// função para facilitar a vida.. heeh
function gE(ID){
	return document.getElementById(ID);
}

//função para mostrar algum elemento com displau none
function mostraElemento(param){
	var p = gE(param);
	
	if (p.style.display == 'none'){
		p.style.display = 'block';	
	}else{
		p.style.display = 'none';		
	}
	
}

// abre pop-up
function abrePopUp(url, id, largura, altura){
	window.open(url, id, 'width='+largura+', height='+altura+', scrollbars=no');
}

var Validacao = {
	ValidaItens: function(){
		var args = Validacao.ValidaItens.arguments; // coloca os parametros em uma variavel no qual se tornará um Array
		if (args.length > 0){ // verifica se há parametros atribuidos a função
			for (var x = 0; x < args.length; x++){
				var vItem = gE(args[x]);
				if (vItem.value == "" || vItem.value == null){
					vItem.focus();
					vItem.style.border = 'solid 1px red';
					alert("Campo em branco");
					return(false);
				}else{
					vItem.style.border = '';
				}				
				//verifica se há algum campo de e-mail para chamar o validaEmail
				var vCampo = args[x].toLowerCase();		
				if (vCampo.indexOf('email') > 0){
					if (Validacao.ValidaEmail(vItem) == false)
						return(false);
				}				
			} // fim do for			
			return(true);
		}else{
			alert('Ocorreu um erro ao realizar operação');
			return(false);			
		}// else (args.length > 0){
	}, // fim do ValidaItens
	
	ValidaEmail: function(pCampo){
		var email = pCampo.value;
		var resp = email.search(/(\w[\w\.\+]+)@(.+)\.(\w+)$/)==0;
		
		if (resp == false){
			pCampo.focus();
			pCampo.style.border = 'solid 1px red';
			alert('E-mail inválido');
			return(false);
		}else{
			return(true);
		}
	}
};

// FUNçÃO DE ALTERAR O TAMANHO DAS FONTES
var tam = 12;
	var lin = 1.5;
	function alterarTamanhoFonte(tipo, onde){
		
		var minimo = 7;
		var maximo = 20;
		vardomElement = gE(onde);
												  
		if( tipo == 'mais' ){
			if( tam < 16 ) tam += 2;
		}
		else{
			if( tam > 9 ) tam -= 2 ;
		}
		
		mudaFonte(tipo , document.getElementById(onde)) ;     
	}
	
	
	function mudaFonte( tipo , idM ){		
	  for( var i = 0 ; i < idM.childNodes.length ; i++ ){
		mudaFonte( tipo , idM.childNodes.item( i )  );
	  }
	  if( idM.style )
		idM.style.fontSize = tam+'px';
	}
