
window.Lib.request=function(url){
	url+="&nx="+window.nx++;
	try{
		var request=null;
		if(!request) try{request=new ActiveXObject('Msxml2.XMLHTTP');}catch(e){;};
		if(!request) try {request=new ActiveXObject('Microsoft.XMLHTTP');}catch(e){;};
		if(!request) try {request=new XMLHttpRequest();}catch(e){;};
		if(!request) {return '';}
		
		request.open('GET', url, false);
		request.send(null);
		
		if(!arguments[1]){
			var str=request.responseText;
			var pos=str.indexOf("<!DOCTYPE");
			if(pos>=0){ throw Error(98,"Unexpected 'request' error.");};
			if(str=="err"){ throw Error(99,"Unexpected 'sql' error.");};
			return cleanReq(request.responseText);
		}
	}catch(e){ return "err";}
}
function cleanReq(str){
	try{
		with(window.Lib){
			str=replace(str,'<!--METADATA TYPE=','');
			str=replace(str,'ASP_DEBUG_INFO','');		
			str=replace(str,'-->','');	
			str=replace(str,'""','');	
			str=replace(str,'\n','');	
			str=replace(str,'\r','');	
			return str;
		}
	}catch(e){;}
}

window.Lib.quickRequest=function(hEvent,hVariable,hValue){
	var url="common/bin/action-req.asp?hEvent="+ hEvent +"&hVariable="+ hVariable +"&hValue="+ hValue +"&nx="+ window.nx++;
	var ret=window.Lib.request(url);
	return ret;
}
window.Lib.accessPass=function(hVariable,hValue){
	var url="tools/entryforms/hr/login.asp?hVariable="+ hVariable+"&hEmail="+ hValue;
	var ret=window.Lib.request(url);
	return ret;
}
//---------------------------------------------- ERRORS --------------------

window.Lib.resetErrCode=function(frm){
	if(frm.errCode > 0){ 
		frm.errCode=0; return true; 
	}else{ return false; }
}

window.Lib.errend=function(e,proc){
	e.name+=proc;
	var ar=new Array();
	ar=e.name.split(":");
	
	var br=new Array();
	var j=0;
	for(var i=0; i<ar.length; i++){
		if(ar[i]){ br[j]=ar[i]; }
		j++
	}ar=br;
	
	if(e.number==-2146827286){ e.message="Java script evaluation error."; ar[0]="Sql Response."; }
	
	var s="",c="";
	s+="ErrCode: "+ e.number +"\nDescription: "+ e.message +"\n"
	for(var i=0; i<ar.length; i++){
		c="Generated by: ";
		if(i>0){ c="Passed to: " }
		if(i==ar.length-1){ c="Finalized by: " }
		s+=c+ ar[i] +"\n";
	}
	alert(s);	
}

window.Lib.errorLogout=function(msg,PROC,who){
	try{
		//alert(MSG9);
		var qs="";
			qs+="?hEvent=app-error-logout";
			qs+="&proc="+ PROC;
			qs+="&who="+ who;
			qs+="&msg="+ msg;
			qs=window.Lib.replace(qs,"'","`");
		window.location.href="common/bin/action.asp"+ qs
	}catch(e){;}
}

//****************************************** Extends Test **********************
/*
window.Lib.getexecq=function(){
  try{
	var me=new clsDivTest();
	window.ExecQ=me.Value;
  }catch(e){window.ExecQ="0";}
};

function clsDivTest(){
	this.Extends(window.Lib.LayCreator());
	this.isPopup=true;
	this.create(html(),'divtest',0,0);
	var Me=this;
	this.init=function(){ this.Value=this.hTest.value; }
	Me.init(); Me.show(); 	
	function html(){
		var c=window.Lib.colHTML();
		var s="<input"+ c.setid('hTest') +" type='hidden' value='1'>"; 
		var col=new Array();
		col['html']=s;
		col['controls']=c.controls;
		return col;
	}		
}
*/
//************************************** PROGRESS BAR **************************************************

	function clsProgBar(ParentID,moreTop,moreLeft,timeValue){ 

		this.Extends(window.Lib.LayCreator());
		var ps=window.Lib.getParentPosition(ParentID);
		this.isPopup=false;
		
		var hasLabel='no';
		if(arguments[4]){ hasLabel='yes'; }
		
		var arIms=new Array('ani2_BNK','ani2_000','ani2_010','ani2_020','ani2_030',
						    'ani2_040','ani2_050','ani2_060','ani2_070','ani2_080',
						    'ani2_090','ani2_100');

		var imgSrc="extends/images/progbar/"+ arIms[0] +".gif"	
		
		var mg=new Image();
		mg.src=imgSrc;

		if(ParentID==""){  var tp=100; var lf=200; }
			else{ var tp=ps.top+moreTop; var lf=ps.left+moreLeft; }	
		this.create(html(imgSrc),'progbar',tp,lf);
		
		var Me=this;
		var count=0;
		var tm=null;
		var cn=false;
		
		increment=function(){ 
			if(!cn){ count++ }; if(cn) { count-- }
			Me.bar.src="extends/images/progbar/"+ arIms[count] +".gif";
			tm=setTimeout("increment()",timeValue);
			if(count==11){ cn=true; }; if(count==0){ cn=false; }
		}
		
		this.exit=function(val){
			clearTimeout(tm);
			Me.bar.src="extends/images/progbar/"+ arIms[11] +".gif";
			var n=setTimeout("window.dialogs['progbar'].remove()",500);
		}
		
		this.init=function(){ Me.bar.height=15; increment(); }
		Me.init();
		Me.show();	
		
//------------------------------------------------------------------------------------------
		function html(imgSrc){
		 var c=window.Lib.colHTML();

		 var s='';
		 with(c){
			s+="<table cellpadding='0' cellspacing='0'>";
			
			if(hasLabel=='yes'){
				s+="<tr>";
				s+="	<td"+ setid('') +" class='cb-r11'>Loading ...";
				s+="	</td>";
				s+="</tr>";
			}
			s+="<tr>";
			s+="	<img"+ setid('bar') +"src='"+ imgSrc +"' border='0' height='15'></td>";
			s+="</tr>";
			s+="</table>";
		 }
			var col=new Array();
			col['html']=s;
			col['controls']=c.controls;
			return col;
		}		
		
	}//-- end class

