+ // Hide sourceport area when no sourceport is used
+ if (! \$("#USE_SRC_PORT").attr("checked")) {
+ toggle_elements('srcport');
+ }
+ // Hide targetport area when no targetport is used
+ if (! \$("#USESRV").attr("checked")) {
+ toggle_elements('targetport');
+ }
+ // When nat not used, hide it
+ if (! \$("#USENAT").attr("checked")) {
+ toggle_elements('natpart');
+ }
+ // When Prot not icmp, hide icmp-types
+ if (! \$("#PROT option[value='ICMP']").attr('select')) {
+ document.getElementById('PROTOKOLL').style.display='none';
+ }
+ // When protocol dropdown is changed, check if we selected icmp - then show icmp-types
+ \$("#prt").change(function(){
+ if ( document.getElementById("PROT").value === 'ICMP' ){
+ document.getElementById('PROTOKOLL').style.display='block';
+ }
+ else{
+ document.getElementById('PROTOKOLL').style.display='none';
+ }
+ });
+ // Show Sourceport area when "use sourceport" checkbox is clicked
+ \$( "#spt" ).click(function() {
+ toggle_elements('srcport');
+ });
+ // Show Targetport area when "use Targetport" checkbox is clicked
+ \$( "#tpt" ).click(function() {
+ toggle_elements('targetport');
+ });