// ******************************************
// *** JavaScript Document for BMI Pvt. Ltd.
// *** Created by Pranjal Kumar Hazarika
// *** Started: 29th May 2007
// ******************************************
var elem;
var LayerWidth;
var LayerHeight;
var winWidth;
var winHeight;

// Vertically & Horizontally Center Main Layer 
function pkRePos_on_Resize(x) {
	// This is the way the latest standards work
	if (document.getElementById) {	elem = document.getElementById(x);	}
	// This is the way old MSIE versions work
	else if (document.all) { elem = document.all[x]; } 
	// This is the way NN4 works
	else if (document.layers) { elem = document.layers[x]; }

	// Get Layer width and height
	LayerWidth = elem.offsetWidth;
	LayerHeight = elem.offsetHeight;
	
	if (self.innerWidth)
	{
		winWidth = self.innerWidth;
		winHeight = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientWidth)
	{
		winWidth = document.documentElement.clientWidth;
		winHeight = document.documentElement.clientHeight;
	}
	else if (document.body)
	{
		winWidth = document.body.clientWidth;
		winHeight = document.body.clientHeight;
	}
	pkCalcPOS()
	//alert ("Win: " + winWidth + " x " + winHeight + "\n" + "LeftTop: " + LayerLeft + " x " + LayerTop + "\n" + "WidthHeight: " + LayerWidth + " x " + LayerHeight);
}

function pkCalcPOS() {
	// Calculate position
	LayerTop = (winHeight / 2) - (LayerHeight / 2);
	LayerLeft = (winWidth / 2) - (LayerWidth / 2);
	// Position the Layer
	elem.style.top = (LayerTop) + "px";
	elem.style.left = (LayerLeft) + "px";
}

