/*sem dávat, jenom když hrozí že se to bude načítat ajaxem*/
function domready() {
    Shadowbox.init();
    loadFlash();


    /* zkracování odstavců */
    $('#about').condense({
        moreText: 'více <img src="/media/Image/visual/penziony/dropDownArrow.jpg" />',
        lessText: 'skrýt <img src="/media/Image/visual/penziony/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č*/
    
    //alert('ok');
    
    $("#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/penziony/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/penziony/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").bind("dateChanged", function(){
      getCeny();  
    });
    $("#f_trigger_b").bind("dateChanged", function(){
      getCeny();  
    });    
           
    domready();
});



