function check_fields()
{
	var flag;
	if (emptyField(document.getElementById("Login_User1_txtUser")))
	{
		alert("Enter your Email Address");
		document.getElementById("Login_User1_txtUser").focus();
		return false;
	}
	
	arg=document.getElementById("Login_User1_txtUser").value;
	flag=check_email(arg);
	if (flag==0)
	{
		alert('Enter valid e-mail address.');
		document.getElementById("Login_User1_txtUser").focus();
		return false;	
	}
	if (emptyField(document.getElementById("Login_User1_txtPassword")))
	{
		alert("Enter Password");
		document.getElementById("Login_User1_txtPassword").focus();
		return false;
	}
}

function Signup_fields()
{
	var arg;
	var flag;
	
	if (emptyField(document.getElementById("Signup1_txtEmail")))
	{
		alert("Enter your Email Address");
		document.getElementById("Signup1_txtEmail").focus();
		return false;
	}
	
	arg=document.getElementById("Signup1_txtEmail").value;
	flag=check_email(arg);
	if (flag==0)
	{
		alert('Enter valid e-mail address.');
		document.getElementById("Signup1_txtEmail").focus();
		return false;	
	}
	
	
	
	if (emptyField(document.getElementById("Signup1_txtPass")))
	{
		alert('Enter Password..');
		document.getElementById("Signup1_txtPass").focus();
		return false;
	}
	
	if (emptyField(document.getElementById("Signup1_txtPassAgain")))
	{
		alert('Enter Confirm Password..');
		document.getElementById("Signup1_txtPassAgain").focus();
		return false;
	}
	
	var pass1=document.getElementById("Signup1_txtPass").value;
	var pass2=document.getElementById("Signup1_txtPassAgain").value;
	flag=check_password(pass1,pass2)
	if (flag==0 || flag== 1)
	{
		alert('Password and confirm password must be same.');
		document.getElementById("Signup1_txtPass").focus();
		return false;
	}
	
	if (emptyField(document.getElementById("Signup1_txtFname")))
	{
		alert('Enter Your First Name.');
		document.getElementById("Signup1_txtFname").focus();
		return false;
	}
	if (emptyField(document.getElementById("Signup1_txtLname")))
	{
		alert('Enter Your Last Name.');
		document.getElementById("Signup1_txtLname").focus();
		return false;
	}
	
	if (document.getElementById("Signup1_ddlDate").value == "0")
	{
		alert('Select Day.');
		document.getElementById("Signup1_ddlDate").focus();
		return false;
	}
	if (document.getElementById("Signup1_ddlMonth").value == "0")
	{
		alert('Select Month.');
		document.getElementById("Signup1_ddlMonth").focus();
		return false;
	}
	if (document.getElementById("Signup1_ddlYear").value == "0")
	{
		alert('Select Year.');
		document.getElementById("Signup1_ddlYear").focus();
		return false;
	}
}

/*function check_product(i)
{
	if(i.value==0)
	{
		alert('Select product');
		return false;
	}
}*/

function advcheck_product(i,pid)
{
document.getElementById("AdvSearch1_pvalueid").value=i.value;
document.getElementById("AdvSearch1_pid").value=pid;
}


function check_product(i,pid)
{
//pvalueid
//pid

document.getElementById("SearchProducts1_pvalueid").value=i.value;
document.getElementById("SearchProducts1_pid").value=pid;

//alert('pvalueid ' + document.getElementById("SearchProducts1_pvalueid").value);
//alert('pid ' + document.getElementById("SearchProducts1_pid").value);

//return false;
	/*if(i.value==0)
	{
		alert('Select product');
		return false;
	}*/
}

function check_product1(i,pid)
{
//pvalueid
//pid

document.getElementById("View_products1_pvalueid").value=i.value;
document.getElementById("View_products1_pid").value=pid;
//alert('pvalueid ' + document.getElementById("View_products1_pvalueid").value);
//alert('pid ' + document.getElementById("View_products1_pid").value);
}

