function runSpotRadio(progNum,mp3){
	
	document.write('<div class="spotRadioPlayer" id="SpotRadio'+progNum+'">');
	document.write('</div>');
	
	var so = new SWFObject("mp3/preview_mp3.swf?mp3Link=mp3/"+mp3+".mp3", "SpotRadio"+progNum+"", "60", "26", "9", "#ffffff");  
	so.addParam("allowScriptAccess", "always");
	so.addParam("allowFullScreen", "true");
	so.addParam("wmode", "transparent");
	so.addParam("quality", "high");
	so.addParam("scale", "noborder");
	so.addParam("menu", "false");
	so.write("SpotRadio"+progNum+"");	
}
/***************************************************/
/* aggiungo le funzioni js nei link di faq e privilegi (il mostra/nascondi risposte) */
function addLinkToFaq(){
	var faqs=document.getElementById("containerFaq").getElementsByTagName("a");
	var totFaqs=faqs.length;
	for (i=0; i<totFaqs; i++){
		if (navigator.appName.indexOf("Explorer")!=-1){
			faqs[i].onclick=function(){return showHideFaq(this)};
		} else{
			faqs[i].onclick=function(){return showHideFaq(this)};
		}	
		faqs[i].id="faq"+i;
		  if(faqs[i].href=="#"){
          	faqs[i].href="#faq"+i;
      	  }
	}
} 

function showHideFaq(q){
	var eventType;
	var faq;
	faq=q;
	var PToShowHide=faq.nextSibling;
	while((PToShowHide != null) && (PToShowHide.className!="faqRisposta") && (PToShowHide.className!="faqRisposta2")){
		PToShowHide=PToShowHide.nextSibling;
	}
   
	   newAnchor=PToShowHide.appendChild(document.createElement('a'));
	   newAnchor.name=faq.id;
	   if(faq.className=="openFaq" || faq.className=="openFaq2"){
          	PToShowHide.style.display="block";
		  	faq.href="#"+faq.id;
	      	if (faq.className=="openFaq"){
				faq.className="closeFaq";
			}else{
				faq.className="closeFaq2";			
			}	
	   
	   } else {
	        if (faq.className=="closeFaq"){
				faq.className="openFaq";
			}else{
				faq.className="openFaq2";			
			}
			faq.href="#"+faq.id;
	        PToShowHide.style.display="none";
	   }
	
}

