/* Global Javascript */

// this will be our minimum width and minimum height
var minwidth = 980;
var maxwidth = 1024;

// Get Window Width
function getWindowWidth(){
	var r;
	
	if (document != null && document.body != null) {
		r = document.body.clientWidth;
	} else if (document != null && document.documentElement != null) {
		r = document.documentElement.clientWidth;
	}
	//if(!Browser.Engine.trident4){
		return r;
	//}
}





// Check for Size
function checkForSize(){
	var w = getWindowWidth();
	
	var e = document.getElementById("Global");
	
	if (w == null || e == null)
	return;
	
	//alert(w + '+' + h + '=' + e);
	
	if (w < minwidth) {
		e.style.width = minwidth + "px";
	}else if (w >maxwidth) {
		e.style.width = maxwidth + "px";
	}
	else {
		e.style.width = w;
	}
	//alert(e.style.width);
	
	
}


// Window Resize and Center
function resizeCenterWindow(sUrl, sName, iWidth, iHeight) {
	var iLeft;
	var iTop;
	
	if (screen.width > iWidth) {
		iLeft = parseInt((screen.width - iWidth) / 2);
	} else {
		iLeft = 0;
	}
	
	if (screen.height > iHeight) {
		iTop = parseInt((screen.height - iHeight) / 2);
	} else {
		iTop = 0;
	}
	
	window.open(sUrl, sName, 'width=' + iWidth + ', height=' + iHeight + ', location=0, resizable=0, scrollbars=0, toolbar=0, menubar=0, status=0, left=' + iLeft + ', top=' + iTop );
}


// INITIALIZER
window.onload = checkForSize;
window.onresize = checkForSize;

