$(document).ready(function(){ 
	function popup(u, h, w, n) { if (n == "") { n = '_pop'}; nw = window.open(u, n, "width="+w+"px, height="+h+"px, scrollbars=yes, top ="+((screen.height-h)/2)+", left ="+((screen.width-w)/2)); if (window.focus) { nw.focus() } return false; }
	function html2entities(str){var keys = new Array("&amp;", "&nbsp;", "&iexcl;", "&cent;", "&pound;", "&curren;", "&yen;", "&brvbar;", "&sect;", "&uml;", "&copy;", "&ordf;", "&laquo;", "&not;", "&shy;", "&reg;", "&macr;", "&deg;", "&plusmn;", "&sup2;", "&sup3;", "&acute;", "&micro;", "&para;", "&middot;", "&cedil;", "&sup1;", "&ordm;", "&raquo;", "&frac14;", "&frac12;", "&frac34;", "&iquest;", "&Agrave;", "&Aacute;", "&Acirc;", "&Atilde;", "&Auml;", "&Aring;", "&AElig;", "&Ccedil;", "&Egrave;", "&Eacute;", "&Ecirc;", "&Euml;", "&Igrave;", "&Iacute;", "&Icirc;", "&Iuml;", "&ETH;", "&Ntilde;", "&Ograve;", "&Oacute;", "&Ocirc;", "&Otilde;", "&Ouml;", "&times;", "&Oslash;", "&Ugrave;", "&Uacute;", "&Ucirc;", "&Uuml;", "&Yacute;", "&THORN;", "&szlig;", "&agrave;", "&aacute;", "&acirc;", "&atilde;", "&auml;", "&aring;", "&aelig;", "&ccedil;", "&egrave;", "&eacute;", "&ecirc;", "&euml;", "&igrave;", "&iacute;", "&icirc;", "&iuml;", "&eth;", "&ntilde;", "&ograve;", "&oacute;", "&ocirc;", "&otilde;", "&ouml;", "&divide;", "&oslash;", "&ugrave;", "&uacute;", "&ucirc;", "&uuml;", "&yacute;", "&thorn;", "&yuml;", "&quot;", "&lt;", "&gt;", "");var values = new Array("&", " ", "¡", "¢", "£", "¤", "¥", "¦", "§", "¨", "©", "ª", "«", "¬", "­", "®", "¯", "°", "±", "²", "³", "´", "µ", "¶", "·", "¸", "¹", "º", "»", "¼", "½", "¾", "¿", "À", "Á", "Â", "Ã", "Ä", "Å", "Æ", "Ç", "È", "É", "Ê", "Ë", "Ì", "Í", "Î", "Ï", "Ð", "Ñ", "Ò", "Ó", "Ô", "Õ", "Ö", "×", "Ø", "Ù", "Ú", "Û", "Ü", "Ý", "Þ", "ß", "à", "á", "â", "ã", "ä", "å", "æ", "ç", "è", "é", "ê", "ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô", "õ", "ö", "÷", "ø", "ù", "ú", "û", "ü", "ý", "þ", "ÿ", "\"", "<", ">", "");for(var i=0; i<keys.length; i++){ if(values[i]!="&nbsp;"){ str = str.replace(keys[i], values[i]); } }return str;}
	function objR() { if(navigator.appName == "Microsoft Internet Explorer"){ return new ActiveXObject("Microsoft.XMLHTTP"); } else { return new XMLHttpRequest(); } }
	var http = objR();
});


$(document).ready(function(){
	//EFEITO DO MENU - SIDEBAR
	slide("#menuside", 35, 26, 0, 0.8);	
	
	//BOTAO COMPARTILHE
	/*$('.compartilhe').mouseover(function(){
		$(this).css('background-position','0px 0px');
	}).mouseout(function(){
		$(this).css('background-position','0px -40px');
	});*/
	
	// BOTAO ENVIAR
	/*$('.enviar').mouseover(function(){
		$(this).css('background-position','0px 0px');	
	}).mouseout(function(){
		$(this).css('background-position','0px -43px');
	});*/
	
	// BOTAO VER RESULTADO
	/*$('.results').mouseover(function(){
		$(this).css('background-position','-91px 1px');	
	}).mouseout(function(){
		$(this).css('background-position','-91px -41px');
	});*/
	
	// BOTAO VER VOLTAR
	/*$('.voltar').mouseover(function(){
		$(this).css('background-position','0px -87px');	
	}).mouseout(function(){
		$(this).css('background-position','0px -133px');
	});*/
	
	//BOTÃO ANTERIOR - LTB
	/*$('.ltb-ant').mouseover(function(){
		if (!$(this).hasClass('inativo')){ $(this).css('background-position','0px -36px'); }	
	}).mouseout(function(){
		if (!$(this).hasClass('inativo')){ $(this).css('background-position','0px 0px'); }
	});*/
	
	//BOTÃO PROXIMO - LTB
	/*$('.ltb-pro').mouseover(function(){
		if (!$(this).hasClass('inativo')){ $(this).css('background-position','-92px -35px'); }	
	}).mouseout(function(){
		if (!$(this).hasClass('inativo')){ $(this).css('background-position','-91px 0px'); }
	});*/
	
	
	//ACCORDION - EMPREGOS
	$('#accordion .head').each(function(e){
		$(this).bind('mouseover',function(){
			if ($(this).hasClass('inativo')){
				$(this).addClass('ativo').removeClass('inativo');
				
				if ($('.icon-acco').eq(e).hasClass('inativo')){
					$('.icon-acco').eq(e).addClass('ativo').removeClass('inativo');
				}
			}	
		});
		$(this).bind('mouseout',function(){
			if ($(this).hasClass('ativo')){
				$(this).addClass('inativo').removeClass('ativo');
				
				if ($('.icon-acco').eq(e).hasClass('ativo')){
					$('.icon-acco').eq(e).addClass('inativo').removeClass('ativo');
				}
			}	
		});
		$(this).bind('click',function(){
			
			if ($('.icon-acco').eq(e).hasClass('esconde')){
				$('.icon-acco').eq(e).addClass('exibe').removeClass('esconde');
			} else {
				$('.icon-acco').eq(e).addClass('esconde').removeClass('exibe');	
			}	
		});
		
	});
	
	$('#accordion .head').click(function() {
		
		if (!$(this).hasClass('ultimo')){
			$(this).addClass('ultimo');
			$(this).next().slideDown('slow');
		} else {
			$(this).removeClass('ultimo');
			$(this).next().slideUp('slow');
		}
		
		
		$(this).parent().find('.icon-acco').removeClass('atual');
		
		/*if ($(this).hasClass('atual')){
			$(this).removeClass('atual');
		} else {*/
			//$('.icon-acco').addClass('atual');
		//}
		
		return false;
	}).next().hide();


	
});

