
// elimina os espaço antes e depois da string passada
function trim(str){
	var i=0,p = str.length-1;
	while(str.charAt(i)==' ') i++;
	while(str.charAt(p)==' ') p--;
	if(i>p) return '';
	return str.substring(i,p+1);
}
 
// coloca disabled um botão depois de ser clicado
function clickOnce(bt){
	bt.disabled=true;
}

// coloca visível ou esconde alternadamente um div 
function showhide(id){ 
	if (document.getElementById(id)){ 
		obj = document.getElementById(id); 
		if (obj.style.display == "none"){ 
			obj.style.display = ""; 
		}else{ 
			obj.style.display = "none"; 
		} 
	} 
} 

// coloca visível um div 
function show(id){ 
	if (document.getElementById(id)){ 
		obj = document.getElementById(id); 
		obj.style.display = "";
	} else {
		alert('function show(): Nao foi encontrado o objeto com ID = ' + id);
	} 
}

// esconde um div 
function hide(id){
 
	if (document.getElementById(id)){
		obj = document.getElementById(id); 
		obj.style.display = "none"; 
	} else {
		alert('function hide(): Nao foi encontrado o objeto com ID = ' + id);
	}
} 

// coloca visível um div - com estilo display: block 
function show_block(id){ 
	if (document.getElementById(id)){ 
		obj = document.getElementById(id); 
		obj.style.display = "block";
	} else {
		alert('function show_block(): Nao foi encontrado o objeto com ID = ' + id);
	} 
}


//copia o valor seleccionado na combo para um  input obj
function copyValueComboToInput(comboObj,InputObj){
	InputObj.value=comboObj[comboObj.selectedIndex].value;
}
//copia o valor seleccionado na combo para um  input obj
function copyTextComboToInput(comboObj,InputObj){	
	InputObj.value=comboObj[comboObj.selectedIndex].text;
}

//obtém a data do dia para mostrar no cabeçalho
function getDataDoDia()
{
	new Ajax.Updater('datadodia', '/geral/index/getdatadodia');	
}


