<!-- MAIN JS

//popup windows

function openMap(newcontent)
 {
  var wincontent = window.open(newcontent, 'map', 'width=418,height=490,top=50,left=50,titlebar=yes,resizable=yes,toolbar=no,menubar=no,scrollbars=no')         
  wincontent.focus();
 }

function openLondon(newcontent)
 {
  var wincontent = window.open(newcontent, 'london', 'width=628,height=564,scrollbars=no,resizable=no,top=50,left=50,titlebar=yes,toolbar=no,menubar=no')         
  wincontent.focus();
 }

function openTube(newcontent)
 {
  var wincontent = window.open(newcontent, 'tube', 'width=645,height=550,scrollbars=no,resizable=no,top=50,left=50,titlebar=yes,toolbar=no,menubar=no')         
  wincontent.focus();
 }

function openOffice(newcontent)
 {
  var wincontent = window.open(newcontent, 'office', 'width=615,height=655,scrollbars=no,resizable=no,top=50,left=50,titlebar=yes,toolbar=no,menubar=no')         
  wincontent.focus();
 }

function openMortgage(newcontent)
 {
  var wincontent = window.open(newcontent, 'mortgage', 'width=505,height=660,scrollbars=no,resizable=no,top=50,left=50,titlebar=yes,toolbar=no,menubar=no')         
  wincontent.focus();
 }


function openContact(newcontent)
 {
  var wincontent = window.open(newcontent, 'contact', 'width=460,height=490,scrollbars=yes,resizable=no,top=50,left=50,titlebar=yes,toolbar=no,menubar=no')         
  wincontent.focus();
 }
 
 function openEmailAFriend(newcontent)
 {
  var wincontent = window.open(newcontent, 'contact', 'width=445,height=450,scrollbars=yes,resizable=no,top=50,left=50,titlebar=yes,toolbar=no,menubar=no,status=yes')         
  wincontent.focus();
 }

function openPrint(newcontent)
 {
  var wincontent = window.open(newcontent, 'print', 'width=632,height=490,scrollbars=yes,resizable=no,top=50,left=50,titlebar=yes,toolbar=no,menubar=no')         
  wincontent.focus();
 }

function openLocMap(newcontent)
 {
  var wincontent = window.open(newcontent, 'locmap', 'width=665,height=510,scrollbars=no,resizable=no,top=50,left=50,titlebar=yes,toolbar=no,menubar=no')         
  wincontent.focus();
 }

function openLocPrint(newcontent)
 {
  var optionValue;
  optionValue = document.mapscale.ddlScale.options[document.mapscale.ddlScale.selectedIndex].text;
  if(optionValue=='Select Scale')
  {
   optionValue='50000';
  }
  else
  {
  optionValue = optionValue.replace(/1:/g,'') 
  }
  newcontent = newcontent + '&mapscaleOptions=' + optionValue;
  var wincontent = window.open(newcontent, 'locprint', 'width=507,height=640,scrollbars=no,resizable=no,top=50,left=50,titlebar=yes,toolbar=no,menubar=no')         
  wincontent.focus();
 }

function openPropAlert(newcontent)
 {
  var wincontent = window.open(newcontent, 'propalert', 'width=470,height=685,scrollbars=yes,resizable=no,top=50,left=50,titlebar=yes,toolbar=no,menubar=no')         
  wincontent.focus();
 }

function openSubscribeRssFeed(newcontent)
 {
  var wincontent = window.open(newcontent, 'rssFeed', 'width=750,height=750,status=yes,scrollbars=yes,resizable=yes,titlebar=yes,toolbar=yes,menubar=yes,location=yes')         
  wincontent.focus();
 }
 
 function subscribeRssFeed(newcontent)
 {
  var wincontent = window.open(newcontent, 'rssFeed', 'width=750,height=750,scrollbars=yes,resizable=yes,titlebar=yes,toolbar=yes,menubar=yes')         
  wincontent.focus();
 }
 
 function quicksubscribeRssFeed()
 {
	document.getElementById("rssFeed").value = true;
	document.forms["searchResults"].submit();
 }

