function PopupPage(PageName,Pid)
		{
			
			//var url='EmailProperty.aspx?PId='+Pid;
			var url=''+PageName+'?PId='+Pid;
			width = 500;
			height = 440;
			xx = window.screen.width;
			yy = window.screen.height;
			xx = (xx/2) - (width/2);
			yy = (yy/2) - (height);
			style = 'left = ' +  xx + ',top = 150,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()}
		}

/*THIS FUNCTION IS FOR CHANGE THE IMAGE ON MOUSE OVER e.g FOR ADVANCE SEARCH*/
function ValidatePropertyImageManage()
{	
  
	var err, ErrorDisp, UrlPat;
	err="";
	
	ErrorDisp = "You are missing following entries.\n";
	ErrorDisp += "----------------------------------------\n";
	if (document.Form1.txtImageFile.value=="")
	{
		err += "Select image.\n";
	}
	
	
	if (document.Form1.txtSort.value=="")
	{
		err += "Sort order required.\n";
	}
	
	if (isNaN(document.Form1.txtSort.value)==true)
	{
		err += "Sort order value should be numeric.\n";
	} 
	
	
	if (err=="")
	{
		
		return true;
	}
	else
	{	
		alert(ErrorDisp+err);
		return false;
	}
}
function ChangeImage(imgId,imgPath)
	{
		document.getElementById(imgId).src=imgPath;
		
	}

