/* 
	@author Daniel Gibby, WestOne Services
	@created for Aged and Community Services | Guide to Emergency Management
	WUPI: 941ACS07_EGID
	@modified [Date], [Name], [Reason]
*/


// specific popup window functions

function showMain(url){
	var w = checkWidth(830);
	var h = checkHeight(600);
	window.parent.name = "opener";
	var features = "width=" + w + ",height=" + h + ",scrollbars=yes,resizable=yes,menubar,status" + getCenterStage(w,h);
	openCenteredWin(url,"emp",features);
}

// generic functions to open a centered window 
// check the width height and resize for netscape
// and to get the centre point of the screen.

function openCenteredWin(url,name,features) {
	myWindow = window.open(url,name,features);
	if (window.focus) myWindow.focus();
}

function checkHeight(h){
	// windows open smaller on NETSCAPE so make bigger
	if (navigator.appName == 'Netscape'){
		h += 19;
	}
	// windows open smaller on MAC IE so make bigger
	if (navigator.OS == 'mac' && navigator.appName != 'Netscape'){
		h = h + 25;
	}
	return h;
}

function checkWidth(w){
	// windows open smaller on MAC IE so make bigger
	if (navigator.OS == 'mac' && navigator.appName != 'Netscape'){
		w = w + 5;
	}
	return w;
}

function getCenterStage(w,h,buffer){
	if(!buffer) buffer = 0;
	if(window.screen) {
		var s = "";
		var aH = screen.availHeight;
		var aW = screen.availWidth;
		var cY = (aH - h)/2;
		var cX = (aW - w)/2;
		s += ",left=" + ((cX-12) + buffer);
		s += ",top=" + ((cY-50) + buffer);
		return s
	}
}