function popUp(URL) { day = new Date(); id = day.getTime(); eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=380,height=400');"); } function getnavndx() { if (typeof(window['ni']) != 'undefined') return window['ni']; return 0; var val = getqval('ni'); if (val == '') return -1; else return parseInt(val); } function getqval(key) { var loc = document.location.href; var fnd = key + '='; var sdx = loc.indexOf(fnd); var val = ''; if (sdx > 0) { var edx = loc.indexOf('&', sdx); if (edx > 0) val = loc.substring(sdx + fnd.length, edx); else { edx = loc.indexOf('#'); if (edx > 0) val = loc.substring(sdx + fnd.length, edx); else val = loc.substring(sdx + fnd.length); } } return val.split('+').join(' '); } function init() { navndx = getnavndx() - 1; subnavs = document.getElementsByTagName("subnav"); for (var i = subnavs.length; --i >= 0; ) { //alert(i); if (navndx == i) { var img = null; if (document.all) { var img = subnavs[i].parentNode.parentNode.previousSibling.firstChild.firstChild.firstChild; } else { var tr = subnavs[i].parentNode.parentNode; var tr2 = tr; do { tr2 = tr2.previousSibling; } while (!tr2.tagName || tr2.tagName.toLowerCase() != "tr") var imgs = tr2.getElementsByTagName("img"); if (imgs.length > 0) img = imgs[0]; } if (img) img.src = img.src.substring(0, img.src.length - 4) + "-on.gif"; } if (navndx != i) subnavs[i].parentNode.parentNode.style.display = "none"; } //var pagetitle = getqval('pt'); //alert(pagetitle); //document.title = 'Melatrol Sleeping Aid - ' + pagetitle; //document.getElementById('title').innerHTML = pagetitle; } /* End Melatrol Custom ====================================================================== */ function GetMyCookieVal(offset) { var endstr = document.cookie.indexOf ( ";", offset ) ; if ( endstr == -1 ) endstr = document.cookie.length ; return unescape(document.cookie.substring(offset, endstr) ) ; } function GetMyCookie(name) { var arg = name + "=" ; var alen = arg.length ; var i = 0 ; var clen = document.cookie.length ; while (i < clen) { var j = i + alen if ( document.cookie.substring(i,j) == arg ) { var v = GetMyCookieVal (j) ; return v ; } i = document.cookie.indexOf (" ", i) + 1 ; if ( i == 0 ) break ; } return null ; } function read_querystring() { var a_out = new Object(); //a_out[0] = ""; var s_loc = String(location.href); //alert(s_loc); if(s_loc.indexOf('?')>0) { var p; var s_query = s_loc.substr(s_loc.indexOf('?')+1); var a_query = s_query ? s_query.split('&') : new Array(); for(var i=0; i 0) { offset = document.cookie.indexOf(search) if (offset != -1) { offset += search.length end = document.cookie.indexOf(";", offset); if (end == -1) end = document.cookie.length; returnvalue=unescape(document.cookie.substring(offset, end)) } } return returnvalue; } function loadornot() { if (get_cookie('poppedup')=='') { //setTimeout("popUnder()", 8000); // openpopup(); //document.cookie="poppedup=yes" } } loadornot() function popUnder() { url = "../ata/index.htm"; newwin = Window.open(url,'',''); //newwin.blur(); self.focus(); setTimeout("self.focus()",300); } var day=""; var month=""; var myweekday=""; var year=""; mydate = new Date(); myday = mydate.getDay(); mymonth = mydate.getMonth(); myweekday= mydate.getDate(); weekday= myweekday; myyear= mydate.getYear(); year = myyear if(myday == 0) day = " Sunday, " else if(myday == 1) day = " Monday, " else if(myday == 2) day = " Tuesday, " else if(myday == 3) day = " Wednesday, " else if(myday == 4) day = " Thursday, " else if(myday == 5) day = " Friday, " else if(myday == 6) day = " Saturday, " if(mymonth == 0) { month = "January "} else if(mymonth ==1) month = "February " else if(mymonth ==2) month = "March " else if(mymonth ==3) month = "April " else if(mymonth ==4) month = "May " else if(mymonth ==5) month = "June " else if(mymonth ==6) month = "July " else if(mymonth ==7) month = "August " else if(mymonth ==8) month = "September " else if(mymonth ==9) month = "October " else if(mymonth ==10) month = "November " else if(mymonth ==11) month = "December " function openpopuptos() { var popurl="tos.php" winpops=window.open(popurl,"","width=600,height=500,scrollbars,") } function openpopupcopyright() { var popurl="copyright.php" winpops=window.open(popurl,"","width=600,height=500,scrollbars,") } function fillbill() { if ( document.form.sameshipping.checked == true ) { document.form.elements['formData[x_First_Name]'].value = document.form.elements['formData[x_Ship_to_First_Name]'].value; document.form.elements['formData[x_Last_Name]'].value = document.form.elements['formData[x_Ship_to_Last_Name]'].value; document.form.elements['formData[x_Email]'].value = document.form.elements['formData[x_Ship_to_Email]'].value; document.form.elements['formData[x_Address]'].value = document.form.elements['formData[x_Ship_to_Address]'].value; document.form.elements['formData[x_City]'].value = document.form.elements['formData[x_Ship_to_City]'].value; document.form.elements['formData[x_State]'].value = document.form.elements['formData[x_Ship_to_State]'].value; document.form.elements['formData[x_Zip]'].value = document.form.elements['formData[x_Ship_to_Zip]'].value; document.form.elements['formData[x_Country]'].selectedIndex = document.form.elements['formData[x_Ship_to_Country]'].selectedIndex; document.form.elements['formData[x_Country]'].selectedIndex = document.form.elements['formData[x_Ship_to_Country]'].selectedIndex; } } function autofillbill() { document.form.elements['formData[x_First_Name]'].value = document.form.elements['formData[x_Ship_to_First_Name]'].value; document.form.elements['formData[x_Last_Name]'].value = document.form.elements['formData[x_Ship_to_Last_Name]'].value; document.form.elements['formData[x_Email]'].value = document.form.elements['formData[x_Ship_to_Email]'].value; document.form.elements['formData[x_Address]'].value = document.form.elements['formData[x_Ship_to_Address]'].value; document.form.elements['formData[x_City]'].value = document.form.elements['formData[x_Ship_to_City]'].value; document.form.elements['formData[x_State]'].value = document.form.elements['formData[x_Ship_to_State]'].value; document.form.elements['formData[x_Zip]'].value = document.form.elements['formData[x_Ship_to_Zip]'].value; selCountry = document.form.elements['formData[x_Ship_to_Country]'] document.form.elements['formData[x_Country]'].value = selCountry.options[selCountry.selectedIndex].value; } function js_in_array(the_needle, the_haystack){ var the_hay = the_haystack.toString(); if(the_hay == ''){ return false; } var the_pattern = new RegExp(the_needle, 'g'); var matched = the_pattern.test(the_haystack); return matched; } function js_get_index_at(the_needle, the_haystack) { for(var i=0; i= 2 ) { ship_find_state = ship_state_text.value.substring(0,2); } /// TEXT OFF /// DROP ON ship_state_text_row.className = 'ordertextOFF'; ship_state_drop_row_can.className = 'ordertextOFF'; ship_state_drop_can.disabled = true; //ship_state_text.disabled = true; ship_state_drop_row.className = 'ordertext'; ship_state_drop.disabled = false; /// SET DROP if ( ship_state_drop.selectedIndex < 1 ) { ship_state_drop.selectedIndex = js_get_index_at(ship_find_state.toUpperCase(),the_states); } } else if ( ship_country.options[ship_country.selectedIndex].value == 'CA' ) { /// ATTEMPT TO FIND THE MATCHING DROP STATE if ( ship_state_text.value != undefined && ship_state_text.value.length >= 2 ) { ship_find_state = ship_state_text.value.substring(0,2); } /// TEXT OFF /// DROP ON ship_state_text_row.className = 'ordertextOFF'; ship_state_drop_row.className = 'ordertextOFF'; ship_state_drop.disabled = true; //ship_state_text.disabled = true; ship_state_drop_row_can.className = 'ordertext'; ship_state_drop_can.disabled = false; /// SET DROP if ( ship_state_drop_can.selectedIndex < 1 ) { ship_state_drop_can.selectedIndex = js_get_index_at(ship_find_state.toUpperCase(),can_states); } } else { /// TEXT ON /// DROP OFF ship_state_text_row.className = 'ordertext'; ship_state_text.disabled = false; ship_state_drop_row.className = 'ordertextOFF'; ship_state_drop.disabled = true; ship_state_drop_row_can.className = 'ordertextOFF'; ship_state_drop_can.disabled = true; } /// BILL HANDLE - US if ( bill_country.options[bill_country.selectedIndex].value == 'US' ) { /// ATTEMPT TO FIND THE MATCHING DROP STATE if ( bill_state_text.value != undefined && bill_state_text.value.length >= 2 ) { bill_find_state = bill_state_text.value.substring(0,2); } /// TEXT OFF /// DROP ON bill_state_text_row.className = 'ordertextOFF'; bill_state_drop_row.className = 'ordertextOFF'; bill_state_drop_can.disabled = true; //bill_state_text.disabled = true; bill_state_drop_row.className = 'ordertext'; bill_state_drop.disabled = false; /// SET DROP if ( bill_state_drop.selectedIndex < 1 ) { bill_state_drop.selectedIndex = js_get_index_at(bill_find_state.toUpperCase(),the_states); } } else if ( bill_country.options[bill_country.selectedIndex].value == 'CA' ) { /// ATTEMPT TO FIND THE MATCHING DROP STATE if ( bill_state_text.value != undefined && bill_state_text.value.length >= 2 ) { bill_find_state = bill_state_text.value.substring(0,2); } /// TEXT OFF /// DROP ON bill_state_text_row.className = 'ordertextOFF'; bill_state_drop_row.className = 'ordertextOFF'; bill_state_drop.disabled = true; //bill_state_text.disabled = true; bill_state_drop_row_can.className = 'ordertext'; bill_state_drop_can.disabled = false; /// SET DROP if ( bill_state_drop_can.selectedIndex < 1 ) { bill_state_drop_can.selectedIndex = js_get_index_at(bill_find_state.toUpperCase(),can_states); } } else { /// TEXT ON /// DROP OFF bill_state_text_row.className = 'ordertext'; bill_state_text.disabled = false; bill_state_drop_row.className = 'ordertextOFF'; bill_state_drop.disabled = true; bill_state_drop_row_can.className = 'ordertextOFF'; bill_state_drop_can.disabled = true; } } function adjustBillShip() { tb = document.getElementById('bill_table'); if ( document.forms['form'].elements['sameshipping'].checked ) { tb.className = 'ordertextOFF'; } else { tb.className = 'body'; } }