var Mp=new Object();

var z=false;
var pu="http://"+document.domain+"/";
var cn=null;
var tl='';
var ls=[];
var lso=[];
var es='Fri, 01-Jan-2020 00:00:01 GMT';
var mb=null;
var ac=z;var as=z;

function euc(v){return encodeURIComponent(v)}
function cb(e){e.cancelBubble=true}
function ge(e){return document.getElementById?document.getElementById(e):null}
function eih(e,v){ge(e).innerHTML=v}
function sa(e,n,v){e.setAttribute(n,v)}
function sd(e,s){ge(e).style.display=s?s:"none"}
function gc(n){var c=document.cookie;var p=n+"=";var b=c.indexOf("; "+p);if(b==-1){b=c.indexOf(p);if(b!=0)return null}else{b+=2}var e=c.indexOf(";",b);if(e==-1)e=c.length;return unescape(c.substring(b+p.length,e))}
function dc(n){if(gc(n))document.cookie=n+"=; expires=Fri, 10 Feb 2000 03:12:33 UTC; path=/";}
function sc(n,v,e,p,d,s){document.cookie=n+"="+escape(v)+((e)?";expires="+e:"")+((p)?";path="+p:"")+((d)?";domain="+d:"")+((s)?";secure":"")}
function dac(){var m=[];var j=document.cookie;m=j.split("; ");for(var i=0;i<m.length;i++){var o=[];o=m[i].split("=");dc(o[0])}}
function gof(e,h){var o=0;while(e!=null){o+=e["offset"+(h?"Left":"Top")];e=e.offsetParent}return o}
var ui=gc("uid")?true:false;

function cro(){var o=null;if(window.ActiveXObject){o=new ActiveXObject("Msxml2.XMLHTTP");if(!o)o=new ActiveXObject("Microsoft.XMLHTTP")}else if(window.XMLHttpRequest){o=new XMLHttpRequest()}return o;}
function rmp(u,f,a){var p=cro();p.open("GET",pu+u+"&t="+tl,true);if(f){p.onreadystatechange=function(){if(p.readyState==4){a?f(a,p.responseText):f(p.responseText)}}}p.send(null)}
function smp(t){tl=t;rmp("start.php?",imp)}

function sac(){ac=!ac;if(ac){ge("ctbl").style.width="auto";sd("ac","inline")}else{sd("ac");ge("ctbl").style.width="100%"}}
function ssb(){as=!as;if(as){rmp("ssb.php?",eih,"shb");sd("shb","block")}else{eih("shb","Please wait...");sd("shb")}}

function ebl(l,e){
	if(!lso[l]){
		lso[l]=true;
		sd("l_"+l+"_ed","block");
		e.innerHTML=L("Close Edit");
		if(!ls[l]){
			rmp("gs.php?l="+l,eih,"l_"+l+"_ed");
			ls[l]=true
		}
	}
	else{
		lso[l]=z;
		sd("l_"+l+"_ed");
		e.innerHTML=L("Edit")
	}
}

function sst(l,n,v){if(ui){rmp("ss.php?l="+l+"&sn="+n+"&sv="+v,gl,l)}else{sc('l'+l+'['+n+']',v,es);gl(l)}}
function snr(l,n,v){if(ui){rmp("ss.php?l="+l+"&sn="+n+"&sv="+v)}else{sc('l'+l+'['+n+']',v,es)}}

function gl(l){rmp("gb.php?l="+l,eih,"l_"+l+"_c")}

function imp(r){eih("mypage",r);i=1;while(ge("s_"+i)){for(var j=0;j<ge("s_"+i).childNodes.length;j++){var k=ge("s_"+i).childNodes[j];if(k.id&&k.id!='l_101'){gl(k.id.substring(2));inl(k.id)}}i++}cn=i-1}
function inl(l){if(ge(l+"_h"))ge(l+"_h").onmousedown=function(ev){mbl(ev,this.id.substring(2,this.id.length-2))}}

function clg(a){sts("lang",a);location.reload();return z}
function sts(n,v){if(ui){rmp("so.php?sn="+n+"&sv="+v)}else{sc("t"+tl+"["+n+"]",v,es)}}
function sse(t){sts("seng",t)}


function asb(f,r){f.sbmt.disabled=z;if(r.indexOf("Error")!=-1){eih(f.msg.value,r.substring(6))}else eih("shb",r)}

function swm(){
	eih ("mypage","<center><br/>loading...</center>");
	if (gc("sbmd")){dc("sbmd");eih("hs","<a href='#' onClick='swm()'>Switch to Admin Mode</a>")}else{sc("sbmd","1");eih("hs","<a href='#' onClick='swm()'>Switch to User Mode</a>")}
	rmp("start.php?",imp);return z
}

