var mouse_is_inside = false;
// @ skrytie multiselect boxu po kliknuti kdekolvek na body, okrem divu sameho
$(document).ready(function() {
$("#multiSelect_touroperator_box").live({
mouseenter:
function() {
mouse_is_inside=true;
},
mouseleave:
function() {
mouse_is_inside=false;
}
}
);
$("body").mouseup(function(){
if(! mouse_is_inside) $('#multiSelect_touroperator_box').slideUp();
});
});
function checkedTouroperator($item) {
$item.attr("checked", "checked");
$item.parent().parent().parent().find('.touroperatorGroupCheckbox').attr("checked", "checked");
}
function uncheck_multiselect_touroperator() {
$('#multiSelect_touroperator_box input:checked').attr("checked", false);
calculate_touroperator_count();
}
function calculate_touroperator_count() {
$touroperators = $("input.touroperatorCheckbox:checked").length;
$groups = 0;
$count = $touroperators + $groups;
$('input[name="toccount"]').val($count);
// ak nie je vybrana ziadna polozka
if ($count>0) {
$('#multiSelect_touroperator_box_filter').html('Zrušiť voľbu');
} else $('#multiSelect_touroperator_box_filter').html('');
if ($count==0) {
$('#touroperator_drop').html('Všetci touroperátori');
} else if ($count<5) {
var $title = '';
$('input[name="touroperator[]"]:checked').each(function(index) {
if ($title!='') $title = $title + '; ';
$title = $title + $(this).attr('title');
});
$('#touroperator_drop').html($title + ' (' + $count + ')');
} else {
$('#touroperator_drop').html('Touroperátori (' + $count + ')');
}
$('input[name="groupOpi[]"]:checked').each(function(index) {
$li = $(this).parent();
$unchecked = $li.find('ul input[name="touroperator[]"]').not(':checked');
$checked = $li.find('ul input[name="touroperator[]"]:checked');
if ($checked.length==0) {
$(this).attr("checked", false);
}
if ($unchecked.length==0) {
$li.removeClass('notAllSelected');
} else {
$li.addClass('notAllSelected');
}
});
}
function loadMultiSelectTouroperator() {
$('ul#multiSelect_touroperator_ul').collapsibleCheckboxTree({
checkParents : true, // When checking a box, all parents are checked (Default: true)
checkChildren : true, // When checking a box, all children are checked (Default: false)
uncheckChildren : true, // When unchecking a box, all children are unchecked (Default: true)
initialState : 'expand' // Options - 'expand' (fully expanded), 'collapse' (fully collapsed) or default
});
$('ul#multiSelect_touroperator_ul .collapsed').click();
}
function InicializateMultiSelectTouroperator() {
$('#touroperator_drop').live("click", function() {
$box = $('#multiSelect_touroperator_box');
if ($box.is(':visible')) {
$box.slideUp();
} else {
$box.slideDown();
}
});
$('#multiSelect_touroperator_box').live("click", function() {
mouse_is_inside=true;
}, function() {
//mouse_is_inside=false;
});
$('input[name="touroperator[]"]').live("click", function() {
calculate_touroperator_count()
});
$('input[name="groupOpi[]"]').live("click", function() {
calculate_touroperator_count()
});
}