/***************************************************/
  function trim(str)
  {
     return str.replace(/^\s*|\s*$/g,"");
  } 
      
  function sendLogon(){
    document.logonForm.submit();
  }
   
  function checkEmailAddress(str)
  {
    if (str.length==0)
      return false;
    var i=str.indexOf("@");
    if (i>0)
    {
      var j=str.indexOf(".",i+1);
      if (j>i+1)
      {
        if (str.length>j+1)
          return true;
      }
    }
    return false;
  }        
  
  function setMessagioSaluto(){
    var tipo = trim(document.getElementById("salutoIscrizione").value);    
    var nome = trim(document.getElementById("nomeIscrizione").value);
    var cognome = trim(document.getElementById("cognomeIscrizione").value);
    var titolo = trim(document.getElementById("titIscrizione").value);
    var anteprima = '';
    if (tipo=='tnc' || tipo == ''){    
      if (titolo != "") anteprima = anteprima + trim(titolo) +  " ";          
      if (nome != "") anteprima = anteprima  +  trim(nome) + " ";
      if (cognome != "") anteprima = anteprima +  trim(cognome);         
      
      anteprima = 'Buongiorno ' + anteprima;  
    }
    else if (tipo=='tn') {
      if (titolo != "") anteprima = anteprima + trim(titolo) +  " ";          
      if (nome != "") anteprima = anteprima  +  trim(nome) + " ";
      
      anteprima = 'Buongiorno ' + anteprima;  
    }
    else if (tipo=='tc'){
      if (titolo != "") anteprima = anteprima + trim(titolo) +  " ";          
      if (cognome != "") anteprima = anteprima +  trim(cognome);         
      
      anteprima = 'Buongiorno ' + anteprima;      
    }
    
    document.getElementById('anteprima').value = trim(anteprima);
    document.getElementById('anteprima').style.textTransform='uppercase';    
  }
  
  function perteSubmit(){
    
    var nome = trim(document.getElementById("nomeIscrizione").value);
    var cognome = trim(document.getElementById("cognomeIscrizione").value);
    var email = trim(document.getElementById("emailIscrizione").value);
    var telefono = trim(document.getElementById("telIscrizione").value);
    var titolo = trim(document.getElementById("titIscrizione").value);
    var sex =  '';
    var privacy = '';
    
    if ( cognome.length == 0 ){
      alert("Attenzione! Inserire il Cognome");
      document.getElementById("cognomeIscrizione").focus();
      return false;
    }
  
    if ( nome.length == 0 ){
      alert("Attenzione! Inserire il Nome");
      document.getElementById("nomeIscrizione").focus();
      return false;
    }

    if (email.length==0)
    {
      alert("Attenzione! Inserire l'indirizzo E-mail");
      document.getElementById("emailIscrizione").focus();      
      return false;
    }
    else{
      if ( !checkEmailAddress(email) ){
        alert("Attenzione! L'indirizzo E-mail inserito non è valido");
        document.getElementById("emailIscrizione").focus();
        return false;
        }   
    }    
    if ( telefono.length == 0 ){
      alert("Attenzione! Inserire il Telefono");
      document.getElementById("telIscrizione").focus();
      return false;
    } 
    else{
     if (isNaN(Number(telefono)))
     {
        alert('Attenzione! Immettere un valore numerico per il campo Telefono');
        document.getElementById("telIscrizione").focus();
        return false;
     }
    else if (telefono.indexOf('.') > -1 ){    
        alert('Attenzione! Il numero di telefono non deve contenere punti');
        document.getElementById("telIscrizione").focus();
        return false;     
     }
     else if (telefono.length < 7)
     {
        alert('Attenzione! Il numero di telefono deve essere composto da almeno sette caratteri');
        document.getElementById("telIscrizione").focus();
        return false;
     }
     else if (telefono.substr(0,1) != '3' && telefono.substr(0,1) != '0' ){
        alert('Attenzione! Il numero di telefono deve iniziare per 0 o per 3');
        document.getElementById("telIscrizione").focus();
        return false;     
     }
    }    
    
    if(titolo.length==0){
      alert("Attenzione! Inserire il Titolo");
      document.getElementById("titIscrizione").focus();      
      return false;    
    }
      
    var objS = document.formPerTe.sex;   
    if (objS[0].checked){
      sex = objS[0].value;
    }
    else if (objS[1].checked){
      sex = objS[1].value;
    }
    else{
      alert("Attenzione! Inserire il Sesso");
      return false;
   }
    var obj = document.formPerTe.privacyIscrizione;
   if (obj[0].checked){
      privacy = obj[0].value;
    }
    else if (obj[1].checked){
      privacy =obj[1].value;
    }    
    if (privacy == 'n'){  
      alert("Attenzione! Non è stato dato il consenso alla privacy");
      return false;
   }      
   document.formPerTe.submit();
  }

