/*------------------------------------------------------------------------------------
		This page:  parklane.js -> include for Park Lane Properties website.

		This include file is called by malmost all pages in directory level 1 
    
     	Last Modified 09/12/04  by Luke Harris.
-------------------------------------------------------------------------------------*/
function jumpTO(obj)
{
if (obj!="")
{
	if (obj==1)
	document.location.href='/Areaguide/Areaguide.asp';
	else if (obj==2)
	document.location.href='/buy/buy.asp';
	else if (obj==3)
	document.location.href='/contacts/contacts.asp';
	else if (obj==4)
	document.location.href='/Landlords/index.asp';
	else if (obj==5)
	document.location.href='/let/let.asp';
	else if (obj==6)
	document.location.href='/maintenance/index.asp';
	else if (obj==7)
	document.location.href='/MyPL/mypl.asp';
	else if (obj==8)
	document.location.href='/news/index.asp';
	else if (obj==9)
	document.location.href='/search/letSearch.asp';
	else if (obj==10)
	document.location.href='/sell/sell.asp';
	else if (obj==11)
	document.location.href='/services/';
	else if (obj==12)
	document.location.href='/tenants/tenants.asp';
	else if (obj==13)
	document.location.href='/corp/about.asp';
	else if (obj==14)
	document.location.href='/developments/index.asp';
}
else
alert('please choose any section');
}

