var menu_hide_timer = 0;
var qwe;

$(document).ready(
  function()
  {
  		isIE6 = !$.support.opacity && !window.XMLHttpRequest;
  		
      $('.mod_goals-switcher').click(
        function()
        {
          var sender = $(this);
          $('.goal-tab').hide();
          if ($('#current_tab').val() == '1')
          {
            $('.goal-tab2').show();  
            $('#current_tab').val('2');
            $('.mod_goals-switcher').attr('src','/templates/juv_ftheme/images/mod_goals-tab2.png');            
          }
          else
          {          
            $('.goal-tab1').show();  
            $('#current_tab').val('1');
            $('.mod_goals-switcher').attr('src','/templates/juv_ftheme/images/mod_goals-tab1.png');            
          }              
        }
      );
      
		  $('.menu-item').mouseover(
		    function()
		    {
		      menuMouseover();
		      
		      $('.menu-subitems').css({left:'-10000px'});
		      $('p', $('.menu-item')).removeClass('active');
		      
		      var left = $(this).attr('offsetLeft'); 
		      var item_id = $(this).attr('class').replace(/^[\D]*/,'').replace(/[\D]*$/,'');
		      var width = $('.menu-block').width();
		            
		      $('.menu-subitems-'+item_id).css({left:left+'px'});
		      $('p', $('.menu-item-'+item_id)).addClass('active');
		    }
		  ).mouseout(
		    function()
		    {
		      menuMouseover();
		    }
		  );
		  
		  $('.menu-subitems').mousemove(
		    function()
		    {
		      menuMouseover();
		    }
		  );
      
      $('.menu-item').mousemove(
        function()
        {
          menuMouseover();
        }
      );

      $('.mod_poll-answer-center').hover(
        function()
        {
          $(this).css('text-decoration','underline');
        },
        function()
        {
          $(this).css('text-decoration','none');
        }
      ); 
      
      $('.hn').hide();
            
      $('.inp', $('#acbook-table')).parent().parent().hide();
      
      $('.mod_tournament-table tr').show();
      var scrolls = $('.scroll-pane').jScrollPane({showArrows:true, scrollbarWidth:11, dragMaxHeight:48, animateTo:true, animateInterval:50, animateStep:5});
      setTimeout(
    			function()
    			{    				
		      	scroll_to = $('.mod_tournament-table').attr('scroll_to');
		      	if (scrolls.length == 2)
		      		scrolls[1].scrollTo('.mod_tournament-table-index[command_id="'+scroll_to+'"]')
		      	else if (scrolls.length == 1)
		      		scrolls[0].scrollTo('.mod_tournament-table-index[command_id="'+scroll_to+'"]')
		      	else return;
		      }
    	,600);
      
      $('.blog_list .list .content-head').corner('6px');
      
  		if (!isIE6)
  		{
  			$('.blog_list .list .content-head').append('<img src="/templates/juv_ftheme/images/list_item_title_star1.png" title="" alt="" class="star1" /><img src="/templates/juv_ftheme/images/list_item_title_star2.png" title="" alt="" class="star2" />');
  		}
  		
  }
);

function menuMouseover()
{
  clearTimeout(menu_hide_timer);
  menu_hide_timer = setTimeout(
    function(){
      $('.menu-subitems').css({left:'-10000px'});
      $('p', $('.menu-item')).removeClass('active');              
    }
  ,1500);
}

function doVote(id)
{
  //$('#voteid').val($('#'+id).val());
  $('#vote-form').submit();    
}

function banner_mail()
{
  document.write("<a href='http://www.liveinternet.ru/click' target=_blank><img src='http://counter.yadro.ru/hit?t26.2;r"+escape(document.referrer)+((typeof(screen)=="undefined")?"":";s"+screen.width+"*"+screen.height+"*"+(screen.colorDepth?screen.colorDepth:screen.pixelDepth))+";u"+escape(document.URL)+";"+Math.random()+"' alt='' title='LiveInternet:' border=0 width=88 height=15><\/a>");
}
function banner_mail2()
{
  document.write('<a href="http://top.mail.ru/jump?from=391922" target=_top><img src="http://da.cf.b5.a0.top.list.ru/counter?id=391922;t=52;js='+js+a+';rand='+Math.random()+'" alt="Рейтинг@Mail.ru"'+' border=0 height=31 width=88></a>');
}