
function roll_over(img_name, img_src)
{
 	document[img_name].src = img_src;
}


function redirectSearch()
{
	document.FrmRegForm.canGet.value=2;
    var jsCountry = document.getElementById("selcountry").value;
	var jsRegion =  document.getElementById("selregion").value;
	var jsCity = document.getElementById("selcity").value;
	var jsMax =  parseInt(document.getElementById("selMax").value);
	var jsMin =  parseInt(document.getElementById("selMin").value);
	
	if((jsMin!="")&&(jsMax!="")){
		if(jsMin >jsMax){
		alert("Your Maximum value is less than the minimum value. please select another value");
		return false;
		}
	}
	 jsMax =  document.getElementById("selMax").value;
	 jsMin =  document.getElementById("selMin").value;
	window.location = "http://www.propertyalert.org/qsearch.php?varCountry="+ jsCountry + "&varRegion=" + jsRegion + "&varCity=" + jsCity + "&intMax=" + jsMax + "&intMin=" + jsMin;
}

function setvalue()
{
	var set_property_value=document.getElementById("setproptryrule");
	
	if(set_property_value.style.display=="none"){
		document.FrmRegForm.setpropertyalert.value = 1;
		set_property_value.style.display='block'; // rule
	}
	else if(set_property_value.style.display=="block"){
		set_property_value.style.display='none'; // rule
	}
	else{
	}

}

function setsubmitval()
{
	document.FrmRegForm.canGet.value=2;
	
}

function isEmail(mailstr)
{
	a = mailstr.indexOf(".");
	b = mailstr.indexOf("@");
	c = mailstr.indexOf(" ");
	d = mailstr.lastIndexOf(".");
	e = mailstr.length;
	if( (a == -1) || (b == -1) || (c != -1) || (d < b) || ( d == e - 1) || (b+1 == a) )
		return false;
	else
		return true;
}

function submitval()
{
	if(document.FrmRegForm.canGet.value == 2)
	{	
		if(document.FrmRegForm.txtname.value == ""){
		alert("please enter the name");
		document.FrmRegForm.txtname.focus();
		return false;
		}
		else if(document.FrmRegForm.txtemail.value == ""){
		alert("please enter the email address");
		document.FrmRegForm.txtemail.focus();
		return false;
		}
		else if(!isEmail(document.FrmRegForm.txtemail.value)){
		alert("Please enter a valid email address");
		document.FrmRegForm.txtemail.focus();
		return false;
		}	
		else 
		return true;
	}
	else
	return false;
	
}

function winOp()
{
 window.open("http://www.propertyalert.org/tellafriend.php","","toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=570,height=500");
}

function updateregion()
{
	var sel_country = document.FrmRegForm.selcountry.value;
	var sel_region = document.FrmRegForm.selregion;
	while ( sel_region.options.length )
		sel_region.options[0] = null;
	sel_region.options[0] = new Option('loading...', -1);
	frames['thread'].location.href = 'list_region.php?country=' + sel_country;
}

function validate1()
{

 if(document.frm1.fname.value=="")
  {
  alert("Please fill the first name");
  document.frm1.fname.focus();
  return false;
  }
  if(document.frm1.sname.value=="")
  {
  alert("Please fill the Sub name");
    document.frm1.sname.focus();
  return false;

  }
   if(document.frm1.country.value=="select-country")
  {
  alert("Please fill the country");
  document.frm1.country.focus();
  return false;
  }
  if(document.frm1.adline1.value=="")
  {
  alert("Please fill Address line 1");
  document.frm1.adline1.focus();
  return false;
  }
  if(document.frm1.city.value=="")
  {
  alert("Please fill Town or City ");
  document.frm1.city.focus();
  return false;
  }
   if(document.frm1.pcode.value=="")
  {
  alert("Please fill Post code ");
  document.frm1.pcode.focus();
  return false;
  }
   if(document.frm1.phone.value=="")
  {
  alert("Please fill the Telephone Number");
    document.frm1.phone.focus();
  return false;

  }
  psPhoneno=document.frm1.phone;
  if(!isNumeric(psPhoneno,"The Phone number must be Numeric"))
{
 return false;
}

function isNumeric(elem, helperMsg){
 var numericExpression = /^[0-9]+$/;
 if(elem.value.match(numericExpression)){
  return true;
 }else{
  alert(helperMsg);
  elem.focus();
  return false;
 }
}
    if(document.frm1.email.value == "")
	{
	alert("Please Enter Email");
	document.frm1.email.focus();
	return false;
	}
	
	if(!checkEmail(document.frm1.email.value))
	{
		alert("Please enter your valid Email address");
		document.frm1.email.focus();
		return false;
	}
	 function checkEmail(myForm) {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myForm)){
return true
}

return false
}
 if(document.frm1.dat.value=="DD")
  {
  alert("Please select date");
  document.frm1.dat.focus();
  return false;
  }

if(document.frm1.mon.value=="MM")
  {
  alert("Please select Month");
  document.frm1.mon.focus();
  return false;
  }
if(document.frm1.yer.value=="YYYY")
  {
  alert("Please select year");
  document.frm1.yer.focus();
  return false;
  }
return true;  
}

