﻿/* --------------------------- Inicializa Scripts --------------------------- */

$(document).ready(function() {

	//Fun�o Alinhar o Centro do Topo (Site Geral)
	alinharHome();
	onResizeHome();
	
	//fun��o que seta os valores dos input (Home)
	setandoInput();
	
	//fun��o que seta os valores dos input (Autentica��o)
	setandoInputAutenciacao();
	
	//fun��o que fecha o pop-up (Fale Conosco e Cadastro)
	fecharPopUp();
	
	//fun��o estiliza��o selectbox (Fale Conosco e Cadastro)
	estilizacaoSelectbox();
	
	//fun��o pular ddd ao atingir 2 d�gitos (Fale Conosco e Cadastro)
	pularDDDTel();
	
	//fun��o para mascarar o campo Telefone (Fale Conosco e Cadastro)
	maskTel();
	
    //Chama a fun��o Estiliza��o Radio Button (Boletim)
	estilizaRadioButton();

	//Chama a fun��o ao clicar no bot�o esqueci senha (Site Geral)
	setaClickBtEsqueciSenha();
	
	//Chama a fun��o ao clicar no bot�o enviar email (Site Geral)
	setaClickEnviarEmail()
	
	//Chama a fun��o ao clicar no bot�o diretoria (Diretoria)
	setaClickBtDiretoria();
	
	//Galeria de Fotos
    //setaGaleriaFotos();
	
	//Chama a fun��o que mostra o submenu do topo (Site Geral)
	mostraSubmenuTopo();
	
	//Fun��o da galeria de fotos da pagina de Equipe ( jCarouselLite )
	//galeriaPagFotos();
	
	//Chama a fun��o de vota��o das fotos (Foto)
	votacaoFotos();
	
	//Chama a fun��o de mostrar e enconder boxes coment�rios (Foto)
	mostrarEsconderComentarios();
	
	//Chama a fun��o do menu da pagina de Equipe ( jCarouselLite )
	//menuPagEquipe();
	
	
});

/*------------------------------------ Alinhar o Centro do Topo (Site Geral) ------------------------------------------*/

function onResizeHome(){
	$(window).resize(function(){
	  alinharHome();
	});
}

function alinharHome(){
	var topoCentro = $('.centro');
	var tamanhoTopo = topoCentro.css("width");
	var tamanhoDiv = $('.topo').css("width");
	
	var posicaoFinal = (parseInt(tamanhoDiv)/2)-(parseInt(tamanhoTopo)/2);	
	
	topoCentro.css('margin-left',posicaoFinal+"px");
	
}

/*------------------------------------ Setando valores nos campos input (Site Geral e Home) ------------------------------------------*/
function setandoInput(){
    
    //inputs dos campos de autentica��o do topo (Site Geral)
    $(".formTopo .campoLogin").focus(function () {
         if($(this).attr('value')=="login"){
            $(this).attr('value','');
         }
    });
    $(".formTopo .campoLogin").blur(function () {
        if($(this).attr('value')==""){
            $(this).attr('value','login');
        }
    });
    
    $(".formTopo .campoSenha").focus(function () {
         if($(this).attr('value')=="senha"){
            $(this).attr('value','');
         }
    });
    $(".formTopo .campoSenha").blur(function () {
        if($(this).attr('value')==""){
            $(this).attr('value','senha');
        }
    });
    
    $(".formEsqueciSenha .campoEmail").focus(function () {
         if($(this).attr('value')=="email"){
            $(this).attr('value','');
         }
    });
    $(".formEsqueciSenha .campoEmail").blur(function () {
        if($(this).attr('value')==""){
            $(this).attr('value','email');
        }
    });
    
    //input do banner newsletter (Home)
    $(".formNewsletter .inputNewsletter").focus(function () {
         if($(this).attr('value')=="Cadastre seu email"){
            $(this).attr('value','');
         }
    });
    
    $(".formNewsletter .inputNewsletter").blur(function () {
        if($(this).attr('value')==""){
            $(this).attr('value','Cadastre seu email');
        }
    });
}

