var imgpath="sys11/training";
var lastrequesturl="";var incdiv="";var opstate=0;var newdiv_width;var newdiv_height;var winh;var over;var overdiv;var dheight=0;var topedge;var content="";
var user_maindiv;var user_fdivname;var user_dispdiv;var user_dispdivw;var user_dispdivh;var user_frmname;var user_url;var user_sfile;var user_dispcontent;var user_method;var user_updatefun;var optotmsg;var inclfun="";

var ie4=document.all
var ns6=document.getElementById&&!document.all

function iecompattest(){return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body}


function fade(maindiv,fdivname,dispdiv,dispdivw,dispdivh,frmname,url,sfile,dispcontent,method,updatefun)
{
try{
if(wload==1){
		if(dispcontent=="" || dispcontent==null)
		{dispcontent='dispcontent';}
		user_maindiv=maindiv;user_fdivname=fdivname;user_dispdiv=dispdiv;user_dispdivw=dispdivw;user_dispdivh=dispdivh;user_frmname=frmname;user_url=url;user_sfile=sfile;user_dispcontent=dispcontent;user_method=method;user_updatefun=updatefun;
		dheight=dispdivh;		
		hideSelectBoxes();
		var newdiv= document.createElement('div');
		 newdiv.setAttribute("id",'fadediv');
		 newdiv.className="fadediv";
		 newdiv.style.display='block';
		 
		 if( document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) 
		{newdiv_width = document.body.scrollWidth+'px';newdiv_height = document.body.scrollHeight+'px';}
		 else if( document.body.offsetWidth ) 
		{
		 newdiv_width = document.body.offsetWidth+'px';
		 newdiv_height= document.body.offsetHeight+'px';    
		 } else 
		{newdiv_width='100%';newdiv_height='100%';}

		newdiv.style.width=newdiv_width;
		newdiv.style.height=newdiv_height;

		document.body.appendChild(newdiv)       

		newdiv.style.top=document.body.offsetTop;
		newdiv.style.left=document.body.offsetLeft;

		 fade1(dispdiv,dispdivw,dispdivh,frmname,url,sfile,dispcontent,method,updatefun);
  }
}
	catch(e) { alert(e); }
}

