
<!--

function showPopup()
{
greyout(true,3);
document.getElementById('coupresult').innerHTML='';
document.getElementById('certresult').innerHTML='';
document.getElementById('login_error').innerHTML='';
 }

function hidePopup()
 {
 greyout(false);
document.coup_form.DEN_COUPON_Code.value = '';
document.cert_form.CertKey.value = '';
document.logn_form.Customer_Login.value = '';
document.logn_form.Customer_Password.value = '';
document.getElementById('coupresult').innerHTML='';
document.getElementById('certresult').innerHTML='';
document.getElementById('login_error').innerHTML='';

 }

function makeredeemRequest(url, parameters) {
MM_swapImage('giftwait','','graphics/00000001/waiting.gif',1);
MM_swapImage('coupwait','','graphics/00000001/waiting.gif',1);
      http_request = false;   
     if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
          // set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
     http_request.onreadystatechange = redeemContents;
      http_request.open('GET', url+parameters+"&dummy=" + new Date().getTime(), true);
      http_request.send(null);
	 
return false;
   }

  






   function makeCUSTRequest(url, parameters) {
      http_request = false;   
     if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
          // set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
     

     http_request.onreadystatechange = alertCustContents;

      http_request.open('GET', url+parameters+"&dummy=" + new Date().getTime(), true);
      http_request.send(null);
return false;
   }
 
   function alertCustContents() {
      if (http_request.readyState == 4) {
         if (http_request.status == 200) {
            //alert(http_request.responseText);

cust_resp = http_request.responseText

MM_swapImage('loginwait','','graphics/en-US/admin/blank.gif',1);

parsed_resp=cust_resp.split("^^")
whole_resp = parsed_resp[1];


chk_resp_start = cust_resp.lastIndexOf("Unknown login")
chk_resp_end = cust_resp.lastIndexOf("Invalid password")




if (chk_resp_start == -1 && chk_resp_end == -1) {

custArray = eval(whole_resp)


document.form1.BillFirstName.value = custArray[0];
document.form1.BillLastName.value = custArray[1];
document.form1.BillPhone.value = custArray[2];
document.form1.BillEmail.value = custArray[3];

document.form1.BillCompany.value = custArray[4];
document.form1.BillAddress.value = custArray[5];
document.form1.BillCity.value = custArray[6];
document.form1.BillStateSelect.value = custArray[7];
document.form1.BillState.value = '';
document.form1.BillZip.value = custArray[8];
document.form1.BillCountry.value = custArray[9];

document.form1.ShipFirstName.value = custArray[10];
document.form1.ShipLastName.value = custArray[11];
document.form1.ShipPhone.value = custArray[12];
document.form1.ShipEmail.value = custArray[13];

document.form1.ShipCompany.value = custArray[14];
document.form1.ShipAddress.value = custArray[15];
document.form1.ShipCity.value = custArray[16];
document.form1.ShipStateSelect.value = custArray[17];
document.form1.ShipState.value = '';
document.form1.ShipZip.value = custArray[18];
document.form1.ShipCountry.value = custArray[19];

submit_rates();
hidePopup();
MM_showHideLayers('login_layer','','hide');


}else{
document.getElementById('login_error').innerHTML="<font face='Arial, Helvetica, sans-serif' size='-2' color='red'><b>Invalid Login / Password<b><font>";
}
           
         } else {
            alert('There was a problem with the request.');
         }
      }
   }

function getcust(obj) {


var poststr = "&action=LOGN&Customer_Login=" + encodeURI( document.logn_form.Customer_Login.value ) + "&Customer_Password=" + encodeURI( document.logn_form.Customer_Password.value );

 makeCUSTRequest('merchant.mvc?Screen=LOGINRETURN', poststr);
   }


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function cent(amount) {
return (amount == Math.floor(amount)) ? amount + '.00' : ( (amount*10 == Math.floor(amount*10)) ? amount + '0' : amount);
}