//inputs dos campos de autentica��o (Autentica��o)
function setandoInputAutenciacao(){

    //campo Email (form Autenticacao)
    $(".boxAutenticacao .formAutenciacao .email").focus(function () {
         if($(this).attr('value')=="E-mail"){
            $(this).attr('value','');
         }
    });
    
    
    //campo Senha (form Autenticacao)
    $(".boxAutenticacao .formAutenciacao .senha").focus(function () {
         if($(this).attr('value')=="Senha"){
            $(this).attr('value','');
         }
    });
    
    
    //campo email (form Cadastro)
    $(".boxCadastro .formCadastro .email").focus(function () {
         if($(this).attr('value')=="E-mail"){
            $(this).attr('value','');
         }
    });
        
    //campo email (form Cadastro)
    $(".pagFotos .BoxBusca .textBusca").focus(function () {
         if($(this).attr('value')=="Digite sua busca aqui"){
            $(this).attr('value','');
         }
    });
    
    
}

/*------------------------------------ Fechar Pop=Up (Fale Conosco) ------------------------------------------*/
function fecharPopUp(){

    /*POP-UP - Erro e Sucesso*/
    $(".box .meioPop .btFechar").click(function(speed, easing, callback){
         $("#alertaPop").hide();
         $(".box .meioPop").parent().hide();
    });
    
    /*POP-UP - Carregando*/
    $(".btCancelar").click(function(){
        $(".boxPop").animate({ height: 'hide', opacity: 'hide' }, 'slow');
    });

}

/* --------------------------- Estiliza��o Selectbox (Fale Conosco e Cadastro) --------------------------- */

function estilizacaoSelectbox() {
	$('.pagFaleConosco .formFaleConosco select').selectbox();
	$('.pagCadastro .formCadastro select').selectbox();
	$('.pagDownloads select').selectbox();
	$('.pagFotos select').selectbox();
}

/* -------------Pular campos DDD ao atingir 2 d�gitos(Fale Conosco e Cadastro) ------------------ */

function pularDDDTel() {
	
/*Fale Conosco*/
var inputDdd = $('.pagFaleConosco .formFaleConosco .inputDDD');
var inputTelefone = $('.pagFaleConosco .formFaleConosco .inputTelefone');

inputDdd.keyup(function(){

	var ddd = $(this).attr('value');
	if (ddd.length >= 2)
		inputTelefone.focus();
	
    });

/*Cadastro*/
var inputDdd = $('.pagCadastro .formCadastro .inputDDD');
var inputTelefone = $('.pagCadastro .formCadastro .inputTelefone');
var inputDddCel = $('.pagCadastro .formCadastro .inputDDDCel');
var inputCel = $('.pagCadastro .formCadastro .inputCel');
var inputDia = $('.pagCadastro .formCadastro .inputDia');
var inputMes = $('.pagCadastro .formCadastro .inputMes');
var inputAno = $('.pagCadastro .formCadastro .inputAno');

/*Telefone*/
inputDdd.keyup(function(){

	var ddd = $(this).attr('value');
	if (ddd.length >= 2)
		inputTelefone.focus();
    });

/*Celular*/
inputDddCel.keyup(function(){

	var ddd = $(this).attr('value');
	if (ddd.length >= 2)
		inputCel.focus();

    });

/*Data Nascimento*/
inputDia.keyup(function(){

	var dia = $(this).attr('value');
	
	if (dia.length >= 2)
		inputMes.focus();

    });

inputMes.keyup(function(){

	var mes = $(this).attr('value');
	
	if (mes.length >= 2)
		inputAno.focus();

    });

}

/* -------------Mascarar telefone(Fale Conosco e Cadastro) ------------------ */

