
  // Usess: jQuery;
  //        jquery.url;
  
  $(document).ready(function() {
    
    var Folder = {
      'similar' : 0,
      'other_positions' : 1,
      'comments' : 2,
      'notice': 3
    }
    var Anchor = $.url.attr("anchor");
    var PrevIndex = (Anchor != null || Anchor == '') ? Folder[Anchor] : 0 ;
    
    $("div#module_menu_content div.folder_content").eq(PrevIndex).css('display', 'block');
    $("ul#module_folders li").eq(PrevIndex).removeClass('inactive').addClass('active');
    
    $("ul#module_folders li").click(function() {
      
      Index = $("ul#module_folders li").index(this);
      
      $("ul#module_folders li").removeClass('active').addClass('inactive');
      
      $(this).removeClass('inactive').addClass('active');
      
      $("div#module_menu_content div.folder_content").eq(PrevIndex).fadeOut(100, function() {
        $("div#module_menu_content div.folder_content").eq(Index).fadeIn(200);
        PrevIndex = Index;
      });
    });
    
    
    // Zabezpieczenie przed Botami!
    $('form#module_comments_form').prepend("<input type='hidden' name='confirm' value='1' />");
    
    $("form#module_comments_form div.row_footer a").click(function() {    
      var OK = true;
      $('.module_inp').each(function(i) {
        field_name = $(this).attr('name');
        if (field_name == 'nick' || field_name == 'msg' ) {
          if ($(this).val() == '') {
            alert("Nie wypełniono wymaganych pól!");
            OK = false;
            return false;
          }
        }
      });
      
      if (OK) {
        $(this).fadeOut(100);
        $(this).parent().parent().css('opacity', 0.4).submit();
        return true;
      }
      else {
        return false;
      }
    });
    
    // Zabezpieczenie przed Botami!
    $('form#module_notice_form').prepend("<input type='hidden' name='confirm' value='1' />");
    
    $("form#module_notice_form div.row_footer a").click(function() {    
      var OK = true;
      $('.notice_inp').each(function(i) {
        field_name = $(this).attr('name');
        if (field_name == 'nick_from' || field_name == 'nick_to' || field_name == 'mail') {
          if ($(this).val() == '') {
            alert("Nie wypełniono wymaganych pól!");
            OK = false;
            return false;
          }
        }
      });
      
      if (OK) {
        $(this).fadeOut(50);
        $(this).parent().parent().css('opacity', 0.4).submit();
        return true;
      }
      else {
        return false;
      }
    });
    
    setTimeout("$('div#module_result').fadeOut(100)", 2000);
    
  })
  
