﻿var xmlHttp
function ajaxcenter(ctype,bcid,scid,pid,events,forbackfn)
{
		/////
}
function formatfbfn(instr)
{
	var str
	str = instr.replace(/'|"/g,"%27");
	str = str.replace(/\(/g,"%28");
	str = str.replace(/\)/g,"%29");
	str = str.replace(/,/g,"%2C");
	return(str)
}
function formatmenu(ctype,bcid,forbackfn)
{
	//borbackfn = formatfbfn(forbackfn)
	if (ctype.length > 0){
		var url="inc/ECmenu.asp?ctype=" + ctype + "&bcid=" + bcid + "&forbackfn="+forbackfn
		xmlHttp=GetXmlHttpObject(stateChanged2)
		xmlHttp.open("GET", url , true)
		xmlHttp.send(null)
	}
	else{
		document.getElementById("menuhint").innerHTML=""
	}
}

function showalpp(ctype,bcid,forbackfn)
{
	if (ctype.length > 0){
		var url
		if (ctype == '1'){
			url="unti.asp?bcid=" + bcid + "&forbackfn="+forbackfn }
		else{
			url="unitapp.asp?bcid=" + bcid + "&forbackfn="+forbackfn
		}
		xmlHttp=GetXmlHttpObject(stateChanged)
		xmlHttp.open("GET", url , true)
		xmlHttp.send(null)
	}
	else{
		document.getElementById("txtHint").innerHTML=""
	}
}
function showpppl(scid)
{
	if (scid.length > 0){
		var url="Appdetallist.asp?scid=" + scid
		xmlHttp=GetXmlHttpObject(stateChanged)
		xmlHttp.open("GET", url , true)
		xmlHttp.send(null)
	}
	else{
		document.getElementById("txtHint").innerHTML=""
		
	}
}
function showHint(pid)
{
	if (pid.length > 0){
		var url="cpp.asp?pid=" + pid
		xmlHttp=GetXmlHttpObject(stateChanged)
		xmlHttp.open("GET", url , true)
		xmlHttp.send(null)
	}
	else{
		document.getElementById("txtHint").innerHTML=""
	}
}
function showHint2(pid)
{
	if (pid.length > 0){
		var url="app.asp?pid=" + pid
		xmlHttp=GetXmlHttpObject(stateChanged)
		xmlHttp.open("GET", url , true)
		xmlHttp.send(null)
	}
	else{
		document.getElementById("txtHint").innerHTML=""
	}
}
function stateChanged()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
		document.getElementById("txtHint").innerHTML=xmlHttp.responseText
		var array = xmlHttp.responseText.match(/<script>[A-Za-z0-9\s;,'"()]*<\/script>/i )
		var MyScript="";
		if(array != null){
			MyScript=array[0];
			MyScript = MyScript.replace(/<\/?script>/g,"")
			if((MyScript == "") || (MyScript == null)){
				saveHistory();}
			else{
				eval(MyScript);}
		}
		else{
			saveHistory();}
	}
}
function stateChanged2()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
		document.getElementById("menuhint").innerHTML=xmlHttp.responseText
		var array = xmlHttp.responseText.match(/<script>[A-Za-z0-9\s;,'"()]*<\/script>/i )
		var MyScript="";
		if(array != null){
			MyScript=array[0];
			MyScript = MyScript.replace(/<\/?script>/g,"")
			eval(MyScript);
		}
	}
}
function GetXmlHttpObject(handler)
{
	var objXmlHttp=null
	if (navigator.userAgent.indexOf("Opera")>=0){
		alert("This page doesnt work in Opera")
		return;
	}
	
	if (navigator.userAgent.indexOf("MSIE")>=0){
		var strName="Msxml2.XMLHTTP"
		if (navigator.appVersion.indexOf("MSIE 5.5")>=0){
			strName="Microsoft.XMLHTTP"
		}
		try{
			objXmlHttp=new ActiveXObject(strName)
			objXmlHttp.onreadystatechange=handler
			return objXmlHttp
		}
		catch(e){
			alert("Error. Scripting for ActiveX might be disabled")
			return
		}
	}
	if (navigator.userAgent.indexOf("Mozilla")>=0)
	{
		objXmlHttp=new XMLHttpRequest()
		objXmlHttp.onload=handler
		objXmlHttp.onerror=handler
		return objXmlHttp
	}
}