 function propertysearch()
 {
 
 var anum=/(^\d+$)|(^\d+\.\d+$)/
 if(document.form1.txtNoofBeedRooms.value!="")
 {
 
     if (!anum.test(document.form1.txtNoofBeedRooms.value))
    {
      	alert("Please enter numeric value for bedrooms.");
		document.form1.txtNoofBeedRooms.focus();
		return false;
    }
    }
    else
    {}
    if(document.form1.txtMinPrize.value!="")
 {
 if (!anum.test(document.form1.txtMinPrize.value))
    {
      	alert("Please enter numeric value in Minimum Price.");
		document.form1.txtMinPrize.focus();
		return false;
    }
    }
else
{}	
  if(document.form1.txtMaxPrize.value!="")
 {
    if (!anum.test(document.form1.txtMaxPrize.value))
    {
      	alert("Please enter numeric value in Maximun Price.");
		document.form1.txtMaxPrize.focus();
		return false;
    }
    }
    else
    {}
  
  return true;  
    
 }
 //this is used when any visitor wants to add any property
 function PropertyRelatedValidation()
{
    var strd;
    if (document.form1.txtPropertyName.value=="")
	{
		strd=document.form1.MRF1.value;
		alert(strd);
		document.form1.txtPropertyName.focus();
		return false;
	}
    if (document.form1.cmbpropertytype.value == "")
	{
		strd=document.form1.MRF2.value;
		alert(strd);
		document.form1.cmbpropertytype.focus();
		return false;
	}
	
	
	if (document.form1.txtSellingPrize.value=="")
	{
		strd=document.form1.MRF6.value;
		alert(strd);
		document.form1.txtSellingPrize.focus();
		return false;
	}
	var anum=/(^\d+$)|(^\d+\.\d+$)/
	if (!anum.test(document.form1.txtSellingPrize.value))
    {
      	alert("Please enter numeric value in Selling Price.");
      	  document.form1.txtSellingPrize.value="";
		document.form1.txtSellingPrize.focus();
		return false;
    }
	
	if (document.form1.cmbCountry.value == "")
	{
		strd=document.form1.MRF4.value;
		alert(strd);
		document.form1.cmbCountry.focus();
		return false;
	}
//	if (document.form1.txtCity.value=="")
//	{
//		strd=document.form1.MRF5.value;
//		alert(strd);
//		document.form1.txtCity.focus();
//		return false;
//	}
//	
if (document.form1.drpcity.value=="")
	{
	    if(document.form1.chkcityname.checked==false)
	    {
		    alert("Please Select Checkbox");
		    document.form1.chkcityname.focus();
		    return false;
		}
	}
	if (document.form1.drpcity.value=="" && document.form1.chkcityname.checked==true)
	{
	    if(document.form1.txtCity.value=="")
	    {
		    alert("Please Enter New City Name");
		    document.form1.txtCity.focus();
		    return false;
		}
	}
	
	/*if (document.form1.cmbBuildYear.value == "")
	{
		strd=document.form1.MRF7.value;
		alert(strd);
		document.form1.cmbBuildYear.focus();
		return false;
	}
	if (document.form1.txtNoofBeedRooms.value=="")
	{
		strd=document.form1.MRF8.value;
		alert(strd);
		document.form1.txtNoofBeedRooms.focus();
		return false;
	}*/
	var anum=/(^\d+$)|(^\d+\.\d+$)/
	if(document.form1.txtNoofBeedRooms.value!="")
	{
	if (!anum.test(document.form1.txtNoofBeedRooms.value))
    {
        alert("Please enter numeric value in Number of Bedrooms.");
      document.form1.txtNoofBeedRooms.value="";
        document.form1.txtNoofBeedRooms.focus();
		return false;
    }
}
    
   	if (document.form1.txtfname.value=="")
	{
		alert("Please enter first name");
		document.form1.txtfname.focus();
		return false;
	}
	 	if (document.form1.txtcontactno.value=="")
	{
		alert("Please enter contact number");
		document.form1.txtcontactno.focus();
		return false;
	}

	
	var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
	var matchArray = document.form1.txtemail.value.match(emailPat);
	if (document.form1.txtemail.value=="")
	{
		alert("Please enter your EmailId");
		document.form1.txtemail.focus();
		return false;
	}
	else if (matchArray == null)
	{
		
		alert("Please enter valid MailId");
			document.form1.txtemail.focus();
		return false;
	}
/*	 	if (document.form1.txtcomments.value=="")
	{
		alert("Please enter comments");
		document.form1.txtcomments.focus();
		return false;
	}*/
	return true;
}

