//Главное меню
$(document).ready(function(){
   $("#top-menu > li").each(function() {
      $(this).hover(
         function() {
            $(this).addClass("active");
         },
         function() { 
            $(this).removeClass("active");
         }
      );
   });
});
//Горячие предложения
 $(document).ready(function(){
    $('.hot').hover(function(){
      $(".hot-info", this).stop().animate({height: '0px', top:'150px'},{queue:false,duration:160});
   }, function() {
      $(".hot-info", this).stop().animate({height: '65px', top:'78px'},{queue:false,duration:160});
   });

    $('.hot').click(function(){
      document.location = $(this).find('a').attr('href');
   });

});





//Модальные окна
 $(document).ready(function(){
 
	$('a[name=modal]').click(function(e) {
		//Cancel the link behavior
		e.preventDefault();
		
		//Get the A tag
		var id = $(this).attr('href');
	
		//Get the screen height and width
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
	
		//Set heigth and width to mask to fill up the whole screen
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		
		//transition effect		
		$('#mask').fadeIn(1000);	
		$('#mask').fadeTo("slow",0.6);	
	
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();

		//Set the popup window to center
 		$(id).css('top',  winH/2-$(id).height()/2 + getScrollY());
		$(id).css('left', 200); 

		//transition effect
		$(id).fadeIn(2000); 
	});

	//if close button is clicked
	$('.window .close').click(function (e) {
		//Cancel the link behavior
		e.preventDefault();
		
		$('#mask').hide();
		$('.window').hide();
	});		
	
	//if mask is clicked
	$('#mask').click(function () {
		$(this).hide();
		$('.window').hide();
	});	
	
 	$('#print').click(function () {
	print = open('', 'print' , 'width=600,height=580');
	print.document.open();
	print.document.writeln('<html><head><title></title><style type="text/css">@media screen, print{#smeta_window table { width:350px;}.right { float:right; }.left { float:left; }.window .adres{padding-right: 35px}.clear { clear:both; font-size:1px; height:1px; line-height:1px; }a {display:none;}}</style></head><body onload="print();close()">'+ $('#smeta').html() +'</body></html>');
	print.document.close();
	});	
	
	
	
});



function getScrollY()
{
    scrollY = 0;   
    if (typeof window.pageYOffset == "number") {
        scrollY = window.pageYOffset;
    } else if (document.documentElement && document.documentElement.scrollTop) {
        scrollY = document.documentElement.scrollTop;
    }  else if (document.body && document.body.scrollTop) {
        scrollY = document.body.scrollTop;
    } else if (window.scrollY) {
        scrollY = window.scrollY;
    }
    return scrollY;
}










 



