function CheckCheckBox(nome_check, nome_campo){
	if (!document.getElementById(nome_check).checked){
		document.getElementById(nome_campo).disabled= false;
	} else{
		document.getElementById(nome_campo).disabled= true;
	}
}

function sh (id) {
   whichpost = document.getElementById(id); 
   
   if (whichpost.className=="show") { 
      whichpost.className="hide";
   } 
   else { 
      if (whichpost.className=="hide") { 
      whichpost.className="show";
      }
   }
}
function insertTags(tagOpen, tagClose, sampleText, id_input) {
         var txtarea =document.getElementById(id_input);


    //var txtarea = document.contenuto.testo;
	// IE
	if(document.selection) {
		var theSelection = document.selection.createRange().text;
		if(!theSelection) { theSelection=sampleText;}
		txtarea.focus();
		if(theSelection.charAt(theSelection.length - 1) == " "){
			theSelection = theSelection.substring(0, theSelection.length - 1);
			document.selection.createRange().text = tagOpen + theSelection + tagClose + " ";
		} else {
			document.selection.createRange().text = tagOpen + theSelection + tagClose;

		}
	// Mozilla
	} else if(txtarea.selectionStart || txtarea.selectionStart == '0') {
 		var startPos = txtarea.selectionStart;
		var endPos = txtarea.selectionEnd;
		var myText = (txtarea.value).substring(startPos, endPos);
		if(!myText) { myText=sampleText;}
		if(myText.charAt(myText.length - 1) == " "){ // exclude ending space char, if any
			subst = tagOpen + myText.substring(0, (myText.length - 1)) + tagClose + " "; 
		} else {
			subst = tagOpen + myText + tagClose; 
		}
		txtarea.value = txtarea.value.substring(0, startPos) + subst + txtarea.value.substring(endPos, txtarea.value.length);
		txtarea.focus();
		var cPos=startPos+(tagOpen.length+myText.length+tagClose.length);
		txtarea.selectionStart=cPos;
		txtarea.selectionEnd=cPos;
	// All others
	} else {
		tagOpen=tagOpen.replace(/\n/g,"");
		tagClose=tagClose.replace(/\n/g,"");
		document.infoform.infobox.value=tagOpen+sampleText+tagClose;
		txtarea.focus();
	}
	if (txtarea.createTextRange) txtarea.caretPos = document.selection.createRange().duplicate();
}



function showDetails(divID) {     
	strShow =document.getElementById(divID+"_show");
	strHide = document.getElementById(divID+"_hide");

	//divID = document.getElementById(divID);	
	//divID.style.display = "block";
	strShow.style.display = "none";
	strHide.style.display = "block";
	strHide.style.float = "left";
}

function hideDetails(divID) {
	strShow =document.getElementById(divID+"_show");
	strHide = document.getElementById(divID+"_hide");
	//divID = document.getElementById(divID);  
	//divID.style.display = "none";
	strShow.style.display = "block";
	strHide.style.display = "none";
	strShow.style.float = "left"
}

//--------------------------------


         boxmove=true;
         
         function stopstartbox() {
            boxmove=!boxmove;
         }
         function updatebox(evt, id) {

               mouseX=evt.pageX?evt.pageX:evt.clientX;
               mouseX=mouseX-250;
               mouseY=evt.pageY?evt.pageY:evt.clientY;
               document.getElementById(id).style.left=mouseX;
               document.getElementById(id).style.top=mouseY;
               document.getElementById(id).style.display="block";

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

