// - - - - - - - - - - - - - - - - - - GRID - - - - - - - - - - - - - - - - - - - - - - 
var isIE =  (navigator.appName.indexOf("Microsoft") != -1);

// - - - - - - - - - - - - - - - - - - Open POPUP Window - - - - - - - - - - - - - - - - - - - - 

function openPopUpWindow(url, w, h, attr){
	if (attr==null)
		attr='resizable=1,directories=0,toolbar=1,scrollbars=0,menubar=1,top=0,left=0';

	var sSizeAndPosition;
	sSizeAndPosition = 'width=' + w + ', height=' + h + ', top=' + (screen.height - parseInt(h))/2 + ', left=' + (screen.width - parseInt(w))/2;
	// try to close old window
	try{window.PopUpWindow.close();}catch(e){}

	window.PopUpWindow = window.open(url, 'edit', sSizeAndPosition + ', ' + attr);
}


// - - - - - - - - - - - - - - - - - - PAGE UNLOAD handler - - - - - - - - - - - - - - - - - - - - 
function Page_Unload(){
	try{
		if(window.PopUpWindow != null)
			window.PopUpWindow.close();
	}catch(e){}
}

window.onbeforeunload = Page_Unload;
