/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


function ct (obj) {
    obj.target = '_blank';
}

function showJSONSlideshow (url) {
    $.getJSON(url,function(data){
        $("#fancy_images").remove();
        var imgs = $("<div id=\"fancy_images\"/>").hide().appendTo("#content");
        $.each(data, function(i,item){
            $("<a/>").attr("rel", item.gruppe).addClass("json-im").appendTo($(imgs)).attr("href", item.href).attr("title", item.titel+"|"+item.text).append(
                $("<img/>")
                .attr("src", item.href)
                );
        });
        $("#fancy_images a.json-im").fancybox( {
            margin          :   5,
            padding        :    5,
            overlayOpacity  :   0.6,
            showNavArrows   :   true,
            centerOnScroll  :   true,
            titlePosition   :   'inside',
            titleFormat     :   function(title, currentArray, currentIndex, currentOpts) {
                var parts = title.split("|");
                var titleTag = $("<div/>");
                //$(titleTag).append("<span class=\"arrow_left\"/>");
                $(titleTag).append("<h3 style=\"text-align:left;margin:0 35px;padding:0\">"+parts[0]+"</hr>").append("<p style=\"margin:5px 35px;text-align:left\">"+parts[1]+"</p>");
                //$(titleTag).append("<span class=\"arrow_right\"/>");
                return $(titleTag).html();
            }
	} );
        $("#fancy_images a:first").trigger('click');
    
    });
}