// JavaScript Document   
$(document).ready(function(){
  $("#PhotoBox .pagination a.indicator:first").addClass("sel");

  var itcount=($("#PhotoBox .changeable").size())-1;
  var current=0;
  var old=0;  
  $("#PhotoBox .changeable:eq(0)").show();
  
  $("#PhotoBox .pagination a.navLeft").click(function(){current--; if(current<0) current=itcount; rotate(current,old); old=current; return(false);});
  $("#PhotoBox .pagination a.navRight").click(function(){current++; if(current>(itcount)) current=0; rotate(current,old); old=current; return(false);} );
  
  $("#PhotoBox .pagination a.indicator").click(function(){str=$(this).attr("id");current=(str.substring(2,(str.length))-1); rotate(current,old); old=current; return(false);});

});

function rotate(current,old){   
//$("#RelatedSection .item .content .changeable").not(":eq("+current+")").hide();
$("#PhotoBox .changeable:eq("+old+")").fadeOut("fast",function(){$("#PhotoBox .changeable:eq("+current+")").fadeIn("fast");});


//$("#RelatedSection .item .content .changeable:eq("+current+")").fadeIn("normal");

$("#PhotoBox .pagination a.indicator:eq("+current+")").addClass("sel"); 
$("#PhotoBox .pagination a.indicator").not(":eq("+current+")").removeClass("sel");

}
    

