//---------------------------COSTANTI----------------------------------------//

//Posizione del file audio punto asp
_audio="/Ambienti/audio.asp"; 
_audioFlash="/Ambienti/audioFlash.asp";
_pulsantiera="/Ambienti/Didattica/images/pulsantiera/";

//---------------------------------------------------------------------------//

function eliminaAllegato(id)
{
	if(!confirm("Eliminare l'allegato?")) return;
	window.open("/Ambienti/NodoCms/EliminaAllegato.asp?ID="+id,""); 
	location.reload();
}

//---------------------------------------------------------------------------//

function fineAudio(){}

var _audiopopup=null;

function play(audio)	
{
	if(_audiopopup && _audiopopup.parentNode) _audiopopup.parentNode.removeChild(_audiopopup);
	_audiopopup=document.createElement("iframe");
	_audiopopup.style.visibility="hidden";
	_audiopopup.style.position="absolute";
	_audiopopup.style.top=-1000;
	_audiopopup.style.left=-1000;
	_audiopopup.style.width=0;
	_audiopopup.style.height=0;
	document.body.appendChild(_audiopopup);
	audio=audio.replace(/IDA=[\d]*&/g,"");
	audio=audio.replace(/IDN=[\d]*&/g,"");
	if(!(document.all) && !(audio.match("mms://"))) 
	 _audiopopup.contentWindow.location=_audioFlash+"?FILE="+audio;
	else
	 _audiopopup.contentWindow.location=_audio+"?FILE="+audio;
}

//---------------------------------------------------------------------------//

// 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=490, 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";
}

//-------------------------PULSANTIERA--------------------------------------//
function disactivate(imName)
{
  try 
  {
    var img = document.getElementById(imName);
  	img.src = _pulsantiera+imName+"Dis.gif";	
  	img.alt = "fine navigazione";
  	img.title = "fine navigazione";
  	document.getElementById(imName+"_status").value="0";
  	document.getElementById(imName+"_link").href="#";
  	document.getElementById(imName+"_link").title = "fine navigazione";
	}catch(e) {}
}

function activate(imName)
{
	try 
  {
    var img = document.getElementById(imName);
  	img.src = _pulsantiera+imName+".gif";
  	document.getElementById(imName+"_status").value="1";
  }catch(e) {}
}

function check(imName,active)
{
  try { if(active!="1") disactivate(imName); }
  catch(e) {}
}	

function changeImage(imName,active)	
{
	try 
  {
    if(active!="1") return;
  	var img = document.getElementById(imName);
  	img.src = _pulsantiera+imName+"Att.gif";	
	}catch(e) {}
}

function restoreImage(imName,active)	
{
  try 
  {
  	if(active!="1") return;
  	var img = document.getElementById(imName);	
  	img.src = _pulsantiera+imName+".gif";
	}catch(e) {}
}

function stampa(cosa)	{
  var w;
  var idNodo =document.getElementById("STD_ID_NODO").value;
  if (idNodo.indexOf("@")==-1)
  	w=window.open("/Ambienti/NodoCMS/CaricaPaginaLight.asp?TPL=/Ambienti/Template/Print.htm&ID="+idNodo,"STAMPA","toolbar=no,menubar=no,personalbar=no,width=640,height=480,resizable=yes,scrollbars=yes,modal=yes,dependable=yes");
  else  {
  	var header="<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1//EN' 'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd'>" +
      "<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='it' lang='it'>" +
  		"<head>" +
      "<title>Integrazioni - Anteprima di stampa</title>" +
  		"<link href='/_Themes/Print.css' rel='stylesheet' type='text/css' />" +
      "<link href='/_Themes/Common.css' rel='stylesheet' type='text/css' />" +
      "</head>" +
      "<body id='home'>" +
      "<div id='wrap'><div id='main' class='clearfix'><div id='contentwrap'><div id='content'><div id='da_stampare'>"
    w=window.open("","STAMPA","toolbar=no,menubar=no,personalbar=no,width=640,height=480,resizable=yes,scrollbars=yes,modal=yes,dependable=yes");
  	w.document.write(header);
  	if(!cosa) cosa="content";
  	w.document.write(document.getElementById(cosa).innerHTML);
  	w.document.write("</div></div></div></div></div></body></html>");
  	w.document.close();
  	w.print();
	}	
} 

		
function hideAndShow(titolo) {
	 if (document.getElementById(titolo).className=="")
	   document.getElementById(titolo).className="NoDisplay";
	 else  {
  	 var divs=document.getElementsByTagName('div');
  	 for (var i in divs) {
  	   if (divs[i].id && divs[i].id.match('anastasis_hideShow'))
  	     divs[i].className='NoDisplay';
      }
   	 document.getElementById(titolo).className="";	 
  	 }  
  	 return false;
  }

//----------------------------------------------------------------------------//
function ControllaDatiNewsLetter(theForm)
{
  if (!theForm.email.value)
  {
    alert("Occorre inserire il campo  \"E-mail\" .");
    theForm.email.focus();
    return false;
  }
  else
  {
    if (!theForm.email.value.match("@") || !theForm.email.value.match(/\./)) 
    {
		alert("Controlla la Email che hai digitato !!!");
		theForm.email.focus();
		return false;	
    }
  }  
  return true;
}	


