// JavaScript Document
$(document).ready(function(){
		$('#top_menu ul ul').each(function(index)
					{	
						$(this).parent().hover(
									  function () {
									   $('.top_menu').animate({height: "280px"},300);
										  $(this).children().next().fadeIn(700);
										  },
									  function () {
									  $('.top_menu').height(170)
										  $(this).children().next().hide();
										  }
										  
									  )
					});
					
		$('.left_menu ul .bg_submenu').each(function(index)
      {
       $(this).parent().hover(
         function () {
               $(this).children().addClass("hover");
               $(this).css({'z-index' : '20000'});
               $(this).children().next().fadeIn(400);
         },
         function () {
               $(this).css({'z-index' : '0'});
               $(this).children().next().hide();
               $(this).children().removeClass("hover");
        }
      )
      });			
				
    $('.item .pravo table tr').each(function(){
        $(this).children('td:first').addClass("td_style");
    })
    
      /*  $('.element_detail table tr:first').addClass("td_style");*/  
    $('.element_detail table tr').each(function(){
        $(this).children('td:first').addClass("td_style");
    })
    
    // IMG Hover
    $('.element .pic a').click(function(){
      return false;
    });
    $('.element .pic a').hover(function(){
      var img_real = $(this).attr('href');
      var img_src = $(this).children('img').attr('src');
      $(this).attr('href',img_src);
      //$(this).fadeTo(500,0.5);
      $(this).children('img').attr('src',img_real);
      $(this).children('img').addClass('img_hover');
    }, function(){
      var img_src = $(this).attr('href');
      var img_real = $(this).children('img').attr('src');
      $(this).attr('href',img_real);
      //$(this).fadeTo(500,1);
      $(this).children('img').attr('src',img_src);
      $(this).children('img').removeClass('img_hover');
    });
    // END IMG Hover


	
    // certificates
    $('.certificates ul li').hover(function(){
      $(this).children('ul').show('800');
    },function(){
      $(this).children('ul').hide('800');
    });
    // END certificates
    
    // Навигация
    $('.content').each(function(index){
      var nav = $('.nav_pp').html();
      var nav_p = '<p>' + nav + '</p>';
      if( nav != null ){$('.content h1').after(nav_p);} //prepend()
    });
    // END Навигация 
		
		/*
		$(".element .pic").each(function(){
		    $(this).hover(
		      function(){
            $(this).children('img').width("262px");
            $(this).addClass("zindex");
          },
          function(){
            $(this).children('img').width("154px");
            $(this).removeClass("zindex");
          }
        )
    })  */

    
    	function formatText(index, panel) {
		  return index + "";
	    }
    
        $(function () {
        
            $('.anythingSlider').anythingSlider({
                easing: "easeInOutExpo",        // Anything other than "linear" or "swing" requires the easing plugin
                autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
                delay: 3000,                    // How long between slide transitions in AutoPlay mode
                startStopped: false,            // If autoPlay is on, this can force it to start stopped
                animationTime: 600,             // How long the slide transition takes
                hashTags: true,                 // Should links change the hashtag in the URL?
                buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
        		pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
        		startText: "Старт",             // Start text
		        stopText: "Стоп",               // Stop text
		        navigationFormatter: formatText       // Details at the top of the file on this use (advanced use)
            });
            
            $("#slide-jump").click(function(){
                $('.anythingSlider').anythingSlider(6);
            });
            
        });
      

$(".fancy").fancybox();
		
});

