﻿    function SetScreen()
    {
       document.getElementById("<%=hiddW.ClientID%>").value = screen.width;
       document.getElementById("<%=hiddH.ClientID%>").value = screen.height;
   }

   $(function () {

        //slider homePage
       if ($('#pruhAkce .item').length > 1) {
           $('.slider').mobilyslider({
               content: '.sliderContent',
               children: 'div',
               transition: 'horizontal',
               animationSpeed: 400,
               autoplay: true,
               autoplaySpeed: 8000,
               pauseOnHover: true,
               bullets: true,
               arrows: true,
               arrowsHide: true,
               prev: 'prev',
               next: 'next',
               animationStart: function () { },
               animationComplete: function () {
                   //$('#tx').append($('#pruhAkce #bonus').css("zIndex")); //pro zjištění z-indexu
                   var bonusIndex = $('#pruhAkce #bonus').css("zIndex");

                   $('#pruhAkce').removeAttr('class')
                   // nastavení css stylu v nejvyšším prvku - zjištění dle z-indexu
                   if (bonusIndex == 4) {
                       $('#pruhAkce').addClass('bonus')
                   }
               }
           });
       }

   });

    $(document).ready(function () {

        //horni hlavni menu
        var hoverColour = "#FFF";
        // $("#xx").css("color", hoverColour);

        $(this).attr("class", "");
        var $odkazMn02 = $("#menu02 ul li:not(.selected) a");
        $odkazMn02.addClass("js");
        $odkazMn02.hover(
            function () {
                $(this).children("SPAN").animate({ "color": hoverColour }, 200);
                $(this).stop(true, true).animate({ paddingTop: "48px", backgroundPosition: "(0 0)", "color": hoverColour }, 200);
                $(this).animate({ backgroundPosition: "(0 -6px)", paddingTop: "42px" }, 150);
            },
            function () {
                $(this).stop(true, true)
                $(this).animate({ backgroundPosition: "(0 -95px)", paddingTop: "18px", "color": "black" }, 200);
                $(this).children("SPAN").animate({ "color": "#797979" }, 200);
            });



        //Login Panel
        //      Expand Panel
        $("#open").click(function () {
            $("#hlavicka, #hlavicka .column-in").css("z-index", "40");
            $("div#log-panel").slideDown("slow");
        });
        //      Collapse Panel
        $("#close").click(function () {
            $("div#log-panel").slideUp("slow", function () { $("#hlavicka, #hlavicka .column-in").css("z-index", "192"); });
        });
        //      přepnout ikonu
        $("#toggle a").click(function () {
            $("#toggle a").toggle();
        });


        //default page - akce
        $("#pruhAkce .bonus").parent().addClass("bonus");


        //prave menu
        var $menuUL = $("#rMenu .mn UL");
        if ($menuUL.length) {
            $menuUL.treeview({
                collapsed: true,
                animated: "normal",
                persist: "selected"
            });
        };

        //prave menu partner
        var $menuULPartner = $(".mnPartner UL");
        if ($menuULPartner.length) {
            $menuULPartner.treeview({
                collapsed: true,
                animated: "normal",
                persist: "selected"
            });
        };


        //linka u formularových polí
        $(".wiz tr td:first-child").addClass("formLabel");

        //kulate rohy
        $(".btZv01").corner("cc:#E5E5E5 6px");
        $(".btZv03").corner("cc:#A8D739 6px");
        $(".tZv02").corner("cc:#E5E5E5 6px");
        $(".btC").corner("cc:#E5E5E5 6px");
        $(".btC2").corner("cc:#272727 6px");
        $(".btZ").corner("cc:#E5E5E5 6px");
        $(".btS").corner("cc:#E5E5E5 6px");
        $(".btS-Sel").corner("cc:#E5E5E5 6px");

        $(".kalkCena").corner("cc:#E5E5E5 6px");


        //panel TIP s kulatymi rohy
        var $pnlTip = $('#centerPanel .pnlTip')
        $pnlTip.wrapInner('<div class="pnlTip-in"></div>');
        $pnlTip.children("#centerPanel .pnlTip-in").corner("round tl tr 6px")
                                .append("<div class='zapati'></div>")
                                .parent().css('padding', '1px')
                                .corner("cc:#E5E5E5 tl tr 6px")
                                .corner("cc:#E5E5E5 6px bl br sc:#97D220");


        //icony u odkazu s typem souboru
        $("a[href$='.pdf']").addClass("pdf");
        $("a[href$='.txt'], a[href$='.rft']").addClass("txt");
        $("a[href$='.doc'], a[href$='.docx'], a[href$='.dot']").addClass("doc");
        $("a[href$='.xls'], a[href$='.xlsx']").addClass("xls");
        $("a[href$='.zip'], a[href$='.rar']").addClass("zip");
        $("li a[href$='.jpg'],li  a[href$='.png'], li a[href$='.gif']").addClass("jpg");
        $("a[href^='mailto:']").addClass("email");
        $('a').not(".btC, .btC2").filter(function () {
            //Compare the anchor tag's host name with location's host name
            return this.hostname && this.hostname !== location.hostname;
        }).addClass("external");



        //u tabulky "tAlter" nastavit alternativní rádkování
        $('.tAlter tr:even td').addClass("alter");


        //$('input').customInput();
        $('input').checkBox({ addVisualElement: false });

        // zmena obrazku CallMeBack
        $('#ctl00_ctl00_cpPanel_ContentPlaceCenter_KontaktFormPartner1_ImgCallMeBack')
		.hover(function () {
		    $(this).attr("src", "/Images/callMeBack_sel.png");
		},
		function () {
		    $(this).attr("src", "/Images/callMeBack.png");
		});



        $('.nyroModal').nyroModal();


    });




//nové funkce pro nahodný číslo
jQuery.extend({
    random: function (X) {
        return Math.floor(X * (Math.random() % 1));
    },
    randomBetween: function (MinV, MaxV) {
        return MinV + jQuery.random(MaxV - MinV + 1);
    }
});


// nová funkce pro AJAX
jQuery.fn.extend({
    AjaxReady: function (fn) {
        if (fn) {
            return jQuery.event.add(this[0], "AjaxReady", fn, null);
        } else {
            var ret = jQuery.event.trigger("AjaxReady", null, this[0], false, null);
            // if there was no return value then the even validated correctly 
            if (ret === undefined)
                ret = true;
            return ret;
        }
    }
});


$(document).AjaxReady(function () {
        $("#centerPanel .btC").corner("cc:#E5E5E5 6px");

  
    $(".btZ").corner("cc:#E5E5E5 6px");
    $(".btS").corner("cc:#E5E5E5 6px");
    $(".btS-Sel").corner("cc:#E5E5E5 6px");

    $(".btZv01").corner("cc:#E5E5E5 6px");
    $(".tZv02").corner("cc:#E5E5E5 6px");

    $(".kalkCena").corner("cc:#E5E5E5 6px");

    $("a[href^='mailto:']").addClass("email");


    //panel TIP s kulatymi rohy
    var $pnlTip = $('#centerPanel .pnlTip')
    $pnlTip.wrapInner('<div class="pnlTip-in"></div>');
        $pnlTip.children("#centerPanel .pnlTip-in").corner("round tl tr 6px")
                                .append("<div class='zapati'></div>")
                                .parent().css('padding', '1px')
                                .corner("cc:#E5E5E5 tl tr 6px")
                                .corner("cc:#E5E5E5 6px bl br sc:#97D220");



});  
