var path="http://www.value-drugs.net/";

//var path="https://www.offshorerx.com/";

//var path="https://project.tdspharma.com/ofrx/";



function validateuc()

{	



		if(!checkBlank(document.login_frm.emailid,'Email address')) return false;

		if(!checkSpace(document.login_frm.emailid,'Email address')) return false;

		if(!checkEmail(document.login_frm.emailid,'Email Address')) return false;



		if(!checkBlank(document.login_frm.password,'Password')) return false;

		if(!checkSpace(document.login_frm.password,'Password')) return false;

		

	}	

function validateuc_form()

{	

		if(!checkBlank(document.login_frm.emailid,'Email address')) return false;

		if(!checkSpace(document.login_frm.emailid,'Email address')) return false;

		if(!checkEmail(document.login_frm.emailid,'Email Address')) return false;



		if(!checkBlank(document.login_frm.password,'Password')) return false;

		if(!checkSpace(document.login_frm.password,'Password')) return false;

		document.login_frm.submit();



	}	

	

	

	

	function MM_openBrWindow(theURL,winName,features) 

	{ //v2.0

		window.open(theURL,winName,features);

	}



	function MM_preloadImages() { //v3.0

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

}



function MM_swapImgRestore() { //v3.0

  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;

}



function MM_findObj(n, d) { //v4.0

  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);

  if(!x && document.getElementById) x=document.getElementById(n); return x;

}



function MM_swapImage() { //v3.0

  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}



function delfromwl(rid)

	{		

		if (confirm("The selected product will be deleted from the wish list?"))

		{

			strurl="/asp/mywishlist/deletewl.asp?rid=" + rid;

			document.frm.action= strurl;

			location.href=strurl;			

		}

	

	}

	function add2sc(rid,pid)

	{	

		strurl="/asp/mywishlist/insertwish2shop.asp?rid=" + rid + "&pid="+ pid;

		document.frm.action= strurl;

		location.href=strurl;

	}



	function detailviewpop(id)

	{

		//alert("here");

		window.open("orderdetailview.asp?oid="+id,"Oreder_Details","resizable=yes,toolbar=no,status=no,scrollbars=yes,location=no,menubar=no,directories=no,width=520,height=375");

	}



	function validate()

	{

		if(!checkBlank(document.custphy.txtar_question,'Question')) return false;

	}

	function MM_openBrWindow(theURL,winName,features) 

	{ //v2.0

		window.open(theURL,winName,features);

	}



	function add2wl(pid)

	{	

		var qty;

		qty=document.frm.qty.value;		

		strurl="/asp/mywishlist/insertwl.asp?pid=" + pid + "&qty="+ qty;

		document.frm.action= strurl;

		document.frm.submit();

	}

	function add2sc(pid)

	{	

		var qty;

		qty=document.frm.qty.value;		

		strurl="/asp/mywishlist/insertsc.asp?pid=" + pid + "&qty="+ qty;

		//alert(strurl);

		document.frm.action= strurl;

		document.frm.submit();



	}



	function validate1()

	{	

		if(!checkBlank(document.login_frm1.txt_fname,'Name')) return false;

		if(!checkBlank(document.login_frm1.txt_emailid,'Email address')) return false;

		if(!checkSpace(document.login_frm1.txt_emailid,'Email address')) return false;

		if(!checkEmail(document.login_frm1.txt_emailid,'Email Address')) return false;



	}





function validate2()