function maskTel() {
    $(".pagFaleConosco .formFaleConosco .inputTelefone").mask("9999-9999");
    $(".pagCadastro .formCadastro .inputTelefone").mask("9999-9999");
    $(".pagCadastro .formCadastro .inputCel").mask("9999-9999");
    $(".pagCadastro .formCadastro .inputCpf").mask("999.999.999-99");

}

/* ------------- Estiliza��o RadioButton(Boletim) ------------------- */

function estilizaRadioButton() {
	$('.pagBoletim [@type=radio]').checkbox({cls:'radioButton-boletim'});	
	$('.pagRealizarCompra .boxFormaPagamento [@type=radio]').checkbox({cls:'radioButton-boletim'});	
	$('.pagRealizarCompra .boxOpcaoPagamento [@type=radio]').checkbox({cls:'radioButton-opcao'});	
}

/*-----------------Seta Clique Bt Esqueci Senha (Site Geral) ------------------*/

function setaClickBtEsqueciSenha() {
     $(".topo .boxSuperior .btEsqueciSenha").click(function(){
         //$(".topo .boxSuperior .formTopo").hide('fast');
         //$(".topo .boxSuperior .formEsqueciSenha").show('slow');
        $("form.formTopo input[name='action']").val('recuperaSenha')
        document.formTopo.submit();
    });
}

/*-----------------Seta Clique Bt Enviar Email (Site Geral) ------------------*/

function setaClickEnviarEmail() {
    $('.topo .boxSuperior .btEnviarEmail').click(function(){
            $('.topo .boxSuperior .mensagem').slideToggle();
    });
}
/*-----------------Seta Clique Bt Diretoria (Diretoria) ------------------*/