/***************************************************/
function runSpot(video){
	
	document.write('<div id="SpotVideo">');
	document.write('<table cellspacing="0" bgcolor="#dedede" cellpadding="0" border="0" width="320" height="240">');
	document.write('<tr>');
	document.write('<td valign="middle" align="center">');
	document.write('<strong>Se non visualizzi questo contenuto<br>clicca sull\'immagine per scaricare o aggiornare Flash Player</strong>');
	document.write('<br /><br />');
	document.write('<a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&Lang=Italian" target="_blank"><img src="../gfx/get_flash_player.gif" alt="INSTALLA ORA L ULTIMA VERSIONE DEL FLASH PLAYER" border="0"></a>');
	document.write('</td>');
	document.write('</tr>');
	document.write('</table>');
	document.write('</div>');
	
	var so = new SWFObject("swf/video_player.swf?whatVideoToLoad=../flv/"+video+".flv&whatPrevPics=flv/"+video+".jpg", "SpotVideo", "320", "285", "9", "#000000");  
	so.addParam("allowScriptAccess", "always");
	so.addParam("allowFullScreen", "true");
	so.addParam("quality", "high");
	so.addParam("scale", "noborder");
	so.addParam("menu", "false");
	so.write("SpotVideo");	
}
/***************************************************/

function menuPerTeLink(url){
	document.location.href="perTe_"+url+".jsp";
}

function MenuPerTe(sezione){
	
	document.write('<div id="perTeMenu">');
	document.write('<table cellspacing="0" bgcolor="#dedede" cellpadding="0" border="0" width="704" height="239">');
	document.write('<tr>');
	document.write('<td valign="middle" align="center">');
	document.write('<strong>Se non visualizzi questo contenuto<br>clicca sull\'immagine per scaricare o aggiornare Flash Player</strong>');
	document.write('<br /><br />');
	document.write('<a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&Lang=Italian" target="_blank"><img src="../gfx/get_flash_player.gif" alt="INSTALLA ORA L ULTIMA VERSIONE DEL FLASH PLAYER" border="0"></a>');
	document.write('</td>');
	document.write('</tr>');
	document.write('</table>');
	document.write('</div>');
	
	var so = new SWFObject("../swf/menu_perte.swf?menuId="+sezione+"", "perTeMenu", "704", "239", "8", "#ffffff");  
	so.addParam("allowScriptAccess", "always");
	so.addParam("quality", "high");
	so.addParam("scale", "noborder");
	so.addParam("wmode", "transparent");
	so.addParam("menu", "false");
	so.write("perTeMenu");	
}
/***************************************************/


/***************************************************/
function HeaderInterne(){
	
	document.write('<div id="flashoccasioniInterne">');
	document.write('<table cellspacing="0" bgcolor="#dedede" cellpadding="0" border="0" width="518" height="186">');
	document.write('<tr>');
	document.write('<td valign="middle" align="center">');
	document.write('<strong>Se non visualizzi questo contenuto<br>clicca sull\'immagine per scaricare o aggiornare Flash Player</strong>');
	document.write('<br /><br />');
	document.write('<a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&Lang=Italian" target="_blank"><img src="gfx/get_flash_player.gif" alt="INSTALLA ORA L ULTIMA VERSIONE DEL FLASH PLAYER" border="0"></a>');
	document.write('</td>');
	document.write('</tr>');
	document.write('</table>');
	document.write('</div>');
	
	var animazioni = new Array();
	animazioni[0] = new Banner("viaggi");
	animazioni[1] = new Banner("cinema");
	animazioni[2] = new Banner("uffici_pubblici");
	animazioni[3] = new Banner("shopping");

	function Banner(quale) {
		this.quale = quale;
		return this;
	}
	var aNum = Math.round(Math.random() * (animazioni.length - 1));
	var so = new SWFObject("swf/mini_" + animazioni[aNum].quale + ".swf", "flashoccasioniInterne", "518", "186", "8", "#ffffff");  
	so.addParam("allowScriptAccess", "always");
	so.addParam("quality", "high");
	so.addParam("scale", "noborder");
	so.addParam("menu", "false");
	so.write("flashoccasioniInterne");
	
}
/***************************************************/



/**************************************************/
var stati = new Array();
stati[0] = 'none';
stati[1] = 'none';
stati[2] = 'none';
stati[3] = 'none';
stati[4] = 'none';
stati[5] = 'none';
stati[6] = 'none';
stati[7] = 'none';
stati[8] = 'none';