{



		if(!checkBlank(document.custform.fname,'First Name')) return false;

		if(!checkSpecialChar2(document.custform.fname,'First Name')) return false;



		if(!checkBlank(document.custform.lname,'Last Name')) return false;

		if(!checkSpecialChar2(document.custform.lname,'Last Name')) return false;



		if(!checkBlank(document.custform.dobmonth,'Month')) return false;

		if(!checkBlank(document.custform.dobdate,'Date')) return false;

		if(!checkBlank(document.custform.dobyear,'Year')) return false;



		if(!checkBlank(document.custform.emailid,'Email Address')) return false;

		if(!checkEmail(document.custform.emailid,'Email Address')) return false;



		if(!checkBlank(document.custform.pwd,'Password')) return false;

		if(!checkLessLen(document.custform.pwd,'Password',4)) return false;

		if(document.custform.pwd.value != document.custform.cpwd.value)

		{

			alert("Password & Confirm password should be same !");

			document.custform.cpwd.focus();			

			return false;

		}



	 //if(!checkEmail(document.custform.emailid,'Email Address')) return false;



		if(!checkBlank(document.custform.addr,'Address Street1')) return false;

		//if(!checkBlank(document.custform.addr2,'Address Street2')) return false;



		



		var textblock=document.getElementById("showstatetext");	

			var listblock=document.getElementById("showstatelist");	



			if(textblock.style.display == "block")

			{



			if(!checkBlank(document.custform.state,'State')) return false;

			}

			

			if(listblock.style.display == "block")

			{	if(document.custform.statelist.options.selectedIndex == 0) 

			{	

				alert("Please Enter State")

				document.custform.statelist.focus();

				return false;

			}

			}

		



		if(!checkBlank(document.custform.city,'City')) return false;



		if(!checkBlank(document.custform.zipcode,'Zip Code')) return false;



		if(!checkBlank(document.custform.cno,'Home Phone Number')) return false;

		if(!checkBlank(document.custform.cno1,'Work Phone Number')) return false;



		if(document.custform.shipsame.checked != 1)

		{

			

			

			if(!checkBlank(document.custform.sname,'Shipping Name')) return false;

			if(!checkBlank(document.custform.saddr,'Shipping Address Street1')) return false;

			

			textblock=document.getElementById("showsstatetext");	

			listblock=document.getElementById("showsstatelist");	

			if(textblock.style.display == "block")

			if(!checkBlank(document.custform.sstate,'Shipping State')) return false;

			if(listblock.style.display == "block")

			{	if(document.custform.sstatelist.options.selectedIndex == 0) 

			{	

				alert("Please Enter Shipping State")

				document.custform.sstatelist.focus();

				return false;

			}

			}

			if(!checkBlank(document.custform.scity,'Shipping City')) return false;

			if(!checkBlank(document.custform.szipcode,'Shipping Zip Code')) return false;

			if(!checkBlank(document.custform.scno,' your phone no in your shipping details. As per Courier \n policies, we are unable to ship your order without a valid phone no.')) return false;

			if(!checkBlank(document.custform.scno1,' your phone no in your shipping details. As per Courier \n policies, we are unable to ship your order without a valid phone no.')) return false;

		}

		if(document.custform.billsame.checked != 1)

		{

			if(!checkBlank(document.custform.baddr,'Billing Address Street1')) return false;

			textblock=document.getElementById("showbstatetext");	

			listblock=document.getElementById("showbstatelist");	

			if(textblock.style.display == "block")

			if(!checkBlank(document.custform.bstate,'Billing State')) return false;

			if(listblock.style.display == "block")

			{	if(document.custform.bstatelist.options.selectedIndex == 0) 

			{	

				alert("Please Enter Billing State")

				document.custform.bstatelist.focus();

				return false;

			}

			}

			if(!checkBlank(document.custform.bcity,'Billing City')) return false;

			if(!checkBlank(document.custform.bzipcode,'Billing Zip Code')) return false;

			if(!checkBlank(document.custform.bcno,'Billing Phone Number')) return false;

		}

		if(!checkBlank(document.custform.dname,'Doctors Name')) return false;		

		if(!checkBlank(document.custform.dadr1,'Doctors Address Street1')) return false;		

		if(!checkBlank(document.custform.dphno,'Doctors Telephone No.')) return false;

		if(document.custform.docsame.checked != 1)

		{

			textblock=document.getElementById("showdstatetext");	

			listblock=document.getElementById("showdstatelist");	

			if(textblock.style.display == "block")

			if(!checkBlank(document.custform.dstate,'Doctors State')) return false;

			if(listblock.style.display == "block")

			{	if(document.custform.dstatelist.options.selectedIndex == 0) 

			{	

				alert("Please Enter Doctors State")

				document.custform.dstatelist.focus();

				return false;

			}

			}

			if(!checkBlank(document.custform.dzipcode,'Doctors Zip Code')) return false;

			if(!checkBlank(document.custform.dcity,'Doctors City')) return false;

		}

}//end validate()



function validate_refund()

{		

		//alert(document.custform.fname);

		

		if(!checkBlank(document.custform.orderid,'Order ID')) return false;

		if(!checkBlank(document.custform.amount,'Amount')) return false;

		if(!checkNaN(document.custform.amount,'Amount')) return false;



		if(!checkBlank(document.custform.txt_username,'Email Address')) return false;

		if(!checkEmail(document.custform.txt_username,'Email Address')) return false;



		if(!checkBlank(document.custform.fname,'First Name')) return false;

		if(!checkSpecialChar2(document.custform.fname,'First Name')) return false;



		if(!checkBlank(document.custform.lname,'Last Name')) return false;

		if(!checkSpecialChar2(document.custform.lname,'Last Name')) return false;

	 //if(!checkEmail(document.custform.emailid,'Email Address')) return false;



		if(!checkBlank(document.custform.baddr,'Billing Address Street1')) return false;

		//if(!checkBlank(document.custform.baddr2,'Billing Address Street2')) return false;



		if(!checkBlank(document.custform.bcity,'Billing City')) return false;

		if(!checkBlank(document.custform.bstate,'Billing State')) return false;

		if(!checkBlank(document.custform.bzipcode,'Billing Zip Code')) return false;

		if(!checkNaN(document.custform.bzipcode,'Billing Zip Code')) return false;

		if(!checkBlank(document.custform.bcno,'Billing Phone Number')) return false;

		

		if(!checkBlank(document.custform.sname,'Shipping Name')) return false;



		if(!checkBlank(document.custform.saddr,'Shipping Address Street1')) return false;

		//if(!checkBlank(document.custform.saddr2,'Shipping Address Street2')) return false;



		if(!checkBlank(document.custform.scity,'Shipping City')) return false;

		if(!checkBlank(document.custform.sstate,'Shipping State')) return false;

		if(!checkBlank(document.custform.szipcode,'Shipping Zip Code')) return false;

		if(!checkNaN(document.custform.szipcode,'Shipping Zip Code')) return false;

		if(!checkBlank(document.custform.scno,' your phone no in your shipping details. As per Courier \n policies, we are unable to ship your order without a valid phone no.')) return false;

		if(!checkBlank(document.custform.scno1,' your phone no in your shipping details. As per Courier \n policies, we are unable to ship your order without a valid phone no.')) return false;

document.custform.mode.value='submitform';

document.custform.submit();

		



}//end validate()



function addshipaddress()

