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)
	{
		//alert('open popupnow');
		var totalweight;
		totalweight = (parseInt(document.all.freightproductqty.value) /  parseInt(document.all.cartonqty.value))
		totalweight = totalweight * parseInt(document.all.cartonweight.value)
		//alert(totalweight);
		//window.open('http://ns1.powerweave1.com/FreightEstimatorV1/Default.aspx?appname=clegg&fromcity=GARDENA&fromstate=CA&Fromzip=90248&Fromcountry=US&Tostate=' + document.all.freightstate.value + '&ToZip=' + document.all.freightzip.value + '&ToCountry=' + document.all.freightcountrycode.value + '&Weight='+ totalweight +'&uspsuserid=clegginc&uspsuserpassword=clegginc&fedexAccountNumber=117240592&fedexMeterNumber=2485228&UPSAccesslicensenumber=EC109FB4E7C1DED8&UPSUserID=clegginc&UPSPassword=clegginc&UPSShippernumber=8E3364&showfedex=Y&FedexRateType=L' , 'getfreightestimates', 'width=490,height=640,left=250,top=50,scrollbars=yes,status =1');
		window.open('http://ns5.powerweave.com/FreightEstimatorV1/Default.aspx?appname=Molenaar&fromcity=Willmar&fromstate=MN&Fromzip=56201&Fromcountry=US&Tostate=' + document.all.freightstate.value + '&ToZip=' + document.all.freightzip.value + '&ToCountry=' + document.all.freightcountrycode.value + '&Weight='+ totalweight +'&uspsuserid=lepredeveloper&uspsuserpassword=developer&fedexAccountNumber=103809649&fedexMeterNumber=5221188&UPSAccesslicensenumber=4C2ACA19972D04A8&UPSUserID=molenardeveloper&UPSPassword=developer&UPSShippernumber=562375&showfedex=Y&FedexRateType=L' , 'getfreightestimates', 'width=490,height=640,left=250,top=50,scrollbars=yes,status =1');
	}
}

