$(document).ready(function() {

	$("#menu li a").click(function(e) {
		if($(this).attr("href") == "" || $(this).attr("href") == "#") {
			$("ul.sub",$(this).parent()).slideToggle();
			e.preventDefault();
		}
	});
	
	$("ul.escolha input").change(function() {
		var e = $(this).val();
		$(".boxFormularios").slideUp("slow",function() {
			$(e).slideDown("slow");	
		});					  
	});

	// ----------------------------------------------------------------
	// CADASTRO PF
	// ----------------------------------------------------------------
	$(".noticias-PF input").change(function() {
			if( $(this).val() == 1)
				$("#listaNoticias-PF").slideDown();
			else
				$("#listaNoticias-PF").slideUp();
	});
	//
	$(".callFriends-PF input").change(function() {
			if( $(this).val() == 1)
				$("#listaContatos-PF").slideDown();
			else
				$("#listaContatos-PF").slideUp();
	});



	// ----------------------------------------------------------------
	// CADASTRO PJ
	// ----------------------------------------------------------------
	$(".noticias-PJ input").change(function() {
			if( $(this).val() == 1)
				$("#listaNoticias-PJ").slideDown();
			else
				$("#listaNoticias-PJ").slideUp();
	});
	//
	$(".callFriends-PJ input").change(function() {
			if( $(this).val() == 1)
				$("#listaContatos-PJ").slideDown();
			else
				$("#listaContatos-PJ").slideUp();
	});	  

	//$('.cnpjMask').mask("99.999.999/9999-99");
//	$('.cpfMask').mask("999.999.999-99");
	//$('.cepMask').mask("99999-999");
	//$('.foneMask').mask("(99)9999-9999");
	//
	$('#form_login .radioLoginCheck').click( function(){
		if( $("input[@name='type']:checked").val() == 'pf')
		{
		
			$('input#login-cpf').show();
			$('input#login-cnpj').hide();
		}
		else
		{
			$('input#login-cpf').hide();
			$('input#login-cnpj').show();
		}
	});
				
	
	$('#LinkPatrocinadorC').click(function(){
		$('#TabelaColaboradores').slideDown('slow');
		$('#patro').hide(1000);			
		$('#colab').show(3000);			
		$('#TabelaPatrocinadores').fadeOut('slow');			
	});
	
	$('#LinkPatrocinadorB').click(function(){
		$('#TabelaColaboradores').fadeOut('slow');
		$('#colab').hide(1000);
		$('#patro').show(3000);						
		$('#TabelaPatrocinadores').slideDown('slow');
	});
	
	$('#LinkColaborador').click(function(){
		$('#TabelaColaboradores').toggle('slow');
	});
	
	$('#LinkPlantioP').click(function(){
		$('#Plant_colaboradores').hide(3000);
		$('#Plant_patrocinadoras').hide(3000);
		$('#Plant_fisicas').show(3000);
	});
	
	$('#LinkPlantioC').click(function(){
		$('#Plant_fisicas').hide(3000);
		$('#Plant_patrocinadoras').hide(3000);
		$('#Plant_colaboradores').show(3000);			
	});
	
	
	$('#LinkPlantioPa').click(function(){
			$('#Plant_colaboradores').hide(3000);
			$('#Plant_fisicas').hide(1000);
			$('#Plant_patrocinadoras').show(3000);

	});			


});



	//FUN��ES DE VALIDA��O DA CALCULADORA ##########################################################################
	//##############################################################################################################
	function valida_quantidadeMudas(){
		
		var arvores = document.getElementById('arvores').value;
		if (parseFloat(arvores) > parseFloat(5000)){			
				alert('O limite maximo de compra é de 5000.\nObrigado -- SOS Mata Atlantica.');
				return false;
			}
		
		}
		
	function mudar_cor_over(celula)	{
		celula1 = document.getElementById("celula");
   		celula1.style.backgroundColor="#66ff33";
   		alert('Teste1');
	}
	
	function mudar_cor_out(celula)	{
		celula1 = document.getElementById("celula");
   		celula1.style.backgroundColor="#dddddd";
   		alert('Teste2');
	} 	
	


/*CSS Browser Selector v0.3.2Rafael Lima (http://rafael.adm.br)http://rafael.adm.br/css_browser_selectorLicense: http://creativecommons.org/licenses/by/2.5/Contributors: http://rafael.adm.br/css_browser_selector#contributors*/function css_browser_selector(u){var ua = u.toLowerCase(),is=function(t){return ua.indexOf(t)>-1;},g='gecko',w='webkit',s='safari',h=document.getElementsByTagName('html')[0],b=[(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3')?g+' ff3':is('gecko/')?g:/opera(\s|\/)(\d+)/.test(ua)?'opera opera'+RegExp.$2:is('konqueror')?'konqueror':is('chrome')?w+' chrome':is('applewebkit/')?w+' '+s+(/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?'mobile':is('iphone')?'iphone':is('ipod')?'ipod':is('mac')?'mac':is('darwin')?'mac':is('webtv')?'webtv':is('win')?'win':is('freebsd')?'freebsd':(is('x11')||is('linux'))?'linux':'','js']; c = b.join(' '); h.className += ' '+c; return c;}; css_browser_selector(navigator.userAgent); 
	
