var sid='';

sfHover = function() {
   var sfEls = document.getElementById('nav').getElementsByTagName("LI");
   for (var i = 0; i < sfEls.length; i++) {
      sfEls[i].onmouseover = function() {
         this.className += " sfhover";
      }
      sfEls[i].onmouseout = function() {
         this.className = this.className.replace(new RegExp(" sfhover\\b"), "");
      }
   }
}
if (window.attachEvent) {
	window.attachEvent("onload", sfHover);
}

function pop_map(){
        var mapups="/templates/map_popup.htm"
        winpops=window.open(mapups,"","width=700,height=400,z-index=10,scrollbars=1")
        winpops.focus();
        }

function switch_billstates() {
var country;
var states;
var m;
	country=document.forms[0].BillTo_Country.options[document.forms[0].BillTo_Country.selectedIndex].value;
	if(country == 'United States') {
	states= new Array('AL','AK','AS','AZ','AR','CA','CO','CT','DE','DC','FM','FL','GA','GU','HI','ID','IL','IN','IA','KS','KY','LA','ME','MH','MD','MA','MI','MN','MS','MO','MT','NE','NV','NH','NJ','NM','NY','NC','ND','MP','OH','OK','OR','PW','PA','PR','RI','SC','SD','TN','TX','UT','VT','VI','VA','WA','WV','WI','WY');
       	document.forms[0].BillTo_State.options.length=states.length+1;
        document.forms[0].BillTo_State.options[0]=new Option('');
	for(m=0;m<states.length;m++) {
            document.forms[0].BillTo_State.options[m+1]=new Option(states[m]);
	}
        document.forms[0].BillTo_State.selectedIndex=0;
	} else {
	states= new Array('AB','BC','MB','NB','NL','NT','NS','NU','ON','PE','QC','SK','YT');
       	document.forms[0].BillTo_State.options.length=states.length+1;
        document.forms[0].BillTo_State.options[0]=new Option('');
	for(m=0;m<states.length;m++) {
            document.forms[0].BillTo_State.options[m+1]=new Option(states[m]);
	}
        document.forms[0].BillTo_State.selectedIndex=0;
	}
}

function switch_shipstates() {
var country;
var states;
var m;
	country=document.forms[0].ShipTo_Country.options[document.forms[0].ShipTo_Country.selectedIndex].value;
	if(country == 'United States') {
	states= new Array('AL','AK','AS','AZ','AR','CA','CO','CT','DE','DC','FM','FL','GA','GU','HI','ID','IL','IN','IA','KS','KY','LA','ME','MH','MD','MA','MI','MN','MS','MO','MT','NE','NV','NH','NJ','NM','NY','NC','ND','MP','OH','OK','OR','PW','PA','PR','RI','SC','SD','TN','TX','UT','VT','VI','VA','WA','WV','WI','WY');
       	document.forms[0].ShipTo_State.options.length=states.length+1;
        document.forms[0].ShipTo_State.options[0]=new Option('');
	for(m=0;m<states.length;m++) {
            document.forms[0].ShipTo_State.options[m+1]=new Option(states[m]);
	}
        document.forms[0].ShipTo_State.selectedIndex=0;
	} else {
	states= new Array('AB','BC','MB','NB','NL','NT','NS','NU','ON','PE','QC','SK','YT');
       	document.forms[0].ShipTo_State.options.length=states.length+1;
        document.forms[0].ShipTo_State.options[0]=new Option('');
	for(m=0;m<states.length;m++) {
            document.forms[0].ShipTo_State.options[m+1]=new Option(states[m]);
	}
        document.forms[0].ShipTo_State.selectedIndex=0;
	}
}

function pop_cardcode(){

winpops=window.open("","","width=600,height=300,z-index=10");
winpops.document.writeln("<html><head><title>What Is The Card Code</title></head><body bgcolor='#FFFFFF'><font size=2 face=Verdana><b>What is the Card Code</b><br><br>Visa calls this code Card Verification Value (CVV); MasterCard calls it Card Validation Code (CVC); Discover calls it a Card IDentification (CID) number. Here we use Card Code to refer to it.<br>Card code is the last 3 digits on the Signature Panel on the back of the card.</font><br><br><img src=/images/site/cardcode.jpg>");

winpops.document.writeln("</body></html>");
winpops.document.close();
winpops.focus();
}

function set_cimg(s,c) {
var i=0;
	if(document.getElementById('cimg')) {
	if(s == '0' || s == '3') {
		i=Math.floor(Math.random()*5);
        	document.cimg.src="/images/site/frontimages/f"+i+".jpg";
	}
	if(s == '1') {
		i=Math.floor(Math.random()*2);
        	document.cimg.src="/images/site/frontimages/m"+i+".jpg";
	}
	if(s == '2') {
		i=Math.floor(Math.random()*3);
        	document.cimg.src="/images/site/frontimages/k"+i+".jpg";
	}
        document.getElementById('cimghref').href="http://www.shoplattitude.com/cgi-bin/main.cgi?sid="+sid+"&"+c;
	}
}

function pop_model(id,img,s){
var nurl;
if(s == '0') 
  nurl="http://www.shoplattitude.com/cgi-bin/main.cgi?sid="+sid+"&p="+id;
else 
  nurl="http://www.shoplattitude.com/"+id+".htm";

winpops=window.open("","","width=475,height=320,z-index=10");
winpops.document.writeln("<html><head><title>Model</title></head><body bgcolor='#FFFFFF'><a href=\"javascript:window.opener.location='"+nurl+"';window.close()\"><img src=/images/product/model/" + img + "></a>");

winpops.document.writeln("</body></html>");
winpops.document.close();
winpops.focus();
}

