var bOnWin;
function AJAXRequest() {
	var xmlObj = false;
	var CBfunc,ObjSelf;
	ObjSelf=this;
	try { xmlObj=new XMLHttpRequest; }
	catch(e) {
		try { xmlObj=new ActiveXObject("MSXML2.XMLHTTP"); }
		catch(e2) {
			try { xmlObj=new ActiveXObject("Microsoft.XMLHTTP"); }
			catch(e3) { xmlObj=false; }
		}
	}
	if (!xmlObj) return false;
	if(arguments[0]) this.url=arguments[0]; else this.url="";
	if(arguments[1]) this.callback=arguments[1]; else this.callback=function(obj){return};
	if(arguments[2]) this.content=arguments[2]; else this.content="";
	if(arguments[3]) this.method=arguments[3]; else this.method="POST";
	if(arguments[4]) this.async=arguments[4]; else this.async=true;
	this.send=function() {
		var purl,pcbf,pc,pm,pa;
		if(arguments[0]) purl=arguments[0]; else purl=this.url;
		if(arguments[1]) pc=arguments[1]; else pc=this.content;
		if(arguments[2]) pcbf=arguments[2]; else pcbf=this.callback;
		if(arguments[3]) pm=arguments[3]; else pm=this.method;
		if(arguments[4]) pa=arguments[4]; else pa=this.async;
		if(!pm||!purl||!pa) return false;
		xmlObj.open (pm, purl, pa);
		if(pm=="POST") xmlObj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		xmlObj.onreadystatechange=function() {
			if(xmlObj.readyState==4) {
				if(xmlObj.status==200) {
					pcbf(xmlObj);
				}
				else {
					pcbf(null);
				}
			}
		}
		if(pm=="POST")
			xmlObj.send(pc);
		else
			xmlObj.send("");
	}
	this.get=function() {
		var purl,pcbf;
		if(arguments[0]) purl=arguments[0]; else purl=this.url;
		if(arguments[1]) pcbf=arguments[1]; else pcbf=this.callback;
		if(!purl&&!pcbf) return false;
		this.send(purl,"",pcbf,"GET",true);
	}
	this.post=function() {
		var fo,pcbf,purl,pc,pm;
		if(arguments[0]) fo=arguments[0]; else return false;
		if(arguments[1]) pcbf=arguments[1]; else pcbf=this.callback;
		if(arguments[2])
			purl=arguments[2];
		else if(fo.action)
			purl=fo.action;
		else
			purl=this.url;
		if(arguments[3])
			pm=arguments[3];
		else if(fo.method)
			pm=fo.method.toLowerCase();
		else
			pm="post";
		if(!pcbf&&!purl) return false;
		pc=this.formToStr(fo);
		if(!pc) return false;
		if(pm) {
			if(pm=="post")
				this.send(purl,pc,pcbf,"POST",true);
			else
				if(purl.indexOf("?")>0)
					this.send(purl+"&"+pc,"",pcbf,"GET",true);
				else
					this.send(purl+"?"+pc,"",pcbf,"GET",true);
		}
		else
			this.send(purl,pc,pcbf,"POST",true);
	}

	this.formToStr=function(fc) {
		var i,query_string="",and="";
		for(i=0;i<fc.length;i++) {
			e=fc[i];
			if (e.name!='') {
				if (e.type=='select-one') {
					element_value=e.options[e.selectedIndex].value;
				}
				else if (e.type=='checkbox' || e.type=='radio') {
					if (e.checked==false) {
						continue;	
					}
					element_value=e.value;
				}
				else {
					element_value=e.value;
				}
				element_value=encodeURIComponent(element_value);
				query_string+=and+e.name+'='+element_value;
				and="&";
			}
		}
		return query_string;
	}
}
function tip(e,h){
	  e=e||event;
	  var x=e.clientX;
	  var y=e.clientY;
	  titleheight=25 
	   var ajaxobj=new AJAXRequest;
	   ajaxobj.url="/gethelp.trans";
	   ajaxobj.content="method=helpTip&handle="+h;
	   ajaxobj.method="POST";
	   ajaxobj.callback=function(xmlObj){
		   bordercolor="#336699";
			titlecolor="#99CCFF";
			var msgObj = document.createElement('msgTip');
			msgObj.setAttribute("id","msgDiv");
			msgObj.setAttribute("align","center");
			msgObj.style.border="1px solid " + bordercolor;
			msgObj.style.left = x+207+"px";
			msgObj.style.top=y+86+"px";
			msgObj.style.marginTop = -75+document.documentElement.scrollTop+"px";		
			msgObj.onmouseover = function() {bOnWin = 1;}
			msgObj.onmouseout = function() {bOnWin = null;}
			
			//document.body.appendChild(msgObj);
			var title=document.createElement("div");
			title.setAttribute("id","msgTitle");
			title.setAttribute("align","right");
			title.style.background=bordercolor;
			title.style.border="1px solid " + bordercolor;
			title.innerHTML="<img src=/images/close.gif>";
			title.onclick=removeObj;	
			function removeObj(){
				document.getElementById("msgDiv").removeChild(title);
				document.body.removeChild(msgObj);
				bOnWin=null;
			}
			document.body.appendChild(msgObj);
			document.getElementById("msgDiv").appendChild(title);
			var txt=document.createElement("span");
			txt.setAttribute("id","msgContent");

			txt.innerHTML=xmlObj.responseText;
			document.getElementById("msgDiv").appendChild(txt);
	  }
	    ajaxobj.send();
	}	
function showhelptip(){
	 
	 var tipObj=document.getElementById('helptipmsg');
	 if(tipObj){
 		  tipObj.style.display=''; 				
   	}	
}
function show_or_hide(){
	document.documentElement.onmousedown=null;
	var tipObj=document.getElementById('helptipmsg');
	if(tipObj&&tipObj!=null){
		if(tipObj.style.display==''){
			tipObj.style.display='none';	
		}else{
			tipObj.style.display='';	
		}
	}	
}
function hidehelptip(){
	 
	 var tipObj=document.getElementById('helptipmsg');
	 if(tipObj){
 		  tipObj.style.display='none'; 				
   	}	
}
document.documentElement.onmousedown= function() {
	var c = document.getElementById('msgDiv');
	if (!bOnWin && c) 
	document.body.removeChild(c);
	hidehelptip();
}
function smallAdvancedOptions(arg0,arg1){
	obj0=document.getElementById(arg0);
	obj1=document.getElementById(arg1);
	if(obj0!=null&&obj1!=null){
		if(obj0.style.display==''&&obj1.style.display==''){
				obj0.style.display='none';
				obj1.style.display='none';
		}else{
				obj0.style.display='';
				obj1.style.display='';			
		}
	}
}
function bigAdvancedOptions(arg0){
	obj0=document.getElementById(arg0);
	if(obj0!=null){
		if(obj0.style.display==''){
				obj0.style.display='none';
		}else{
				obj0.style.display='';
		}
	}
}