function check_qty(txtqty)
{           
				var test =0;
				var con = 2;
				var con2 = 2;
				for (var i=0; i<document.Form1.length; i++)
				{
				
					 if (document.getElementById("DataGrid1__ctl"+con+"_txtqty"))
					 {
					    if (emptyField(document.getElementById("DataGrid1__ctl"+con+"_txtqty")))
								{
									alert('Please Enter Quantity');
									document.getElementById("DataGrid1__ctl"+con+"_txtqty").focus();
									return false;
								}
								
							if (document.getElementById("DataGrid1__ctl"+con+"_txtqty").value < 1)
								
								{
									alert('Quantity Must Be Greater Then Zero.');
									document.getElementById("DataGrid1__ctl"+con+"_txtqty").focus();
									return false;
								}
					
							if (!isInt(document.getElementById("DataGrid1__ctl"+con+"_txtqty").value))
								
								{
									alert('Please Enter Integer Value.');
									document.getElementById("DataGrid1__ctl"+con+"_txtqty").focus();
									return false;
								}
					
					
						con =con + 1;	
					 
					 }
							
						///added new for gift voucher////
						 if (document.getElementById("DataGrid2__ctl"+con2+"_txtgvqty"))
			               {
			                if (emptyField(document.getElementById("DataGrid2__ctl"+con2+"_txtgvqty")))
								        {
									        alert('Please Enter Quantity');
									        document.getElementById("DataGrid2__ctl"+con2+"_txtgvqty").focus();
									        return false;
								        }
        								
							        if (document.getElementById("DataGrid2__ctl"+con2+"_txtgvqty").value < 1)
        								
								        {
									        alert('Quantity Must Be Greater Then Zero.');
									        document.getElementById("DataGrid2__ctl"+con2+"_txtgvqty").focus();
									        return false;
								        }
        					
							        if (!isInt(document.getElementById("DataGrid2__ctl"+con2+"_txtgvqty").value))
        								
								        {
									        alert('Please Enter Integer Value.');
									        document.getElementById("DataGrid2__ctl"+con2+"_txtgvqty").focus();
									        return false;
								        }        			       
			               }		
				        con2 =con2 + 1;	
						///end added new for gift voucher////
							
				}
		
				
				
				
}