{

		if (document.custform.shipsame.checked)

		{

			shipname = document.custform.fname.value + " " + document.custform.lname.value;

			

			document.custform.sname.value = shipname;



			document.custform.saddr.value = document.custform.addr.value;

			document.custform.saddr2.value = document.custform.addr2.value;



			document.custform.scity.value = document.custform.city.value;

			document.custform.sstate.value = document.custform.state.value;



			document.custform.szipcode.value = document.custform.zipcode.value;



			document.custform.scno.value = document.custform.cno.value;



			document.custform.scountry.value = document.custform.country.value;





		}	

		else

		{

			document.custform.sname.value = "";



			document.custform.saddr.value = "";



			document.custform.saddr2.value = "";

			

			document.custform.scity.value = "";



			document.custform.sstate.value = "";



			document.custform.szipcode.value = "";



			document.custform.scno.value = "";



			document.custform.scountry.value = "3";

		}

}//end addshipaddress()



function addshipaddress1()

{

	//alert("I am called");

		if (document.custform.billsame.checked)

		{

			shipname = document.custform.fname.value + " " + document.custform.lname.value;

			

			document.custform.sname.value = shipname;



			document.custform.saddr.value = document.custform.baddr.value;

			document.custform.saddr2.value = document.custform.baddr2.value;



			document.custform.scity.value = document.custform.bcity.value;

			document.custform.sstate.value = document.custform.bstate.value;



			document.custform.szipcode.value = document.custform.bzipcode.value;



			document.custform.scno.value = document.custform.bcno.value;



			document.custform.scountry.value = document.custform.bcountry.value;





		}	

		else

		{

			document.custform.sname.value = "";



			document.custform.saddr.value = "";



			document.custform.saddr2.value = "";

			

			document.custform.scity.value = "";



			document.custform.sstate.value = "";



			document.custform.szipcode.value = "";



			document.custform.scno.value = "";



			document.custform.scountry.value = "3";

		}

}//end addshipaddress()



function addbilladdress()

{

		if (document.custform.billsame.checked)

		{

			

			document.custform.baddr.value = document.custform.addr.value;

			document.custform.baddr2.value = document.custform.addr2.value;



			document.custform.bcity.value = document.custform.city.value;



			document.custform.bstate.value = document.custform.state.value;



			document.custform.bzipcode.value = document.custform.zipcode.value;



			document.custform.bcno.value = document.custform.cno.value;



			document.custform.bcountry.value = document.custform.country.value;





		}	

		else

		{

			document.custform.baddr.value = "";

			document.custform.baddr2.value = "";

			document.custform.bcity.value = "";



			document.custform.bstate.value = "";



			document.custform.bzipcode.value = "";



			document.custform.bcno.value = "";



			document.custform.bcountry.value = "3";

		}	

}//end addbilladdress()

//for change password

function change_pass(elementname)

	{

		

	var block=document.getElementById(elementname);



	if(document.custform.newpass[0].checked == true)

		{

	block.style.display = "block";

		}

	if(document.custform.newpass[1].checked == true)

		{

	block.style.display = "none";

		}



	return true;	

	}





function validate3()

