//JQUERY Settings

jQuery(document).ready(function () {

    $('#slideshow').cycle({
        fx: 'fade',
        speed: 800,
        timeout: 4000,
        pager: '#slideshow-nav div'
    });
    if ($('#slideshow li').length > 1) {
        $("#slideshow-nav").css({ display: 'block' });
    };
    $("#slideshow li a").each(function (index) {
        $(this).append("<span class='slideshow-caption'><span class='title'>" + $(this).find("img").attr("alt") + "</span><span class='text'>" + $(this).find("img").attr("longdesc") + "</span></span>");
    });

    $("a[rel^='prettyPhoto']").prettyPhoto({
        theme: 'light_square' /* light_rounded / dark_rounded / light_square / dark_square / facebook */
    });
    $("ul.gallery").prettyGallery({
        itemsPerPage: 4,
        of_label: ' / ' /* The content in the page "1 of 2" */
    });

    //Menu fix for shitty IE6
    $("#nav li").hover(function () { $(this).addClass("hover"); $(this).find(".dropdown").css({ display: 'block' }); }, function () { $(this).removeClass("hover"); $(this).find(".dropdown").css({ display: 'none' }); });

    //Fake Hover/Click
    $(".head-image-slide li").hover(function () {
        $(this).addClass("fake-hover");
    }, function () {
        $(this).removeClass("fake-hover");
    });

    $(".lang ul li a").hover(function () {
        $("#show").text($(this).attr("title")).show();
    }, function () {
        $("#show").hide();
    });

    // Nwl focus
    var nwlTxt = $('.nwl-register input').attr('value');
    $(".nwl-register input").focus(function () {
        if ((this.value == '') || (this.value == nwlTxt)) {
            $(this).val('');
        }
    });
    $(".nwl-register input").blur(function () {
        if (this.value == '') {
            $(this).val(nwlTxt);
        }
    });
    // Nwl submit
    $('.nwl-register input').keypress(function (event) {
        if (event.keyCode == '13') {
            var labelTxt = $('.nwl-register input').attr('value');
            if (labelTxt == '') { alert("Email missing :("); }
            else {
                window.open("newsletter.aspx?email=" + labelTxt, "_top");
                return false;
            }
        }
    });
    $('#nwl-submit').click(function () {
        var labelTxt = $('.nwl-register input').attr('value');
        if (labelTxt == '') { alert("Email missing :("); }
        else {
            window.open("newsletter.aspx?email=" + labelTxt, "_top");
            return false;
        }
    });

    $("a[rel^='prettyPhoto']").prettyPhoto({
        theme: 'light_square' /* light_rounded / dark_rounded / light_square / dark_square / facebook */
    });

    //Tab switcher na objektu
    $(function () {
        var tabContainers = $('.tabs_box');
        tabContainers.hide().filter(':first').show();

        $('.switch_battun a').click(function () {
            tabContainers.hide();
            tabContainers.filter(this.hash).show();
            $('.switch_battun a').removeClass('active');
            $(this).addClass('active');
            return false;
        }).filter(':first').click();
    });

    //kraj
});