function submitform()
{
if (document.myForm.Name.value=="")
	{
	alert('please enter your Name');
	return false;
	document.myForm.Name.focus();
	}
else if (document.myForm.Email.value.indexOf("@")==-1)
	{
	 alert('Please supply a valid e-mail address');
	 document.myForm.Email.focus();
	 return false;	
	}
else if (document.myForm.Phone.value=="")
	{
	alert('please enter your Contact Number');
	return false;
	document.myForm.Phone.focus();
	}	


else if (document.myForm.Comments.value=="")
	{
	alert('please enter your Requests');
	return false;
	document.myForm.Comments.focus();
	}
		
	else
	{	
w=window.open("/popups/thankyou.asp","contact","left=250,top=160,toolbar=no,directories=no,menubar=no,scrollbars=no,width=370,height=450;");	
//w.focus();
//myForm.submit();
}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function  changeLetOrBuy(theForm,obj){ //changes the property type
	
	var letPrice =[['0',"All"],['0',"_______________"]];
	var letBeds =[['0',"All"],['1',"1"],['2',"2"],['3',"3"],['4',"4"],['5',"5"],['6',"6"],['7',"7"],['8',"8+"], ['',"_______________"]];
	var letArea =[['0',"All"] ,['',"_______________"]];
	var letTypeOfClient =[['0',"All"],['1',"Student"],['2',"Professional"],['0',"_______________"]];
	var letTypeOfProperty =[['0',"All"],['1',"House"],['2',"Flat"],['',"_______________"]];
	
	var buyPrice =[['0',"All"],['1',"Under 250k"],['2',"250 - 500k"],['3',"Over 500k"], ['',"_______________"]];
	var buyBeds =[['',"All"],['1',"1"],['2',"2"],['3',"3"],['4',"4+"], ['',"_______________"]];
	var buyArea =[['',"All"],['City Centre',"City Centre"],['Chapel Allerton',"Chapel Allerton"],['North Leeds',"North Leeds"],['',"_______________"]];
	var buyTypeOfClient =[];
	var buyTypeOfProperty =[];
	
	if(obj==2){ //Buy			
		theForm.action= "../search/buyResults.asp";
		
		my_div.innerHTML="<table width='100%' border='0' cellpadding='0' cellspacing='0'><tr><td class='smwht' style=';line-height:18px'>Price</td></tr></table>";		
		//my_div.style.visibility="visible";	
		
		type=buyPrice;
		//set up prices
		for(i=theForm.maxprice.options.length; i>=0 ;i--){
			theForm.maxprice.options[i]=null;
		}
		for(i=0;i<type.length;i++){
			theForm.maxprice.options[theForm.maxprice.options.length]=new Option(type[i][1], type[i][0],false, false);
		}		
		type=buyBeds;
		//set up prices
		for(i=theForm.beds.options.length; i>=0 ;i--){
			theForm.beds.options[i]=null;
		}
		for(i=0;i<type.length;i++){
			theForm.beds.options[theForm.beds.options.length]=new Option(type[i][1], type[i][0],false, false);
		}		
		type=buyArea;
		//set up prices
		for(i=theForm.area.options.length; i>=0 ;i--){
			theForm.area.options[i]=null;
		}
		for(i=0;i<type.length;i++){
			theForm.area.options[theForm.area.options.length]=new Option(type[i][1], type[i][0],false, false);
		}		
	}
	
	else{ //Let		
		
		theForm.action= "../search/letResults.asp";
				
		my_div.innerHTML="<div><table width='100%' border='0' cellpadding='0' cellspacing='0'><tr><td class='smwht' style=';line-height:18px'>Type of Let</td></tr><tr><td style=';line-height:18px'><select name='renttype' class='normsmm' onChange='changeBeds(thisForm,this.options[this.selectedIndex] .value);changeType(thisForm,this.options[this.selectedIndex] .value);changeRent(thisForm,this.options[this.selectedIndex] .value);changeArea(thisForm,this.options[this.selectedIndex] .value);'><option value=0 selected>All</option><option value=1>Student</option><option value=2>Professional</option><option value=0>_______________</option></select></td></tr><tr><td class='smwht' style=';line-height:18px'>Property Type</td></tr><tr><td class='normsmm' style=';line-height:18px'><select name='typeoflet' class='normsmm'><option value='' selected>All</option><option value=1>House</option><option value=2>Flat</option><option value=''>_______________</option></select></td></tr><tr><td  style=';line-height:18px'class='smwht'>Price </td></tr></table></div>"
		
		my_div.style.visibility="visible";		
		
		type=letPrice;
		//set up prices
		for(i=theForm.maxprice.options.length; i>=0 ;i--){
			theForm.maxprice.options[i]=null;
		}
		for(i=0;i<type.length;i++){
			theForm.maxprice.options[theForm.maxprice.options.length]=new Option(type[i][1], type[i][0],false, false);
		}
		
		type=letBeds;
		//set up prices
		for(i=theForm.beds.options.length; i>=0 ;i--){
			theForm.beds.options[i]=null;
		}
		for(i=0;i<type.length;i++){
			theForm.beds.options[theForm.beds.options.length]=new Option(type[i][1], type[i][0],false, false);
		}
		
		type=letArea;
		//set up prices
		for(i=theForm.area.options.length; i>=0 ;i--){
			theForm.area.options[i]=null;
		}
		for(i=0;i<type.length;i++){
			theForm.area.options[theForm.area.options.length]=new Option(type[i][1], type[i][0],false, false);
		}
		
		type=letTypeOfClient;
		//set up prices
		for(i=theForm.renttype.options.length; i>=0 ;i--){
			theForm.renttype.options[i]=null;
		}
		for(i=0;i<type.length;i++){
			theForm.renttype.options[theForm.renttype.options.length]=new Option(type[i][1], type[i][0],false, false);
		}
		
		type=letTypeOfProperty;
		//set up prices
		for(i=theForm.typeoflet.options.length; i>=0 ;i--){
			theForm.typeoflet.options[i]=null;
		}
		for(i=0;i<type.length;i++){
			theForm.typeoflet.options[theForm.typeoflet.options.length]=new Option(type[i][1], type[i][0],false, false);
		}
	}	
}

function  changeType(theForm,obj){ //changes the property type
	var All = [['',"All"],['1',"House"],['2',"Flat"], ['',"_______________"]];
	var Stud =[['',"All"],['1',"House"],['2',"Flat"],['3',"Room share (Stu)"], ['',"_______________"]];
	var Prof =[['',"All"],['1',"House"],['2',"Flat"],['3',"Studio"],['4',"Bedsit"],['5',"Room Share (Pro)"], ['',"_______________"]];
	
	if(obj==0){
		type=All;
	}
	else if(obj==1){
		type=Stud;
	}
	else{
		type=Prof;
	}
	for(i=theForm.typeoflet.options.length; i>=0 ;i--){
		theForm.typeoflet.options[i]=null;
	}
	for(i=0;i<type.length;i++){
		theForm.typeoflet.options[theForm.typeoflet.options.length]=new Option(type[i][1], type[i][0],false, false);
	}
}

function  changeBeds(theForm,obj){ //changes the property type
	var All =[['',"All"],['1',"1"],['2',"2"],['3',"3"],['4',"4"],['5',"5"],['6',"6"],['7',"7"],['8',"8+"], ['',"_______________"]];
	var Stud =[['',"All"],['1',"1"],['2',"2"],['3',"3"],['4',"4"],['5',"5"],['6',"6"],['7',"7"],['8',"8+"], ['',"_______________"]];
	var Prof =[['',"All"],['1',"1"],['2',"2"],['3',"3"],['4',"4+"], ['',"_______________"]];
	
	if(obj==0){
		type=All;
	}
	else if(obj==1){
		type=Stud;
	}
	else {
		type=Prof;
	}
	
	for(i=theForm.beds.options.length; i>=0 ;i--){
		theForm.beds.options[i]=null;
	}
	for(i=0;i<type.length;i++){
		theForm.beds.options[theForm.beds.options.length]=new Option(type[i][1], type[i][0],false, false);
	}
}

function  changeRent(theForm,obj){ //changes the property type
	var All = [['0',"All"], ['0',"_______________"]];
	var Prof =[['0',"All"],['1',"Under £400pcm"],['2',"£400 - £600pcm"],['3',"£600pcm+"], ['0',"_______________"]];
	var Stud =[['0',"All"],['1',"Under £50pw"],['2',"£50 - £60pw"],['3',"£60pw+"], ['0',"_______________"]];
	
	if(obj==0){
		rent=All;
	}
	else if(obj==1){
		rent=Stud;
	}
	else{
		rent=Prof;
	}
	for(i=theForm.maxprice.options.length; i>=0 ;i--){
		theForm.maxprice.options[i]=null;
	}
	for(i=0;i<rent.length;i++){
		theForm.maxprice.options[theForm.maxprice.options.length]=new Option(rent[i][1], rent[i][0],false, false);
	}
}

function  changeArea(theForm,obj){
	var All=[['',"All"] ,['',"_______________"]];
	var Areas=[['',"All"] ,['Adel',"Adel"] ,['Becketts Park',"Becketts Park"],['Burley',"Burley"],['Chapel Allerton',"Chapel Allerton"],['City Centre',"City Centre"],['Far Headingley',"Far Headingley"],['Headingley',"Headingley"],['Horsforth',"Horsforth"],['Hyde Park',"Hyde Park"],['Kirkstall',"Kirkstall"] ,['Meanwood',"Meanwood"] ,['North Leeds',"North Leeds"],['Oakwood',"Oakwood"],['Roundhay',"Roundhay"],['Scarcroft',"Scarcroft"],['Shadwell',"Shadwell"],['University',"University"],['Weetwood',"Weetwood"],['West Park',"West Park"],['Woodhouse',"Woodhouse"],['',"_______________"]];	
	
	if(obj==1){
		toArea=Areas;
	}
	else if(obj==2){
		toArea=Areas;
	}
	else{
		toArea=Areas;
	}
	for(i=theForm.area.options.length;i>=0;i--){
		theForm.area.options[i]=null;
		//toArea=Areas;
	}
	for(i=0;i<toArea.length;i++){
		theForm.area.options[theForm.area.options.length]=new Option(toArea[i][1], toArea[i][0],false, false);
		//toArea=Areas;
	}
}