
var loadingHTML = '<div align="center" style="height:100%; width:100%; vertical-align:middle;"><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><img align="middle" alt="loading" src="images/loading.gif" /></div>';

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_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_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 f_clientWidth() {
	return f_filterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}
function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}
function f_scrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}
function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}

function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}

<!--
	function change(id, newClass) {
		identity=document.getElementById(id);
		identity.className=newClass;
	}
	
	function openWin(file, size1, size2, scroll) {
		popupbox = window.open( file,
"new","toolbar=no,location=no,status=no,menubar=no,scrollbars="+scroll+",width="+size1+",height="+size2+",resizable=no");
	}
	
	function openReport(field,value) {
		if (value == "") {
			alert("Please make a selection before printing a report");
		} else {		
			reportbox = window.open("report.php?field="+field+"&value="+value,
"new","toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,width=760,height=520,resizable=no");
		}
	}
	
	function openfilter()
	{
		Element.toggle('searchfilter');
	}
	
	function CheckAll(fmobj, check) {
		var TotalBoxes = 0;
	  	var TotalOn = 0;
		  for (var i=0;i<fmobj.elements.length;i++) {
			var e = fmobj.elements[i];
			if ((e.type=='checkbox')) {
			  e.checked = check;
			}
		  }
	}
	
	function submitSearch(e, btnid)
	{
		var characterCode;
		var btn = document.getElementById(btnid);

		if(e && e.which){ //if which property of event object is supported (NN4)
		e = e
		characterCode = e.which; //character code is contained in NN4's which property
		}
		else{
		e = event
		characterCode = e.keyCode //character code is contained in IE's keyCode property
		}
		
		//alert(characterCode);
		
		if(characterCode == 13){ 
			btn.click();
			return false;
		}else
		{
			return false;
		}
	}
	
	
function ShowHideLayer(id, todo)
{
	if(todo == 'show')
	{
		Element.show(id);
	}else
	{
		Element.hide(id);
	}
}

function showpopup(id)
{	
	setOpacity("PopupOverlay");
	Element.show('PopupOverlay');
	Element.show(id);
}

function closePopup(name, inner)
{
	Element.hide('PopupOverlay');
	Element.hide(name);
	if(inner != "")
	{
		Element.update(inner,loadingHTML);	
	}
	//resetWindow('enquirePnl');
}

function setOpacity(name)
{
	if (navigator.appVersion.indexOf("MSIE")!=-1)
	{
		Element.setFilter(name,'alpha(opacity=80)');
	}
	else
	{
		Element.setOpacity(name,'0.8');
	}
}

function showThanks()
{
	width = f_clientWidth();
	scrollh = f_scrollTop();
	
	Element.setTop('enquirePnl',scrollh+100);
	Element.setLeft('enquirePnl',width/2 -250);
		
	showpopup('enquirePnl');
	//resizeWindow('enquirePnl', 500, 485);
	new Ajax.Updater('enquirePnlInner', 'lib/thanks.php', {method: 'get'});
}

function showDetail(thepage)
{
	overlay=document.getElementById('PopupOverlay');
	page = document.getElementById('body');
	if(overlay)
	{		
		height = page.offsetHeight;		
		Element.setHeight('PopupOverlay',  height + 300);
		newh = height + 500;
	}
	width = f_clientWidth();
	scrollh = f_scrollTop();
	
	Element.setTop('enquirePnl',scrollh+100);
	Element.setLeft('enquirePnl',width/2 -250);
		
	showpopup('enquirePnl');
	//resizeWindow('enquirePnl', 500, 485);
	new Ajax.Updater('enquirePnlInner', thepage+'.html', {method: 'get'});	
}

function loadEnquire()
{
	width = f_clientWidth();
	scrollh = f_scrollTop();
	
	Element.setTop('enquirePnl',scrollh+100);
	Element.setLeft('enquirePnl',width/2 -250);
		
	showpopup('enquirePnl');
	//resizeWindow('enquirePnl', 500, 485);
	new Ajax.Updater('enquirePnlInner', 'lib/enquire.php', {method: 'get'});
}

function loadBox(value)
{
	page = document.getElementById('wrapper');
	
	width = f_clientWidth();
	scrollh = f_scrollTop();	
	height = page.offsetHeight;
	
	Element.setTop('enquirePnl',scrollh+150);
	Element.setLeft('enquirePnl',width/2 -250);	
	Element.setHeight('PopupOverlay',height+20);
		
	showpopup('enquirePnl');
	//resizeWindow('enquirePnl', 500, 485);
	new Ajax.Updater('enquirePnlInner', 'lib/map_entry.php?entry='+value, {method: 'get'});
}


function userValidate(form) { // OPEN FUNCTION  userValidate
	
	var email = form.hfs_email.value; // email value
	var checkEmail = /^([a-zA-Z0-9-_\.]+)@([a-zA-Z0-9-\.]+)\.[a-z]{2,4}$/; // email value check	
	
	if(form.hfs_fname.value.length <1) { form.hfs_fname.select(); // selects field if less than 1
												 alert("Please enter your First Name");									  	   	 
												 return false; } // alerts msg & then quits function if less than 1
	if(form.hfs_sname.value.length <1) { form.hfs_sname.select(); // selects field if less than 1
												 alert("Please enter your Last Name");	
												 return false; } // alerts msg & then quits function if less than 1		
	
	else if(!(checkEmail.test(email))) { form.hfs_email.select();
												 alert("Please enter a valid e-mail address");									  	   	 
												 return false; }
	else if(form.captcha.value.length <4) { form.captcha.select(); // selects field if less than 1
												 alert("Please enter the 4 letter code");	
												 return false; } // alerts msg & then quits function if less than 1
	
		
	else { return true; }// submits form results
			
						
						} // CLOSE FUNCTION SUBBUTT
						
	function validateCODE() { // OPEN FUNCTION  userValidate
	
	if(form.captcha.value.length <4) {form.captcha.select(); // selects field if less than 1
												 alert("Please enter the 4 letter code");												
												 return false; } // alerts msg & then quits function if less than 1		
	
			
						
						} // CLOSE FUNCTION SUBBUTT
