var DIVcont='DIVcontainer'

function InitPage(){
	CheckBW();
	DeclareData();
	CenterParent(DIVcont);
}

function DeclareData(){
	d=document;
	w=window;

	oLay=new Object();
	window.onresize=RefreshPage;
}

function CheckBW(){
	NS=(document.layers)?true:false;
	DOM=(document.getElementById)?true:false;
	IE=(document.all)?true:false;
}

function GetLay(){
	//returns the layer object
	var o,a=GetLay.arguments[0];
	if (NS){o=d.layers[a];} else if (IE&&!DOM){o=d.all[a];} else {o=d.getElementById(a)}
	return o;
}

function RefreshPage(){
	if (NS){document.location.reload();}else{CenterParent();}
}

function CenterParent(){
	//centers the parentLayer 
	DIVcont=(typeof(DIVcont)=='undefined')?CenterParent.arguments[0]:DIVcont;
	if (NS){
		GetLay(DIVcont).pageX=((w.innerWidth-GetLay(DIVcont).clip.width)/2<0)?0:(w.innerWidth-GetLay(DIVcont).clip.width)/2;
		GetLay(DIVcont).pageY=((w.innerHeight-GetLay(DIVcont).clip.height)/2<0)?0:(w.innerHeight-GetLay(DIVcont).clip.height)/2;
	} else if (IE){
		GetLay(DIVcont).style.left=((d.body.offsetWidth-GetLay(DIVcont).offsetWidth)/2<0)?0:(d.body.offsetWidth-GetLay(DIVcont).offsetWidth)/2;
		GetLay(DIVcont).style.top=((d.body.offsetHeight-GetLay(DIVcont).offsetHeight)/2<0)?0:(d.body.offsetHeight-GetLay(DIVcont).offsetHeight)/2;
	} else {
		window.status='';// added otherwise ns6 has strange comportement
		GetLay(DIVcont).style.left=((w.innerWidth-GetLay(DIVcont).offsetWidth)/2<0)?0:(w.innerWidth-GetLay(DIVcont).offsetWidth)/2;
		GetLay(DIVcont).style.top=((w.innerHeight-GetLay(DIVcont).offsetHeight)/2<0)?0:(w.innerHeight-GetLay(DIVcont).offsetHeight)/2;;
	}
	SetVisibility(GetLay(DIVcont),true);
	//setTimeout('CenterChildren()',1);
	allowed=true;
	
}

function SetVisibility(){
	//arg[0]= layer_object; arg[1]= true:visible/false:hidden
	var arg=SetVisibility.arguments;
	var vis=(arg[1])?((NS)?'show':'visible'):((NS)?'hide':'hidden')
	if (NS){arg[0].visibility=vis;} else {arg[0].style.visibility=vis;}
}