function openVirtual(newcontent)
 {
  var wincontent = window.open(newcontent, 'virtual', 'width=415,height=440,top=50,left=50,titlebar=yes,resizable=yes,toolbar=no,menubar=no,scrollbars=no')         
  wincontent.focus();
 }

function openQuickBrochure(id, newcontent)
 {
  var wincontent = window.open('QuickAssetStream.aspx?type=brochure&id=' + id + '&url=' + newcontent, 'virtual', 'width=800,height=640,top=50,left=50,titlebar=yes,resizable=yes,toolbar=no,menubar=no,scrollbars=no')         
  wincontent.focus();
 }

function openQuickFloorPlan(id, newcontent)
{
	var wincontent = window.open('QuickAssetStream.aspx?type=floorplan&id=' + id + '&url=' + newcontent, 'virtual', 'width=800,height=640,top=50,left=50,titlebar=yes,resizable=yes,toolbar=no,menubar=no,scrollbars=no')         
	wincontent.focus();
}

function openFloorPlan(newcontent)
 {
  getAcrobatVersion()
  var agt=navigator.userAgent.toLowerCase();
  var is_mac    = (agt.indexOf("mac")!=-1);
	
  if (!is_mac) {
    newcontent=newcontent + "&acrobatReaderDetected=" + acrobat.installed;
	var wincontent = window.open(newcontent, 'virtual', 'width=800,height=640,top=50,left=50,titlebar=yes,resizable=yes,toolbar=no,menubar=no,scrollbars=no')         
	wincontent.focus();
  } else {
	location.href=arguments[1];
  }
 }

function openBrochure(newcontent)
 {
  getAcrobatVersion()
  var agt=navigator.userAgent.toLowerCase();
  var is_mac    = (agt.indexOf("mac")!=-1);
	
  if (!is_mac) {
  
    newcontent=newcontent + "&acrobatReaderDetected=" + acrobat.installed;
	var wincontent = window.open(newcontent, 'virtual', 'width=800,height=640,top=50,left=50,titlebar=yes,resizable=yes,toolbar=no,menubar=no,scrollbars=no')         
	wincontent.focus();
  } else {
	location.href=arguments[1];
  }
 }
 
 function openthirdPartyBrochure(newcontent)
 {
  getAcrobatVersion()
  var agt=navigator.userAgent.toLowerCase();
  var is_mac    = (agt.indexOf("mac")!=-1);
	
  if (!is_mac) {
  
    newcontent=newcontent + "&acrobatReaderDetected=" + acrobat.installed;
	var wincontent = window.open(newcontent, 'virtual', 'width=800,height=640,top=50,left=50,titlebar=yes,resizable=yes,toolbar=no,menubar=no,scrollbars=no')         
	wincontent.focus();
  } else {
	location.href=arguments[1];
  }
 }


/*******************************************************
ACROBAT DETECT
All code by Ryan Parman, unless otherwise noted.
(c) 1997-2003, Ryan Parman
http://www.skyzyx.com
Distributed according to SkyGPL 2.1, http://www.skyzyx.com/license/
*******************************************************/

var acrobat=new Object();

// Set some base values
acrobat.installed=true;
acrobat.version='0.0';

function getAcrobatVersion() {

	if (navigator.plugins && navigator.plugins.length)
	{
		for (x=0; x<navigator.plugins.length; x++)
		{
			if (navigator.plugins[x].description.indexOf('Adobe Acrobat') != -1)
			{
				acrobat.version=parseFloat(navigator.plugins[x].description.split('Version ')[1]);

				if (acrobat.version.toString().length == 1) acrobat.version+='.0';

				acrobat.installed=true;
				break;
			}
		}
	}
	else if (window.ActiveXObject)
	{
		for (x=2; x<10; x++)
		{
			try
			{
				oAcro=eval("new ActiveXObject('PDF.PdfCtrl."+x+"');");
				if (oAcro)
				{
					acrobat.installed=true;
					acrobat.version=x+'.0';
				}
			}
			catch(e) {}
		}

		try
		{
			oAcro4=new ActiveXObject('PDF.PdfCtrl.1');
			if (oAcro4)
			{
				acrobat.installed=true;
				acrobat.version='4.0';
			}
		}
		catch(e) {}
	}
}


