function valid(g,cfn)
{
	document.form.action=cfn;
	document.form.Submi.disabled=true;
	document.form.Submi.value=g;
	document.form.submit();
}

function sessionRenew_Do(fromClick)
{
	var sessionImg=new Image(1,1);
	sessionImg.src="index.php";
	if(fromClick) window.alert("If you clicked ok in time, your session has been safely extended, otherwise please log back in.");
	setTimeout("showSessionTimeoutWarning();",timeToWarn);
}

function showSessionTimeoutWarning()
{
	var now=Date();
	var _confMsg="You have been busy or idle for some time. Would you like to stay logged in? If you don't click OK in the next [TIMEOUT] minutes, your session will time out. Alert issued at [TIME].";
	var threshhold="20";
	_confMsg = _confMsg.replace("[TIME]",now.toString());
	if(window.confirm(_confMsg.replace("[TIMEOUT]",threshhold))) sessionRenew_Do(true);
	else window.alert("Your session will timeout soon (if not already). Expired sessions are NOT able to save data.");
}

function printit()
{
	if(window.print) window.print();  
	else
	{
		var WebBrowser='<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
		document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
		WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";
	}
}

function MessageCenter(zSpanID, zDelayMS)
{
	var spanid=zSpanID;
	var delay=(zDelayMS) ? zDelayMS:4000;
	var messageArray=new Array();
	var count=0;
	var tOut=new Timer(this);
	var tOutRef, tOutRev;
	var prevAcct=0;
	var nextAcct=0;
	var newXMLMsg;

	this.addMessage=function(zMessage)
	{
		messageArray[messageArray.length]=zMessage;
	}

	this.start=function()
	{
		if (document.getElementById)
		{
			document.getElementById(spanid).innerHTML=messageArray[count];
			count++;
			if(count > (messageArray.length-1)) count=0;
		}
		tOut.clearTimeout(tOutRev);
		tOutRef=tOut.setTimeout("start", delay);
		nextAcct=0;
		prevAcct=0;
	}
}

// wonderful timer function by algorithm @ http://www.codingforums.com/archive/index.php/t-10531.html

function Timer()
{
	this.obj = (arguments.length)?arguments[0]:window;
	return this;
}

Timer.prototype.setInterval = function(func, msec)
{
	var i = Timer.getNew();
	var t = Timer.buildCall(this.obj, i, arguments);
	Timer.set[i].timer = window.setInterval(t,msec);
	return i;
}

Timer.prototype.setTimeout = function(func, msec)
{
	var i = Timer.getNew();
	Timer.buildCall(this.obj, i, arguments);
	Timer.set[i].timer = window.setTimeout("Timer.callOnce("+i+");",msec);
	return i;
}

Timer.prototype.clearInterval = function(i)
{
	if(!Timer.set[i]) return;
	window.clearInterval(Timer.set[i].timer);
	Timer.set[i] = null;
}

Timer.prototype.clearTimeout = function(i)
{
	if(!Timer.set[i]) return;
	window.clearTimeout(Timer.set[i].timer);
	Timer.set[i] = null;
}

Timer.set=new Array();
Timer.buildCall=function(obj, i, args)
{
	var t = "";
	Timer.set[i] = new Array();
	if(obj != window)
	{
		Timer.set[i].obj=obj;
		t="Timer.set["+i+"].obj.";
	}
	t += args[0]+"(";
	if(args.length>2)
	{
		Timer.set[i][0]=args[2];
		t += "Timer.set["+i+"][0]";
		for(var j=1;(j+2)<args.length;j++)
		{
			Timer.set[i][j] = args[j+2];
			t += ", Timer.set["+i+"]["+j+"]";
		}
	}
	t += ");";
	Timer.set[i].call=t;
	return t;
}

Timer.callOnce = function(i)
{
	if(!Timer.set[i]) return;
	eval(Timer.set[i].call);
	Timer.set[i] = null;
}

Timer.getNew = function()
{
	var i = 0;
	while(Timer.set[i]) i++;
	return i;
}

var stsz=0;
var szs=new Array('12px','13px','14px','15px','16px','17px');

function setFont(inc)
{
	document.body.style.fontSize = szs[inc];
	if(parent.frames.azlist?true : false) parent.azlist.document.body.style.fontSize=szs[inc];
}

function setFs(inc)
{
	var sz = stsz;
	sz += inc;
	if (sz< 0) sz=0;
	if (sz> 5) sz=0;
	stsz=sz;
	setFont(stsz);
}

function confirmSubmit(bla)
{
	var agree=confirm(bla);
	if(agree) return true;
	else return false;
}