// JavaScript Document

//////////////////////////read cookie functions/////////////////////////////////////////
exptime = new Date();
exptime.setMonth(exptime.getMonth()+6);
cName ="";
cPass ="";
vName ="";
vPass ="";
iName ="";
iPass ="";
iLoginName ="";

function showCookie()
	{//start function
	if (document.forms[0].name=="frmVendor")
		{//start if 'frmVendor'
		if (document.cookie != "")
			{//start 'if cookie is not null'
			thisCookie = document.cookie.split("; ")
	 		for (i=0;i<thisCookie.length;i++)
				{//start for loop
				if (thisCookie[i].split("=")[0] == "Vendor Name")
					{vName = thisCookie[i].split("=")[1];
					document.frmVendor.txtvusername.value = vName;
					thisCookie[i].split(";expires = ")+ exptime.toGMTString();}
				else if (thisCookie[i].split("=")[0] == "Vendor Password")
					{vPass = thisCookie[i].split("=")[1];
					document.frmVendor.txtvpassword.value = vPass;
					thisCookie[i].split(";expires = ")+ exptime.toGMTString();}
				}//ends for loop
			}//ends 'if cookie is not null'
		}//ends if 'frmVendor'
	else if (document.forms[0].name=="frmClient")
		{//starts if 'frmClient'
		if (document.cookie != "")
			{//start 'if cookie is not null'
			thisCookie = document.cookie.split("; ")
	 		for (i=0;i<thisCookie.length;i++)
				{//start for loop
				if (thisCookie[i].split("=")[0] == "Client Name")
					{cName = thisCookie[i].split("=")[1];
					document.frmClient.txtUsername.value = cName;
					thisCookie[i].split(";expires = ")+ exptime.toGMTString();}
				else if (thisCookie[i].split("=")[0] == "Client Password")
					{cPass = thisCookie[i].split("=")[1];
					document.frmClient.txtPassword.value = cPass;
					thisCookie[i].split(";expires = ")+ exptime.toGMTString();}	
				else if (thisCookie[i].split("=")[0] == "Iris Name")
					{iName = thisCookie[i].split("=")[1];
					document.frmIris.txtiusername.value = iName;
					thisCookie[i].split(";expires = ")+ exptime.toGMTString();}
				else if (thisCookie[i].split("=")[0] == "Iris Password")
					{iPass = thisCookie[i].split("=")[1];
					document.frmIris.txtipassword.value = iPass;
					thisCookie[i].split(";expires = ")+ exptime.toGMTString();}
				else if (thisCookie[i].split("=")[0] == "Iris LoginName")
					{iLoginName = thisCookie[i].split("=")[1];
					document.frmIris.txtloginname.value = iLoginName;
					thisCookie[i].split(";expires = ")+ exptime.toGMTString();}
				}//ends for loop
			}//ends 'if cookie is not null'
		}//ends if 'frmClient'
	}//ends function

////////////////////////set cookie functions///////////////////////////////////////
function setFastrakCookie()
{
if (document.frmClient.chkClientLogin.checked==true)
	{ 
	document.cookie= "Client Name = "+ document.frmClient.txtUsername.value +";expires = " 
	+ exptime.toGMTString()
	document.cookie= "Client Password = "+ document.frmClient.txtPassword.value +";expires = "+ exptime.toGMTString()
	}//end if
else
	{ 
	document.cookie= "Client Name = "+ document.frmClient.txtUsername.value +";expires = " 
	+ exptime.setDate(exptime.getDate()-1);
	//document.frmClient.txtUsername.value = "";
	document.cookie= "Client Password = "+ document.frmClient.txtPassword.value +";expires = "
	+ exptime.setDate(exptime.getDate()-1);
	//document.frmClient.txtPassword.value = "";
	}//end else
}//end function