// search chooser buy / rent

	function showdiv(div, hideDiv){
		var div2 = hideDiv;//(div == "buy") ? "rent" : "buy" ;
		div = document.getElementById(div);
		div2 = document.getElementById(div2);
		div.style.display='block';
		div2.style.display='none';
		
		
	}






// TUBE MAP


	function imgUp(img,com){
	 if (img.checked){return;}// don't do anything if the image is checked
	 
	 if (com){
	 	//if true mouse over

		img.src = eval(img.name+"02.src");

	 } else {
	 	//if false mouse out
		img.src = eval(img.name+"01.src");
	 }
	
	}
	
	function chckbx(obj){
		// clicking on the div will set the checkbox and image to be checked
		var chbx = obj.getElementsByTagName('INPUT')[0];
		var img =  obj.getElementsByTagName('IMG')[0];
		var bool = chbx.checked;
		chbx.checked = (bool)? false : true;
		img.checked = (!bool);
		if (bool) {
			img.src = eval(img.name+"01.src");
		}
	}
	
	function setCheckedImage(id,bool){
		// set the image checked value when page loads
		img = id+"img";
		if (bool) {
			document.getElementById(img).src = oversrc;
		}	
		document.getElementById(id).checked = bool;
		document.getElementById(img).checked = bool;
	}
	
	function CheckSearchValues()
	{		
		//Check whether user has added a value to the drop down boxs or not.		
		
		var iError = 0;
		//For users who have clicked to Buy
		if(document.forms[0].textSearchBox.value == '')
		{
		alert('Please enter a location before actioning your search.');
		++iError;
		}		
		
		
		if(document.forms[0].buysection.checked == true)
		{			
			//Commented out by SA 10/5/04 requested by RC
			/*
			if(document.forms[0].buymaxprice.value == '-1')						
			{
			alert('Please select a maximum price.');			
			++iError;			
			}
			*/
			
			
			if(document.forms[0].buyminprice.value != '-1' && document.forms[0].buymaxprice.value != '-1' && document.forms[0].buyminprice.length > document.forms[0].buymaxprice.length)
			{
				alert('Minimum price exceeds maximum price. Please adjust.');			
				++iError;				
			}
									
		}
		/*
		if(document.forms[0].rentsection.checked == true)
		{			
			//check if rent is monthly or weekly.			
			if(document.forms[0].rentmonthly.checked == true)
			{
				if(document.forms[0].minRentPriceMonthly.value == '-1')
				{
				alert('Please select min rent price.');
				++iError;		
				}
			}									
			if(document.forms[0].rentweekly.checked == true)
			{
				if(document.forms[0].minimumrentweekly.value == '-1')
				{
				alert('Please select min rent price.');
				++iError;
				}
			}			
		}
		*/
		
		
						
		
		if(iError != 0)
		{
			return false;
		}
		
		/*
		if(iError == 0)
		{
			return true;
		}				
		else
		{
			return false;
		}
		*/		
	}
	
	


// END -->

	//submit on enter (RW 27/1/2004)

	function checkEnter(event)
	{ 	
		var code = 0;
		var NS4;
		NS4 = (document.layers) ? true : false;	
		if (NS4)
			{
				code = event.which;
			}
		else
			{
				code = event.keyCode;
			}
		if (code==13)
			{
				document.forms[0].autoSubmit.value='search';
				document.forms[0].submit();
			}
	}




