

varMSIE=(navigator.appName=="Microsoft Internet Explorer")? 1 : 0;
varVersion=navigator.appVersion.charAt(0);
viewX=0;
viewY=0;
adjPrefix=(varMSIE)? "document.all[" : ((varVersion>4) ?
	"document.getElementById(" : "document.layers");
adjSuffix=(varMSIE)? "]" : ((varVersion>4) ? ")" : "");

function CenterX(tmv){
	initView();
	return Math.ceil((viewX/2)-(tmv/2));
}

function CenterY(tmv){
	initView();
	return Math.ceil((viewY/2)-(tmv/2));
}

function initView(){
	viewX=(varMSIE)? document.body.clientWidth : window.innerWidth+5;
	viewY=(varMSIE)? document.body.clientHeight : window.innerHeight+5;
}

function layerControl(){
	var tms="";
	if(varMSIE || varVersion>4){
		tms=adjPrefix + "'" + (layerControl.arguments[layerControl.arguments.length-1]) + "'" + adjSuffix;
	}else{
		var RefLayerCC=0;
		while(RefLayerCC<layerControl.arguments.length){
			tms+=adjPrefix + "['" + layerControl.arguments[RefLayerCC] + "']";
			RefLayerCC++;
			tms+=(RefLayerCC!=layerControl.arguments.length) ? "." : adjSuffix;
		}
	}
	var lyrRef=eval(tms);

	this.object=lyrRef;
	this.style=(varMSIE || varVersion>4) ? lyrRef.style : lyrRef;
	this.resize=new Function("this.style.width=arguments[0];"
		+ "this.style.height=arguments[1]; if(!varMSIE && varVersion<5){"
		+ "this.object.clip.right=arguments[0];"
		+ "this.object.clip.bottom=arguments[1];}");

	this.move=new Function("this.style.top=arguments[1];" +
		"this.style.left=arguments[0];");

	this.write=new Function("if(varMSIE || varVersion>4){" +
		"this.object.innerHTML=arguments[0];" +
		"}else{" +
		"this.object.document.write(arguments[0]);" +
		"this.object.document.close();}");

	this.getTop=new Function("var tmv=this.style.top;" +
		"if(tmv==\"\") tmv=0; return parseInt(tmv);");

	this.getLeft=new Function("var tmv=this.style.left;" +
		"if(tmv==\"\") tmv=0; return parseInt(tmv);");

	this.getWidth=new Function("if(varMSIE || varVersion>4){" +
		"return parseInt(this.object.offsetWidth);"
		+ "}else{return parseInt(this.object.clip.width);}");

	this.getHeight=new Function("if(varMSIE || varVersion>4){" +
		"return parseInt(this.object.offsetHeight);"
		+ "}else{return parseInt(this.object.clip.height);}");

	this.getRight=new Function("return this.getLeft() + this.getWidth()");

	this.getBottom=new Function("return this.getTop() + this.getHeight()");

	this.moveBy=new Function("this.style.top=this.getTop() + arguments[1];" +
		"this.style.left=this.getLeft() + arguments[0];");

	this.resizeBy=new Function("var nX=this.getWidth() + arguments[0];" +
		"var nY=this.getHeight() + arguments[1];" +
		"this.resize(nX, nY);");

	this.switchImg=new Function("if(document.images){" +
		"var adjSwitchPrefix=(varMSIE || varVersion>4) ? document : " +
		"this.object.document;" +
		"adjSwitchPrefix.images[arguments[0]].src=eval(arguments[0] + \"_\"" +
		" + arguments[1] + \".src\");}");

	this.switch1Img=new Function("if(document.images){" +
		"var adjSwitchPrefix=(varMSIE || varVersion>4) ? document : " +
		"this.object.document;" +
		"adjSwitchPrefix.images[arguments[0]].src=eval(" +
		"arguments[1] + \".src\");}");

	this.visibility=new Function("this.style.visibility=arguments[0]");
}