function addEvent(obj ,evt, fnc)
      {
        if (obj.addEventListener)
          obj.addEventListener(evt,fnc,false);
        else if (obj.attachEvent)
          obj.attachEvent('on'+evt,fnc);
        else
          return false;
        return true;
      }

      function removeEvent(obj ,evt, fnc)
      {
        if (obj.removeEventListener)
          obj.removeEventListener(evt,fnc,false);
        else if (obj.detachEvent)
          obj.detachEvent('on'+evt,fnc);
        else
          return false;
        return true;
      }

      //----------

      function appendElement(node,tag,id,htm)
      {
        var ne = document.createElement(tag);
        if(id) ne.id = id;
        if(htm) ne.innerHTML = htm;
        node.appendChild(ne);
      }
function greyout(d,z)
      {
        var obj = document.getElementById('greyout');
        if(!obj)
        {
          appendElement(document.body,'div','greyout');
          obj = document.getElementById('greyout');
          obj.style.position = 'absolute';
          obj.style.top = '0px';
          obj.style.left = '0px';
          obj.style.background = '#111';
          obj.style.opacity = '.5';
          obj.style.filter = 'alpha(opacity=75)';
        }
        if(d)
        {
          if(!z){ z - 50 }
          obj.style.zIndex = z;
          obj.style.height = Math.max(document.body.scrollHeight,document.body.clientHeight)+'px';
          obj.style.width  = Math.max(document.body.scrollWidth,document.body.clientWidth)+'px';
          obj.style.display = 'block';
          addEvent(window,'resize',greyoutResize);
        }
        else
        {
          obj.style.display = 'none';
          removeEvent(window,'resize',greyoutResize);
        }
      }
      
      function greyoutResize()
      {
        var obj = document.getElementById('greyout');
        obj.style.height = document.body.clientHeight+'px';
        obj.style.width  = document.body.clientWidth+'px';
        obj.style.height = Math.max(document.body.scrollHeight,document.body.clientHeight)+'px';
        obj.style.width  = Math.max(document.body.scrollWidth,document.body.clientWidth)+'px';
      }

	  function P7_Snap() { //v2.62 by PVII
var x,y,ox,bx,oy,p,tx,a,b,k,d,da,e,el,args=P7_Snap.arguments;a=parseInt(a);
for (k=0; k<(args.length-3); k+=4)
if ((g=MM_findObj(args[k]))!=null) {
el=eval(MM_findObj(args[k+1]));
a=parseInt(args[k+2]);b=parseInt(args[k+3]);
x=0;y=0;ox=0;oy=0;p="";tx=1;da="document.all['"+args[k]+"']";
if(document.getElementById) {
d="document.getElementsByName('"+args[k]+"')[0]";
if(!eval(d)) {d="document.getElementById('"+args[k]+"')";if(!eval(d)) {d=da;}}
}else if(document.all) {d=da;} if (document.all || document.getElementById) {
while (tx==1) {p+=".offsetParent";
if(eval(d+p)) {x+=parseInt(eval(d+p+".offsetLeft"));y+=parseInt(eval(d+p+".offsetTop"));
}else{tx=0;}}
ox=parseInt(g.offsetLeft);oy=parseInt(g.offsetTop);var tw=x+ox+y+oy;
if(tw==0 || (navigator.appVersion.indexOf("MSIE 4")>-1 && navigator.appVersion.indexOf("Mac")>-1)) {
ox=0;oy=0;if(g.style.left){x=parseInt(g.style.left);y=parseInt(g.style.top);
}else{var w1=parseInt(el.style.width);bx=(a<0)?-5-w1:-10;
a=(Math.abs(a)<1000)?0:a;b=(Math.abs(b)<1000)?0:b;
x=document.body.scrollLeft + event.clientX + bx;
y=document.body.scrollTop + event.clientY;}}
}else if (document.layers) {x=g.x;y=g.y;var q0=document.layers,dd="";
for(var s=0;s<q0.length;s++) {dd='document.'+q0[s].name;
if(eval(dd+'.document.'+args[k])) {x+=eval(dd+'.left');y+=eval(dd+'.top');break;}}}
if(el) {e=(document.layers)?el:el.style;
var xx=parseInt(x+ox+a),yy=parseInt(y+oy+b);
if(navigator.appName=="Netscape" && parseInt(navigator.appVersion)>4){xx+="px";yy+="px";}
if(navigator.appVersion.indexOf("MSIE 5")>-1 && navigator.appVersion.indexOf("Mac")>-1){
xx+=parseInt(document.body.leftMargin);yy+=parseInt(document.body.topMargin);
xx+="px";yy+="px";}e.left=xx;e.top=yy;}}
}
function MM_showHideLayers() { //v6.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
obj.visibility=v; }

}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&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<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function flvS7(){//v1.0
var v1=(arguments.length>0)?arguments[0]:window;if (v1.innerWidth){this.x=v1.pageXOffset;this.y=v1.pageYOffset;this.w=v1.innerWidth;this.h=v1.innerHeight;}else {var v2=document;if (v2.documentElement&&v2.documentElement.clientWidth){var v3=v2.documentElement;this.x=v3.scrollLeft;this.y=v3.scrollTop;this.w=v3.clientWidth;this.h=v3.clientHeight;}else if (v2.body){var v4=v2.body;this.x=v4.scrollLeft;this.y=v4.scrollTop;this.w=v4.clientWidth;this.h=v4.clientHeight;}else {this.x=this.y=this.w=this.h=0;}}}

