

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=="" )
	{
		alert("First name required\n");
		document.Form1.Contactus2_txtFname.focus();
		return false;
	}
	
	if(document.Form1.Contactus2_txtFname.value.charAt(0)==' ')
	{    alert("First name required"); 
		 document.Form1.Contactus2_txtFname.focus();
		 return false;
	 }	
	if(document.Form1.Contactus2_txtEmail.value == " " )
	{
	    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 HeaderLoginValidation()
{
	if(document.login.m_txtUserName.value==" ")
	{
		alert("Enter your username.");
		document.login.m_txtUserName.focus();
		return false;
	}
	
	if(document.login.m_txtPassword.value=="")
	{
		alert("Enter your password.");
		document.login.m_txtPassword.focus();
		return false;
	}
	return true;
}

function HeaderSearchValidation()
{
	if(document.Search.m_txtSearch.value==" ")
	{
		alert("Enter search text.");
		document.Search.m_txtSearch.focus();
		return false;
	}
}
function popup1(url)
	{
		width = 620;
		height = 600;
		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=yes,status=no,toolbar=no,resizable=yes';
		newwindow=window.open(url,'name',style);
		if (window.focus) {newwindow.focus()}
	}
	
	function mailtofriend(url)
	{
		width = 450;
		height = 340;
		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=yes,status=no,toolbar=no,resizable=yes';
		newwindow=window.open(url,'name',style);
		if (window.focus) {newwindow.focus()}
	}
	function Mailfriendvalidation()
    {
        var strd;
		var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
		var matchArray = form1.txtfriendemail.value.match(emailPat);
		var matchArray1 = form1.txtselfEmail.value.match(emailPat);
	    if(matchArray == null)
	    {
		    strd=document.form1.MRF1.value;
		    alert(strd);
		    document.form1.txtfriendemail.focus();
		    return false;
	    }
    	
	    if(matchArray1 == null)
	    {
		    strd=document.form1.MRF2.value;
		    alert(strd);
		    document.form1.txtselfEmail.focus();
		    return false;
	    }
	    return true;
    }
    function Callmevalidation()
	{
	    var strd;
		var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
		var matchArray = frmcontactus.txtemail.value.match(emailPat);
		if (document.frmcontactus.txtfname.value == "")
		{
		    strd=document.frmcontactus.MRF1.value;
		    alert(strd);
			/*alert ("Please enter your first name.");*/
			document.frmcontactus.txtfname.focus();
			return false;
		}
		if (document.frmcontactus.txtlname.value == "")
		{
		    strd=document.frmcontactus.MRF2.value;
		    alert(strd);
			/*alert ("Please enter your last name.");*/
			document.frmcontactus.txtlname.focus();
			return false;
		}
		if (matchArray == null)
		{
		    strd=document.frmcontactus.MRF3.value;
		    alert(strd);
			/*alert ("Please enter your valid email address.");*/
			document.frmcontactus.txtemail.focus();
			return false;
		}
			
		
		return true;
	}
function validatmailid()
{
    var strd;
	var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
	var matchArray = frmnews.txtnewsletter.value.match(emailPat);
	if(matchArray == null)
    {
	   alert ("Please enter your valid email address.");
	    document.frmnews.txtnewsletter.focus();
	    return false;
    }
    
}
function validatuser()
{
		if (document.frmlogin.m_txtUserName.value == "username" || document.frmlogin.m_txtUserName.value == "")
		{
			alert ("Please Enter User Name");
			document.frmlogin.m_txtUserName.focus();
			return false;
		}
		if (document.frmlogin.m_txtPassword.value == "password" || document.frmlogin.m_txtPassword.value == "")
		{
			alert ("Please Enter password");
			document.frmlogin.m_txtPassword.focus();
			return false;
		}
}
function validat()
			{
					var strd;
					if (document.newsletter.m_txtFirstName.value == "")
					{
						alert ("Please Enter naam");
						document.newsletter.m_txtFirstName.focus();
						return false;
					}					
					if (document.newsletter.m_txtNewsLetter.value == "Enter your email id here.."  || document.newsletter.m_txtNewsLetter.value == "")
						{
							alert ("Please Enter EmailID");
							document.newsletter.m_txtNewsLetter.focus();
							return false;
						}
						
					var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
					var matchArray = newsletter.m_txtNewsLetter.value.match(emailPat);
					if (matchArray == null)
					{	
					    
						alert ("Please Enter Valid Email ID");
						document.newsletter.m_txtNewsLetter.focus();
						return false;
					}				
					/*if (document.newsletter.m_txtTelephoneNo.value == "")
					{
						alert ("Please Enter telefoon");
						document.newsletter.m_txtTelephoneNo.focus();
						return false;
					}*/
			}
			function changeImg(obj)
			{	
				document.getElementbyId(BigImg).src="dynamicdata/uploads/propertyImages/"+obj;
			}
