var galleryCurrentImage=0;var galleryNewImage=false;var galleryRotateImages=true;var galleryRotateTimer=false;var gallerygalleryNextImage=0;var currentlyRotating=false;var numImages=0;var currentVideo=0;var currentVideo="";function gallerySetup(){var _1=$("div.gallery-image-holder").length;for(counter=1;counter<_1;counter++){$("div.gallery-image-holder:eq("+counter+")").css("top","-1000px");}if($("div#video-holder").length>0){$("div#image-gallery").css("display","none");$("div#image-gallery").css("visibility","hidden");}if($("div#video-holder").length<=0){$("div#image-gallery").css("display","block");$("div#image-gallery").css("visibility","visible");$("div#video-gallery").css("display","none");}else{$("div#image-gallery div.imagebutton-selected").css("display","block");$("div#image-gallery a.videobutton").css("display","block");$("div#image-gallery").css("display","none");$("div#image-gallery").css("visibility","hidden");$.post("videos.xml",function(_2){var _3="";var _4=0;var _5=0;var _6=$(_2).find("video").length;for(_4=0;_4<_6;_4++){_5=$(_2).find("video")[_4];_3+="<a href=\""+$(_5).find("video-link").text()+"\" ";_3+="name=\""+$(_5).find("video-xml-file").text()+"#";_3+=$(_5).find("title").text()+"#";_3+=$(_5).find("date").text()+"#";_3+=$(_5).find("body-text").text()+"\">";_3+="<img src=\""+$(_5).find("thumbnail-src").text()+"\" ";_3+="alt=\""+$(_5).find("title").text()+"\"></a>";}$("div#video-thumbs-holder").empty();$("div#video-thumbs-holder").append(_3);$("div#video-thumbs-holder a:eq(0)").each(function(){currentVideoId=this;currentVideo=$(this).attr("name");$("div#video-browse h2").text($(this).attr("name").split("#")[1]);$("div#video-browse h3").text($(this).attr("name").split("#")[2]);$("div#video-browse p").html($(this).attr("name").split("#")[3]+"<a href=\"javascript:popupFullEpisode('"+$(this).attr("href")+"')\">Watch the short film</a><a id=\"mediainfo\" href=\"javascript:popupPlayerGuide();\">Required: Windows Media or Real Media</a>");$(this).css("background-position","0 -88px");});if(_6<=1){$("div#video-thumbs-holder").empty();$("div#video-browse h4").remove();}$("div#video-thumbs-holder a").click(function(){currentVideoId=this;currentVideo=$(this).attr("name");$("div#video-browse h2").text($(this).attr("name").split("#")[1]);$("div#video-browse h3").text($(this).attr("name").split("#")[2]);$("div#video-browse p").html($(this).attr("name").split("#")[3]+"<a href=\""+$(this).attr("href")+"\">Watch the short film</a><a id=\"mediainfo\" href=\"javascript:popupPlayerGuide();\">Required: Windows Media or Real Media</a>");$("div#video-thumbs-holder a").css("background-position","0 0");$(this).css("background-position","0 -88px");mpLoadVideo($(this).attr("name").split("#")[0]);return false;});$("div#video-thumbs-holder a").hover(function(){$(this).css("background-position","0 -88px");$("div#video-browse h2").text($(this).attr("name").split("#")[1]);$("div#video-browse h3").text($(this).attr("name").split("#")[2]);$("div#video-browse p").html($(this).attr("name").split("#")[3]+"<a href=\"javascript:popupFullEpisode('"+$(this).attr("href")+"')\">Watch the short film</a><a id=\"mediainfo\" href=\"javascript:popupPlayerGuide();\">Required: Windows Media or Real Media</a>");},function(){$(this).css("background-position","0 0");$(currentVideoId).css("background-position","0 -88px");$("div#video-browse h2").text($(currentVideoId).attr("name").split("#")[1]);$("div#video-browse h3").text($(currentVideoId).attr("name").split("#")[2]);$("div#video-browse p").html($(currentVideoId).attr("name").split("#")[3]+"<a href=\"javascript:popupFullEpisode('"+$(currentVideoId).attr("href")+"')\">Watch the short film</a><a id=\"mediainfo\" href=\"javascript:popupPlayerGuide();\">Required: Windows Media or Real Media</a>");});$("div#video-gallery").css("visibility","visible");$("div#video-gallery").show();});}$.post("images.xml",function(_7){var _8="";var _9=0;var _a=0;for(_9=0;_9<$(_7).find("image").length;_9++){_a=$(_7).find("image")[_9];_8+="<div class=\"gallery-image-holder\">";_8+="<div>";_8+="<h3>"+$(_a).find("name").text()+"</h3>";_8+="<p>"+$(_a).find("venue").text()+" ";_8+=$(_a).find("date").text()+"</p>";_8+="</div>";_8+="<img src=\""+$(_a).find("image-src").text()+"\" alt=\"";_8+=$(_a).find("name").text()+"\" />";_8+="</div>";}$("div.gallery-image-holder").after(_8);numImages=$("div.gallery-image-holder").length;if(numImages>1){$("div#image-gallery").prepend("<a href=\"javascript: void(0)\" class=\"previousbutton\"></a><a href=\"javascript: void(0)\" class=\"nextbutton\"></a><a href=\"javascript: void(0)\" class=\"pausebutton\"></a>");}var _b=0;for(_b=0;_b<numImages;_b++){$("div.gallery-image-holder:eq("+_b+")").css("z-index",""+(50-_b)+"");$("div.gallery-image-holder:eq("+_b+")").css("top","34px");if(_b!=0){$("div.gallery-image-holder:eq("+_b+") div").css("top","274px");}}$("div.gallery-image-holder:eq(0) div").css("top","233px").css("opacity","0.8");$("div#image-gallery a.pausebutton").toggle(function(){galleryRotateImages=false;clearTimeout(galleryRotateTimer);$(this).css("background-position","0 -32px");},function(){galleryRotateImages=true;$(this).css("background-position","0 0");clearTimeout(galleryRotateTimer);galleryRotateTimer=setTimeout("swapGalleryImage()",1000);return false;});$("a.nextbutton").click(function(){if(!currentlyRotating){clearTimeout(galleryRotateTimer);galleryRotateTimer=setTimeout("swapGalleryImage()",300);}return false;});$("a.previousbutton").click(function(){if(!currentlyRotating){clearTimeout(galleryRotateTimer);galleryNewImage=galleryCurrentImage-1;if(galleryNewImage<0){galleryNewImage=galleryNewImage+($("div.gallery-image-holder").length);}clearTimeout(galleryRotateTimer);galleryRotateTimer=setTimeout("swapGalleryImage()",300);}return false;});if($("div#video-holder").length<=0){galleryRotateTimer=setTimeout("swapGalleryImage()",10000);}});}function swapGalleryImage(){if(numImages<2){return;}if(currentlyRotating){return;}currentlyRotating=true;$("div.gallery-image-holder:eq("+galleryCurrentImage+") div").animate({top:274,opacity:0},500,"",function(){if(!(galleryNewImage===false)){galleryNextImage=galleryNewImage;galleryNewImage=false;}else{galleryNextImage=galleryCurrentImage+1;if(galleryNextImage>(numImages-1)){galleryNextImage=0;}}$("div.gallery-image-holder:eq("+galleryCurrentImage+")").css("z-index","100");$("div.gallery-image-holder:eq("+galleryNextImage+")").css("z-index","99");$("div.gallery-image-holder:eq("+galleryNextImage+")").css("display","block");$(this).parent().fadeOut("slow",function(){$(this).css("z-index","0");$("div.gallery-image-holder").css("z-index","0");$("div.gallery-image-holder:eq("+galleryNextImage+")").css("z-index","100");$("div.gallery-image-holder:eq("+galleryNextImage+") div").each(function(){$(this).animate({top:233,opacity:0.8},500);galleryCurrentImage=galleryNextImage;if(galleryRotateImages){clearTimeout(galleryRotateTimer);galleryRotateTimer=setTimeout("swapGalleryImage()",5000);}currentlyRotating=false;});});});}$(document).ready(function(){$("div#no-js-video-links").hide();if($("div#video-holder").length<=0){$("a.videobutton").remove();$("div.imagebutton-selected").remove();}else{$("div#image-gallery").css("display","none");$("div#image-gallery").css("visibility","hidden");}$("a.videobutton").click(function(){if($("div#video-holder").length<=0){return false;}clearTimeout(galleryRotateTimer);$(this).parent().css("visibility","hidden");$(this).parent().css("display","none");$("div#video-gallery").css("visibility","visible");return false;});$("div#video-gallery a.imagebutton").click(function(){stopVideo();$(this).parent().css("visibility","hidden");$("div#image-gallery").css("visibility","visible");$("div#image-gallery").css("display","block");if(galleryRotateImages){currentlyRotating=false;clearTimeout(galleryRotateTimer);galleryRotateTimer=setTimeout("swapGalleryImage()",1000);}return false;});});