$(document).ready(function(){
	$("#breadcrumb").after("<div id='tester'></div>");
	
    initNewSlideshow();
});

function initNewSlideshow() {
    $(".slideshowLink").each(function(){
	    $(this).unbind().bind("click",function(){
		var theFlashTitle = $(this).attr('title');
		    //$(this).after('<span class="loadingIcon" id="slideshowLoader">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>');
		    $("#tester").empty().load($(this).attr('href') + " div.slides a", function(){
			    $("#tester a").empty().colorbox({open:true,onComplete:function(){$("#cboxTopCenter").html('<h3>'+theFlashTitle+'</h3>');flashReplace();},onClosed:function(){$("#cboxTopCenter").empty()}});
			    //$("#slideshowLoader").remove();
		    });
		    return false;
		});
	});
}


function flashReplace(){
    sIFR.replace(crankMinus, {
      selector: '#cboxTopCenter h3'
	  ,wmode: 'transparent',
	forceSingleLine: true
      ,css: [
        '.sIFR-root { color: #666666;}'
      ],
	  	tuneHeight:0, offsetTop:0
    });

}