//ADD LOAD EVENT
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

addLoadEvent(quicksearch);

//QUICKVIEW FEATURE
function quicksearch() { 
//alert (document.forms.qvForm.dbt.value);
  if (!document.getElementsByTagName) return false;
  if (!document.getElementById) return false;
  if (!document.getElementById("quickview")) return false;

	var buy = document.getElementById("buy");
	var let = document.getElementById("let");

	buy.onclick = function() {
		if(document.getElementById("let").checked == false) {
			document.getElementById("firmid").value = 11410;
			document.getElementById("dbtype").value = 1;
			document.getElementById("maplink").href = "sales.php";
			document.getElementById("maplink2").href = "sales.php";
		}
	}
	let.onclick = function() {
		if(document.getElementById("buy").checked == false) {
			document.getElementById("firmid").value = 11410;
			document.getElementById("dbtype").value = 2;
			document.getElementById("maplink").href = "lettings.php";
			document.getElementById("maplink2").href = "lettings.php";
		}
	}
	if(document.forms.searchform.dbt.value==1){
		buy.checked = true;
		let.checked = false;
		}
	if(document.forms.searchform.dbt.value==2){
		buy.checked = false;
		let.checked = true;
		}
		//alert(window.location.href);
	
}