// JavaScript Document
jQuery.noConflict()
jQuery(document).ready(function()
{
	//--> inicio rodape |----------------------------------------------------
	//--> botão enviar |-----------------------------------------------------
	jQuery('#nome').focus(function (){
		if (jQuery(this).val() == descNome)
		{
			jQuery(this).val('');
		}
	});
	
	jQuery('#email').focus(function (){
		if (jQuery(this).val() == descEmail)
		{
			jQuery(this).val('');
		}
	});
	
	jQuery('#nome').blur(function (){
	if (jQuery(this).val() == '')
	{
		jQuery(this).val(descNome);
	}
	});
	
	jQuery('#email').blur(function (){
		if (jQuery(this).val() == '')
		{
			jQuery(this).val(descEmail);
		}
	});
	jQuery('#btEnviarRodape').hover(function() 
	{
		jQuery(this).css({backgroundPosition:'0px -35px'});
	}, 
	function () 
	{
		jQuery(this).css({backgroundPosition:'0px -0px'});
	}).click(function()
	{
		var nome = jQuery('#nome').val(); 
		var email = jQuery('#email').val(); 
		if (nome == '' || email == '' || nome == descNome || email==descEmail  )
		{
			if (linguagemJs == "pt")
			{
				jAlert('Preencha todos os campos', 'Atenção');
			}else if (linguagemJs == "es")
			{
				jAlert('Rellene todos los campos', 'Atención');
			}else if (linguagemJs == "en")
			{
				jAlert('Fill all fields, email and name', 'Atention');
			}
		}else
		{
			jQuery.post('php/cadastraNews.php',{_idioma:linguagemJs,_nome:nome,_email:email}, function (data)
			{
				if (data == true)
				{
					if (linguagemJs == "pt")
					{
						jAlert('Newsletter cadastrado', 'Obrigado');
					}else if (linguagemJs == "es")
					{
						jAlert('Boletín registrado', 'Gracias');
					}else if (linguagemJs == "en")
					{
						jAlert('Newsletter subscribed', 'Thank you');
					}
				}else
				{
					if (linguagemJs == "pt")
					{
						jAlert('Erro ao cadastrar, tente novamente', 'Atenção');
					}else if (linguagemJs == "es")
					{
						jAlert('Error al registrar, por favor, inténtelo de nuevo', 'Atención');
					}else if (linguagemJs == "en")
					{
						jAlert('Error registering, please try again', 'Atention');
					}
				}
			});
			
		}
	});	
	
	jQuery('#menuSiteIntRodape a').hover(function() 
	{
		
		jQuery(this).stop().animate({'color':'#2a6c3c'},400);
	}, 
	function () 
	{
		jQuery(this).stop().animate({'color':'#424242'},700);
	});
	//--> inicia menu Principal |---------------------------------------
	//--> efeito subMenu |----------------------------------------------
	jQuery('.subMenu a').hover(function() 
	{
		jQuery(this).stop().animate({'color':'#2a6c3c'},400);
		jQuery(this).parent("li").stop().animate({'background-position':'7px 4px'},100);
	}, 
	function () 
	{
		jQuery(this).stop().animate({'color':'#424242'},700);
		jQuery(this).parent("li").stop().animate({'background-position':'-10px 4px'},400);
	});
	var btSubMenuTemp = 0;
	
	jQuery('#menuPrincipalDiv > .itemMenu:last').css({'margin-right':'0px'});
	jQuery('.itemMenu').each(function(i) 
	{
		jQuery('.itemMenu:eq('+i+') > .subMenu > ol > li:first').css({'margin-left':'5px','text-indent':'0px','border-bottom':'#3f7138 solid 1px','width':'190px'});
		if(navigator.userAgent.match(/iPad/i) == null)
		{
			jQuery('.itemMenu:eq('+i+')').hover(function() 
			{
				jQuery('.itemMenu:eq('+i+') > .subMenu').addClass('itemMenuHover');
				jQuery('.itemMenu:eq('+i+') > .subMenu').css({'margin-left':"-100px"});
			}, 
			function () 
			{
				jQuery('.itemMenu:eq('+i+') > .subMenu').removeClass('itemMenuHover');
				jQuery('.itemMenu:eq('+i+') > .subMenu').css({'margin-left':'0px'});
			});			
		}else
		{
			//--> touch scroll |-------------------------------------------------------------------------			
			jQuery('#barraRodaContato').touchScroll();
			jQuery('.itemMenu:eq('+i+')').mousedown(function() 
			{
				jQuery('.itemMenu:eq('+i+') > .subMenu').addClass('itemMenuHover');
				jQuery('.itemMenu:eq('+i+') > .subMenu').css({'margin-left':"-100px"});		
				
					
				jQuery('.itemMenu:eq('+i+') > .subMenu').stop().delay(2000).fadeOut(300, function() 
				{	
					jQuery('.itemMenu:eq('+i+') > .subMenu').fadeIn(10);			
					jQuery('.itemMenu:eq('+i+') > .subMenu').removeClass('itemMenuHover');
					jQuery('.itemMenu:eq('+i+') > .subMenu').css({'margin-left':'0px'});					
				});						
			})
			jQuery('#topoMenuDiv, #menuBarraTopo, #divCenterBaixo, #menuPrincipalDiv, html, body').css({'width':'1024px'});							
		}
	});
	//--> inicio home |---------------------------------------------------------------
	//--> menu grupo |----------------------------------------------------------------
	jQuery('.btGrupoHome > a').each(function(b) 
	{
		if(b == 0) jQuery('.btGrupoHome:eq('+b+')').css({'margin-left':'-50px'});
		jQuery('.btGrupoHome:eq('+b+') .imgBt').css({'opacity':0});
		jQuery('.btGrupoHome:eq('+b+') > a').hover(function() 
		{
			jQuery('.btGrupoHome:eq('+b+') .imgBt').stop().animate({'opacity':1},400);
		}, 
		function () 
		{
			jQuery('.btGrupoHome:eq('+b+') .imgBt').stop().animate({'opacity':0},700);
		});
	});
	//--> botão mais |-----------------------------------------------------------------------
	
	jQuery('.bt-saiba-mais a, .bt-voltar a, .bt-enviar a').hover(function() 
	{
		jQuery(this).children("img").css({'top':'-35px'});
	}, 
	function () 
	{
		jQuery(this).children("img").css({'top':'0px'});
	});
	
	
	//--> menu paginacao itens |-------------------------------------------------------------
	jQuery('#menu-paginacao-itens div:last').css({'border-right':'none'});
	jQuery('#menu-paginacao-itens .on').css({backgroundColor: '#529048', color:'#FFFFFF'});
	jQuery('#menu-paginacao-itens .on a').css({color:'#FFFFFF'});
	jQuery('#menu-paginacao-itens a').hover(function() 
	{
		jQuery(this).parent('.btNum').stop().animate({'background-color':'#529048'},400);
		jQuery(this).stop().animate({'color':'#FFFFFF'},400);
	}, 
	function () 
	{
		jQuery(this).stop().animate({'color':'#424242'},400);
		jQuery(this).parent('.btNum').stop().animate({'background-color':'transparent'},700);
	});	
	jQuery('#texto-canal p, #texto-canal-empresa p').addClass('fontArial fontTamQuartoze corCinza');
	//--> Div Conteudo |-----------------------------------------------------------------------------
	jQuery('#divConteudo').css({'width':'980px'});	
	//--> Inicio canal contato |----------------------------------------------------------------------	
	//--> Trabalhe conosco |--------------------------------------------------------------------------
	

	//--> efeito botão baixo |------------------------------------------------------------------------	

	jQuery('.bt-submenu-contato a').hover(function() 
	{
		jQuery(this).parent().parent().parent().css({'background-position':'0px -66px'});
		jQuery(this).parent().parent().css({'background-color':'#5e5e5e'});		
		
		
	},function () 
	{
		jQuery(this).parent().parent().parent().css({'background-position':'0px 0px'});
		jQuery(this).parent().parent().css({'background-color':'#00842f'});
	});	
	
	jQuery(".bt-menu-noticas-grupo").hover(function()
	{
		///alert("opa") mouse hover noticia
	 	jQuery(".bt-menu-noticas-grupo").removeClass("onBoxNoticia");
		jQuery(this).addClass('onBoxNoticia'); 
		var e = jQuery(this).attr("id");		
		e = e.charAt(3);	
		id_noticia_home = e;
		e = e-1;
	 	jQuery("#totalImgNoticias").stop().animate({top:(e*-335)+'px'}, 500);
	});
	
	//--> hack para o opera |-------------------------------------------------------------------------
	if(jQuery.browser.opera)
	{		
		jQuery('.tituloCanal > span').css({'line-height':'5px'});
		jQuery('#selecIdiomaDiv > span').css({'top':'-1px'});	
	}
});
function showImagemHome(_imagem)
{
	jQuery("#img-noticas-grupo").animate({opacity:0}, 500, function()
	{
		jQuery("#img-noticas-grupo").attr('style', 'background-image:url(administracao/imagens/noticia/media/'+_imagem+')');
	});
	jQuery("#img-noticas-grupo").animate({opacity:1}, 500);	
}
