function showcur(getcur,url)
{

document.aspnetForm.getcur.value=getcur;
document.aspnetForm.url.value=url;
document.aspnetForm.submit();
}
 function loginfrmsubmit()
 {
  document.frmloginsubmit.submit();
 }
  function loginfrmsubmit1()
 {
  document.frmloginsubmit1.submit();
 }

function tellafriend(url,prodid)
{
document.frmproduct.url.value=url;
document.frmproduct.prodid.value=prodid;
document.frmproduct.action="http://www.workingpharmacy.com/tellafriend.php";
document.frmproduct.method="post";
document.frmproduct.submit();
}

function addtocart(actiontype,pid,qty)
{
document.frmresult.prodid.value=pid;
document.frmresult.qty.value=qty;
document.frmresult.actiontype.value=actiontype;
document.frmresult.submit();
}

function continueshop()
{
window.location="index.php";
}



function retpharma()
{

	if(document.frmpharmacy.txtname.value=="")
	{
	alert("Please Enter Name");
	document.frmpharmacy.txtname.focus();
	return false;
	}
	
	if(document.frmpharmacy.txtemail.value=="")
	{
	alert("Please Enter EmailId");
	document.frmpharmacy.txtemail.focus();
	return false;
	}
	else
	{
	if(!echeck(document.frmpharmacy.txtemail.value))
	{
	return false;
	}
	
	}
	if(document.frmpharmacy.txtquest.value=="")
	{
	alert("Please Enter Your Question");
	document.frmpharmacy.txtquest.focus();
	return false;
	}
}

function retcontact()
{
	if(document.frmcontact.txtname.value=="")
	{
	alert("Please Enter Name");
	document.frmcontact.txtname.focus();
	return false;
	}
	
	if(document.frmcontact.txtemail.value=="")
	{
	alert("Please Enter EmailId");
	document.frmcontact.txtemail.focus();
	return false;
	}
	else
	{
	if(!echeck(document.frmcontact.txtemail.value))
	{
	return false;
	}
	
	}
	if(document.frmcontact.txtsubject.value=="")
	{
	alert("Please Enter Subject");
	document.frmcontact.txtsubject.focus();
	return false;
	}
	
	if(document.frmcontact.txtquest.value=="")
	{
	alert("Please Enter Your Question");
	document.frmcontact.txtquest.focus();
	return false;
	}

}


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 isBlank(s) {
	var k;
	if (s !="") {
		for (k=0;k<s.length;k++) {
			if(s.charAt(k) != " ") {
				return false;
			}
		}
	}
	return true;
}
function validatepass()
{

if(document.frmpass.oldpass.value=="")
{
alert("Please Enter old password");
document.frmpass.oldpass.focus();
return false;
}
if(document.frmpass.newpass.value=="")
{
alert("Please Enter new password");
document.frmpass.newpass.focus();
return false;
}
if (document.frmpass.newpass.value.length < 6) 
{
		alert ("Password should contain minimum 6 characters");
		document.frmpass.newpass.value="";
		document.frmpass.newpass.focus();
		return false; 
	}


if(document.frmpass.confirmpass.value=="")
{
alert("Please Enter Confirm password");
document.frmpass.confirmpass.focus();
return false;
}

if(document.frmpass.confirmpass.value!=document.frmpass.newpass.value)
{
alert("New password and Confirm password should be same");
document.frmpass.confirmpass.focus();
return false;
}
}

function addcart(prodid,pqty,price,ptype,actiontype)
{
document.frmproduct.prodid.value=prodid;
document.frmproduct.pqty.value=pqty;
document.frmproduct.price.value=price;
document.frmproduct.ptype.value=ptype;
document.frmproduct.actiontype.value=actiontype;
document.frmproduct.submit();
}
function addlistcart(prodid,pqty,price,ptype,actiontype)
{
var prodprice;
prodprice=document.frmproduct.txtqty.value*price;

document.frmproduct.prodid.value=prodid;
document.frmproduct.pqty.value=document.frmproduct.txtqty.value;
document.frmproduct.price.value=prodprice;
document.frmproduct.ptype.value=ptype;
document.frmproduct.actiontype.value=actiontype;
document.frmproduct.submit();
}

function submitlistform(prodidname,qtyname,pricename,typename,actiontypename,formsubmitname,prodid,qty,price,txtprice,qtyvalue,actionname)
{
if(qty=="")
{
alert("Please enter qty in the given box or select qty from the list box.");
return false;
}
else
{

	var prodprice;
	prodprice=qty*price;
	prodidname=prodid;
	qtyname=qty;
	pricename=price;
	//alert(qtyname);
	typename="P";
	actiontypename="addcart";
	actionname;
	formsubmitname;
}	
}
function getqty(listname,inputfield)
{
inputfield;
}
function addextracart(prodid,pqty,price,ptype,actiontype)
{
var prodprice;
prodprice=document.frmproduct.txtqty.value*price;

document.frmproduct.prodid.value=prodid;
document.frmproduct.pqty.value=document.frmproduct.txtqty.value;
document.frmproduct.price.value=prodprice;
document.frmproduct.ptype.value=ptype;
document.frmproduct.actiontype.value=actiontype;
document.frmproduct.submit();
}

function updatecart()
{
alert("hello");
//document.frmcart.action="cartmodi.php";
//document.frmcart.actiontype.value=actiontype;
//document.frmcart.submit();
}