function browsercheck() {
	this.agent = navigator.userAgent;
	this.dom = document.getElementById ? 1 : 0;
	this.ver = navigator.appVersion;
	this.win = (this.agent.indexOf("Win") > -1) ? 1 : 0;
	this.ie5 = (this.ver.indexOf("MSIE 5") > -1 && this.dom) ? 1 : 0;
	this.ie55 =	(this.ie5 && this.minorver >= 0.5) ? 1 : 0;
	this.ie6 = (this.ver.indexOf("MSIE 6") > -1 && this.dom) ? 1 : 0;
	this.ie7 = (this.ver.indexOf("MSIE 7") > -1 && this.dom) ? 1 : 0;
	this.ff = this.agent.toLowerCase().indexOf("firefox") ? 1 : 0;
	this.aol = this.agent.toLowerCase().indexOf("america online") ? 1 : 0;
	this.ie	= (this.ie5 || this.ie6 || this.ie7);
	this.opera	= (navigator.userAgent.indexOf("Opera") != -1) ? 1 : 0;
	this.px = (this.ie) ? "" : "px";
	return this;
}
var bw = new browsercheck();
	
function jumpWhiteSpace(node) {
	while (node.nodeType != 1) node = node.nextSibling;
	return node;
}

/*
elmObj - Mandatory. Element whose children to search for the attributes.
elmNameStr - Mandatory. Name of the elements you want to look for. Use "*" to look for all elements.
atrNameStr - Mandatory. Name of the attribute you're looking for.
atrValueStr - Optional. Attribute you’re looking for must contain certain value as well.
examples:
	getElementsByAttribute(document.body, "*", "id"); 
	getElementsByAttribute(myObj, "input", "type", "text"); 
*/
function getElementsByAttribute(elmObj, elmNameStr, atrNameStr, atrValueStr) {
	var elmArr = (elmNameStr == "*" && document.all) ? document.all : elmObj.getElementsByTagName(elmNameStr);
	var elmReturnArr = new Array();
    var atrValueObj = (typeof atrValueStr != "undefined") ? new RegExp("(^|\\s|.)" + atrValueStr + "(.|\\s|$)") : null;
    var currentObj, attributeObj;
    for (var i = 0; i < elmArr.length; i++) {
        currentObj = elmArr[i];
        attributeObj = currentObj.getAttribute(atrNameStr);
        if (typeof attributeObj == "string" && attributeObj.length > 0) {
			if (typeof atrValueStr == "undefined" || (atrValueObj && atrValueObj.test(attributeObj))) elmReturnArr.push(currentObj);
        }
    }
    return elmReturnArr;
}

if (Array.prototype.push == null) {
	Array.prototype.push = function(value) {
		this[this.length] = value;
		return value;
	}
}

popUp.prototype.ref = { closed : false, open : false };
function popUp(url, name, opts) {
	this.opts = opts;
	this.url = url;
	this.name = name;
}

popUp.prototype.open = function(reload) {
	if (this.ref.closed || !this.ref.open || reload) this.ref = window.open(this.url, this.name, this.opts);
	this.ref.focus();
}

function initialiseImageSwap(imgObj, swapUrl) {
	imgSwap = new Image();
	imgSwap.src = swapUrl;
	imgObj.originalSrc = imgObj.src;
	imgObj.onmouseover = function() {
		this.src = swapUrl;
	}
	imgObj.onmouseout = function() {
		this.src = this.originalSrc;
	}
}

function ieObjectHack() {
	var objectElements = document.getElementsByTagName("OBJECT");
	for (var i = 0; i < objectElements.length; i++) {
		if (objectElements[i].getAttribute("data")) objectElements[i].removeAttribute("data");
		objectElements[i].outerHTML = objectElements[i].outerHTML;
		objectElements[i].style.visibility = "visible";
	}
}