function testIsValidObject(objToTest) {
	if (objToTest == null || objToTest == undefined) {
	return false;
	}
	return true;
	}

	var xmlHttp
	
	function addtofavourites(id,addremove){
		
		
		var xmlHttp = GetXmlHttpObject();
		
		var refurl=document.URL
		
		var url="/addtofavourites.asp"
		url=url+"?id="+id
		url=url+"&addremove="+addremove
		
		if (refurl.indexOf("favourites.asp")>0) {
		     url=url+"&page=favourites"
		}
		
		url=url+"&sid="+Math.random()
		
		if (!xmlHttp){
		     alert ("Browser does not support HTTP Request")
		     return
		}
		xmlHttp.onreadystatechange=function(){
		if (xmlHttp.readyState==1){ 
		       document.getElementById('favourites').innerHTML="...";
		} else if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		       if(xmlHttp.status == 200) {
					document.getElementById('favourites').innerHTML=xmlHttp.responseText;
					
					var favlink=document.getElementById('favlink-'+id);
					
					if (favlink != null)
					{
					
					if(addremove=='add') {
						document.getElementById('favlink-'+id).innerHTML='<span id="favlink-'+id+'"><a class="favlink" href="javascript:void(0);" onclick="addtofavourites(\''+id+'\',\'remove\')">Remove from saved properties</a></span>';
					}
					else if(addremove=='addfav') {
						document.getElementById('favlink-'+id).innerHTML='<span id="favlink-'+id+'"><a class="favlink" href="javascript:void(0);" onclick="addtofavourites(\''+id+'\',\'removefav\')">Remove from favourites</a></span>';
					}
					else if(addremove=='removefav') {
						document.getElementById('favlink-'+id).innerHTML='<span id="favlink-'+id+'"><a class="favlink" href="javascript:void(0);" onclick="addtofavourites(\''+id+'\',\'addfav\')">Add to favourites</a></span>';
					}
					else {
						document.getElementById('favlink-'+id).innerHTML='<span id="favlink-'+id+'"><a href="javascript:void(0);" onclick="addtofavourites(\''+id+'\',\'add\')">Add to saved properties</a></span>';
					}
					
					}
				} else {
					document.getElementById('favourites').innerHTML='error:'+xmlHttp.status;
				}
		}
		}
		xmlHttp.open("GET", url, true);
		xmlHttp.send(null);
	}
	function GetXmlHttpObject(){ 
	var objXMLHttp=null;
	if (window.XMLHttpRequest){
	     objXMLHttp=new XMLHttpRequest();
	}else if (window.ActiveXObject){
	     objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	return objXMLHttp;
	}
	
	function register(email,country,county,location,salerent){
		
		var xmlHttp = GetXmlHttpObject();
	
		var url="/registerforupdates.asp"
		url=url+"?email="+email
		url=url+"&country="+country
		url=url+"&county="+county
		url=url+"&location="+location
		url=url+"&salerent="+salerent
		url=url+"&sid="+Math.random()
		
		if (!xmlHttp){
		     alert ("Browser does not support HTTP Request")
		     return
		}
		xmlHttp.onreadystatechange=function(){
		if (xmlHttp.readyState==1){ 
		       document.getElementById('registerforupdates').innerHTML="...";
		} else if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		       if(xmlHttp.status == 200) {
					document.getElementById('registerforupdates').innerHTML=xmlHttp.responseText;
					
				} else {
					document.getElementById('registerforupdates').innerHTML='error: '+xmlHttp.status;
				}
		}
		}
		xmlHttp.open("GET", url, true);
		xmlHttp.send(null);
	}
	function GetXmlHttpObject(){ 
	var objXMLHttp=null;
	if (window.XMLHttpRequest){
	     objXMLHttp=new XMLHttpRequest();
	}else if (window.ActiveXObject){
	     objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	return objXMLHttp;
	}
	
	function enter_pressed(e){
		var keycode;
		if (window.event) keycode = window.event.keyCode;
		else if (e) keycode = e.which;
		else return false;
		return (keycode == 13);
	}
	

	function geoupdatedb1(id,address) {	
	
		var xmlHttp = GetXmlHttpObject();
		var url="geoupdatedb.asp"
		url=url+"?id="+id
		url=url+"&address="+address
		url=url+"&sid="+Math.random()
		
		if (!xmlHttp){
		     alert ("Browser does not support HTTP Request")
		     return
		}
		xmlHttp.onreadystatechange=function(){
		if (xmlHttp.readyState==1){ 
		       //document.getElementById("message").innerHTML=".";
		} else if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		       if(xmlHttp.status == 200) {
					 //alert(xmlHttp.responseText);
					
				} else {
					alert('error1: '+url)
					//alert(xmlHttp.responseText);
				}
		}
		}
		xmlHttp.open("GET", url, true);
		xmlHttp.send(null);
		
	}
