// JavaScript Document
/*
 COPYRIGHT NOTICE 
 Copyright 2005-2006 Mario Rota - INETConsulting s.r.l All Rights Reserved. 
 email: mario.rota@inetconsulting.it

 Expandjs may be used and modified free of charge by anyone so long as 
 this copyright notice remains intact. By using this 
 code you agree to indemnify Mario Rota from any liability that 
 might arise from its use. 
 
 Selling the code for this script without prior written consent is 
 expressly forbidden. 
 (END OF COPYRIGHT NOTICE)
*/
var nomeContenitore;
var nomeSpan;
var nomeClasseInizio;
var nomeClasseFine;
nomeContenitore = "codecontainer";		//customizzare
nomeSpan = "paragrafo";					//customizzare
nomeClasseEspandi = "codecontainer";	//customizzare
nomeClasseContrai = "codecontainer1";	//customizzare
function prendiElementoDaId(id_elemento) {
 var elemento;
 if(document.getElementById)
  elemento = document.getElementById(id_elemento);
 else
  elemento = document.all[id_elemento];
 return elemento;
};
//CARICO IL VALORE INIZIALE
function fOnload(id_elemento) {
	prendiElementoDaId(nomeSpan).innerHTML = '<span id="spandacambiare" onclick="fCambiaTesto1();">espandi</span>';
	document.getElementById(nomeContenitore).className = nomeClasseEspandi
};

//CAMBIO AL 1 CLICK = ESPANDO
function fCambiaTesto1(id_elemento) {
	prendiElementoDaId(nomeSpan).innerHTML = '<span id="spandacambiare" onclick="fCambiaTesto2();">contrai</span>';
	document.getElementById(nomeContenitore).className = nomeClasseContrai
};

//CAMBIO AL 2 CLICK e ritorno alla situazione originaria = CONTRAGGO
function fCambiaTesto2(id_elemento) {
	prendiElementoDaId(nomeSpan).innerHTML = '<span id="spandacambiare" onclick="fCambiaTesto1();">espandi</span>';
	document.getElementById(nomeContenitore).className = nomeClasseEspandi
};