function colresize(fo,sep){
	if(typeof fo=="undefined")fo=window.event;
	var lmx=fo.clientX;
	var l=ge("s_"+sep).width;
	l=parseInt(l.substring(0,l.length-1));
	var r=ge("s_"+(sep+1)).width;
	r=parseInt(r.substring(0,r.length-1));
	var t=l+r;
	document.onmousedown=function(fo){return z}
	document.onmousemove=function(fo){
		if(typeof fo=="undefined")fo=window.event;
		cpx=fo.clientX-lmx;
		ge("s_"+sep).width=(parseInt(ge("s_"+sep).offsetWidth)+cpx)+"px";
		ge("s_"+(sep+1)).width=(parseInt(ge("s_"+(sep+1)).offsetWidth)-cpx)+"px";
		lmx=fo.clientX;
		return z;
	}
	document.onmouseup=function(fo){if(typeof fo=="undefined")fo=window.event;var s=[];la=ge("s_"+sep).offsetWidth;ra=ge("s_"+(sep+1)).offsetWidth; if (fo.shiftKey){ge("s_"+sep).width=la+"px";ge("s_"+(sep+1)).width=ra+"px"}else{lp = Math.round((la*t)/(la+ra)); ge("s_"+sep).width=lp+"%";ge("s_"+(sep+1)).width=(t-lp)+"%";}for(var i=1;i<=cn;i++){s.push(ge("s_"+i).width)}sts("colw",s.join(":"));document.onmousedown=null;document.onmousemove=null;document.onmouseup=null}
}

function cmb(){if(!mb){mb=document.createElement("div");mb.style.display="none";mb.style.position="absolute";mb.style.backgroundColor="#ffffff";mb.style.cursor="move";document.body.appendChild(mb)}return mb}

var clmn=1;var rw=1;
function mbl(fo,l) {
	if(typeof fo=="undefined")fo=window.event;
	var lo=ge("l_"+l);
	var mo=cmb();
	mo.style.display="block";
	mo.style.left=(gof(lo,true)-7)+"px";
	mo.style.top=gof(lo,z)+"px";
	mo.style.height=(lo.offsetHeight-2)+"px";
	mo.style.width=(lo.offsetWidth-2)+"px";
	mo.style.filter="alpha(opacity=75)";
	mo.style.opacity=0.75;
	mo.style.border="1px solid #BADDF1";
	mo.style.zIndex="2";
	mo.innerHTML=lo.innerHTML;
	mo.className=lo.className;
	var lmx=fo.clientX;
	var lmy=fo.clientY;
	document.onmousedown=function(fo){return z}
	document.onmousemove=function(fo){
		if(typeof fo=="undefined")fo=window.event;
		cpx=fo.clientX+parseInt(cmb().style.left)-lmx;
		cpy=fo.clientY+parseInt(cmb().style.top)-lmy;
		cmb().style.left=cpx+"px";
		cmb().style.top=cpy+"px";
		lmx=fo.clientX;
		lmy=fo.clientY;
		da(lo,cpx+mo.offsetWidth/2,cpy);
		return z;
	}
	document.onmouseup=function(fo){document.onmousedown=null;document.onmousemove=null;cmb().style.display="none";slo();document.onmouseup=null}
}
function da(o,x,y){
	for(var i=1;i<=cn;i++){
		if(x>=gof(ge("s_"+i),true))clmn=i;
	}
	var rwo=ge("s_"+clmn).childNodes[ge("s_"+clmn).childNodes.length-1];
	for (sbi=ge("s_"+clmn).childNodes.length-1;sbi>=0;sbi--){
		var sb=ge("s_"+clmn).childNodes[sbi];
		if (sb==o){rh=true;continue}
		if (y<=gof(sb,z)){rwo=sb;rw=sbi}
	}
	if(rwo!=null)rwo.parentNode.insertBefore(o,rwo);
}
function slo(){
	var a=[];
	for (var i=1;i<=cn;i++){
		var b=[];
		for(var j=0;j<ge("s_"+i).childNodes.length;j++){var jo=ge("s_"+i).childNodes[j];if(jo.id)b.push(jo.id)}
		a.push(b.join(":"));
	}
	if(ui){rmp("so.php?sn=ord&sv="+a.join(","))}else{sc("t"+tl+'[ord]',a.join(","),es)}
}

function sfm(f,s,o){eih(f.msg.value,L("checking..."));f.sbmt.disabled=true;rmp(s,o,f)}
function amf(f,r){
	f.sbmt.disabled=z;
	if(r.indexOf("Error")!=-1){eih(f.msg.value,r.substring(6))}else{
		f.nf.value="";eih(f.msg.value,"feed added successfully");anl(r);gbl()
	}
}
function abl(i){rmp("af.php?b="+i,anl)}
function gbl(){rmp("mf.php?",eih,"ubs")}
function dbl(i){rmp("db.php?b="+i,gbl)}
function dlo(l){if (confirm(L("Are you sure you want to")+" "+L("close it?"))){rmp("dl.php?l="+l);sd("l_"+l)}}

function anl(r){
var b=r.indexOf("id=\"")+4;var i=r.substring(b,r.indexOf("\"",b));var l=document.createElement("div");l.id=i;l.className="loc";
if(ge("s_2").firstChild){ge("s_2").insertBefore(l,ge("s_2").firstChild)}else{ge("s_2").appendChild(l)}
eih (i,r.substring(r.indexOf(">")+1,r.lastIndexOf("</div>")));
slo();
inl(i);
}

