	var IsIE = true, BrowserName = 'MSIE', BrowserVersion = 0;

	GetBrowser();

function GetWindowWidth(pWin) 		{ if (IsIE) return pWin.document.body.clientWidth; else return pWin.outerWidth; }
function GetWindowHeight(pWin) 		{ if (IsIE) return pWin.document.body.clientHeight; else return pWin.outerHeight; }
function GetScreenWidth() 			{ return screen.availWidth - 10; }
function GetScreenHeight() 			{ return screen.availHeight - 35; }
function GetBrowser() {
	if (navigator.userAgent.indexOf("Opera") != -1) 	BrowserName = 'Opera'; 
	if (navigator.userAgent.indexOf("Firefox") != -1) 	BrowserName = 'Firefox'; 
	if (navigator.userAgent.indexOf("Safari") != -1) 	BrowserName = 'Safari'; 
	if (navigator.userAgent.indexOf("Camino") != -1) 	BrowserName = 'Camino'; 
	if (navigator.userAgent.indexOf("Netscape") != -1) 	BrowserName = 'Netscape'; 
	if (navigator.userAgent.indexOf("MSIE") != -1) 		BrowserName = 'MSIE'; 
	var w1 = navigator.userAgent.indexOf(BrowserName); 	
	BrowserVersion = parseInt(navigator.userAgent.substr(w1+BrowserName.length+1, 8));
	if (BrowserName != 'MSIE') IsIE = false;
}

function WindowOpen(wLocation, wName, wParam, wCenter, wMax) {
	if (wParam == "") {
		wParam = "toolbar=no, location=no, directories= no, status= yes, menubar=no, resizable=yes, scrollbars=yes";
		if (wMax && wMax == true) { wParam += ", width=" + GetScreenWidth(this).toString() + ", height=" + GetScreenHeight(this).toString() + ", left=0, top=0"; }
		else { wParam += ", width=940, height=690"; }
	} else {
		if (wParam.indexOf("scrollbars=") == -1) wParam += ", scrollbars=yes";
		if (wParam.indexOf("toolbar=") == -1) wParam += ", toolbar=no";
		if (wParam.indexOf("directories=") == -1) wParam += ", directories=no";
		if (wParam.indexOf("status=") == -1) wParam += ", status=no";
		if (wParam.indexOf("resizable=") == -1) wParam += ", resizable=yes";
		if (wParam.indexOf("center=") == -1) wParam += ", center=yes";
		if (wParam.indexOf("menubar=") == -1) wParam += ", menubar=no";
		if (wParam.indexOf("width=") == -1) wParam += ", width=940";
		if (wParam.indexOf("height=") == -1) wParam += ", height=690";
	}
	if (wMax == false) {
	if (wCenter || wCenter == true) {
	
		var w1, w2, wwidth, wheight, wleft, wtop;
		w1 = wParam.indexOf('width=');
		if (w1 > -1) {
			w2 = wParam.indexOf(',', w1);
			if (w2 <= 0) w2 = wParam.length;
			wwidth = wParam.substring(w1 + 6, w2);
		}
		w1 = wParam.indexOf('height=');
		if (w1 > -1) {
			w2 = wParam.indexOf(',', w1);
			if (w2 <= 0) w2 = wParam.length;
			wheight = wParam.substring(w1 + 7, w2);
		}
		wleft = parseInt((GetScreenWidth() - parseInt(wwidth)) / 2);
		wtop = parseInt((GetScreenHeight() - parseInt(wheight)) / 2);		
		wParam += ", left=" + wleft + ', top=' + wtop;		
	}
	}

	var pWindow = window.open(wLocation, wName, wParam);
	if (pWindow) pWindow.focus();
	return(pWindow);
}
