
function pageLoad(){
	chM();
}

function chM(){
	var str="";
	var m="";
	var z="109-97-105-108-116-111-58";
	for(i=0;i<document.getElementsByTagName("a").length;i++){
		if((document.getElementsByTagName("a")[i].href) &&
			(document.getElementsByTagName("a")[i].href.search("ml=")>=0)){
			m=document.getElementsByTagName("a")[i].href.substr(document.getElementsByTagName("a")[i].href.search("ml=")+3);
			eval("str=String.fromCharCode("+z.split("-")+")");
			document.getElementsByTagName("a")[i].href=str;
			eval("str=String.fromCharCode("+m.split("-")+")");
			document.getElementsByTagName("a")[i].href+=str;
			if(trim(document.getElementsByTagName("a")[i].innerHTML).length==0)
				document.getElementsByTagName("a")[i].innerHTML=str;
		}
	}
}

function crM(src, dest){
	var str=""
	for(j=0;j<getObj(src).value.length;j++){
		str += getObj(src).value.charCodeAt(j)
		if((j+1) != getObj(src).value.length)
			str+="-";
	}
	getObj(dest).value=str
}

function popUp(u, w, h, tit){ 
	if(!tit)
		tit='Agmor'
	var l=0
	var t=0
	try{
		l=(window.screen.availWidth-w)/2; 
		t=(window.screen.availHeight-h)/2;
	}catch(e){}
	page="<html><head><title>"+tit+"</title></head><body style=\"margin: 0; padding: 0;\">"+
		 "<img src=\""+u+"\" style=\"cursor:pointer;display: block;\" onclick=\"window.close();\" alt=\"\" /></body></html>"; 
	p = window.open("","","width="+w+",height="+h+",left="+l+",top="+t+",resizable=no"); void(0); 
	p.document.open(); 
	p.document.write(page); 
	p.document.close(); 
	p.focus(); 
} 

function trim(str){
	return str.replace(/^\s*|\s*$/g,"");
}

function SP(obj, val){
	if(obj != null)
		if(val == 1)
			obj.style.border = "2px solid #81898F";
		else
			obj.style.border = "2px solid #f0f0f0";
}

function textCounter(field,cntfield,maxlimit) {
	var lCnt = getObj(cntfield)
	if(lCnt != null){
		if (field.innerHTML.length > maxlimit) 
			field.innerHTML = field.innerHTML.substring(0, maxlimit);
		else
			lCnt.innerHTML = maxlimit - field.innerHTML.length;
    }
}


function getObj(id){
	ret=null;
	try{
		ret=document.getElementById(id);
	}catch(e){}
	return ret;
}

	function urlParamAdd(page,param){
		if(param){
			if(page.indexOf('?')>=0)
				return page+'&'+param
			else
				return page+'?'+param
		}
		return page
	}
	
	
	function popup(mylink, windowname, simple, w, h){
		var resize = true
		if (!window.focus)
			return true
		var href
		if (typeof(mylink) == 'string')
			href=mylink
		else
			href=mylink.href
		if(w == null)
			w = 900
		if(h == null)
			h = 500
		else
			resize = false
		var l = (window.screen.Width - w)/2
		var t = (window.screen.Height - h)/4
		var p=",left="+l+",top="+t+",screenX="+l+",screenY="+t
		if(resize)
			h = 10
		if(simple)
			win=window.open(href, windowname, 'menubar=no, toolbar=no, location=no, scrollbars=yes, resizable=yes, status=no,width='+w+',height='+h+p)
		else
			win=window.open(href, windowname, 'menubar=yes, toolbar=yes, location=yes, scrollbars=yes, resizable=yes, status=yes,width='+w+',height='+h+p)
		return win
	}

function calOpen(fd, sh){
	var appPath = '/HomePage/'
	var page = urlParamAdd(urlParamAdd(urlParamAdd(appPath+'comm/cal.aspx','val='+getObj(fd).value),'fd='+fd),(sh)?'short=1':'')
	popup(page,'',200,100)
}

/*calendar*/

function y2k(number)    { return (number < 1000) ? number + 1900 : number; }
var today = new Date();
var day   = today.getDate();
var month = today.getMonth();
var year  = y2k(today.getYear());
var curfield = 1;
var fd = null;

function padout(number) { return (number < 10) ? '0' + number : number; }
function restart() {
    if (curfield == 1)
      getObj(fd).value = '' + year + '-' + padout(month - 0 + 1) + '-' + padout(day);
    else
      document.JobSearch.termin_do.value = '' + year + '-' + padout(month - 0 + 1) + '-' + padout(day);
    mywindow.close();
}
function newWindowDepart(val) {
	fd = val.id.substring(0, val.id.length - 3)
    curfield = 1;
    mywindow=open('/HomePage/Common/Cal.html','myname','resizable=no,width=180,height=180, left=500, top=100');
    if (mywindow.opener == null) mywindow.opener = self;
    mywindow.focus();
}
function newWindowReturn() {
    curfield = 2;
    mywindow=open('/HomePage/Common/Cal.html','myname','resizable=no,width=180,height=180,left=100, top=100');
    if (mywindow.opener == null) mywindow.opener = self;
    mywindow.focus();
}

function ShowBanner(){
	var ban = '';
	ban += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="760" height="93" VIEWASTEXT><param name="movie" value="/HomePage/Images/header.swf" /><param name="quality" value="high" />';
	ban += '<embed src="/HomePage/Images/header.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="760" height="93"></embed></object>';
	document.write(ban);
}