function showhide(rispostanum, layName) {
	state = stati[rispostanum];
	if (state == 'block') {
		state = 'none';
		stati[rispostanum] = 'none';
	}
	else {
		state = 'block';
		stati[rispostanum] = 'block';
	}
	if (document.all) { //IS IE 4 or 5 (or 6 beta)
		eval( "document.all."+layName+".style.display = state");
		
		if(state=='block'){
			eval( "document.all.faq0"+(rispostanum+1)+".className = 'txtFaq0"+(rispostanum+1)+"On'");
		}else{
			eval( "document.all.faq0"+(rispostanum+1)+".className = 'txtFaq0"+(rispostanum+1)+"'");
		}	
	}
	if (document.layers) { //IS NETSCAPE 4 or below
		document.layers[layName].display = state;
		
		if(state=='block'){
			eval( "document.getElementById('faq0"+(rispostanum+1)+"').className = 'txtFaq0"+(rispostanum+1)+"On'");
		}else{
			eval( "document.getElementById('faq0"+(rispostanum+1)+"').className = 'txtFaq0"+(rispostanum+1)+"'");
		}
	}
	if (document.getElementById && !document.all) {
		if(state=='block'){
			eval( "document.getElementById('faq0"+(rispostanum+1)+"').className = 'txtFaq0"+(rispostanum+1)+"On'");
		}else{
			eval( "document.getElementById('faq0"+(rispostanum+1)+"').className = 'txtFaq0"+(rispostanum+1)+"'");
		}
		maxwell_smart = document.getElementById(layName);
		maxwell_smart.style.display = state;
	}
}
/**************************************************/




/**************************************************/
var statiinfo = new Array();
statiinfo[0] = 'none';
statiinfo[1] = 'none';
statiinfo[2] = 'none';
statiinfo[3] = 'none';
statiinfo[4] = 'none';
statiinfo[5] = 'none';
statiinfo[6] = 'none';
statiinfo[7] = 'none';
statiinfo[8] = 'none';
statiinfo[9] = 'none';
statiinfo[10] = 'none';
statiinfo[11] = 'none';
statiinfo[12] = 'none';
statiinfo[13] = 'none';
statiinfo[14] = 'none';
statiinfo[15] = 'none';
statiinfo[16] = 'none';
statiinfo[17] = 'none';

function showhideInfo(rispostanum, layName) {
	state = statiinfo[rispostanum];
	if (state == 'block') {
		state = 'none';
		statiinfo[rispostanum] = 'none';
	}
	else {
		state = 'block';
		statiinfo[rispostanum] = 'block';
	}
	if (document.all) { //IS IE 4 or 5 (or 6 beta)
		eval( "document.all."+layName+".style.display = state");
		
		if(state=='block'){
			eval( "document.all.faq"+(rispostanum+1)+".className = 'txtInfo"+(rispostanum+1)+"On'");
		}else{
			eval( "document.all.faq"+(rispostanum+1)+".className = 'txtInfo"+(rispostanum+1)+"'");
		}	
	}
	if (document.layers) { //IS NETSCAPE 4 or below
		document.layers[layName].display = state;
		
		if(state=='block'){
			eval( "document.getElementById('faq"+(rispostanum+1)+"').className = 'txtInfo"+(rispostanum+1)+"On'");
		}else{
			eval( "document.getElementById('faq"+(rispostanum+1)+"').className = 'txtInfo"+(rispostanum+1)+"'");
		}
	}
	if (document.getElementById && !document.all) {
		if(state=='block'){
			eval( "document.getElementById('faq"+(rispostanum+1)+"').className = 'txtInfo"+(rispostanum+1)+"On'");
		}else{
			eval( "document.getElementById('faq"+(rispostanum+1)+"').className = 'txtInfo"+(rispostanum+1)+"'");
		}
		maxwell_smart = document.getElementById(layName);
		maxwell_smart.style.display = state;
	}
}
/**************************************************/





function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}