var globalSource;
var message = "";
var objbuttoncache = new Array;

function changetab(blnLeft, strLetter, strImage)  //v1.0
{
	var strFrame;
	if (blnLeft == true)
		strFrame = "lefttabs";
	else
		strFrame = "righttabs";		
	
	
	if (parent.frames[strFrame].document[strLetter] != null)
		parent.frames[strFrame].document[strLetter].src = "images/tabs/" + strImage;
}


function changeto(winevent, highlightcolor) //v1.3
{
	source=getobjectfromevent(winevent);
	var strtagname = (arguments.length > 2 ? arguments[2] : 'TR');
	if (source.tagName=="TABLE")
		return;
	while(source.tagName!=strtagname)
		source=getparentobject(source);
	if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore")
		source.style.backgroundColor=highlightcolor;
	winevent.cancelBubble = true;
}


function changeback(winevent) //v1.3
{
//	if (winevent.fromElement.contains(winevent.toElement)||source.contains(winevent.toElement)||source.id=="ignore")
//		return;
//	if (winevent.toElement!=source)
	if (source) {
		if (source.id!="ignore" && source.tagName != "TABLE") {
			source.style.backgroundColor=source.id;
			source = null;
		}
	}
}

function changetd(winevent, highlightcolor) { // v1.3
	changeto(winevent, highlightcolor, 'TD');
}

function changetr(winevent, highlightcolor) { // v1.3
	changeto(winevent, highlightcolor, 'TR');
}

function changebacktd(winevent) //v1.3
{
	changeback(winevent);
//	source.style.backgroundColor = source.id;
}
function getobjectfromevent(winevnt) {
	var obj;
	if (winevnt.target) obj = winevnt.target;
	else obj = winevnt.srcElement;
	if (!obj.tagName) obj = getparentobject(obj);	
	return obj;
}

function getparentobject(obj) {
	if (obj.parentNode) return obj.parentNode;
	else return obj.parentElement;
}


function proceedcheck(bookmark, link, target, strMsg) {
	if (confirm(strMsg))
		proceed(bookmark, link, target);
}


function proceed(bookmark, link, target) {
	var mydate = new Date();
	mydate.getDate();
	
	if (link.indexOf("?") > 0)
		link += "&";
	else
		link += "?";

	link += "uid=z"  + mydate.getDay() + "-" + mydate.getMonth() + "-" + mydate.getYear() + "-" + mydate.getHours() + "-" + mydate.getMinutes() + "-" + mydate.getSeconds() + "-" + Math.round(Math.random()*1000);

	if (bookmark != '') {
		link += "#" + bookmark;
	}

	if (target == '') {
		location.href = link;
	}
	else {
		parent.frames[target].location.href = link;
	}
}


function changebutton(objbutton, blnover, blnwhite) {
	var objlink;
	var strclass;

	if (blnwhite)
		strclass = (blnover == true ? "buttonwhiteover" : "buttonwhite");
	else
		strclass = (blnover == true ? "buttonover" : "button");
			
	while(objbutton.tagName != "TABLE")
		objbutton = objbutton.parentElement;
			
	if (objbutton.childNodes) {
		alterbuttonobject(objbutton, strclass);
		alterbuttonobjects(objbutton, strclass);
	}
}


function alterbuttonobjects(objparent, strclass) {
	var objchild;
	for (var inta = 0; inta < objparent.childNodes.length; inta ++) {
		objchild = objparent.childNodes[inta];
		alterbuttonobject(objchild, strclass);
		if (objchild.childNodes)
			alterbuttonobjects(objchild, strclass);
	}
}


function alterbuttonobject(objchild, strclass) {
	if (objchild.tagName != "IMG" && objchild.className)
		objchild.className = strclass;
}

function taboffother(strTab) { // remove another tab if one was selected
	if (parent.frames['righttabs'] != null) {

		vartab = parent.frames['righttabs'].document.frmRightTabs.currenttab.value;

		if (vartab != "") {
			varcurrentimage = parent.frames['righttabs'].document[vartab].src;
			parent.frames['righttabs'].document[vartab].src = varcurrentimage.replace("on", "off");
//			changetab(false, vartab, varcurrentimage.replace("on", "off"));
			parent.frames['righttabs'].document.frmRightTabs.currenttab.value = strTab;
		}
	}
}


function updatebalance(strUnsecurePath) {
	var mydate = new Date();
	mydate.getDate();

	link = strUnsecurePath + "fr_header.asp?uid=z"  + mydate.getDay() + "-" + mydate.getMonth() + "-" + mydate.getYear() + "-" + mydate.getHours() + "-" + mydate.getMinutes() + "-" + mydate.getSeconds() + "-" + Math.round(Math.random()*1000);

	parent.frames['banner'].location.href = link;
	if (message!='') alert(message);
}

function updatelogonstatus(blnLoggedon) {
	//document.frmRightTabs.loggedon.value == "1")
}

function getobject(strobjectname) {
	var obj;
	if (document.getElementById)
		obj = document.getElementById(strobjectname);
	else {
		obj = document[strobjectname];
		if (obj == null)
			obj = eval(strobjectname);
	}
	return obj;
}

