function WinOpen(url,a,b){
	properties='history=no,toolbar=0,location=0,directories=0,scrollbars=yes,status=0,menubar=0,width='+a+',height='+b+'';
	window.open(url,'news',properties) ;
}

function WinOpenNoScroll(url,a,b){
	properties='history=no,toolbar=0,location=0,directories=0,scrollbars=no,status=0,menubar=0,width='+a+',height='+b+'';
	window.open(url,'mywindow',properties) ;
}
function WinOpenAt(url,name,a,b,top,left,scroll){
	if(!scroll) scroll='yes';
	properties='history=no,toolbar=0,location=0,directories=0,scrollbars='+scroll+',status=0,menubar=0,width='+a+',height='+b+',top='+top+',left='+left+'';
	window.open(url,name,properties) ;
}

function WinOpenAtHidden(url,name,a,b,top,left){
	properties='fullscreen,history=no,toolbar=0,location=0,directories=0,scrollbars=yes,status=0,menubar=0,width='+a+',height='+b+',top='+top+',left='+left+'';
	Win=window.open(url,name,properties) ;
	Win.resizeTo(100,100);
	Win.moveTo((screen.width-120),(screen.height-200));
}

function WinOpenNamed(url,w_name,a,b){
	properties='history=no,toolbar=0,location=0,directories=0,scrollbars=yes,status=0,menubar=0,width='+a+',height='+b+'';
	window.open(url,w_name,properties) ;
}

function openClip(URL){
	properties = 'history=no,toolbar=0,location=0,directories=0,scrollbars=yes,status=0,menubar=0,width=500,height=550,top=0,left=0';
	WinH = window.open(URL,'clipboard',properties);
}

function WinOpenFull(URL){
	properties = 'history=yes,toolbar=1,location=1,directories=1,scrollbars=yes,status=1,menubar=1,width=800,height=600';
	window.open(URL,'Full',properties);
}