function newsOver(id){
	$('li#'+id).removeClass('opa');
	$('li#'+id+' span').addClass('txt04').removeClass('txt06');
}

function newsOut(id){
	$('li#'+id).addClass('opa');
	$('li#'+id+' span').addClass('txt06').removeClass('txt04');
}

function slide(navigation_id, pad_out, pad_in, time, multiplier)
{
	// creates the target paths
	var list_elements = navigation_id + " li.sliding-element";
	var link_elements = list_elements + " a";
	
	// initiates the timer used for the sliding animation
	var timer = 0;
	
	// creates the slide animation for all list elements 
	$(list_elements).each(function(i)
	{
		// margin left = - ([width of element] + [total vertical padding of element])
		$(this).css("margin-left","-180px");
		// updates timer
		timer = (timer*multiplier + time);
		$(this).animate({ marginLeft: "0" }, timer);
		$(this).animate({ marginLeft: "26px" }, timer);
		$(this).animate({ marginLeft: "0" }, timer);
	});

	// creates the hover-slide effect for all link elements 		
	$(link_elements).each(function(i)
	{
		$(this).hover(
		function()
		{
			$(this).animate({ paddingLeft: pad_out }, 150);
			//$(this).css("color","#B4191E"});
		},		
		function()
		{
			$(this).animate({ paddingLeft: pad_in }, 150);
		});
	});
}

function fcOn(id,dv){
	$('input#'+id).addClass('ipton').removeClass('iptoff');
	$('#'+dv).addClass('fcon').removeClass('fcoff');
}

function fcOut(id,dv){
	$('input#'+id).addClass('iptoff').removeClass('ipton');
	$('#'+dv).addClass('fcoff').removeClass('fcon');
}

function fcOn2(id,dv){
	$('input#'+id).addClass('ipton2').removeClass('iptoff2');
	$('#'+dv).addClass('fcon2').removeClass('fcoff2');
}

function fcOut2(id,dv){
	$('input#'+id).addClass('iptoff2').removeClass('ipton2');
	$('#'+dv).addClass('fcoff2').removeClass('fcon2');
}

function fctOn(id,dv){
	$('textarea#'+id).addClass('txton').removeClass('txtoff');
	$('#'+dv).addClass('fcont').removeClass('fcofft');
}

function fctOut(id,dv){
	$('textarea#'+id).addClass('txtoff').removeClass('txton');
	$('#'+dv).addClass('fcofft').removeClass('fcont');
}

function nwOn(id,dv){
	$('input#'+id).addClass('ipton3').removeClass('iptoff3');
	$('#'+dv).addClass('nwon').removeClass('nwoff');
}

function nwOut(id,dv){
	$('input#'+id).addClass('iptoff3').removeClass('ipton3');
	$('#'+dv).addClass('nwoff').removeClass('nwon');
}

function showMap(){
	
	var agencia = $('select#fcagencia :selected').val();
	
	if (agencia == "1"){
		$('div#au').hide();
		$('div#co').hide();
		$('div#bra').fadeIn('slow');
	} else if (agencia == "2"){
		$('div#bra').hide();
		$('div#co').hide();
		$('div#au').fadeIn('slow');
	} else if (agencia == "3"){
		$('div#au').hide();
		$('div#bra').hide();
		$('div#co').fadeIn('slow');
	}
}

function equalHeight(group) {
	tallest = 0;
	group.each(function() {
		thisHeight = $(this).height();
		if(thisHeight > tallest) {
			tallest = thisHeight;
		}
	});
	group.height(tallest);
}

$(document).ready(function() {
	equalHeight($(".colunah"));
	equalHeight($(".lc01"));
	equalHeight($(".lc02"));
}); 

//NOTICIAS - HOME

$(document).ready(function(){
	
	//BANNER NEWS
	$('#aunews').click(function(){
		var url = $(this).find('a').attr('href');
		//alert(url);
		window.location.href=url;	
	});
	
	$('#aunews').mouseover(function(){
		window.status = $(this).find('a').attr('href');return true;
		//alert($(this).find('a').attr('href'));
	}).mouseout(function(){
		window.status = '';return true;
	});
	
	//LISTA NEWS
	$('ul#news-home li').each(function(){
		$(this).bind('click',function(e){
		
			var url = $(this).find('a').attr('href');
			//alert(url);
			window.location.href=url;
			
		});	
	});	
	
	
	
});

