  $(document).ready(function(){
	var div = $('<div style="width:50px;height:50px;overflow:hidden;position:absolute;top:-200px;left:-200px;"><div style="height:100px;"></div>');
	$('body').append(div);
	var w1 = $('div', div).innerWidth();
	div.css('overflow-y', 'scroll');
	var w2 = $('div', div).innerWidth();
	$(div).remove();

	$("body","html", "#principal").css({height: "100%", width: "100%"});

	var scrollbar = w1 - w2;
	var tela = $(window).width() - scrollbar;

	$("#conteudo .texto").css("width",(tela-236)+"px");
  });

  function startScroll1(){
    if(!$('#control01').is(':animated')){ $('#control01').animate({ "scrollTop": "-=40px" }); }
	$.tempo = setTimeout(startScroll1, 1);
  }

  function startScroll2(){
	if(!$('#control01').is(':animated')){ $('#control01').animate({ "scrollTop": "+=40px" }); }
	$.tempo = setTimeout(startScroll2, 1);
  }

  function startScroll3(){
    if(!$('#control02').is(':animated')){ $('#control02').animate({ "scrollTop": "-=40px" }); }
	$.tempo = setTimeout(startScroll3, 1);
  }

  function startScroll4(){
	if(!$('#control02').is(':animated')){ $('#control02').animate({ "scrollTop": "+=40px" }); }
	$.tempo = setTimeout(startScroll4, 1);
  }

  function startScroll5(){
    if(!$('#control03').is(':animated')){ $('#control03').animate({ "scrollTop": "-=40px" }); }
	$.tempo = setTimeout(startScroll5, 1);
  }

  function startScroll6(){
	if(!$('#control03').is(':animated')){ $('#control03').animate({ "scrollTop": "+=40px" }); }
	$.tempo = setTimeout(startScroll6, 1);
  }

  function startScroll7(){
    if(!$('#control04').is(':animated')){ $('#control04').animate({ "scrollTop": "-=40px" }); }
	$.tempo = setTimeout(startScroll7, 1);
  }

  function startScroll8(){
	if(!$('#control04').is(':animated')){ $('#control04').animate({ "scrollTop": "+=40px" }); }
	$.tempo = setTimeout(startScroll8, 1);
  }

  function startScroll9(){
    if(!$('#control05').is(':animated')){ $('#control05').animate({ "scrollLeft": "-=138px" }); }
	$.tempo = setTimeout(startScroll9, 1);
  }

  function startScroll10(){
	if(!$('#control05').is(':animated')){ $('#control05').animate({ "scrollLeft": "+=138px" }); }
	$.tempo = setTimeout(startScroll10, 1);
  }

  function rodabanner(){
	if(!$('#banner').is(':animated')){
	  $("#banner").animate({ "scrollLeft": "+=303" }, 1500, function() {
		$("#banner").scrollLeft($("#banner").scrollLeft()-303);
		jQuery("#banner #roda div:first-child").insertAfter(jQuery("#banner #roda div:last-child"));
	  });
	}
	$.tempobanner = setTimeout(rodabanner, 6000);
  }

  $(document).ready(function(){
	$('#banner #roda').css('width' , ($('#banner #roda').children().size()*303) + 'px');
	jQuery("#banner #roda div:last-child").insertBefore(jQuery("#banner #roda div:first-child"));
	$("#banner").scrollLeft(303);
	rodabanner();

	$("img#nav_right").click(function(){
	  if(!$('#banner').is(':animated')){
		$("#banner").animate({ "scrollLeft": "+=303" }, 1500, function() {
		  $("#banner").scrollLeft($("#banner").scrollLeft()-303);
		  jQuery("#banner #roda div:first-child").insertAfter(jQuery("#banner #roda div:last-child"));
		});
		clearTimeout($.tempobanner);
		$.tempobanner = setTimeout(rodabanner, 6000);
	  }
    });

	$("img#nav_left").click(function(){
	  if(!$('#banner').is(':animated')){
		$("#banner").animate({ "scrollLeft": "-=303" }, 1500, function() {
		  $("#banner").scrollLeft($("#banner").scrollLeft()+303);
		  jQuery("#banner #roda div:last-child").insertBefore(jQuery("#banner #roda div:first-child"));
		});
		clearTimeout($.tempobanner);
		$.tempobanner = setTimeout(rodabanner, 6000);
	  }
    });

	$('#scrollup1').hover(startScroll1, function(){ clearTimeout($.tempo); $("#control01").stop(); });
	$('#scrolldown1').hover(startScroll2, function(){ clearTimeout($.tempo); $("#control01").stop(); });
	$('#scrollup2').hover(startScroll3, function(){ clearTimeout($.tempo); $("#control02").stop(); });
	$('#scrolldown2').hover(startScroll4, function(){ clearTimeout($.tempo); $("#control02").stop(); });
	$('#scrollup3').hover(startScroll5, function(){ clearTimeout($.tempo); $("#control03").stop(); });
	$('#scrolldown3').hover(startScroll6, function(){ clearTimeout($.tempo); $("#control03").stop(); });
	$('#scrollup4').hover(startScroll7, function(){ clearTimeout($.tempo); $("#control04").stop(); });
	$('#scrolldown4').hover(startScroll8, function(){ clearTimeout($.tempo); $("#control04").stop(); });
	$('#scrollleft').hover(startScroll9, function(){ clearTimeout($.tempo); $("#control05").stop(); });
	$('#scrollright').hover(startScroll10, function(){ clearTimeout($.tempo); $("#control05").stop(); });
  });