// JavaScript Document

function calc(product_weight)
{
	x = document.getElementById("shippingcity").value;
	var y = x.split("@");
	//var product_weight='<?php echo $row[product_weight]; ?>';
	shipping1 = (y[0]*product_weight);
	var fuelsurcharge = shipping1/2;
	var shippingbeforetax=shipping1+fuelsurcharge;
	var tax = 0.1236*shippingbeforetax;
	var shipping = parseInt(shippingbeforetax + tax);
	document.getElementById("shipping").innerHTML = shipping;
	document.getElementById("deliverytime").innerHTML = "Max. "+y[1]+" days";
}/*
function success()
{
if('<?php echo $uid;?>'=="")
{
alert("You need to Login to Add a Product to Your Wishlist");
}else
alert("Product Successfully Added To Wishlist. Click Wishlist in the Menu to check Your Wishlist");
}
*/
/**
 * DHTML email validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true
	}

function ValidateForm(){
//for input name

	var name=document.productquery.query
	if(name.value.length == 0){
		alert("Please Enter Your Query");
		name.focus(); // set the focus to this input
		return false;
	}

//for from email
	var emailID=document.productquery.query_email
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }
 
 function OpenpopUP( url){
window.open(url,"","menubar=no,width=425,height=550,toolbar=no","scrollbars=yes");
}