function setVendorCookie()
{
if (document.frmVendor.chkVendorLogin.checked==true)
	{ 
	document.cookie= "Vendor Name = "+ document.frmVendor.txtvusername.value +";expires = " 
	+ exptime.toGMTString()
	document.cookie= "Vendor Password = "+ document.frmVendor.txtvpassword.value +";expires = "
	+ exptime.toGMTString()
	}//end if
else
	{ 
	document.cookie= "Vendor Name = "+ document.frmVendor.txtvusername.value +";expires = " 
	+ exptime.setDate(exptime.getDate()-1)
	document.cookie= "Vendor Password = "+ document.frmVendor.txtvpassword.value +";expires = "
	+ exptime.setDate(exptime.getDate()-1)
	}//end else
}//end function

function setIrisCookie()
{
if (document.frmIris.chkIrisLogin.checked==true)
	{ 
	document.cookie= "Iris Name = "+ document.frmIris.txtiusername.value +";expires = " 
	+ exptime.toGMTString()
	document.cookie= "Iris Password = "+ document.frmIris.txtipassword.value +";expires = "
	+ exptime.toGMTString()
	document.cookie= "Iris LoginName = "+ document.frmIris.txtloginname.value +";expires = "
	+ exptime.toGMTString()
	}//end if
else
	{ 
	document.cookie= "Iris Name = "+ document.frmIris.txtiusername.value +";expires = " 
	+ exptime.setDate(exptime.getDate()-1);
	//document.frmIris.txtiusername.value ="";
	document.cookie= "Iris Password = "+ document.frmIris.txtipassword.value +";expires = "
	+ exptime.setDate(exptime.getDate()-1);
	//document.frmIris.txtipassword.value ="";
	document.cookie= "Iris LoginName = "+ document.frmIris.txtloginname.value +";expires = "
	+ exptime.setDate(exptime.getDate()-1);
	//document.frmIris.txtloginname.value ="";
	}//end else
}//end function

////////////////////////form submit functions///////////////////////////////////////
function VendorSubmit()
{
 if (frmVendor.txtvusername.value==""){alert("Please enter username.");frmVendor.txtvusername.focus();return false;}//end if
else if (frmVendor.txtvpassword.value==""){alert("Please enter password.");frmVendor.txtvpassword.focus();return false;}//end else if
else
	{
  	document.frmVendor.txtvusername.value=document.frmVendor.txtvusername.value.toUpperCase();
  	document.frmVendor.txtvpassword.value=document.frmVendor.txtvpassword.value.toUpperCase();
  	setVendorCookie();
	document.frmVendor.submit();
	}//end else
}

function FastrakSubmit()
{
 if (frmClient.txtUsername.value=="")
	{
	alert("Please enter username.");
	frmClient.txtUsername.focus();
	return false;
	}//end if
else if (frmClient.txtPassword.value=="")
	{
	alert("Please enter password.");
	frmClient.txtPassword.focus();
	return false;
	}//end else if
else
	{
  	document.frmClient.txtUsername.value=document.frmClient.txtUsername.value.toUpperCase();
  	document.frmClient.txtPassword.value=document.frmClient.txtPassword.value.toUpperCase();
  	setFastrakCookie();
	document.frmClient.submit();
 	}//end else
}//end function


function IrisSubmit()
{
 if (frmIris.txtiusername.value=="")
	{
	alert("Please enter username.");
	frmIris.txtiusername.focus();
	return false;
	}//end if
else if (frmIris.txtipassword.value=="")
	{
	alert("Please enter password.");
	frmIris.txtipassword.focus();
	return false;
	}//end else if
else if (frmIris.txtloginname.value=="")
	{
	alert("Please enter your name.");
	frmIris.txtloginname.focus();
	return false;
	}//end else if
else
	{
  	document.frmIris.txtiusername.value=document.frmIris.txtiusername.value.toUpperCase();
	document.frmIris.txtipassword.value=document.frmIris.txtipassword.value.toUpperCase();
	document.frmIris.txtloginname.value=document.frmIris.txtloginname.value.toUpperCase();
  	setIrisCookie();
	document.frmIris.submit();
  	}//end else
}//end function
///////////////////////Form Submit functions for DEMO PAGE/////////////////////////

