ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false

//these function from:
//http://www.devshed.com/c/a/PHP/PHP-and-JavaScript-Pooling-Your-Resources/
//this function calls the child file
function attach_file( p_script_url ) {
      // create new script element, set its relative URL, and load it
      script = document.createElement( 'script' );
      script.src = p_script_url;
      document.getElementsByTagName( 'head' )[0].appendChild( script );
}
//this function updates the status box
function show_status( status_text ) {
    document.getElementById('status').innerHTML = status_text;
}


function submitForm(elem){
  while (elem.parentNode && elem.parentNode.tagName != "FORM"){
     elem = elem.parentNode;
  }
  var oForm = elem.parentNode;
  oForm.submit();
}


function bigPic (propertyPic) {
	var url = 'popup_bigPic.phtml?property=' + propertyPic;
	var remoteWin1 = window.open(url,"propertyPic",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=350,height=500');
	if( navigator.appName.substring(0,8) == "Netscape" ) {
		remoteWin1.location = url;
	}
	remoteWin1.focus();
}

function fullSpec (prty_uid, htmlzone) {
	var url = 'popup_fullSpec.phtml?prty_uid=' + prty_uid + '&htmlzone=' + htmlzone;
	var remoteWin2 = window.open(url,"fullSpec",'toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=0,width=600,height=500');
	if( navigator.appName.substring(0,8) == "Netscape" ) {
		remoteWin2.location = url;
	}
	remoteWin2.focus();
}

function moreLoc (lc_uid) {
	var url = 'popup_moreLoc.phtml?lc_uid=' + lc_uid;
	var remoteWin3 = window.open(url,"moreLoc",'toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=0,width=400,height=200');
	if( navigator.appName.substring(0,8) == "Netscape" ) {
		remoteWin3.location = url;
	}
	remoteWin3.focus();
}

function drillDown (areaFrom) {
	var url = 'popup_drilldown.phtml';
	if (areaFrom) url = 'popup_drilldown.phtml?drillDown=' + areaFrom;
	var remoteWin4 = window.open(url,"drillDown",'toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=0,width=300,height=250');
	if( navigator.appName.substring(0,8) == "Netscape" ) {
		remoteWin4.location = url;
	}
	remoteWin4.focus();
}

function popMap (map) {

	if (map == "monaco") {
		url = 'texts/monaco/map_monaco.html';
	} else if (map == "alpes") {
		url = 'texts/sof/map_alpes.html';
	} else if (map == "var") {
		url = 'texts/sof/map_var.html';
	} else {
		url = 'null';
	}

	var remoteWin5 = window.open(url,"Map",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=600,height=540');
	if( navigator.appName.substring(0,8) == "Netscape" ) {
		remoteWin5.location = url;
	}
	remoteWin5.focus();
}


function set_var(x) {
  window.opener.document.myform.lc_uid.value=x;

}

function checkinput(CheckForm) {
		if (empty(CheckForm.frm_name.value)) {
			var message="You haven't included your name!.";
			alert(message);
		} else if (empty(CheckForm.frm_address.value)) {
			var message="You need to include your postal address in order for us to contact you.";
			alert(message);
		} else if (empty(CheckForm.frm_phone.value)) {
			var message="You need to include your telephone number in order for us to contact you.";
			alert(message);
		} else if (empty(CheckForm.frm_email.value)) {
			var message="You need to include your email address in order for us to contact you.";
			alert(message);
		} else if (empty(CheckForm.frm_comments.value)) {
			var message="You haven't made any comments!";
			alert(message);
		} else {
			return true;
		}
		return false;
	}

	function empty(inputStr) {
		if (inputStr == "" || inputStr == null) {
			return true
	    }
		return false
	}
	
	//This dynamically updates the price lists on the fly according to currency.
	dynData_1 = new Array("300k","300000","500k","500000","1m","1000000","2m+","2000000"); //gb
	dynData_3 = new Array("3m","3000000","5m","5000000","10m","10000000","20m+","20000000"); //ff
	dynData_5 = new Array("1m","1000000","2m","2000000","3m","3000000","5m+","5000000"); //dm
	dynData_6 = new Array("100m","100000000","200m","200000000","300m","300000000","500m+","500000000"); //it
	dynData_4 = new Array("500k","500000","800k","800000","1.5m","1500000","3m+","3000000"); //eu
	dynData_2 = new Array("500k","500000","800k","800000","1.5m","1500000","3m+","3000000"); //us
	
	function init(tag) {
		document.myform.price_from.options[4] = null;document.myform.price_from.options[3] = null;document.myform.price_from.options[2] = null;document.myform.price_from.options[1] = null;
		document.myform.price_to.options[4] = null;document.myform.price_to.options[3] = null;document.myform.price_to.options[2] = null;document.myform.price_to.options[1] = null;
	
		tag = eval("dynData_"+tag);
		for (var i=0; i<tag.length; i=i+2) document.myform.price_from.options[document.myform.price_from.length] = new Option(tag[i], tag[i+1], false, false);
		document.myform.price_from.selectedIndex = 0

		for (var i=0; i<tag.length; i=i+2) document.myform.price_to.options[document.myform.price_to.length] = new Option(tag[i], tag[i+1], false, false);
		document.myform.price_to.selectedIndex = 0
	}
	
	function setCC() {
		var tmpHold = document.myform.price_from.length;
		for (var i=0; i<tmpHold; i++) {
			document.myform.price_from.options[0] = null;
			document.myform.price_to.options[0] = null;
		}
		document.myform.price_from.options[0] =  new Option("...", "ignore", false, false);
		document.myform.price_to.options[0] =  new Option("...", "ignore", false, false);

		if (document.myform.cur_uid.options[document.myform.cur_uid.selectedIndex].value != "ignore") {
			var tag = eval("dynData_"+document.myform.cur_uid.options[document.myform.cur_uid.selectedIndex].value);
			for (var i=0; i<tag.length; i=i+2) document.myform.price_from.options[document.myform.price_from.length] = new Option(tag[i], tag[i+1], false, false);
	
	
			for (var i=0; i<tag.length; i=i+2) document.myform.price_to.options[document.myform.price_to.length] = new Option(tag[i], tag[i+1], false, false);
		}

		document.myform.price_from.selectedIndex = 0
		document.myform.price_to.selectedIndex = 0
	}
	
	
function toggleLayer(whichLayer) {
  if (document.getElementById)
{
// this is the way the standards work
var style2 = document.getElementById(whichLayer).style;
style2.display = style2.display? "":"block";
}
else if (document.all)
{
// this is the way old msie versions work
var style2 = document.all[whichLayer].style;
style2.display = style2.display? "":"block";
}
else if (document.layers)
{
// this is the way nn4 works
var style2 = document.layers[whichLayer].style;
style2.display = style2.display? "":"block";
}
}
	
