function validatepoints()
{
	if(document.frmpointsmanage.txtinvoice.value == "")
	{
		alert("Please enter Invoice number.")
		document.frmpointsmanage.txtinvoice.focus();
		return false;
	}
	if(document.frmpointsmanage.ddlDistname.value == "")
	{
		alert("Please select Distributors name.")
		document.frmpointsmanage.ddlDistname.focus();
		return false;
	}
	if(document.frmpointsmanage.ddlProd.value == ".: Seleccione :.")
	{
		if(document.frmpointsmanage.ddlProd1.value == ".: Seleccione :." && document.frmpointsmanage.ddlProd2.value == ".: Seleccione :." && document.frmpointsmanage.ddlProd3.value == ".: Seleccione :." && document.frmpointsmanage.ddlProd4.value == ".: Seleccione :." && document.frmpointsmanage.ddlProd5.value == ".: Seleccione :." && document.frmpointsmanage.ddlProd6.value == ".: Seleccione :." && document.frmpointsmanage.ddlProd7.value == ".: Seleccione :." && document.frmpointsmanage.ddlProd8.value == ".: Seleccione :." && document.frmpointsmanage.ddlProd9.value == ".: Seleccione :.")
		{
			alert("Please select atleast one product...");
			document.frmpointsmanage.ddlProd.focus();
			return false;
		}
	}
	return true;
}
function validatesize()
{
	alert("hi");
	var val1 = document.frmpointsmanage.lblProdSize.value ;
	var val2 = document.frmpointsmanage.lblProdSize1.value ;
	var val3 = document.frmpointsmanage.lblProdSize2.value ;
	var val4 = document.frmpointsmanage.lblProdSize3.value ;
	var val5 = document.frmpointsmanage.lblProdSize4.value ;
	var val6 = document.frmpointsmanage.lblProdSize5.value ;
	var val7 = document.frmpointsmanage.lblProdSize6.value ;
	var val8 = document.frmpointsmanage.lblProdSize7.value ;
	var val9 = document.frmpointsmanage.lblProdSize8.value ;
	var val10 = document.frmpointsmanage.lblProdSize9.value ;
	
	if(val1 == val2)
	{
		alert("Sizes are same..");
		return false;
	}
	return true;				
	
}
function mailtofriend(url)
	{
		width = 510;
		height = 450;
		xx = window.screen.width;
		yy = window.screen.height;
		xx = (xx/2) - (width/2);
		yy = (yy/2) - (height);
		tt = 50;
		style = 'left = ' +  xx + ',top = ' + tt + ',width='+ width +',height=' + height + ',directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=yes';
		newwindow=window.open(url,'name',style);
		if (window.focus) {newwindow.focus()}
	}
function validatefaq()
{
	if (document.frmFaq.search.value == "")
	{
		alert("Enter text for search");
		document.frmFaq.search.focus();
		return false;
	}
	frmFaq.action="faqdetails.aspx?flag=2&search="+document.frmFaq.search.value;
	return true;
}

