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...

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 + "mideast/glossary/" + str, "glossary", "scrollbars=auto,width=344,height=400");
	glossWin.focus();
	return false;
}

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


 
function vidPop(str) {
	// worst-case scenario is hi real
	var vidWin = window.open(GC_SiteRoot + "mideast/video/" + str, "video", "scrollbars=no,status=yes,width=360,height=365");
	vidWin.focus();
	return false;
}



function surveyPop(str) {
var vidSur=window.open(GC_SiteRoot + "mideast/" + str,"survey","scrollbars=yes,status=yes,width=600,height=480");
vidSur.focus();
return false;
}


// Kit was here...

function initPop() {
var ckDays=365; // how long does the cookie last
var ckExpDate=new Date();
ckExpDate.setTime(ckExpDate.getTime() +  (24 * 60 * 60 * 1000 * ckDays));

var check=getCookie('gcflag');
if (check == null) {
var inSur=window.open(GC_SiteRoot + "mideast/survey.html","init","scrollbars=no,status=yes,width=360,height=260");
inSur.focus();
setCookie('gcflag',1,ckExpDate);
}
else
{
//window.alert('cookie set');
}
return false;
}

// and now Kit is gone.

function tlPop(str) {
	var tlWin = window.open(GC_SiteRoot + "mideast/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 + "mideast/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 + "mideast/thumb/" + str, "thumb" + winname, "scrollbars=auto,width=" + width + ",height=" + height);
	thumbWin.focus();
	return false;
}

