//slideshow ajax
jQuery(document).ready(function(){

    jQuery("#loader").html('<img src="fileadmin/img/dreambowl/ajax-loader.gif" alt="lade..." />');
    loadSlideshow(null);
    
    
    
    
    
    function loadSlideshow(id){
        jQuery.ajax({
            url: "index.php",
            type: "POST",
            async: true,
            data: {
                eID: "slideshow_eID", // die erstellte eID
                id: "61",
                input: id
            },
            dataType: "json",
            success: function(response){
                //if (response.length > 0) {
                jQuery("#slideshow_container").html(response.html);
				jQuery("#slideshow_nav li.active img").attr("src", "typo3conf/ext/dreambowl_slideshowbox/pi1/icon_foto.png")
                jQuery("#slideshow_nav_1").click(function(){                    
                    loadSlideshow(0);                    
                });
                
                jQuery("#slideshow_nav_2").click(function(){
                    loadSlideshow(1);
                });
                
                jQuery("#slideshow_nav_3").click(function(){					
                    loadSlideshow(2);
                });
                
                jQuery("#slideshow_nav_4").click(function(){
                    loadSlideshow(3);
                });
                
                jQuery("#slideshow_nav_5").click(function(){
                    loadSlideshow(4);
                });
                jQuery("#slideshow_nav_6").click(function(){
                    loadSlideshow(5);
                });				
                //}
            },
            error: function(x, e){
                var err_text = "";
                if (x.status == 0) {
                    err_text = 'Server Connection Error.';
                }
                else 
                    if (x.status == 404) {
                        err_text = 'Requested URL not found.';
                    }
                    else 
                        if (x.status == 500) {
                            err_text = 'Internal Server Error.';
                        }
                        else 
                            if (e == 'parsererror') {
                                err_text = 'Error:\nParsing JSON Request failed.';
                            }
                            else 
                                if (e == 'timeout') {
                                    err_text = 'Request Time out.';
                                }
                                else {
                                    err_text = 'Unknow Error:\n' + x.responseText;
                                }
                alert(err_text);
            }
        });
    }
});

