/** author: daniel bulli wgbh interactive **/ //lets do video var cookieval = false; var dovideo = true; //while video playing var ctrl_changesetting = '
Change Settings
'; //not playing but cookie is set var ctrl_cookieset = '
Change Settings Play video
'; //open panel var ctrl_all = '
Windows Media Playerhighlow
QuickTimehighlow
'; /** * initializes video **/ function initVideo() { if(dovideo) { //get cookie value cookieval = getCookie("vidpref"); //write out appropiate things write_controls(); write_curtain(); } } /** * writes out curtain **/ function write_curtain() { if (!document.getElementById && !document.getElementById("video-holder")) { alert("You need to a newer browser version to view content."); return; } var videoholder = document.getElementById("video-holder"); if(!cookieval) { if (vid_img == null || vid_img == '') { vid_img = '../images/video/poster1_instruct.jpg'; } videoholder.innerHTML = 'Choose setting to play video'; } else { if (vid_img == null || vid_img == '../images/video/poster1_instruct.jpg' || vid_img == '') { vid_img = '../images/video/poster1.jpg'; } videoholder.innerHTML = 'Hit play below.'; } } /** * writes out controls **/ function write_controls() { if(!cookieval) { /** if no cookie then show all controls **/ write_ctrl_default(); } else { write_ctrl_cookieset(); } } /** write play/changesettings **/ function write_ctrl_cookieset() { var linkholder = document.getElementById("links-holder"); linkholder.innerHTML = ctrl_cookieset; } /** write changesettings **/ function write_ctrl_changesettings() { var linkholder = document.getElementById("links-holder"); linkholder.innerHTML = ctrl_changesetting; } /** write all options **/ function write_ctrl_default() { var linkholder = document.getElementById("links-holder"); //get cookie value cookieval = getCookie("vidpref"); var wm_stat = "off"; var wm_lo_vers = "off"; var wm_hi_vers = "off"; var qt_stat = "off"; var qt_lo_vers = "off"; var qt_hi_vers = "off"; if(cookieval) { if(cookieval.match("wm")) { wm_stat = "on"; if(cookieval.match("low")) { wm_lo_vers = "on"; } if(cookieval.match("high")) { wm_hi_vers = "on"; } } if(cookieval.match("qt")) { qt_stat = "on"; if(cookieval.match("low")) { qt_lo_vers = "on"; } if(cookieval.match("high")) { qt_hi_vers = "on"; } } } var ctrl_default = '
Windows Media Playerhighlow
QuickTimehighlow
'; linkholder.innerHTML = ctrl_default; } /** * opens up panel not really a play button */ function fakeplay(somevar) { var videoholder = document.getElementById("video-holder"); videoholder.innerHTML = 'Choose setting to play video'; var linkholder = document.getElementById("links-holder"); linkholder.innerHTML = ctrl_all; return; } /** * plays video */ function playvideo(somevar) { if (!document.getElementById && !document.getElementById("video-holder")) { alert("You need to a newer browser version to view content."); return; } //grab video holder var videoholder = document.getElementById("video-holder"); //if we are playing cookie val then get it if ((somevar == "cookieval")) { somevar = getCookie("vidpref"); } //reset cookie setCookie("vidpref",somevar); cookieval = somevar; var vidval = eval(somevar); var vidval_noext = vidval.substring(0,vidval.length-4); var wm_ext = '.asx'; if(cookieval.match("wm")) { var deflocv = "http://www.pbs.org/wgbh/si/video/" + vidval_noext + ".asx"; /* //local file from pc fix var defloc = "../video/"; var loc = window.location.href; //second two takes out ie mac and firefox //if((loc.lastIndexOf('file://') != -1) && !(loc.lastIndexOf('file:///') != -1) && !(loc.lastIndexOf('file://localhost') != -1)) var agt=navigator.userAgent.toLowerCase(); var is_win = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) ); var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1)); if (is_win && is_ie) { var defloc = "video/"; } */ /* if(is_win && (loc.lastIndexOf('file:///') != -1) && !(loc.lastIndexOf('file://localhost') != -1)) { var deflocv2 = loc.substring(8,loc.lastIndexOf('/')); deflocv2 = deflocv2.substring(0,deflocv2.lastIndexOf('/')); deflocv2 = deflocv2.substring(0,deflocv2.lastIndexOf('/')+1); var deflocv = unescape(deflocv2 + "video/" + vidval_noext + wm_ext); var samiFile = unescape(deflocv2 + "video/" + vidval_noext + '.sami'); } else { var deflocv = defloc + vidval_noext + wm_ext; var samiFile= defloc + vidval_noext + '.sami';//;'vid_1_1_creating_220.sami'; } var captionDiv = ((navigator.platform.indexOf('Win') > -1) ? "
 <\/div>" : ""); */ videoholder.innerHTML = ''; //videoholder.innerHTML = ''; } if(cookieval.match("qt")) { //write out embed videoholder.innerHTML = ''; } write_ctrl_changesettings(); } /** * roll over for high low **/ function vidroll(this_img) { //if image reference not passed then quit out if (!this_img) return true; //if rollovers not set then let's set them up if(!this_img.is_setup) { //let's store old value this_img.setAttribute('osrc', this_img.getAttribute('src')); var sTempSrc = ''; if(this_img.getAttribute('src').match('off')) { sTempSrc = this_img.getAttribute('src').replace('_off.gif', '_over.gif'); } else if(this_img.getAttribute('src').match('on')) { sTempSrc = this_img.getAttribute('src').replace('_on.gif', '_over.gif'); } //let's store hover state this_img.setAttribute('hsrc', sTempSrc); this_img.onmouseout = function() { this.setAttribute('src', this.getAttribute('osrc')); } //let's set to true this_img.is_setup = true; } this_img.setAttribute('src', this_img.getAttribute('hsrc')); return false; }