var root = "http://www.petershamproperties.com/";
//var root = "http://localhost/pp/";

function load_county(id,c_name){
 
 var cnty_id = form.counties.options[form.counties.selectedIndex].value;
 var cnty_name = form.counties.options[form.counties.selectedIndex].text;
 cnty_name = cnty_name.toLowerCase();
  
 window.location.href = root + "view_property/" + cnty_id + "/" + cnty_name + "/" + id + "/" + c_name + ".html";

}


function load_county_without_category(){
 
 var cnty_id = form.counties.options[form.counties.selectedIndex].value;
 var cnty_name = form.counties.options[form.counties.selectedIndex].text;
 cnty_name = cnty_name.toLowerCase();
 window.location.href = root + "view_properties/" + cnty_id + "/" + cnty_name + ".html";

}



function delWork(url){
 if(confirm('You are about to delete!')){
   //location.href='?action='+action+'&topID='+id+'&open_div='+subNavID;
   location.href=url;
 } 
}



function load_country(){
 
 var cntry_id = form.countries.options[form.countries.selectedIndex].value;
 var cntry_name = form.countries.options[form.countries.selectedIndex].text;
 cntry_name = cntry_name.toLowerCase();
  
  
 window.location.href = root + "view_properties/abroad/" + cntry_id + "/" + cntry_name + ".html";

}



function getCSSID(getID){
  var str;
	 document.getElementById(getID).style.borderTop='1px solid black';
	 document.getElementById(getID).style.borderLeft='1px solid black';
	 document.getElementById(getID).style.borderRight='1px solid black';
	 document.getElementById(getID).style.borderBottom='1px solid #eceae3';
	 document.getElementById(getID).style.backgroundColor='#eceae3';

 //document.getElementById(second).style.color='red';

}

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid email")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid email")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid email")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid email")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid email")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid email")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid email")
		    return false
		 }

 		 return true					
	}

function chk_enq_form(){

  var emailID=document.enq_form.email;

  if(enq_form.fullname.value==''){
    alert('Please enter your name.') 
	enq_form.fullname.focus(); 	
	return false;
   }  


	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please enter your email")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}

  if(enq_form.tel.value==''){
    alert('Please enter Telephone.') 
	enq_form.tel.focus(); 	
	return false;
   }  
   
  if(enq_form.msg.value==''){
    alert('Please enter Message.') 
	enq_form.msg.focus(); 	
	return false;
   }  
      

  if(enq_form.date-of-arrival.value==''){
    alert('Please select arrival date') 
	enq_form.tel.focus(); 	
	return false;
   }  

  if(enq_form.date-of-departure.value==''){
    alert('Please select departure date') 
	enq_form.tel.focus(); 	
	return false;
   }  
   
   
   
}

function submit_form(){

 var emailID=document.enq_form.email;

  if(enq_form.fullname.value==''){
    alert('Please enter your name.') 
	enq_form.fullname.focus(); 	
	return false;
   }  


	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please enter your email")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}

  if(enq_form.tel.value==''){
    alert('Please enter Telephone.') 
	enq_form.tel.focus(); 	
	return false;
   }  

 document.enq_form.submit();

}

function accept(){



  if(login_form.user_name.value==''){
    alert('Please enter user name.') 
	login_form.user_name.focus(); 	
	return false;
   }  

   if(login_form.elements[1].value==''){
    alert('Please enter password.') 
	login_form.pass.focus(); 	
	return false;
   }  

 document.login_form.submit();

}

function submit_form(){

  if(pc_form.user_name.value==''){
    alert('Please enter user name.') 
	pc_form.user_name.focus(); 	
	return false;
   }  

   if(pc_form.email.value==''){
    alert('Please enter email.') 
	pc_form.email.focus(); 	
	return false;
   }  

 document.pc_form.submit();


}


function accept2(){

  if(login_form.user_name.value==''){
    alert('Please enter user name.') 
	login_form.user_name.focus(); 	
	return false;
   }  

   if(login_form.elements[1].value==''){
    alert('Please enter email.') 
	login_form.pass.focus(); 	
	return false;
   }  

 document.login_form.submit();

}


function accept3(){


  if(login2_form.email.value==''){
    alert('Please enter email.') 
	login2_form.email.focus(); 	
	return false;
   }  

 document.login2_form.submit();

}

function sbt_member(){

 document.tarrif_form.submit();

}



function showDIV(){
 var chk = document.getElementById('privacy').style.display; 
 if(chk=="block"){
   document.getElementById('privacy').style.display="none";
 }else{
   document.getElementById('privacy').style.display="block";
 }
 
}





function whichBrs() {

var agt=navigator.userAgent.toLowerCase();

if (agt.indexOf("opera") != -1) return 'Opera';

if (agt.indexOf("staroffice") != -1) return 'Star Office';

if (agt.indexOf("webtv") != -1) return 'WebTV';

if (agt.indexOf("beonex") != -1) return 'Beonex';

if (agt.indexOf("chimera") != -1) return 'Chimera';

if (agt.indexOf("netpositive") != -1) return 'NetPositive';

if (agt.indexOf("phoenix") != -1) return 'Phoenix';

if (agt.indexOf("firefox") != -1) return 'Firefox';

if (agt.indexOf("safari") != -1) return 'Safari';

if (agt.indexOf("skipstone") != -1) return 'SkipStone';

if (agt.indexOf("msie") != -1) return 'Internet Explorer';

if (agt.indexOf("netscape") != -1) return 'Netscape';

if (agt.indexOf("mozilla/5.0") != -1) return 'Mozilla';

if (agt.indexOf('\/') != -1) {

if (agt.substr(0,agt.indexOf('\/')) != 'mozilla') {

return navigator.userAgent.substr(0,agt.indexOf('\/'));}

else return 'Netscape';} else if (agt.indexOf(' ') != -1)

return navigator.userAgent.substr(0,agt.indexOf(' '));

else return navigator.userAgent;

}









