var agt = navigator.userAgent.toLowerCase();

var is_nav     = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
                 && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
                 && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));

var is_ie      = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));

var newWindow;
function openWindow(theURL,winName){
	if (theURL == "/Agent.asp"){
		if (newWindow){
			newWindow.close();
		}
		location = "/Agent.asp";
	}
	else{
		if (!newWindow || newWindow.closed){
			if (is_nav){
				newWindow = window.open(theURL,winName);
			}
			else{
				var WindowWidth = HM_IE ? (HM_DOM ? HM_IEcanvas.clientWidth : document.body.clientWidth) : window.innerWidth;
				var WindowHeight   = (HM_IE) ? (HM_DOM ? HM_IEcanvas.clientHeight : document.body.clientHeight) : window.innerHeight;
				WindowWidth += 9
				WindowHeight -= 25
				newWindow = window.open(theURL,winName,"menubar=yes,toolbar=yes,location=yes,resizable=yes,status=yes,scrollbars=yes,left=0,top=0,width="+WindowWidth+",height="+WindowHeight+"");
			}
	
			if (!newWindow.opener){
				newWindow.opener = window;
			}
		}
		else{
			newWindow.location = theURL;
			newWindow.focus();
		}
	}
}

var newHWindow;
function openWindow(theURL,winName){
	if (!newHWindow || newHWindow.closed){
		if (is_nav){
			newHWindow = window.open(theURL,winName);
		}
		else{
			var HM_DOM = (document.getElementById) ? true : false;
			var HM_IE = (document.all) ? true : false;
			var HM_IECSS = (HM_IE && document.compatMode) ? document.compatMode ==  "CSS1Compat" : false;
			if(HM_IE) HM_IEcanvas = HM_IECSS ? document.documentElement : document.body;
			
			var WindowWidth = HM_IE ? top.document.body.clientWidth : top.window.innerWidth;
			var WindowHeight   = (HM_IE) ? top.document.body.clientHeight : top.window.innerHeight;
			//WindowWidth += 9
			WindowHeight -= 20
			newHWindow = window.open(theURL,winName,"menubar=yes,toolbar=yes,location=yes,resizable=yes,status=yes,scrollbars=yes,left=0,top=0,width="+WindowWidth+",height="+WindowHeight+"");
		}

		if (!newHWindow.opener){
			newHWindow.opener = window;
		}
	}
	else{
		newHWindow.location = theURL;
		newHWindow.focus();
	}
}

var newPWindow;
function openPWindow(theURL,winName){
	if (!newPWindow || newPWindow.closed){
		newPWindow = window.open(theURL,winName,"resizable=yes,toolbar=no,menubar=no,location=no,status=no");
		if (!newPWindow.opener){
			newPWindow.opener = window;
		}
	}
	else{
		newPWindow.location = theURL;
		newPWindow.focus();
	}
}