function tabsos(tab)
{
	var arrTabs=new Array("details","location","vtour","floorplan","contact");
	var elemdiv, visdiv, elemtab, vistab;
	
	for (x in arrTabs) {
		if( document.getElementById ) { // this is the way the standards work
			elemdiv = document.getElementById( arrTabs[x]+'div' );
			elemtab = document.getElementById( arrTabs[x]+'tab' );
		} else if( document.all ) { // this is the way old msie versions work
			elemdiv = document.all[arrTabs[x]+'div'];
			elemtab = document.all[arrTabs[x]+'tab'];
		} else if( document.layers ) {// this is the way nn4 works
			elemdiv = document.layers[arrTabs[x]+'div'];
			elemtab = document.layers[arrTabs[x]+'tab'];
		}
		
		visdiv = elemdiv.style;
		vistab = elemtab.style;
	
		if(tab==arrTabs[x]) {
			visdiv.display = 'block';	
			vistab.backgroundColor='#FFFFFF';
			vistab.borderBottom='1px solid #FFFFFF';
			if(tab=='location') {
				load();
			} else {
				GUnload();
			}
		} else {
			visdiv.display = 'none';	
			vistab.backgroundColor='#DDDDDD';
			vistab.borderBottom='1px solid #CCCCCC';
		}
	}
}

function tabs(tab)
{
	var arrTabs=new Array("details","location","vtour","floorplan","epc","contact");
	var elemdiv, visdiv, elemtab, vistab;
	
	for (x in arrTabs) {
		if( document.getElementById ) { // this is the way the standards work
			elemdiv = document.getElementById( arrTabs[x]+'div' );
			elemtab = document.getElementById( arrTabs[x]+'tab' );
		} else if( document.all ) { // this is the way old msie versions work
			elemdiv = document.all[arrTabs[x]+'div'];
			elemtab = document.all[arrTabs[x]+'tab'];
		} else if( document.layers ) {// this is the way nn4 works
			elemdiv = document.layers[arrTabs[x]+'div'];
			elemtab = document.layers[arrTabs[x]+'tab'];
		}

		visdiv = elemdiv.style;
		vistab = elemtab.style;
	
		if(tab==arrTabs[x]) {
			visdiv.display = 'block';	
			vistab.backgroundColor='#FFFFFF';
			vistab.borderBottom='1px solid #FFFFFF';
			if(tab=='location') {
				load();
			} else {
				GUnload();
			}
		} else {
			visdiv.display = 'none';	
			vistab.backgroundColor='#DDDDDD';
			vistab.borderBottom='1px solid #CCCCCC';
		}
	}
}

function contactform(id,name,phone,email,viewings,contact,details,info,ip){
		
	var xmlHttp = GetXmlHttpObject();
	
	var url="/contactform.asp"
	url=url+"?id="+id
	url=url+"&name="+name
	url=url+"&phone="+phone
	url=url+"&email="+email
	url=url+"&viewings="+viewings
	url=url+"&contact="+contact
	url=url+"&details="+details
	url=url+"&info="+info
	url=url+"&ip="+ip
	url=url+"&sid="+Math.random()

	if (!xmlHttp){
	     alert ("Browser does not support HTTP Request")
	     return
	}
	xmlHttp.onreadystatechange=function(){
	if (xmlHttp.readyState==1){ 
	       document.getElementById('contactresponse').innerHTML=" ";
	} else if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
	       if(xmlHttp.status == 200) {
				if(xmlHttp.responseText.substring(3,8)=='Thank') {
					document.frmapply.reset()
					}
				document.getElementById('contactresponse').innerHTML=xmlHttp.responseText;
					
			} else {
				document.getElementById('contactresponse').innerHTML='error: '+xmlHttp.status;
			}
	}
	}
	xmlHttp.open("GET", url, true);
	xmlHttp.send(null);
}
function getCountyLocation(strCountry,strCounty,strLocation,strError){
	
	var xmlHttp = GetXmlHttpObject();
	var url="getCountyLocation.asp"
	url=url+"?country="+escape(strCountry)
	url=url+"&county="+escape(strCounty)
	url=url+"&location="+escape(strLocation)
	url=url+"&error="+escape(strError)
	url=url+"&sid="+Math.random()
	
	if (!xmlHttp){
	     alert ("Browser does not support HTTP Request")
	     return
	}
	xmlHttp.onreadystatechange=function(){
	if (xmlHttp.readyState==1){ 
	       document.getElementById("countyinsert").innerHTML="<p>Loading...</p>";
	} else if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
	       if(xmlHttp.status == 200) {
				document.getElementById("countyinsert").innerHTML=xmlHttp.responseText;
			} else {
				document.getElementById("countyinsert").innerHTML='<p>There has been an error loading the counties/locations for this Country. Please try again later</p>';
			}
	}
	}
	xmlHttp.open("GET", url, true);
	xmlHttp.send(null);
}


