
var playlistSlider={trailer:new Object(),webisode:new Object()};var hashIndex=location.href.indexOf('#');if(hashIndex>-1){var urlStart=location.href.match(/^http:\/\/.*videos/);var urlEnd=location.href.substr(hashIndex+1);if(urlEnd.substr(0,1)!="/"){urlEnd="/"+urlEnd;}
var newLocation=urlStart+urlEnd;location.href=newLocation;}
window.onload=function(){createScrollBar('video_playlist_area_'+($('activeTab').value),$('activeTab').value);Event.observe('track-top_'+($('activeTab').value),'mousedown',function(){scrollContinue=true;Event.observe(document.body,'mouseup',scrollStop);Event.observe('track-top_'+($('activeTab').value),'mouseout',scrollStop);scrollUp();});Event.observe('track-bottom_'+($('activeTab').value),'mousedown',function(){scrollContinue=true;Event.observe(document.body,'mouseup',scrollStop);Event.observe('track-bottom_'+($('activeTab').value),'mouseout',scrollStop);scrollDown();});if(location.href.indexOf('#')==-1){var titlePath=location.href.substr(location.href.indexOf('/videos')+1).split('/');if(titlePath.length>=3){if($('video_'+titlePath[2])){changeTitle($('video_'+titlePath[2]).firstChild.nodeValue);}
if($('descriptionText_'+titlePath[2])){$('currentDescription').innerHTML=$('descriptionText_'+titlePath[2]).innerHTML;}}}
SWFAddress.addEventListener(SWFAddressEvent.CHANGE,function(){var videoID;var tabName;var pathNames=SWFAddress.getPathNames();if(pathNames.length>=2){videoID=pathNames[1];tabName=pathNames[0];}
else{videoID=vflashvars.defaultVideoPath.split("/")[0];tabName=defaultTab;}
if($('rhc').hasClassName(tabName)==false){getPlaylist(tabName);}
var anchor=$('video_'+videoID);if(anchor){changeTitle(anchor.firstChild.nodeValue);}
var description=$('descriptionText_'+videoID);if(description){$('currentDescription').innerHTML=description.innerHTML;}});}
function createScrollBar(id,tabName){var num=$$('#'+id+' .vidlinks').length;playlistSlider[tabName]=new Control.Slider('scroll_handle_'+tabName,'track_'+tabName,{axis:'vertical',range:$R(0,num),onSlide:function(v){scrollVertical(v,$(id),playlistSlider[tabName]);},onChange:function(v){scrollVertical(v,$(id),playlistSlider[tabName]);}});function scrollVertical(value,element,slider){element.scrollTop=Math.round(value/slider.maximum*(element.scrollHeight-element.offsetHeight));}
if($(id).scrollHeight<=$(id).offsetHeight){playlistSlider[tabName].setDisabled();$('scrollbar_'+tabName).hide();}
Event.observe(id,'DOMMouseScroll',wheel);Event.observe(id,'mousewheel',wheel);}
function handle(delta){var tabName=$('activeTab').value;if(navigator.appName=='Opera'){playlistSlider[tabName].setValueBy(delta);}else{playlistSlider[tabName].setValueBy(-delta);}}
function getPlaylist(tabName){$('rhc').className=tabName+' pngfix';$('activeTab').value=tabName;switch(tabName){case'webisode':$('video_playlist_trailer').hide();$('video_playlist_webisode').show();break;case'trailer':$('video_playlist_webisode').hide();$('video_playlist_trailer').show();break;}
if(!$('video_playlist_'+tabName).hasClassName('scrollable')){var vids=$$('#video_playlist_'+tabName+' .vidlinks');for(var i=0;i<vids.length;i++){vids[i].addClassName('pngfix');}
$('track-top_'+tabName).addClassName('pngfix');$('track_'+tabName).addClassName('pngfix');$('scrub_'+tabName).addClassName('pngfix');$('track-bottom_'+tabName).addClassName('pngfix');createScrollBar('video_playlist_area_'+($('activeTab').value),$('activeTab').value);playlistSlider[($('activeTab').value)].setValue(0);Event.observe('track-top_'+($('activeTab').value),'mousedown',function(){scrollContinue=true;Event.observe(document.body,'mouseup',scrollStop);Event.observe('track-top_'+($('activeTab').value),'mouseout',scrollStop);scrollUp();});Event.observe('track-bottom_'+($('activeTab').value),'mousedown',function(){scrollContinue=true;Event.observe(document.body,'mouseup',scrollStop);Event.observe('track-bottom_'+($('activeTab').value),'mouseout',scrollStop);scrollDown();});$('video_playlist_'+tabName).addClassName('scrollable');}}
function changeTitle(newTitle){$('videoTitle').innerHTML="<h1 class=\"videos\" >"+newTitle+"</h1>";FLIR.replace('h1.videos',new FLIRStyle({mode:'quickeffects',qe_Shadow:'toon',color:'2a597a'}));}
function loadVideo(tab,id,language){SWFAddress.setValue('/'+tab+'/'+id+'/'+language+'/');}
var scrollContinue=true;function scrollDown(){if(scrollContinue){playlistSlider[($('activeTab').value)].setValueBy(1);setTimeout("scrollDown()",100);}}
function scrollUp(){if(scrollContinue){playlistSlider[($('activeTab').value)].setValueBy(-1);setTimeout("scrollUp()",100);}}
function scrollStop(){scrollContinue=false;}
function changeText(){var newTitle='webisodess';$('vt').innerHTML="<h2 class=\"videoT\" >"+newTitle+"</h2>";FLIR.replace('h2.videoT',new FLIRStyle({mode:'quickeffects',qe_Shadow:'toon',color:'2a597a'}));}