function DemoVendorSubmit()
{
 if (frmVendor.txtvusername.value=="")
	{
	alert("Please enter username.");
	frmVendor.txtvusername.focus();
	return false;
	}//end if
else if (frmVendor.txtvpassword.value=="")
	{
	alert("Please enter password.");
	frmVendor.txtvpassword.focus();
	return false;
	}//end else if
else
	{
  	document.frmVendor.txtvusername.value=document.frmVendor.txtvusername.value.toUpperCase();
  	document.frmVendor.txtvpassword.value=document.frmVendor.txtvpassword.value.toUpperCase();
  	//setVendorCookie();
	if(document.frmVendor.txtvusername.value == "VENDOR")
  		{
   		//document.frmVendor.action ="http://64.19.190.99/csp/vend1/LoginExt.csp";
   		document.frmVendor.submit();
  		}
 	}//end else
}//end DemoVendorSubmit function

function DemoFastrakSubmit()
{
 if (frmClient.txtUsername.value=="")
	{
	alert("Please enter username.");
	frmClient.txtUsername.focus();
	return false;
	}//end if
else if (frmClient.txtPassword.value=="")
	{
	alert("Please enter password.");
	frmClient.txtPassword.focus();
	return false;
	}//end else if
else
	{
  	document.frmClient.txtUsername.value=document.frmClient.txtUsername.value.toUpperCase();
  	document.frmClient.txtPassword.value=document.frmClient.txtPassword.value.toUpperCase();
  	//setFastrakCookie();
	if((document.frmClient.txtUsername.value == "IMSTEST")||(document.frmClient.txtUsername.value == "IMSTEST2"))
  		{
   		//document.frmClient.action ="http://64.19.190.99/csp/iw/LoginExt.csp";
   		document.frmClient.submit();
  		}
    else if((document.frmClient.txtUsername.value == "IMSTEST1")||(document.frmClient.txtUsername.value == "IMSDEMO1"))
		{
   		//document.frmClient.action ="http://64.19.190.99/csp/iw/LoginExt.csp";
   		document.frmClient.submit();
  		}
  	}//end else
}//end DemoFastrakSubmit function


function DemoIrisSubmit()
{
 if (frmIris.txtiusername.value=="")
	{
	alert("Please enter username.");
	frmIris.txtiusername.focus();
	return false;
	}//end if
else if (frmIris.txtipassword.value=="")
	{
	alert("Please enter password.");
	frmIris.txtipassword.focus();
	return false;
	}//end else if
else if (frmIris.txtloginname.value=="")
	{
	alert("Please enter your name.");
	frmIris.txtloginname.focus();
	return false;
	}//end else if
else
	{
  	document.frmIris.txtiusername.value=document.frmIris.txtiusername.value.toUpperCase();
	document.frmIris.txtipassword.value=document.frmIris.txtipassword.value.toUpperCase();
	document.frmIris.txtloginname.value=document.frmIris.txtloginname.value.toUpperCase();
  	//setIrisCookie();
	if(document.frmIris.txtiusername.value == "IRISUSER")
  		{
   		//document.frmIris.action ="http://64.19.190.99/csp/iris/LoginExt.csp";
   		document.frmIris.submit();
  		}
   	}//end else
}//end DemoIrisSubmit function

////////////////////////////TECHNICAL PROBLEMS MESSAGE/////////////////////////////

function TEMPIrisSubmit()
	{
	alert("Websites are temporarily down.\nPlease try again later.");
	return false;
	}
	
function TEMPFastrakSubmit()
	{
	alert("Websites are temporarily down.\nPlease try again later.");
	return false;
	}
	
function TEMPVendorSubmit()
	{
	alert("Websites are temporarily down.\nPlease try again later.");
	return false;
	}
	