function grp(f,r){if(r.indexOf("Error")!=-1){eih(f.msg.value,r.substring(6));f.sbmt.disabled=z}else{location.reload()}}
function ulo(){dac();location.reload()}
function exf(){dc("sbmd")}

function cht(l,t,f){if(f)f(t);for(var j=0;j<ge("tc_"+l).childNodes.length;j++){var jo=ge("tc_"+l).childNodes[j];var i=null;if(jo.id){i=jo.id;i=i.substring(0,i.lastIndexOf("_")+1)}if(i=="tc_"+l+"_t_"){jo.className="ptb"}if(i=="tc_"+l+"_c_"){jo.className="ptc"}}ge("tc_"+l+"_t_"+t).className="atb";ge("tc_"+l+"_c_"+t).className="atc";return false}

function abm(f,l){rmp("abm.php?u="+euc(f.bmu.value)+"&n="+euc(f.bmt.value)+"&g="+euc(f.bmg.value),gl,l)}
function dbm(b,l){if (confirm(L("Are you sure you want to")+" "+L("delete?"))){rmp("dbm.php?b="+b,gl,l)}return z}
function dbms(l){rmp("dbm.php?bms=all",gl,l);return z}
function dtg(tg,l){sst(l,'dtag','');rmp("dtg.php?tg="+tg,gl,l);return z} 
function ibm(f){f.sbmt.disabled=true;f.t.value=tl;return true}
function fib(l,r){var f=document.forms["f_"+l+"_i"];f.sbmt.disabled=z;if(r.indexOf("Error")!=-1){eih("f_"+l+"_msg",r.substring(6))}else{f.reset();gl(l)}}
function ied(i){
	ge(i).style.display="none";
	var l=document.createElement("input");
	sa(l,"type","text");sa(l,"value",ge(i).innerHTML);sa(l,"size",ge(i).innerHTML.length+2);
	ge(i).parentNode.insertBefore(l,ge(i));
	l.onkeyup=function(fo){
		if(typeof fo=="undefined")fo=window.event;
		sa(l,"size",l.value.length+2);
		if((fo.keyCode&&fo.keyCode==13)||(fo.which&&fo.which==13))l.blur();
	}
	l.onblur=function(fo){
		if(typeof fo=="undefined")fo=window.event;
		if (l.value.replace(/^\s*|\s*$/g,"")!=""){
			eih(i,l.value+" ");
			ge(i).parentNode.removeChild(l);
			sd(i,"inline");
			rmp("stg.php?tg="+i.substring(i.indexOf("_")+1,i.lastIndexOf("_l_"))+"&nm="+euc(l.value),sti,i)
		}
		else{l.focus()}
	}
	l.focus();
	l.select()
}
function sti(i,r){ge(i).id="t_"+r+"_l_"+i.substring(i.indexOf("_l_")+1)}

function ent(n){
	i="l_"+n+"_nc";
	ic="l_"+n+"_ncc";
	h=ge(i).offsetHeight;
	w=ge(i).offsetWidth;
	sd(i);
	var l=document.createElement("textarea");
	l.className="ntc";
	l.style.height=(h+5)+"px";
	l.style.width=(w-12)+"px";
	ge(i).parentNode.insertBefore(l,ge(i));
	var s=ge(ic).innerHTML;
	l.value=ge(ic).innerHTML.replace(/\n/gi,"").replace(/\&amp;/gi,"&").replace(/\&lt;/gi,"<").replace(/&gt;/gi,">").replace(/<br>/gi,"\n").replace(/<br\/>/gi,"\n").replace(/\&nbsp;/gi, " ");
	l.onkeyup = function(fo){
		if(typeof fo=="undefined")fo=window.event;
		ge(ic).innerHTML=l.value.replace(/\&/g,"&amp;").replace(/</gi,"&lt;").replace(/>/gi,"&gt;").replace(/\n/gi,"<br>").replace(/<br\/>/gi,"\n").replace(/  /gi,"&nbsp; ");
		sd(i,"block");
		l.style.height=(ge(i).offsetHeight+5)+"px";
		sd(i);
	}

	l.onblur=function(fo){
		if(typeof fo=="undefined")fo=window.event;
		if (l.value.replace(/^\s*|\s*$/g,"")!=""){
			eih(ic,l.value.replace(/\&/g, "&amp;").replace(/</gi, "&lt;").replace(/>/gi, "&gt;").replace(/\n/gi, "<br>").replace(/  /gi, "&nbsp; "));
			ge(i).parentNode.removeChild(l);
			sd(i,"block");
			if (ge(ic).innerHTML!=s)rmp("snt.php?l="+n+"&nt="+euc(ge(ic).innerHTML.replace(/\n/gi,"")));
		}
		else{l.focus()}
	}
	l.focus(0)
}
function L(s){return Mp.lang[s]?Mp.lang[s]:s}