function getCounty(strCountry,strPage){
	var xmlHttp = GetXmlHttpObject();
	var url="/getCounty.asp"
	url=url+"?country="+escape(strCountry)
	url=url+"&page="+escape(strPage)
	url=url+"&sid="+Math.random()
  
	if (!xmlHttp){
	     alert ("Browser does not support HTTP Request")
	     return
	}
	xmlHttp.onreadystatechange=function(){
	if (xmlHttp.readyState==1){ 
	       document.getElementById("countyinsert").innerHTML="<p>Loading Counties...</p>";
	} else if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
	       if(xmlHttp.status == 200) {
				document.getElementById("countyinsert").innerHTML=xmlHttp.responseText;
			} else {
				document.getElementById("countyinsert").innerHTML='<p>There has been an error loading the counties for this Country. Please try again later</p>';
			}
	}
	}
	xmlHttp.open("GET", url, true);
	xmlHttp.send(null);
}

function getLocation(strCountry,strCounty){
		var xmlHttp = GetXmlHttpObject();
		var url="getLocation.asp"
		url=url+"?country="+escape(strCountry)
		url=url+"&county="+escape(strCounty)
		url=url+"&sid="+Math.random()
		     
		if (!xmlHttp){
		     alert ("Browser does not support HTTP Request")
		     return
		}
		xmlHttp.onreadystatechange=function(){
		if (xmlHttp.readyState==1){ 
		       document.getElementById("locationinsert").innerHTML="<p>Loading Locations...</p>";
		} else if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		       if(xmlHttp.status == 200) {
					document.getElementById("locationinsert").innerHTML=xmlHttp.responseText;
				} else {
					document.getElementById("locationinsert").innerHTML='<p>There has been an error loading the locations for this County. Please try again later</p>';
				}
		}
		} 
		xmlHttp.open("GET", url, true);
		xmlHttp.send(null);
}
function MM_CheckFlashVersion(reqVerStr,msg){
  with(navigator){
    var isIE  = (appVersion.indexOf("MSIE") != -1 && userAgent.indexOf("Opera") == -1);
    var isWin = (appVersion.toLowerCase().indexOf("win") != -1);
    if (!isIE || !isWin){  
      var flashVer = -1;
      if (plugins && plugins.length > 0){
        var desc = plugins["Shockwave Flash"] ? plugins["Shockwave Flash"].description : "";
        desc = plugins["Shockwave Flash 2.0"] ? plugins["Shockwave Flash 2.0"].description : desc;
        if (desc == "") flashVer = -1;
        else{
          var descArr = desc.split(" ");
          var tempArrMajor = descArr[2].split(".");
          var verMajor = tempArrMajor[0];
          var tempArrMinor = (descArr[3] != "") ? descArr[3].split("r") : descArr[4].split("r");
          var verMinor = (tempArrMinor[1] > 0) ? tempArrMinor[1] : 0;
          flashVer =  parseFloat(verMajor + "." + verMinor);
        }
      }
      // WebTV has Flash Player 4 or lower -- too low for video
      else if (userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 4.0;

      var verArr = reqVerStr.split(",");
      var reqVer = parseFloat(verArr[0] + "." + verArr[2]);
  
      if (flashVer < reqVer){
        if (confirm(msg))
          window.location = "http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";
      }
    }
  } 
}