function set_shippingInfo()
{
	if(document.getElementById("chkShip").checked==true)
	{
		document.Form1.txtShipFname.value = document.getElementById("txtBillFname").value;
		document.Form1.txtShipLname.value = document.getElementById("txtBillLname").value;
		document.Form1.txtShipAddr1.value = document.getElementById("txtBillAddr1").value;
		document.Form1.txtShipAddr2.value = document.getElementById("txtBillAddr2").value;
		document.Form1.txtShipCity.value = document.getElementById("txtBillCity").value;
		document.Form1.txtShipState.value = document.getElementById("txtBillState").value;
		document.Form1.ddlShipCountry.value = document.getElementById("ddlBillCountry").value;
		document.Form1.txtShipPost.value = document.getElementById("txtBillPost").value;
		document.Form1.txtShipPhone.value = document.getElementById("txtBillPhone").value;
		
		
	}
	else if(document.getElementById("chkShip").checked==false)
	{
		document.Form1.txtShipFname.value = "";
		document.Form1.txtShipLname.value = "";
		document.Form1.txtShipAddr1.value = "";
		document.Form1.txtShipAddr2.value = "";
		document.Form1.txtShipCity.value = "";
		document.Form1.txtShipState.value = "";
		document.Form1.ddlShipCountry.value = "0";
		document.Form1.txtShipPost.value = "";
		document.Form1.txtShipPhone.value = "";
	}
}
function check_billingInfo()
{
	var arg;
	var flag;
	// check billing info fields
	if (emptyField(document.getElementById("txtBillFname")))
	{
		alert("Enter your First Name");
		document.getElementById("txtBillFname").focus();
		return false;
	}
	if (emptyField(document.getElementById("txtBillLname")))
	{
		alert("Enter your Last Name");
		document.getElementById("txtBillLname").focus();
		return false;
	}
	if (emptyField(document.getElementById("txtBillAddr1")))
	{
		alert("Enter your Address Line 1");
		document.getElementById("txtBillAddr1").focus();
		return false;
	}
	if (emptyField(document.getElementById("txtBillCity")))
	{
		alert("Enter your Town/City");
		document.getElementById("txtBillCity").focus();
		return false;
	}
	if (emptyField(document.getElementById("txtBillState")))
	{
		alert("Enter your County / State");
		document.getElementById("txtBillState").focus();
		return false;
	}
	if (document.getElementById("ddlBillCountry").value == "0")
	{
		alert('Select Your Country.');
		document.getElementById("ddlBillCountry").focus();
		return false;
	}
	if (emptyField(document.getElementById("txtBillPost")))
	{
		alert('Enter your Post Code/Zip');
		document.getElementById("txtBillPost").focus();
		return false;
	}
	if (emptyField(document.getElementById("txtBillPhone")))
	{
		alert('Enter your Telephone.');
		document.getElementById("txtBillPhone").focus();
		return false;
	}
	//if (!isInt(document.getElementById("txtBillPhone").value))
	//{
	//	alert('Please enter only digits.');
	//	document.getElementById("txtBillPhone").focus();
//		return false;
//	}
	
	// check shipping info fields
	if (emptyField(document.getElementById("txtShipFname")))
	{
		alert("Enter your First Name");
		document.getElementById("txtShipFname").focus();
		return false;
	}
	if (emptyField(document.getElementById("txtShipLname")))
	{
		alert("Enter your Last Name");
		document.getElementById("txtShipLname").focus();
		return false;
	}
	if (emptyField(document.getElementById("txtShipAddr1")))
	{
		alert("Enter your Address Line 1");
		document.getElementById("txtShipAddr1").focus();
		return false;
	}
	if (emptyField(document.getElementById("txtShipCity")))
	{
		alert("Enter your Town/City");
		document.getElementById("txtShipCity").focus();
		return false;
	}
	if (emptyField(document.getElementById("txtShipState")))
	{
		alert("Enter your County / State");
		document.getElementById("txtShipState").focus();
		return false;
	}
	if (document.getElementById("ddlShipCountry").value == "0")
	{
		alert('Select Your Country.');
		document.getElementById("ddlShipCountry").focus();
		return false;
	}
	if (emptyField(document.getElementById("txtShipPost")))
	{
		alert('Enter Your Post Code/Zip');
		document.getElementById("txtShipPost").focus();
		return false;
	}
	if (emptyField(document.getElementById("txtShipPhone")))
	{
		alert('Enter your Telephone.');
		document.getElementById("txtShipPhone").focus();
		return false;
	}
	//if (!isInt(document.getElementById("txtShipPhone").value))
	//{
	//	alert('Please enter only digits.');
	//	document.getElementById("txtShipPhone").focus();
	//	return false;
//	}
}