function flvS8(v1,v2,v3){//v1.0
var v4=(document.layers)?v1:v1.style;var v5=flvS5();eval("v4.left='"+v2+v5+"'");eval("v4.top='"+v3+v5+"'");}

function flvS5(){//v1.0
var v1=((parseInt(navigator.appVersion)>4||navigator.userAgent.indexOf("MSIE")>-1)&&(!window.opera))?"px":"";return v1;}

function flvS3(v1){//v1.5
var v2=MM_findObj(v1);if (!v2){this.x=this.y=this.h=this.w=0;return;}var v3,v4,v5,v6,v7=(document.layers)?v2:v2.style,v8=document,v9=navigator.appVersion;v3=isNaN(parseInt(v7.left))?v2.offsetLeft:parseInt(v7.left);v4=isNaN(parseInt(v7.top))?v2.offsetTop:parseInt(v7.top);if (v9.indexOf("MSIE 5")>-1&&v9.indexOf("Mac")>-1){if (v2.parentElement.tagName=="BODY"){v3+=parseInt(v8.body.leftMargin);v4+=parseInt(v8.body.topMargin);}}if (v2.offsetHeight){v5=v2.offsetHeight;v6=v2.offsetWidth;}else if (document.layers){v5=v7.clip.height;v6=v7.clip.width;}else {v5=v6=0;}this.x=parseInt(v3);this.y=parseInt(v4);this.h=parseInt(v5);this.w=parseInt(v6);}