function Message()
	{
	alert("We are experiencing technical problems.\nPlease try again later.");
	return false;
	}

function Message2()
	{
	alert("Verizon Communications is presently testing our T1 communication lines.\nOnce testing is completed, login will be enabled.\nPlease try again later.");
	return false;
	}
///////////////////////////////////////////////////////////////////////////////////	
////////////////////////validation functions///////////////////////////////////////
/*
to determine what field is being validated, see what the alert will return;
this validation will check four forms in the rates section of our homepage;
*/

function validateForm()
{
	if (document.forms[0].name=="domoversize")
		{
		//domestic oversize form has 10 required fields...
		if (document.forms[0].elements[0].value==""){alert("Please advise Origin (Location or Zip Code)");document.forms[0].elements[0].focus();return false;};
		if (document.forms[0].elements[1].value==""){alert("Please advise Destination (Location or Zip Code)");document.forms[0].elements[1].focus();return false;}
		if (document.forms[0].elements[2].value==""){alert("Please advise Cargo description.");document.forms[0].elements[2].focus();return false;}
		if (document.forms[0].elements[3].value==""){alert("Please advise Length.");document.forms[0].elements[3].focus();return false;}
		if (document.forms[0].elements[5].value==""){alert("Please advise Width.");document.forms[0].elements[5].focus();return false;}
		if (document.forms[0].elements[7].value==""){alert("Please advise Height.");document.forms[0].elements[7].focus();return false;}
		if (document.forms[0].elements[9].value==""){alert("Please advise Weight.");document.forms[0].elements[9].focus();return false;}
		if (document.forms[0].elements[17].value==""){alert("Please advise Approximate value of goods.)");document.forms[0].elements[17].focus();return false;}
		if (document.forms[0].elements[18].value==""){alert("Please advise your phone number.");document.forms[0].elements[18].focus();return false;}
		if (document.forms[0].elements[19].value==""){alert("Please advise your email address.");document.forms[0].elements[19].focus();return false;}
		} //end if    
	if (document.forms[0].name=="domltl")
		{
		//domestic ltl form has 6 required fields...
		if (document.forms[0].elements[0].value==""){alert("Please advise Origin (Location or Zip Code)");document.forms[0].elements[0].focus();return false;};
		if (document.forms[0].elements[1].value==""){alert("Please advise Destination (Location or Zip Code)");document.forms[0].elements[1].focus();return false;}
		if (document.forms[0].elements[2].value==""){alert("Please advise Cargo description.");document.forms[0].elements[2].focus();return false;}
		if (document.forms[0].elements[13].value==""){alert("Please advise Weight.");document.forms[0].elements[13].focus();return false;}
		if (document.forms[0].elements[22].value==""){alert("Please advise your phone number.");document.forms[0].elements[22].focus();return false;}
		if (document.forms[0].elements[23].value==""){alert("Please advise your email address.");document.forms[0].elements[23].focus();return false;}
		} //end if  
	if (document.forms[0].name=="intoversize")
		{
		//international oversize form has 8 required fields...
		if (document.forms[0].elements[1].value==""){alert("Please advise Supplier / Receiver.");document.forms[0].elements[1].focus();return false;}
		if (document.forms[0].elements[10].value==""){alert("Please advise Length.");document.forms[0].elements[10].focus();return false;}
		if (document.forms[0].elements[12].value==""){alert("Please advise Width.");document.forms[0].elements[12].focus();return false;}
		if (document.forms[0].elements[14].value==""){alert("Please advise Height.");document.forms[0].elements[14].focus();return false;}
		if (document.forms[0].elements[16].value==""){alert("Please advise Weight.");document.forms[0].elements[16].focus();return false;}
		if (document.forms[0].elements[23].value==""){alert("Please advise Approximate value of goods.)");document.forms[0].elements[23].focus();return false;}
		if (document.forms[0].elements[24].value==""){alert("Please advise your phone number.");document.forms[0].elements[24].focus();return false;}
		if (document.forms[0].elements[25].value==""){alert("Please advise your email address.");document.forms[0].elements[25].focus();return false;}
		} //end if  
	if (document.forms[0].name=="intcontainers")
		{
		//international containeroversize form has 3 required fields...
		if (document.forms[0].elements[1].value==""){alert("Please advise Supplier / Receiver.");document.forms[0].elements[1].focus();return false;}
		if (document.forms[0].elements[18].value==""){alert("Please advise your phone number.");document.forms[0].elements[18].focus();return false;}
		if (document.forms[0].elements[19].value==""){alert("Please advise your email address.");document.forms[0].elements[19].focus();return false;}
		} //end if   
	if (document.forms[0].name=="loginRequest")
		{
		//international containeroversize form has 3 required fields...
		if (document.forms[0].elements[0].value==""){alert("Please advise Company Name.");document.forms[0].elements[0].focus();return false;}
		if (document.forms[0].elements[1].value==""){alert("Please advise Company Address.");document.forms[0].elements[1].focus();return false;}
		if (document.forms[0].elements[2].value==""){alert("Please advise City Information.");document.forms[0].elements[2].focus();return false;}
		if (document.forms[0].elements[5].checked==false)
				{
				if (document.forms[0].elements[3].value==""){alert("Please advise State Information.");document.forms[0].elements[3].focus();return false;}
				if (document.forms[0].elements[4].value==""){alert("Please advise Zip Code Information.");document.forms[0].elements[4].focus();return false;}
				}
		if (document.forms[0].elements[6].value==""){alert("Please advise your phone number.");document.forms[0].elements[6].focus();return false;}
		if (document.forms[0].elements[8].value==""){alert("Please advise your email address.");document.forms[0].elements[8].focus();return false;}
		if (document.forms[0].elements[9].value==""){alert("Please advise Contact Name.");document.forms[0].elements[9].focus();return false;}
	} //end if    
}//end function