function setaClickBtDiretoria() {

//Bot�ões
var btDiretor01 = $('.pagDiretoria .boxDiretoria .menuDiretoria .baseBtDiretoria01');
var btDiretor02 = $('.pagDiretoria .boxDiretoria .menuDiretoria .baseBtDiretoria02');
var btDiretor03 = $('.pagDiretoria .boxDiretoria .menuDiretoria .baseBtDiretoria03');
var btDiretor04 = $('.pagDiretoria .boxDiretoria .menuDiretoria .baseBtDiretoria04');


//Diretor 01
btDiretor01.click(function() {
        
        //box diretor - conteúdo
	    $('.pagDiretoria .boxDiretor01').animate({ height: 'show', opacity: 'show' }, 'slow');
	    $('.pagDiretoria .boxDiretor02').animate({ height: 'hide', opacity: 'hide' }, 'slow');
	    $('.pagDiretoria .boxDiretor03').animate({ height: 'hide', opacity: 'hide' }, 'slow');
	    $('.pagDiretoria .boxDiretor04').animate({ height: 'hide', opacity: 'hide' }, 'slow');
	    
	    //mudar bg
	    var diretor01 = $(this);
        var diretor02 = $('.pagDiretoria .boxDiretoria .menuDiretoria .baseBtDiretoria02');
	    var diretor03 = $('.pagDiretoria .boxDiretoria .menuDiretoria .baseBtDiretoria03');
	    var diretor04 = $('.pagDiretoria .boxDiretoria .menuDiretoria .baseBtDiretoria04');
	     
	   diretor01.addClass('baseBtDiretoriaAtivo');
	   diretor02.removeClass('baseBtDiretoriaAtivo');
	   diretor03.removeClass('baseBtDiretoriaAtivo');
	   diretor04.removeClass('baseBtDiretoriaAtivo');
	   
    });

//Diretor 02
btDiretor02.click(function() {
        
        //box diretor - conteúdo
        $('.pagDiretoria .boxDiretor02').animate({ height: 'show', opacity: 'show' }, 'slow');
	    $('.pagDiretoria .boxDiretor01').animate({ height: 'hide', opacity: 'hide' }, 'slow');
	    $('.pagDiretoria .boxDiretor03').animate({ height: 'hide', opacity: 'hide' }, 'slow');
	    $('.pagDiretoria .boxDiretor04').animate({ height: 'hide', opacity: 'hide' }, 'slow');
	    
	    //mudar bg
	    var diretor02 = $(this);
        var diretor01 = $('.pagDiretoria .boxDiretoria .menuDiretoria .baseBtDiretoria01');
	    var diretor03 = $('.pagDiretoria .boxDiretoria .menuDiretoria .baseBtDiretoria03');
	    var diretor04 = $('.pagDiretoria .boxDiretoria .menuDiretoria .baseBtDiretoria04');
	  
	    diretor02.addClass('baseBtDiretoriaAtivo');
	    diretor01.removeClass('baseBtDiretoriaAtivo');
	    diretor03.removeClass('baseBtDiretoriaAtivo');
	    diretor04.removeClass('baseBtDiretoriaAtivo');
    });

//Diretor 03
btDiretor03.click(function() {
        
        //box diretor - conteúdo
        $('.pagDiretoria .boxDiretor03').animate({ height: 'show', opacity: 'show' }, 'slow');
	    $('.pagDiretoria .boxDiretor02').animate({ height: 'hide', opacity: 'hide' }, 'slow');
	    $('.pagDiretoria .boxDiretor01').animate({ height: 'hide', opacity: 'hide' }, 'slow');
	    $('.pagDiretoria .boxDiretor04').animate({ height: 'hide', opacity: 'hide' }, 'slow');
	    
	    //mudar bg
	    var diretor03 = $(this);
        var diretor02 = $('.pagDiretoria .boxDiretoria .menuDiretoria .baseBtDiretoria02');
	    var diretor01 = $('.pagDiretoria .boxDiretoria .menuDiretoria .baseBtDiretoria01');
	    var diretor04 = $('.pagDiretoria .boxDiretoria .menuDiretoria .baseBtDiretoria04');
	   
	    diretor03.addClass('baseBtDiretoriaAtivo');
	    diretor02.removeClass('baseBtDiretoriaAtivo');
	    diretor01.removeClass('baseBtDiretoriaAtivo');
	    diretor04.removeClass('baseBtDiretoriaAtivo');
    });

//Diretor 04
btDiretor04.click(function() {

        //box diretor - conteúdo
        $('.pagDiretoria .boxDiretor04').animate({ height: 'show', opacity: 'show' }, 'slow');
	    $('.pagDiretoria .boxDiretor02').animate({ height: 'hide', opacity: 'hide' }, 'slow');
	    $('.pagDiretoria .boxDiretor03').animate({ height: 'hide', opacity: 'hide' }, 'slow');
	    $('.pagDiretoria .boxDiretor01').animate({ height: 'hide', opacity: 'hide' }, 'slow');
	    
	    //mudar bg
	    var diretor04 = $(this);
	    var diretor02 = $('.pagDiretoria .boxDiretoria .menuDiretoria .baseBtDiretoria02');
	    var diretor03 = $('.pagDiretoria .boxDiretoria .menuDiretoria .baseBtDiretoria03');
	    var diretor01 = $('.pagDiretoria .boxDiretoria .menuDiretoria .baseBtDiretoria01');

	    diretor04.addClass('baseBtDiretoriaAtivo');
	    diretor02.removeClass('baseBtDiretoriaAtivo');
	    diretor03.removeClass('baseBtDiretoriaAtivo');
	    diretor01.removeClass('baseBtDiretoriaAtivo');

    });
       
}


/*---------------------------- Fun�o Mostra Submenu Topo  --------------------------------*/