{

		if(!checkBlank(document.custform.fname,'First Name')) return false;

		if(!checkSpecialChar2(document.custform.fname,'First Name')) return false;



		if(!checkBlank(document.custform.lname,'Last Name')) return false;

		if(!checkSpecialChar2(document.custform.lname,'Last Name')) return false;



		



	 //if(!checkEmail(document.custform.emailid,'Email Address')) return false;



		if(!checkBlank(document.custform.addr,'Address Street1')) return false;

		//if(!checkBlank(document.custform.addr2,'Address Street2')) return false;



		



		var textblock=document.getElementById("showstatetext");	

			var listblock=document.getElementById("showstatelist");	



			if(textblock.style.display == "block")

			{



			if(!checkBlank(document.custform.state,'State')) return false;

			}

			

			if(listblock.style.display == "block")

			{	if(document.custform.statelist.options.selectedIndex == 0) 

			{	

				alert("Please Enter State")

				document.custform.statelist.focus();

				return false;

			}

			}

		



		if(!checkBlank(document.custform.city,'City')) return false;



		if(!checkBlank(document.custform.zipcode,'Zip Code')) return false;



		if(!checkBlank(document.custform.cno,'Phone Number')) return false;

		

		if(document.custform.shipsame.checked != 1)

		{

			

			

			if(!checkBlank(document.custform.sname,'Shipping Name')) return false;

			if(!checkBlank(document.custform.saddr,'Shipping Address Street1')) return false;

			

			textblock=document.getElementById("showsstatetext");	

			listblock=document.getElementById("showsstatelist");	



			if(textblock.style.display == "block")

			if(!checkBlank(document.custform.sstate,'Shipping State')) return false;

			

			if(listblock.style.display == "block")

			{	if(document.custform.sstatelist.options.selectedIndex == 0) 

			{	

				alert("Please Enter Shipping State")

				document.custform.sstatelist.focus();

				return false;

			}

			}

			if(!checkBlank(document.custform.scity,'Shipping City')) return false;

			

			if(!checkBlank(document.custform.szipcode,'Shipping Zip Code')) return false;

			if(!checkBlank(document.custform.scno,' your phone no in your shipping details. As per Courier \n policies, we are unable to ship your order without a valid phone no.')) return false;

			if(!checkBlank(document.custform.scno1,' your phone no in your shipping details. As per Courier \n policies, we are unable to ship your order without a valid phone no.')) return false;

		}

		if(document.custform.billsame.checked != 1)

		{

			if(!checkBlank(document.custform.baddr,'Billing Address Street1')) return false;

			

			textblock=document.getElementById("showbstatetext");	

			listblock=document.getElementById("showbstatelist");	



			

			if(textblock.style.display == "block")

			if(!checkBlank(document.custform.bstate,'Billing State')) return false;

			

			if(listblock.style.display == "block")

			{	if(document.custform.bstatelist.options.selectedIndex == 0) 

			{	

				alert("Please Enter Billing State")

				document.custform.bstatelist.focus();

				return false;

			}

			}



			if(!checkBlank(document.custform.bcity,'Billing City')) return false;

			if(!checkBlank(document.custform.bzipcode,'Billing Zip Code')) return false;

			if(!checkBlank(document.custform.bcno,'Billing Phone Number')) return false;

		}



		if(!checkBlank(document.custform.dname,'Doctors Name')) return false;		

		if(!checkBlank(document.custform.dadr1,'Doctors Address Street1')) return false;		

		if(!checkBlank(document.custform.dphno,'Doctors Telephone No.')) return false;

		if(document.custform.docsame.checked != 1)

		{

			

			textblock=document.getElementById("showdstatetext");	

			listblock=document.getElementById("showdstatelist");	



			

			if(textblock.style.display == "block")

			if(!checkBlank(document.custform.dstate,'Doctors State')) return false;

			

			if(listblock.style.display == "block")

			{	if(document.custform.dstatelist.options.selectedIndex == 0) 

			{	

				alert("Please Enter Doctors State")

				document.custform.dstatelist.focus();

				return false;

			}

			}



			if(!checkBlank(document.custform.dzipcode,'Doctors Zip Code')) return false;

			if(!checkBlank(document.custform.dcity,'Doctors City')) return false;

		}

		if(document.custform.newpass[0].checked == true)

		{

			

			if(!checkBlank(document.custform.new_pass,'Password')) return false;

			if(!checkLessLen(document.custform.new_pass,'Password',4)) return false;



			if(!checkBlank(document.custform.conf_new_pass,'Password')) return false;

     		if(!checkLessLen(document.custform.conf_new_pass,'Password',4)) return false;



			if(!checkBlank(document.custform.new_pass,'New Password')) return false;

			if(!checkSpace(document.custform.new_pass,'New Password')) return false;

			if(!checkBlank(document.custform.conf_new_pass,'Confirm Password')) return false;

			if(!checkSpace(document.custform.conf_new_pass,'Confirm Password')) return false;



			if(document.custform.new_pass.value == document.custform.conf_new_pass.value)

			{

				return true;		

			}

			else

			{

				alert("New Password and Confirm Password do not match!");

				document.custform.new_pass.focus;

				return false;

			}

		}

		



}//end validate()

  function check_search(elementname)

 {	



	var block=document.getElementById('search_eng');

	var block2=document.getElementById('keywords');

	var block3=document.getElementById('oth_search');

	var block1=document.getElementById('oth_search_eng');

	block1.style.display = "none";

	

	if(document.custform.where1.value == "Other")

	{

		block3.style.display = "block";

	}

		else

	 {

	block3.style.display = "none";

	 }



	if(document.custform.where1.value == "Search Engine")

	 {

	block2.style.display = "block";

	block.style.display = "block";

	 }

	else

	 {

	block.style.display = "none";

	block2.style.display = "none";

	 }

 }

 function check_search1(elementname)

 {	



	var block1=document.getElementById('oth_search_eng');

	if(document.custform.eng_name.value == "Other")

	block1.style.display = "block";

	else

	block1.style.display = "none";

 }



function SubmitWishList(formNm,actiontype,hid,minQty){

	

  formNm.method = "post"; 		

  formNm.action = path+"mywishList.php"; 		

  formNm.ActionType.value = actiontype;

  formNm.product_id.value = hid;

  formNm.quantity.value = minQty;

  formNm.submit();

}



function SubmitToCart(formNm,actiontype,hid,price,minQty){



  formNm.method = "post";

  formNm.action = path+"shoppingcart/ShoppingModule.php";

  formNm.ActionType.value = actiontype;

  formNm.product_id.value = hid;

  formNm.quantity.value = minQty;

  formNm.price.value = price;

  formNm.submit();

}



function SubmitToCart2(formNm,actiontype,hid,price,minQty)

{

  formNm.method = "post";

  formNm.action = path+"shoppingcart/ShoppingModule.php";

  formNm.ActionType.value = actiontype;

  formNm.product_id.value = hid;

  formNm.quantity.value = formNm.qty.options[formNm.qty.options.selectedIndex].value;

  formNm.price.value = price;

  formNm.submit();

}



function WishListAddToCart(formNm,actiontype){

	var cn,pcn,flg,flg1 ;

	flg="no";

	flg1=1;

	pcn=formNm.productid.length;

	if (!pcn){

		if (formNm.productid.checked){

			formNm.product_id.value=formNm.productid.value;

			formNm.price.value = formNm.prc.value;

			formNm.quantity.value = formNm.qty.value;

			flg="yes";

		}		

	}

	else{

		for (cn=0; cn<pcn ;cn++){

			if (formNm.productid[cn].checked){

				if (flg1==1){

					formNm.product_id.value=formNm.productid[cn].value;

					formNm.price.value = formNm.prc[cn].value;

					formNm.quantity.value = formNm.qty[cn].value;

					flg1=flg1+1;

				}

				else{

					formNm.product_id.value=formNm.product_id.value+","+formNm.productid[cn].value

						formNm.price.value = formNm.price.value+","+formNm.prc[cn].value;	

					formNm.quantity.value = formNm.quantity.value+","+formNm.qty[cn].value;

				}

			flg="yes";

			}

		}	

	}

	if (flg=="no"){

		alert("Please Select Product");

	}

	else if (flg=="yes"){

		formNm.method = "post";

		formNm.action = path+"shoppingcart/ShoppingModule.php";

		formNm.ActionType.value = actiontype;

		formNm.submit();

	}

}



