// GH_openPopupWindow()
// Used to popup windows. Only opens 1 window with 'winName' at a time.

  // Lean code written Oct04 worked around popup blockers on Win98 + XP SP2.
  // This worked GREAT on XP, but one reservation on Win98!
  // focus() on XP brings a window UP from minimised, or from behind.
  // focus() on Win98 leaves a window minimised, but brings it in front from behind.


// ******** NOTE: Modified Code below is not tested yet with XP Popup Blockers - may2005 **


 // Keep the function itself as LEAN as possible.
function GH_openPopupWindow(theURL,winName,features) {

	// Note: This function used in both Online Shop, Image Library and popups to the Virtual Tour.

	// offset wanted for pop up placement
	xOffset = 0;
	yOffset = 25;

	// Detect IE Win and change yOffset to 0.
	if (is_ie && is_win) {
		yOffset = 0;
	}

	//alert(isNaN(window.screenX));
	//alert(window.screenLeft);
	//alert(window.screenX);
	
	// picks up the browser top left position
	broX = parseInt( isNaN(window.screenX) ? window.screenLeft : window.screenX ) + xOffset;
	broY = parseInt( isNaN(window.screenY) ? window.screenTop : window.screenY ) + yOffset;
	
	features += ",top=" + broY + ",left=" + broX + "";
	
	//alert(features);
	
	winHandle = window.open(theURL,winName,features);
	winHandle.focus();
}

// Run once when page loads.
var agt=navigator.userAgent.toLowerCase();
var is_ie   = (agt.indexOf("msie") != -1);
// var is_ns  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1));
// var agt_major = parseInt(navigator.appVersion);
// var agt_minor = parseFloat(navigator.appVersion);
// var is_ns4down = (is_ns && (agt_major <= 4));
// var is_mac= (agt.indexOf("mac")!=-1);
var is_win= (agt.indexOf("win")!=-1);

