// JavaScript Document
<!--
//**********
// Video Popup added for Distributor Training section, DR, 3/10/06
// New: POPUP Blocker compatible, DR, 26/10/04
// Original custom popup code, DR, 9/10/03.

window.onerror=LPOnError

function LPOnError() {
   return true }

// On opening this window, reset Window trackers
// Allow one POPUP window (QTWin)
QTWin = null;   //global var


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

  // New code Oct04 for popup blockers on Win98 + XP SP2.
  // This works 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.
  
  // Keep the function itself as LEAN as possible.
function GH_openPopupWindow(theURL,winName,features) {
  winHandle = window.open(theURL,winName,features);
  winHandle.focus();
}

//*** Client Popups ***
	// Open new window at 0,0 set to 75% of screen width & height, or 1024 x 800, whichever is lesser.

	// Prepare popup dimensions BEFORE user clicks a link, to help popup blockers:
	clWidthMax = 1024;
	clHeightMax = 600;

	clWidth = clWidthMax;
	if ( screen.width * 0.75 > clWidthMax ) {
		clWidth = clWidthMax;
	} else {
		clWidth = screen.width * 0.75;
	}
	
	clHeight = clHeightMax;
	if ( screen.height * 0.75 > clHeightMax ) {
		clHeight = clHeightMax;
	} else {
		clHeight = screen.height * 0.75;
	}

	//alert(self.window.screenX);
	//	clTop = window.screenY;
	//	clLeft = window.screenX + clLeftOffset;
	clTop = 0;
	clLeft = 0;

// Dave for GH Client Screens - 8.12.06
function openClientWindow(theURL,winName,features) {
		winName = 'clientWindow';
		winHandle = window.open(theURL,winName, 'menubar=yes,location=yes,status=yes,scrollbars=yes,resizable=yes,width=' + clWidth + ',height=' + clHeight + ',left=' + clLeft + ',top=' + clTop);
		winHandle.focus();		
}


// Dave: to open ePo Demo window - 28.3.07
	// Prepare ePo window dimensions BEFORE user clicks a link, to help popup blockers:
	epoLeft = 0;
	epoTop = 0;
	epoIdealWidth = 1024;
	epoIdealHeight = 740;

	// Open to Ideal size, else to screen size if screen is smaller.
	epoWidth  = (screen.width < epoIdealWidth ) ? screen.width : epoIdealWidth;
	epoHeight = (screen.height < epoIdealHeight ) ? screen.height : epoIdealHeight;

function ePoDemo(theURL,winName,features) {
		theURL = 'epo-demonstration.htm';
		winName = 'ePoDemo';
		winHandle = window.open(theURL,winName, 'menubar=yes,location=no,status=no,scrollbars=yes,resizable=yes,width=' + epoWidth + ',height=' + epoHeight + ',left=' + epoLeft + ',top=' + epoTop);
		winHandle.focus();		
}


// Someone added this to top of JC Video Pages to open video popup windows from Range Overview.
// However, needs a winHandle.focus() at the bottom to bring up that window from minimised/behind.
function openBrWindow(theURL,winName,features) {
    rmRightOffset = 30;
    rmLeftOffset = 300;
	rmWidth = 370;
	rmHeight = 550;

	rmLeft = screen.width - rmWidth - rmRightOffset;
	//alert(self.window.screenX);
//	rmLeft = window.screenX + rmLeftOffset;
//	rmTop = window.screenY;
	rmTop = 0;
	winHandle = window.open(theURL,winName, 'scrollbars=yes,resizable=yes, width=' + rmWidth + ',height=' + rmHeight + ',left=' + rmLeft + ',top=' + rmTop);
	winHandle.focus();
	
	//window.open(theURL,winName,features);
}

function GH_openPopupWindowOld(theURL,winName,features) {
	popupWin = false;
	if (QTWin != null) {
		popupWin = true;
	}
	finished = false;
	if (popupWin) {
		if (!QTWin.closed) {
			commstring = 'QTWin = null';
			setTimeout(commstring,500);
			QTWin.close();
			}
		}
	commstring = 'QTWin = window.open("' + theURL + '","' + winName + '","' + features + '")';
	setTimeout(commstring,600);
	commstring = 'QTWin.focus()';
	setTimeout(commstring,800);
}

function GH_closePopupWindow() {
	popupWin = false;
	if (QTWin != null) {
		popupWin = true;
		}
	finished = false;
	if (popupWin) {
		if (!QTWin.closed) {
			commstring = 'QTWin = null';
			setTimeout(commstring,500);
			QTWin.close();
			}
		}
}

function closethiswindow() { 
	   window.close()
}
//-->