function WishToDelete(formNm,actiontype,flg_state){

	var RecID,flg,flg1,flg2;	

	flg="no";

	flg1=1;

	pcn=formNm.productid.length;

	RecID="";	

	if (flg_state=="DelSelected"){

		if (!pcn){

			if (formNm.productid.checked){

				RecID=formNm.RecordID.value;

				formNm.RecordID.value="";

				formNm.price.value="";

				formNm.quantity.value= "";

				formNm.prc.value="";

				formNm.qty.value="";

				formNm.product_id.value="";

				flg="yes";

			}

		}

		else{

			for (cn=0; cn<pcn ;cn++){

				if (formNm.productid[cn].checked){				

					if (flg1==1){

						RecID=formNm.RecordID[cn].value;

						formNm.RecordID[cn].value="";

						formNm.price.value="";

						formNm.quantity.value= "";

						formNm.prc[cn].value="";

						formNm.qty[cn].value="";

						formNm.product_id.value="";

						flg1=flg1+1;

					}

					else{

						RecID=RecID+","+formNm.RecordID[cn].value;

						formNm.RecordID[cn].value="";

						formNm.productid[cn].value="";

						formNm.prc[cn].value="";

						formNm.qty[cn].value="";

					}

					flg="yes";

				}

			}

		}

		if (flg=="no"){

			alert("Please Select Product");

		}

		else if (flg=="yes"){

			flg2=confirm("You are about to DELETE this product from your Wish List!");

			if (!flg2){

				return;

			}

			formNm.RecordID_str.value=RecID;

			formNm.method = "post";

			formNm.action = path+"mywishList.php";

			formNm.ActionType.value = actiontype;

			formNm.submit();

		}

	}

	else{	

		flg2=confirm("You are about to DELETE this product from your Wish List!");

		if (!flg2){

			return;

		}

		for (cn=0; cn<pcn ;cn++){

			formNm.RecordID[cn].value="";

			formNm.price.value="";

			formNm.quantity.value= "";

			formNm.prc[cn].value="";

			formNm.qty[cn].value="";

			formNm.product_id.value="";

			formNm.productid[cn].value="";

			formNm.prc[cn].value="";

			formNm.qty[cn].value="";

		}

		formNm.RecordID_str.value=flg_state;

		formNm.method = "post";

		formNm.action = path+"mywishList.php";

		formNm.ActionType.value = actiontype;

		formNm.submit();		

	}

}



function CheckOut(formnm,ActionType,press_filled)	{

		if (press_filled == 0)	{

			alert("Before Check Out please select the prescriptions option above.");

		}	else	{

		

			if (formnm.txt_username.value =="") {

				alert("Please Enter User Name");

				formnm.txt_username.focus();

			}else if (formnm.txt_password.value == "") {

				alert("Please Password");

				formnm.txt_password.focus();

			}else{

				

				//if(formnm.opt_prescription[0].checked == 1)

				//currentActionType="doctor_details";

				//else

				//currentActionType="medical_history";

	

	

		formnm.ActionType.value= ActionType;

		//formnm.nextActionType.value= ActionType;

				formnm.submit();

			}

		}

}

function SubmitProfile(formnm,ActionType)	{

	if (ActionType == "changeprofile_todb" || ActionType == "addprofile_todb")	{

		if (formnm.cust_name.value =="") {

			alert("Please Enter Name");

			formnm.cust_name.focus();

		}else if (formnm.cust_phone.value == "") {

			alert("Please Enter Phone Number");

			formnm.cust_phone.focus();

		}else if (formnm.cust_email.value == "") {

			alert("Please Enter Email");

			formnm.cust_email.focus();

		}else if (checkEmail(formnm.cust_email.value) ){

			alert("Invalid Email Id");

			formnm.cust_email.focus();

		}else if (formnm.cust_address.value == "") {

			alert("Please Enter Address");

			formnm.cust_address.focus();

		}else if (formnm.city.value == "") {

			alert("Please Enter City");

			formnm.city.focus();

		}else if (formnm.dname.value == "") {

			alert("Please Enter Doctor's Name");

			formnm.dname.focus();

		}else if (formnm.dadr1.value == "") {

			alert("Please Enter Doctor's address");

			formnm.dadr1.focus();

		}else if (formnm.zip.value == "") {

			alert("Please Enter Zip code");

			formnm.zip.focus();

		}else if (ActionType == "addprofile_todb" && formnm.txt_username.value =="") {

			alert("Please Enter User Name");

			formnm.txt_username.focus();

		}else if (ActionType == "addprofile_todb" && formnm.txt_password.value == "") {

			alert("Please Enter Password");

			formnm.txt_password.focus();			

		}else if (ActionType == "addprofile_todb" && formnm.txt_confpassword.value == "") {

			alert("Please Enter Password to Confirm");

			formnm.txt_confpassword.focus();			

		}else if (ActionType == "addprofile_todb" && (formnm.txt_password.value != formnm.txt_confpassword.value)) {

			alert("Confirm password to should be same as password");

			formnm.txt_confpassword.focus();			

		}else {		

			formnm.ActionType.value= ActionType;

			formnm.submit();				

		}

	}	

	else{

		formnm.ActionType.value= ActionType;

		formnm.submit();

	}

}

function isNull(FieldName){

	if(FieldName.charAt(0)==""){

		return true;

	}

	else{

		return false;

	}

 }