function PropertyImageValidation()
{
    var strd;
    if (document.form1.FileServiceImage.value == "")
    {
        strd=document.form1.MRF1.value;
		alert(strd);
		document.form1.FileServiceImage.focus();
		return false;
    }
}
 function clearTip(field)
			{
				if(field.defaultValue == field.value)
				field.value = "";
			}

			function writeTip(field)
			{
				if(field.value == "")
					field.value = field.defaultValue;
			}
			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 winpop()
			{
				popup('forgotpass.aspx');
			}  
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		nav_05_over = newImage("dynamicdata/images/Nav-left_05-over.jpg");
		nav_07_over = newImage("dynamicdata/images/Nav-left_07-over.jpg");
		
		preloadFlag = true;
	}
}



function validatefaq()
{
    var strd;
	if (document.aspnetForm.search.value=="" || document.aspnetForm.search.value=="Pregunta")
	{
		strd=document.aspnetForm.MRF8.value;
		alert(strd);
		document.aspnetForm.search.focus();
		return false;
	}
	if (document.aspnetForm.search.value.charAt(0)==' ')
	{
		strd=document.aspnetForm.MRF9.value;
		alert(strd);
		document.aspnetForm.search.focus();
		return false;
	}
	aspnetForm.action="faqdetails.aspx?flag=2&search="+document.aspnetForm.search.value;
	return true;
}