function fade1(dispdiv,dispdivw,dheight,frmname,url,sfile,dispcontent,method,updatefun)
{
	try{
		over=$('fadediv');
		overdiv=document.createElement('div');
		overdiv.setAttribute("id",dispdiv);
		overdiv.className="dispdiv";
		overdiv.style.width=dispdivw+"px";
		document.body.appendChild(overdiv);
		
		content="<div id='"+dispcontent+"' style='background-color:white;overflow:auto;width:"+(parseInt(dispdivw)-25)+"' class='smalltxt' ><center><img src='"+imgpath+"/images/loading.gif' border='0'></center></div>";
		optotmsg="<table border='0' cellpadding='0' cellspacing='0' width='"+dispdivw+"'><tr><td valign='top'><div class='opa'><img src='http://"+imgpath+"/images/pop-top-left-crv.gif' width='11' height='11'></div></td><td valign='top' background='http://"+imgpath+"/images/pop-top-tile.gif' width='"+parseInt(dispdivw-22)+"' height='11'><img src='http://"+imgpath+"/images/trans.gif' width='"+parseInt(dispdivw-22)+"' height='11'></td><td valign='top'><img src='http://"+imgpath+"/images/pop-top-right-crv.gif' width='11' height='11'></td></tr></table><table border='0' cellpadding='0' cellspacing='0' width='"+dispdivw+"' bgcolor='white'><tr><td valign='top' width='11' background='http://"+imgpath+"/images/pop-left-tile.gif'><img src='http://"+imgpath+"/images/trans.gif' width='11'></td><td valign='top' width='100%' style='padding-bottom:20px;'><div style='float: right; text-align: middle;padding-top:5px;padding-right:5px;padding-bottom:5px;'><a href=\"javascript:;\" onclick=\"closediv('"+dispdiv+"','"+frmname+"','"+sfile+"','"+updatefun+"','"+dispcontent+"')\" style='cursor:ponter'><img src='http://"+imgpath+"/images/close-icon.gif' width='12' height='12' border='0'></a></div><br clear='all'>"+content+"</td><td valign='top' width='11' background='http://"+imgpath+"/images/pop-right-tile.gif'><img src='http://"+imgpath+"/images/trans.gif' width='11'></td></tr></table><table border='0' cellpadding='0' cellspacing='0' width='"+dispdivw+"'><tr><td valign='top'><img src='http://"+imgpath+"/images/pop-bot-left-crv.gif' width='11' height='11'></td>	<td valign='top' background='http://"+imgpath+"/images/pop-bot-tile.gif' width='100%' height='11'></td>	<td valign='top'><img src='http://"+imgpath+"/images/pop-bot-right-crv.gif' width='11' height='11'></td></tr></table>";
		overdiv.innerHTML="<table border='0' cellpadding='0' cellspacing='0' width='"+dispdivw+"'><tr><td valign='top'><div class='opa'><img src='http://"+imgpath+"/images/pop-top-left-crv.gif' width='11' height='11'></div></td><td valign='top' background='http://"+imgpath+"/images/pop-top-tile.gif' width='"+parseInt(dispdivw-22)+"' height='11'><img src='http://"+imgpath+"/images/trans.gif' width='"+parseInt(dispdivw-22)+"' height='11'></td><td valign='top'><img src='http://"+imgpath+"/images/pop-top-right-crv.gif' width='11' height='11'></td></tr></table><table border='0' cellpadding='0' cellspacing='0' width='"+dispdivw+"' bgcolor='white'><tr><td valign='top' width='11' background='http://"+imgpath+"/images/pop-left-tile.gif'><img src='http://"+imgpath+"/images/trans.gif' width='11'></td><td valign='top' width='100%' style='padding-bottom:20px;'><div style='float: right; text-align: middle;padding-top:5px;padding-right:5px;padding-bottom:5px;'><a href=\"javascript:;\" onclick=\"load_close('"+dispdiv+"','"+frmname+"','"+sfile+"','"+updatefun+"','"+dispcontent+"')\" style='cursor:ponter'><img src='http://"+imgpath+"/images/close-icon.gif' width='12' height='12' border='0'></a></div><br clear='all'><center><img src='http://"+imgpath+"/images/loading-icon.gif' border='0'></center></td><td valign='top' width='11' background='http://"+imgpath+"/images/pop-right-tile.gif'><img src='http://"+imgpath+"/images/trans.gif' width='11'></td></tr></table><table border='0' cellpadding='0' cellspacing='0' width='"+dispdivw+"'><tr><td valign='top'><img src='http://"+imgpath+"/images/pop-bot-left-crv.gif' width='11' height='11'></td>	<td valign='top' background='http://"+imgpath+"/images/pop-bot-tile.gif' width='100%' height='11'></td>	<td valign='top'><img src='http://"+imgpath+"/images/pop-bot-right-crv.gif' width='11' height='11'></td></tr></table>";
		overdiv.style.display='block';
		winh=window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
		topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
		overdiv.style.left=(document.body.offsetWidth-dispdivw)/2+"px";
		overdiv.style.top=topedge+parseInt(winh/12)+"px";

		if(url!=null && url!="")
		{
			//alert(url);
			lastrequesturl=url;
			
			if(url.indexOf("?")==-1)
			{url=url+"?trand="+genNumbers()}
			else
			{url=url+"&trand="+genNumbers()}

			if(method=="POST")
			{ajobj=MakePostRequest(url,parameters,storeContents);}
			else
			{ajobj=MakeGetRequest(url,storeContents);}
		}
	}
	catch(e) { 
		alert(e); }
}

function storeContents()
{
	if (ajobj.readyState == 4) 
	{
	 if (ajobj.status == 200) 
	{
		if(ajobj.responseText!=null && ajobj.responseText!="")
		{
			overdiv.innerHTML="";
			overdiv.innerHTML=optotmsg;
			$(user_dispcontent).innerHTML=ajobj.responseText;
			incdiv=$(user_dispcontent);
			divheight(incdiv.offsetHeight);
		}
	} 
	 //else {alert('There was a problem with the request.');}
   }
}

function removeDiv(e) {e=$(e);e.parentNode.removeChild(e);}

function closediv(dispdiv,frmname,sfile,updatefun,dispcontent)
{
	try{
		var d2=$('fadediv');
		var d3=$(user_dispdiv);
		var d4=$(user_dispcontent);
		d4.innerHTML="";
		removeDiv(user_dispcontent);
		document.body.removeChild(d3);
		removeDiv('fadediv');
		if(user_updatefun!=null && user_updatefun!="")
		{eval(user_updatefun+"()");}
		content="";
		if($('bannerdiv')){$('bannerdiv').style.display="block";}
		if($('logoutbannerdiv')){$('logoutbannerdiv').style.display="block";}
		showSelectBoxes();
	}
	catch(e) { alert(e); }
}

function close_div()
{
try{
	var d2=$('fadediv');
	var d3=$(user_dispdiv);
	var d4=$(user_dispcontent);
	d4.innerHTML="";
	removeDiv(user_dispcontent);
	document.body.removeChild(d3);
	removeDiv('fadediv');
	if(user_updatefun!=null && user_updatefun!=""){eval(user_updatefun+"()");}
	if($('bannerdiv')){$('bannerdiv').style.display="block";}
	if($('logoutbannerdiv')){$('logoutbannerdiv').style.display="block";}
	showSelectBoxes();
  }
	catch(e) { alert(e); }
}

function load_close()
{
try{
	var d2=$('fadediv');
	var d3=$(user_dispdiv);
	document.body.removeChild(d3);
	removeDiv('fadediv');
	if(user_updatefun!=null && user_updatefun!=""){eval(user_updatefun+"()");}
	if($('bannerdiv')){$('bannerdiv').style.display="block";}
	if($('logoutbannerdiv')){$('logoutbannerdiv').style.display="block";}
	showSelectBoxes();
  }
	catch(e) { alert(e); }
}