function quickSearch(){
var postareas1 = new Array(200);
postareas1['E1']="Whitechapel,Stepney,Mile End";postareas1['E2']="Bethnal Green,Shoreditch";postareas1['E3']="Bow,Bromley-by-Bow";
postareas1['E4']="Chingford, Highams Park";postareas1['E5']="Clapton";postareas1['E6']="East Ham";postareas1['E7']="Forest Gate, Upton Park";
postareas1['E8']="Hackney, Dalston";postareas1['E9']="Hackney, Homerton";postareas1['E10']="Leyton";postareas1['E11']="Leytonstone";
postareas1['E12']="Manor Park";postareas1['E13']="Plaistow";postareas1['E14']="Poplar, Millwall, Isle of Dogs";postareas1['E15']="Stratford, West Ham";
postareas1['E16']="Canning Town, North Woolwich";postareas1['E17']="Walthamstow";postareas1['E18']="South Woodford";postareas1['WC1']="Bloomsbury, Gray's Inn";
postareas1['WC2']="Covent Garden, Holborn, Strand";postareas1['EC1']="Clerkenwell, Finsbury, Barbican";postareas1['EC2']="Moorgate, Liverpool Street";
postareas1['EC3']="Monument, Tower Hill, Aldgate";postareas1['EC4']="Fleet Street, St. Paul’s";postareas1['N1']="Islington, Barnsbury, Canonbury";
postareas1['N2']="East Finchley";postareas1['N3']="Finchley Central";postareas1['N4']="Finsbury Park, Manor House";postareas1['N5']="Highbury";
postareas1['N6']="Highgate";postareas1['N7']="Holloway";postareas1['N8']="Hornsey, Crouch End";postareas1['N9']="Lower Edmonton";
postareas1['N10']="Muswell Hill";postareas1['N11']="Friern Barnet, New Southgate";postareas1['N12']="North Finchley, Woodside Park";postareas1['N13']="Palmers Green";
postareas1['N14']="Southgate";postareas1['N15']="Seven Sisters";postareas1['N16']="Stoke Newington, Stamford Hill";postareas1['N17']="Tottenham";
postareas1['N18']="Upper Edmonton";postareas1['N19']="Archway, Tufnell Park";postareas1['N20']="Whetstone, Totteridge";postareas1['N21']="Winchmore Hill";
postareas1['N22']="Wood Green, Alexandra Palace";postareas1['NW1']="Regent’s Park, Camden Town";postareas1['NW2']="Cricklewood, Neasden";
postareas1['NW3']="Hampstead, Swiss Cottage";postareas1['NW4']="Hendon, Brent Cross";postareas1['NW5']="Kentish Town";postareas1['NW6']="West Hampstead, Kilburn, Queens Park";
postareas1['NW7']="Mill Hill";postareas1['NW8']="St John’s Wood";postareas1['NW9']="Kinsbury, Colindale";postareas1['NW10']="Willesden, Harlesden, Kensal Green";
postareas1['NW11']="Golders Green, Hampstead Gdn Suburb";postareas1['SE1']="Waterloo, Bermondsey, Southwark, Borough";postareas1['SE2']="Abbey Wood";
postareas1['SE3']="Blackheath, Westcombe Park";postareas1['SE4']="Brockley, Crofton Park, Honor Oak Park";postareas1['SE5']="Camberwell";
postareas1['SE6']="Catford, Hither Green, Bellingham";postareas1['SE7']="Charlton";postareas1['SE8']="Deptford";
postareas1['SE9']="Eltham, Mottingham";postareas1['SE10']="Greenwich";postareas1['SE11']="Lambeth";postareas1['SE12']="Lee, Grove Park";
postareas1['SE13']="Lewisham, Hither Green";postareas1['SE14']="New Cross, New Cross Gate";postareas1['SE15']="Peckham, Nunhead";postareas1['SE16']="Rotherhithe, South Bermonsey, Surrey Docks";
postareas1['SE17']="Walworth, Elephant & Castle";postareas1['SE18']="Woolwich, Plumstead";postareas1['SE19']="Upper Norwood, Crystal Palace";postareas1['SE20']="Penge, Anerley";
postareas1['SE21']="Dulwich";postareas1['SE22']="East Dulwich";postareas1['SE23']="Forest Hill";postareas1['SE24']="Herne Hill";
postareas1['SE25']="South Norwood";postareas1['SE26']="Sydenham";postareas1['SE27']="West Norwood, Tulse Hill";postareas1['SE28']="Thamesmead";
postareas1['SW1']="Westminster, Belgravia, Pimlico";postareas1['SW2']="Brixton, Streatham Hill";postareas1['SW3']="Chelsea, Brompton";postareas1['SW4']="Clapham";
postareas1['SW5']="Earl’s Court";postareas1['SW6']="Fulham, Parson’s Green";postareas1['SW7']="South Kensington";postareas1['SW8']="South Lambeth, Nine Elms";
postareas1['SW9']="Stockwell, Brixton";postareas1['SW10']="West Brompton, World’s End";postareas1['SW11']="Battersea, Clapham Junction";postareas1['SW12']="Balham";
postareas1['SW13']="Barnes, Castelnau";postareas1['SW14']="Mortlake, East Sheen";postareas1['SW15']="Putney, Roehampton";postareas1['SW16']="Streatham, Norbury";
postareas1['SW17']="Tooting";postareas1['SW18']="Wandsworth, Earlsfield";postareas1['SW19']="Wimbledon, Merton";postareas1['SW20']="South Wimbledon, Raynes Park";
postareas1['W1']="Mayfair, Marylebone, Soho";postareas1['W2']="Bayswater, Paddington";postareas1['W3']="Acton";postareas1['W4']="Chiswick";
postareas1['W5']="Ealing";postareas1['W6']="Hammersmith";postareas1['W7']="Hanwell";postareas1['W8']="Kensington";postareas1['W9']="Maida Vale, Warwick Avenue";
postareas1['W10']="Ladbroke Grove, North Kensington";postareas1['W11']="Notting Hill, Holland Park";postareas1['W12']="Shepherd's Bush";postareas1['W13']="West Ealing";
postareas1['W14']="West Kensington";
postareas1['S']="All";postareas1['N']="All";postareas1['W']="All";postareas1['E']="All";postareas1['SW']="All";postareas1['SE']="All";postareas1['NW']="All";postareas1['WC']="All";postareas1['EC']="All";

re = / /gi;
s=document.searchform.mappostcode.value.toUpperCase();
err=0;

if (document.searchform.mappostcode.value == '' ){
	alert('Please enter a postcode');
	err=1;
} else if(!postareas1[s]){
	alert('This is not a valid postcode');
	err=1;
}

if(err==0){
	if(postareas1[s] == 'All'){
		document.searchform.largearea.value = s;
		document.searchform.mappostcode.value = s;
	}
 return true;
}

return false;
}

