function volta () {
	$("#footer").animate({'bottom':'0'}, 'slow');
	$('.p').html('<a href="#" class="prod" onclick="vai();"><img src="imagens/bt-produtos.png" /></a>');
	$("#categorias").hide();
	$("#recebeProd").empty();
	$("#categorias").css({'top':'20%'}) 
}
function volta2 () {
	$("#footer").animate({'bottom':'0'}, 'slow');
	$("#eu-amo-biramar").hide();
}
function vai () {
	$("#footer").animate({'bottom':'-260px'}, 'slow');
	$('.p').html('<a href="#" class="prod" onclick="volta2();"><img src="imagens/bt-produtos2.png" /></a>');
	$("#categorias").show();
}
function vai2 () {
	$("#footer").animate({'bottom':'-260px'}, 'slow');
	$("#eu-amo-biramar").show();
}
	
function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};
$(document).ready(function () {
	$(document).pngFix();
	$(".enxo").click(function () {
			$("#opcEnxovais").fadeIn();								 
	});
	$("#footer").flash({src:'flash/rod.swf', width:'100%', height:'311px', scale:'noscale', wmode:'transparent', menu:'false'});
	$('#ipt').focus(function() {
			value=$(this).val();
			$(this).attr("value","");
			$(this).addClass("focus");
		});
	var largura = screen.width;
	var altura	=	screen.height;
	
	if ((largura==800) && (altura==600)) {
		$("#footer").css("bottom", "-150px");
		}
	/*
	$('.item').click(function () { 
		var i = $(this).attr("rel");
		$("#categorias").animate({'top':'5px'}) 
		$("#containerProdutos").fadeIn();
		$.ajax({
					 url:'carregaProdutos.php',
					 type:'POST',
					 dataType:'html',
					 data:{IDCategoria:i},
					 beforeSend: function () { $('.carregando').fadeIn(); $('#recebeProd').html(''); },
					 complete: function () { $('.carregando').hide() },
					 success: function (data) { $("#recebeProd").html(data); }
					 });
		
		
		} );*/
	
	
		$('#ipt').blur(function() {
			if($(this).val()=="") {
				$(this).val(value);
				$(this).removeClass("focus");
			}
		});
	$.fn.clouds = function(settings) {
	settings = $.extend({
		clouds: [],
		folder: '/',
		speed: 1,
		opacityStep: 0.05,
		fader: true
	}, settings);
	return this.each(function(n, item) {
		var self = $(item);
		$.each(settings.clouds, function(c, cloud) {
			var cImg = new Image();
			$(cImg).load(function() {
				var cDiv = $('<div class="cloud"></div>');
				cDiv.css({
					top: cloud.y+"px",
					left: cloud.x+"px",
					width: cImg.width+"px",
					height: cImg.height+"px",
					backgroundImage: 'url('+this.src+')',
					zIndex: 0
				});
				self.append(cDiv);
				var o = settings.opacityStep;
				cloud.currentO = Math.random();
				if (!$.browser.msie) { cDiv.css({opacity: cloud.currentO}) };
				window.setInterval(function() {
					if (settings.fader) {
						if (cloud.currentO > 1.0) o = -settings.opacityStep;
						if (cloud.currentO < 0.3) o = +settings.opacityStep;
						cloud.currentO += o;
						cDiv.css({opacity: cloud.currentO});
					}
					var currentLeft = parseInt(cDiv.css("left"));
					cDiv.css({left: (currentLeft - cloud.speedX)+'px'});
					if (cDiv.offset().left > $(document).width() - self.offset().left) {
						var s = -cImg.width;
						cDiv.css({left: s+"px"});
					}
				}, settings.speed);
			});
			cImg.src = settings.folder + cloud.src;
		});
	});
}
	 if ($.browser.version == 6) {
		 navegador = false;
		 }
		else {
			navegador = true;
			}
  
	if(navegador || !$.browser.msie) {
		$("#cloud-holder").clouds({
			clouds: [
				{src:'cloud_1.png',x:-120,y:450,speedX:-1},
				{src:'cloud_2.png',x:-250,y:250,speedX:-2},
				{src:'cloud_3.png',x:150,y:100,speedX:-2.5},
				{src:'cloud_4.png',x:320,y:350,speedX:-1},
				{src:'cloud_5.png',x:820,y:390,speedX:-2.5},
				{src:'cloud_6.png',x:620,y:490,speedX:-2.5},
				{src:'cloud_7.png',x:920,y:330,speedX:-2.5}
			],
			folder: 'imagens/',
			speed: 100,
			fader: !$.browser.msie });}

	SexyLightbox.initialize({find:'conteudo', color:'white', OverlayStyles:{'opacity':0.2},emergefrom:'top', dir: 'plugins/box/sexyimages'});
	/*if ($.browser.msie) {
		if ($.browser.version == 6) {
			$("#ie").animate({'top':'2px'});;
			}
		}*/


$('#newsletter').tabSlideOut({
		tabHandle: '.handle',                              //class of the element that will be your tab
		pathToTabImage: 'imagens/bt-newsletter.gif',          //path to the image for the tab (optionaly can be set using css)
		imageHeight: '103px',                               //height of tab image
		imageWidth: '28px',                               //width of tab image    
		tabLocation: 'right',                               //side of screen where tab lives, top, right, bottom, or left
		speed: 300,                                        //speed of animation
		action: 'click',                                   //options: 'click' or 'hover', action to trigger animation
		topPos: '50px',                                   //position from the top
		fixedPosition: false                               //options: true makes it stick(fixed position) on scroll
});
	
	
	$("#newsletterForm").submit(function (e) {
		var icon = $('<center><br><img src="imagens/carregando.gif" /><br><p style="font-size:10px">Enviando</p></center>');
		e.preventDefault();
		if (!$("#nome").val()=="" || !$("#email").val()=="") {
		$.ajax({
			url:'submit-newsletter.php',
			data: $("#newsletterForm").serialize(),
			type: 'POST',
			dataType: 'html',
			beforeSend: function () { $(".containerNews").html(icon) },
			complete: function () { $(icon).remove },
			success: function (data) { $(".containerNews").html(data) }});}});});

document.oncontextmenu=desabilitar;
function desabilitar(){
	return false;
}
