function hideTagSelect(hidSho){
	var tags = document.getElementsByTagName("select");
	for (i = 0; i < tags.length; i++) {
		if (hidSho) {
			tags[i].style.visibility = 'visible';
		} else {
			tags[i].style.visibility = 'hidden';			
		}
	}
}
function url(obj){
	var valor = obj.value;
	if (valor != null && valor != "") {
		if(valor.indexOf('http://') == -1) {
			obj.value = "http://" + obj.value;
		}
	}
}
function checkBoxValue(nomeCampo, obj){
	if (obj.checked == true){
		document.getElementById(nomeCampo).value = 'S';
	} else {
		document.getElementById(nomeCampo).value = 'N';	
	}
	//alert(document.getElementById(nomeCampo).value);
}
function pegaCookie(obj){
	var email = getCookie("email");
	document.getElementById(obj).value = email;
	if (email != "" && email != null)
		document.getElementById('Salvar').checked = true
}
function setCookie( name, value ) {
	var expDays = 30;
	var exp = new Date(); 
	exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
	var expires = exp; 
	var bla = name + "=" + escape(value) + "; expires=" + expires.toGMTString();
	document.cookie = bla;
}
function getCookie( name ) {
	var search = name + "=";
	if (document.cookie.length > 0) { // Existem cookies
			offset = document.cookie.indexOf(search)
			if (offset != -1) { // Existe o cookie "name"
					offset += search.length // inicio do conteudo do cookie
					end = document.cookie.indexOf(";", offset) // fim do conteudo
					if (end == -1) end = document.cookie.length;
					return unescape(document.cookie.substring(offset, end));
			} else {
					return "";
			}
	} else {
			return "";
	}
}
var MyWindow=null; 
function abrirJanela(theURL,winName,features) { 

	// Split features
	var arFeatures = features.split(",");
	var arFeaturesValues = Array();
	
	for (i = 0; i < arFeatures.length; i++){
		var arAux = arFeatures[i].split('=');
		arFeaturesValues[arAux[0]] = arAux[1];
	}
	
	// Abre ou da o focus na janela
	if(MyWindow != null) {   
		if(!MyWindow.closed) {                                  
			MyWindow.close();                               
			MyWindow = window.open(theURL,winName,features);                           
		} else {                             
			MyWindow = window.open(theURL,winName,features);
		}   
	} else {          
		MyWindow = window.open(theURL,winName,features); 
	}
			
	var largura = window.screen.availWidth;
	var altura = window.screen.availHeight;	
	
	var x = (largura - arFeaturesValues['width']) / 2;
	var y = (altura - arFeaturesValues['height']) / 2;
	
	MyWindow.moveTo(x, y);	
}
function excluiRegistro(id) {	
	if(confirm("Você realmente deseja excluir este registro?\nAo deletar ele outros registros poderão ser afetados!")){
		document.location.href="?action=delete&did="+id;
	}	
}
function excluiArquivo(id, idPai) {	
	if(confirm("Você realmente deseja excluir este arquivo?")){
		document.location.href="?pag=cadastroConsultor&etapa=4&action=deleteArq&didImg="+id+"&id="+idPai;
	}	
}
function logOut() {	
	if(confirm("Você realmente deseja sair?")){
		document.location.href="?logout";
	}	
}
function numbersOnly(objeto, evt){
	evt = (evt) ? evt : (window.event) ? window.event : "";
	var value = objeto.value;
	if (evt) {
		var ntecla = (evt.which) ? evt.which : evt.keyCode;
		//alert(ntecla);
		if (ntecla > 47 && ntecla<58 || ntecla==46 || ntecla==44 || ntecla==8 || ntecla==9|| ntecla==37|| ntecla==39) 
			return true;
		else 
			return false;
	}
}
function lowerCase(obj) {
	obj.value = obj.value.toLowerCase();
}