$(function() {

  $( "#logindialog" ).dialog({
    autoOpen: false,
    show: 'fade',
    hide: 'fade',
    width: 300
  });

  $('#loginlink').click(function(){
    $('#logindialog').dialog('open');
    return false;
  });
});

$(function() {

    $( "#bannerdialog" ).dialog({
        autoOpen: false,
        show: 'fade',
        hide: 'fade',
        width: 540
    });

    $('#bannerlink').click(function(){
        $('#bannerdialog').dialog('open');
        return false;
    });
});

$(function() {

  $( "#polldialog" ).dialog({
    autoOpen: false,
    width: 450
  });

  $('#polllink').click(function(){
    $('#polldialog').dialog('open');
    return false;
  });
});

$(document).ready(function(){
    $('#topmenu li.sublnk').hover(
    function() {
      $(this).addClass("selected");
      $(this).find('ul').stop(true, true);
      $(this).find('ul').show('fast');
    },
    function() {
      $(this).find('ul').hide('fast');
      $(this).removeClass("selected");
    }
  );
});

function complaint( post_id ) {
  var text = $('#complaint form textarea').val();    if( !text ){ DLEalert("А жалобу кто писать будет?<br />Среди администрации телепатов нет!", "Ошибка!"); return false; }
  if( text.length<10 ){ DLEalert( "Краткость безупречно сестра таланта, но не на столько же...<br />", "Ошибка!" ); return false; }    ShowLoading('');
  $.get(dle_root + "engine/ajax/complaint.php", { text: text, post_id: post_id }, function(data)
    {
      HideLoading('');
      $("#complaint").fadeOut(500, function()
        {
          $(this).html(data);
          $(this).fadeIn(500);
        }
      );
    }
  );
};


$(document).ready(function(){
  var tabContainers = $('#news-arch .tabcont');
    tabContainers.hide().filter(':first').show();
                
    $('#news-arch .tabmenu a').click(function () {
      tabContainers.hide();
      tabContainers.filter(this.hash).show();
      $('#news-arch .tabmenu a').removeClass('selected');
      $(this).addClass('selected');
      return false;
    }).filter(':first').click();
});