function ValidateContactUs()
{
 	var ErrMsg="";
	var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
	var matchArray = Form1.Contactus2_txtEmail.value.match(emailPat);
	var ErrorDisp = "You are missing following entries.\n";
	ErrorDisp += "----------------------------------------\n";
	
	if(document.Form1.Contactus2_txtFname.value=="" )
	{
		strd = "Name Required";		
		alert(strd);
		document.Form1.Contactus2_txtFname.focus();
		return false;
	}
	
	if(document.Form1.Contactus2_txtFname.value.charAt(0)==' ')
	{    alert("Name required"); 
		 document.Form1.Contactus2_txtFname.focus();
		 return false;
	 }
	if(document.Form1.Contactus2_txtLName.value=="" )
	{
		strd = "ID Required";		
		alert(strd);
		document.Form1.Contactus2_txtLName.focus();
		return false;
	}
	
	if(document.Form1.Contactus2_txtLName.value.charAt(0)==' ')
	{    alert("ID required"); 
		 document.Form1.Contactus2_txtLName.focus();
		 return false;
	 }
	if(document.Form1.Contactus2_txtEmail.value==""||document.Form1.Contactus2_txtEmail.value=="Enter your email.")
	{
	    alert("Email required");		
		document.Form1.Contactus2_txtEmail.focus();
		return false;
	}
	else if (matchArray == null)
	{
		alert("Invalid Email format");
		document.Form1.Contactus2_txtEmail.focus();
		return false;
	}
	
	 if(document.Form1.Contactus2_txtComments.value==""||document.Form1.Contactus2_txtComments.value=="Enter your comments here")
	{
	    alert("Comments required");
		document.Form1.Contactus2_txtComments.focus();
		return false;		
	}
	
	if(document.Form1.Contactus2_txtComments.value.charAt(0)==' ')
	{  
	    alert("No spaces allowed.");
	    document.Form1.Contactus2_txtComments.focus();
		return false;
    }
	if(document.Form1.Contactus2_txtComments.value.length > 250)
	 {
			alert("Please enter only 250 characters");
			document.Form1.Contactus2_txtComments.focus();
			return false; 
	 }
	 
	if(document.Form1.Contactus2_CodeNumberTextBox.value=="")
	{
		alert("Verification code required");
		document.Form1.Contactus2_CodeNumberTextBox.focus();
		return false;
	}
	
	/*if(document.Form1.Contactus2_ddlCountry.selectedIndex==".::Please Select::.")
	{
		ErrMsg += "Country required\n";
	}*/
	
	if (ErrMsg=="")
	{
		return true;
	}
	else
	{	
		alert(ErrorDisp+ErrMsg);
		return false;
	}
}

function ValidateFaqDetails()
{
	var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
	var matchArray = Form1.TextBox2.value.match(emailPat);
	if(document.Form1.TextBox2.value=="")
	{
		alert("Email required");
		document.Form1.TextBox2.focus();
		return false;
	}
	else if (matchArray == null)
	{
		alert("Invalid Email format");
		document.Form1.TextBox2.focus();
		return false;
	}
	if(document.Form1.txtArea.value=="")
	{
		alert("Question required");
		document.Form1.txtArea.focus();
		return false;
	}
	return true;
}

function ValidateProfile()
{
	
 	var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
	var matchArray = Form2.Profile1_txtEmail.value.match(emailPat);
	if(document.Form2.Profile1_txtFName.value=="")
	{  
		alert("First name required");
		document.Form2.Profile1_txtFName.focus();
		return false;
	}
	if(document.Form2.Profile1_txtFName.value.charAt(0)==' ')
	{   alert("No spaces allowed.\n");
		document.Form2.Profile1_txtFName.focus();
		return false;
	}
	if(document.Form2.Profile1_txtUserName.value=="")
	{
		alert("User name required");
		document.Form2.Profile1_txtUserName.focus();
		return false;
	}
	if(document.Form2.Profile1_txtUserName.value.charAt(0)==' ')
	{   alert("No spaces allowed.\n");
		document.Form2.Profile1_txtUserName.focus();
		return false; 
    }
	if(document.Form2.Profile1_txtPassword.value=="")
	{
		alert("Password required");
		document.Form2.Profile1_txtPassword.focus();
		return false;
	}
	if(document.Form2.Profile1_txtPassword.value.charAt(0)==' ')
	{    alert("No spaces allowed.\n"); 
		document.Form2.Profile1_txtPassword.focus();
		return false;
	 }
	if(document.Form2.Profile1_txtEmail.value=="")
	{
		alert("Email required");
		document.Form2.Profile1_txtEmail.focus();
		return false;
	}
	else if (matchArray == null)
	{
		alert("Invalid Email format");
		document.Form2.Profile1_txtEmail.focus();
		return false;
	}
	
	if(document.Form2.Profile1_ddlCountry.value==".::Please Select::.")
	{
		alert("Country required");
		return false;
	}
	
	if(document.Form2.Profile1_txtAns.value=="")
	{
		alert("Answer required");
		document.Form2.Profile1_txtAns.focus();
		return false;
	}
	if(document.Form2.Profile1_txtAns.value.charAt(0)==' ')
	{    alert("No spaces allowed.\n");
	document.Form2.Profile1_txtAns.focus(); 
	return false;
	 }
	return true;
	}
	
