var ZesternLiblary = {
	Disable : function(){
		return false;
	},
	Block : function(ids){
		try{
		document.getElementById(ids).style.display = "block";
		}catch(e){}
	},
	None : function(ids){
		try{
		document.getElementById(ids).style.display = "none";
		}catch(e){}
	},
	ObjGet : function(event){
		var ObjGet = (ZesternLiblary.ChkBrowser("ms"))?event.srcElement:event.target;
		return ObjGet;
	},
	ObjAnz : function(event){
		var results;
		for(var t in event){
			var attr = eval("event."+t);
			results +=t+": "+attr+"<br/>";
		}
		return results;
	},
	AddEvent : function(Target,Ename,Func){
		var AddOpt = (ZesternLiblary.ChkBrowser("ms"))?"attachEvent":"addEventListener";
		var Ename = (ZesternLiblary.ChkBrowser("ms"))?Ename:Ename.replace("on","");
		var Func = (ZesternLiblary.ChkBrowser("ms"))?Func:Func+",true";
		return eval(Target+"."+AddOpt+"(\""+Ename+"\","+Func+");");
	},
	DelEvent : function(Target,Ename,Func){
		var AddOpt = (ZesternLiblary.ChkBrowser("ms"))?"detachEvent":"removeEventListener";
		var Ename = (ZesternLiblary.ChkBrowser("ms"))?Ename:Ename.replace("on","");
		var Func = (ZesternLiblary.ChkBrowser("ms"))?Func:Func+",true";
		return eval(Target+"."+AddOpt+"(\""+Ename+"\","+Func+");");
	},
	ChkBrowser : function(chk){
		var ChkBrw = navigator.userAgent;		
		if(chk == "opera"){
			var  Values= ChkBrw.indexOf("Opera","");
		} else if(chk == "safari"){
			var  Values= ChkBrw.indexOf("AppleWebKit/","");
		} else if(chk == "moz"){
			var  Values= ChkBrw.indexOf("Firefox","");
		} else if(chk == "ms"){
			var  Values= ChkBrw.indexOf("MSIE","");
		} else if(chk == "ms80"){
			var  Values= ChkBrw.indexOf("MSIE 8.0","");
		}
		return (Values != "-1")?true:false;
	},
	Alpha : function(target,opacitys){
		var target = document.getElementById(target);
		if (target.filters) {
			try {
				target.filters.item("DXImageTransform.Microsoft.Alpha").opacity = opacitys;
			} catch (e) {
				target.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=" + opacitys + ")";
			}
		} else {
			target.style.opacity = opacitys / 100;
		}	
	},
	FadeFunc : function(){
		var reduceOpacityBy = 8;
		var rate = 10;	
		if (opct < 100) {
			opct += reduceOpacityBy;
			ZesternLiblary.Alpha(layer,opct);
			roofs = setTimeout(ZesternLiblary.FadeFunc, rate);
		} else {
			clearTimeout(roofs);
			ZesternLiblary.Alpha(layer,"100");
			opct = 5;
		}
	},
	NoneActive : function(target,func){
		var target = document.getElementById(target);
		var disp = (func == "not")?"block":"none";
		var wid = (func == "not")?"100%":"0px";
		target.style.display = disp;
		ZesternLiblary.Alpha("NoneActive","40");
		target.style.width = wid;
		if(Zestern.ChkTrans() == true){
			target.style.padding = "100% 0";
		} else {
			target.style.height = "100%";
		}
	},
	MakeVar : function(val,value){
		return eval(val+"=\""+value+"\";");
	},
	PriceNum : function(num){
		var num = num;
		var Rz = '';
		var Rs = '';
		var Rc = 0;
		num = parseInt(num);
		var Rh = (num < 0) ? 1 : 0;
		num += '';
		var Orglength = num.length;
		for(i = Orglength; i >= 0 ; i--) {
			Rz = num.charAt(i);
			Rs = Rz + Rs;
			if(Rc % 3 == 0 && i > Rh && i < Orglength) {
				Rs = ',' + Rs;}Rc++;
		}
		var Rs = (num != "NaN")?Rs:"";
		return Rs;
	},
	OnlyNum : function(num,target,type){
			if(!type){
				var basic = num.replace(/[^0-9]/gi,"");		
			} else {
				var basic = num.replace(/[^0-9.]/gi,"");
				if(basic){
					var basic = (basic <= 100)?basic:"0.1";
				}
			}
			if(target){
			target.value = basic;
		} else {
			return basic;
		}
	},
	NotHan : function(cont){
		var basic = cont.replace(/[^a-zA-Z0-9]/gi,"");
		return basic;
	}, 
	Togle : function(event,incont,cls){
		var Lay = document.getElementById("TogleBox");
		Lay.style.display = "block";
		Lay.className = cls;
		var BagicX = document.body.clientWidth;
		var BagicY = document.getElementById("Height100Per").offsetHeight;
		var ScrollChk = document.documentElement.scrollTop;
		var LayX = 1*(event.clientX-3);
		var LayY = 1*(event.clientY+8+ScrollChk);
        var LayWidth = Lay.clientWidth;
 		var LayHeight = Lay.clientHeight;
		var CompX = LayX+LayWidth;
		var CompY = LayY+LayHeight-ScrollChk;
		var PosX = (CompX < BagicX)?LayX+5-260:LayX-LayWidth-260;	
		var PosY = (CompY < BagicY)?LayY:LayY-LayHeight-23;	
		var PosX = (PosX < 0)?"0":PosX;
		var PosY = (PosY < 0)?"0":PosY;
		Lay.style.top = PosY+"px";
		Lay.style.left = PosX+"px";
		Lay.innerHTML = document.getElementById(incont).innerHTML;
	}
}
var idschk;
var delimgborder;
var AceC = {
	MakeDiv : function(event, ids, filename, width, height){
		var ThisPoint = ZesternLiblary.ObjGet(event).parentNode;
		var chk = ThisPoint.getElementsByTagName("DIV");
		var imgtarget = ThisPoint.getElementsByTagName("IMG");
		if(idschk != ids){
			try{AceC.DelDiv();}catch(e){}
		}
		if(!chk[0]){
			var MyDiv = document.createElement("DIV");	
			var MyDivs = document.createElement("DIV");	
			var MyDivss = document.createElement("DIV");	
			
			var MyDivTop = document.createElement("DIV");	
			var MyDivRight = document.createElement("DIV");	
			var MyDivBottom = document.createElement("DIV");	
			var MyDivLeft = document.createElement("DIV");	
			ThisPoint.appendChild(MyDiv);
			MyDiv.setAttribute("id", "MouseArea");
			MyDiv.style.position = "absolute";
			MyDiv.style.top = "-51px";
			MyDiv.style.left = "70px";
			MyDiv.style.padding = "50px";
			MyDiv.style.textAlign = "left";
			MyDiv.style.width = 1*width+100+"px";
			MyDiv.style.height = 1*height+100+"px";
			
			MyDiv.appendChild(MyDivs);
			MyDivs.style.position = "relative";
			MyDivs.style.width = "100%";
			MyDivs.style.height = "100%";

			MyDivs.appendChild(MyDivss);
			MyDivss.setAttribute("id", "InnerCont");
			MyDivss.style.position = "relative";
			MyDivss.style.background = "#fff";
			MyDivss.style.width = width+"px";
			MyDivss.style.height = height+"px";
			MyDivss.style.overflow = "auto";
			MyDivss.style.border = "4px solid #ed1e27";
			imgtarget[0].style.border = "3px solid #ed1e27";
			delimgborder = imgtarget[0];

			MyDivs.appendChild(MyDivTop);
			MyDivTop.setAttribute("id", "EventTop");
			MyDivTop.style.position = "absolute";
			MyDivTop.style.top = "-50px";
			MyDivTop.style.left = "-50px";
			MyDivTop.style.width = "125%";
			MyDivTop.style.height = "50px";

			MyDivs.appendChild(MyDivRight);
			MyDivRight.setAttribute("id", "EventRight");
			MyDivRight.style.position = "absolute";
			MyDivRight.style.top = "-50px";
			MyDivRight.style.right = "-50px";
			MyDivRight.style.width = "50px";
			MyDivRight.style.height = "155%";

			MyDivs.appendChild(MyDivBottom);
			MyDivBottom.setAttribute("id", "EventBottom");
			MyDivBottom.style.position = "absolute";
			MyDivBottom.style.bottom = "-50px";
			MyDivBottom.style.left = "-50px";
			MyDivBottom.style.width = "125%";
			MyDivBottom.style.height = "50px";
			
			MyDivs.appendChild(MyDivLeft);
			MyDivLeft.setAttribute("id", "EventLeft");
			MyDivLeft.style.position = "absolute";
			MyDivLeft.style.top = "-50px";
			MyDivLeft.style.left = "-50px";
			MyDivLeft.style.width = "50px";
			MyDivLeft.style.height = "155%";

			ZesternLiblary.AddEvent("InnerCont","onmouseover","AceC.DelMethod");	
			this.InnerAjax(filename);
			idschk = ids;
		}
	},
	DelMethod : function(){
	 ZesternLiblary.AddEvent("EventTop","onmouseover","AceC.DelDiv");
	 ZesternLiblary.AddEvent("EventRight","onmouseover","AceC.DelDiv");
	 ZesternLiblary.AddEvent("EventBottom","onmouseover","AceC.DelDiv");
	 ZesternLiblary.AddEvent("EventLeft","onmouseover","AceC.DelDiv");
	},
	DelDiv : function(){
		delimgborder.style.border = "none"; 
		document.getElementById("MouseArea").removeNode(true);
	},
	InnerAjax : function(filename){
		sendRequest(this.ActAjax,"&modules=","POST",filename,true,true); 
	},
	ActAjax : function(object){
		var Cont = object.responseText;
		document.getElementById("InnerCont").innerHTML = Cont;
	}
}

