// JavaScript Document
$(document).ready(function(){
	$('.produtos').css({'opacity' : 0});
	/*$('div.mouseover ul li').slideUp('fast', function(){
		
		if($('.content').height()>($(window).height()-160)){
		$('.footer').css({'position' : 'absolute', 'bottom' : -180});
		}else{
			$('.content').animate({'margin-top' : (($(window).height()-160)/2) - (($('.content').height())/2)}, 'slow');
		}
		
	});*/
	
	$('div.mouseover ul li').css({'display' : 'none'});
	$('.vinhoszanrosso div.mouseover').find('ul li').css({'display' : 'block'});

	$('a.titulocategoria').click(function(e){
		$('a.titulocategoria').removeClass('activo');
		$('div.mouseover ul li').slideUp("easinInSine");
		$(this).addClass('activo');
		$(this).siblings('div.mouseover').find('ul li').slideToggle("easinInSine");
			if($(window).height()>$('.conteudo').height()+235){
				$('.footer').css({'position' : 'absolute'});
			}else{
				$('.footer').css({'position' : 'static'});
			}
		return false;
	});
	var bt = $('div.mouseover ul li a');
	
	bt.click(function(){
		var url = $(this).attr('href');
		$("#produto").animate({'opacity' : 0}, 'slow', function(){
			$("#produto").load(url, function(){
					$("#produto").animate({'opacity' : 1}, 'slow');
			});
		});
		
		return false;
	});
	
});

$(function(){
	var div = $('div.roll'),ul = $('.roll ul'),ulPadding = 30;
	div.css({overflow: 'hidden'});
	var divWidth = div.width();
	ul.css({'position': 'relative', 'width' : ($('.mouseover ul > li').size()+2)*$('.mouseover ul li').width()});
	var lastLi = ul.find('li:last-child');
	
	div.mousemove(function(e){
		var ulWidth = lastLi[0].offsetLeft + lastLi.outerWidth() + ulPadding;
		var Width = (e.pageX - div.offset().left) * (ulWidth-divWidth) / divWidth;
		div.scrollLeft(Width);
	});
});



