window.onload = addLoder;
window.onresize = addLoder;

function addLoder(){
	positionWrap();
	return;
}

function positionWrap(){
	if (!document.getElementById) return false;
	if (!document.getElementById('wrapper')) return false;
	obj = document.getElementById("wrapper");			

	bodyW  = parseInt(document.body.clientWidth);
	bodyH = parseInt(document.body.clientHeight);
	objW = parseInt(obj.clientWidth);
	objH = parseInt(obj.clientHeight);
	
	obj.style.marginLeft = (bodyW < objW) ? "0px" : (-1 * (objW / 2)) + "px" ;
	obj.style.left = (bodyW < objW) ? "0px" : "50%" ;
	obj.style.marginTop = (bodyH < objH) ? "0px" : (-1 * (objH / 2)) + "px" ;
	obj.style.top = (bodyH < objH) ? "0px" : "50%" ;
}

function show_layer(elem){
	if (!document.getElementById) return false;
	if (!document.getElementById(elem)) return false;
	this.obj = document.getElementById(elem);
	this.obj.style.display = '';
	this.obj.W = this.obj.offsetWidth;
	this.obj.H = this.obj.offsetHeight;
	this.obj.style.left = '50%';
	this.obj.style.top = '50%';
	this.obj.style.marginLeft = -1 * parseInt(this.obj.W / 2) + 'px';
	this.obj.style.marginTop = -1 * parseInt(this.obj.H / 2) + 'px';

}