function resetForm(formnm) {

	formnm.reset();

}



function deleteProduct(formnm,ActionType,id,quan){

		formnm.qty.value= quan;

		formnm.product_id.value= id;

		formnm.ActionType.value= ActionType;

		//alert(formnm.product_id.value);

		formnm.submit();



}



function confirmshopping(formnm)

{

	formnm.ActionType.value="NonPay";

	//alert(formnm.ActionType.value)

	formnm.action=path+"result.php";

	formnm.submit();

}



function SubmitShopping1(formnm,ActionType,pres_p)

{

	

	

	if(pres_p == 1)

	{

	

			formnm.ActionType.value= ActionType;

			formnm.submit();				

		

	}	

	else{

		 formnm.ActionType.value= ActionType;

		 formnm.submit();

	}

	

	



}



function state_notpresent(textelement,listelement,textstate,obj,message)

{

		var textblock=document.getElementById(textelement);	

		var listblock=document.getElementById(listelement);	

			if(textblock.style.display == "block")

			{

				if(!checkBlank(textstate,message)) 

				return true;

			}

			if(listblock.style.display == "block")

			{	if(obj.selectedIndex == 0) 

			{	

					alert("Please Enter "+message)

					obj.focus();

						return true;

			}

			}

}



function SubmitShopping(formnm,ActionType)

{	

		

	if(ActionType == "InsertDet" || ActionType == "ModifyDet")

	{

			shipsamevalue=formnm.shipsame.checked;

		billsamevalue=formnm.billsame.checked;

	if(ActionType == "InsertDet")

		{

			docsamevalue=formnm.docsame.checked;	

		}





	if(shipsamevalue == 1)

		{

			document.custform.sname.value = document.custform.fname.value + " " + document.custform.lname.value;

			document.custform.saddr.value = document.custform.addr.value;

			document.custform.saddr2.value = document.custform.addr2.value;

			document.custform.scity.value = document.custform.city.value;

			document.custform.sstate.value = document.custform.state.value;

			document.custform.szipcode.value = document.custform.zipcode.value;

			document.custform.scno.value = document.custform.cno.value;

			document.custform.scno1.value = document.custform.cno1.value;

			document.custform.scountry.value = document.custform.country.value;

		}

		

		if(billsamevalue == 1)

		{

			document.custform.baddr.value = document.custform.addr.value;

			document.custform.baddr2.value = document.custform.addr2.value;

			document.custform.bcity.value = document.custform.city.value;

			document.custform.bstate.value = document.custform.state.value;

			document.custform.bzipcode.value = document.custform.zipcode.value;

			document.custform.bcno.value = document.custform.cno.value;

			document.custform.bcountry.value = document.custform.country.value;

		}

	if(ActionType == "InsertDet")

		{

		

		if(docsamevalue == 1)

		{

//			document.custform.dadr1.value = document.custform.addr.value;

//			document.custform.dadr2.value = document.custform.addr2.value;

			document.custform.dcountry.value = document.custform.country.value;

			document.custform.dstate.value = document.custform.state.value;

			document.custform.dcity.value = document.custform.city.value;

			document.custform.dzipcode.value = document.custform.zipcode.value;

		}

		}

		if(formnm.fname && isNull(formnm.fname.value))

		{

			alert("Please Enter Name");

			formnm.fname.focus();

		}else if(formnm.lname.value == ""){

			alert("Please Enter Last Name");

			formnm.lname.focus();

		}



		else if(ActionType == "InsertDet" && formnm.dobmonth.value == ""){

			alert("Please Enter Month");

			formnm.dobmonth.focus();

		}else if(ActionType == "InsertDet" && formnm.dobdate.value == ""){

			alert("Please Enter Date");

			formnm.dobdate.focus();

		}else if(ActionType == "InsertDet" && formnm.dobyear.value == ""){

			alert("Please Enter Year");

			formnm.dobyear.focus();

		}else if(ActionType == "InsertDet" && formnm.sex.value == ""){

			alert("Please Select Sex");

			formnm.sex.focus();

		}

		else if (formnm.addr && isNull(formnm.addr.value)) {

			alert("Please Enter Street1 Address");

			formnm.addr.focus();

		//}else if (formnm.addr2 && isNull(formnm.addr2.value)) {

		//	alert("Please Enter Street2 Address");

		//	formnm.addr2.focus();



		}

		else if (state_notpresent("showstatetext","showstatelist",formnm.state,formnm.statelist,"State"))

		{

			//return false;

		}

		else if (formnm.city && isNull(formnm.city.value)) {

			alert("Please Enter City");

			formnm.city.focus();

		}else if (formnm.zipcode && isNull(formnm.zipcode.value)) {

			alert("Please Enter Zipcode");

			formnm.zipcode.focus();

		}else if (formnm.cno && isNull(formnm.cno.value)) {

			alert("Please Enter Work Phone Number");

			formnm.cno.focus();

		}

		else if (formnm.cno1 && isNull(formnm.cno1.value)) {

			alert("Please Enter Home Phone Number");

			formnm.cno1.focus();

		}

		else if (formnm.sname  && isNull(formnm.sname.value) && shipsamevalue != 1) {

			alert("Please Enter Shipping Name");

			formnm.sname.focus();

		}else if (formnm.saddr  && isNull(formnm.saddr.value) && shipsamevalue != 1) {

			alert("Please Enter Shipping Address");

			formnm.saddr.focus();

		}else if (shipsamevalue != 1 && state_notpresent("showsstatetext","showsstatelist",formnm.sstate,formnm.sstatelist,"Shipping State"))

		{

//			alert("ttt"+shipsamevalue);

			//return false;

		

		}else if (formnm.scity  && isNull(formnm.scity.value) && shipsamevalue != 1) {

			alert("Please Enter Shipping City");

			formnm.scity.focus();

		}else if (formnm.szipcode  && isNull(formnm.szipcode.value) && shipsamevalue != 1) {

			alert("Please Enter Shipping Zip Code");

			formnm.szipcode.focus();

		}else if (formnm.scno  && isNull(formnm.scno.value) && shipsamevalue != 1) {

			alert("Please Enter Shipping Phone Number ( Work) ");

			formnm.scno.focus();

		}else if (formnm.scno1  && isNull(formnm.scno1.value) && shipsamevalue != 1) {

			alert("Please Enter Shipping Phone Number ( Home)");

			formnm.scno1.focus();

		}else if(formnm.baddr  && isNull(formnm.baddr.value) && billsamevalue != 1) {

			alert("Please Enter Billing Address Street1");

			formnm.baddr.focus();

		}else if (billsamevalue != 1 && state_notpresent("showbstatetext","showbstatelist",formnm.bstate,formnm.bstatelist,"Billing State"))

		{

			//return false;

		

		}else if(formnm.bcity  && isNull(formnm.bcity.value) && billsamevalue != 1) {

			alert("Please Enter Billing City");

			formnm.bcity.focus();

		}else if(formnm.bcno  && isNull(formnm.bcno.value) && billsamevalue != 1) {

			alert("Please Enter Billing Phone Number");

			formnm.bcno.focus();

		}

		else if (ActionType == "InsertDet" && formnm.txt_username.value == "") {

			alert("Please Enter Email Id");

			formnm.txt_username.focus();

		}



		else if (ActionType == "InsertDet" && !checkSpace(formnm.txt_username,'Email address')) 

		{ formnm.txt_username.focus(); }

		else if (ActionType == "InsertDet" && !checkEmail(formnm.txt_username,'Email Address'))

		{ formnm.txt_username.focus(); }	

		else if (ActionType == "InsertDet" && formnm.txt_password.value == "") {

			alert("Please Enter Password");

			formnm.txt_password.focus();			

		}	

		else if (ActionType == "InsertDet" && formnm.txt_confpassword.value == "") {

			alert("Please Enter Password to Confirm");

			formnm.txt_confpassword.focus();			

		}else if (ActionType == "InsertDet" && (formnm.txt_password.value != formnm.txt_confpassword.value)) {

			alert("Confirm Password should be same as the password ");

			formnm.txt_confpassword.focus();			

		}

		

		

		

		

		else if (formnm.dname  && isNull(formnm.dname.value)) {

			alert("Please Enter Doctors Name");

			formnm.dname.focus();

		}else if (formnm.dadr1  && isNull(formnm.dadr1.value)) {

			alert("Please Enter Doctors Address Street1");

			formnm.dadr1.focus();

		}

		



		else if (formnm.dcity  && isNull(formnm.dcity.value) && docsamevalue != 1) {

			alert("Please Enter Doctors City");

			formnm.dcity.focus();

		}else if (formnm.dstate  && isNull(formnm.dstate.value) && docsamevalue != 1) {

			alert("Please Enter Doctors State");

			formnm.dstate.focus();

		}else if (formnm.dzipcode  && isNull(formnm.dzipcode.value) && docsamevalue != 1) {

			alert("Please Enter Doctors Zipcode");

			formnm.dzipcode.focus();

		}else if (formnm.dphno  && isNull(formnm.dphno.value) && docsamevalue != 1) {

			alert("Please Enter Doctors Phone");

			formnm.dphno.focus();

		}

		else 

		{

			



		

			formnm.ActionType.value= ActionType;

					 		 

			formnm.submit();				

		}

	}	

	else{ 

		  if(ActionType =="purchase_history")

		{

			//formnm.action = "shoppingcart/ShoppingModule.php";

		  }

		//alert("@");

		 formnm.ActionType.value= ActionType;		

		 formnm.submit();

	}



}

