
      $(function(){
          $("#campo-resultado").fancybox({
              'width'         : 550,
              'height'        : 280,
              'transitionIn'  : 'elastic',
              'transitionOut' : 'elastic',
              'speedIn'   : 600,
              'speedOut'    : 200,
              'overlayShow' : true,
              'centerOnScroll' : true,
              'overlayColor': '#000',
              'overlayOpacity': 0.8,
              'titleShow': false
          });
          
          
  	    if(jQuery("#lista_noticia li").length>1){	      
	        jQuery("#lista_noticia").jcarousel({
	            scroll: 1,
	            easing: 'easeOutExpo',
	            animation: 1300,
	            auto: 6,
							wrap: 'last',
	            initCallback: initCallbackCarouselNoticia,
	            itemFirstInCallback:  {onBeforeAnimation: itemFirstInCallbackNoticia},
	            buttonNextHTML: null,
	            buttonPrevHTML: null
	         });
	    }
          
          
      });

      
      // Configura os Botões Carrosel Noticia
      function initCallbackCarouselNoticia(carousel) {
          jQuery('#navegacao_noticias li a').bind('click', function() {
              carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
              return false;
          });

      };

      // Iten Visible
      function itemFirstInCallbackNoticia(carousel, item, idx, state) {

      	  $("#navegacao_noticias li").each(function(j){

                if((j+1)== idx)
                  $(this).addClass('active');
                else
                  $(this).removeClass('active');
          });

      };      
      
      
      
    //Objeto para Enquete
      var Enquete = {
      		
      		/* Release form in the Ajax content*/		
      		release : function(form){
      			jQuery('#campos-enquete').hide();
      			jQuery('#campo-votar').hide();
      			jQuery('#msgReturn-enquete').html('* Aguarde <strong>totalizando</strong> o voto!').fadeIn();		
      			with(form) {
      				
      				jQuery.ajax({							
      					url:'/assets/ajax/enquete.php', type:'post', data:jQuery(form).serialize(),								
      					success:function(response) {
      						 
      						
      						if(response == "error"){
      							jQuery('#campos-enquete').fadeOut(100, function(){jQuery('#msgReturn-enquete').html('* <strong>Problemas</strong> tente mais tarde!').fadeIn()});						
      							setTimeout(function() { jQuery('#msgReturn-enquete').fadeOut(100,function(){jQuery('#campos-newslleter').fadeIn()});}, 4100);	
      						}
      						
      						if(response == "ok"){
      							$("#campo-resultado").show();
      							jQuery('#campos-enquete').fadeOut(100, function(){jQuery('#msgReturn-enquete').html('* Seu voto já foi <strong>contabilizado obrigado!</strong>').fadeIn()});      							
      							$(".botoes_enquete input").hide();
      						}      						
      							
      						
      					}				
      				});
      				
      				return false;
      			}			
      		}	
      	}

      
      
      
      // Objeto para Newslleter
      var Newslleter = {
      		
      		/* Validate form */
      		validate : function(form) {
      				with(form) {
      					
      					if(nome.value == "" || email.value == "" || nome.value == "Nome:" || email.value == "E-mail:" ) {
      						
      						jQuery('#campos-newslleter').fadeOut(100, function(){jQuery('#msgReturn').html('* <strong>Nome</strong> deve ser Preenchido! <br /> * <strong>E-mail</strong> deve ser Preenchido!').fadeIn()});						
      						setTimeout(function() { jQuery('#msgReturn').fadeOut(100,function(){jQuery('#campos-newslleter').fadeIn()});}, 4100);
      						
      					} else if(email.value.indexOf("@") == -1){
      						
      						jQuery('#campos-newslleter').fadeOut(100, function(){jQuery('#msgReturn').html('* <strong>E-mail</strong> incorreto!').fadeIn()});						
      						setTimeout(function() { jQuery('#msgReturn').fadeOut(100,function(){jQuery('#campos-newslleter').fadeIn()});}, 4100);
      						
      					}else{					
      						this.release(form);
      					}
      				}
      				return false;
      			},		

      		/* Release form in the Ajax content*/		
      		release : function(form){				
      						
      			with(form) {				
      				jQuery.ajax({							
      					url:'/assets/ajax/cadastrar.php', type:'post', data:jQuery(form).serialize(),								
      					success:function(response) {
      						
      						
      					
      						if(response == "EmailExists"){
      							jQuery('#campos-newslleter').fadeOut(100, function(){jQuery('#msgReturn').html('* <strong>E-mail</strong> já existe!').fadeIn()});						
      							setTimeout(function() { jQuery('#msgReturn').fadeOut(100,function(){jQuery('#campos-newslleter').fadeIn()});}, 4100);	
      						}
      						
      						if(response == "Ok"){
      							jQuery('#campos-newslleter').fadeOut(100, function(){jQuery('#msgReturn').html('* <strong class="cadastro_sucess">E-mail</strong> cadastrato com sucesso!').fadeIn()});						
      							setTimeout(function() { jQuery('#msgReturn').fadeOut(100,function(){jQuery('#campos-newslleter').fadeIn()});}, 4100);
      							nome.value = "";
      							email.value = "";
      						}
      						
      						
      							
      						return false;
      					}				
      				});	
      			}			
      		}	
      	}
      
      
      
      function addFavorito(url){
    		if (document.all) window.external.AddFavorite(url, "Jornal Palavra Cristã ");
    		else if (window.sidebar) window.sidebar.addPanel("Jornal Palavra Cristã ", url, "");
    	}


      
   // Tamanho Fonte
      function ChangeFontSize(acao) {
      	var ObjTexto		= (document.getElementById) ? document.getElementById('textos_site') : document.all('textos_site');
      	if(ObjTexto==null){
      		var ObjTexto	= (document.getElementById) ? document.getElementById('textos_site') : document.all('textos_site');
      	};
      	var FonteTamAtual	= parseInt(document.getElementById('query_busca').diversos.value);	
      	switch(acao){
      		case '+':
      			FonteTamNovo	=	FonteTamAtual+2;
      			break;
      		case '-':
      			FonteTamNovo	=	FonteTamAtual-2;
      			break;		
      	}
      	document.getElementById('query_busca').diversos.value	=	FonteTamNovo;
      	ObjTexto.style.fontSize				=	FonteTamNovo+"px";
      }
      
      function pop_up_center(local, w, h, scrol)
      {
      	var instan	=	local.replace(/\./g,"");
      	instan		=	instan.replace(/\?/g,"");
      	instan		=	instan.replace(/\//g,"");
      	instan		=	instan.replace(/=/g,"");
      	instan		=	instan.replace(/;/g,"");
      	instan		=	instan.replace(/:/g,"");
      	instan		=	instan.replace(/-/g,"");

      	var largura = screen.width;
      	var altura 	= screen.height;
      	var XX 		= (largura-w)/2;
      	var YY		= (altura-h)/2;
      	var janela  = window.open(local,'POP_UP'+instan,'width='+w+',height='+h+',left='+XX+',top='+YY+',scrollbars='+scrol+',status=no,resizable=yes, toolbar=no,directories=no,menubar=no');
      	janela.focus();
      }
      
      
      
