var x_hint,y_hint,pageW_hint,pageH_hint,fl_hide=0,x,y,el,pageW,pageH,fl_form;
var fst_srch_focused = true;
function y1(){}function pme(){}
function urlencode(aS){
	aS=aS.replace(/\%/g,'%25');
	aS=aS.replace(/\&/g,'%26');
	aS=aS.replace(/\?/g,'%3F');
	aS=aS.replace(/\=/g,'%3D');
	aS=aS.replace(/\#/g,'%23');
	aS=aS.replace(/\+/g,'%2B');

	aS=aS.replace(/à/g,'%E0');
	aS=aS.replace(/á/g,'%E1');
	aS=aS.replace(/â/g,'%E2');
	aS=aS.replace(/ã/g,'%E3');
	aS=aS.replace(/ä/g,'%E4');
	aS=aS.replace(/å/g,'%E5');
	aS=aS.replace(/æ/g,'%E6');
	aS=aS.replace(/ç/g,'%E7');
	aS=aS.replace(/è/g,'%E8');
	aS=aS.replace(/é/g,'%E9');
	aS=aS.replace(/ê/g,'%EA');
	aS=aS.replace(/ë/g,'%EB');
	aS=aS.replace(/ì/g,'%EC');
	aS=aS.replace(/í/g,'%ED');
	aS=aS.replace(/î/g,'%EE');
	aS=aS.replace(/ï/g,'%EF');
	aS=aS.replace(/ð/g,'%F0');
	aS=aS.replace(/ñ/g,'%F1');
	aS=aS.replace(/ò/g,'%F2');
	aS=aS.replace(/ó/g,'%F3');
	aS=aS.replace(/ô/g,'%F4');
	aS=aS.replace(/õ/g,'%F5');
	aS=aS.replace(/ö/g,'%F6');
	aS=aS.replace(/÷/g,'%F7');
	aS=aS.replace(/ø/g,'%F8');
	aS=aS.replace(/ù/g,'%F9');
	aS=aS.replace(/ú/g,'%FA');
	aS=aS.replace(/ü/g,'%FC');
	aS=aS.replace(/þ/g,'%FE');
	aS=aS.replace(/ÿ/g,'%FF');
	
	aS=aS.replace(/À/g,'%C0');
	aS=aS.replace(/Á/g,'%C1');
	aS=aS.replace(/Â/g,'%C2');
	aS=aS.replace(/Ã/g,'%C3');
	aS=aS.replace(/Ä/g,'%C4');
	aS=aS.replace(/Å/g,'%C5');
	aS=aS.replace(/Æ/g,'%C6');
	aS=aS.replace(/Ç/g,'%C7');
	aS=aS.replace(/È/g,'%C8');
	aS=aS.replace(/É/g,'%C9');
	aS=aS.replace(/Ê/g,'%CA');
	aS=aS.replace(/Ë/g,'%CB');
	aS=aS.replace(/Ì/g,'%CC');
	aS=aS.replace(/Í/g,'%CD');
	aS=aS.replace(/Î/g,'%CE');
	aS=aS.replace(/Ï/g,'%CF');
	aS=aS.replace(/Ð/g,'%D0');
	aS=aS.replace(/Ñ/g,'%D1');
	aS=aS.replace(/Ò/g,'%D2');
	aS=aS.replace(/Ó/g,'%D3');
	aS=aS.replace(/Ô/g,'%D4');
	aS=aS.replace(/Õ/g,'%D5');
	aS=aS.replace(/Ö/g,'%D6');
	aS=aS.replace(/×/g,'%D7');
	aS=aS.replace(/Ø/g,'%D8');
	aS=aS.replace(/Ù/g,'%D9');
	aS=aS.replace(/Ú/g,'%DA');
	aS=aS.replace(/Ü/g,'%DC');
	aS=aS.replace(/Þ/g,'%DE');
	aS=aS.replace(/ß/g,'%DF');
	return aS;
}

function trim(aS) {
	return aS.replace(/^\s+|\s+$/g,"");
}
function htmldecode(aS){
	aS=aS.replace(/\&amp;/g,'&');
	aS=aS.replace(/\&lt;/g,'<');
	aS=aS.replace(/\&gt;/g,'>');
	aS=aS.replace(/\&\#039;/g,'\'');
	return aS;
}
function htmlencode(aS){
	aS=aS.replace(/\&/g,'&amp;');
	aS=aS.replace(/</g,'&lt;');
	aS=aS.replace(/>/g,'&gt;');
	aS=aS.replace(/\'/g,'&\#039;');
	return aS;
}
function $(aI){
	return document.getElementById(aI);
}
function gn(el,i){
	return el.childNodes[i].innerHTML;
}
function sn(el,i,s){
	el.childNodes[i].innerHTML=s;
}
function sde(b){
	document.documentElement.onkeydown=b;
}
function ar(u,c){
	ar_ex(u,c,1);
}
function ar_ex(u,c,async){
  if(window.XMLHttpRequest)
		req=new XMLHttpRequest();
	else if(window.ActiveXObject)
		req=new ActiveXObject("Microsoft.XMLHTTP");
	if(req){
		if(!c && async){
			var hF=ac(req);
			req.onreadystatechange=hF;
		}
		req.open("GET",u,async);
		req.send(null);
		if(!async)
		  acSync(req);
	}	
}
function ar_post(u, p){//example: ar_post('proc_dial_req.php', 'p=678&param1=val1&param2=val2');
  if(window.XMLHttpRequest)
		req=new XMLHttpRequest();
	else if(window.ActiveXObject)
		req=new ActiveXObject("Microsoft.XMLHTTP");
	if(req){
		var hF=ac(req);
		req.onreadystatechange=hF;
		req.open("POST", u, true);
		req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		req.setRequestHeader("Content-length", p.length);
		req.setRequestHeader("Connection", "close");
		req.send(p);
	}
}
function gt(s,t,ct){
	r='';
	s11=s.indexOf(t);
	if(s11>-1)
		r=s.substring(s11+t.length,s.indexOf(ct));
	return r;	
}
function ac(req){
		return function(){
		if(req.readyState==4){
			if(req.status==200){
				ra=req.responseText;
				//alert(ra);
				var id;
				id=gt(ra,'{i}','{/i}');
				h=gt(ra,'{h}','{/h}');
				sc=gt(ra,'{s}','{/s}');
				ea=$(id);
				if(ea)
					ea.innerHTML=h;
				if(sc!='')
					eval(sc);
			}
		}
	}
}
function acSync(req){
		if(req.readyState==4){
			if(req.status==200){
				ra=req.responseText;
				//alert('acSync: '+ra);
				var id;
				id=gt(ra,'{i}','{/i}');
				h=gt(ra,'{h}','{/h}');
				sc=gt(ra,'{s}','{/s}');
				ea=$(id);
				if(ea)
					ea.innerHTML=h;
				if(sc!='')
					eval(sc);
			}
		}
	}
function posCm(aI,aH){
	var r=aH;
	v=$(aI);
	if(v){
		r=r.replace(/&amp;/g, '&');
		v.innerHTML=r;
		var loc_y=y;
		if((x+parseInt(v.offsetWidth))>=pageW)
			x=x-parseInt(v.offsetWidth);
		if((loc_y+parseInt(v.offsetHeight))>=pageH)
			loc_y=loc_y-parseInt(v.offsetHeight);
		if(loc_y<parseInt(v.offsetHeight))
			loc_y=y;
		loc_y=loc_y+document.body.scrollTop;
		x=x+document.body.scrollLeft;
		el.style.top=loc_y+"px";
		el.style.left=x+"px";
		v.style.visibility='visible';
	}
}
function posHint(aI,aH){
	var r=aH;
	v=$(aI);
	if(v){
		v.style.width=650;
		r=r.replace(/&amp;/g,'&');
		if(r!=''){
			v.innerHTML=r;
			var loc_y=y_hint;
			var loc_x=x_hint;
			pageW_hint=pageW_hint-22;
			pageH_hint=pageH_hint-22;
			if((loc_x+parseInt(v.offsetWidth))>=pageW_hint)
				loc_x=loc_x-parseInt(v.offsetWidth)-12;
			if(loc_x<0){
				loc_x=x_hint+12;v.style.width=pageW_hint-10-loc_x;
			}
			if(loc_y<parseInt(v.offsetHeight))
				loc_y=y_hint+5;
			if(((loc_y+parseInt(v.offsetHeight))>=pageH_hint)&&(loc_y==y_hint))
				loc_y=loc_y-parseInt(v.offsetHeight)-5;
			if(loc_x==x_hint)
				loc_x=loc_x+12;
			if(loc_y==y_hint)
				loc_y=loc_y+5;
			loc_y=loc_y+document.body.scrollTop;
			loc_x=loc_x+document.body.scrollLeft;
			v.style.top=loc_y+"px";
			v.style.left=loc_x+"px";
			if(!fl_hide==1)
				v.style.visibility='visible';
		}
	}
}
function asKd(aT){
	switch (aT)
	{
		case 1: document.documentElement.onkeydown=ldef_keydown;break;
		case 2: document.documentElement.onkeydown=srch_keydown;break;
	}
}
function ged(aUid,aDi){
	ar('proc_req.php?p=50&i='+aUid+'&b='+aDi);
}

var srch_text = "";
function show_fast_srch_list(e) {
	if(window.event) 
	  	k=event.keyCode;
	else if(e.which) 
	  	k=e.which;
	if(k == 38 || k == 40 || k == 13 || k == 27) {
		return true;
	}
	srch_text = $('fast_srch').value;
	if(srch_text == "") {
		$('fast_srch_list').style.visibility = "hidden";
		$('fast_srch').style.borderBottom = "solid 1px #DEDEDE";		
	} else {
		ar("proc_dial_req.php?p=24&text=" + urlencode(srch_text));
	}
}

function show_help() {
	window.open('Help/Index.html','ÀïèñWEB','location=yes,directories=yes,menubar=yes,toolbar=yes,width=900,height=820,resizable=yes,scrollbars=yes');
}

function isLaterDate(startD, endD){
	if(startD != endD){
		stratD_arr = startD.split(".");
		endD_arr = endD.split(".");
		if (stratD_arr[2] > endD_arr[2]) {
			return true;
		} else if (stratD_arr[1] > endD_arr[1]) {
			return true;
		} else if (stratD_arr[0] > endD_arr[0]) {
			return true;
		}
	}
	return false;
}
function enChar(s){
	r='';t='';q='';
	for (i=0;i<s.length;i++)
	{
		t=s.charCodeAt(i);
		if(t<=15){q='0';}else{q='';}
		r += q+(t).toString(16);
	}
	return r;
}

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function ShowSBhint(event, nm, show)
{
	v=$(nm);
	if(v)
	{
		pageW_hint=document.body.offsetWidth;
		x_hint=event.clientX;
		var loc_x=x_hint;
		pageW_hint=pageW_hint-22;
		if((loc_x+parseInt(v.offsetWidth))>=pageW_hint)
			loc_x=loc_x-parseInt(v.offsetWidth)-12;
		if(loc_x<0){
			loc_x=x_hint+12;v.style.width=pageW_hint-10-loc_x;
		}
		if(loc_x==x_hint)
			loc_x=loc_x+12;
		loc_x=loc_x+document.body.scrollLeft;
		loc_x = loc_x+30;
		v.style.top="-26px";
		v.style.left=loc_x+"px";
				
		if(show == 1)
			v.style.visibility='visible';	
		else
			v.style.visibility='hidden';		
	}
}
function zxcPos(zxc, scrollBase){
zxcObjLeft = zxc.offsetLeft;
zxcObjTop = zxc.offsetTop;
while(zxc!=null && zxc.offsetParent!=null && zxc.offsetParent.id != scrollBase){	
zxcObjParent=zxc.offsetParent;
zxc=zxcObjParent;
zxcObjLeft+=zxcObjParent.offsetLeft;
zxcObjTop+=zxcObjParent.offsetTop;
}
return [zxcObjLeft,zxcObjTop];
}
function divScrollTop(id, scrollBase){
var objf=$(id);
var objS=$(scrollBase);
objS.scrollTop = zxcPos(objf, scrollBase)[1];
}
function changeLG(elemId) {
	if ($(elemId)) {
		if (elemId == 'lgbg') {
			$(elemId).style.color = "#F68D22";
			$('lgen').style.color = "#807E7C";
			lg = 'BG';
		} else if (elemId == 'lgen') {
			$(elemId).style.color = "#F68D22";
			$('lgbg').style.color = "#807E7C";
			lg = 'EN';
		}
		ar('proc_req.php?p=52&lg=' + lg);
	}
}