function getObjectByID(Objid){	
				var ns4 = document.layers;
			var ns6 = document.getElementById && !document.all;
			var ie4 = document.all;
				if(ns4)
				{
					return eval('document.' + Objid)
				}
				if(ns6)
				{
					return document.getElementById(Objid);
				}
				if(ie4)
				{
					return document.all(Objid);      
				}  
				return null
			}


			function SetText(objid,msg, fg, bg){
				var ns4 = document.layers;
			var ns6 = document.getElementById && !document.all;
			var ie4 = document.all;
				if(!fg) fg = "#ff0000";
				if(!bg) bg = "#FFFFFF";
				
				var content = msg ;
				if(ns4)
				{
					objItm = eval('document.' + objid)
					objItm.document.write(content);
					objItm.document.close();
					objItm.visibility = "visible";
				}
				if(ns6)
				{
					document.getElementById(objid).innerHTML = content;
				}
				if(ie4)
				{
					document.all(objid).innerHTML=content;
				}  
			}
			
			
		///vishal script//	
		/*function check_radiobutton()
		{ 
			var i;
			var tot;
			for(i=0;i<document.Form1.length;i++)
			{
				if(document.Form1.elements[i].type=="radio")
				{
					if(document.Form1.elements[i].checked==true)
					{
						document.getElementById("NetPrc").value	 = parseFloat(document.getElementById("subtot").value) + parseFloat(document.Form1.elements[i].value);
					}
				}
				
			}
			//alert('discount: ' +document.getElementById("dis").value);
			if (document.getElementById("dis").value!="")
			{
			document.getElementById("NetPrc").value	=parseFloat(document.getElementById("NetPrc").value) - parseFloat(document.getElementById("dis").value);		
			}
			tot=(parseFloat(document.getElementById("NetPrc").value)).toFixed(2);			
					
			SetText("Contenttot", tot);
		}*/
		
		//end of vishal script
		
		function check_radiobutton()
		{ 
			var i;
			var tot;
			for(i=0;i<document.Form1.length;i++)
			{
				if(document.Form1.elements[i].type=="radio")
				{
					if(document.Form1.elements[i].checked==true)
					{
						document.getElementById("NetPrc").value	 = parseFloat(document.getElementById("subtot").value) + parseFloat(document.Form1.elements[i].value);
					}
				}
				
			}
		
			if (document.getElementById("dis").value!="")
			{
			document.getElementById("NetPrc").value	=parseFloat(document.getElementById("NetPrc").value) - parseFloat(document.getElementById("dis").value); 		
			}
			
			document.getElementById("NetPrc").value = parseFloat(document.getElementById("NetPrc").value) - parseFloat(document.getElementById("spdis").value);
			
			tot=(parseFloat(document.getElementById("NetPrc").value)).toFixed(2);			
					
			SetText("Contenttot", tot);
		}
		function checkKey(b1,e)
		{
		    
			if (e.keyCode == 13)
			{
				document.getElementById(b1).click();
				return false;
			}
		}	
		
		function changeoverimg(img)
		{
		//alert('vishal');
		img.src="images/buy_hov.gif";
		}
		
		function changeoutimg(img)
		{
		//alert('vishal');
		img.src="images/buy.gif";		
		}
	
		
		
		function validwishlist(img)
		{
			alert('Please Login First To Add Product In Wish List.');
			return false;
		}
		
		
function checkfront1(val)
{
//alert(val);
	var con=0;
	for (var i=0; i<document.Form1.length; i++)
	{
		if(document.Form1.elements[i].type == "checkbox")
		{
			if ( document.Form1.elements[i].checked == true )
			{
				con++;
			}
		}	
	}
	if (con==0)
	{
		if (val == "Export")
		{
			
			alert('Please Select Atleast One Record For Send Wishlist');			
			return false;
		}
		else
		{
			alert('Please Select Atleast One Record For Send Wishlist');
			return false;
		}
	}
}

function checkfront2(val)
{
//alert(val);
	var con=0;
	for (var i=0; i<document.Form1.length; i++)
	{
		if(document.Form1.elements[i].type == "checkbox")
		{
			if ( document.Form1.elements[i].checked == true )
			{
				con++;
			}
		}	
	}
	if (con==0)
	{
		if (val == "Export")
		{
			
			alert('Please Select Atleast One Record For Add To Cart');			
			return false;
		}
		else
		{
			alert('Please Select Atleast One Record For Add To Cart');
			return false;
		}
	}	
}
function checkfront3(val)
{
//alert(val);
	var con=0;
	for (var i=0; i<document.Form1.length; i++)
	{
		if(document.Form1.elements[i].type == "checkbox")
		{
			if ( document.Form1.elements[i].checked == true )
			{
				con++;
			}
		}	
	}
	if (con==0)
	{
		if (val == "Export")
		{
			
			alert('Please Select Atleast One Record For Update');			
			return false;
		}
		else
		{
			alert('Please Select Atleast One Record For Update');
			return false;
		}
	}	
}