function mostraSubmenuTopo(){	
	
	var botao = $('.boxMenu .btTopoSubmenu');	
	
	//links especificos de cada submenu
	var btQuemSomos = $('.bgSubBtMultipla .btQuemSomos');
	var btEquipe = $('.bgSubBtMultipla .btEquipe');
	var btDiretoria = $('.bgSubBtMultipla .btDiretoria');	
	var btProxEventos = $('.bgSubBtEventos .btProxEventos');
	var btEventosAnt = $('.bgSubBtEventos .btEventosAnt');
	var btCasadinhas = $('.bgSubBtEventos .btCasadinhas');
	var btPromocoes = $('.bgSubBtEventos .btPromocoes');	
	var btFotos = $('.bgSubBtGaleria .btFotos');
	var btVideos = $('.bgSubBtGaleria .btVideos');
	
	
	botao.hover(function(){
		var botaoOver = $(this).find('.botaoOver');
		var submenu = $(this).find('.bgSubBt');				 
						 
		botaoOver.fadeIn(function(){
			if(botaoOver.css('display')=='block'){						  
				submenu.show();
			}
		});		
				
	}, 
	function () {
		var botaoOver = $(this).find('.botaoOver');
		var submenu = $(this).find('.bgSubBt');	
		
		if(submenu.css('display')=='block'){
			submenu.hide();
		}
		if(botaoOver.css('display')=='block'){
			botaoOver.hide();
		}
		
	});
	
	//btQuemSomos
	btQuemSomos.hover(function(){		
		$(this).addClass('btQuemSomosOver');	
	}, 
	function () {
		$(this).removeClass('btQuemSomosOver');
	});
	
	//btEquipe
	btEquipe.hover(function(){		
		$(this).addClass('btEquipeOver');	
	}, 
	function () {
		$(this).removeClass('btEquipeOver');
	});
	
	//btDiretoria
	btDiretoria.hover(function(){		
		$(this).addClass('btDiretoriaOver');	
	}, 
	function () {
		$(this).removeClass('btDiretoriaOver');
	});
	
	//btProxEventos
	btProxEventos.hover(function(){		
		$(this).addClass('btProxEventosOver');	
	}, 
	function () {
		$(this).removeClass('btProxEventosOver');
	});
	
	//btEventosAnteriores
	btEventosAnt.hover(function(){		
		$(this).addClass('btEventosAntOver');	
	}, 
	function () {
		$(this).removeClass('btEventosAntOver');
	});
	
	//btCasadinhas
	btCasadinhas.hover(function(){		
		$(this).addClass('btCasadinhasOver');	
	}, 
	function () {
		$(this).removeClass('btCasadinhasOver');
	});
	
	//btPromocoes
	btPromocoes.hover(function(){		
		$(this).addClass('btPromocoesOver');	
	}, 
	function () {
		$(this).removeClass('btPromocoesOver');
	});
	
	//btFotos
	btFotos.hover(function(){		
		$(this).addClass('btFotosOver');	
	}, 
	function () {
		$(this).removeClass('btFotosOver');
	});
	
	//btVideos
	btVideos.hover(function(){		
		$(this).addClass('btVideosOver');	
	}, 
	function () {
		$(this).removeClass('btVideosOver');
	});
	
}

/*---------------------------- Fun��o Mostra PopUp Fale Conosco  --------------------------------*/

function mostraPopUpFaleConosco(acao){
    
    popUp = $(".popUpMsgFaleConosco");
    msg = $(".popUpMsgFaleConosco .boxPop .meioPop .iconeMsg"+acao);
    
    msg.show();
    popUp.show();
}



/*------------------------------------ Setando as estrelas da vota��o de Fotos (Fotos) ------------------------------------------*/
function votacaoFotos(){
	var ativado=0;	
	function ativacaoEstrela(num){
		$(".boxVotacaoFotoSelecionado .estrela").each(function (i) {
			if(i+1<=num){
				$(this).addClass('estrelaAtiva');		   
			}else{
				$(this).removeClass('estrelaAtiva');
			}
		});
	}
	
	$(".boxVotacaoFotoSelecionado .estrela").each(function (i) {												 
	  	$(this).click(function(){
			ativacaoEstrela(i+1);
			ativado=i+1;
		});
		
		$(this).hover(function () {
			ativacaoEstrela(i+1);
		  }, function () {
			if(ativado==0){  
				ativacaoEstrela(0);
			}else{
				ativacaoEstrela(ativado);
			}
		  }
		);

		
	});
}

