//COSTANTI
_pulsantiera="/images/didattica/pulsantiera/";
_personaggio="/images/didattica/personaggio/"


var _audiopopup=null;

// apre una finestra popup per l'ascolto del file audio passato (path completo!)
function ascolta(audio)	{
	_audiopopup=window.open("","audio","toolbar=no,menubar=no,personalbar=no,width=210,height=100," +
			      "scrollbars=no,resizable=no,modal=no,dependable=no");
	_audiopopup.document.write('<head><title>AUDIO</title></head>'+
					 '<body style="background-color: #e7f8f8">'+					 
					 '<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" Name="MediaPlayer" src="'+audio+'" AutoStart=1 ShowStatusBar=1 volume=-1 HEIGHT=50 WIDTH=180></embed>'+
					 '<br><br><a style="font-size: 0.8em" href="'+audio+'">Non parte'+"'"+'audio?</a>'+
					 '</body>'
					 );
	_audiopopup.document.close();
	window.focus();
}

// dummy 
function setAudio(bVal)	{ }

// apre una finestra popup per la definizione della parola del glossario passata
function glossario(parola)	{
	var path = "/ambienti/glossario.asp?parola=" + parola;
	window.open(path,"Audio","top=10, left=350, screenY=10, screenX=350, width=320, height=320");
}

// apre una finestra popup per la definizione del testo indicizzato dal parametro
function testo(chiave)	{
	var path = "/ambienti/testo.asp?chiave=" + chiave;
	window.open(path,"Glossario","top=10, left=350, width=320, height=320");
}

function stampaCMS(idNodo)		{ 
	var url = "/vai_a.asp?PAGINA=NODO_LIGHT&ID=" + idNodo+"&TPL=/ambienti/template/print.htm";
	var dlg = window.open(url, "stampa","toolbar=no,menubar=no,personalbar=no,scrollbars=yes,resizable=yes,width=800,height=600"); 
	} 
	
function lis()		{ 
	alert("Filmato non disponibile.");
	} 
	

function approfondimenti()	{
	var hrefBase = "/ambienti/didattica/approfondimento.asp";
	var lezione = document.forms.passi.Lezione.value;
	var modulo = document.forms.passi.Modulo.value;
	var argomento = document.forms.passi.Argomento.value;
	var approfondimento = document.forms.passi.Approfondimento.value;
	if (approfondimento == "")	{
		alert("Nessun approfondimento disponibile!");
		return;
		}
	hrefBase += "?MODULO=" + modulo + "&LEZIONE=" + lezione + "&ARGOMENTO=" +argomento + "&APPROFONDIMENTO=" +approfondimento;
	hrefBase = hrefBase.replace(" ","%20");
//	alert("approfondimento: " + hrefBase);
	myWin=window.open(hrefBase,"","scrollbars=yes");
	myWin.window.moveTo(0,0);
    myWin.window.resizeTo(screen.availWidth,screen.availHeight);
    myWin.focus();
}

// apre una finestra popup per la chat 
function chat(accetta,room,user,caller,called)	{
	var path = "/include/chat.asp?ACCETTA=" + accetta +"&ROOM=" +room+"&USER=" +user+ "&CALLER=" +caller+ "&CALLED=" +called;
	window.open(path,"CHAT","top=10, left=350, width=500, height=525, resizable=yes, toolbar=no, location=no, directories=no, status=no , menubar=no");
	if(accetta=="CALLER_OK") window.location="/main.asp?PAGE=/AMBIENTI/didattica/Chat_Aula.asp";
}

function checkLocalLogon()	{
		if (!document.MyJavaProxy.LoggedIn())	{
			alert("Accesso non autorizzato. Effettuare il logon:");
			location = "./index.html";
			}
	}
	
function monitoraggioLocale(modulo,nomeModulo)	{
	if (document.MyJavaProxy.TraceEsecuzione(modulo,nomeModulo))
		location = "./monitoraggioModulo" + modulo + ".html";	
	else 
		alert("Impossibile aprire il file di monitoraggio del modulo " + nomeModulo);
}


function aggiornaStato(modulo)	{
		var args = document.MyJavaProxy.CaricaArgomentiFatti(modulo);
		for (var i=0; i<args.length; eval("document.a_" + args[i++]).src = "./images/check.jpg");
		var dove = document.MyJavaProxy.DoveSonoArrivato(modulo);
//		alert("sono arrivato al " + dove);
		eval("document.a_" + dove).src = "./images/hereAnim.gif";
	}
	
function doveSonoArrivato(){
	var nextModulo = document.MyJavaProxy.ModuloDaFare();
	if (nextModulo==null) 
		alert("Funzione non disponibile");
	else
		location = nextModulo;	
}

function aiuto()
  {
//  window.open(,"_blank","toolbar=no,menubar=no,personalbar=no,scrollbars=yes,resizable=yes,modal=yes,dependable=yes,width=800,height=600");
	var hrefBase = "/vai_a.asp?PAGINA=NODO_LIGHT&ID=561&TPL=/ambienti/didattica/template/templateHelp.htm";
  	var myWin=window.open(hrefBase,"AIUTO","scrollbars=yes");
	myWin.window.moveTo(0,0);
    myWin.window.resizeTo(screen.availWidth,screen.availHeight);
    myWin.focus();

  }
		
		
//---------------------------------------------------------------//
function disactivate(imName)
{
	var img = document.getElementById(imName);
	img.src = _pulsantiera+imName+"Dis.gif";
	document.getElementById(imName+"_status").value="0";
	document.getElementById(imName+"_link").href="#";
}

function activate(imName)
{
	var img = document.getElementById(imName);
	img.src = _pulsantiera+imName+".gif";
	document.getElementById(imName+"_status").value="1";
}

function check(imName,active)
{
	if(active!="1") disactivate(imName);
}	

function changeImage(imName,active)	
{
	if(active!="1") return;
	var img = document.getElementById(imName);
	img.src = _pulsantiera+imName+"Att.gif";	
}

function restoreImage(imName,active)	
{
	if(active!="1") return;
	var img = document.getElementById(imName);	
	img.src = _pulsantiera+imName+".gif";
}

//---------------------------------------------------//

function scriviFeedback(testo,suggerimento,lightIndex)	
{	
	document.getElementById("feedback").innerHTML=testo;
	document.getElementById("suggerimento").innerHTML=suggerimento;
}
		
function cambiaPersonaggio(stato)
{
	document.getElementById("personaggio").src=_personaggio+stato+".gif";
}	      