// JavaScript Document
	$(function() {
		arrayImg = $("#content #photo-slider #carrousel img").toArray();
		qtdy = 0;
		totalW = 0;
		for (var i = 0; i < arrayImg.length; i++) {
        	totalW += arrayImg[i].width;
			totalW += 20;
			qtdy ++;
      	}
		
		scrolW = totalW / qtdy;
		
		$("#content #photo-slider #carrousel").css("width",totalW+'px');
				
		
		$("#content #photo-slider #photo-menu-left" ).click(function() {
			left = $("#carrousel").css('left');
			if(left != 'auto'){
				left.replace('px','');
				left = parseInt(left);
				if(left > -scrolW){
					$("#content #photo-slider #carrousel").animate({"left": "0px"}, "slow");
				}else{
					$("#content #photo-slider #carrousel").animate({"left": "+=306px"}, "slow");
				}
			}
		});
		$("#content #photo-slider #photo-menu-right").click(function() {

			left = $("#carrousel").css('left');
			left.replace('px','');
			left = parseInt(left);
			if(isNaN(left)){ left = 0; }
			totalWnegative = +-totalW
			totalWnegative = totalWnegative +924;
			if(left < totalWnegative + scrolW){
				$("#content #photo-slider #carrousel").animate({"left": totalWnegative+"px"}, "slow");
			}else{
				$("#content #photo-slider #carrousel").animate({"left": "-=306px"}, "slow");
			}
		});
		
		$("#content #photo-slider #carrousel img").hover(
			function(){
				position = $(this).position();
				$('#content #photo-slider #photo-over-link').attr('href',$(this).attr('longdesc'));
				$('#content #photo-slider #photo-over #title').html($(this).attr('title'));	
				$('#content #photo-slider #photo-over #text').html($(this).attr('alt'));					
				$('#content #photo-slider #photo-over').css('left',position.left+'px');
				$('#content #photo-slider #photo-over').fadeIn(300);
			},
			function(){
				$('#content #photo-slider #photo-over').hide();
			}
		);

		$("#content #photo-slider #photo-over").hover(
			function(){
				$(this).show();	
			},
			function(){
				$(this).hide();	
			}
		);		

		$("#content #photo-slider #carrousel img").click(function(){
			slink  = $(this).attr('longdesc');
			parent.location.href=slink;
		});	
		
	});		