function validDepartments()
{//validate that these 4 fields have been filled...
		if (document.forms[0].elements[0].value==""){alert("Please select department.");document.forms[0].elements[0].focus();return false;}
		if (document.forms[0].elements[1].value==""){alert("Please advise your name.");document.forms[0].elements[1].focus();return false;}
		if (document.forms[0].elements[2].value==""){alert("Please supply your comments/suggestions.");document.forms[0].elements[2].focus();return false;}
		if (document.forms[0].elements[3].value==""){alert("Please advise your email address, so we can contact you.");document.forms[0].elements[3].focus();return false;}
}//end function

function validateVendorProfile()
{//validate that these 6 fields have been filled...
		if (document.forms[0].elements[0].value==""){alert("Please enter Company Name.");document.forms[0].elements[0].focus();return false;}
		if (document.forms[0].elements[1].value==""){alert("Please enter Company Address.");document.forms[0].elements[1].focus();return false;}
		if (document.forms[0].elements[2].value==""){alert("Please enter City information.");document.forms[0].elements[2].focus();return false;}
		if (document.forms[0].elements[3].value==""){alert("Please enter State information.");document.forms[0].elements[3].focus();return false;}
		if (document.forms[0].elements[4].value==""){alert("Please enter Zip Code information.");document.forms[0].elements[4].focus();return false;}
		if (document.forms[0].elements[5].value==""){alert("Please advise your company email address.");document.forms[0].elements[5].focus();return false;}
}//end function

/////////////////////////Measurement Conversion functions//////////////////////
function calcTemp()
{
var temp = document.frm.tempVal.value;
var fromTemp = document.frm.selTemp1.options.value;
var toTemp = document.frm.selTemp2.options.value;
var t;

	if (fromTemp=="f")
		{
		if (toTemp=="f")
			{
			document.frm.tempResult.value =(temp*1)
			}
		else
			{
			t=(5/9*(temp-32));
			document.frm.tempResult.value =(Math.round(t*100)/100)
			}
		}
	else if (fromTemp=="c")
		{
		if (toTemp=="f")
			{
			t=(temp*(9/5)+32);
			document.frm.tempResult.value=(Math.round(t*100)/100)
			}
		else
			{
			document.frm.tempResult.value=(temp*1)
			}
		}
}

