
onCntWhat = new Image
onCntAbout = new Image
onCntTest = new Image
onCntHist = new Image
onCntDirec = new Image
onCntCont = new Image
onCntHome = new Image
		
offCntWhat = new Image
offCntAbout = new Image
offCntTest = new Image
offCntHist = new Image
offCntDirec = new Image
offCntCont = new Image
offCntHome = new Image
		
onCntWhat.src ="i/cnt_what_on.gif"
onCntAbout.src ="i/cnt_abouts_on.gif"
onCntTest.src ="i/cnt_test_on.gif"
onCntHist.src ="i/cnt_history_on.gif"
onCntDirec.src ="i/cnt_abt_on.gif"
onCntCont.src ="i/cnt_contact_on.gif"
onCntHome.src ="i/cnt_home_on.gif"
		
offCntWhat.src ="i/cnt_what_off.gif"
offCntAbout.src ="i/cnt_abouts_off.gif"
offCntTest.src ="i/cnt_test_off.gif"
offCntHist.src ="i/cnt_history_off.gif"
offCntDirec.src ="i/cnt_abt_off.gif"
offCntCont.src ="i/cnt_contact_off.gif"
offCntHome.src ="i/cnt_home_off.gif"
	
function tax()
{
	if(document.csi.sstate.value == 'CA')
	{
	
	}
	else if(document.csi.bstate.value == 'CA')
	{
	
	}
}

function lcase()
{
	var strEmail = new String(document.csi.EMAIL.value);
	strEmail = strEmail.toLowerCase();
	document.csi.EMAIL.value = strEmail;
	return true;
}
function ssname()
{
	document.csi.sname.value = document.csi.FIRSTNAME.value + '&' + document.csi.LASTNAME.value
}
function bbname()
{
	document.csi.bname.value = document.csi.BillToFIRSTNAME.value + '&' + document.csi.BillToLASTNAME.value
}
function popup(page)
{   
	config='toolbar=no,location=no,directories=no,status=no,menubar=no,width=325,height=205,scrollbars=no,resizable=no';
	var popup = window.open(page,"BodyPower",config);
}
function popup2(page)
{   
	config='toolbar=no,location=no,directories=no,status=no,menubar=no,width=325,height=500,scrollbars=yes,resizable=no';
	var popup = window.open(page,"State_Codes",config);
}

function popup_Art(page)
{   
	config='toolbar=no,location=no,directories=no,status=no,menubar=no,width=500,height=550,scrollbars=yes,resizable=no';
	var popup = window.open(page,"BodyPower_Articals",config);
}

function popup_survey(page)
{   
	config='toolbar=no,location=no,directories=no,status=no,menubar=no,width=450,height=500,scrollbars=yes,resizable=no';
	var popup = window.open(page,"Survey",config);
}

