// JavaScript Document
var animating = false;



function prevPhotoClick(widthElm){
		//divId - block which contain all elements
		//widthElm - width of one child block 		
		
		if(animating == false){
			setTimeout('clear()', 700);
			animating = true;			
			var myLeft = parseInt(document.getElementById('sliderBody').style.left);
			var width =  document.getElementById('sliderBody').offsetWidth;
			
			if (myLeft !== 20){
				$("#sliderBody").animate( { left: myLeft + widthElm }, 500 );						
			}
		}
					
		return false;
	}
	
						
	function nextPhotoClick(widthElm){
		//divId - block which contain all elements
		//widthElm - width of one child block 
		//amountElm - amount blocks on page		
		if(animating == false){
			setTimeout('clear()', 700);
			animating = true;
			var width =  document.getElementById('sliderBody').offsetWidth;
			var myLeft = parseInt($("#sliderBody").css("left"));
			var num = $('#sliderBody .product').length - 5;
			//alert(num * widthElm);
			if(myLeft !== -(num * widthElm-20) ){
				$("#sliderBody").animate( { left: myLeft - widthElm }, 500);						
			}
		}
		
		return false;	
	}
	
	function clear(){		
			animating = false;
			
	}
	


$(document).ready(
	function(){
		$('#menu ul.subMainMenu li').hover(  //наведение на первое подменю 
			function(){				
				$(this).find('ul.subsubMainMenu').show();				
				$(this).css({background:'#8fc902'}); //green
			},
			function(){				
				$(this).find('ul.subsubMainMenu').hide();
				$(this).css({background:'#66a4dd'}); //blue
			}
		);
		
		
		
		
		$('#menu .subsubMainMenu li').hover( 
			function(){				
				$(this).css({background:'#66a4dd'}); //blue
			},
			function(){
				$(this).css({background:'#8fc902'}); //green
			}
		);
		
		
		$('.titleMenu').hover( //наведение на меню
			function(){
				$(this).find('.subMainMenu').show();
			},
			function(){
				$(this).find('.subMainMenu').hide();
			}
		);
		
		$('.subMainMenu').hover( 
			function(){
				$(this).show();
			},
			function(){
				$(this).hide();
			}
		);
		
				
});