function calcVolume()
{
var vL = document.frm.vLength.value;
var vW = document.frm.vWidth.value;
var vH = document.frm.vHeight.value;
var fromVal = (vL*vW*vH);
var Cube1 = document.frm.selCube1.options.value;
var Cube2 = document.frm.selCube2.options.value;
var z;
     if (Cube1=="in")
		{
		if (Cube2=="ft")
			{document.frm.volResult.value=(fromVal*12)}
		else
			{z =(fromVal*0.0254); 
			document.frm.volResult.value =(Math.round(z*100)/100);}	
		}
     else if (Cube1=="ft")	   
		{
		if (Cube2=="ft")
			{document.frm.volResult.value=(fromVal*1)}
		else
			{z =(fromVal*0.3048); 
			document.frm.volResult.value =(Math.round(z*100)/100);}	
		}
     else if (Cube1=="yd")
		{
		if (Cube2=="ft")
			{document.frm.volResult.value=(fromVal/3)}
		else
			{z =(fromVal*0.9144); 
			document.frm.volResult.value =(Math.round(z*100)/100);}	
		}
     else if (Cube1=="mm")
		{
		if (Cube2=="ft")
			{z =(fromVal*304.8); 
			document.frm.volResult.value =(Math.round(z*100)/100);}
		else
			{z =(fromVal*0.001); 
			document.frm.volResult.value =(Math.round(z*100)/100);}	
		}
     else if (Cube1=="cm")
		{
		if (Cube2=="ft")
			{z =(fromVal*30.48); 
			document.frm.volResult.value =(Math.round(z*100)/100);}
		else
			{z =(fromVal*0.01); 
			document.frm.volResult.value =(Math.round(z*100)/100);}	
		}
     else if (Cube1=="m")
		{
		if (Cube2=="ft")
			{z =(fromVal*3.281); 
			document.frm.volResult.value =(Math.round(z*100)/100);}
		else
			{document.frm.volResult.value=(fromVal*1)}	
		}
}