function validatefaq()
{
	if (document.frmFaq.search.value == "Type Your Question Here and Click Button")
	{
		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==""||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 ValidateAddProfile()//Validate clientRegisteration
{
	
 	var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
	var matchArray = Form2.Register1_txtEmail.value.match(emailPat);
	if(document.Form2.Register1_ddlUserType.value=="0")
	{  
		alert("Please Select User Type");
		document.Form2.Register1_ddlUserType.focus();
		return false;
	}
	if(document.Form2.Register1_txtFName.value=="")
	{  
		alert("First name required");
		document.Form2.Register1_txtFName.focus();
		return false;
	}
	if(document.Form2.Register1_txtFName.value.charAt(0)==' ')
	{   alert("No spaces allowed.\n");
		document.Form2.Register1_txtFName.focus();
		return false;
	}
	if(document.Form2.Register1_txtUserName.value=="")
	{
		alert("User name required");
		document.Form2.Register1_txtUserName.focus();
		return false;
	}
	if(document.Form2.Register1_txtUserName.value.charAt(0)==' ')
	{   alert("No spaces allowed.\n");
		document.Form2.Register1_txtUserName.focus();
		return false; 
    }
	if(document.Form2.Register1_txtPassword.value=="")
	{
		alert("Password required");
		document.Form2.Register1_txtPassword.focus();
		return false;
	}
	if(document.Form2.Register1_txtPassword.value.charAt(0)==' ')
	{    alert("No spaces allowed.\n"); 
		document.Form2.Register1_txtPassword.focus();
		return false;
	 }
	if(document.Form2.Register1_txtEmail.value=="")
	{
		alert("Email required");
		document.Form2.Register1_txtEmail.focus();
		return false;
	}
	else if (matchArray == null)
	{
		alert("Invalid Email format");
		document.Form2.Register1_txtEmail.focus();
		return false;
	}
	
	if(document.Form2.Register1_ddlCountry.value==".::Please Select::.")
	{
		alert("Country required");
		return false;
	}
	if(document.Form2.Register1_ddlQuestion.value==".::Select Question::.")
	{
		alert("Security Question is required.");
		return false;
	}
	if(document.Form2.Register1_txtAns.value=="")
	{
		alert("Answer is required");
		document.Form2.Register1_txtAns.focus();
		return false;
	}
	if(document.Form2.Register1_txtAns.value.charAt(0)==' ')
	{    alert("No spaces allowed.\n");
	document.Form2.Register1_txtAns.focus(); 
	return false;
	 }
	return true;
	}
	function ValidateAddProfile1()//Validate clientRegisteration
	{
	
 	var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
	var matchArray = Form2.Register1_txtEmail.value.match(emailPat);
	if(document.Form2.Register1_txtFName.value=="")
	{  
		alert("First name required");
		document.Form2.Register1_txtFName.focus();
		return false;
	}
	if(document.Form2.Register1_txtFName.value.charAt(0)==' ')
	{   alert("No spaces allowed.\n");
		document.Form2.Register1_txtFName.focus();
		return false;
	}
	if(document.Form2.Register1_txtUserName.value=="")
	{
		alert("User name required");
		document.Form2.Register1_txtUserName.focus();
		return false;
	}
	if(document.Form2.Register1_txtUserName.value.charAt(0)==' ')
	{   alert("No spaces allowed.\n");
		document.Form2.Register1_txtUserName.focus();
		return false; 
    }
	if(document.Form2.Register1_txtPassword.value=="")
	{
		alert("Password required");
		document.Form2.Register1_txtPassword.focus();
		return false;
	}
	if(document.Form2.Register1_txtPassword.value.charAt(0)==' ')
	{    alert("No spaces allowed.\n"); 
		document.Form2.Register1_txtPassword.focus();
		return false;
	 }
	if(document.Form2.Register1_txtEmail.value=="")
	{
		alert("Email required");
		document.Form2.Register1_txtEmail.focus();
		return false;
	}
	else if (matchArray == null)
	{
		alert("Invalid Email format");
		document.Form2.Register1_txtEmail.focus();
		return false;
	}
	
	if(document.Form2.Register1_ddlCountry.value==".::Please Select::.")
	{
		alert("Country required");
		return false;
	}
	if(document.Form2.Register1_ddlQuestion.value=="1")
	{
		alert("Security question is required");
		document.Form2.Register1_ddlQuestion.focus();
		return false;
	}
	if(document.Form2.Register1_txtAns.value=="")
	{
		alert("Answer required");
		document.Form2.Register1_txtAns.focus();
		return false;
	}
	if(document.Form2.Register1_txtAns.value.charAt(0)==' ')
	{    alert("No spaces allowed.\n");
	document.Form2.Register1_txtAns.focus(); 
	return false;
	 }	
	return true;
	}
function ValidateProfile()//Validate client Profile on Edit
{
	
 	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_ddlUserType.value=="0")
	{  
		alert("Please Select User Type");
		document.Form2.Profile1_ddlUserType.focus();
		return false;
	}
	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 ValidateProfilearun()
	{
	//alert(document.Form2.GetElementById("pnlPreferencestxt").txtWhereMoving.value);
	if(document.Form2.Profile11_txtWhereMoving.value=="")
	{
		alert(":: Where are you moving field is required ::");
		document.Form2.Profile11_txtWhereMoving.focus();
		return false;
	}
	return true;
	}
	function ValidateProfile1()//Validate client Profile on Edit
{
	
 	var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
	var matchArray = Form2.Profile11_txtEmail.value.match(emailPat);
	
	if(document.Form2.Profile11_txtFName.value=="")
	{  
		alert("First name required");
		document.Form2.Profile11_txtFName.focus();
		return false;
	}
	if(document.Form2.Profile11_txtFName.value.charAt(0)==' ')
	{   alert("No spaces allowed.\n");
		document.Form2.Profile11_txtFName.focus();
		return false;
	}
	if(document.Form2.Profile11_txtUserName.value=="")
	{
		alert("User name required");
		document.Form2.Profile11_txtUserName.focus();
		return false;
	}
	if(document.Form2.Profile11_txtUserName.value.charAt(0)==' ')
	{   alert("No spaces allowed.\n");
		document.Form2.Profile11_txtUserName.focus();
		return false; 
    }
	if(document.Form2.Profile11_txtPassword.value=="")
	{
		alert("Password required");
		document.Form2.Profile11_txtPassword.focus();
		return false;
	}
	if(document.Form2.Profile11_txtPassword.value.charAt(0)==' ')
	{    alert("No spaces allowed.\n"); 
		document.Form2.Profile11_txtPassword.focus();
		return false;
	 }
	if(document.Form2.Profile11_txtEmail.value=="")
	{
		alert("Email required");
		document.Form2.Profile11_txtEmail.focus();
		return false;
	}
	else if (matchArray == null)
	{
		alert("Invalid Email format");
		document.Form2.Profile11_txtEmail.focus();
		return false;
	}
	
	if(document.Form2.Profile11_ddlCountry.value==".::Please Select::.")
	{
		alert("Country required");
		return false;
	}
	
	if(document.Form2.Profile11_txtAns.value=="")
	{
		alert("Answer required");
		document.Form2.Profile11_txtAns.focus();
		return false;
	}
	if(document.Form2.Profile11_txtAns.value.charAt(0)==' ')
	{    alert("No spaces allowed.\n");
	document.Form2.Profile11_txtAns.focus(); 
	return false;
	 }	
	return true;
	}
	
	function ValidateAddProfile()//Validate clientRegisteration
{
	
 	var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
	var matchArray = Form2.Register1_txtEmail.value.match(emailPat);
	if(document.Form2.Register1_ddlUserType.value=="0")
	{  
		alert("Please Select User Type");
		document.Form2.Register1_ddlUserType.focus();
		return false;
	}
	if(document.Form2.Register1_txtFName.value=="")
	{  
		alert("First name required");
		document.Form2.Register1_txtFName.focus();
		return false;
	}
	if(document.Form2.Register1_txtFName.value.charAt(0)==' ')
	{   alert("No spaces allowed.\n");
		document.Form2.Register1_txtFName.focus();
		return false;
	}
	if(document.Form2.Register1_txtLName.value=="")
	{  
		alert("First name required");
		document.Form2.Register1_txtLName.focus();
		return false;
	}
	if(document.Form2.Register1_txtLName.value.charAt(0)==' ')
	{   alert("No spaces allowed.\n");
		document.Form2.Register1_txtLName.focus();
		return false;
	}
	if(document.Form2.Register1_txtUserName.value=="")
	{
		alert("User name required");
		document.Form2.Register1_txtUserName.focus();
		return false;
	}
	if(document.Form2.Register1_txtUserName.value.charAt(0)==' ')
	{   alert("No spaces allowed.\n");
		document.Form2.Register1_txtUserName.focus();
		return false; 
    }
	if(document.Form2.Register1_txtPassword.value=="")
	{
		alert("Password required");
		document.Form2.Register1_txtPassword.focus();
		return false;
	}
	if(document.Form2.Register1_txtPassword.value.charAt(0)==' ')
	{    alert("No spaces allowed.\n"); 
		document.Form2.Register1_txtPassword.focus();
		return false;
	 }
	if(document.Form2.Register1_txtEmail.value=="")
	{
		alert("Email required");
		document.Form2.Register1_txtEmail.focus();
		return false;
	}
	else if (matchArray == null)
	{
		alert("Invalid Email format");
		document.Form2.Register1_txtEmail.focus();
		return false;
	}
	
	if(document.Form2.Register1_ddlCountry.value==".::Please Select::.")
	{
		alert("Country required");
		return false;
	}
	
	if(document.Form2.Register1_txtAns.value=="")
	{
		alert("Answer required");
		document.Form2.Register1_txtAns.focus();
		return false;
	}
	if(document.Form2.Register1_txtAns.value.charAt(0)==' ')
	{    alert("No spaces allowed.\n");
	document.Form2.Register1_txtAns.focus(); 
	return false;
	 }
	return true;
	}

function ValidateAddProfile21()//Validate clientRegisteration
{
	if(document.Form2.Register1_txtSellerAgency.value=="")
	{  
		alert("Seller's Agency name is required");
		document.Form2.Register1_txtSellerAgency.focus();
		return false;
	}
	if(document.Form2.Register1_txtSellerPhone.value.charAt(0)==' ')
	{   alert("No spaces allowed.\n");
		document.Form2.Register1_txtSellerPhone.value.focus();
		return false;
	}
	if(document.Form2.Register1_txtSellerPhone.value=="")
	{  
		alert("Seller Phone number is required");
		document.Form2.Register1_txtSellerPhone.focus();
		return false;
	}
	if(document.Form2.Register1_txtAgencyAddress.value.charAt(0)==' ')
	{   alert("No spaces allowed.\n");
		document.Form2.Register1_txtAgencyAddress.focus();
		return false;
	}
	if(document.Form2.Register1_txtAgencyAddress.value=="")
	{
		alert("Agency Address is required");
		document.Form2.Register1_txtAgencyAddress.focus();
		return false;
	}
	if(document.Form2.Register1_txtAgencyCity.value.charAt(0)==' ')
	{   alert("No spaces allowed.\n");
		document.Form2.Register1_txtAgencyCity.focus();
		return false; 
    }
	if(document.Form2.Register1_txtAgencyCity.value=="")
	{
		alert("Agency City is required");
		document.Form2.Register1_txtAgencyCity.focus();
		return false;
	}
	if(document.Form2.Register1_txtAgencyState.value.charAt(0)=="")
	{    alert("No spaces allowed.\n"); 
		document.Form2.Register1_txtAgencyState.focus();
		return false;
	 }
	 if(document.Form2.Register1_txtAgencyCountry.value.charAt(0)==' ')
	{    alert("No spaces allowed.\n");
		document.Form2.Register1_txtAgencyCountry.focus(); 
		return false;
	 }
	if(document.Form2.Register1_txtAgencyCountry.value=="")
	{
		alert("Agency Country is required");
		document.Form2.Register1_txtAgencyCountry.focus();
		return false;
	}
	
	 if(document.Form2.Register1_txtAgencyZipCode.value=="")
	{
		alert("Zip Code Country is required");
		document.Form2.Register1_txtAgencyZipCode.focus();
		return false;
	}
	if(document.Form2.Register1_txtAgencyZipCode.value.charAt(0)==' ')
	{    alert("No spaces allowed.\n");
		document.Form2.Register1_txtAgencyZipCode.focus(); 
	return false;
	 }
	return true;
	}
	function ValidateAddProfile211()//Validate clientRegisteration
	{
			if(document.Form2.Register1_txtLegalAdress.value=="")
			{  
				alert("Legal Notification Address is required");
				document.Form2.Register1_txtLegalAdress.focus();
				return false;
			}
			if(document.Form2.Register1_txtLegalAdress.value.charAt(0)==' ')
			{   alert("No spaces allowed.\n");
				document.Form2.Register1_txtLegalAdress.value.focus();
				return false;
			}
			if(document.Form2.Register1_txtLegalCity.value=="")
			{  
				alert("City is required");
				document.Form2.Register1_txtLegalCity.focus();
				return false;
			}
			if(document.Form2.Register1_txtLegalCity.value.charAt(0)==' ')
			{   alert("No spaces allowed.\n");
				document.Form2.Register1_txtLegalCity.focus();
				return false;
			}
			if(document.Form2.Register1_txtLegalState.value=="")
			{
				alert("State is required");
				document.Form2.Register1_txtLegalState.focus();
				return false;
			}
			
			if(document.Form2.Register1_txtLegalZip.value.charAt(0)=="")
			{    alert("Zip Code Is Required."); 
				document.Form2.Register1_txtLegalZip.focus();
				return false;
			}
			if(document.Form2.Register1_txtLegalZip.value.charAt(0)==' ')
			{    alert("No spaces allowed.\n");
				document.Form2.Register1_txtLegalZip.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=="Enter Email ...")
	{
		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=="Username")
	{
		alert("Enter your username.");
		document.login.m_txtUserName.focus();
		return false;
	}
	
	if(document.login.m_txtPassword.value=="Password")
	{
		alert("Enter your password.");
		document.login.m_txtPassword.focus();
		return false;
	}
	return true;
}
function ValidateLogin()
{
	if(document.frmLogin.txtUserName.value=="")
	{
		alert("Enter your username.");
		document.frmLogin.txtUserName.focus();
		return false;
	}
	
	if(document.frmLogin.txtPassword.value=="")
	{
		alert("Enter your password.");
		document.frmLogin.txtPassword.focus();
		return false;
	}
	return true;
}

function HeaderSearchValidation()
{
	if(document.Search.m_txtSearch.value=="Search Text...")
	{
		alert("Enter search text.");
		document.Search.m_txtSearch.focus();
		return false;
	}
}
function HeaderStateValidation()
{
	var strStateId=document.StateForm.ddlStateDrop.value;
	if(document.StateForm.ddlStateDrop.value=="0")
	{
		document.StateForm.ddlStateDrop.focus();
		return false;
	}
	else
	{
		window.location="searchhomes.aspx?SId="+strStateId;
	}
	return true;
}
function DynHeaderStateValidation()
{
	var strStateId=document.StateForm.ddlStateDrop.value;
	if(document.StateForm.ddlStateDrop.value=="0")
	{
		document.StateForm.ddlStateDrop.focus();
		return false;
	}
	else
	{
		window.location="../searchhomes.aspx?id="+strStateId;
	}
	return true;
}
/********************PROPERTY VALIDATION*******************************/



/***********************************************************************/