function countResults(){
   // var aktivita ='';     var parameter ='';     var miesto ='';
    //$('input.checkMiesto:checked').each(function(){  miesto += ","+$(this).attr("value");    });     
    //$('input.checkParameter:checked').each(function(){  parameter += ","+$(this).attr("value"); });     
    //$('input.checkAktivita:checked').each(function(){ aktivita += ","+$(this).attr("value"); 
     //});
//   $('#debug').html("wapp/countResults.php?aktivita="+aktivita + "&parameter="+parameter +"&miesto=" + miesto); 
   //$('#vdatabaze').load("/wapp/countResults.php?aktivita="+aktivita + "&parameter="+parameter +"&miesto=" + miesto); 
    }
$(document).ready(function(){


$(".hmArea input[type=checkbox]").click(function(){
        if ($(this).attr('checked')) {
            $(this).attr('checked','');
            $(this).parent('div:eq(0)').removeClass('active2');
        }else{
            $(this).attr('checked','checked');
            $(this).parent('div:eq(0)').addClass('active2');
        }
    });

$(".potvrd").click(function(){ 
            $(this).parent('div:eq(0)').parent('div:eq(0)').hide('fast');
});

$(".hmgAreaItem").click(function(){
    //$('#vdatabaze').html("<img src='files/loader.worm.gif' >");
    $(this).children(":first").attr('checked',function(){
        var rel = $(this).attr('rel');
        var pocet = parseInt($("#csc"+rel+" > span").html()); 
        if ($(this).attr('checked')) {
            pocet = pocet-1;
            $(this).attr('checked','');
            $(this).parent('div:eq(0)').removeClass('active2');
            countResults();
        }else{
            pocet = pocet+1;
            $(this).attr('checked','checked');
            $(this).parent('div:eq(0)').addClass('active2');
            countResults();
        }
        $("#csc"+rel+" > span").html(pocet);
        if (pocet == 0) $("#csc"+rel).hide();
        else $("#csc"+rel).show();
      });
});


$(".hmoaAreaItem").click(function(){
    //$('#vdatabaze').html("<img src='files/loader.worm.gif' >");
    $(this).children(":first").click();
        var rel = $(this).attr('rel');
        countResults();
        $("#cseltit"+rel).html("<span class=red>"+$(this).attr("title")+"</span>");
//        if (pocet == 0) $("#csc"+rel).hide();
  //      else $("#csc"+rel).show();
});

$(".hmAreaItem").click(function(){
    //$('#vdatabaze').html("<img src='files/loader.worm.gif' >");
    $(this).children(":first").attr('checked',function(){
        var rel = $(this).attr('rel');
        var pocet = parseInt($("#csc"+rel+" > span").html()); 
        if ($(this).attr('checked')) {
            pocet = pocet-1;
            $(this).attr('checked','');
            $(this).parent('div:eq(0)').removeClass('active2');
            countResults();
        }else{
            pocet = pocet+1;
            $(this).attr('checked','checked');
            $(this).parent('div:eq(0)').addClass('active2');
            countResults();
        }
        $("#csc"+rel+" > span").html(pocet);
        if (pocet == 0) $("#csc"+rel).hide();
        else $("#csc"+rel).show();
      });
});
$(".hmAreaItem").hover(function(){
        $(this).addClass("active"); 
        var idf =  $(this).attr("rel");
      //  $("#hmAreaDesc-"+idf).show();
    },function(){
    
    $(".hmAreaItem").removeClass("active"); 
        $(".hmAreaDesc").hide();
    });

/*
    $(".hmAreaTitle").bind( 'drag', function( event ){
        //The div which you want to drag.
        $(this).parent().css({ top:(event.offsetY-document.body.scrollTop),left:(event.offsetX-document.body.scrollLeft)});
    });
    */
    $(".cselect").click(function(){
        var idf = $(this).attr("rel");
        $(".hmArea").hide();
        var pos = $("#nagSearch").offset();  
        var width = $("#nagSearch").width();
        $("#hmArea-"+idf).css( { "left": (pos.left + 15 ) + "px", "top": (pos.top+13) + "px" } );
        $("#hmArea-"+idf).show(  );
        //$("#hmArea-"+idf).fancybox();
    });


});

$(function(){
/*
$(".eur").mbTooltip({ // also $([domElement]).mbTooltip  >>  in this case only children element are involved
wait:10,           //before show
opacity:1,
cssClass:"default",  // default = default
timePerWord:70,      //time to show in milliseconds per word
hasArrow:true,         // if you whant a little arrow on the corner
hasShadow:true,
imgPath:"files/",
anchor:"mouse", //"parent"  you can ancor the tooltip to the mouse position or at the bottom of the element
shadowColor:"darkblue", //the color of the shadow
mb_fade:0 //the time to fade-in
});
*/
$('.obrazky a').lightBox({fixedNavigation:true});
});

function ccv(name){
        var pocet = $('#csid'+name+' input:checked').length ;
        $("#csc"+name+" > span").html(pocet);
        if (pocet == 0) $("#csc"+name).hide();
        else $("#csc"+name).show();

    }
    $(function() {
                $(".hasDatePicker").datepicker();
                    });
jQuery.fn.checkboxify = function() {
return this.each(function() {
jQuery(this).data('checked', jQuery(this).is(':checked'));

jQuery(this).click(function(){
    alert('aaa');
var radio = jQuery(this);

if (radio.data('checked')) {
radio.attr('checked', false).data('checked', false);
} else {
jQuery('input[name="' + radio.attr('name') + '"]', radio.parent()).attr('checked', false).data('checked', false);
radio.attr('checked', true).data('checked', true);
}
});
});
}

//jQuery('.unc').checkboxify();