function reflect(){
	a = document.searchform.category.selectedIndex;
	var jj = new Array(document.searchform.lowestprice.length);

	if ( a == 0 ){

	b = '£';
	c = ',000';
	step = 0;
	
	for ( i = 0 ; i < document.searchform.lowestprice.length; i++){
	if ( step==0 ){
		jj[i] = new Option(b+0);
		step +=50;
		continue;
	}
	jj[i] = new Option(b+step+c);
	step += 50;
}

step=0;
for(i=0;i<document.searchform.lowestprice.length;i++){
document.searchform.lowestprice.options[i]=jj[i];
if (step>950){step='1000000+';}
document.searchform.lowestprice.options[i].value=step;
step+=50000;
}
document.searchform.lowestprice.options[0].selected=true;

step=0;
for(i=0;i<document.searchform.highestprice.length;i++){
step+=50;
s=step;
if (s>950){s='1,000';c=',000+';}
jj[i]=new Option(b+s+c);
}

step=0;
for(i=0;i<document.searchform.highestprice.length;i++){
document.searchform.highestprice.options[i]=jj[i];
step+=50000;
if (step>950000){step='1000000+';};
document.searchform.highestprice.options[i].value=step;
}
document.searchform.highestprice.options[19].selected=true;
}else{

b='£';
c=',000';
step=0;
for(i=0;i<document.searchform.lowestprice.length;i++){
if(step==0){jj[i]=new Option(b+0);step+=25;continue;}
jj[i]=new Option(b+step);
step+=25;
}
step=0;
for(i=0;i<document.searchform.lowestprice.length;i++){
document.searchform.lowestprice.options[i]=jj[i];
document.searchform.lowestprice.options[i].value=step;
step+=25;
}
document.searchform.lowestprice.options[0].selected=true;

step=25
for(i=0;i<document.searchform.highestprice.length;i++){
//eval(b + i);      
if(step==500){jj[i]=new Option("Over £500");}else{
jj[i]=new Option(b+step);}
step+=25;
}

step=0;
for(i=0;i<document.searchform.highestprice.length;i++){
document.searchform.highestprice.options[i]=jj[i];
step+=25;
if(step==500){document.searchform.highestprice.options[i].value="1000000+";}else{
document.searchform.highestprice.options[i].value=step;}
}
document.searchform.highestprice.options[19].selected=true;
}
}

function reflect_disable()
{
	a = document.searchform.estatetype.selectedIndex;   //Disable/Enable the 
	if (a==3) {
		document.searchform.bedrooms.disabled=true;
		document.searchform.bathrooms.disabled=true;
		document.searchform.receptionrooms.disabled=true;
		document.searchform.garden.disabled=true;
	}else{
		document.searchform.bedrooms.disabled=false;
	    document.searchform.bathrooms.disabled=false;
		document.searchform.receptionrooms.disabled=false;
		document.searchform.garden.disabled=false;
	}
}

function setReset()
{
	document.searchform.reset();
	document.searchform.estatetype.selectedIndex=0;
	document.searchform.category.selectedIndex=0;
	reflect_disable();
	reflect();
}

function mailme(firstpart,secondpart,textclass){

	document.write('<a href="mailto:' + firstpart + '@' + secondpart + '" class="' + textclass + '">' + firstpart + '@' + secondpart + '</a>')

}
function addAgencyInTheList(agency){
	
	var select = document.forma.agency;
	select.options[select.options.length] = new Option(agency);
	select.options[select.options.length - 1].value = agency;
	select.options[select.options.length - 1].selected = true;

}

var hideLayerFlag = true;

function ChangeHideLayerFlag(){
	hideLayerFlag = !hideLayerFlag;
}

function showlayer(myy,mynote,left){
	//alert(document.body.scrollTop);
	//alert(myy);
	mylayer = document.getElementById('statuslayer');
	if (left){		
		mylayer.style.left = left;
	} else {
		mylayer.style.left = (screen.width/2)-100;
	}
	
	if (document.all){
		mylayer.style.top = Number(document.body.scrollTop) + Number(myy) + 10;	
	} else {
		mylayer.style.top = Number(myy) + 15;
	}
	/*
	mylayer.innerHTML = '	<table width="300" cellpadding="0" cellspacing="0" border="0" align="center">\
								<tr>\
									<td valign="top" width="240"><h6>'+mynote+'</td>\
								</tr>\
							</table>';
	*/
	mylayer.innerHTML = mynote;
	mylayer.style.visibility = 'visible';
}

function hidelayer(closeFlag){
	
	if (closeFlag){
		hideLayerFlag = true;		
	}

	if (hideLayerFlag){
		mylayer = document.getElementById('statuslayer');
		mylayer.style.left = 0;
		mylayer.style.top = 0;
		mylayer.innerHTML = '';
		mylayer.style.visibility = 'hidden';
	}

}