function validate2()
{
  if(document.frm1.icountry.value=="select-country")
  {
  alert("Please fill the country which you interest?");
  document.frm1.icountry.focus();
  return false;
  }
  
  if(document.frm1.region.value == "")
	{
	alert("Please Enter region");
	document.frm1.region.focus();
	return false;
	} 
  
 
    if(document.frm1.currency.value == "")
	{
	alert("Please Enter currency of Mortgage ");
	document.frm1.currency.focus();
	return false;
	} 
 if(document.frm1.price.value == "")
	{
	alert("Please Enter Purchase price");
	document.frm1.price.focus();
	return false;
	} 
  if(document.frm1.loan.value == "")
	{
	alert("Please Enter Loan Amount Requested");
	document.frm1.loan.focus();
	return false;
	} 
 
 return true;
 }
 
 function validate3()
 {
 
  myOption = -1;
 
 
  for (i=document.frm1.radio3.length-1; i > -1; i--) {
  if (document.frm1.radio3[i].checked) {
myOption = i; i = -1;
}
}
if (myOption == -1) {
alert("Please select the answer for Do you own your current residence?");
return false;
}

 if(document.frm1.salary.value=="")
  {
  alert("What is your net annual basic salary?");
  document.frm1.salary.focus();
  return false;
  } 
 
  return true;
  
}

function validate()
{

 if(document.frm.icountry.value=="Select -Country-")
  {
  alert("Please fill the country which you interest?");
  document.frm.icountry.focus();
  return false;
  }
  if(document.frm.fname.value=="")
  {
  alert("Please fill the first name");
  document.frm.fname.focus();
  return false;
  }
  if(document.frm.sname.value=="")
  {
  alert("Please fill the Sub name");
    document.frm.sname.focus();
  return false;

  }
   if(document.frm.phone.value=="")
  {
  alert("Please fill the Telephone Number");
    document.frm.phone.focus();
  return false;

  }
  psPhoneno=document.frm.phone;
  if(!isNumeric(psPhoneno,"The Phone number must be Numeric"))
{
 return false;
}

function isNumeric(elem, helperMsg){
 var numericExpression = /^[0-9]+$/;
 if(elem.value.match(numericExpression)){
  return true;
 }else{
  alert(helperMsg);
  elem.focus();
  return false;
 }
}
  if(document.frm.email.value == "")
	{
	alert("Please Enter Email");
	document.frm.email.focus();
	return false;
	}
	
	if(!checkEmail(document.frm.email.value))
	{
		alert("Please enter your valid Email address");
		document.frm.email.focus();
		return false;
	}
	 function checkEmail(myForm) {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myForm)){
return true
}

return false
}
 if(document.frm.country.value=="select your country")
  {
  alert("Please fill the country");
  document.frm.country.focus();
  return false;
  }
if(document.frm.adline1.value=="")
  {
  alert("Please fill Address line 1");
  document.frm.adline1.focus();
  return false;
  }
  
  if(document.frm.city.value=="")
  {
  alert("Please fill Town or City ");
  document.frm.city.focus();
  return false;
  }
  if(document.frm.state.value=="")
  {
  alert("Please fill state ");
  document.frm.state.focus();
  return false;
  }
   if(document.frm.pcode.value=="")
  {
  alert("Please fill Post code ");
  document.frm.pcode.focus();
  return false;
  }
return true;  
 }
 
 function validate_insure()
 {
  myOption = -1;
 
 
 
  for (i=document.frm.radio1.length-1; i > -1; i--) {
  if (document.frm.radio1[i].checked) {
myOption = i; i = -1;
}
}
if (myOption == -1) {
alert("Please select the answer for What type of Overseas Building and Contents Insurance are you interested in?");
return false;
}
myOption = -1;

  for (i=document.frm.radio2.length-1; i > -1; i--) {
  if (document.frm.radio2[i].checked) {
myOption = i; i = -1;
}
}
if (myOption == -1) {
alert("Please select the answer for In my search for an Overseas Buildings and Contents Insurance, I?");
return false;
}
myOption = -1;

for (i=document.frm.radio3.length-1; i > -1; i--) {
  if (document.frm.radio3[i].checked) {
myOption = i; i = -1;
}
}
if (myOption == -1) {
alert("Please select the answer for What type of building?");
return false;
}
 if(document.frm.binsure.value=="")
  {
  alert("Please fill Building sum insured in € ");
  document.frm.binsure.focus();
  return false;
  }
if(document.frm.cinsure.value=="")
  {
  alert("Please fill Content sum insured in € ");
  document.frm.cinsure.focus();
  return false;
  }
  myOption = -1;

   for (i=document.frm.radio4.length-1; i > -1; i--) {
  if (document.frm.radio4[i].checked) {
myOption = i; i = -1;
}
}
if (myOption == -1) {
alert("Please select the answer for Is the property a listed building?");
return false;
}
myOption = -1;

 for (i=document.frm.radio5.length-1; i > -1; i--) {
  if (document.frm.radio5[i].checked) {
myOption = i; i = -1;
}
}
if (myOption == -1) {
alert("Please select the answer for Have you made any claims in the last 5 years?");
return false;
}
if(document.frm.dat.value=="DD")
  {
  alert("Please select date");
  document.frm.dat.focus();
  return false;
  }

if(document.frm.mon.value=="MM")
  {
  alert("Please select Month");
  document.frm.mon.focus();
  return false;
  }
if(document.frm.yer.value=="YYYY")
  {
  alert("Please select year");
  document.frm.yer.focus();
  return false;
  }

    return true;
}


