function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 6000 );
});


function mySbOpen(){
        var c = Shadowbox.getCurrent();
        var pageLink = c.link.ownerDocument.URL;
        if(pageLink.indexOf('?')>1){
                pageLink = pageLink.split('?')[0]
        }
        var link2image = pageLink+"?the_item="+c.link.shadowboxCacheKey;
        var newDiv = $('<div id="sb-mylink">'+
                                   '<a id="printMe" href="#" title="Print me"><img src="../images/print.png" border="0"></a></div>');
        if($('div#sb-mylink')!=null){
                $('div#sb-mylink').remove();
        }
        newDiv.insertAfter($('div#sb-counter'));
        $('a#printMe').click(function(){
                    var theWork =  window.open('','PrintWindow');
                var html = "<html><head><title>Print An Image</title>";
                        html = html + "<link rel='stylesheet' href='../css/shadowbox.css' type='text/css' /><style>#sb-info{display:none;}div#sb-wrapper{left:20px !important;top:40px !important}</style></head>";
                        html = html + "<body><div id='myprint'>"+$('#sb-container').clone().html()+"</div></body></html>";
                        
                        theWork.document.open();
                        theWork.document.write(html);
                        theWork.document.close();
                        theWork.print();
                        theWork.close()
      return false;
                                                                  
        });
}