function proceed(formnm,islogin)	{

	

	var currentActionType;

	if(formnm.opt_prescription[0].checked == true)

	{

		if(islogin == 0)

		currentActionType="doctor_details";

		else

		currentActionType="ProcessLoggedIn";

		formnm.ActionType.value= currentActionType;

		formnm.submit();

	}

	else if(formnm.opt_prescription[1].checked == true)

	{

		currentActionType="medical_history";

		formnm.ActionType.value= currentActionType;

		formnm.submit();

	}

	else

	{

		alert("Before Proceeding , Please Select the Prescription Options!!");		

	}

	

}

 function doc_50_pres(elementname)

 {	

	var block=document.getElementById(elementname);	

	hide_discount();

	if(document.custform.choose_dis[0].value == 0)

	block.style.display = "block";

	else

	block.style.display = "none";	

}

 function ofmd(elementname)

 {	

	var block=document.getElementById(elementname);	

	hide_discount();

	if(document.custform.choose_dis[0].value == 1 || document.custform.choose_dis[1].value == 1)

	block.style.display = "block";

	else

	block.style.display = "none";	

}

 function magnet(elementname)

 {	

	var block=document.getElementById(elementname);	

	hide_discount();

	if(document.custform.choose_dis[0].value == 2 || document.custform.choose_dis[1].value == 2 || document.custform.choose_dis[2].value == 2 )

	block.style.display = "block";

	else

	block.style.display = "none";	

}

   function new_cust_dis(elementname)

 {	

	var block=document.getElementById(elementname);	

	hide_discount();

	if(document.custform.choose_dis[0].value == 3 || document.custform.choose_dis[1].value == 3 || document.custform.choose_dis[2].value == 3 || document.custform.choose_dis[3].value == 3)

	block.style.display = "block";

	else

	block.style.display = "none";	

}