function dmxFPLP5(v1,v2){//v1.1.3
var v3=MM_findObj(v1),v4=window,v5=new flvS7(),v6=new flvS3(v1),v7,v8,v9=document,v10,v11,v12,v13,v14;this.cx=v6.x;this.cy=v6.y;if (v2){v3.PLP3=v5.w;v3.PLP4=v5.h;if (v3.PLP7==0||v3.PLP7==1){v8=v3.PLP20;}else if (v3.PLP7==2){v8=Math.round((v5.h/2)-(v6.h/2));}else {v8=v5.h-(v6.h+v3.PLP20);}v3.PLP1=v8;if (v3.PLP8==0||v3.PLP8==1){v7=v3.PLP21;}else if (v3.PLP8==2){v7=Math.round((v5.w/2)-(v6.w/2));}else {v7=v5.w-(v6.w+v3.PLP21);}v3.PLP2=v7;this.cx=v7;this.cy=v8;v14=(document.layers)?v3:v3.style;v14.left=v7+v3.PLP5;v14.top=v8+v3.PLP5;}else {if (v3.PLP18==0){if (v3.PLP14==0||v3.PLP14==2){if (v3.PLP7==0||v3.PLP7==1){v8=v5.y+v3.PLP20;}else if (v3.PLP7==2){v8=Math.round(v5.y+(v5.h/2)-(v6.h/2));}else {v8=v5.y+v5.h-(v6.h+v3.PLP20);if (v9.h<(v8+v6.h+v3.PLP20)){if (v9.h<v6.h){v8=v5.y+v5.h-(v6.h+v3.PLP20);}else {v8=v5.h-(v6.h+v3.PLP20);}}if (v8<0){v8=0}}}else {v8=this.cy;}v3.PLP1=v8;if (v3.PLP14==1||v3.PLP14==2){if (v3.PLP8==0||v3.PLP8==1){v7=v5.x+v3.PLP21;}else if (v3.PLP8==2){v7=Math.round(v5.x+(v5.w/2)-(v6.w/2));}else {v7=v5.x+v5.w-(v6.w+v3.PLP21);if (v9.w<(v7+v6.w+v3.PLP21)){if (v9.w<v6.w){v7=v5.x+v5.w-(v6.w+v3.PLP21);}else {v7=v5.w-(v6.w+v3.PLP21);}}if (v7<0){v7=0;}}}else {v7=this.cx;}v3.PLP2=v7;}else {if (v3.PLP10==1){if (v3.PLP1<v5.y){v8=v5.y+v3.PLP16;}else {v10=v5.y+v5.h;v12=v3.PLP1+v6.h+v3.PLP16;if (v12>v10){v8=v10-(v6.h+v3.PLP16);}else {v8=v3.PLP1;}}}else {v8=v3.PLP1;}if (v3.PLP11==1){if (v3.PLP2<v5.x){v7=v5.x+v3.PLP17;}else {v11=v5.x+v5.w;v13=v3.PLP2+v6.w+v3.PLP17;if (v13>v11){v7=v11-(v6.w+v3.PLP17);}else {v7=v3.PLP2;}}}else {v7=v3.PLP2;}}}this.nx=v7;this.ny=v8;}

function dmxFPLP4(v1){//v1.1.3
var v2=MM_findObj(v1),v3=(document.layers)?v2:v2.style,v4=new flvS7(),v5=0,v6=new flvS3(v1),v7,v8,v9,v10,v11,v12,v13,v14,v3;if (v2.PLP12!=null){clearTimeout(v2.PLP12);}if (v2.PLP3!=v4.w||v2.PLP4!=v4.h){v5=1;}v7=new dmxFPLP5(v1,v5);v8=v7.nx;v9=v7.ny;if ((v7.cx!=v8)||(v7.cy!=v9)){if (v2.PLP6>0){if (v2.PLP9>0){v10=v2.PLP9;v11=v2.PLP9;v12=Math.abs(v7.cx-v8);v13=Math.abs(v7.cy-v9);if (v12<v13){v11=(v12!=0)?((v13/v12)*v2.PLP9):v2.PLP9;}else {v10=(v13!=0)?((v12/v13)*v2.PLP9):v2.PLP9;}if (v10>=v12){v10=Math.min(Math.ceil(v10),v2.PLP9);}if (v11>=v13){v11=Math.min(Math.ceil(v11),v2.PLP9);}if ((v7.cx<v8)&&(v7.cx+v10<v8)){v8=v7.cx+v10;}if ((v7.cx>v8)&&(v7.cx-v10>v8)){v8=v7.cx-v10;}if ((v7.cy<v9)&&(v7.cy+v11<v9)){v9=v7.cy+v11;}if ((v7.cy>v9)&&(v7.cy-v11>v9)){v9=v7.cy-v11;}}else {v12=((v8-v7.cx)/v2.PLP6);v13=((v9-v7.cy)/v2.PLP6);v12=(v12>0)?Math.ceil(v12):Math.floor(v12);v8=v7.cx+v12;v13=(v13>0)?Math.ceil(v13):Math.floor(v13);v9=v7.cy+v13;}}v3=(document.layers)?v2:v2.style;v3.left=v8+v2.PLP5;v3.top=v9+v2.PLP5;v14="dmxFPLP4('"+v1+"')";v2.PLP12=setTimeout(v14,10);}}

