var videoisdown = false;
var videofirstrun = true;
var slideshow_interval = 0;
var slideshow_item = 0;
var slideshow_paused = false;
function slideshow_goto (target,isclick) { if(isclick && !slideshow_paused){clearInterval(slideshow_interval);
slideshow_interval = setInterval(slideshow_goto,slideshow_swapcount);
if(target == -1){target = slideshow_captions.length - 1;
}if(target == slideshow_captions.length){target = 0;
}} else {target = slideshow_item + 1;
if(target == slideshow_captions.length){target = 0;
}}if(document.getElementById('sl'+slideshow_item)){document.getElementById('sl'+slideshow_item).className = 'off';
}if(document.getElementById('sl'+target)){document.getElementById('sl'+target).className = 'on';
}slideshow_item = target;
$("#sl_main").stop();
$("#sl_caption").stop();
$("#sl_main").css({ opacity: "1" });
$("#sl_caption").css({ opacity: "1" });
$("#sl_caption").fadeOut("fast", function () { document.getElementById('sl_caption').innerHTML = slideshow_captions[target];
 $("#sl_caption").fadeIn("fast") });
$("#sl_main").fadeOut("fast", function () { document.getElementById('sl_main').innerHTML = '<img src="../art/'+slideshow_prefix+target+'.jpg" width="470" height="300" alt="" \/>';
 $("#sl_main").fadeIn("fast");
 });
}
function slideshow_pausemanage () { if(slideshow_paused){  slideshow_paused = false;
  slideshow_interval = setInterval(slideshow_goto,slideshow_swapcount);
  document.getElementById("slideshow_pause").style.backgroundColor = "#cc2222";
 } else {  slideshow_paused = true;
  clearInterval(slideshow_interval);
  document.getElementById("slideshow_pause").style.backgroundColor = "#4e8dd4";
 }}
function videotoggle () {
	if(videoisdown){
		if(document.getElementById('videoshow')){
			document.getElementById('videoshow').style.backgroundColor = '#ff0000';
			document.getElementById('videoshow').innerHTML = 'OPEN VIDEO <span class="grey">&#187;</span>';
		}
		$('#videospace').slideUp("fast", function () { document.getElementById('videospace').style.display = 'none'; });
		videoisdown = false;
	} else {
		if(videofirstrun){
			var varcheck = new Array();
			if(typeof(currentchapter) != 'undefined'){
				varcheck.current = currentchapter;
			}
			if(document.getElementById('videospace')){
				document.getElementById('videospace').innerHTML = '<div id="videospaceflash"></div>';
				_papobject.embedSWF('../view/viewer.swf','videospaceflash','100%','125','9.0.0',null,varcheck,{menu: "false",wmode: "transparent"});
			}
		}
		if(document.getElementById('videoshow')){
			document.getElementById('videoshow').innerHTML = 'CLOSE VIDEO <span class="grey">&#187;</span>';
			document.getElementById('videoshow').style.backgroundColor = '#666666';
		}
		$('#videospace').slideDown("fast");
		videoisdown = true;
	}
}

window.onload = function () {
	if(document.getElementById('videoshow')){
		document.getElementById('videoshow').style.display = 'block';
		document.getElementById('videoshow').onclick = videotoggle;
	}
	if(typeof(currentchapter) != 'undefined' || (document.referrer && document.referrer != '' && document.referrer.indexOf('pbs.org') == -1)){
		videotoggle();
	}
}

function makenextlink () {
	if(currentchapter < 10){
		if(document.getElementById('charea')){
			document.getElementById('charea').innerHTML = '';
			$('#charea').hide();
		}
		if(document.getElementById('nextthing')){
			document.getElementById('nextthing').innerHTML = '<a href="' + (currentchapter + 1) + '.html"><img src="../art/vidnext.gif" width="150" height="150" alt="" /><br /><span class="nextchapter">NEXT CHAPTER</span> ' + nextchtitle + '</a>';
			$('#nextthing').fadeIn(300);
		}
	}
}

function localchapters () {
document.write('<div id="pap_chapters"><p>You\'ll need Flash 9 or better to view this content. <a href="http://www.adobe.com/go/gntray_dl_getflashplayer" target="_new">Download it now</a></p></div>');
var h=
{
};
var i=
{
wmode:"opaque",allowScriptAccess:"always"
};
h.pap_brandcode='frol';
h.pap_program='2701';
_papobject.embedSWF("http://www.pbs.org/wgbh/pages/frontline/video/flv/clocal0.swf","pap_chapters","100%","218","9",null,h,i,
{
id:'pap_chapters',name:'pap_chapters'
}
)
}