function copy_form()
{
	ssname();
	bbname();
	if(!document.csi.SAS.checked)
	{
			document.csi.BillToFIRSTNAME.value = "";
			document.csi.BillToLASTNAME.value = "";
			document.csi.baddr1.value = "";
			document.csi.baddr2.value = "";
			document.csi.bcity.value = "";
			document.csi.BillToPHONE.value = "";
			document.csi.bstate.value = "Select One";
			//document.csi.bcountry.value = "US";
			document.csi.bother.value = "";
			document.csi.bzip.value = "";
	}
	else
	{
			if(document.csi.bstate.value = "")
			{
				if(document.csi.bstate2.value = "")
				{
					alert('Please enter your billing state or province if there is none please type NONE in the field')
					document.csi.bstate2.focus()
				}
			}
			document.csi.BillToFIRSTNAME.value = document.csi.FIRSTNAME.value;
			document.csi.BillToLASTNAME.value = document.csi.LASTNAME.value;
			document.csi.baddr1.value = document.csi.saddr1.value;
			document.csi.baddr2.value = document.csi.saddr2.value;
			document.csi.bcity.value = document.csi.scity.value;
			document.csi.BillToPHONE.value = document.csi.PHONE.value;
			document.csi.bstate.value = document.csi.sstate.value;
			document.csi.bstate2.value = document.csi.sstate2.value;
			document.csi.bcountry.value = document.csi.scountry.value;
			document.csi.bzip.value = document.csi.szip.value;
	};

}
function currency(anynum,width) {
   anynum=eval(anynum)
   workNum=Math.abs((Math.round(anynum*100)/100));workStr=""+workNum
   if (workStr.indexOf(".")==-1){workStr+=".00"}
   dStr=workStr.substr(0,workStr.indexOf("."));dNum=dStr-0
   pStr=workStr.substr(workStr.indexOf("."))
   while (pStr.length<3){pStr+="0"}

   //--- Adds comma in thousands place.
   if (dNum>=1000) {
      dLen=dStr.length
      dStr=parseFloat(""+(dNum/1000))+","+dStr.substring(dLen-3,dLen)
   }

   //-- Adds comma in millions place.
   if (dNum>=1000000) {
      dLen=dStr.length
      dStr=parseFloat(""+(dNum/1000000))+","+dStr.substring(dLen-7,dLen)
   }
   retval=dStr+pStr 
   if (anynum < 0) {
      retval=retval.substring(1,retval.length)
      retval="("+retval+")"        
   }
   retval = retval
   //--Pad with leading blanks to better align numbers.
   while (retval.length<width){retval=" "+retval}

   return retval
}
function price()
{
	var totalvideo;
	var totalgift;
	var totalship;
	var qtvid=parseFloat(document.csi.quantvid.value);
	var subtot;
	var total;
	var stax = (.0825)
	var ship=qtvid;
	var priceship = parseFloat(document.csi.priceShipping.value);
	var pricevid = parseFloat(document.csi.pricevideo.value);
	totalvideo=(qtvid * pricevid);

	if(ship>=1)
	{
		if(ship>1)
		{
			var ship2=(ship - 1)
			totalship=(5.00+ship2)
		}
		else
		{
			totalship=5.00
		};
	}
	else
	{
		totalship=0.00
	};

	if(totalship>25.00)
	{
		totalship=25.00
	};
	if(document.csi.sstate.value == 'CA')
	{
		var stax2 = parseFloat((qtvid*pricevid)*stax)
		popup("tax.htm")
	}
	else
	{
		var stax2 = 0.00
	}
	subtot = (totalvideo + totalship);
	document.csi.totalvid.value=currency(totalvideo,5);
	document.csi.shiphan.value=ship;
	document.csi.shipping.value=currency(totalship,5);
	document.csi.subtotal.value=document.csi.totalvid.value
	document.csi.subtota.value=currency(subtot,5);
	document.csi.tax.value=currency(stax2,5);
	document.csi.total.value=currency((subtot+stax2),5);
	document.csi.chargetotal.value= document.csi.total.value;

}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


if(document.images)
{
	onWhat = new Image
	onAbout = new Image
	onTest = new Image		
	onHist = new Image
	onAboutD = new Image
	onCont = new Image
	onHome = new Image
		
	offWhat = new Image
	offAbout = new Image
	offTest = new Image		
	offHist = new Image
	offAboutD = new Image
	offCont = new Image
	offHome = new Image
		
	onWhat.src ="i/what_on.gif"
	onAbout.src ="i/about_on.gif"
	onTest.src ="i/test_on.gif"
	onHist.src="i/history_on.gif"
	onAboutD.src ="i/about_d_on.gif"
	onCont.src ="i/contact_on.gif"
	onHome.src ="i/home_on.gif"

	offWhat.src ="i/what_off.gif"
	offAbout.src ="i/about_off.gif"
	offTest.src ="i/test_off.gif"
	offHist.src="i/history_off.gif"
	offAboutD.src ="i/about_d_off.gif"
	offCont.src ="i/contact_off.gif"
	offHome.src ="i/home_off.gif"
}
else
{
	onAbout.src =""
	onInt.src =""
	onDom.src =""
	onCorp.src=""
	onRew.src =""
	onCont.src =""
		
	offAbout.src =""
	offInt.src =""
	offDom.src =""
	offCorp.src=""
	offRew.src =""
	offCont.src =""
}