function dmxFPLP3(){//v1.1.3
var v1=document,v2,v3,v4;for (i=0;i<v1.PLP13.length;i++){v2=v1.PLP13[i];v3=MM_findObj(v2);if (v3.PLP15){dmxFPLP4(v2);}}if (!v1.PLP22){v4="dmxFPLP3()";setTimeout(v4,10);}}

function dmxFPLP1(){//v1.1.3
// Copyright 2003-2005, Marja Ribbers (FlevOOware.nl), George Petrov (DMXzone.com)
var v1=arguments,v2=v1[0],v3=MM_findObj(v2),v4=false,v5=false,v6=window,v7=document,v8=new flvS3(v2),v9,v10,v11,v12=navigator,v13=v12.userAgent,v9,v14=v7.body,v15=19;if (v3){if (v7.PLP13==null){v7.PLP13=new Array();v4=true;}for (var v16=0;v16<v7.PLP13.length;v16++){if (v7.PLP13[v16]==v2){v5=true;break;}}if (!v5){v7.PLP13[v7.PLP13.length]=v2;}v9=(v7.layers)?v3:v3.style;v7.PLP19=v13.toLowerCase().indexOf("mac")!=-1;v3.PLP8=parseInt(v1[1]);if (v3.PLP8==0){v3.PLP21=v8.x;}else {v3.PLP21=parseInt(v1[2]);if (v3.PLP8==3){v10=v7.PLP19&&v7.getElementById&&!v6.opera&&!v7.all&&v13.toLowerCase().indexOf("safari")<0;v10=v10||(!v7.PLP19&&(!v7.all||(v6.opera&&parseInt(v12.appVersion))>=4));if (v3.PLP21<v15&&v10){v3.PLP21=v3.PLP21+v15;}}}v3.PLP7=parseInt(v1[3]);if (v3.PLP7==0){v3.PLP20=v8.y;}else {v3.PLP20=parseInt(v1[4]);}v3.PLP6=parseInt(v1[5]);v3.PLP9=parseInt(v1[6]);v3.PLP18=parseInt(v1[7]);if (v3.PLP18==0){v3.PLP14=parseInt(v1[8]);}else if (v3.PLP18==1){v3.PLP11=parseInt(v1[8]);v3.PLP17=parseInt(v1[9]);v3.PLP10=parseInt(v1[10]);v3.PLP16=parseInt(v1[11]);}else {v3.PLP11=0;v3.PLP10=0;}v3.PLP5=(document.layers||window.opera)?"":"px";if (!v7.layers){if (v14.scrollHeight>v14.offsetHeight){v7.w=v14.scrollWidth;v7.dh=v14.scrollHeight;}else {v7.w=v14.offsetWidth;v7.dh=v14.offsetHeight;}}v11=new dmxFPLP5(v2,1);if (v11.cx!=v11.nx||v11.cy!=v11.ny){v9=(document.layers)?v3:v3.style;v9.left=v11.nx+v3.PLP5;v9.top=v11.ny+v3.PLP5;}v3.PLP15=true;if (v4){v7.PLP22=v7.all&&!v6.opera&&!v7.PLP19;if (v7.PLP22){v6.attachEvent("onresize",dmxFPLP3);v6.attachEvent("onscroll",dmxFPLP3);}}dmxFPLP3();}}