// JavaScript Document

/////////////////////////////////////////////////////////////////////

var FloatLayers       = new Array();
var FloatLayersByName = new Array();

function addFloatLayer(n,offX,offY,spd){new FloatLayer(n,offX,offY,spd);}
function getFloatLayer(n){return FloatLayersByName[n];}
function alignFloatLayers(){for(var i=0;i<FloatLayers.length;i++)FloatLayers[i].align();}

function getXCoord(el) {
	x=0;
	while(el){
		x+=el.offsetLeft;
		el=el.offsetParent;
	}
	return x;
}
function getYCoord(el) {
	y=0;
	while(el){
		y+=el.offsetTop;
		el=el.offsetParent;
	}
	return y;
}

/////////////////////////////////////////////////////////////////////

FloatLayer.prototype.setFloatToTop=setTopFloater;
FloatLayer.prototype.setFloatToBottom=setBottomFloater;
FloatLayer.prototype.setFloatToLeft=setLeftFloater;
FloatLayer.prototype.setFloatToRight=setRightFloater;
FloatLayer.prototype.initialize=defineFloater;
FloatLayer.prototype.adjust=adjustFloater;
FloatLayer.prototype.align=alignFloater;

function FloatLayer(n, offX, offY, spd) {
	this.index=FloatLayers.length;

	FloatLayers.push(this);
	FloatLayersByName[n] = this;

	this.name    = n;
	this.floatX  = 0;
	this.floatY  = 0;
	this.tm      = null;
	this.steps   = spd;
	//this.alignHorizontal=(offX>=0) ? leftFloater : rightFloater;
	this.alignHorizontal=leftFloater;
	this.alignVertical  =(offY>=0) ? topFloater : bottomFloater;
	//this.ifloatX = Math.abs(offX);
	this.ifloatX = offX;
	this.ifloatY = Math.abs(offY);
}

/////////////////////////////////////////////////////////////////////

function defineFloater(){
	this.layer  = document.getElementById(this.name);
	this.width  = this.layer.offsetWidth;
	this.height = this.layer.offsetHeight;
	this.prevX  = this.layer.offsetLeft;
	this.prevY  = this.layer.offsetTop;
}

function adjustFloater() {
	this.tm=null;
	if(this.layer.style.position!='absolute')return;

	var dx = Math.abs(this.floatX-this.prevX);
	var dy = Math.abs(this.floatY-this.prevY);

	if (dx < this.steps/2)
		cx = (dx>=1) ? 1 : 0;
	else
		cx = Math.round(dx/this.steps);

	if (dy < this.steps/2)
		cy = (dy>=1) ? 1 : 0;
	else
		cy = Math.round(dy/this.steps);

	if (this.floatX > this.prevX)
		this.prevX += cx;
	else if (this.floatX < this.prevX)
		this.prevX -= cx;

	if (this.floatY > this.prevY)
		this.prevY += cy;
	else if (this.floatY < this.prevY)
		this.prevY -= cy;

	this.layer.style.left = this.prevX;
	this.layer.style.top  = this.prevY;

	if (cx!=0||cy!=0){
		if(this.tm==null)this.tm=setTimeout('FloatLayers['+this.index+'].adjust()',50);
	}else
		alignFloatLayers();
}

function setLeftFloater(){this.alignHorizontal=leftFloater;}
function setRightFloater(){this.alignHorizontal=rightFloater;}
function setTopFloater(){this.alignVertical=topFloater;}
function setBottomFloater(){this.alignVertical=bottomFloater;}

function leftFloater(){this.floatX = document.body.scrollLeft + this.ifloatX;}
function topFloater(){this.floatY = document.body.scrollTop + this.ifloatY;}
function rightFloater(){this.floatX = document.body.scrollLeft + document.body.clientWidth - this.ifloatX - this.width;}
function bottomFloater(){this.floatY = document.body.scrollTop + document.body.clientHeight - this.ifloatY - this.height;}

function alignFloater(){
	if(this.layer==null)this.initialize();
	this.alignHorizontal();
	this.alignVertical();
	if(this.prevX!=this.floatX || this.prevY!=this.floatY){
		if(this.tm==null)this.tm=setTimeout('FloatLayers['+this.index+'].adjust()',50);
	}
}

function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}

function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}


new FloatLayer('enquirePnl',-22,170,10);
function detach(){	
	lay=document.getElementById('enquirePnl');
	if(lay)
	{
		l=getXCoord(lay);
		t=getYCoord(lay);
		lay.style.position='absolute';
		lay.style.top=t;
		lay.style.left=l;
		getFloatLayer('enquirePnl').initialize();
		alignFloatLayers();
	}
	
	
	
}

