
//################## JAVASCRIPT FUNCTIONS ##########################
//	Francesco Lai 25/03/08
//	
//	Progetto Sito Marconi
//
//#######################################################################

var debug=false;


//______________________________________________________________________
//           CAMBIA LA CLASSE DI UN DIV	
//______________________________________________________________________
function changeClass(id, classElement)
{
	
	
	var element=document.getElementById(id);
	element.className=classElement;	
	

	return false;
		
}

//______________________________________________________________________
//           CAMBIA LA CLASSE DI UN DIV	
//______________________________________________________________________
function changeClassInsertText(id, classElement, idInsert, textInsert)
{
	
	
	var element=document.getElementById(id);
	var elementInsert=document.getElementById(idInsert);
	
	elementInsert.innerHTML=textInsert;
	element.className=classElement;	
	

	return false;
		
}
//______________________________________________________________________

//______________________________________________________________________
//          CAMBIA IL CSS
//______________________________________________________________________

function newCSS(n)
{
	
	document.styleSheets[0].disabled = true;
	document.styleSheets[1].disabled = true;
	document.styleSheets[2].disabled = true;
	
	document.styleSheets[n].disabled = false;
}
//______________________________________________________________________

//______________________________________________________________________
//          CAMBIA IL NUMERO DEI COMMENTI
//______________________________________________________________________
var comm=0
function newsTitoloComm(id, n)
{
	if(comm==0)
		dettaglio ='<a onclick="changeClass(\'ulCommenti\', \'invisibile\'); changeClass(\'ulCommentiPag\', \'invisibile\'); newsTitoloComm(\'idH1Comm\', '+n+'); comm=0">'+n+' comments - </a>';
	else
		dettaglio ='<a onclick="changeClass(\'ulCommenti\', \'ulCommenti\'); changeClass(\'ulCommentiPag\', \'ulCommentiPag\'); newsTitoloComm(\'idH1Comm\', '+n+'); comm=1">'+n+' comments + </a>';
		
	document.getElementById(id).innerHTML=dettaglio;
	
}
//______________________________________________________________________

//______________________________________________________________________
//          CAMBIA IL NUMERO DEI COMMENTI
//______________________________________________________________________
var invComm=0
function newsTitoloInvComm(id)
{
	
	
	
	
	if(invComm==0)
		dettaglio ='<a onclick="changeClass(\'ulInserisciCommenti\', \'invisibile\');  newsTitoloInvComm(\'idH1InsComm\'); invComm=0">send a comment - </a>';
	else
		dettaglio ='<a onclick="changeClass(\'ulInserisciCommenti\', \'ulInserisciCommenti\');   newsTitoloInvComm(\'idH1InsComm\'); invComm=1">send a comment + </a>';
		
	document.getElementById(id).innerHTML=dettaglio;
	
}
//______________________________________________________________________



function selectArgomento(id, id_nipote)
{
	
 	document.getElementById(id).value=id_nipote;
	
	//------------------DEBUG-------------------
	if(debug)
		alert("id: "+id+" - numero: "+n);
		
	//------------------END--------------------
		
}

function controlloCommenti(id)
{
	
 	var text=document.getElementById(id).value;
	
	if(!advansedTextControl('commento', '100000000000', 'Testo nullo o non valido', 'divAlert', 'resultAlertDiv', 'inviaComm', '#F9A98E'))
	{
		document.getElementById('inviaComm').disabled=true;
		
	}
}
//______________________________________________________________________