function P7_swapClass(){ //v1.4 by PVII
var i,x,tB,j=0,tA=new Array(),arg=P7_swapClass.arguments;
if(document.getElementsByTagName){for(i=4;i<arg.length;i++){tB=document.getElementsByTagName(arg[i]);
for(x=0;x<tB.length;x++){tA[j]=tB[x];j++;}}for(i=0;i<tA.length;i++){
if(tA[i].className){if(tA[i].id==arg[1]){if(arg[0]==1){
tA[i].className=(tA[i].className==arg[3])?arg[2]:arg[3];}else{tA[i].className=arg[2];}
}else if(arg[0]==1 && arg[1]=='none'){if(tA[i].className==arg[2] ||
tA[i].className==arg[3]){
tA[i].className=(tA[i].className==arg[3])?arg[2]:arg[3];}
}else if(tA[i].className==arg[2]){tA[i].className=arg[3];}}}}
}

function showChoices() {
var pay_meth = document.getElementsByName("PaymentMethod")[0];
var pay_methIndex = pay_meth.selectedIndex;
var pay_methValue = pay_meth.options[pay_methIndex].value;
var pay_methsplit = pay_methValue.split(':');
var pay_array = pay_methsplit.length - 2;
var pay_methfinval = pay_methsplit[pay_array];
if (pay_methfinval=="mod10"){
P7_swapClass(0,'none','hidecc','showcc','div');
P7_swapClass(0,'none','showfax','hidefax','div');
P7_swapClass(0,'none','showmo','hidemo','div');
} else if (pay_methfinval=="check") {
P7_swapClass(0,'none','hidemo','showmo','div');
P7_swapClass(0,'none','showcc','hidecc','div');
P7_swapClass(0,'none','showfax','hidefax','div');
} else if (pay_methfinval=="BROK_PAYPAL") {
P7_swapClass(0,'none','showcc','hidecc','div');
P7_swapClass(0,'none','showmo','hidemo','div');
P7_swapClass(0,'none','hidefax','showfax','div');
}else{
P7_swapClass(0,'none','hidecc','showcc','div');
P7_swapClass(0,'none','showfax','hidefax','div');
P7_swapClass(0,'none','showmo','hidemo','div');
}
}




function hide() {
submit_rates();
document.form2.tax_price.value = cent(Math.round(0*Math.pow(10,2))/Math.pow(10,2));
document.form2.ship_price.value = cent(Math.round(0*Math.pow(10,2))/Math.pow(10,2));
P7_swapClass(0,'none','showship','hideship','div');
}
function show() {
submit_rates();
document.form2.tax_price.value = cent(Math.round(0*Math.pow(10,2))/Math.pow(10,2));
document.form2.ship_price.value = cent(Math.round(0*Math.pow(10,2))/Math.pow(10,2));
P7_swapClass(0,'none','hideship','showship','div');
}

var SFirst = "";
var SLast = "";
var SEmail = "";
var SPhone = "";
var SCompany = "";
var SAddress = "";
var SCity = "";
var SState = "";
var SSOther = "";
var SZip = "";
var SCountry = "";

function InitSaveVariables(form) {
SFirst = document.form1.ShipFirstName.value;
SLast = document.form1.ShipLastName.value;
SEmail = document.form1.ShipEmail.value;
SPhone = document.form1.ShipPhone.value;
SCompany = document.form1.ShipCompany.value;
SAddress = document.form1.ShipAddress.value;
SCity = document.form1.ShipCity.value;
SState = document.form1.ShipStateSelect.value;
SSOther = document.form1.ShipState.value;
SZip = document.form1.ShipZip.value;
SCountry = document.form1.ShipCountry.value;
}