function loopy() {
		loc = window.location.href
		sPos =loc.lastIndexOf("/")+1;
		if (sPos != -1) loc = loc.substring(0,sPos); // loose existing search
		window.location = loc+'logout.aspx';
	}

function popup(url)
{
	width = 450;
	height = 345;
	xx = window.screen.width;
	yy = window.screen.height;
	xx = (xx/2) - (width/2);
	yy = (yy/2) - (height);
	style = 'left = ' +  xx + ',top = ' + yy + ',width='+ width +',height=' + height + ',directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no';
	newwindow=window.open(url,'name',style);
	if (window.focus) {newwindow.focus()}
}

function HeaderEmailValidation()
{
	var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
	var matchArray =document.newsletter.m_txtNewsLetter.value.match(emailPat);
	if(document.newsletter.m_txtNewsLetter.value==" ")
	{
		alert("Enter Email address.");
		document.newsletter.m_txtNewsLetter.focus();
		return false;
	}
	else if (matchArray == null)
	{
		alert("Invalid Email format.");
		document.newsletter.m_txtNewsLetter.value="";
		document.newsletter.m_txtNewsLetter.focus();
		return false;
	}
}

function HeaderMobValidation()
{
	
	var mobPat = /(^\d+$)|(^\d+\.\d+$)/
	var matchArray =document.mobmsg.m_txtmobnumber.value.match(mobPat);
	if(document.mobmsg.m_txtmobnumber.value==" ")
	{
		alert("Enter mobile number.");
		document.mobmsg.m_txtmobnumber.focus();
		return false;
	}
	else if (matchArray == null)
	{
		alert("Invalid Mobile Number.");
		document.mobmsg.m_txtmobnumber.value="";
		document.mobmsg.m_txtmobnumber.focus();
		return false;
	}
}


function HeaderLoginValidation()
{
	
	if(document.frmPreclient.m_txtusername.value=="")
	{
		alert("Enter your username.");
		document.frmPreclient.m_txtusername.focus();
		return false;
	}
	
	if(document.frmPreclient.m_txtPassword.value=="")
	{
		alert("Enter your password.");
		document.frmPreclient.m_txtPassword.focus();
		return false;
	}
	return true;
}

function HeaderSearchValidation()
{
	if(document.frmsearch.m_txtSearch.value=="")
	{
		alert("Enter search text.");
		document.frmsearch.m_txtSearch.focus();
		return false;
	}
}

function ValidateOrder()
{
	if(document.frmOrder.txtinvoice.value == "")
	{
		alert("Please enter valid invoice number.");
		document.frmOrder.txtinvoice.focus();
		return false;
	}
	if(document.frmOrder.ddlDistname.value == "")
	{
		alert("Please select distributor's name.");		
		return false;
	}
	if(document.frmOrder.ddlProdCat.value == "")
	{
		alert("Please select Product type.");		
		return false;
	}
	if(document.frmOrder.ddlProd.value == "")
	{
		alert("Please select product.");
		document.frmOrder.ddlProd.focus();
		return false;
	}
	if(document.frmOrder.ddlSize.value == "")
	{
		alert("Please select size of product.");
		document.frmOrder.ddlSize.focus();
		return false;
	}
	if(document.frmOrder.txtquantity.value == "")
	{
		alert("Please enter quantity.");
		document.frmOrder.txtquantity.focus();
		return false;
	}
	return true;	
}