// JavaScript Document
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

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_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_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 NextOneUp() {
// A function that changes the values of the upper price band to the value above
// The currenty selected  value in the lower price band box.
// inoder to work this we have to know:
// what type of list it is.
// what the value of the lover on is 
		// we are in the big list
		//alert(document.quickSearch.FrmMINprice.selectedIndex);
		//alert(document.quickSearch.FrmMINprice.length);
		if (document.quickSearchLetting.FrmMINpriceLetting.selectedIndex != (document.quickSearchLetting.FrmMINpriceLetting.length -1))
		{
			document.quickSearchLetting.FrmMAXpriceLetting.selectedIndex = (document.quickSearchLetting.FrmMINpriceLetting.selectedIndex +1);
		}
		else {
			document.quickSearchLetting.FrmMAXpriceLetting.selectedIndex = (document.quickSearchLetting.FrmMINpriceLetting.selectedIndex);
		}
		
		if (document.quickSearchSales.FrmMINpriceSales.selectedIndex != (document.quickSearchSales.FrmMINpriceSales.length -1))
		{
			document.quickSearchSales.FrmMAXpriceSales.selectedIndex = (document.quickSearchSales.FrmMINpriceSales.selectedIndex +1);
		}
		else {
			document.quickSearchSales.FrmMAXpriceSales.selectedIndex = (document.quickSearchSales.FrmMINpriceSales.selectedIndex);
		}		
}



function popArray (ptype) {
//alert("!!" + ptype);
	    letArr = new Array;
	    saleArr = new Array;
	
	if (ptype =="L") {
		saleArr[0] = ['0','£0'];
		saleArr[1] = ['500','£500'];
		saleArr[2] = ['800','£800'];
		saleArr[3] = ['1000','£1,000'];
		saleArr[4] = ['1200','£1,200'];
		saleArr[5] = ['2000','£2,000'];
		saleArr[6] = ['2500','£2,500'];
		saleArr[7] = ['5000','£5,000'];
		document.quickSearchLetting.FrmPropertyType.value = 'L';
		
	    document.quickSearchLetting.FrmMINpriceLetting.length = saleArr.length;
		document.quickSearchLetting.FrmMAXpriceLetting.length = saleArr.length;
		
		document.quickSearchLetting.FrmMINpriceLetting.options[0].text ='Min Property Price';
		document.quickSearchLetting.FrmMINpriceLetting.options[0].value ='.';
		document.quickSearchLetting.FrmMAXpriceLetting.options[0].text ='Max Property Price';
		document.quickSearchLetting.FrmMAXpriceLetting.options[0].value ='.';		
		
	    for (var i=1;i < saleArr.length;i++) {  // Populate Make list		   
	       document.quickSearchLetting.FrmMINpriceLetting.options[i].value = saleArr[i][0];
	       document.quickSearchLetting.FrmMINpriceLetting.options[i].text = saleArr[i][1];
		   
		   document.quickSearchLetting.FrmMAXpriceLetting.options[i].value = saleArr[i][0];
	       document.quickSearchLetting.FrmMAXpriceLetting.options[i].text = saleArr[i][1];		   
	
	    }		
		
	   	document.quickSearchLetting.FrmMINpriceLetting.selectedIndex = 0;     // select the first model in the list
		document.quickSearchLetting.FrmMAXpriceLetting.selectedIndex = 0;     // select the first model in the list
		
	}
	else
	{
		letArr[0] =['100000','£100,000'];
		letArr[1] =['125000','£125,000'];
		letArr[2] =['150000','£150,000'];
		letArr[3] =['175000','£175,000'];
		letArr[4] =['200000','£200,000'];
		letArr[5] =['225000','£225,000'];
		letArr[6] =['250000','£250,000'];
		letArr[7] =['275000','£275,000'];
		letArr[8] =['300000','£300,000'];
		letArr[9] =['330000','£330,000'];
		letArr[10] =['370000','£370,000'];
		letArr[11] =['400000','£400,000'];
		letArr[12] =['450000','£450,000'];
		letArr[13] =['500000','£500,000'];
		letArr[14] =['550000','£550,000'];
		letArr[15] =['600000','£600,000'];
		letArr[16] =['650000','£650,000'];
		letArr[17] =['700000','£700,000'];
		letArr[18] =['800000','£800,000'];
		letArr[19] =['900000','£900,000'];
		letArr[20] =['1000000','£1,000,000'];
		letArr[21] =['1200000','£1,200,000'];
		letArr[22] =['1500000','£1,500,000'];
		document.quickSearchSales.FrmPropertyType.value = 'S';
		
		document.quickSearchSales.FrmMINpriceSales.length = letArr.length;
		document.quickSearchSales.FrmMAXpriceSales.length = letArr.length;
				
		document.quickSearchSales.FrmMINpriceSales.options[0].text ='Min Property Price';
		document.quickSearchSales.FrmMINpriceSales.options[0].value ='.';
		document.quickSearchSales.FrmMAXpriceSales.options[0].text ='Max Property Price';
		document.quickSearchSales.FrmMAXpriceSales.options[0].value ='.';		
		
	    for (var i=1;i < letArr.length;i++) {  // Populate Make list
	       document.quickSearchSales.FrmMINpriceSales.options[i].value = letArr[i][0];
	       document.quickSearchSales.FrmMINpriceSales.options[i].text = letArr[i][1];
		   
		   document.quickSearchSales.FrmMAXpriceSales.options[i].value = letArr[i][0];
	       document.quickSearchSales.FrmMAXpriceSales.options[i].text = letArr[i][1];	
	    }	
		
	   	document.quickSearchSales.FrmMINpriceSales.selectedIndex = 0;     // select the first model in the list
		document.quickSearchSales.FrmMAXpriceSales.selectedIndex = 0;     // select the first model in the list
		
	}
	
	

	
		

		

		

}
var win= null;
function NewWindow(mypage,myname,w,h,scroll,resize){
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  var settings  ='height='+h+',';
      settings +='width='+w+',';
      settings +='top='+wint+',';
      settings +='left='+winl+',';
      settings +='scrollbars='+scroll+',';
      settings +='resizable='+resize;
	  if (win){
		win.close();
		}
  win=window.open(mypage,myname,settings);
  if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}