function ShipToShipPerson(form) {
j=document.form1.ShipDestination.length; //alert(j)
	for (i=0; i<j; i++){
		if(document.form1.ShipDestination[i].checked) var ship_dest = document.form1.ShipDestination[i].value
	}

if (ship_dest == "billaddy") {
InitSaveVariables(form);
document.form1.ShipFirstName.value = document.form1.BillFirstName.value;
document.form1.ShipLastName.value = document.form1.BillLastName.value;
document.form1.ShipEmail.value = document.form1.BillEmail.value;
document.form1.ShipPhone.value = document.form1.BillPhone.value;
document.form1.ShipCompany.value = document.form1.BillCompany.value;
document.form1.ShipAddress.value = document.form1.BillAddress.value;
document.form1.ShipCity.value = document.form1.BillCity.value;

document.form1.ShipStateSelect.value = document.form1.BillStateSelect.value;
document.form1.ShipState.value = document.form1.BillState.value;
document.form1.ShipZip.value = document.form1.BillZip.value;
document.form1.ShipCountry.value = document.form1.BillCountry.value;

}
}
function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Please enter a valid email address")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Please enter a valid email address")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Please enter a valid email address")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Please enter a valid email address")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Please enter a valid email address")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Please enter a valid email address")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Please enter a valid email address")
		    return false
		 }

 		 return true					
	}


var digits = "0123456789";
var phoneNumberDelimiters = ".()- ";
var validWorldPhoneChars = phoneNumberDelimiters + "+";
var minDigitsInIPhoneNumber = 8;

function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function checkInternationalPhone(strPhone){
s=stripCharsInBag(strPhone,validWorldPhoneChars);
return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}

var submitcount=0;