function buy4get1_dis(elementname)

{

	var block=document.getElementById(elementname);	

	hide_discount();

	if(document.custform.choose_dis[0].value == 4  || document.custform.choose_dis[1].value == 4  || document.custform.choose_dis[2].value == 4  || document.custform.choose_dis[3].value == 4 || document.custform.choose_dis[4].value == 4)

	block.style.display = "block";

	else

	block.style.display = "none";	

}

function survey25(elementname)

{

	var block=document.getElementById(elementname);	

	hide_discount();

	if(document.custform.choose_dis[0].value == 5  || document.custform.choose_dis[1].value == 5  || document.custform.choose_dis[2].value == 5  || document.custform.choose_dis[3].value == 5  || document.custform.choose_dis[4].value == 5 || document.custform.choose_dis[5].value == 5)

	block.style.display = "block";

	else

	block.style.display = "none";	

}





function hide_discount()

{

document.getElementById('doc_freeprescription').style.display = "none";

document.getElementById('ofmd_25').style.display = "none";

document.getElementById('check_mag').style.display = "none";

document.getElementById('new_customer').style.display = "none";

document.getElementById('get1buy4').style.display = "none";

document.getElementById('survey_mon').style.display = "none";



}

function check_option(id,elementname)

 {

	var block=document.getElementById(elementname);	

	if(id == 1)

	var rootblock1=document.custform.shipsame;

	else

	var rootblock1=document.custform.billsame;



	//alert("Check Level ==="+rootblock1.checked);

	if(rootblock1.checked == 0)

	block.style.display = "block";

	else

	block.style.display = "none";

	//alert("Check Block Level"+block.style.display);



 }





function check_option1(id,elementname)

 {

	var block=document.getElementById(elementname);	

	if(id == 3)

	var rootblock1=document.custform.docsame;

	//alert("Check Level ==="+rootblock1.checked);

	if(rootblock1.checked == 0)

	block.style.display = "block";

	else

	block.style.display = "none";

	//alert("Check Block Level"+block.style.display);



 }





 function check_refcode(elementname)

 {

	var block=document.getElementById(elementname);

	if(document.custform.isrefcode.checked == 1)

	block.style.display = "block";

	else

	block.style.display = "none";



 }





function check_promocode(elementname)

 {

	var block=document.getElementById(elementname);

	if(document.custform.isrefcode.checked == 1)

	block.style.display = "block";

	else

	block.style.display = "none";



 }



var win = null;

function NewWindow(mypage,myname,w,h,scroll){

LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;

TopPosition = (screen.height) ? (screen.height-h)/2 : 0;

settings =

'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'

win = window.open(mypage,myname,settings)

}







function submit_associate()

{

	if(!checkBlank(document.associate.associate_emailid,'Email address')) return false;

	if(!checkSpace(document.associate.associate_emailid,'Email address')) return false;

	if(!checkEmail(document.associate.associate_emailid,'Email Address')) return false;

	if(!checkBlank(document.associate.associate_passwd,'Enter Password')) return false;

	if(!checkSpace(document.associate.associate_passwd,'Enter Password')) return false;

	//if(!checkBlank(document.associate.txt_confpassword,'Enter Confirm Password')) return false;

	//if(!checkSpace(document.associate.txt_confpassword,'Enter Password')) return false;



	document.associate.submit();

}



function submit_associate()

{

	if(!checkBlank(document.associate.associate_emailid,'Email address')) return false;

	if(!checkSpace(document.associate.associate_emailid,'Email address')) return false;

	if(!checkEmail(document.associate.associate_emailid,'Email Address')) return false;

	if(!checkBlank(document.associate.associate_passwd,'Enter Password')) return false;

	if(!checkSpace(document.associate.associate_passwd,'Enter Password')) return false;

	//if(!checkBlank(document.associate.txt_confpassword,'Enter Confirm Password')) return false;

	//if(!checkSpace(document.associate.txt_confpassword,'Enter Password')) return false;

	document.associate.submit();

}



// referral scroller script





var Type = 'Z';

var toppos;

function StartFloat(swfpos) {

	toppos=swfpos;

if(document.all) {

	document.all.AdFloater.style.pixelLeft = 0;

	document.all.AdFloater.style.visibility = 'visible';

	Type = 'A';

	}

else if(document.layers) {

	document.AdFloater.left = window.innerWidth - document.AdFloater.clip.width - 18;

	document.AdFloater.visibility = 'show';

	Type = 'B';

	}

else if(document.getElementById) {

	document.getElementById('AdFloater').style.left = (window.innerWidth - 35) + 'px';

	document.getElementById('AdFloater').style.visibility = 'visible';

	Type = 'C';

	}

if (document.all) { window.onscroll = Float; }

else { setInterval('Float()', 2000); }

}

function Float() {

if (Type == 'A') {

	var scrolltop=document.body.scrollTop;

	if(scrolltop < toppos)

	document.all.AdFloater.style.pixelTop=toppos;

	else

	document.all.AdFloater.style.pixelTop=scrolltop;

	}

else if (Type == 'B') { document.AdFloater.top = window.pageYOffset; }

else if (Type == 'C') { document.getElementById('AdFloater').style.top = window.pageYOffset + 'px'; }

} 




