/* 
 * Javascript für Material
 */

function initMaterial(){
    $('#naviRight').hide();
    $('a.big').show();

    //Lightbox
    $('a.big').lightBox(); // Select all links with lightbox class

    // Accordion
    $("#accordion").accordion({
        header: "h3"
    });

    //hover states on the static widgets

    $('#dialog_link, ul#icons li').hover(
        function() {
            $(this).addClass('ui-state-hover');
        },
        function() {
            $(this).removeClass('ui-state-hover');
        }
        );

    // ImageSlider

    $("img.thumb:first").animate({
        "opacity": 1
    }, "slow");

    $("img.thumb").click(function () {

        var position = $(this).attr("value");
        var chainWidth = -293;

        $("#picturesChain").animate({
            "left": position*chainWidth
        }, "slow");
        $("img.thumb").animate({
            "opacity": 0.5
        }, "slow");
        $(this).animate({
            "opacity": 1
        }, "slow");

    });
    $('td.value:empty').parent('tr').remove();
}

function ajaxGetMaterialPage(id){
    $.ajax({
        type: "GET",
        url: "material/materialPage.jsp",
        dataType:"html",
        data:"id="+id,
        success:
        function(data){
            $("#content").html(data);
            initMaterial();
        },
        error:
        function (xhr){
            alert(xhr.status+" "+xhr.statusText);
        }
    });
}

function ajaxGetResultOfMaterialSearchPage(){
    alert('Diese Funktion wird noch nicht unterstützt!');
}
