// 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){ 
		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){ 
		obj = document.getElementById(id); 
		obj.style.display = ""; 
	} 
} 

// esconde um div 
function hide(id){ 
	if (document.getElementById){ 
		obj = document.getElementById(id); 
		obj.style.display = "none"; 
	}
} 

//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;
}


//mostra da pop-up do video (recursos da dicha do produto)
function mostra_pop(tipo){
	var type_video = tipo;

	//se é um video normal
	if(type_video == 0){	
		popup_show('videopopup','video_drag', 'video_exit','mouse', -90, -70);
	} else {
		//se é um video de youtube
		popup_show('videopopup_tube','video_drag_tube', 'video_exit_tube','mouse', -90, -70);
	}
}


function chama(div_name){
	var divName = document.getElementById(div_name);
	divName.style.display="block";		
}	