var coord = new Array(); var coordbyid = new Array(); var coordonbyid = new Array(); var curleft = 0; var itemwidth = 266; var cursel = 0; var itemsel = ''; var holderwidth = 6368; var selwidth = 500; var _evideourl="http://www.pbs.org/wgbh/pages/frontline/video/flv/e3u.swf"; var progs = new Array(); progs['2802'] = 'The Warning<\/i> (2009)'; progs['2708'] = 'Inside the Meltdown<\/i> (2009)'; progs['2714'] = 'The Madoff Affair<\/i> (2009)'; progs['2709'] = 'Ten Trillion and Counting<\/i> (2009)'; progs['2022'] = 'Bigger Than Enron<\/i> (2002)'; progs['1506'] = 'Betting on the Market<\/i> (1997)'; progs['2715'] = 'Breaking the Bank<\/i> (2009)'; progs['1002'] = 'The Great American Bailout<\/i> (1991)'; progs['2118'] = 'The Wall Street Fix<\/i> (2003)'; progs['2010'] = 'Dot Con<\/i> (2002)'; $(document).ready( function (){ topresize(); coordinate(); $("#holder").css({ 'left':'0px' }); if(location.href.indexOf('?') != -1){ moveit(parseInt(location.href.substring(location.href.indexOf('?') + 1, location.href.length)) - 1); } else { topsel(cursel); } $(".ti").each(function () { $(this).mouseover(function (){ var rec = $("#i" + ($(this).attr('tid'))); var ret = rec.find('.date').text(); ret += ' - ' + rec.find('h3').text(); $("#titler").html(ret); $("#titler").show(); }); $(this).mouseout(function (){ $("#titler").hide(); }); $(this).click(function () { var rec = $("#i" + ($(this).attr('tid'))); moveit($(this).attr('tid')); itemselect("i" + $(this).attr('tid')); }); }); $(".it").each(function () { if($(this).attr("id") != "i10"){ $(this).click(function () { itemselect($(this).attr("id")); }); } }); arrowupdate(); $("#leftbutton").click(function () { mover(false); }); $("#rightbutton").click(function () { mover(true); }); }); $(window).resize(function (){ topresize(); arrowupdate(); }); function itemselect (thisid) { if(thisid != itemsel){ var topid = parseInt(thisid.substring(1,thisid.length)); topsel(topid); cursel = topid; if(itemsel == ''){ $("#holder").css({ 'width': (holderwidth + selwidth) + 'px' }); } else { itemclose(itemsel); } var thisdiv = $("#" + thisid); thisdiv.animate({ 'width': (itemwidth + selwidth) + 'px' }, function () { var thisleft = thisdiv.offset(); if(thisleft.left < 80){ var holdoff = $("#holder").offset(); var thisleftreal = thisleft.left; if(thisleftreal < 0){ thisleftreal = 0 - thisleftreal; } var finalleft = (holdoff.left - (-80 - thisleftreal)); if(finalleft > 0){ finalleft = 0; } $("#holder").animate({ "left": finalleft + "px" }, arrowupdate); } else { if((thisleft.left + itemwidth + selwidth) > ($("#mainarea").width() - 80)){ var holdoff = $("#holder").offset(); var mover = holdoff.left - ((thisleft.left + itemwidth + selwidth) - ($("#mainarea").width() - 80)); if((0 - mover) > $("#holder").width()){ mover = (0 - $("#holder").width()); } $("#holder").animate({ "left": mover + "px" },arrowupdate); } } thisdiv.addClass('currentsel'); }); thisdiv.find("p").each( function () { $(this).hide(); }); $("#s" + topid + "a").html('' + thisdiv.find("h3").text() + ''); videoside(thisdiv,thisdiv.attr('vid'),topid); thisdiv.find('.vh').each( function () { $(this).after(''); $(this).find('.pb').each(function () { $(this).hide(); }); $(this).animate({ 'width': '450px', 'height':'284px' }, function () { videoembed(thisdiv.attr("vid"),"v" + topid); $("#vprog").html("FROM " + progs[thisdiv.attr("prg")]); }); }); thisdiv.unbind('click'); itemsel = thisid; } } function videoside (bigdiv,svd,topid){ bigdiv.find(".rel").each( function () { $(this).unbind("click"); if(svd != $(this).attr('svd')){ $(this).removeClass('on'); $(this).click(function () { videoload("v"+topid,$(this).attr('svd')); videoside(bigdiv,$(this).attr('svd'),topid); $("#vprog").html("FROM " + progs[$(this).attr("prg")]); }); } else { $(this).addClass('on'); } }); } function itemclose (thisid) { if(thisid != '' && thisid == itemsel){ var topid = parseInt(thisid.substring(1,thisid.length)); videoembed_remove(topid); var thisdiv = $("#" + thisid); $("#vprog").remove(); thisdiv.removeClass('currentsel'); thisdiv.find("p").each( function () { $(this).show(); }); thisdiv.find(".rel").each( function () { $(this).unbind('click'); }); thisdiv.find('.vh').each( function () { $(this).animate({ 'width': '256px', 'height':'180px' }); $(this).find('.pb').each(function () { $(this).show(); }); }); thisdiv.animate({ 'width': itemwidth + 'px' }); thisdiv.click(function () { itemselect(thisdiv.attr("id")); }); } } function coordinate () { $(".it").each(function () { var of = $(this).offset(); var thisitem = new String(); thisitem = $(this).attr('id'); coord[thisitem] = of.left; var newobj = new Object(); newobj.loc = of.left; newobj.id = $(this).attr('id'); newobj.vid = 'v' + newobj.id.substring(1,newobj.id.length); coord.push(newobj); coordbyid[thisitem] = of.left; }); } function arrowupdate () { var ho = $("#holder").offset(); if(ho.left > (0 - ($("#holder").width() - $("#mainarea").width()))){ $("#rightbutton").show(); } else { $("#rightbutton").hide(); } if(ho.left < -10){ $("#leftbutton").show(); } else { $("#leftbutton").hide(); } } function mover (right){ var mover; var thisof = $("#holder").offset(); if(right){ mover = thisof.left - (($("#mainarea").width() / 2) - 50); if((0 - mover) > ($("#holder").width() - $("#mainarea").width())){ mover = 0 - ($("#holder").width() - $("#mainarea").width()); } } else { mover = thisof.left + (($("#mainarea").width() / 2) + 50); if(mover > 0){ mover = 0; } } $("#holder").animate({ "left": mover + "px"}, arrowupdate); } function moveit (iid) { topsel(iid); cursel = iid; iid = 'i' + iid; var finalmove = coordbyid[iid]; if(itemsel != ''){ var topid = parseInt(itemsel.substring(1,itemsel.length)); if(cursel > topid){ finalmove += selwidth; } } finalmove -= 80; if(finalmove < 20){ finalmove = 0; } if(finalmove > ($("#holder").width() - $("#mainarea").width())){ finalmove = ($("#holder").width() - $("#mainarea").width()) + 10; } $("#holder").animate({ 'left': '-' + finalmove + 'px' },arrowupdate); } function topsel (iid) { $(".t"+cursel).each(function (){ $(this).removeClass('sel'); }); $(".t"+iid).each(function (){ $(this).addClass('sel'); }); } function topresize () { var newwidth = (($("#outer").width() - 20) / 15) - 3; $(".ti").each(function (){ $(this).css({'width':newwidth + 'px'}); }); // var x = 1; // $(".gr").each(function (){ // var of = $(this).offset(); // $("#l"+x).css({ 'margin-left': (of.left + 10) + 'px' }); // x++; // }); } function videoembed (videoid,targetdiv){ _papobject.embedSWF(_papevideourl,targetdiv,450,284,"9",null,{ pap_url:window.location.href, pap_usecache:true, pap_hash:videoid, pap_play:true, pap_standalone:true, pap_replaymode:true },{wmode:"opaque",allowFullScreen:"true",allowScriptAccess:"always"},{ id:targetdiv+'id',name:targetdiv+'na' }); } function videoembed_remove (targetdiv){ $("#v"+targetdiv+"id").remove(); $(".vh"+targetdiv).html('
'); } function videoload (targetdiv,videoid){ var a; if(navigator.appName.indexOf("Microsoft")!=-1) { a=window[targetdiv+'id'] } else { a=document[targetdiv+'id'] } a.playvideo(videoid); }