/* ///////////////////////////////////////////////////////////

	common.js
	
	Description: Commonly used functions.
	
	Author: Phil Hawksworth
	Date:	06/12/2002


////////////////////////////////////////////////////////////*/

var gaSearchLayers = new Array("searchQuick","searchContent");

//
// toggle between layers.
// We will hide all the other layers in a given set of layers.
//
function toggleTo(layerArray,theLayer) {

	thisSet = eval(layerArray);
	
	// work through the layers in this set turning everything off.
	var arr
	for (arr in thisSet) {
		e 	= eval("document.all." + thisSet[arr]);
		bm 	= eval("document.all." + thisSet[arr] + "_bm");
		e.style.display = "none";
		bm.className = "bm_Off";		
	}
	
	// turn our chosen layer on.
	bm 	= eval("document.all." + theLayer + "_bm");
	e 	= eval("document.all." + theLayer);
	bm.className = "bm_On";
	e.style.display = "inline";
}


//
// Change the style class of given object.
//
function chgClass(e,c){
	e.className = c;
}


//
// Go to a new url
//
function goTo(url) {
	document.location.href = url;
}



//
// Add a leading zero to the number if needed
//
function addLeadingZero(val){
    var num = new String(val);
    if (num.length < 2) num = "0" + num;
    return num;
}

//
// Return today's date in the form dd/mm/yyyy
//
function showToday() {
	
	//alert("add 0")
	var now = new Date();
	d = addLeadingZero(now.getDate());
	m = addLeadingZero(now.getMonth()+1);
	y = addLeadingZero(now.getYear());
	
	var today = d + "/" + m + "/" + y;
	return today;
	
}

//
// Return current time in the form hh:mm
//
function showTime() {
	
	var now = new Date();
	h = addLeadingZero(now.getHours());
	m = addLeadingZero(now.getMinutes());
	
	var time = h + ":" + m;
	return time;
}

//
// Open a window in the help style
//
function openHelp(url) {

	var xpos 	= screen.width - 310;
	var ypos 	= 0;
	var height 	= screen.height - 60
	var width 	= 300;

	//use all our settings
	dressing = "height="+height+",width="+width+",top="+ypos+",left="+xpos+",location=no,scrollbars=auto,menubars=no,toolbars=no,resizable=yes";
									
	//create the new window
	newWin = window.open(url, 'helpWindow', dressing);

}