function chkAjaBrowser(){
	var a,ua = navigator.userAgent;
	this.bw= { 
	  safari    : ((a=ua.split('AppleWebKit/')[1])?a.split('(')[0]:0)>=124 ,
	  konqueror : ((a=ua.split('Konqueror/')[1])?a.split(';')[0]:0)>=3.3 ,
	  mozes     : ((a=ua.split('Gecko/')[1])?a.split(" ")[0]:0) >= 20011128 ,
	  opera     : (!!window.opera) && ((typeof XMLHttpRequest)=='function') ,
	  msie      : (!!window.ActiveXObject)?(!!createHttpRequest()):false 
	}
	return (this.bw.safari||this.bw.konqueror||this.bw.mozes||this.bw.opera||this.bw.msie)
}
function createHttpRequest(){
	if(window.ActiveXObject){
		try {
			return new ActiveXObject("Msxml2.XMLHTTP") ;
		} catch (e) {
			try {
				return new ActiveXObject("Microsoft.XMLHTTP") ;
			} catch (e2) {
				return null ;
			}
		}
	} else if(window.XMLHttpRequest){
		return new XMLHttpRequest() ;
	} else {
		return null ;
	}
}
function sendRequest(callback,data,method,url,async,sload,user,password){
	var oj = createHttpRequest();
	if( oj == null ) return null;
	var sload = (!!sendRequest.arguments[5])?sload:false;
	if(sload || method.toUpperCase() == 'GET')url += "?";
	if(sload)url=url+"t="+(new Date()).getTime();
	
	var bwoj = new chkAjaBrowser();
	var opera	  = bwoj.bw.opera;
	var safari	  = bwoj.bw.safari;
	var konqueror = bwoj.bw.konqueror;
	var mozes	  = bwoj.bw.mozes ;
	if(opera || safari || mozes){
		oj.onload = function () { callback(oj); }
	} else {
	
		oj.onreadystatechange =function () 
		{
			if ( oj.readyState == 4 ){
				callback(oj);
			}
		}
	}
	data = uriEncode(data)
	if(method.toUpperCase() == 'GET') {
		url += data
	}
	oj.open(method,url,async,user,password);
	setEncHeader(oj)
	oj.send(data);
	function setEncHeader(oj){
		var contentTypeUrlenc = 'application/x-www-form-urlencoded; charset=UTF-8';
		if(!window.opera){
			oj.setRequestHeader('Content-Type',contentTypeUrlenc);
		} else {
			if((typeof oj.setRequestHeader) == 'function')
				oj.setRequestHeader('Content-Type',contentTypeUrlenc);
		}	
		return oj
	}
	function uriEncode(data){
		if(data!=""){
			var encdata = '';
			var datas = data.split('&');
			for(i=1;i<datas.length;i++)
			{
				var dataq = datas[i].split('=');
				encdata += '&'+encodeURIComponent(dataq[0])+'='+encodeURIComponent(dataq[1]);
			}
		} else {
			encdata = "";
		}
		return encdata;
	}
	return oj
}
function fadeBgclGry(id){
  var div    = "document.getElementById('"+id+"')";
  var count  = 0;
  var tid    = 0;
  this.doBgFade   = function (f){
    count  = 0;
    clearInterval(tid);
    tid = setInterval( function(){fade(f)} ,30);
  }
  function fade(f){ 
    if(!f)var f = "3456789abcdef";
    if(count < f.length){ 
      var b = f.charAt(count);
      setBgcolor( '#'+b+b+b+b+b+b );
      count++;
    } else {
      clearInterval(tid);
    }
  } 
  function setBgcolor(color){
    if(document.getElementById) 
      eval(div).style.backgroundColor =color
  }
}
function fadeOpacity(layName,swt,stopOpacity){
  if(!window.fadeOpacity[layName])
    fadeOpacity[layName] =0 
  if(!arguments[1]) swt = -1
   if(swt==-1)        var f  = "9876543210"
  else if(swt==1)    var f  = "0123456789"
  else               var f  = "9876543210"
   if(!arguments[2] && swt==-1)   stopOpacity = 0
  else if(!arguments[2] && swt==1) stopOpacity = 10
  if( fadeOpacity[layName] < f.length-1 ){
      var opa = f.charAt(fadeOpacity[layName])/10
    if( opa == stopOpacity ){
      setOpacity(layName,stopOpacity) 
      fadeOpacity[layName] = 0  
      return
    }
    setOpacity(layName,opa)
    fadeOpacity[layName]++
    setTimeout('fadeOpacity("'+layName+'","'+swt+'","'+stopOpacity+'")',30)
  } else {
    setOpacity(layName,stopOpacity)
    fadeOpacity[layName] = 0
  }
}
function setOpacity(layName,arg) {
  if(window.opera)return
  var ua = navigator.userAgent
  if(ua.indexOf('Safari') !=-1 || ua.indexOf('KHTML') !=-1 ) { 
      document.getElementById(layName).style.opacity = arg
  } else if(document.all) {          //win-e4,win-e5,win-e6
      document.all(layName).style.filter="alpha(opacity=0)"
      document.all(layName).filters.alpha.Opacity  = (arg * 100)
  } else if(ua.indexOf('Gecko')!=-1) //n6,n7,m1
      document.getElementById(layName).style.MozOpacity = arg
}