	
	/** WikiWeather JavaScript Library */
	
	// ===== Screen Quality Detection =======================
	var vdu_width = screen.width;
	var vdu_height = screen.height;
	var vdu_colorDepth = screen.colorDepth;
	var vdu_pixelDepth = screen.pixelDepth;

	// ===== Select Picture of Appropriate Size =============		
	function altpic (pic,ext,alt) {
		// Relies on naming convention 
		// _b for largest images on high resolution screens: landscape 750; portrait 500
		// _m for low res 800x600 screens: landscape 450; portrait 300
		// _s for hand held devices: landscape 300; portrait 150
		
		//alert("Got here"); //Debug code
		pic = "../images/" + pic; 
		if (vdu_width >= 1100) {pic = pic + "_b." + ext;}
		if (vdu_width < 1100 & vdu_width >=500) {pic = pic + "_m." + ext;}
		if (vdu_width < 500) {pic = pic + "_s." + ext;}
		//alert(pic); //Debug code
		document.write("<img src = " + pic + " alt = " + alt + "/>");				
	}
	
	// ===== Change contents of a block element ===========
	// Used to place place titletext into banner div
	// Source: http://www.sitepoint.com/article/layers-content-javascript
	function WriteLayer(ID,parentID,sText) { 
 		if (document.layers) { 
   			var oLayer; 
   			if(parentID){ 
     			oLayer = eval('document.' + parentID + '.document.' + ID + '.document'); 
   			}else{ 
     			oLayer = document.layers[ID].document; 
   			} 
  			oLayer.open(); 
   			oLayer.write(sText); 
   			oLayer.close(); 
 		} 
 		else if (parseInt(navigator.appVersion)>=5&&navigator. 
			appName=="Netscape") { 
   			document.getElementById(ID).innerHTML = sText; 
 		} 
 		else if (document.all) document.all[ID].innerHTML = sText;		
	}
	
	// To return to the previous page
	function goBack() {
		javascript:history.go(-1);
	}
	
	//Used to display email addresses on browser - should fool mailbots hopefully
	function oldsend(ename, extension,target) {	
		var linker = "@";
		target = "Email " + target;	
		document.write("<a href=" + "mail" + "to:" + ename +
		linker + extension + ">" + target + "</a>");
	}
	
	function send(ename, extension,target) {	
		var linker = "@";
		target = "Click here to email " + target;	
		document.write("<a class="+"hov " + "href=" + "mail" + "to:" + ename +
		linker + extension + ">" + target + "</a>");
	}
	
	//###### AJAX ###### AJAX ###### AJAX ###### AJAX ###### AJAX ###### AJAX ###### AJAX ###### AJAX 	
	
//Uses Ajax to trace existing database records
var xmlHttp;
var formObject;

function getDetails(str, divtag, handler)
{
formObject = divtag;
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request");
 return;
 }
//var url="download_handler.php";
var url=handler;
url=url+"?q="+str; //str is the value to be searched for in the database
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged; 
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById(formObject).innerHTML=xmlHttp.responseText ;
 } 
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}

 
/* --------Finding the Position of the Cursor --------

IE stores this offset in its document.documentElement.clientLeft and document.documentElement.clientTop properties. This code should calculate the correct cursor position in all current browsers:

*/

function getPosition(e) {
    e = e || window.event;
    var cursor = {x:0, y:0};
    if (e.pageX || e.pageY) {
        cursor.x = e.pageX;
        cursor.y = e.pageY;
    } 
    else {
        var de = document.documentElement;
        var b = document.body;
        cursor.x = e.clientX + 
            (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0);
        cursor.y = e.clientY + 
            (de.scrollTop || b.scrollTop) - (de.clientTop || 0);
    }
    return cursor;
}


/* ------------------------------ Floating a layer at cursor position -------------------------*/

<!-- Copyright 2006,2007 Bontrager Connection, LLC
// http://bontragerconnection.com/ and http://www.willmaster.com/
// Version: July 28, 2007
var winW = 0, winH = 0;

if (parseInt(navigator.appVersion)>3) {
 if (navigator.appName=="Netscape") {
  winW = window.innerWidth-16;
  winH = window.innerHeight-16;
 }
 if (navigator.appName.indexOf("Microsoft")!=-1) {
  winW = document.body.offsetWidth;
  winH = document.body.offsetHeight;
 }
}



var cX = 0; var cY = 0; var rX = 0; var rY = 0;

function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}

function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}

if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; }
else { document.onmousemove = UpdateCursorPosition; }

function AssignPosition(d) {
	if(self.pageYOffset) {
		rX = self.pageXOffset;
		rY = self.pageYOffset;
	}
	else if(document.documentElement && document.documentElement.scrollTop) {
		rX = document.documentElement.scrollLeft;
		rY = document.documentElement.scrollTop;
	}
	else if(document.body) {
		rX = document.body.scrollLeft;
		rY = document.body.scrollTop;
	}
	if(document.all) {
		cX += rX; 
		cY += rY;
	}
	
	//Test for nearness to right edge of screen - PJS amendment
	rDiff = winW - cX;
	if(rDiff<400)	{
		cX = cX-400;	//Create a minimum potential width of 400
	}
	//End of test
	
	d.style.left = (cX+10) + "px";
	d.style.top = (cY+10) + "px";
	
	
}

function HideContent(d) {
	if(d.length < 1) { return; }
	document.getElementById(d).style.display = "none";
}

function ShowContent(d) {
	if(d.length < 1) { return; }
	var dd = document.getElementById(d);
	AssignPosition(dd);
	dd.style.display = "block";
}

function ReverseContentDisplay(d) {
if(d.length < 1) { return; }
var dd = document.getElementById(d);
AssignPosition(dd);
if(dd.style.display == "none") { dd.style.display = "block"; }
else { dd.style.display = "none"; }
}

	