function calcLength()
{
var qty = document.frm.lengthQty.value;
var length1 = document.frm.selLength1.options.value;
var length2 = document.frm.selLength2.options.value;
var x;
     if (length1=="in")
		{
		if (length2=="in")
			{document.frm.lengthResult.value=(qty*1);}
		else if (length2=="ft")
			{x=(qty/12);
			document.frm.lengthResult.value =(Math.round(x*100)/100);}	
		else if (length2=="yd")
			{x =(qty/36); 
			document.frm.lengthResult.value =(Math.round(x*100)/100);}
		else if (length2=="mm")
			{x =(qty*25.4); 
			document.frm.lengthResult.value = (Math.round(x*100)/100);}
		else if (length2=="cm")
			{x =(qty*2.54); 
			document.frm.lengthResult.value = (Math.round(x*100)/100);}
		else
			{x =(qty*0.0254); 
			document.frm.lengthResult.value = (Math.round(x*100)/100);}
		}
     else if (length1=="ft")	   
		{
		if (length2=="in")
			{document.frm.lengthResult.value=(qty*12)}
		else if (length2=="ft")
			{document.frm.lengthResult.value=(qty*1)}	
		else if (length2=="yd")
			{x =(qty/3); 
			document.frm.lengthResult.value =(Math.round(x*100)/100);}
		else if (length2=="mm")
			{x =(qty*304.79); 
			document.frm.lengthResult.value =(Math.round(x*100)/100);}
		else if (length2=="cm")
			{x =(qty*30.479); 
			document.frm.lengthResult.value =(Math.round(x*100)/100);}
		else
			{x =(qty*0.30479); 
			document.frm.lengthResult.value =(Math.round(x*100)/100);}
		}
     else if (length1=="yd")
		{
		if (length2=="in")
			{document.frm.lengthResult.value=(qty*36)}
		else if (length2=="ft")
			{document.frm.lengthResult.value=(qty*3)}	
		else if (length2=="yd")
			{document.frm.lengthResult.value=(qty*1)}
		else if (length2=="mm")
			{x =(qty*914.4); 
			document.frm.lengthResult.value =(Math.round(x*100)/100);}
		else if (length2=="cm")
			{x =(qty*91.44); 
			document.frm.lengthResult.value =(Math.round(x*100)/100);}
		else
			{x =(qty*0.9144); 
			document.frm.lengthResult.value =(Math.round(x*100)/100);}
		}
     else if (length1=="mm")
		{
		if (length2=="in")
			{x =(qty*0.03937); 
			document.frm.lengthResult.value =(Math.round(x*100)/100);}
		else if (length2=="ft")
			{x =(qty*0.0032808); 
			document.frm.lengthResult.value =(Math.round(x*100)/100);}	
		else if (length2=="yd")
			{x =(qty*0.0010936); 
			document.frm.lengthResult.value =(Math.round(x*100)/100);}
		else if (length2=="mm")
			{document.frm.lengthResult.value=(qty*1)}
		else if (length2=="cm")
			{document.frm.lengthResult.value=(qty*0.1)}
		else
			{document.frm.lengthResult.value=(qty*0.001)}
		}
     else if (length1=="cm")
		{
		if (length2=="in")
			{x =(qty/2.54); 
			document.frm.lengthResult.value =(Math.round(x*100)/100);}
		else if (length2=="ft")
			{x =(qty/30.48); 
			document.frm.lengthResult.value =(Math.round(x*100)/100);}	
		else if (length2=="yd")
			{x =(qty/91.44); 
			document.frm.lengthResult.value =(Math.round(x*100)/100);}
		else if (length2=="mm")
			{document.frm.lengthResult.value=(qty*10)}
		else if (length2=="cm")
			{document.frm.lengthResult.value=(qty*1)}
		else
			{document.frm.lengthResult.value=(qty*0.01)}
		}
     else if (length1=="m")
		{
		if (length2=="in")
			{x =(qty*39.3700787); 
			document.frm.lengthResult.value =(Math.round(x*100)/100);}
		else if (length2=="ft")
			{x =(qty*3.281); 
			document.frm.lengthResult.value =(Math.round(x*100)/100);}	
		else if (length2=="yd")
			{x =(qty*1.0936133); 
			document.frm.lengthResult.value =(Math.round(x*100)/100);}
		else if (length2=="mm")
			{document.frm.lengthResult.value=(qty*1000)}
		else if (length2=="cm")
			{document.frm.lengthResult.value=(qty*100)}
		else
			{document.frm.lengthResult.value=(qty*1)}
		}
}

function calcWeight()
{
var qty = document.frm.weightQty.value;
var weight1 = document.frm.selWeight1.options.value;
var weight2 = document.frm.selWeight2.options.value;
var y;
     if (weight1=="lb")
		{
		if (weight2=="lb")
			{document.frm.weightResult.value=(qty*1)}
		else if (weight2=="kg")
			{y =(qty*0.4536); 
			document.frm.weightResult.value =(Math.round(y*100)/100);}	
		else
			{y =(qty*0.0004535); 
			document.frm.weightResult.value =(Math.round(y*100)/100);}
		}
     else if (weight1=="kg")	   
		{
		if (weight2=="lb")
			{y =(qty*2.2046); 
			document.frm.weightResult.value =(Math.round(y*100)/100);}
		else if (weight2=="kg")
			{document.frm.weightResult.value=(qty*1)}	
		else
			{y =(qty/1000);
			document.frm.weightResult.value=(Math.round(y*100)/100);}
		}
     else if (weight1=="mt")
		{
		if (weight2=="lb")
			{y =(qty*2204.6); 
			document.frm.weightResult.value =(Math.round(y*100)/100);}
		else if (weight2=="kg")
			{document.frm.weightResult.value=(qty*1000)}	
		else
			{document.frm.weightResult.value=(qty*1)}
		}
}

