/**
 * @author Iparos Design (http://www.iparos.com.br)
 */
function $(id){
	return document.getElementById(id);
}
function fazAjax(){
	try{return new ActiveXObject("Msxml2.XMLHTTP");} catch(e){ }
	try{return new ActiveXObject("Microsoft.XMLHTTP");} catch(e){ }
	try{return new XMLHttpRequest(); } catch(e){ }
	alert("Navegador muito Antigo");
	return null;
}

function preencheCPF(){
	if($('cpf').value.length == 3 || $('cpf').value.length == 7){
		$('cpf').value = $('cpf').value + ".";
	}else if($('cpf').value.length == 11){
		$('cpf').value = $('cpf').value + "-";
	}				
}
function preencheNascimento(){
	if($('nascimento').value.length == 2 || $('nascimento').value.length == 5){
		$('nascimento').value = $('nascimento').value + "/";
	}				
}
function preencheTelefone(){
	if($('telefone').value.length == 4 ){
		$('telefone').value = $('telefone').value + "-";
	}
	if($('celular').value.length == 4 ){
		$('celular').value = $('celular').value + "-";
	}			
}
function pula(de,para){
	if($(de).value.length == $(de).maxLength){
		$(para).focus();
	}
}
function limpaBusca(){
	if($('campoBusca').value == 'busca...'){
		$('campoBusca').value = '';
	}
}
function colocaBusca(){
	if($('campoBusca').value == ''){
		$('campoBusca').value = 'busca...';
	}
}
function preencheData(id){
	if($(id).value.length == 2 || $(id).value.length == 5){
		$(id).value = $(id).value + "/";
	}				
}
function limitaCampo(id, max){
	if($(id).length == max){
		alert("A descrição deve ter no máximo" + max + "caracteres.");
		$(id).length = $(id).length;
	}
}


//Menu

function mudaCor(id){
	if(id == 'inicio' || id == 'fale'){
		$(id).className = 'menuAtivoLateral';
	}else{
		$(id).className = 'menuAtivo';
	}	
}
function colocaSubMenu(id){
	if(id == "nucleos"){
		var nomeMenu = Array('Pratica de Gestão', 'Pesquisa de Mercado', 'Tecnologia da Informação', 'Eventos e Treinamentos', 'Gestão Ambiental');
	}
}