//Função que modela botões
jQuery(function() {
   jQuery.support.borderRadius = false;
   jQuery.each(['BorderRadius','MozBorderRadius','WebkitBorderRadius','OBorderRadius','KhtmlBorderRadius'], function() {
      if(document.body.style[this] !== undefined) jQuery.support.borderRadius = true;
      return (!jQuery.support.borderRadius);
   });
});
jQuery(function() {
   if(!jQuery.support.borderRadius) {
      jQuery('.botao').each(function() {
         jQuery(this).wrap('<div class="botaowrap"></div>')
         .before('<div class="corner tl"></div><div class="corner tr"></div>')
         .after('<div class="corner bl"></div><div class="corner br"></div>');
      });
   }
});
//Fução que centraliza conteudo em float
jQuery.fn.centerFloat = function(elementPai) {
	var w = $(elementPai);
    this.css('position','absolute');
	var childWidth = this.outerWidth(true);
	var meioWidth = (childWidth+(childWidth/2))/2;
	var novoLeft = (w.width()-meioWidth)/2+w.scrollLeft();
    this.css('left',(novoLeft + 'px'));
    return this;
}
jQuery(document).ready(function(){
	//Limpa valores padrões de inputs
	jQuery('#form-painel input:text, #form-newsletter input:text').clearDefault();	
	
	//Alinhando altura de divs
	jQuery('.conteudo-bloco-1, .conteudo-bloco-2, .conteudo-bloco-3').equalHeight();
	
	//Arredondando cantos de div
	jQuery('#texto-destaque, #faq-assunto ul li, #ar-passos ul li').corner();
	jQuery('.botao, .ul_subpages a').hover(function(){
		Cufon.replace(this, { 
					  fontFamily: 'Corbel',
					  color: '#FFF' });								
	}, function(){	
		Cufon.replace(this, { 
					  fontFamily: 'Corbel',
					  color: '#757575' });		
	});
	
	jQuery('ul.ul_subpages li.current_page_item a').hover(function(){
		Cufon.replace(this, { 
					  fontFamily: 'Corbel',
					  color: '#FFF' });								
	}, function(){	
		Cufon.replace(this, { 
					  fontFamily: 'Corbel',
					  color: '#FFF' });		
	});
	jQuery("a.vocpossui").click(function(){
		jQuery('div.possuicodigopromo').slideToggle('fast');
		return false;
	});
	//Verificando preenchimento do formulário de proposta
	jQuery('#proposta_listas').change(function() {
		var valueSelect = jQuery('#proposta_listas option:selected').val();
		var valueOpcao = jQuery('#proposta_listas option:eq(6)').val();
		if(valueSelect == valueOpcao){
			jQuery('#campos_dep_lista').fadeOut('slow', function() {
				jQuery('#obs_listas').slideToggle();
		    });
		}else{
			jQuery('#campos_dep_lista').fadeIn("slow", function() {
				jQuery('#obs_listas').fadeOut('slow');
		    });
		}
	});
	//Verificando preenchimento do formulário de proposta
	jQuery('#ja_enviou').change(function() {
		var valueSelect = jQuery('#ja_enviou option:selected').val();
		if(valueSelect == 'Sim'){
			jQuery('.ferr').fadeIn('slow');
		}else{
			jQuery('.ferr').fadeOut('slow');
		}
	});

	
});

