jslt.OverPage=function (){
	this.outenerLayerId="outenerOverPageDiv"
	this.innerBackgroundLayerId="OverPageDiv"
	this.layerId="contentOverPageDiv"
	this.getLayer=function(opacity,params){
		if(!params){
			params={}
		}
		if(jslt.overPageInstance){//console.log(jslt.overPageInstance)
			document.getElementById(this.outenerLayerId).style.display="block"
			document.getElementById(this.innerBackgroundLayerId).style.display="block"
			var div=document.getElementById(this.layerId)
			div.style.display="block"
			return div
		}else{
			jslt.overPageInstance=this
		}
		var outener=document.createElement("div")
		outener.style.position="absolute"
		outener.style.top="0px"
		outener.style.left="0px"
		outener.style.zIndex=1001
		outener.id=this.outenerLayerId
		document.body.appendChild(outener)
		var background=document.createElement("div")
		background.style.position="fixed"
		background.style.top="0px"
		background.style.left="0px"
		background.id=this.innerBackgroundLayerId
		outener.appendChild(background)
		if(typeof(opacity)!="undefined"){
			background.style.filter = "alpha(opacity:"+Math.round(opacity*100)+")";
     		 background.style.opacity =opacity;
			 if(params.backgroundColor){
			 	background.style.backgroundColor=params.backgroundColor
			 }else{
			 	background.style.backgroundColor="#cccccc"
			 }
		}
		var div=document.createElement("div")
		div.style.position="absolute"
		div.style.top="0px"
		div.style.left="0px"
		div.id=this.layerId
		outener.appendChild(div)
		return div
	}
	this.setCenter=function(){
		var setCenterActions=function(){
			var cen=new jslt.FullSize()
			cen.setSize2(jslt.overPageInstance.outenerLayerId,true)
			cen.setSize(jslt.overPageInstance.innerBackgroundLayerId,true)
			cen.setSize(jslt.overPageInstance.layerId,true)
			}
		setCenterActions()
		window.onresize=setCenterActions;
	}
	this.hide=function(){
		document.getElementById(this.outenerLayerId).style.display="none"
		document.getElementById(this.innerBackgroundLayerId).style.display="none"
		document.getElementById(this.layerId).style.display="none"
		document.getElementById(this.layerId).innerHTML=""
	}
	this.show=function(){
		document.getElementById(this.outenerLayerId).style.display="block"
		document.getElementById(this.innerBackgroundLayerId).style.display="block"
		document.getElementById(this.layerId).style.display="block"
	}
	this.centerContent=function(objRef,objSizeA){
			var bodyEl=new jslt.Element(document.body)
			var viewSize=bodyEl.getRequiredSize()
			var divEl=new jslt.Element(jslt.overPageInstance.outenerLayerId)
			viewSize[1]=divEl.getViewHeight()
			var thisPosition=[parseInt((viewSize[0]-objSizeA[0])/2),Math.max(0,parseInt((viewSize[1]-objSizeA[1])/2))]
			objRef.style.left=thisPosition[0]+"px"
			objRef.style.top=thisPosition[1]+"px"
	}
}
