var Psyclone=window.Psyclone||
{
};
Psyclone.namespace=function(D)
{
    if(!D||!D.length)
    {
        return null
    }
    var C=D.split(".");
    var A=Psyclone;
    for(var B=(C[0]=="Psyclone")?1:0;B<C.length;++B)
    {
        A[C[B]]=A[C[B]]||
        {
        };
        A=A[C[B]]
    }
    return A
};
Psyclone.namespace("Component");
Psyclone.namespace("Widget");
Psyclone.namespace("Util");
function GetObjPos(B)
{
    var C=0,A=0;
    var D=null;
    if(B)
    {
        C=B.offsetLeft;
        A=B.offsetTop;
        D=B.offsetParent;
        while(D!==null)
        {
            C+=D.offsetLeft;
            A+=D.offsetTop;
            D=D.offsetParent
        }
    }
    return[C,A]
}
Psyclone.Component.SlideShow=
{
    showLightBox:true,showPreview:true,showCaption:true,globalSlidePause:8500,globalTitleTransition:400,onClick:null,isAnimating:false,transitionTimeoutId:null,init:function()
    {
        var A=document.getElementById("dynamicLead");
        A=
        {
            imageDeck:$(".imageDeck",this),mainArtLink:$(".imageDeck a.mainArt",this),mainArtImg:$(".imageDeck a.mainArt img",this),overlay:$(".imageDeck #dlOverlay",this),overlayXOffset:$(".imageDeck").width(),caption:$(".imageDeck #dlOverlay .caption",this),rubric:null,title:null,deck:null,source:null,titlePause:250,currentIndex:0,lightBox:$("div.bot div.lightBox a",this),mainNav:$("div.bot ol.mainNav",this),subNav:$("div.bot ol.subNav",this),back:$("div.bot ol.mainNav li a.back",this),pausePlay:$("div.bot ol.mainNav li a.pausePlay",this),next:$("div.bot ol.mainNav li a.next",this),isPaused:false,slides:[]
        };
        this.globalSlidePause=this.globalSlidePause*1000;
        this.globalTitleTransition=this.globalTitleTransition*1000;
        this.getSlidePreviews(A);
        this.getMainContent(A);
        this.getLightBox(A);
        this.playPauseHandler(A);
        this.previousHandler(A);
        this.nextHandler(A);
        this.start(A);
        A.onselectstart=function()
        {
            return false
        }
    }
    ,getSlidePreviews:function(A)
    {
$("li",A.subNav).each(function(B)
{
    if(Psyclone.Component.SlideShow.showCaption)
    {
$("a",this).mouseover(function(H)
{
    if(document.getElementById("dlLightBox"))
    {
        return
    }
    var I=GetObjPos(this);
    var E=GetObjPos(A.dl);
    var G=(I[0]-E[0])+E[0]-50;
    var F=I[1]-145;
    if(B!==A.currentIndex)
    {
        var D=$(this).siblings(".slideContent").html();
        var C='<div class="dlPreview transp" style="left:'+G+"px;top:"+F+'px;"><div class="slideContent">'+D+"</div></div>";
        $(C).appendTo("body")
    }
$(this).mouseout(function(J)
{
    $("div.dlPreview").remove();
    return false
}
);
return false
}
)
}
$("a",this).click(function(C)
{
    if(B==A.currentIndex)
    {
        return
    }
    Psyclone.Component.SlideShow.showSelected(B,A);
    return false
}
)
}
)
}
,getMainContent:function(A)
{
$("li",A.subNav).each(function(D)
{
    var C=this;
    C=
    {
        url:$("div.slideContent a.thumbArtLink",this).attr("href"),
        rubric:$("div.slideContent h6.rubric",this).text(),
        title:$("div.slideContent h2.title a",this).text(),
        deck:$("div.slideContent p.deck",this).text(),
        deckShort:$("div.slideContent p.deckShort",this).text(),
        source:$("div.slideContent p.source",this).text(),
        imageSrc:$("div.slideContent div.mainArtLink img",this).attr("src"),
        thumbSrc:$("div.slideContent a.thumbArtLink img",this).attr("src"),
        overlaySrc:$("div.slideContent img.overlayArtLink",this).attr("src"),
        date:$("div.slideContent p.date",this).text()
    };
    A.slides.push(C)
}
)
}
,getLightBox:function(A)
{
if(this.showLightBox)
{
$(A.lightBox).click(function(G)
{
    if(document.getElementById("dlLightBox"))
    {
        return
    }
    $(this).addClass("selected");
    var C="<ul>";
    for(var D=0;D<=5;D++)
    {
        if(D%3==2)
        {
            var F='<li class="last">'
        }
        else
        {
            var F="<li>"
        }
        if(A.slides[D]!=null)
        {
            F+='<div class="imageDeck"><img id="'+D+'" class="dlLbItem" width="100" src="../'+A.slides[D].thumbSrc+'" alt="'+A.slides[D].title+'" /></div><h6 id="'+D+'" class="title dlLbItem">'+A.slides[D].title+'</h6><p id="'+D+'" class="dlLbItem">'+A.slides[D].deckShort+'</p><p class="date">'+A.slides[D].date+"</p>"
        }
        else
        {
            F+=" "
        }
        F+="</li>";
        C+=F
    }
    C+="</ul>";
    var H=GetObjPos(this);
    var J=GetObjPos(A.dl);
    var B=H[0]-89;
    var I=H[1]-296;
    var E='<div id="dlLightBox" class="dlLightBox transp" style="left:'+B+"px;top:"+I+'px"><span class="close"> </span>'+C+"</div>";
    $(E).appendTo("body");
    $(document).one("click",function(K)
    {
        $(A.lightBox).removeClass("selected");
        $("#dlLightBox").remove();
        return false
    }
    );
$(".dlLbItem").click(function()
{
    if(parseInt(this.id)==A.currentIndex)
    {
        return
    }
    A.animating=false;
    Psyclone.Component.SlideShow.showSelected(parseInt(this.id),A);
    $(A.lightBox).removeClass("selected");
    $("#dlLightBox").remove()
}
);
return false
}
)
}
else
{
$(A.lightBox).parent("div.lightBox").css(
{
visibility:"hidden"
}
)
}
}
,setMainArtContent:function(A)
{
$(A.mainArtLink).attr("href",A.slides[A.currentIndex].url);
$(A.mainArtImg).attr(
{
src:A.slides[A.currentIndex].imageSrc,alt:A.slides[A.currentIndex].title
}
)
}
,setOverlayContent:function(B)
{
var A='<h6 class="rubric"><a href="'+B.slides[B.currentIndex].url+'">'+B.slides[B.currentIndex].rubric+" </a></h6>";
A+='<h2 class="title"><a href="'+B.slides[B.currentIndex].url+'"><img class="transp" src="'+B.slides[B.currentIndex].overlaySrc+'" alt="'+B.slides[B.currentIndex].title+'" /></a></h2>';
A+='<p class="deck"><a href="'+B.slides[B.currentIndex].url+'">'+B.slides[B.currentIndex].deck+"</a></p>";
A+='<p class="source"><a href="'+B.slides[B.currentIndex].url+'">'+B.slides[B.currentIndex].source+"</a></p>";
return A
}
,playPauseHandler:function(A)
{
$(A.pausePlay).click(function()
{
    if($(this).hasClass("pause"))
    {
        Psyclone.Component.SlideShow.pause(A)
    }
    else
    {
        Psyclone.Component.SlideShow.play(A)
    }
    return false
}
)
}
,previousHandler:function(A)
{
$(A.back).one("click",function()
{
    if(Psyclone.Component.SlideShow.isAnimating)
    {
        return
    }
    Psyclone.Component.SlideShow.isAnimating=true;
    $(A.overlay).dequeue();
    Psyclone.Component.SlideShow.showPrevious(A);
    return false
}
)
}
,nextHandler:function(A)
{
$(A.next).one("click",function()
{
    if(Psyclone.Component.SlideShow.isAnimating)
    {
        return
    }
    Psyclone.Component.SlideShow.isAnimating=true;
    Psyclone.Component.SlideShow.showNext(A);
    return false
}
)
}
,start:function(A)
{
$("li",A.subNav).slice(A.currentIndex,A.currentIndex+1).children("a").removeClass("selected").css(
{
    "background-position":"center "+(-90-(A.currentIndex*15))+"px"
}
);
this.setMainArtContent(A);
var B=this.setOverlayContent(A);
$(A.caption).html(B);
if(this.onClick!=null)
{
$(A.imageDeck).find("a").click(function()
{
    Psyclone.Component.SlideShow.onClick()
}
)
}
$(A.overlay).fadeOut();
this.resetOverlayPos(A);
$(A.mainArtLink).fadeIn(500,function()
{
Psyclone.Component.SlideShow.slideTransition(A)
}
)
}
,showSelected:function(A,B)
{
this.goTo(A,B)
}
,showPrevious:function(A)
{
if(A.currentIndex==0)
{
this.goTo(A.slides.length-1,A)
}
else
{
this.goTo(A.currentIndex-1,A)
}
}
,showNext:function(A)
{
if(A.currentIndex==(A.slides.length-1))
{
this.goTo(0,A)
}
else
{
this.goTo(A.currentIndex+1,A)
}
}
,play:function(A)
{
A.isPaused=false;
$(A.pausePlay).addClass("pause").removeClass("play");
this.goNext(A)
}
,pause:function(A)
{
A.isPaused=true;
$(A.pausePlay).addClass("play").removeClass("pause");
this.clearInterval(A)
}
,slideTransition:function(A)
{
if(A.currentIndex%3==0)
{
this.slideOverlayRightLeft(A)
}
else
{
if(A.currentIndex%3==1)
{
    this.slideOverlayBottomTop(A)
}
else
{
    this.slideOverlayLeftRight(A)
}
}
Psyclone.Component.SlideShow.setNextTransition(A)
}
,slideOverlayRightLeft:function(A)
{
window.setTimeout(function()
{
    $(A.overlay).animate(
    {
        left:0+"px"
    }
    ,Psyclone.Component.SlideShow.globalTitleTransition,function()
    {
        A.animating=false;
        Psyclone.Component.SlideShow.hideOverlayLeftRight(A)
    }
    )
}
,A.titlePause)
}
,slideOverlayBottomTop:function(A)
{
window.setTimeout(function()
{
    $(A.overlay).animate(
    {
        top:-155+"px"
    }
    ,Psyclone.Component.SlideShow.globalTitleTransition,function()
    {
        A.animating=false;
        Psyclone.Component.SlideShow.hideOverlayTopBottom(A)
    }
    )
}
,A.titlePause)
}
,slideOverlayLeftRight:function(A)
{
window.setTimeout(function()
{
    $(A.overlay).animate(
    {
        left:0+"px"
    }
    ,Psyclone.Component.SlideShow.globalTitleTransition,function()
    {
        A.animating=false;
        Psyclone.Component.SlideShow.hideOverlayRightLeft(A)
    }
    )
}
,A.titlePause)
}
,setNextTransition:function(A)
{
if(A.slides.length==1)
{
    return
}
if(!A.isPaused)
{
this.transitionTimeoutId=window.setTimeout(function()
{
    Psyclone.Component.SlideShow.goNext(A)
}
,Psyclone.Component.SlideShow.globalSlidePause)
}
}
,goNext:function(A)
{
if(A.currentIndex==(A.slides.length-1))
{
Psyclone.Component.SlideShow.goTo(0,A)
}
else
{
Psyclone.Component.SlideShow.goTo(null,A)
}
}
,goTo:function(A,B)
{
Psyclone.Component.SlideShow.clearInterval(B);
if(A!=null)
{
$("li",B.subNav).slice(B.currentIndex,B.currentIndex+1).children("a").removeClass("selected").css(
{
    "background-position":"center "+(-(B.currentIndex*15))+"px"
}
);
if(A!==0)
{
    $("li",B.subNav).slice(A,A+1).children("a").addClass("selected").css(
    {
        "background-position":"center "+(-90-(A*15))+"px"
    }
    )
}
else
{
    $("li a",B.subNav).slice(B.slides.length-1,B.slides.length).removeClass("selected").css(
    {
        "background-position":"center "+(-(B.slides.length*15))+"px"
    }
    );
    $("li",B.subNav).slice(A,A+1).children("a").addClass("selected").css(
    {
        "background-position":"center "+(-90-(A*15))+"px"
    }
    )
}
B.currentIndex=A
}
else
{
$("li",B.subNav).slice(B.currentIndex,B.currentIndex+1).children("a").removeClass("selected").css(
{
    "background-position":"center "+(-(B.currentIndex*15))+"px"
}
);
$("li",B.subNav).slice(B.currentIndex+1,B.currentIndex+2).children("a").addClass("selected").css(
{
    "background-position":"center "+(-90-((B.currentIndex+1)*15))+"px"
}
);
B.currentIndex++
}
this.fadeOutSlide(B)
}
,hideOverlayRightLeft:function(B,A)
{
$("span.close",B.overlay).one("click",function()
{
$(B.overlay).animate(
{
    left:-(B.overlayXOffset)+"px"
}
,Psyclone.Component.SlideShow.globalTitleTransition);
return false
}
)
}
,hideOverlayTopBottom:function(B,A)
{
$("span.close",B.overlay).one("click",function()
{
$(B.overlay).animate(
{
    top:0+"px"
}
,Psyclone.Component.SlideShow.globalTitleTransition);
return false
}
)
}
,hideOverlayLeftRight:function(B,A)
{
$("span.close",B.overlay).one("click",function()
{
$(B.overlay).animate(
{
    left:B.overlayXOffset+"px"
}
,Psyclone.Component.SlideShow.globalTitleTransition);
return false
}
)
}
,clearInterval:function(A)
{
window.clearTimeout(this.transitionTimeoutId);
this.transitionTimeoutId=null
}
,fadeOutSlide:function(A)
{
$(A.overlay).fadeOut(function()
{
    var B=Psyclone.Component.SlideShow.setOverlayContent(A);
    $(A.caption).html(B);
    Psyclone.Component.SlideShow.resetOverlayPos(A)
}
).siblings(A.mainArtLink).fadeOut(350,function()
{
    Psyclone.Component.SlideShow.setMainArtContent(A);
    Psyclone.Component.SlideShow.fadeOutComplete(A)
}
)
}
,fadeOutComplete:function(A)
{
$(A.mainArtLink).fadeIn(300,function()
{
    Psyclone.Component.SlideShow.slideTransition(A);
    Psyclone.Component.SlideShow.isAnimating=false;
    Psyclone.Component.SlideShow.previousHandler(A);
    Psyclone.Component.SlideShow.nextHandler(A)
}
)
}
,resetOverlayPos:function(A)
{
if(A.currentIndex%3==0)
{
    $(A.overlay).css(
    {
        left:A.overlayXOffset+"px",top:-155+"px",display:"block"
    }
    )
}
else
{
    if(A.currentIndex%3==1)
    {
        $(A.overlay).css(
        {
            left:0+"px",top:0+"px",display:"block"
        }
        )
    }
    else
    {
        $(A.overlay).css(
        {
            left:(-(A.overlayXOffset))+"px",top:-155+"px",display:"block"
        }
        )
    }
}
}
};
