// JavaScript Document

$(function(){
	$("#menu-lateral li a").mouseover(function(){
		$(this).attr("title", "")
	})
	
	$("ul.topnav li a").mouseover(function() { //When trigger is clicked...
		$(this).attr("title", "")
		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).parent().find("> ul.subnav").slideDown('fast').show(); //Drop down the subnav on click

		$(this).parent().hover(function() {
		}, function(){	
			$(this).parent().find("ul.subnav").slideUp('fast'); //When the mouse hovers out of the subnav, move it back up
		});

		//Following events are applie d to the trigger (Hover events for the trigger)
		}).hover(function() { 
			$(this).addClass("subhover"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			$(this).removeClass("subhover"); //On hover out, remove class "subhover"
	})

	//mailto:presidente@renosa.com.br?subject=Contato Site - Renosa
	$(".alerta-presidente").click(function(){
		var titulo = $(this).attr("title")
		var montaDiv = "<div class=\"caixa-alerta\"><a href=\"#\" title=\"Fechar\" class=\"fechar no-text\">Fechar</a> <p>ATENÇÃO</p> <p>Se o assunto de sua mensagem estiver relacionado à oportunidade de emprego na Renosa, favor utilizar o link  <a href=\"http://www.renosa.com.br/trabalhe-conosco.html\">'trabalhe conosco'</a>.</p> <p>Para seguir adiante e falar com o nosso Presidente, favor <a href=\"mailto:presidente@renosa.com.br?subject=Contato Site - Renosa\">clicar aqui</a>.</div>"
		if($(".caixa-alerta").length == 0) {
			$("#container").before(montaDiv)
		}
		if($(".caixa-alerta").css("display") == "none") {
			$(".caixa-alerta").show("fast")
		}
		
		$(".fechar").click(function(){
			$(this).parent().hide("fast")
			return false
		})
		
		return false
	})

});

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);
    });

    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

$(function(){
    $('#destaque').jcarousel({
        auto: 3,
		scroll: 1,
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });
});

$(function(){
	$('input, textarea').focus(function(){
        $(this).css('border', '1px solid red')
    })
    $('input, textarea').blur(function(){
        $(this).css('border', '1px solid #666')
    })
})

$(function(){
	$(".destaque-pq").hover(function(){
		$(this).find("img").css('border','2px solid red')
	},  function(){
		$(this).find("img").css("border","2px solid #fff")
	})
})

//aumentar e diminuir fonte
var font= 12;
function mudaFonte(tipo){
	if (tipo=="a-mais"){
		font+=2;
	}
	else if(tipo=="a-menos"){
		font-=2;
	}
	else{
		font=font
	}
	$('.texto p, .texto li').attr('style','font-size:'+font+'px')
	return false;
}


//---------------------------------------

