function IsNumericFreight(sText)
{
   var ValidChars = "0123456789."
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
   { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
      {
         IsNumber = false;
      }
   }
   return IsNumber;
   }
function ShowRateEstimates()
{
	var show=true;
	if (document.all.freightproductqty.value=="")
	{
		alert('Please enter Product Quantity');
		document.all.freightproductqty.focus();
		show=false;
		return false;
	}
	if (!IsNumericFreight(document.all.freightproductqty.value))
	{
		alert('Please enter numeric values only');
		document.all.freightproductqty.focus();
		show=false;
		return false;
	}
	if (document.all.freightstate.value=="")
	{
		alert('Please enter Ship To State');
		document.all.freightstate.focus();
		show=false;
		return false;
	}
	if (document.all.freightzip.value=="")
	{
		alert('Please enter Ship To Zip');
		document.all.freightzip.focus();
		show=false;
		return false;
	}
	if (document.all.freightcountrycode.value=="")
	{
		alert('Please enter Ship To Country Code');
		document.all.freightcountrycode.focus();
		show=false;
		return false;
	}

	//------------- Code Start to prevent hacking --------------------	
	if(isValidCode(document.Product,"freightzip","Zip Code")==false)
	{
		show=false;
		return false;
	}
   //------------- Code Start to prevent hacking --------------------	

	if (show==true)
	{
		var totalweight,length,width,height;
		totalweight = (parseInt(document.all.freightproductqty.value) /  parseInt(document.all.cartonqty.value))
		totalweight = totalweight * parseInt(document.all.cartonweight.value)
		length = document.all.Length.value
		width = document.all.Width.value
		height = document.all.Height.value
		
		//window.open('http://ns5.powerweave.com/Freightaddsomezip/Default.aspx?appname=addzip&fromcity=Green Bay&fromstate=WI&Fromzip=54304&Fromcountry=US&Tostate='+document.all.freightstate.value+'&ToZip='+document.all.freightzip.value+'&ToCountry='+document.all.freightcountrycode.value+'&Weight='+totalweight+'&productQty='+document.all.freightproductqty.value+'&cartonqty='+document.all.cartonqty.value+'&cartonweight='+document.all.cartonweight.value+'&uspsuserid=lepredeveloper&uspsuserpassword=developer&fedexAccountNumber=103809649&fedexMeterNumber=5221188&UPSAccesslicensenumber=0C4BB751B544A020&UPSUserID=addzip&UPSPassword=amitpw&UPSShippernumber=3X49Y6&showfedex=N&FedexRateType=L' , 'getfreightestimates', 'width=490,height=640,left=250,top=50,scrollbars=yes,status =1');
		
		window.open('http://ns5.powerweave.com/Freightaddsomezip/Default.aspx?appname=addzip&fromcity=Green Bay&fromstate=WI&Fromzip=54304&Fromcountry=US&Tostate='+document.all.freightstate.value+'&L='+length+'&W='+width+'&H='+height+'&ToZip='+document.all.freightzip.value+'&ToCountry='+document.all.freightcountrycode.value+'&Weight='+totalweight+'&productQty='+document.all.freightproductqty.value+'&cartonqty='+document.all.cartonqty.value+'&cartonweight='+document.all.cartonweight.value+'&uspsuserid=lepredeveloper&uspsuserpassword=developer&fedexAccountNumber=103809649&fedexMeterNumber=5221188&UPSAccesslicensenumber=0C4BB751B544A020&UPSUserID=addzip&UPSPassword=amitpw&UPSShippernumber=3X49Y6&showfedex=N&FedexRateType=L' , 'getfreightestimates', 'width=490,height=640,left=250,top=50,scrollbars=yes,status =1');
	}
}



