$(document).ready(function() {




    
    
	$('.horizontal_navigation .main li').hover(
  	function () {
		  	if ( !($(this).hasClass("search")) )
	        $(this).children('ul').stop(true, true).fadeIn();
  	},
  	function () {
		  	if ( !($(this).hasClass("search")) )
	        $(this).children('ul').stop(true, true).fadeOut();
	}
	); 


	$('.horizontal_navigation .extras li').hover(
  	function () {
		  	if ( !($(this).hasClass("search")) )  	
	        $(this).children('ul').stop(true, true).fadeIn();
  	},
  	function () {
		  	if ( !($(this).hasClass("search")) )  	
	        $(this).children('ul').stop(true, true).fadeOut();
	}
	); 

	$('.horizontal_navigation .extras .search').click(
  	function () {
	        $(this).children('ul').stop(true, true).fadeIn();
  	}
	); 	




    $(window).scroll(function () { 
		var scrollTop = $(window).scrollTop();
		if (scrollTop >= 148) {
      		$("#page_top").show();
        } else {
      		$("#page_top").hide();
        }
    });
	$('#page_top').click(function(){
		$('html, body').animate({scrollTop:0}, 'fast');
	});    


	$('.window_navigation').children().children('li').hover(
  	function () {
	  	    $(this).addClass('selected');
  	},
  	function () {
	  	    $(this).removeClass('selected');
    }
	);  


	
	$('.window_navigation').children().children('li').click(
  	function () {
	  	    $('.window_navigation').children().children('li').removeClass('active');  	
	  	    $(this).addClass('active');  	
		  	var window_nr = $(this).html();
		  	var window_width = $('.box_window .window').width();
            var distans = (-((window_nr -1)*window_width));
            $("#nav_position").html(window_nr);
	  	    $('.box_window .window .container').animate({ left: distans }, {duration: 'slow',easing: 'easeInOutExpo' });
    }
	); 


	
// This ends .ready function
});