/*------------------------------------ Mostrar e esconder coment�rios (Fotos) ------------------------------------------*/

function mostrarEsconderComentarios(){

    var btQtdComentario = $('.pagFotos .btQtdComentario');
    var btComentarios = $('.pagFotos .btComentario');
	var boxComentarios = $('.pagFotos .boxVer');
	
	var btComentar = $('.pagFotos .btComentar');
	var boxComentar = $('.pagFotos .boxEscrever');
	
	btComentarios.click(function() {
	    boxComentarios.slideToggle();
	    boxComentar.slideUp();
	});
	
	btQtdComentario.click(function() {
	    boxComentarios.slideToggle();
	    boxComentar.slideUp();
	});
	 
	btComentar.click(function() {
	    boxComentar.slideToggle();
	    boxComentarios.slideUp();
	});
}

/*------------------------------------ Fun��o do menu da pagina de Galeria de Fotos ( jCarouselLite ) ------------------------------------------*/

function setaGaleriaFotos(){

    $(".pagFotos .boxGaleria .bgFotos .areaFoto").jCarouselLite({
        btnNext: ".pagFotos .boxGaleria .bgFotos .btSetaProx",
        btnPrev: ".pagFotos .boxGaleria .bgFotos .btSetaAnt",
        visible: 1
    });
    
}


/*------------------------------------ Fun��o da galeria de fotos da pagina de Equipe ( jCarouselLite ) ------------------------------------------*/

function galeriaPagFotos(){

     $(".pagFotos .boxGaleria .bgFotos .areaFoto").jCarouselLite({
        btnNext: ".pagFotos .boxGaleria .bgFotos .btSetaProx",
        btnPrev: ".pagFotos .boxGaleria .bgFotos .btSetaAnt",
        visible: 1
    });
    
}

/*------------------------------------ Fun��o do menu da pagina de Equipe ( jCarouselLite ) ------------------------------------------*/

function menuPagEquipe(){

    $(".boxEquipe .menuBoxEquipe .jCarouselLite").jCarouselLite({
        btnNext: ".next",
        btnPrev: ".prev",
        vertical: true,
        visible: 1
    });
    
}

/*-----------------Seta Clique Bt Equipe (Equipe) ------------------*/

function setaClickBtEquipe(elemento, botao) {
    
     $(".conteudoEquipe .meioBoxEquipe .conteudoBoxEquipe").each(function(i){
        $(this).animate({ height: 'hide', opacity: 'hide' }, 'slow');
     });
     $(".menu .botao .baseBotao").each(function(i){
        $(this).removeClass("baseBotaoAtivo");
     });
     //mostra somente o elemento selecionado
     $(".conteudoEquipe .meioBoxEquipe ."+elemento).animate({ height: 'show', opacity: 'show' }, 'slow');
     $(botao).addClass("baseBotaoAtivo");
}


/* UTILIZAR ESSE CODIGO ABAIXO DEPOIS NA PAGINA DE DIRETORIA */

/*$(".conteudoEquipe .meioBoxEquipe .conteudoBoxEquipe").each(function(i){
    $(this).animate({ height: 'hide', opacity: 'hide' }, 'slow');
 });

//Bot�ões
 $(".menuBoxEquipe .menu .botao").each(function(i){
    $(this).click(function(){
        removerEquipe();
        $(".conteudoEquipe .meioBoxEquipe .equipe0"+(i+1)).animate({ height: 'show', opacity: 'show' }, 'slow');
    });
 });*/


/*-----------------Seta Clique na aba de Portfolio (Portfolio) ------------------*/

