function spawn (targ,x,y) {
	window.open(targ,'secondary','width=' + x + ',height=' + y + ',scrollbars=yes');
}

function schedulebox () {
	window.open('http://www.pbs.org/wgbh/pages/frontline/programs/pbsv.html','schedule','width=500,height=600,scrollbars=yes');
}

function mailafriend () {
	window.open('http://www.pbs.org/wgbh/pages/frontline/us/mailfriend.html','mail','width=500,height=500,scrollbars=yes');
}

function stopclicking(button) {
	button.value = "please wait";
	return true;
}
				  
function preload() {
  if (document.images) {
    if (typeof(document.F) == 'undefined'){
		document.F = new Object();
    }
	document.F.loadedImages = new Array();
    var argLength = preload.arguments.length;
    for(arg=0;arg<argLength;arg++) {
		document.F.loadedImages[arg] = new Image();
		document.F.loadedImages[arg].src = preload.arguments[arg];
    }
  }
}


function imageswap(daImage, daSrc){
  var objStr,obj;
  if(document.images){
   if (typeof(daImage) == 'string') {
      objStr = 'document.' + daImage;
      obj = eval(objStr);
      obj.src = daSrc;
    } else if ((typeof(daImage) == 'object') && daImage && daImage.src) {
      daImage.src = daSrc;
    }
  }
}

function videobox(urlprefix,url){
	window.open("http://www.pbs.org/wgbh/pages/frontline/"+urlprefix+url+".html","video","toolbar=no,location=no,directories=no,menubar=no,width=680,height=700,scrollbars=yes");
}

function makenav() {
	document.write('<div class="global_topnav"><div class="navcontain"><form action="http://www.pbs.org/wgbh/pages/frontline/gsearch.html" method="get" name="searchform"><input type="hidden" name="filter" value="0" /><p><a href="http://www.pbs.org/wgbh/pages/frontline/us/" class="item" title="About FRONTLINE">About FRONTLINE</a><a href="http://www.pbs.org/wgbh/pages/frontline/view/" class="item" title="Watch FRONTLINE Online">Watch FRONTLINE Online</a><a href="#" class="item" onclick="schedulebox();" title="FRONTLINE Schedule">Schedule</a><span class="searchinfo">Search&nbsp;<input type="text" name="q" class="navsearchbox" /><input type="image" ISMAP src="/wgbh/pages/frontline/art/common/06navr.gif" class="subbutton" /></span><a href="#" class="eitem" onclick="mailafriend();" title="E-Mail This Page">E-Mail This Page</a></p></form></div></div>');
}

function setcookie(name,value) {
 	var today = new Date();
	 var expire = new Date();
	 var nDays = 180;
 	 expire.setTime(today.getTime() + 3600000*24*nDays);
	 document.cookie = name+"="+escape(value) + ";path=/wgbh/pages/frontline/;expires="+expire.toGMTString();
}

function searchsubmit(){
	document.topnavform.q.value = document.searchform.q.value + '+:site:www.pbs.org/wgbh/pages/frontline';
	document.topnavform.submit();
}

function handleclick (targ) {
	opener.location.href = targ;
	window.close(self);	
}

function subtitle(targetdiv,target){
	if(document.getElementById(targetdiv)){
		document.getElementById(targetdiv).innerHTML = target;
	}
}