var win= null;
function NewWindowTL(mypage,myname,w,h,scroll,resize){
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  var settings  ='height='+h+',';
      settings +='width='+w+',';
      settings +='top='+wint+',';
      settings +='left='+winl+',';
      settings +='scrollbars='+scroll+',';
      settings +='resizable='+resize;
	  if (win){
		win.close();
		}
  win=window.open(mypage,myname,settings);
  if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}

//function unCheckAll(cIndex){
	//this is very simple and is used to uncheck all property type tickboxes so that only one can be checked at once
	//it is used on register_form2.asp
//	for (i = 1; i <= 5; i++){
//			 document.reg2.frmType[i].checked = false;
//	}
//	document.reg2.frmType[cIndex].checked = true;
//}

function lettingoneup() {
// A function that changes the values of the upper price band to the value above
// The currenty selected  value in the lower price band box.
// inoder to work this we have to know:
// what type of list it is.
// what the value of the lover on is 
		
		if (document.quickSearchLetting.FrmMINpriceLetting.selectedIndex != (document.quickSearchLetting.FrmMINpriceLetting.length -1))
		{
			document.quickSearchLetting.FrmMAXpriceLetting.selectedIndex = (document.quickSearchLetting.FrmMINpriceLetting.selectedIndex +1);
		}
		else {
			document.quickSearchLetting.FrmMAXpriceLetting.selectedIndex = (document.quickSearchLetting.FrmMINpriceLetting.selectedIndex);
		}
		
}
