//
// common.js
//

// Author: Colin Jaggs
// Date: 6th October 2004
// Description: Common JS functions use throughout the site

// common variables
var popUpWin = false;

// close any existing popup windows
function closePopups()
{
	if (popUpWin) popUpWin.close();
}

function popUpPage(url)
{
	if (popUpWin.open) popUpWin.close();
	
	popUpWin = window.open(url, "popupwin", "width=650,height=500,scrollbars=1,toolbar=1")
}

// cross browser function to find an element by id
function objectById(id)
{ 
	if (document.getElementById) return document.getElementById(id); 
	else if (document.all) return document.all[id]; 
	else if (document.layers) return document.layers[id]; 
} 

function quickSearchCatchEnter(e)
{
	if (e.keyCode == 13)
	{
		quickSearchGo();
		return false;
	}
	else return true;
}

function quickSearchGo()
{
	var url = HTTPHost + "/search-results";
	if ((document.forms[0].quickSearch.value != "") && (document.forms[0].quickSearch.value != "Search CFC")) url += "?a=" + document.forms[0].quickSearch.value;
	location.href = url;
}

// cross browser function to find an element by id
function objectById(id)
{ 
	if (document.getElementById) return document.getElementById(id); 
	else if (document.all) return document.all[id]; 
	else if (document.layers) return document.layers[id]; 
} 

// textbox focus and blur events (change active css)
function focusTxt(obj) { obj.className = obj.className + " Selected"; }
function blurTxt(obj) { obj.className = obj.className.replace(" Selected", ""); }