var cXHR=null,cXHRf=null;
function common_createXHR(){if(XMLHttpRequest==undefined){XMLHttpRequest=function(){try{return new ActiveXObject("Msxml2.XMLHTTP.6.0");}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0");}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP");}catch(e){}try{return new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}throw new Error("This browser does not support XMLHttpRequest.");};}else return new XMLHttpRequest();return null;}
function common_receive(){
	if (cXHR.readyState==4){
		var v=cXHR.responseText;
		if ((v.charAt(0)=="O")&&(v.charAt(1)=="K")){v=v.substring(2,v.length);
			eval(cXHRf);
			cXHRf=null;
		} else alert(v);
		delete cXHR;
		cXHR = null;
	}
}
function common_send(url,p,act){
	if(cXHR)return;
	cXHRf=act;
	cXHR=common_createXHR();
	cXHR.open("POST",url,true); 
	cXHR.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	cXHR.onreadystatechange=common_receive;
	cXHR.send(p);
}
function OnIC(elmname,i1,i2){elm=document.getElementById(elmname);if(!elm)return;if(elm.className=='ap_icon_'+i1)elm.className='ap_icon_'+i2;else elm.className='ap_icon_'+i1;}
function OnICS(aid,eid,i1,i2){OnIC(eid+"_"+aid,i1,i2);}
function common_getCookie(cookieName) {
	var cookieValue='';
	var posName=document.cookie.indexOf(escape(cookieName) + '=');
	if (posName!=-1) {
		var posValue = posName + (escape(cookieName) + '=').length;
		var endPos = document.cookie.indexOf(';', posValue);
		if (endPos != -1) cookieValue = unescape(document.cookie.substring(posValue, endPos));
		else cookieValue = unescape(document.cookie.substring(posValue));
	}
	return (cookieValue);
}
function common_setCookie(cookieName, cookieValue, expires, path, domain, secure) {
	document.cookie = escape(cookieName) + '=' + escape(cookieValue)
		+ (expires ? '; expires=' + expires.toGMTString() : '')
		+ (path ? '; path=' + "/" : '; path=' + "/")
		+ (domain ? '; domain=' + domain : '')
		+ (secure ? '; secure' : '');
}

