//Changes background color of the element passed as obj argument
function bgCC(obj, color) { //v1.1 by Project VII
	var b;
	if (!obj.style) {
		obj = findObj(obj);
	}
	b = (document.layers) ? obj : obj.style;
	b.backgroundColor = color
}

//Changes css class
function cCSS(obj, cssClass) { //v1.1 by Project VII
	if (!obj.className) {
		obj = findObj(obj);
	}
	obj.className = cssClass;
}

//Locates an object within a page, based on it's ID
function findObj(n, d) {
	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 = findObj(n, d.layers[i].document);
	if (!x && d.getElementById) x = d.getElementById(n);
	return x;
}

//Gets position of an element from the left
function DL_GetElementLeft(eElement) {
	var nLeftPos = eElement.offsetLeft; // initialize var to store calculations
	var eParElement = eElement.offsetParent; // identify first offset parent element
	while (eParElement != null) { // move up through element hierarchy
		nLeftPos += eParElement.offsetLeft; // appending left offset of each parent
		eParElement = eParElement.offsetParent; // until no more offset parents exist
	}
	return nLeftPos; // return the number calculated
}

//Gets position of an element from the top
function DL_GetElementTop(eElement) {
	var nTopPos = eElement.offsetTop; // initialize var to store calculations
	var eParElement = eElement.offsetParent; // identify first offset parent element
	while (eParElement != null) { // move up through element hierarchy
		nTopPos += eParElement.offsetTop; // appending top offset of each parent
		eParElement = eParElement.offsetParent; // until no more offset parents exist
	}
	return nTopPos; // return the number calculated
}

//Makes elemenent visible
function MakeVisible(elemID) {
	var g, b;
	if ((g = findObj(elemID)) != null) {
		b = (document.layers) ? g : g.style;
		b.visibility = "visible";
	}
}

//Makes elemenent invisible
function MakeInvisible(elemID) {
	var g, b;
	if ((g = findObj(elemID)) != null) {
		b = (document.layers) ? g : g.style;
		b.visibility = "hidden";
	}
}

function SetStyle(elemID, Attribute, Value) {
	var g, b;
	if ((g = findObj(elemID)) != null) {
		b = (document.layers) ? g : g.style;
		eval("b." + Attribute + "='" + Value + "'");
	}
}
function GetWinWidth() {
	var myWidth = 0, myHeight = 0;
	if (typeof (window.innerWidth) == 'number') {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	return myWidth;
}
function GetWinHeight() {
	var myWidth = 0, myHeight = 0;
	if (typeof (window.innerWidth) == 'number') {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	return myHeight;
}

function DisableSubmitBtn(obj) {
	obj.disabled = true;
	obj.value = 'Processing...';
	obj.className = "FormButtonSubmitted";
	return true;
}
