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;
		totalweight = (parseInt(document.all.freightproductqty.value) /  parseInt(document.all.cartonqty.value))
		totalweight = totalweight * parseInt(document.all.cartonweight.value)
	

		var productQty=parseInt(eval(document.all.freightproductqty.value))
		var cartonqty = parseInt(document.all.cartonqty.value)
		var cartonweight =  parseInt(document.all.cartonweight.value)
		var totalweight;

		totalweight = productQty /  cartonqty

		totalweight = totalweight * cartonweight
		window.open('http://www.cleggonline.com/cleggfreight/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 +'&productQty='+ productQty + '&cartonqty=' + cartonqty +'&cartonweight='+ cartonweight +'&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');




	}
}

