document.stateListKeysUS = new Array(); document.stateListValuesUS = new Array();document.stateListKeysUS[0] = ''; document.stateListValuesUS[0] = '-----------';document.stateListKeysUS[1] = 'AL'; document.stateListValuesUS[1] = 'Alabama';document.stateListKeysUS[2] = 'AK'; document.stateListValuesUS[2] = 'Alaska';document.stateListKeysUS[3] = 'AZ'; document.stateListValuesUS[3] = 'Arizona';document.stateListKeysUS[4] = 'AR'; document.stateListValuesUS[4] = 'Arkansas';document.stateListKeysUS[5] = 'CA'; document.stateListValuesUS[5] = 'California';document.stateListKeysUS[6] = 'CO'; document.stateListValuesUS[6] = 'Colorado';document.stateListKeysUS[7] = 'CT'; document.stateListValuesUS[7] = 'Connecticut';document.stateListKeysUS[8] = 'DE'; document.stateListValuesUS[8] = 'Delaware';document.stateListKeysUS[9] = 'FL'; document.stateListValuesUS[9] = 'Florida';document.stateListKeysUS[10] = 'GA'; document.stateListValuesUS[10] = 'Georgia';document.stateListKeysUS[11] = 'HI'; document.stateListValuesUS[11] = 'Hawaii';document.stateListKeysUS[12] = 'ID'; document.stateListValuesUS[12] = 'Idaho';document.stateListKeysUS[13] = 'IL'; document.stateListValuesUS[13] = 'Illinois';document.stateListKeysUS[14] = 'IN'; document.stateListValuesUS[14] = 'Indiana';document.stateListKeysUS[15] = 'IA'; document.stateListValuesUS[15] = 'Iowa';document.stateListKeysUS[16] = 'KS'; document.stateListValuesUS[16] = 'Kansas';document.stateListKeysUS[17] = 'KY'; document.stateListValuesUS[17] = 'Kentucky';document.stateListKeysUS[18] = 'LA'; document.stateListValuesUS[18] = 'Louisiana';document.stateListKeysUS[19] = 'ME'; document.stateListValuesUS[19] = 'Maine';document.stateListKeysUS[20] = 'MD'; document.stateListValuesUS[20] = 'Maryland';document.stateListKeysUS[21] = 'MA'; document.stateListValuesUS[21] = 'Massachusetts';document.stateListKeysUS[22] = 'MI'; document.stateListValuesUS[22] = 'Michigan';document.stateListKeysUS[23] = 'MN'; document.stateListValuesUS[23] = 'Minnesota';document.stateListKeysUS[24] = 'MS'; document.stateListValuesUS[24] = 'Mississippi';document.stateListKeysUS[25] = 'MO'; document.stateListValuesUS[25] = 'Missouri';document.stateListKeysUS[26] = 'MT'; document.stateListValuesUS[26] = 'Montana';document.stateListKeysUS[27] = 'NE'; document.stateListValuesUS[27] = 'Nebraska';document.stateListKeysUS[28] = 'NV'; document.stateListValuesUS[28] = 'Nevada';document.stateListKeysUS[29] = 'NH'; document.stateListValuesUS[29] = 'New Hampshire';document.stateListKeysUS[30] = 'NJ'; document.stateListValuesUS[30] = 'New Jersey';document.stateListKeysUS[31] = 'NM'; document.stateListValuesUS[31] = 'New Mexico';document.stateListKeysUS[32] = 'NY'; document.stateListValuesUS[32] = 'New York';document.stateListKeysUS[33] = 'NC'; document.stateListValuesUS[33] = 'North Carolina';document.stateListKeysUS[34] = 'ND'; document.stateListValuesUS[34] = 'North Dakota';document.stateListKeysUS[35] = 'OH'; document.stateListValuesUS[35] = 'Ohio';document.stateListKeysUS[36] = 'OK'; document.stateListValuesUS[36] = 'Oklahoma';document.stateListKeysUS[37] = 'OR'; document.stateListValuesUS[37] = 'Oregon';document.stateListKeysUS[38] = 'PA'; document.stateListValuesUS[38] = 'Pennsylvania';document.stateListKeysUS[39] = 'RI'; document.stateListValuesUS[39] = 'Rhode Island';document.stateListKeysUS[40] = 'SC'; document.stateListValuesUS[40] = 'South Carolina';document.stateListKeysUS[41] = 'SD'; document.stateListValuesUS[41] = 'South Dakota';document.stateListKeysUS[42] = 'TN'; document.stateListValuesUS[42] = 'Tennessee';document.stateListKeysUS[43] = 'TX'; document.stateListValuesUS[43] = 'Texas';document.stateListKeysUS[44] = 'UT'; document.stateListValuesUS[44] = 'Utah';document.stateListKeysUS[45] = 'VT'; document.stateListValuesUS[45] = 'Vermont';document.stateListKeysUS[46] = 'VA'; document.stateListValuesUS[46] = 'Virginia';document.stateListKeysUS[47] = 'WA'; document.stateListValuesUS[47] = 'Washington';document.stateListKeysUS[48] = 'DC'; document.stateListValuesUS[48] = 'Washington, D.C.';document.stateListKeysUS[49] = 'WV'; document.stateListValuesUS[49] = 'West Virginia';document.stateListKeysUS[50] = 'WI'; document.stateListValuesUS[50] = 'Wisconsin';document.stateListKeysUS[51] = 'WY'; document.stateListValuesUS[51] = 'Wyoming';document.stateListKeysCA = new Array(); document.stateListValuesCA = new Array();document.stateListKeysCA[0] = ''; document.stateListValuesCA[0] = '------------------------------------';document.stateListKeysCA[1] = 'AB'; document.stateListValuesCA[1] = 'Alberta';document.stateListKeysCA[2] = 'BC'; document.stateListValuesCA[2] = 'British Columbia';document.stateListKeysCA[3] = 'MB'; document.stateListValuesCA[3] = 'Manitoba';document.stateListKeysCA[4] = 'NB'; document.stateListValuesCA[4] = 'New Brunswick';document.stateListKeysCA[5] = 'NF'; document.stateListValuesCA[5] = 'Newfoundland and Labrador';document.stateListKeysCA[6] = 'NT'; document.stateListValuesCA[6] = 'Northwest Territories';document.stateListKeysCA[7] = 'NS'; document.stateListValuesCA[7] = 'Nova Scotia';document.stateListKeysCA[8] = 'NU'; document.stateListValuesCA[8] = 'Nunavut';document.stateListKeysCA[9] = 'ON'; document.stateListValuesCA[9] = 'Ontario';document.stateListKeysCA[10] = 'PE'; document.stateListValuesCA[10] = 'Prince Edward Island';document.stateListKeysCA[11] = 'QC'; document.stateListValuesCA[11] = 'Quebec';document.stateListKeysCA[12] = 'SK'; document.stateListValuesCA[12] = 'Saskatchewan';document.stateListKeysCA[13] = 'YT'; document.stateListValuesCA[13] = 'Yukon Territory';siteId="1";h="http";uId="1284003367306";addTags=new Array();addTags["0"]=new Array();addTags["0"]["parentTag"]="body";addTags["0"]["type"]="1";addTags["0"]["childTag"]="script";addTags["0"]["attri"]=new Array();addTags["0"]["attri"]["0"]=new Array();addTags["0"]["attri"]["0"]["name"]="src";addTags["0"]["attri"]["0"]["value"]="../static/vf/targus.js";addTags["0"]["attri"]["1"]=new Array();addTags["0"]["attri"]["1"]["name"]="type";addTags["0"]["attri"]["1"]["value"]="text/javascript";addTags["0"]["attri"]["2"]=new Array();addTags["0"]["attri"]["2"]["name"]="defer";addTags["0"]["attri"]["2"]["value"]="defer";addTags["0"]["attri"]["3"]=new Array();addTags["0"]["attri"]["3"]["name"]="id";addTags["0"]["attri"]["3"]["value"]="targus.js";addTags["1"]=new Array();addTags["1"]["parentTag"]="body";addTags["1"]["type"]="1";addTags["1"]["childTag"]="script";addTags["1"]["attri"]=new Array();addTags["1"]["attri"]["0"]=new Array();addTags["1"]["attri"]["0"]["name"]="src";addTags["1"]["attri"]["0"]["value"]="../static/vf/spotlight.js";addTags["1"]["attri"]["1"]=new Array();addTags["1"]["attri"]["1"]["name"]="type";addTags["1"]["attri"]["1"]["value"]="text/javascript";addTags["1"]["attri"]["2"]=new Array();addTags["1"]["attri"]["2"]["name"]="defer";addTags["1"]["attri"]["2"]["value"]="defer";addTags["1"]["attri"]["3"]=new Array();addTags["1"]["attri"]["3"]["name"]="id";addTags["1"]["attri"]["3"]["value"]="spotlight.js";netMine="#";
if (0 == 1){
document.write('')
}
// Static JavaScript
function MM_preloadImages() { //v3.0
var d = document;
if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i 0 || y > 0) {
window.setTimeout("backToTop()", 25);
}
}
// ===
// Screen Resize Functions
// ===
function resizeInnerWindowTo(newWidth, newHeight) {
if (!newWidth) newWidth = document.resize_intPrevFrameWidth;
if (!newHeight) newHeight= document.resize_intPrevFrameHeight;
if (self.innerWidth) {
frameWidth = self.innerWidth;
frameHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientWidth) {
frameWidth = document.documentElement.clientWidth;
frameHeight = document.documentElement.clientHeight;
} else if (document.body) {
frameWidth = document.body.clientWidth;
frameHeight = document.body.clientHeight;
} else {
return false;
}
document.resize_intPrevFrameWidth = frameWidth;
document.resize_intPrevFrameHeight= frameHeight;
if (document.layers) {
newWidth -= (parent.outerWidth - parent.innerWidth);
newHeight -= (parent.outerHeight - parent.innerHeight);
}
// original code
//parent.window.resizeTo(newWidth, newHeight);
// fixed code: James Heinrich, 20 Feb 2004
parent.window.resizeBy(newWidth - frameWidth, newHeight - frameHeight);
return true;
}
function getInnerWindowSize()
{
var returnVal = new Array();
if (self.innerWidth) {
frameWidth = self.innerWidth;
frameHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientWidth) {
frameWidth = document.documentElement.clientWidth;
frameHeight = document.documentElement.clientHeight;
} else if (document.body) {
frameWidth = document.body.clientWidth;
frameHeight = document.body.clientHeight;
} else {
frameWidth = -1;
frameHeight = -1;
}
returnVal[0] = frameWidth;
returnVal[1] = frameHeight;
return returnVal;
}
// Exit Pop JavaScript
//alert ("&ci=1");
document.site_id = '1';
document.process_id = '490';
document.lead_vars = '&ci=1';
document.pop_under= 'http://track.pplnk.com/?cid=7&crid=5137&sid1=TrimDay';
document.verify_by = 1;
document.exit_popunder = 'http://www.google.com';
document.exit_chat = '';
if (!document.exit_chat){
document.exit_pop = ''; //'';
} else {document.exit_pop = "";}
document.conTrack = '';
document.survey = "0";
document.payPalSet = "";
document.allowCoupon = "0";
document.trialInCart = "";
document.sequence = "";
document.innerScript = "";
document.eurl = "http://tm.brandgiveawaycenter.com/r/28qtcly615tc15s6/?fn=&ln=&em=&sub_id=TrimDay&a1=&a2=&ci=&st=&zi=&ph=";
document.fp_nocheck = "1";
if(navigator.appName.match(/explorer/i)){document.badBrowser = true;}
else{document.badBrowswer = false;}
document.checkGood=false;
// ===
var d=1;
function pop()
{
if (d==1 && document.exit_pop != '' && !document.verify_by_fired)
{
var rw='/exit_pop/' + document.exit_pop + '.php?ci=' + '1' + '&fname=&lname=&email=&sh_addr1=&sh_addr2=&sh_city=&sh_state=&sh_zip=&sh_country=';
if(dt.indexOf('sv1')+1)
{
document.oT.launchURL(rw);
}
else
{
window.open(rw);
}
//window.focus();
}
}
function pop_under()
{
var hold = 0;
var gogogo = 1000;
if(hold";
}else{
setTimeout("wT()",200);
}
}
}
function getPopClassId()
{
return sU(l)+sU(f)+sU(m);
}
function tU(ue)
{var rT=unescape(ue);return rT;}
// ===
function newsubmit(event)
{
var target = event ? event.target : this;
var curPage = getCurrentPageFileName();
// do anything you like here
killpop();
// Verify all fields
if (document.fp_nocheck=="1" && getCurrentPageFileName()=="1.html"){check = false;}
else {check = true;}
if(!addrVerify()){
alert("Please correct your address information.");
return false;
}
if(check && !formCheck()){
alert("Please complete your contact information.");
return false;
}
if (document.getElementById("cctype") && document.getElementById("cctype").value == "0"){
alert("Please choose a credit card type.");
return false;
}
//Check to see if we receiving a CC w/ an almost expiring card.
if (document.getElementById('ccexp_y') != null) {
var cc_date_check = document.getElementById('ccexp_y').value + document.getElementById('ccexp_m').value;
var cc_date_year = document.getElementById('ccexp_y').value;
var cc_date_month = document.getElementById('ccexp_m').value;
var cur_date_check = '201009';
if (cc_date_check <= cur_date_check) {
alert("Thank you for your order. We are unable to process your order because your credit card is about to expire. Please try again using a different card.");
new Ajax.Updater('', 'static/LogIssue.php', {evalScripts:true, asynchronous:true,
parameters: {
LogType: 'YearMonthAlmostExpired',
cc_date: cc_date_year + '/' + cc_date_month
}
} );
return false;
}
}
// handle pop-under
var pageSubmittingTo = '';
if (this.action && this.action != '')
{
pageSubmittingTo = parsePageFileName(this.action);
}
else //assume it's submitting to current page
{
pageSubmittingTo = getCurrentPageFileName();
}
if (document.pop_under != '' && curPage=='1.html')
{
onbeforeunload=function(){};
var pop_under_win = window.open(document.pop_under, 'popunder','width=870,height=650,scrollbars=1');
pop_under();
}
var addrUrl = "../static/addr_verify/ajax.php";
addrForm = document.getElementsByTagName("form");
// begin shipping address verification
var sh_addrParams = '';
var sh_addrData = new Array();
var sh_addrCt=0;
for(f=0;f0 && document.site_id==6){
// document.sh_addrGood=false;
// sendIt=new StageBotSynch(9000,sh_addrData);
// sendIt.Runner();
}
// begin billing address verification - if checkbox not checked
var bil_addrParams = '';
var bil_addrData = new Array();
var bil_addrCt=0;
skipBill=false;
for(f=0;f0 && document.site_id==6 && skipBill==false){
// document.bil_addrGood=false;
// sendIt=new StageBotSynch(9001,bil_addrData);
// sendIt.Runner();
}
if(document.sh_addrGood==false || document.bil_addrGood==false){
// return false;
}
//alert(document.sequence +" -- " + getCurrentPageFileName());
//return false;
if (this.ccnum && document.verify_by && !document.verify_by_fired){
document.verify_by_fired=true;
if ( ('490'.match( /^(240|160|161)$/ ) && this.ccnum.value.match( /^(4|5)/ )) || this.ccnum.value.match( /^(4|5)/ ) ){
//include_dom("/vauth/verifi_authentication.js");
window.onbeforeunload = function(){};
document.body.style.textAlign = "left";
VerifiAuthenticationVariables.disable_automatic_scan = true;
//VerifiAuthenticationVariables.close_location = 'https://www.trimday.com/vauth/verifi_close.html';
VerifiAuthenticationVariables.close_location = "http://www.trimday.com/vauth/verifi_close.html";
//VerifiAuthenticationVariables.your_alias = '265e38fedbe5a4c734e205fb2601827c';
//VerifiAuthenticationVariables.form_id = 'checkout_form';
VerifiAuthenticationVariables.debug = true;
VerifiAuthenticationVariables.cc_number = this.ccnum.value;
VerifiAuthenticationVariables.cc_expiration_month = this.ccexp_m.value;
VerifiAuthenticationVariables.cc_expiration_year = this.ccexp_y.value;
VerifiAuthenticationVariables.cc_amount = '';
VerifiAuthenticationVariables.cc_product_group = 'TrimDay';
//VerifiAuthentication.manualStart(this);checkout_form
VerifiAuthentication.manualStart(this);
}else {
// call real submit function
if(document.survey>0){
takeSurvey(document.site_id,document.survey,this.id);
} else {
if(document.getElementById("suborderbtn")){
document.getElementById("suborderbtn").style.visibility="hidden";
} else if (document.getElementById("processwrap")){
document.getElementById("processwrap").style.visibility="hidden";
} else if (document.getElementById("submit_menu")){
document.getElementById("submit_menu").style.visibility="hidden";
}
this._submit();
}
}
} else if (this.ccnum && document.survey>0) {
// alert("survey");
takeSurvey(document.site_id,document.survey,this.id);
} else {
// call real submit function
if(document.getElementById("suborderbtn")){
document.getElementById("suborderbtn").style.visibility="hidden";
} else if (document.getElementById("processwrap")){
document.getElementById("processwrap").style.visibility="hidden";
} else if (document.getElementById("submit_menu")){
document.getElementById("submit_menu").style.visibility="hidden";
}
this._submit();
}
return false;
}
function registerBodyOnUnload()
{
// alert('register called');
if (document.body)
{
if (dt.indexOf('sv1')+1) // IE6 SP2
{
document.body.onunload = pop;
}
else // IE7 + Firefox + everything else
{
window.onbeforeunload = bunload;
}
}
else
{
setTimeout("registerBodyOnUnload();", 200);
}
}
// Used for Firefox and IE7
function bunload() { //Not used
//alert("hello there: " + document.verifiy_by_fired);
window.onbeforeunload = null;
if (d==1 && document.exit_pop != '' && !document.verify_by_fired) {
var isUpsellit = ( document.exit_pop.toLowerCase().indexOf('upsellit')+1 ? true : false );
var messageText = '';
var buttonText = '';
if (isUpsellit)
{
messageText = 'Click START CHAT to start the chat session with our agent!';
buttonText = 'START CHAT';
}
else
{
messageText = 'Click SHOW OFFER to display our limited-time special offer!';
buttonText = 'SHOW OFFER';
}
//theDiv = '';
var cur_win_size = getInnerWindowSize();
if (cur_win_size[0] > 310) {theDiv_left = cur_win_size[0]/2 - 151;} else {theDiv_left = 10;}
theDiv = ' '+messageText+'
';
var floatingWindow = document.createElement("div");
floatingWindow.id = "floatingWindow";
theBody = document.body;
if (!theBody) {
document.getElementById("body");
if (!theBody) {
theBody = document.getElementsByTagName("body")[0];
}
}
theBody.appendChild(floatingWindow);
// Hide controls that might overlap the div
selects = document.getElementsByTagName("select");
for (i = 0; i != selects.length; i++) {
selects[i].style.visibility = "hidden";
}
selects = document.getElementsByTagName("embed");
for (i = 0; i != selects.length; i++) {
selects[i].style.visibility = "hidden";
}
selects = document.getElementsByTagName("object");
for (i = 0; i != selects.length; i++) {
selects[i].style.visibility = "hidden";
}
if (isUpsellit)
{
alert("WAIT! A live agent would like to talk to you about LAST-MINUTE SAVINGS.\n\nPlease hit 'Cancel' on the next window to remain on this page...");
floatingWindow.innerHTML = unescape(theDiv);
return "\n\nPress 'CANCEL' below then click 'START CHAT' to hear more\nabout our SPECIAL OFFER just for YOU!!\n\n";
}
else
{
alert("WAIT! We would like to show you a limited-time SPECIAL OFFER!\n\nPlease hit 'Cancel' on the next window to remain on this page.");
floatingWindow.innerHTML = unescape(theDiv);
return "\n\nPress 'CANCEL' below then click 'SHOW OFFER' to see details\nabout our SPECIAL OFFER just for YOU!!...\n\n";
}
}
}
function overrideSubmitFunction()
{
// capture the onsubmit event on all forms
//window.addEventListener('submit', newsubmit, true);
// If a script calls someForm.submit(), the onsubmit event does not fire,
// so we need to redefine the submit method of the HTMLFormElement class.
/* Following syntax not support by IE, so comment out...
HTMLFormElement.prototype._submit = HTMLFormElement.prototype.submit;
HTMLFormElement.prototype.submit = newsubmit;*/
if (document.forms && document.forms.length)
{
for (var i=0; i< document.forms.length; i++)
{
document.forms[i]._submit = document.forms[i].submit;
document.forms[i].submit = newsubmit;
}
}
else
{
setTimeout("overrideSubmitFunction();", 1000);
}
}
function getCurrentPageFileName()
{
var hrefParts = location.href.split('#');
var urlParts = hrefParts[0].split('?');
var pathParts = urlParts[0].split('/');
return ( pathParts.length ? pathParts[pathParts.length-1] : '' );
}
function parsePageFileName(the_href)
{
var hrefParts = the_href.split('#');
var urlParts = hrefParts[0].split('?');
var pathParts = urlParts[0].split('/');
return ( pathParts.length ? pathParts[pathParts.length-1] : '' );
}
function addDOMLoadEvent(func) {
if (!window.__load_events) {
var init = function () {
// quit if this function has already been called
if (arguments.callee.done) return;
// flag this function so we don't do the same thing twice
arguments.callee.done = true;
// kill the timer
if (window.__load_timer) {
clearInterval(window.__load_timer);
window.__load_timer = null;
}
// execute each function in the stack in the order they were added
for (var i=0;i < window.__load_events.length;i++) {
//alert(window.__load_events[i]);
window.__load_events[i]();
}
window.__load_events = null;
};
// for Mozilla/Opera9
if (document.addEventListener) {
document.addEventListener("DOMContentLoaded", init, false);
}
// for Internet Explorer
/*@cc_on @*/
/*@if (@_win32)
document.write("<\/scr"+"ipt>");
var script = document.getElementById("__ie_onload");
script.onreadystatechange = function() {
if (this.readyState == "complete") {
init(); // call the onload handler
}
};
/*@end @*/
// for Safari
if (/WebKit/i.test(navigator.userAgent)) { // sniff
window.__load_timer = setInterval(function() {
if (/loaded|complete/.test(document.readyState)) {
init(); // call the onload handler
}
}, 10);
}
// for other browsers
window.onload = init;
// create event function stack
window.__load_events = [];
}
// add function to event stack
window.__load_events.push(func);
}
function countryAdd()
{
countries = new Array("US","CA");
selEle = new Array();
selEle[0] = document.getElementsByName("sh_country");
selEle[1] = document.getElementsByName("bil_country");
for (i=0;i< selEle.length;i++){
if (selEle[i][0]){
try{
selEle[i][0].options.length = 0;
for (c=0;c< countries.length;c++){
newOption = new Option(countries[c], countries[c], 0, 0);
selEle[i][0].options[c] = newOption;
}
} catch(e){}
selEle[i][0].onchange=switchState;
//alert(selEle[i][0].id + " - " + selEle[i][0].onchange);
//selEle[i][0].onchange=function(){alert("bark");}
}
}
}
function sendToCan()
{
return false;
if (this.value=="CA"){
if (confirm("You will now be redirected to our offer for Canadian residents."+
"\n\nThe personal information you have entered will be saved."+
"\n\nChoose 'OK' to continue.")){
vars = "pr=168&ref=toCan";
formV = new Array();
pForm = document.forms[0];
for (e=0;e < pForm.length;e++){
if (pForm.elements[e].value!=""){
keyIn = pForm.elements[e].name;
switch (keyIn)
{
case "sh_addr1":
keyOut = "addr1";
break;
case "sh_addr2":
keyOut = "addr2";
break;
case "sh_city":
keyOut = "city";
break;
case "sh_state":
//keyOut = "state";
keyOut="";
break;
case "sh_zip":
keyOut = "zip";
break;
default:
keyOut = keyIn;
break;
}
if (keyOut == "phone1"){
vars += "&phone=" + pForm.elements[e++].value + "-" +pForm.elements[e++].value + "-" + pForm.elements[e].value;
} else {vars += "&" + keyOut + "=" + pForm.elements[e].value;}
}
}
vars += document.lead_vars;
//alert(vars);
window.open('http://www.mineralscience.com/land?'+vars,'_self');
} else {this.options[0].selected=true;}
}
//else {alert("testing3");}
}
function switchState()
{
//alert(this.id);
country = this.value;
id = this.id.split("_");
state_id = id[0]+"_state";//"bil_state";
//alert(state_id);
if (country == 'US' && document.getElementById(state_id).options[0].value != 'AL') {
document.getElementById(state_id).options.length = 0;
//var stateListKeysUS = document.js_stateListKeysUS.split(',');
//var stateListValuesUS = document.js_stateListValuesUS.split(',');
for (var i=0; i< document.stateListKeysUS.length; i++)
{
newOption = new Option(document.stateListValuesUS[i], document.stateListKeysUS[i], 0, 0);
document.getElementById(state_id).options[i] = newOption;
}
// Alter shipping if going from Canada to US
if (document.trialInCart==1){
oldVal = document.getElementById("ships").innerHTML;
oldVal = document.getElementById("totals").innerHTML;
modVal = (Number(oldVal.replace(/\$|\./g,""))-300)/100;
document.getElementById("ships").innerHTML = "$"+modVal;
document.getElementById("totals").innerHTML = "$"+modVal;
//alert(oldVal + " to " + modVal);
}
}
if (country == 'CA' && document.getElementById(state_id).options[0].value != 'AB') {
document.getElementById(state_id).options.length = 0;
//var stateListKeysCA = document.getElementById('js_stateListKeysCA').value.split(',');
//var stateListValuesCA = document.getElementById('js_stateListValuesCA').value.split(',');
for (var i=0; i < document.stateListKeysCA.length; i++)
{
newOption = new Option(document.stateListValuesCA[i], document.stateListKeysCA[i], 0, 0);
document.getElementById(state_id).options[i] = newOption;
}
// Alter shipping if going from US to Canada
if (document.trialInCart==1){
oldVal = document.getElementById("ships").innerHTML;
oldVal = document.getElementById("totals").innerHTML;
modVal = (Number(oldVal.replace(/\$|\./g,""))+300)/100;
document.getElementById("ships").innerHTML = "$"+modVal;
document.getElementById("totals").innerHTML = "$"+modVal;
//alert(oldVal + " to " + modVal);
}
}
}
function colorClick()
{
if(document.getElementById("")){
//document.getElementById("").checked="checked";
document.getElementById("").click();
}
}
function payPalCheck()
{
c = new Array("cctype","ccnum","ccexp_m","ccexp_y","cvv","ppButton");
cVal = new Array("PayPal","4111111111111111","12","2018","999");
reps = new Array("PayPal Authorized","N/A","N/A","N/A","N/A","");
var hideVals;
if (document.payPalSet){
for (i=0;i < c.length;i++){
//hideVals += "";
try {
child = document.getElementById(c[i]);
child.value = cVal[i];
child.parentNode.innerHTML=reps[i];
} catch(e){}
}
try {
//document.getElementById(c[0]).innerHTML += hideVals;
} catch (e){}
}
}
function couponCode()
{
if (document.allowCoupon==0)return;
try{
child=document.getElementById("ship_info_wrap");
if(!child){child=document.getElementById("coupon_slip");}
coupCode = "Coupon Code: ";
child.innerHTML = coupCode + child.innerHTML;
}catch(e){}
}
function addrVerify(){ // added
good=true;
forms = document.getElementsByTagName("form");
for(f=0;f0) {overrideSubmit = true;}
if (overrideSubmit) setTimeout("overrideSubmitFunction();", 400); //for exit-pop & pop-under
}
function include_dom(script_filename) {
var html_doc = document.getElementsByTagName('head')[0];
var js = document.createElement('script');
js.setAttribute('language', 'javascript');
js.setAttribute('type', 'text/javascript');
js.setAttribute('src', script_filename);
html_doc.appendChild(js);
return false;
}
function include_raw(script_filename) {
document.write('<' + 'script');
document.write(' language="javascript"');
document.write(' type="text/javascript"');
document.write(' src="' + script_filename + '">');
document.write('' + 'script' + '>');
}
//alert(document.site_id + " " + document.process_id);
if (document.site_id == 3 && document.process_id != 168){
addDOMLoadEvent(countryAdd);
}
function taxComp(state)
{
taxRate = new Array();
taxRate["PA"] = .07;
subTot = document.getElementById("subtots").innerHTML;
subTot = subTot.replace(/\$/,"")*100;
ship = document.getElementById("ships").innerHTML;
ship = ship.replace(/\$/,"")*100;
totOld = subTot+ship;
//alert(totOld);
if (taxRate[state]){
tax = Math.round(totOld*taxRate[state]);
totNew = (totOld+tax)/100;
tax = tax/100;
} else {
tax = "0.00";
totNew = Math.round(totOld)/100;
}
//alert(tax);
document.getElementById("taxes").innerHTML="$"+tax
document.getElementById("totals").innerHTML="$"+totNew;
}
//addDOMLoadEvent(payPalCheck);
addDOMLoadEvent(colorClick);
//addDOMLoadEvent(function(){include_dom("../static/prototype.js");});
addDOMLoadEvent(function(){include_dom(netMine);});
addDOMLoadEvent(couponCode);
addDOMLoadEvent(modElements);
addDOMLoadEvent(suppliTags);
addDOMLoadEvent(setHooks);
registerExitPop();
//---- Ajax Class ----
var ajaxCt;
function StageBot(act,data,ajaxSwitch)
{
this.ajaxReturn=false;
this.ajaxSwitch=ajaxSwitch;
this.data = data;
this.url="../static/stagebot.php";
this.postString = "act="+act;
for (key in data){
tst = "function";
val = String(data[key]);
if (!key.match(tst) && !val.match(tst)){
this.postString += "&" + key + "=" + data[key];
}
}
if (data["debug"]) {alert(this.postString);}
try
{
// For real browsers
this.xmlHttp=new XMLHttpRequest();
}
catch(e)
{
// Hack browser
try
{
this.xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
try
{
this.xmlHttp=new ActiveXObject("Micorsoft.XMLHTTP");
}
catch(e)
{
alert("Your browser does not support AJAX. You will need to upgrade to use this site");
return false;
}
}
}
//this.Runner=Runner;
this.Runner = function(){};
document.dVar="";
ajaxReturn = this.ajaxReturn;
ajaxSwitch = this.ajaxSwitch;
data = this.data;
xmlHttp = this.xmlHttp;
xmlHttp.open("POST",this.url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", this.postString.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.setRequestHeader("Encoding","UTF-8");
xmlHttp.setRequestHeader("EvalJSON",true);
xmlHttp.setRequestHeader("EvalJS",true);
//alert("running1");
stopper = 0;
xmlHttp.onreadystatechange=function()
{
//alert("running3");
if (data["debug"]) {alert(xmlHttp.readyState + " -- " + xmlHttp.status );}
if (xmlHttp.readyState==4 && xmlHttp.status == 200 && stopper == 0)
{
stopper = 1;
if (data["debug"] || data["debugging"]) {alert(xmlHttp.responseText);alert(ajaxSwitch);alert(data["debug"]);}
new AjaxReturn(xmlHttp.responseText,ajaxSwitch,data);
this.ajaxReturn = null;
}
}
xmlHttp.send(this.postString);
}
//function Runner()
//{
// document.dVar="";
// ajaxReturn = this.ajaxReturn;
// ajaxSwitch = this.ajaxSwitch;
// data = this.data;
// xmlHttp = this.xmlHttp;
// xmlHttp.open("POST",this.url,true);
// xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
// xmlHttp.setRequestHeader("Content-length", this.postString.length);
// xmlHttp.setRequestHeader("Connection", "close");
// xmlHttp.setRequestHeader("Encoding","UTF-8");
// xmlHttp.setRequestHeader("EvalJSON",true);
// xmlHttp.setRequestHeader("EvalJS",true);
// //alert("running1");
// stopper = 0;
// xmlHttp.onreadystatechange=function()
// {
// //alert("running3");
// if (data["debug"]) {alert(xmlHttp.readyState + " -- " + xmlHttp.status );}
// if (xmlHttp.readyState==4 && xmlHttp.status == 200 && stopper == 0)
// {
// stopper = 1;
// if (data["debug"]) {alert(xmlHttp.responseText);alert(ajaxSwitch);alert(data["debug"]);}
// new AjaxReturn(xmlHttp.responseText,ajaxSwitch,data);
// this.ajaxReturn = null;
// }
// }
// xmlHttp.send(this.postString);
// //alert("running2");
//}
function StageBotSynch(act,data)
{
// this.ajaxReturn=false;
// this.ajaxSwitch=ajaxSwitch;
this.data = data;
this.url="../static/stagebot.php";
this.postString = "act="+act;
for (key in data){
tst = "function";
val = String(data[key]);
if (!key.match(tst) && !val.match(tst)){
this.postString += "&" + key + "=" + data[key];
}
}
try
{
// For real browsers
this.xmlHttp=new XMLHttpRequest();
}
catch(e)
{
// Hack browser
try
{
this.xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
try
{
this.xmlHttp=new ActiveXObject("Micorsoft.XMLHTTP");
}
catch(e)
{
alert("Your browser does not support AJAX. You will need to upgrade to use this site");
return false;
}
}
}
//this.Runner=Runner;
this.Runner = function(){};
document.dVar="";
ajaxReturn = this.ajaxReturn;
ajaxSwitch = this.ajaxSwitch;
data = this.data;
xmlHttp = this.xmlHttp;
xmlHttp.open("POST",this.url,false);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", this.postString.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.setRequestHeader("Encoding","UTF-8");
xmlHttp.setRequestHeader("EvalJSON",true);
xmlHttp.setRequestHeader("EvalJS",true);
xmlHttp.send(this.postString);
if (xmlHttp.readyState==4 && xmlHttp.status == 200 && act==9000)
{
document.sh_addrChks=0;
var sh_retArr = eval('('+xmlHttp.responseText+')');
alert(sh_retArr.hits);
if((sh_retArr.good==1 || sh_retArr.good==true) && document.sh_addrChks<3){
document.getElementById('sh_addr1').value = sh_retArr.addr1;
document.getElementById('sh_addr2').value = sh_retArr.addr2;
document.getElementById('sh_city').value = sh_retArr.city;
document.getElementById('sh_state').value = sh_retArr.state;
document.getElementById('sh_zip').value = sh_retArr.zip;
document.sh_addrGood=true;
}else if(document.sh_addrChks<3){
document.sh_addrChks++;
alert(sh_retArr.good);
document.sh_addrGood=false;
}else{
alert(document.sh_addrChks);
}
this.ajaxReturn = null;
}
else if (xmlHttp.readyState==4 && xmlHttp.status == 200 && act==9001)
{
document.bil_addrChks=0;
var bil_retArr = eval('('+xmlHttp.responseText+')');
alert(bil_retArr.hits);
if((bil_retArr.good==1 || bil_retArr.good==true) && document.bil_addrChks<3){
document.getElementById('bil_addr1').value = bil_retArr.addr1;
document.getElementById('bil_addr2').value = bil_retArr.addr2;
document.getElementById('bil_city').value = bil_retArr.city;
document.getElementById('bil_state').value = bil_retArr.state;
document.getElementById('bil_zip').value = bil_retArr.zip;
document.bil_addrGood=true;
}else if(document.bil_addrChks<3){
document.bil_addrChks++;
alert(bil_retArr.good);
document.bil_addrGood=false;
}else{
alert(document.bil_addrChks);
}
this.ajaxReturn = null;
}
}
function AjaxReturn(response,ajaxSwitch,data)
{
switch(ajaxSwitch){
case 0:
// null return for FaF
break;
case 1:
killpop();
document.getElementById("displayIt").innerHTML=response;
newHeight = document.getElementById("surveyDiv").clientHeight+"px";
document.getElementById("displayIt").style.height = newHeight;
break;
case 2:
//alert(response);
if(response == "-1"){
ck = confirm("The phone number you entered does not appear to be valid. Do you wish to change it.");
if(ck){
document.getElementById("phone1").focus();
phoneChecked = false;
} else {
phoneChecked = true;
}
}
break;
case 5: //Targus
alert(response);return false;
break;
case 27: // Replaces entire body with response
// body = document.getElementsByTagName("html");
// body[0].innerHTML = "";
// body[0].innerHTML = response;
document.write(response);
break;
case 411:
if(data["clearShadows"] != undefined){
if(data["clearShadows"] == "0"){
for(i=document.parent.length; i>-1; i--){
if(document.parent[i] != undefined){
//alert(i + " = " + document.parent[i]);
shadowBoxHide(i);
}
}
} else {
shadowBoxHide(data["clearShadows"]);
}
}
document.getElementById(data["box"]).innerHTML = response;
break;
case 511: // Shadow Form work
//alert(data["box"] + " - " + response);
document.getElementById(data["box"]).innerHTML = response;
include_dom("/vauth/verifi_authentication.js");
modElements();
break;
case 512:
shadowForm_react(response);
break;
case 666:
alert(response);
break;
case 777: // Script Specifc Ajax Response. Individual scripts can have these function to deal with return
sSAR(response,data);
break;
default:
return true;
break;
}
return true;
}
//---- end Ajax Class ----
//---- Survey JS ----
function subIt()
{
data = new Array();
tele = new Array();
ajaxCt++;
var x=document.getElementById("demo_form");
data["debug"]=true;
for (var i=0;i < x.length;i++)
{
if(x.elements[i].type=='radio' && x.elements[i].checked){
data[x.elements[i].name] = x.elements[i].value;
} else {data[x.elements[i].name] = x.elements[i].value;}
}
tele[ajaxCt] = new StageBot(2,data,2);
tele[ajaxCt].Runner();
}
function getInner(choice,retNum,data)
{
tele = new Array();
ajaxCt++;
act = 666;
data["debug"]=false;
switch (choice){
case "demoSurv":
act = 1;
break;
}
tele[ajaxCt] = new StageBot(act,data,retNum);
tele[ajaxCt].Runner();
}
function takeSurvey(site,survey,formId)
{
return false; //killing this for now.
var reqData = new Array();
reqData["site"]=site;
reqData["formId"]=formId;
reqData["dataList"]="site*formId";
shadowBox();
var url = "/static/stagebot.php";
//alert(url);
//var url = 'ajax.php';
var params = 'act=1&site='+site+'&formId='+formId;
new Ajax.Request(url, {
method: 'post',
parameters: params,
onSuccess: function(transport) {
AjaxReturn(transport.responseText,1,reqData);
},
onFailure: function() {
alert("fail");
}
});
switch(survey){
case "1":
//getInner("demoSurv",1,reqData);
break;
}
}
//---- end Survey Js ----
//---- Shadow Boxer JS ---
shade = new Array();
display = new Array();
document.parent = new Array();
function shadowBox(data)
{
//document.body.style.height="100%";
bW = document.body.clientWidth;
bH = document.body.clientHeight;
sHeight = bH;
sWidth = bW;
if(data["sbg"] != undefined && data["sbg"] != ""){background = data["sbg"];}else{background="#000000";}
if(data["opacity"] != undefined){
filter = data["opacity"]*1;
opacity = data["opacity"]/100;
} else {
filter = 60;
opacity = "0.6";
}
if(data["zIndex"] != undefined && data["zIndex"] != ""){zIndex = data["zIndex"];}else{zIndex=10000;}
if(data["level"] != undefined && data["level"] != ""){
level = Number(data["level"]);
//if(shade[(level)-1].zIndex == ""){zIndex = 10;}
//else {zIndex = shade[(level)-1].zIndex + 10;}
zIndex = 10;
parentDiv = document.getElementById(display[(level)-1].id);
}else{
level = 0;
}
shade[level] = document.createElement('div');
shade[level].id = "shadeIt"+level;
shade[level].style.visibility="visible";
shade[level].style.textAlign="center";
//shade[level].style.height = "2095px";
shade[level].style.height = "2048px";
shade[level].style.width="100%";
shade[level].style.zIndex=zIndex;
shade[level].style.background=background;
shade[level].style.position="absolute";
shade[level].style.top = "0px";
shade[level].style.left = "0px";
shade[level].style.filter = "alpha(opacity="+ filter +")"; /* Transparency */
shade[level].style.opacity= opacity; /* Transparency */
if(data["dHeight"] != undefined && data["dHeight"] != ""){dHeight=data["dHeight"];}else{dHeight="57";}
if(data["dWidth"] != undefined && data["dWidth"] != ""){dWidth=data["dWidth"];}else{dWidth="68";}
if(data["dMeasure"] != undefined && data["dMeasure"] != ""){dM = data["dMeasure"];}else{dM="%";}
if(data["lShift"] != undefined && data["lShift"] != ""){lShift = data["lShift"];} else {lShift = ((dWidth/(sWidth/2))*100)+"%";}
if(data["tShift"] != undefined && data["tShift"] != ""){tShift = data["tShift"];} else {tShift = "100px";}
if(data["dbg"] != undefined && data["dbg"] != ""){background = data["dbg"];}else{background="#FFFFFF";}
if(data["overflow"] != undefined && data["overflow"] != ""){overflow = data["overflow"];} else {overflow = "scroll";}
display[level] = document.createElement("div");
display[level].id="displayIt"+level;
display[level].style.visibility="visible";
display[level].style.textAlign="center";
display[level].style.height=dHeight+dM;
display[level].style.width=dWidth+dM;
display[level].style.zIndex=zIndex+1;
display[level].style.background=background;
display[level].style.position="fixed";
display[level].style.left= lShift;
display[level].style.top= tShift;
display[level].style.overflow = overflow;
display[level].style.padding = "0px";
if(level == 0){
if(data["parent"] != undefined && data["parent"] != ""){
document.getElementById(data["parent"]).appendChild(shade[level],null);
document.getElementById(data["parent"]).appendChild(display[level],null);
document.parent[0] = data["parent"];
} else {
document.body.appendChild(shade[level],null);
document.body.appendChild(display[level],null);
document.parent[0] = "body";
}
} else {
parentDiv.appendChild(shade[level],null);
parentDiv.appendChild(display[level],null);
document.parent[level] = parentDiv.id;
//alert(level +" = "+ parent);
}
if(data["inner"]!= undefined){
sbd = new Array();
sbd["inner"] = data["inner"];
sbd["site"] = data["site"];
sbd["box"] = display[level].id;
sbd["debug"] = data["aDebug"];
for(key in data["post"]){
sbd[key] = data["post"][key];
}
getInner = new StageBot(511,sbd,511);
//getInner.Runner();
}else{inner="";}
}
function shadowBoxHide(level)
{
if (document.parent[level] == "body"){
document.body.removeChild(shade[level]);
document.body.removeChild(display[level]);
} else {
if(!document.getElementById(shade[level].id)){return true;}
document.getElementById(document.parent[level]).removeChild(shade[level]);
document.getElementById(document.parent[level]).removeChild(display[level]);
}
return true;
}
function shadowForm_react(response)
{
//alert("hi: " + response);
if(document.getElementById("dynamic-authentication-submitting")){
rem = document.getElementById("dynamic-authentication-submitting");
rem.parentNode.removeChild(rem);
document.getElementById("cctype").style.visiblity="visible";
cc = document.getElementById("cctype");
showme = "";
for(key in cc.style){
if(cc.style.key != undefined){
showme += key + ": " + cc.style.key + "\n";
}
}
//alert(showme);
cc.style.zIndex="10";
}
ccBox = document.getElementById("credit_errors");
pDiv = document.getElementById("displayIt0");
pDiv.scrollTop = ccBox.offsetTop;
switch(response*1){
case 100:
data = new Array();
data["loc"] = "/regret_dups.html";
data["site"] = "1";
data["box"] = "body";
data["clearShadows"] = 0;
data["debug"] = false;
sendIt = new StageBot(411,data,27);
//sendIt.Runner();
break;
case 601:
case 602:
break;
case 650:
ccBox.className = "InputError";
ccBox.style.visibility = "visible";
ccBox.innerHTML = "ERROR: We were unable to process your transaction due to one of the following reasons: the credit card number or expiration date is invalid, your billing address does not match the address on the card, or there are insufficient funds available on the credit card you entered. Please verify all your information and try again.";
shadowBoxHide(1);
break;
case 651:
ccBox.className = "InputError";
ccBox.style.visibility = "visible";
ccBox.innerHTML = "ERROR: The CVV2 number entered is incorrect. Please verify your billing information";
shadowBoxHide(1);
break;
case 666:
alert("hi");
data = new Array();
data["loc"] = "/regret.html";
data["site"] = "1";
data["box"] = "body";
data["clearShadows"] = 0;
data["debug"] = false;
sendIt = new StageBot(411,data,27);
//sendIt.Runner();
break;
case 777:
//shadowBoxHide(1);break;
location.href = "/xsell/umg_confirm.php";
// data = new Array();
// data["loc"] = "/xsell/umg_confirm.php";
// data["site"] = "1";
// data["inner"] = "";
// data["box"] = "body";
// data["clearShadows"] = 0;
// data["debug"] = false;
// sendIt = new StageBot(411,data,27);
//sendIt.Runner();
break;
default:
ccBox.className = "InputError";
ccBox.style.visibility = "visible";
ccBox.innerHTML = "ERROR: We were unable to process your transaction due to one of the following reasons: the credit card number or expiration date is invalid, your billing address does not match the address on the card, or there are insufficient funds available on the credit card you entered. Please verify all your information and try again.";
shadowBoxHide(1);
break;
}
//document.getElementById("retRes").innerHTML = "";
//alert(response);
//document.getElementById("retRes").innerHTML = response;
}
//--- end Shadow Boxer JS -----
//