function setaClickBtPortfolio(elemento, botao) {
     
     var conteudo = $(".boxPortfolio .meioBoxPortfolio ."+elemento);
     
     if(conteudo.css('display')!="block"){
     
         $(".boxPortfolio .meioBoxPortfolio .conteudoPortfolio").each(function(i){
            $(this).animate({ height: 'hide', opacity: 'hide' }, 'slow');
         });
         $(".boxPortfolio .menuBoxPortfolio .botaoAba").each(function(i){
            $(this).removeClass("botaoAbaAtivo");
         });
         //mostra somente o elemento selecionado
         conteudo.animate({ height: 'show', opacity: 'show' }, 'slow');
         $(botao).addClass("botaoAbaAtivo");
         
     }
}

/* ---------------------- fun�o mostrar v�deos -------------------*/
	
function videoDetalhe(video,videoId,img){
    var playerVideo = $(".boxFoto");
    var htmlPlayerVideo = '';
    
    //apagando o html existente
    playerVideo.html(htmlPlayerVideo);
    
    //setando o html do player de video com o video a ser carregado    
    
    htmlPlayerVideo= "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0' width='460' height='425'>";
    htmlPlayerVideo=htmlPlayerVideo+"<param name='movie' value='swf/player.swf' />";
    htmlPlayerVideo = htmlPlayerVideo + "<param name='quality' value='high' />";
    htmlPlayerVideo=htmlPlayerVideo+"<param name='flashvars' value='videoCarregar="+video+"&img="+img+"' />";
    htmlPlayerVideo=htmlPlayerVideo+"<embed src='swf/player.swf' width='460' height='425' quality='high' pluginspage='http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' flashvars='videoCarregar="+video+"&img="+img+"'></embed>";
    htmlPlayerVideo=htmlPlayerVideo+"</object>";
    
    playerVideo.html(htmlPlayerVideo);
	
	if (videoId != ""){
	
		try{
		   var xmlhttp =  new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){};
	
		try{
			var xmlhttp =  new ActiveXObject("Microsoft.XMLHTTP");
		}catch(e){};
	
		try{
		  var  xmlhttp =  new XMLHttpRequest();
		}catch(e){};
		
		xmlhttp.open("GET", "videos_contAcessos.asp?videoId="+videoId, true);
		xmlhttp.send(null);
	}

}

/* ---------------------- fun��o Vota��o V�deos -------------------*/
	
function videoVotacao(videoId,nota){

    	
	if (videoId != ""){
	
		try{
		   var xmlhttp =  new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){};
	
		try{
			var xmlhttp =  new ActiveXObject("Microsoft.XMLHTTP");
		}catch(e){};
	
		try{
		  var  xmlhttp =  new XMLHttpRequest();
		}catch(e){};
		
		xmlhttp.open("GET", "videos_votacao.asp?videoId="+videoId+"&nota="+nota, true);
		xmlhttp.onreadystatechange = function() {
	        if(xmlhttp.readyState == 4) {
	            if(xmlhttp.status == 200) {
	                alert(xmlhttp.responseText);
	            }
	        }
		}
		xmlhttp.send(null);
	}

}

/* ---------------------- função mostrar vídeos Home -------------------*/
	
function videoHome(video){
    var playerVideo = $(".flashVideo");
    var htmlPlayerVideo = '';
    
    //apagando o html existente
    playerVideo.html(htmlPlayerVideo);
    
    //setando o html do player de video com o video a ser carregado    
    
    htmlPlayerVideo= "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0' width='460' height='425'>";
    htmlPlayerVideo=htmlPlayerVideo+"<param name='movie' value='swf/player.swf' />";
    htmlPlayerVideo=htmlPlayerVideo+"<param name='quality' value='high' />";
    htmlPlayerVideo=htmlPlayerVideo+"<param name='flashvars' value=videoCarregar="+video+" />";
    htmlPlayerVideo=htmlPlayerVideo+"<embed src='swf/player.swf' width='460' height='425' quality='high' pluginspage='http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' flashvars=videoCarregar="+video+"></embed>";       
    htmlPlayerVideo=htmlPlayerVideo+"</object>";
    
    playerVideo.html(htmlPlayerVideo);

}