
// Show Timeout Alert
function showTimeoutWarning() {
	setTimeout('sessionTimeout()', 3600000); // 60 minutes and we logout.
	alert('Your session will timeout in 5 minutes!');
	
}

// Force Logoff
var pSessionWindow = null;
function sessionTimeout() {
	if(pSessionWindow != null) {
		try { pSessionWindow.close(); } catch(exception) {} ;
	}
	window.open('Default.aspx?Logout=True&ex=Your Session Has Timed Out','_self');
}

function navCustomer(iCustomerID) {
	document.getElementById("header_iptNavCustomerID").value=iCustomerID;
	eval(document.getElementById("ADMIN_CustomerS").href.replace("javascript:",""));
}

function navEvent(iEventID) {
	document.getElementById("header_iptNavEventID").value=iEventID;
	eval(document.getElementById("ADMIN_EVENTS").href.replace("javascript:",""));
}

window.onerror = function(msg, url, lno) {
			alert(msg);
			return true;
}

window.onload = function()
{
	try{ enableTooltips("useBubbleToolTip");  }catch(e){}
	try{ doResize(); }catch(e){}
	
	try{
		if (document.getElementById("header_divMessage").innerHTML.length) {
			document.getElementById("divOuterMessage").style.visibility = 'visible';
			document.getElementById("divOuterMessage").style.display = 'block';
		}
	}
	catch(e){}
	try{ createDailyCalendar("myCalendarDailyDiv",1); }catch(e){}
	try{ pageLoad(); }catch(e){}
	try{ setDIV(); }catch(e){}
	
	if(PageName() != 'Default.aspx') {
		setTimeout('sessionTimeout()', 3600000); // 60 Minutes
	}
}

function popModalSized(sInner, sWidth, sHeight ) {
	YAHOO.util.Dom.get('spnModalInner').innerHTML = sInner;
	YAHOO.util.Dom.setStyle('spnModal', 'width', sWidth);
	YAHOO.util.Dom.setStyle('spnModal', 'height', sHeight);
	YAHOO.util.Dom.setStyle('spnModal', 'visibility', 'visible');
	YAHOO.util.Dom.setStyle('spnModal', 'display', 'block');
}
function popModal(sInner) {
	YAHOO.util.Dom.get('spnModalInner').innerHTML = sInner;
	YAHOO.util.Dom.setStyle('spnModal', 'width', YAHOO.util.Dom.getViewportWidth());
	YAHOO.util.Dom.setStyle('spnModal', 'height', YAHOO.util.Dom.getViewportHeight());
	YAHOO.util.Dom.setStyle('spnModal', 'visibility', 'visible');
	YAHOO.util.Dom.setStyle('spnModal', 'display', 'block');
}
function hideModal() {
	YAHOO.util.Dom.get('spnModalInner').innerHTML = null;
	YAHOO.util.Dom.setStyle('spnModal', 'visibility', 'hidden');
	YAHOO.util.Dom.setStyle('spnModal', 'display', 'none');
}

function popCalendar(sInner) {
	YAHOO.util.Dom.get('spnModalCalendar').innerHTML = sInner;
	YAHOO.util.Dom.setStyle('spnModalCalendar', 'width', '125px');
	YAHOO.util.Dom.setStyle('spnModalCalendar', 'height', '125px');
	YAHOO.util.Dom.setStyle('spnModalCalendar', 'visibility', 'visible');
	YAHOO.util.Dom.setStyle('spnModalCalendar', 'display', 'block');
}
function hideMessage() {
	YAHOO.util.Dom.setStyle('divOuterMessage', 'visibility', 'visible');
	YAHOO.util.Dom.setStyle('divOuterMessage', 'display', 'block');
}

function nav(sTab,sPage) {
	if(sPage.indexOf('swf')>0) {
		if (sPage.length>0){document.getElementById("header_iptSwf").value = sPage;}	
		__doPostBack('header$cmdNav','')
	} else {
		YAHOO.util.Dom.get('header_iptNavTab').value = sTab;
		YAHOO.util.Dom.get('header_iptPage').value = sPage;
		__doPostBack('header$cmdNav','')
	}
}

function upit(iEventID)
{
	document.all.ifrUpload.contentWindow.document.all.file.click();
	document.all.ifrUpload.contentWindow.document.all.iptEventID.value = iEventID;
	while(document.all.ifrUpload.contentWindow.document.all.file == "")
	{
		setTimeout(100);
	}
	setFilename();
}

function submitIt()
{
	document.all.ifrUpload.contentWindow.document.all.sub.click();//.submit();
}

function setFilename() {
  var obj=document.getElementById("flashMain");
  var sPath = document.all.ifrUpload.contentWindow.document.all.file.value;
  sPath = sPath.substring(sPath.lastIndexOf('\\'));
  if (obj) eval('obj.SetVariable("sFileName", "' + sPath.replace('\\','') + '")');
}

function hideDivInformation() {
	YAHOO.util.Dom.setStyle('divInformation', 'visibility', 'hidden');
	YAHOO.util.Dom.setStyle('divInformation', 'display', 'none');
}

function showInfoMessage(sMsg, Type) {
	try {
		document.getElementById('spnRollMemo').innerText = sMsg;
		showInfoDiv(Type);
	} catch(e) {
	}
}
var a;
var ypos=0;
var started=0;
var Id=0;
function hideInfoDiv(iVal)
{	
	if(iVal>0)
	{
		ypos=0;
	}
	
	ypos=ypos-15;
	if(ypos<0){ypos=0;}
	
	var oCtrl = document.getElementById('divRollMemo');
	oCtrl.style.height=ypos;
	if (ypos<=0)
	{
		window.clearTimeout(Id);Id=0;
		oCtrl.style.visibility='hidden';
		oCtrl.style.display='none';
		gshowElement( 'SELECT' );
	}
	else{Id = window.setTimeout('hideInfoDiv(0);',5);}

}
function showInfoDiv(iType)
{

	var iCtrl = document.getElementById('divRollMemo');
	iCtrl.style.visibility='visible';
	iCtrl.style.display='block';
	
	switch(iType) 
	{
		case(1): //INFO
			document.getElementById('imgRollMemo').src = 'images/header/info.gif';
			break
		case(2): //WARNING
			document.getElementById('imgRollMemo').src = 'images/header/warn.gif';
			break
		case(3): //ERROR
			document.getElementById('imgRollMemo').src = 'images/header/error.gif';
			break
	}

	if (a==1) { 
		a=-1; 
	} else {
		a=1;
	}
	//ghideElement( 'SELECT', document.all.divRollMemo )
	document.getElementById('divRollMemo').style.left = ((screen.width - document.getElementById('tblRollMemo').width)/2);
	if(!Id){movemenu();started=1;}

}

function movemenu() {
	try{
		if(ypos>100){ypos=0;}
		if(ypos<0){ypos=0;}
		ypos=ypos+15;
		document.all.divRollMemo.style.height=ypos;
		if (ypos<=0 || ypos>=100) {
			window.clearTimeout(Id);Id=0;window.setTimeout('hideInfoDiv();',8000);}else{Id = window.setTimeout('movemenu();',5);
		}
	} catch(e){}
}