function Email_Validator(theForm, typeform)
{
if (theForm.BillFirstName.value == "")
{
	alert("Please enter your first name.");
	theForm.BillFirstName.focus();
	return (false);
}
if (theForm.BillLastName.value == "")
{
	alert("Please enter your last name.");
	theForm.BillLastName.focus();
	return (false);
}
	var emailID=document.form1.BillEmail
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please enter your email")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}


var Phone=document.form1.BillPhone
	
	if ((Phone.value==null)||(Phone.value=="")){
		alert("Please Enter your Phone Number")
		Phone.focus()
		return false
	}
	if (checkInternationalPhone(Phone.value)==false){
		alert("Please Enter a Valid Phone Number")
		Phone.value=""
		Phone.focus()
		return false
	}

if (theForm.BillAddress.value == "")
{
	alert("Please enter your Address.");
	theForm.BillAddress.focus();
	return (false);
}
if (theForm.BillCity.value == "")
{
	alert("Please enter your City.");
	theForm.BillCity.focus();
	return (false);
}

if (theForm.BillStateSelect.value == '' && theForm.BillCountry.value == 'US')
{
	alert("Please enter your State.");
	theForm.BillStateSelect.focus();
	return (false);
}
if (theForm.BillStateSelect.value == '' && theForm.BillCountry.value != 'US' && theForm.BillCountry.value != '' && theForm.BillState.value == '')
{
	alert("Please enter your Other / Province.");
	theForm.BillState.focus();
	return (false);
}
if (theForm.BillStateSelect.value != '' && theForm.BillCountry.value == '' || theForm.BillStateSelect.value == '' && theForm.BillState.value != '' && theForm.BillCountry.value == '' )
{
	alert("Please enter your Country.");
	theForm.BillCountry.focus();
	return (false);
}

if (theForm.BillZip.value == "")
{
	alert("Please enter your Zip/Postal Code.");
	theForm.BillZip.focus();
	return (false);
}

k=document.form1.ShipDestination.length; 
	for (i=0; i<k; i++){
		if(document.form1.ShipDestination[i].checked) 
		var valship_dest = document.form1.ShipDestination[i].value
	}

if (valship_dest == 'shipaddy' && theForm.ShipFirstName.value == '')
{
	alert("Please enter your first name for shipping or click the button above to use billing info.");
	theForm.ShipFirstName.focus();
	return (false);
}
if (valship_dest == 'shipaddy' && theForm.ShipLastName.value == '')
{
	alert("Please enter your last name for shipping or click the button above to use billing info.");
	theForm.ShipLastName.focus();
	return (false);
}



var ShipemailID=document.form1.ShipEmail
	
		if (valship_dest == 'shipaddy' && (ShipemailID.value==null || ShipemailID.value==""))
	{
		alert("Please enter your email for shipping or click the button above to use billing info.")
		ShipemailID.focus()
		return false
	}
	if (valship_dest == 'shipaddy' && echeck(ShipemailID.value)==false){
		ShipemailID.value=""
		ShipemailID.focus()
		return false
	}
var ShipPhone=document.form1.ShipPhone
	
	if (valship_dest == 'shipaddy' && (ShipPhone.value==null || ShipPhone.value=="")){
		alert("Please enter your phone number for shipping or check the box above to use billing info.")
		ShipPhone.focus()
		return false
	}
	if (valship_dest == 'shipaddy' && checkInternationalPhone(ShipPhone.value)==false){
		alert("Please Enter a Valid phone number for shipping or check the box above to use billing info.")
		ShipPhone.value=""
		ShipPhone.focus()
		return false
	}

if (valship_dest == 'shipaddy' && theForm.ShipAddress.value == '')
{
	alert("Please enter your address for shipping or click the button above to use billing info.");
	theForm.ShipAddress.focus();
	return (false);
}
if (valship_dest == 'shipaddy' && theForm.ShipCity.value == '')
{
	alert("Please enter your city for shipping or click the button above to use billing info.");
	theForm.ShipCity.focus();
	return (false);
}

if (valship_dest == 'shipaddy' && theForm.ShipStateSelect.value == '' && theForm.ShipCountry.value == 'US')
{
	alert("Please enter your state for shipping or click the button above to use billing info.");
	theForm.ShipStateSelect.focus();
	return (false);
}


if (valship_dest == 'shipaddy' && theForm.ShipStateSelect.value == '' && theForm.ShipCountry.value != 'US' && theForm.ShipCountry.value != '' && theForm.ShipState.value == '')
{
	alert("Please enter your Other / Province for shipping or click the button above to use billing info.");
	theForm.ShipState.focus();
	return (false);
}
if (valship_dest == 'shipaddy' && theForm.ShipStateSelect.value != '' && theForm.ShipCountry.value == '' || valship_dest == 'shipaddy' &&  theForm.ShipStateSelect.value == '' && theForm.ShipState.value != '' && theForm.ShipCountry.value == '' )
{
	alert("Please enter your country for shipping or click the button above to use billing info.");
	theForm.ShipCountry.focus();
	return (false);
}


if (valship_dest == 'shipaddy' && theForm.ShipZip.value == "")
{

	alert("Please enter your Zip/Postal Code for shipping or click the button above to use billing info.");
	theForm.ShipZip.focus();
	return (false);
}

if (typeform == 'placeorder')
{

if (theForm.ShippingMethod.value == "")
{
	alert("Please Select a shipping method.");
	theForm.ShippingMethod.focus();
	return (false);
}
if (theForm.PaymentMethod.value == "")
{
	alert("Please Select a payment method.");
	theForm.PaymentMethod.focus();
	return (false);
}
submit_order();

} else if (typeform == 'createaccount') {
showPopup();
MM_showHideLayers('newcust_layer','','show');
P7_Snap('newcust_align','newcust_layer',180,-100);
}

return false;
}

function alertBaskContents() {
      if (http_request.readyState == 4) {
         if (http_request.status == 200) {
            //alert(http_request.responseText);

var bask_resp = http_request.responseText

var parsed_bask=bask_resp.split("^^")
var finalbask_resp = parsed_bask[1];
if (finalbask_resp == "process")
{
document.form1.submit();
document.images['processingorder'].src = document.images['processingorder'].src; 
}else{
document.emptybask.submit();
}
    
         } else {
            alert('There was a problem with the request.');
         }
      }
   }



//-->

