var GC_SiteRoot = document.location.href.substr(0, document.location.href.indexOf('globalconnections'));
if (GC_SiteRoot.length < 2) {
	GC_SiteRoot = "/wgbh/";
}
GC_SiteRoot += 'globalconnections/';

// in case this is called by a script (like search)...

if (GC_SiteRoot.search('cgi-registry') > -1)
{
neavar=GC_SiteRoot.replace(/^(\S+)cgi-registry\/2wgbh/,"$1wgbh");
GC_SiteRoot=neavar;
}

// in addition to window targets listed here, there are also:
// "main": the main browser window, name set by nav.js
// "external": full-sized second window, the target of all outbound links

function glossPop(str) {
	var glossWin = window.open(GC_SiteRoot + "liberia/glossary/" + str, "glossary", "scrollbars=auto,width=344,height=400");
	glossWin.focus();
	return false;
}

function timelinkPop(str) {
	var timelinkWin = window.open(GC_SiteRoot + "libera/timeline/text/links/" + str, "timelinks", "scrollbars=yes,width=360,height=400");
	timelinkWin.focus();
	return false;
}


 
function vidPop(str) {
	// worst-case scenario is hi real
	// (which now has 41px extra due to captions)
	var vidWin = window.open(GC_SiteRoot + "liberia/video/" + str, "video", "scrollbars=no,status=yes,width=360,height=406");
	vidWin.focus();
	return false;
}

function trailPop(str) {
// special vidPop case for the liberia trailer
	var vidWin = window.open(GC_SiteRoot + "liberia/video/" + str, "video", "scrollbars=no,status=yes,width=320,height=400");
	vidWin.focus();
	return false;
}

function tlPop(str) {
	var tlWin = window.open(GC_SiteRoot + "liberia/timeline/flash/" + str, "timeline", "scrollbars=no,status=yes,width=588,height=398");
	tlWin.focus();
	return false;
}

function tlPopscript(str) {
//the GC_SiteRoot doesn't work for search scripts
	loc_GC_SiteRoot="/wgbh/globalconnections/";
	var tlWin = window.open(loc_GC_SiteRoot + "liberia/timeline/flash/" + str, "timeline", "scrollbars=no,status=yes,width=588,height=398");
	tlWin.focus();
	return false;
}


 
function thumbPop(str, orient) {
	// horiz is default
	var width, height, winname;
	if (orient == 'v') {
		winname = 'v';
		width = 295;
		// img is 400 high
		height = 480;
	} else {
		winname = 'h';
		width = 443;
		// img is 298 high
		height = 370;
	}
	var thumbWin = window.open(GC_SiteRoot + "liberia/thumb/" + str, "thumb" + winname, "scrollbars=auto,width=" + width + ",height=" + height);
	thumbWin.focus();
	return false;
}

