﻿function remove_it(qtysku) {   document.quantities.elements[qtysku].value = 0;   document.quantities.submit();}function disable() {   if (document.checkout.type.value == 'member') {       document.checkout.username.disabled = false;       document.checkout.password.disabled = false;   } else {       document.checkout.username.disabled = true;       document.checkout.password.disabled = true;   }}function wholesaleCopy() {      document.ws_register.shipping_address1.value = document.ws_register.billing_address1.value;      document.ws_register.shipping_address2.value = document.ws_register.billing_address2.value;      document.ws_register.shipping_attention.value = document.ws_register.company_name.value;      document.ws_register.shipping_city.value = document.ws_register.billing_city.value;      document.ws_register.shipping_state.value = document.ws_register.billing_state.value;      document.ws_register.shipping_zip.value = document.ws_register.billing_zip.value;}function changeDate(id,id2) {   document.ship_form.elements[id].value = document.ship_form.elements[id2].value;}function use_alias(id,alias) {      var first_name = 's_firstname'+id;      var last_name = 's_lastname'+id;      var title = 's_title'+id;      var company = 's_company'+id;      var addy1 = 's_address1'+id;      var addy2 = 's_address2'+id;      var city = 's_city'+id;      var state = 's_state'+id;      var country = 's_country'+id;      var zip = 's_zip'+id;      var phone = 's_phone'+id;      var shipping_type = 'shipping_type'+id;      var alias_id = document.ship_form.elements[alias].value;      var nullvar;      document.ship_form.elements[first_name].value = info['s_firstname'][alias_id];      document.ship_form.elements[last_name].value = info['s_lastname'][alias_id];      if (info['s_title'][alias_id] != nullvar) {        document.ship_form.elements[title].value = info['s_title'][alias_id];      } else {        document.ship_form.elements[title].value = "";      }      if (info['s_company'][alias_id] != nullvar) {        document.ship_form.elements[company].value = info['s_company'][alias_id];      } else {        document.ship_form.elements[company].value = "";      }      document.ship_form.elements[addy1].value = info['s_address1'][alias_id];      if (info['s_address2'][alias_id] != nullvar) {        document.ship_form.elements[addy2].value = info['s_address2'][alias_id];      } else {        document.ship_form.elements[addy2].value = "";      }      if (document.ship_form.elements[shipping_type] != nullvar) {        if (info['s_country'][alias_id] == 'United States') {          document.ship_form.elements[shipping_type][0].checked=true;          setShipType(document.ship_form.elements[shipping_type][0],'shipping',id);          limitDomShipMeths(id,info['s_state'][alias_id]); // Custom Code for the Shipping Methods Dropdown        } else {          document.ship_form.elements[shipping_type][1].checked=true;          setShipType(document.ship_form.elements[shipping_type][1],'shipping',id);          limitIntShipMeths(id,info['s_country'][alias_id]); // Custom Code for the Shipping Methods Dropdown        }      }      document.ship_form.elements[city].value = info['s_city'][alias_id];      document.ship_form.elements[state].value = info['s_state'][alias_id];      document.ship_form.elements[country].value = info['s_country'][alias_id];      document.ship_form.elements[zip].value = info['s_zip'][alias_id];      if (info['s_phone'][alias_id] != nullvar) {        document.ship_form.elements[phone].value = info['s_phone'][alias_id];      } else {        document.ship_form.elements[phone].value = "";      }}function addressCopy() {      document.ship_form.first_name.value = document.ship_form.s_firstname1.value;      document.ship_form.last_name.value = document.ship_form.s_lastname1.value;      document.ship_form.billing_address1.value = document.ship_form.s_address11.value;      document.ship_form.billing_address2.value = document.ship_form.s_address21.value;      if (typeof document.ship_form.shipping_type1 != 'undefined') {        selected=0;        for(i=0;i<document.ship_form.shipping_type1.length;i++) {          if (document.ship_form.shipping_type1[i].checked) {            document.ship_form.shipping_type2[i].checked=true;            setShipType(document.ship_form.shipping_type2[i],'billing','2');            break;          }         }      }      document.ship_form.billing_state.value = document.ship_form.s_state1.value;      document.ship_form.billing_city.value = document.ship_form.s_city1.value;      document.ship_form.billing_zip.value = document.ship_form.s_zip1.value;      document.ship_form.billing_country.value = document.ship_form.s_country1.value;      document.ship_form.title.value = document.ship_form.s_title1.value;      document.ship_form.company.value = document.ship_form.s_company1.value;      document.ship_form.phone.value = document.ship_form.s_phone1.value;}function toggleCC(val,col) {  if (document.ship_form.print_cc.value == 'y') {    document.ship_form.ccname.disabled=val;    document.ship_form.cctype.disabled=val;    document.ship_form.ccnum.disabled=val;    document.ship_form.ccexpy.disabled=val;    document.ship_form.ccname.style.background=col;    document.ship_form.cctype.style.background=col;    document.ship_form.ccnum.style.background=col;    document.ship_form.ccexpy.style.background=col;    if (typeof document.ship_form.cvv2 != 'undefined') {      document.ship_form.cvv2.disabled=val;      document.ship_form.cvv2.style.background=col;    }    document.ship_form.ccexpm.disabled=val;    document.ship_form.ccexpm.style.background=col;  }}function togglePO(val,col) {  if (document.ship_form.print_po.value == 'y') {    document.ship_form.purchase_order.disabled=val;    document.ship_form.purchase_order.style.background=col;  }}function toggleGC(val,col) {  if (document.ship_form.print_gc.value == 'y') {    document.ship_form.gift_certificate.disabled=val;    document.ship_form.gift_certificate.style.background=col;  }}function toggleCT(val,col) {  document.ship_form.ccexpy.disabled=val;  document.ship_form.ccexpy.style.background=col;  document.ship_form.ccexpm.disabled=val;  document.ship_form.ccexpm.style.background=col;  if (typeof document.ship_form.cvv2 != 'undefined') {    document.ship_form.cvv2.disabled=val;    document.ship_form.cvv2.style.background=col;  }}function use_wishlist(id,wishlist) {      var first_name = 's_firstname'+id;      var last_name = 's_lastname'+id;      var addy1 = 's_address1'+id;      var addy2 = 's_address2'+id;      var city = 's_city'+id;      var state = 's_state'+id;      var country = 's_country'+id;      var zip = 's_zip'+id;      var shipping_type = 'shipping_type'+id;      var wl_id = document.ship_form.elements[wishlist].value;      var nullvar;      document.ship_form.elements[first_name].value = wl['first_name'][wl_id];      document.ship_form.elements[last_name].value = wl['last_name'][wl_id];      document.ship_form.elements[addy1].value = wl['address1'][wl_id];      if (wl['address2'][wl_id] != nullvar) {        document.ship_form.elements[addy2].value = wl['address2'][wl_id];      } else {        document.ship_form.elements[addy2].value = "";      }      if (document.ship_form.elements[shipping_type] != nullvar) {        if (wl['country'][wl_id] == 'United States') {          document.ship_form.elements[shipping_type][0].checked=true;          setShipType(document.ship_form.elements[shipping_type][0],'shipping',id);        } else {          document.ship_form.elements[shipping_type][1].checked=true;          setShipType(document.ship_form.elements[shipping_type][1],'shipping',id);        }      }      document.ship_form.elements[city].value = wl['city'][wl_id];      document.ship_form.elements[state].value = wl['state'][wl_id];      document.ship_form.elements[country].value = wl['country'][wl_id];      document.ship_form.elements[zip].value = wl['zip'][wl_id];}function toggle(id) {  use = document.getElementById ? true : false;  var disp=(use) ? document.getElementById(id) : document.all(id);  if (disp.style.display=='block') {    disp.style.display='none';  } else {    disp.style.display='block';  }  return false;}function setShipType(item,fields,i) {  item.checked = true; // Ensure it's checked if the clicked it.  if(arguments.length > 2) {    var args = new Array();    for(var x=0,z=0,n=arguments.length;x<n;x++) {      if(x > 2) {        args[z++] = arguments[x];      }    }    showFields(item,i,fields,args);  } else {    showFields(item,i,fields,'');  }}function showFields(item,i,fields,args) {  if(item.checked == true) { // Just in case.    if(args != '' && args.length == 3) {      // Form errored, extra fields were passed in:      var savedCountry = args[0];      var savedState = args[1];      var savedZip = args[2];    }    if(fields == 'shipping') {      sFieldName = 's_state'+i;      cFieldName = 's_country'+i;      zFieldName = 's_zip'+i;    } else if(fields == 'member') {      sFieldName = 'state';      cFieldName = 'country';      zFieldName = 'zip';    } else {      sFieldName = 'billing_state';      cFieldName = 'billing_country';      zFieldName = 'billing_zip';    }    if(item.value == 'dom') { // Domestic Options      document.getElementById('stateCaption'+i).innerHTML = '<font color="#fd65a2">*</font> State:';      var statesField = '<select name="'+sFieldName+'" class="formtext" id="sStateField'+i+'" onchange="javascript: limitDomShipMeths('+i+',this.value);">';      for(var x=0,n=arStates.length;x<n;x++) {        statesField += arStates[x]+'\n';      }      statesField += '</select>';      document.getElementById('stateField'+i).innerHTML = statesField;      if(typeof savedState != 'undefined') {        document.getElementById('sStateField'+i).value = savedState;        if(savedState == '') {          document.getElementById('stateField'+i).innerHTML += ' <font color="#ff0000"><b>X</b></font>';        }      }      document.getElementById('countryCaption'+i).innerHTML = '';      document.getElementById('countryField'+i).innerHTML = '<input type="hidden" name="'+cFieldName+'" value="United States" />';    } else {      document.getElementById('stateCaption'+i).innerHTML = '<font color="#fd65a2">*</font> Province:';      document.getElementById('stateField'+i).innerHTML = '<input type="text" name="'+sFieldName+'" class="formtext" size="30" id="sStateField'+i+'">\n<input type="hidden" name="uk" value="y">';      if(typeof savedState != 'undefined') {        document.getElementById('sStateField'+i).value = savedState;        if(savedState == '') {          document.getElementById('stateField'+i).innerHTML += ' <font color="#ff0000"><b>X</b></font>';        }      }      document.getElementById('countryCaption'+i).innerHTML = '<font color="#fd65a2">*</font> Country:';      var countryField = '<select name="'+cFieldName+'" class="formtext" id="sCountryField'+i+'" onchange="javascript: limitIntShipMeths('+i+',this.value);">';      for(var x=0,n=arCountries.length;x<n;x++) {        countryField += arCountries[x]+'\n';      }      countryField += '</select>\n';      document.getElementById('countryField'+i).innerHTML = countryField;      if(typeof savedCountry != 'undefined') {        document.getElementById('sCountryField'+i).value = savedCountry;        if(savedCountry == '') {          document.getElementById('countryField'+i).innerHTML += ' <font color="#ff0000"><b>X</b></font>';        }      }    }    document.getElementById('zipCaption'+i).innerHTML = '<font color="#fd65a2">*</font> Zip/Postal Code:';    document.getElementById('zipField'+i).innerHTML = '<input type="text" name="'+zFieldName+'" size="15" maxlength="15" class="formtext" id="sZipField'+i+'">';    if(typeof savedZip != 'undefined') {      document.getElementById('sZipField'+i).value = savedZip;      if(savedZip == '') {        document.getElementById('zipField'+i).innerHTML += ' <font color="#ff0000"><b>X</b></font>';      }    }  }}
