var dom = document;

function tooltip(id, text){

	window.scroll(0,0);

	document.getElementById(id).style.visibility = "visible";
	document.getElementById(id).innerHTML = text;

}

function hide(id){
	document.getElementById(id).style.visibility = "hidden";
}

function move(e){
	document.getElementById(id).style.left = e.clientX + "px";
	document.getElementById(id).style.top = e.clientY + "px";
}

function out(){
	document.getElementById(id).style.display = "none";
}

function encodePassword(passwordID, codeID){

	var passwordBox = document.getElementById(passwordID);
	var codeBox = document.getElementById(codeID);
	var password = passwordBox.value;
	var code = codeBox.value;

	passwordBox.value = hex_md5(hex_md5(password) + code);

}

function editTD(nodeID){

   if(!nodeID) return;

   node = document.getElementById("comment" + nodeID);

   var nodeValue = node.innerHTML;
   
   node.innerHTML = "<textarea style='width: 100%; height: 100%; padding: 1%; border: none;' id='text" + nodeID + "'>" + nodeValue + "</textarea>";
   node.innerHTML += "<button type=\"submit\" onclick=\"ajxjt('updatecomment.php?id=" + nodeID + "&comment=" + document.getElementById('text' + nodeID).value.replace(/\'/g, "\\\'") + "', 'comment" + nodeID + "');\">Modifica</button>";

}

function addInputFile(spanID){

   if(!spanID) return;

   span = document.getElementById(spanID);

   span.innerHTML += "<br /><input type=\"file\" name=\"filename[]\" /><br />";

}