function clearLength()
	{
		document.frm.lengthQty.value=0;
		document.frm.selLength1.options.value="in";
		document.frm.selLength2.options.value="ft";
		document.frm.lengthResult.value=0;		
	}

function clearWeight()
	{
		document.frm.weightQty.value=0;
		document.frm.selWeight1.options.value="lb";
		document.frm.selWeight2.options.value="kg";
		document.frm.weightResult.value=0;		
	}

function clearVolume()
	{
		document.frm.vLength.value=0;
		document.frm.vWidth.value=0;
		document.frm.vHeight.value=0;
		document.frm.selCube1.options.value="in";
		document.frm.selCube2.options.value="ft";
		document.frm.volResult.value=0;		
	}

function clearTemp()
	{
		document.frm.tempVal.value=0;
		document.frm.selTemp1.options.value="f";
		document.frm.selTemp2.options.value="c";
		document.frm.tempResult.value=0;		
	}
	
///////////////////////////////////////////////////////////////////////////////
////////////////////////other functions////////////////////////////////////////
//this function is to ensure the popup window is centered on the main window, regardless of resolution...
function CenterWin(mypage, myname, w, h, scroll,resize) 
	{
		var winl = (screen.width - w) / 2;
		var wint = (screen.height - h) / 2;
		winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable='+resize+''
		win = window.open(mypage, myname, winprops)
		if (parseInt(navigator.appVersion) >= 4) 
		{win.window.focus(); }
	}
	
function CenteredPop(mypage, myname, w, h, scroll,resize) 
	{
		var winl = (screen.width - w) / 2;
		var wint = (screen.height - h) / 2;
		winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable='+resize+''
		win = window.open(mypage, myname, winprops)
		if (parseInt(navigator.appVersion) >= 4) 
		{win.window.focus(); }
	}
	
function checkSpecs()
	{//validate that something has been selected
	if (document.frmSpecs.Size.value==""){alert("Please select a size.");document.frmSpecs.Size.focus();return false;}
	if (document.frmSpecs.Type.value==""){alert("Please select a Type.");document.frmSpecs.Type.focus();return false;}
	}//end of function

function checkZipForm()
	{//validate that one of the three fields has been filled, to continue with search
	if ((document.frmZip.txtZip.value=="")&&(document.frmZip.txtCity.value==""))
		{
		if (document.frmZip.txtState.value=="")
			{
			alert("Please enter search criteria!");document.frmZip.txtZip.focus();return false;
			}
		}
	}//end of function

function getDistance()
	{//validate that both fields have been filled, to continue with search
	if((document.frmDistance.zipOne.value.length==0)||(document.frmDistance.zipOne.value==null))
		{alert("Please provide Zip One information");document.frmDistance.zipOne.focus();return false;}	
	if((document.frmDistance.zipTwo.value.length==0)||(document.frmDistance.zipTwo.value==null))
		{alert("Please provide Zip Two information");document.frmDistance.zipTwo.focus();return false;}	
	}//end function
	
function clearZipSearch()
	{//used to reset zip search
	document.frmZip.txtZip.value="";
	document.frmZip.txtCity.value="";
	document.frmZip.txtState.value="";
	document.frmZip.txtZip.focus();
	}//end of function

function clearDistance()
	{//used to reset distance search
	document.frmDistance.zipOne.value="";
	document.frmDistance.zipTwo.value="";
	document.frmDistance.selMeasure.value="M";
	document.frmDistance.zipOne.focus();
	}//end of function
	
