/*sem dávat, jenom když hrozí že se to bude načítat ajaxem*/
function domready() {
    Shadowbox.init({
        handleOversize:     "drag",
        animate: false,
        animateFade: false
    });
    loadFlash();


    /* zkracování odstavců */
    $('#about').condense({
        moreText: 'více <img src="/media/Image/visual/kempy/dropDownArrow.jpg" />',
        lessText: 'skrýt <img src="/media/Image/visual/kempy/backToTop.jpg" />',
        ellipsis: '...',
        condensedLength: 600
    });

    /*vyjížděcí box*/
    $("#toggleInfoText").click(function () {
        $("#additionalInfoText").toggle('blind',{
            direction: "down"
        }, 200);
    });
    $("#additionalInfoText").click(function () {
        $("#additionalInfoText").toggle('blind',{
            direction: "down"
        }, 200);
    });

    
    /*palce*/
    $(".palec_ano").click(function () {
        palce(this,'ano');
    });   
    $(".palec_ne").click(function () {
        palce(this,'ne');
    }); 
    
    /*pridat prispevek*/
    $(".pridat_prispevek").click(function (){
        $("#pridat_prispevek").slideToggle(500);
    });     
    
    
    /*ukázat uživatelský profil     */
    $(".showUserProfile").mouseenter(function (){
        toggleUserInfo(this,1);
    });  
    $(".showUserProfile").mouseleave(function (){
        toggleUserInfo(this,0);
    });  
    
    /*vyhledávací form selekty*/
    $(".advancedSearch .region").change(function (){
        nullSearchFromSelects(this);
    });           
}

$(document).ready(function () {
    /*našeptávač*/
    var url = window.location;
    var ln = '';
    if((url+'').indexOf('/de/')>0)
        ln = '/de';
    else if((url+'').indexOf('/nl/')>0)
        ln = '/nl';
    else if((url+'').indexOf('/es/')>0)
        ln = '/es';
    else if((url+'').indexOf('/fr/')>0)
        ln = '/fr';
    else if((url+'').indexOf('/pl/')>0)
        ln = '/pl';
    
    $("#fulltext").autocomplete({ 
        "source": "/index.php?page=fulltext_naseptavac&include=yes",
        "html": true,
        "select":function(event,ui){
            $(location).attr('href',ui.item.link); 
        }
    });
    /*cookie trail*/
    $(".cookieTrailToggle").click(function () {
        showHideCookieTrail (this);
    });

    /* ovladani rozbalovani na detailu */
    /* $("#infoContent .toggleEquip").click(function () {
        var child=$(this).children(".equipContent");
        $(child[0]).slideToggle("slow");
        $(this).toggleClass("toggleEquipShown", 500);
    });*/
    
    /*zkracování vybavení na detailu*/    
    $("#infoContent .toggleBttn").click(function () {
        showHideVybaveni(this);       
    });
    
    
    
    $("#infoContent .toggleAll").click(function () {
        if ($(this).hasClass('up')) {
            $(this).children("a").each(function (index, item){
                $(item).html('zobrazit vše'); 
            });
            $(this).children("img").each(function (index, item){
                $(item).attr('src',"/media/Image/visual/kempy/toggleDown.png");
            });   
            $("#infoContent .toggleBttn").each(function (index, item){
                showHideVybaveni(item,2);       
            });    
             
            $(this).removeClass("up");
        } else {
            $(this).children("a").each(function (index, item){
                $(item).html('skrýt vše');
            });
            $(this).children("img").each(function (index, item){
                $(item).attr('src',"/media/Image/visual/kempy/toggleUp.png");
            });          
            $("#infoContent .toggleBttn").each(function (index, item){
                showHideVybaveni(item,1);       
            });  
            $(this).addClass("up");
        }
        
    });

    /*tooltips*/
    $(".tooltip").tooltip({
        track:"true",
        showBody:"::",
        showURL:false
    });

    /* validator formularu */
    $("form").validationEngine({
        promptPosition : "topLeft"
    });
    
    
    /*get lista link*/
    /*$(".lista_box").mouseenter(function () {
      listaLink(this, 1);
    });
    $(".lista_box").mouseleave(function () {
      listaLink(this, 0);
    });*/
    
    
    /*ceníky na detailu*/
    $("#In_Day, #In_Month, #In_Year, #Out_Day, #Out_Month, #Out_Year").change(function() {
      getCeny();
    }); 
    
    $("#f_trigger_a, #f_trigger_b").bind("dateChanged", function(){
      getCeny();  
    });
    
    
    domready();
});



