$(document).ready(function(){ if($('.listelement .element').find('.dispnone').length >= 1){ $(this).find('.listelement .title').css('cursor','pointer'); $(this).find('.listelement .title').prepend(" "); $(this).find('.listelement .title').data('toggle','0'); $('.listelement .title').click(function(){ $(this).siblings('.dispnone').toggle(); if($(this).data('toggle') == '0'){ $(this).data('toggle','1'); $(this).find('.toggler img').attr('src','/media/img/down.png') } else{ $(this).data('toggle','0'); $(this).find('.toggler img').attr('src','/media/img/right.png') } }); } }); function checkAllCheckBoxes(exceptions) { var elements = document.getElementsByTagName('input'); if(!elements) { return; } var countElements = elements.length; var countExceptions; if(exceptions) { countExceptions = exceptions.length; } else { countExceptions = 0; } var foundException = false; if(!countElements) { if(elements.getAttribute('type') == 'checkbox') { for(var j = 0; j < countExceptions; j++) { if(elements.getAttribute('name') == exceptions[j]) { foundException = true break; } } if(!foundException) { elements.checked = true; } foundException = false; } } else { for(var i = 0; i < countElements; i++) { if(elements[i].getAttribute('type') == 'checkbox') { for(var j = 0; j < countExceptions; j++) { if(elements[i].getAttribute('name') == exceptions[j]) { foundException = true break; } } if(!foundException) { elements[i].checked = true; } foundException = false; } } } } function uncheckAllCheckBoxes(exceptions) { var elements = document.getElementsByTagName('input'); if(!elements) { return; } var countElements = elements.length; var countExceptions; if(exceptions) { countExceptions = exceptions.length; } else { countExceptions = 0; } var foundException = false; if(!countElements) { if(elements.getAttribute('type') == 'checkbox') { for(var j = 0; j < countExceptions; j++) { if(elements.getAttribute('name') == exceptions[j]) { foundException = true break; } } if(!foundException) { elements.checked = false; } foundException = false; } } else { for(var i = 0; i < countElements; i++) { if(elements[i].getAttribute('type') == 'checkbox') { for(var j = 0; j < countExceptions; j++) { if(elements[i].getAttribute('name') == exceptions[j]) { foundException = true break; } } if(!foundException) { elements[i].checked = false; } foundException = false; } } } }