function pop(path, w, h, popName, hasScrollbars, isResizable, menubar, displayToolbar, usePositions, top, left, hasStatus) {
	if (!hasScrollbars) hasScrollbars='0';
	if (!isResizable) isResizable='0';
	if (!menubar) menubar='0';
	if (!displayToolbar) displayToolbar='0';
	if (!top) top='0';
	if (!left) left='0';
	if (!hasStatus) hasStatus='0';
	var paramStr = '';

	if (w || h) {
		paramStr += ('width=' + w + ',height=' + h + ',');
	}
	paramStr += ('location=0,directories=0');
	paramStr += (',status=' + hasStatus + ',menubar=' + menubar);
	paramStr += (',toolbar=' + displayToolbar);
	paramStr += (',scrollbars=' + hasScrollbars);
	paramStr += (',resizable=' + isResizable);
	if (usePositions) {
		paramStr += (',top=' + top);
		paramStr += (',left=' + left);
	}

	var thePopup = window.open(path, popName, paramStr);
	return thePopup; 
}

var p;
function popInteractive(root, timePeriod, tourStop) {
		if (!root) {
			root = "";
		}
        if (!timePeriod) {
			timePeriod=0;
		}
		if (!tourStop) {
			tourStop=0;
		}

		// dk disabling fancy goto tour stop
		if(tourStop && p && p.frames && p.frames[0]) {
			p.frames[0].document.location.href = root + 'interactive/control.html?s1=0|timePeriod='+timePeriod+'|tourStop='+tourStop;			
			p.focus();			
		} else {		
			// turn on the status bar for IE and Safari Mac to prevent the size dragger from overlapping content
			var myStatus = 0;
			if (isMac) {
				myStatus = 1;
			}

			// if we have a small screen, don't include the button bar.
			var displayToolbar = 1;
			if (screen && (screen.availHeight <= 600)) {
				displayToolbar = 0;
			}

			// open popup letting the browser handle size and position
			p = pop(root + 'interactive/index.html?s1=0|timePeriod='+timePeriod+'|tourStop='+tourStop, 0, 0, 'chesapeakeInteractive', 0, 1, 0, displayToolbar, 0, 0, 0, myStatus);
			p.focus();
		}
		return false;
}

// given an anchor and a window, attempt to open the anchor in the window.  If the window doesn't exist, create it.
function launchInOpener(url) {
	if (url) {
		if (myOpener && !myOpener.closed) {
			myOpener.location = url;
		} else {
			myOpener = window.open(url,'chesapeakeWindow');
		}
        myOpener.focus();
		return false;
	} else {
		return true;
	}
}