function ValidateFaqDetails()
{
	var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
	var matchArray = document.form1.txtMail.value.match(emailPat);
	if(document.form1.txtMail.value=="" || document.form1.txtMail.value=="Enter Email Id")
	{
		strd=document.form1.MRF8.value;
		alert(strd);
		document.form1.txtMail.focus();
		return false;
	}
	else if (matchArray == null)
	{
		strd=document.form1.MRF9.value;
		alert(strd);
		document.form1.txtMail.focus();
		return false;
	}
	if(document.form1.txtArea.value=="" || document.form1.txtArea.value=="Enter your question")
	{
		strd=document.form1.MRF10.value;
		alert(strd);
		document.form1.txtArea.focus();
		return false;
	}
	if(document.form1.txtArea.value.charAt(0)==' ')
	{   
	    strd=document.form1.MRF11.value;
		alert(strd);
		document.form1.txtArea.focus();
		return false;
	}
	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.txtEmail.value.match(emailPat);

	if(document.form1.txtFname.value=="" || document.form1.txtFname.value==" ")
	{
		
		alert("Frist name required");
		document.form1.txtFname.focus();
		return false;
	}
	 if(document.form1.txtLName.value=="" || document.form1.txtLName.value==" ")
	{  
	     alert("Last name required");
		 document.form1.txtLName.focus();
		 return false;
	}
	
	if(document.form1.txtEmail.value=="")
	{
	   strd=document.form1.MRF3.value;
	   alert(strd);
	   document.form1.txtEmail.focus();
	   return false;
	}
	else if (matchArray == null)
	{
		strd=document.form1.MRF4.value;
	    alert(strd);
		document.form1.txtEmail.focus();
		return false;
	}
	
	 /*if(document.form1.txtComments.value==""||document.form1.txtComments.value=="Enter your comments here")
	{
	   
	    alert("Comments required.");
		document.form1.txtComments.focus();
		return false;
	}*/
	if(document.form1.CodeNumberTextBox.value=="")
	{
		
	    alert("Please enter security code as shown in box");
		document.form1.CodeNumberTextBox.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=="Search Here")
	{
		alert("Enter search text.");
		document.Search.m_txtSearch.focus();
		return false;
	}
}
function ValidateGuestBook()
{
    var err, ErrorDisp, emailPat;
    var emailPat =/^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
	var matchArray = form1.txtemail.value.match(emailPat);
	err="";
	ErrorDisp = "You are missing following entries.\n";
	ErrorDisp += "----------------------------------------\n";
	if (document.form1.txtfname.value=="" || document.form1.txtfname.value==" ")
	{
		err += "First Name required.\n";
		document.form1.txtfname.focus();
	}	
	if (document.form1.txtlname.value=="" || document.form1.txtlname.value==" ")
	{
		err += "Last Name required.\n";
	}
	if (document.form1.txtemail.value=="" || document.form1.txtemail.value==" ")
	{
		err += "Email required.\n";
	}
	else if (matchArray == null)
	{  
	     err += "Inavalid Email format.\n";
	}
	if (document.form1.txtComment.value=="" || document.form1.txtComment.value=="Enter your comment's.")
	{
		err += "Comments required.\n";
	}	
	if (err=="")
	{
		return true;
	}
	else
	{	
		alert(ErrorDisp+err);
		return false;
	}
}
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 == "" || 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 == "" || 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 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 popup1(url)
	{
		width = 400;
		height = 200;
		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 = 510;
		height = 370;
		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 clearTip(field)
	{
		if(field.defaultValue == field.value)				
		field.value = "";
	}

	function writeTip(field)
	{
		if(field.value == "")
			field.value = field.defaultValue;
	}
	function validatReferenceNo()
	{
	    var emailPat = /^[0-9]*$/
		var matchArray = frmrefsearch.txtrefsearch.value.match(emailPat);
        if (document.frmrefsearch.txtrefsearch.value == "")
        {
        alert("Please Enter Reference Number.");
        document.frmrefsearch.txtrefsearch.focus();
        return false;
        }
        if (document.frmrefsearch.txtrefsearch.value == "Enter reference no here")
        {
        alert("Please Enter Reference Number.");
        document.frmrefsearch.txtrefsearch.focus();
        return false;
        }
        if (matchArray == null)
        {
	        alert ("Please Enter Numeric Reference Number.");
	        document.frmrefsearch.txtrefsearch.focus();
	        return false;
        }
       
	}
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 (document.frmnews.txtnewsletter.value == "Ingrese su email..")
        {
        alert("Please Enter EmailId");
        document.frmnews.txtnewsletter.focus();
        return false;
        }
	if(matchArray == null)
    {
	   alert ("Please enter your valid email address.");
	    document.frmnews.txtnewsletter.focus();
	    return false;
    }
    
}
function OpenWindow()
{ 
window.open("Calculator.htm","winPop","toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=335,left=150,top=150");
}
function popUpWindowCC(url,wd,ht)
{
	newwindow=window.open(url,'cc','scrollbars=1,location=0,menubar=0,resizable=0,width=650,height=400,left = 80,top = 80');
	if (window.focus) {newwindow.focus()}
}
function OpenWindowDn()
{ 
window.open("../Calculator.htm","winPop","toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=335,left=150,top=150");
}
function popUpWindowCC(url,wd,ht)
{
	newwindow=window.open("http://www.xe.com/pca/input.cgi",'cc','scrollbars=1,location=0,menubar=0,resizable=0,width=650,height=400,left = 80,top = 80');
	if (window.focus) {newwindow.focus()}
}

function ValidateUnSubScribe()
{
    var strd;
	if (document.form1.txtEmail.value == "" || document.form1.txtEmail.value == " ")
	{
		strd=document.form1.MRF1.value;
		alert(strd);
		window.document.form1.txtEmail.focus();
		return false;
	}
	else
	{	var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/;
		var matchArray = document.form1.txtEmail.value.match(emailPat);
		if (matchArray == null)
		{
			strd=document.form1.MRF2.value;
			alert (strd);
			window.document.form1.txtEmail.focus();
			return false;
		}
	}
	return true;
}

function wclose()
{
	opener.location.reload(true);
	self.close();
}