function divheight(h)
{	
	var seth=h;
	if (dheight!=0)
	{
		seth=dheight;
		if(winh>seth){incdiv.style.height=dheight+"px";overdiv.style.top="100px";}
		if(seth>winh){overdiv.style.top=topedge+25+"px";}	
	}
	else
	{
		seth=overdiv.offsetHeight;
		if(winh>seth){overdiv.style.top=topedge+(winh-seth)/3+"px";}
		else if(seth>winh){overdiv.style.top=topedge+25+"px";}
	}
}

var infdispdivw;var infwinh;

function innerfade(infurl,infwidth,infclosefun)
{
	hideSelectBoxes();
	inclfun=infclosefun;
	infdispdivw=infwidth;
	var exfade=document.getElementById(user_dispdiv);
	var infdiv= document.createElement('div');
	infdiv.setAttribute("id",'infdivover');
	infdiv.className="fadediv";
	
	infdiv.style.width = exfade.offsetWidth+'px';
	infdiv.style.height= exfade.offsetHeight+'px';    
	exfade.appendChild(infdiv)
	infdiv.style.display='block';
	
	var infdisp= document.createElement('div');
	infdisp.setAttribute("id",'infdiv');
	infdisp.className="dispdiv";
	
	document.body.appendChild(infdisp)
	infwinh=window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
	topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
	infdisp.style.left=(document.body.offsetWidth- infwidth)/2+"px";
	infdisp.style.top=topedge+parseInt(infwinh/4)+"px";
	infdisp.style.width =infwidth+'px';
	
	infdisp.innerHTML="<center><img src='http://"+imgpath+"/images/loading-icon.gif' border='0'></center>";
	infdisp.style.display='block';
	ajobj=MakeGetRequest(infurl,infContents);
}

function infContents()
{
	if (ajobj.readyState == 4) 
	{
	 if (ajobj.status == 200) 
	{
		if(ajobj.responseText!=null && ajobj.responseText!="")
		{
			$('infdiv').innerHTML="<table border='0' cellpadding='0' cellspacing='0' width='"+infdispdivw+"'><tr><td valign='top'><div class='opa'><img src='http://"+imgpath+"/images/pop-top-left-crv.gif' width='11' height='11'></div></td><td valign='top' background='http://"+imgpath+"/images/pop-top-tile.gif' width='"+parseInt(infdispdivw-22)+"' height='11'><img src='http://"+imgpath+"/images/trans.gif' width='"+parseInt(infdispdivw-22)+"' height='11'></td><td valign='top'><img src='http://"+imgpath+"/images/pop-top-right-crv.gif' width='11' height='11'></td></tr></table><table border='0' cellpadding='0' cellspacing='0' width='"+infdispdivw+"' bgcolor='white'><tr><td valign='top' width='11' background='http://"+imgpath+"/images/pop-left-tile.gif'><img src='http://"+imgpath+"/images/trans.gif' width='11'></td><td valign='top' width='100%' style='padding-bottom:20px;'><div style='float: right; text-align: middle;padding-top:5px;padding-right:5px;padding-bottom:5px;'><a href=\"javascript:infclose()\" style='cursor:pointer'><img src='http://"+imgpath+"/images/close-icon.gif' width='12' height='12' border='0'></a></div><br clear='all'>"+ajobj.responseText+"</td><td valign='top' width='11' background='http://"+imgpath+"/images/pop-right-tile.gif'><img src='http://"+imgpath+"/images/trans.gif' width='11'></td></tr></table><table border='0' cellpadding='0' cellspacing='0' width='"+infdispdivw+"'><tr><td valign='top'><img src='http://"+imgpath+"/images/pop-bot-left-crv.gif' width='11' height='11'></td>	<td valign='top' background='http://"+imgpath+"/images/pop-bot-tile.gif' width='100%' height='11'></td>	<td valign='top'><img src='http://"+imgpath+"/images/pop-bot-right-crv.gif' width='11' height='11'></td></tr></table>";
			infdivheight($('infdiv').offsetHeight,infwinh);
		}
	} 
	 //else {alert('There was a problem with the request.');}
   }
}

function infdivheight(h,infwin)
{var seth=h;if(infwin>seth){$('infdiv').style.top=topedge+(infwin-seth)/3+"px";}else if(seth>infwin){$('infdiv').style.top=topedge+25+"px";}}
function infclose(){removeDiv('infdivover');removeDiv('infdiv');showSelectBoxes();if(inclfun!=null && inclfun!=""){eval(inclfun+"()");}}
function chngheight(divid,divheight){$(divid).style.height=divheight+"px";}
function IFheight(divid,divheight){$(divid).height=divheight+"px";}
function loadicon(ifraobj){$(ifraobj).style['visibility'] = 'visible';}
