//variável necessária para o player do youtube

//var ytplayer = null;



$(document).ready(function(){

	//funcao para exibir a galeria de screenshots como lightbox

	$('#screenshots a').lightBox({'txtImage':'Imagem', 'txtOf':'de'});

	

	$('#desvioderota').hide();

	$('#splash').animate({opacity:'show', height:'show'}, {queue:false, duration:1500});

	

	$('.tooltip-rodape-link').hover(function(){

		$('.tooltip-rodape').fadeIn();

	}, function(){

		$('.tooltip-rodape').fadeOut(200);

	});



	$('.submenu-historia').show();

});





//http://jquery.bassistance.de/validate/demo/milk/

//validaes dos formulrios

function sucesso(label) { label.html("V&aacute;lido!").addClass("checked"); }



//Volta para o item anterior da galeria e se não tiver mais itens esconde o botão

function previous(){

	$('.next').show();

	if(!$('#content-main .galeria-item:visible').hide().prev().fadeIn().prev().html())

		$('.previous').hide();

}



//Avança para o proximo item da galeria e se não tiver mais itens esconde o botão

function next(){

	$('.previous').show();

	if(!$('#content-main .galeria-item:visible').hide().next().fadeIn().next().html())

		$('.next').hide();

}



function exibeFoto(id){

	if(id != ''){

		$('#content-main .galeria-item:visible').hide();

	$('#'+id).fadeIn();

	linksNavegacao();

	}

}



function linksNavegacao(){

	$('.previous').show();

	$('.next').show();

	if(!$('#content-main .galeria-item:visible').prev().html())

		$('.previous').hide();

	if(!$('#content-main .galeria-item:visible').next().html())

		$('.next').hide();

}



//Exibe a janela modal

function show_modal(id){

	$('.modal-box').each(function(){

		$(this).hide();

	});

	$('#modal'+id).fadeIn('def');

}



//Exibe a janela modal

function show(obj){

	$('#'+obj).fadeIn('def');

}



//Fecha janela modal

function fechar(obj){

	$('#'+obj).fadeOut('def');

}



//validaes do formulario de contato

$(document).ready(function() {

	$.validator.addMethod("phone", function(pnumber) {

	var stripped = pnumber.replace(/[\(\)\.\-\ ]/g, '');

		if (isNaN(parseInt(stripped)) || !(stripped.length == 10)) {

			return false;

		}else{

			return true;

		}

	}, "Especifique um número de telefone válido");

	

	var validator = $("#contato-form").validate({

        rules: {

            nome: { required: true, minlength: 2 },

			empresa: { required: true, minlength: 2 },

            email: { required: true, email: true },

			telefone: { required: true, phone: true },

            mensagem: { required: true, minlength: 10 }

        },

        success: function(label) { sucesso(label); }

    }); 

});



//validaes do formulrio de envio de depoimento

$(document).ready(function() {

	var validator = $("#depoimento-form").validate({

        rules: {

            nome: { required: true, minlength: 2 },

            estado: { required: true, minlength: 2 },

            cidade: { required: true, minlength: 2 },			

            email: { required: true, email: true },

            depoimento: { required: true, minlength: 10 }

        },

        success: function(label) { sucesso(label); }

    }); 

});



//abre popup

function abrepopup(pagina,titulo){

	window.open('popup.php?pagina='+pagina,titulo,'status=no,resizable=no,scrollbars=yes,location=no,menubar=no,toolbar=no,width=700,height=700');

	return false;

}



//JCarousel



jQuery(document).ready(function() {

			jQuery('#mycarousel').jcarousel();

		});

