// FUNZIONI DIV ALTERNATIVI
var time_H,nome_H,div_H,timeMSG_H,note_H;
var mouseY=100;
var mouseX=600;
var dx=-20;
var dy=50;
var widthDiv=250;
var nomeDiv="alternativo";
var stato=1;
var div_width=300;
//var x_H=(ns6_H) ? 280 : 150;
var x_H=(ns6_H) ? 20 : 20;
var ajax_H;

function visDiv_HELP(nome){
 time_H=clearTimeout();
 var txt=document.getElementById(nome).innerHTML;
 var myDiv=document.getElementById(nomeDiv);
 myDiv.className="help";
 if((mouseX+widthDiv)>=1000) mouseX=mouseX-widthDiv+(2*dx);
 myDiv.style.top=mouseY+"px";
 myDiv.style.left=mouseX+"px";
 myDiv.style.width=widthDiv+"px";
 LayerWrite(nomeDiv,txt);
 nome_H=nomeDiv;
 Layer_display(nomeDiv,2);
 myDiv.innerHTML=txt;
}

function cancellaDiv(nome){
 Layer_display(nome_H,0);
 clearTimeout(time_H);
 nome_H="";
 div_H="";
}
function cancellaDiv(){
 Layer_display(nomeDiv,0);
 clearTimeout(time_H);
}


// COMPILA DIV ALTERNATIVO NEWS
function compilaDiv_news(id,autore,data_ins,note){
  var myDiv=document.getElementById(nomeDiv);
  var str="<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\" class=\"w100\">" +
  		  "<tr><td class=\"colore2 gras w40\">Codice:</td><td class=\"colore2\">"+id+"</td></tr>" +
		  "<tr><td class=\"gras\">Autore:</td><td>"+autore+"</td></tr>" +
		  "<tr><td class=\"colore2 gras\">Inserimento:</td><td class=\"colore2\">"+data_ins+"</td></tr>" +
		  "<tr><td class=\"gras\">Note:</td><td>"+note+"</td></tr>" +
  		  "</table>";
		  
 if((mouseX+widthDiv)>=1000) mouseX=mouseX-widthDiv+(2*dx);
 myDiv.style.top=mouseY+"px";
 myDiv.style.left=mouseX+"px";
 myDiv.style.width=widthDiv+"px";
 nome_H=nomeDiv;
 Layer_display(nomeDiv,2);
 LayerWrite(nomeDiv,str);
}

function compilaDiv_link(id,data_ins,note){
  var myDiv=document.getElementById(nomeDiv);
  var str="<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\" class=\"w100\">" +
  		  "<tr><td class=\"colore2 gras w40\">Codice:</td><td class=\"colore2\">"+id+"</td></tr>" +
		  "<tr><td class=\"gras\">Inserimento:</td><td>"+data_ins+"</td></tr>" +
		  "<tr><td class=\"colore2 gras\">note:</td><td class=\"colore2\">"+note+"</td></tr>" +
  		  "</table>";
		  
 if((mouseX+widthDiv)>=1000) mouseX=mouseX-widthDiv+(2*dx);
 myDiv.style.top=mouseY+"px";
 myDiv.style.left=mouseX+"px";
 myDiv.style.width=widthDiv+"px";
 nome_H=nomeDiv;
 Layer_display(nomeDiv,2);
 LayerWrite(nomeDiv,str);
}

function compilaDiv_eventi(id,autore,data_ins,note){
  var myDiv=document.getElementById(nomeDiv);
  var str="<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\" class=\"w100\">" +
  		  "<tr><td class=\"colore2 gras w40\">Codice:</td><td class=\"colore2\">"+id+"</td></tr>" +
		  "<tr><td class=\"gras\">Autore:</td><td>"+autore+"</td></tr>" +
		  "<tr><td class=\"colore2 gras\">Inserimento:</td><td class=\"colore2\">"+data_ins+"</td></tr>" +
		  "<tr><td class=\"gras\">Note:</td><td>"+note+"</td></tr>" +
  		  "</table>";
		  
 if((mouseX+widthDiv)>=1000) mouseX=mouseX-widthDiv+(2*dx);
 myDiv.style.top=mouseY+"px";
 myDiv.style.left=mouseX+"px";
 myDiv.style.width=widthDiv+"px";
 nome_H=nomeDiv;
 Layer_display(nomeDiv,2);
 LayerWrite(nomeDiv,str);
}

function compilaDiv_articoli(id,autore,data_ins,note){
  var myDiv=document.getElementById(nomeDiv);
  var str="<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\" class=\"w100\">" +
  		  "<tr><td class=\"colore2 gras w40\">Codice:</td><td class=\"colore2\">"+id+"</td></tr>" +
		  "<tr><td class=\"gras\">Autore:</td><td>"+autore+"</td></tr>" +
		  "<tr><td class=\"colore2 gras\">Inserimento:</td><td class=\"colore2\">"+data_ins+"</td></tr>" +
		  "<tr><td class=\"gras\">Note:</td><td>"+note+"</td></tr>" +
  		  "</table>";
		  
 if((mouseX+widthDiv)>=1000) mouseX=mouseX-widthDiv+(2*dx);
 myDiv.style.top=mouseY+"px";
 myDiv.style.left=mouseX+"px";
 myDiv.style.width=widthDiv+"px";
 nome_H=nomeDiv;
 Layer_display(nomeDiv,2);
 LayerWrite(nomeDiv,str);
}

function compilaDiv_archivio(id,autore,data_ins,note){
  var myDiv=document.getElementById(nomeDiv);
  var str="<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\" class=\"w100\">" +
  		  "<tr><td class=\"colore2 gras w40\">Codice:</td><td class=\"colore2\">"+id+"</td></tr>" +
		  "<tr><td class=\"gras\">Autore:</td><td>"+autore+"</td></tr>" +
		  "<tr><td class=\"colore2 gras\">Inserimento:</td><td class=\"colore2\">"+data_ins+"</td></tr>" +
		  "<tr><td class=\"gras\">Note:</td><td>"+note+"</td></tr>" +
  		  "</table>";
		  
 if((mouseX+widthDiv)>=1000) mouseX=mouseX-widthDiv+(2*dx);
 myDiv.style.top=mouseY+"px";
 myDiv.style.left=mouseX+"px";
 myDiv.style.width=widthDiv+"px";
 nome_H=nomeDiv;
 Layer_display(nomeDiv,2);
 LayerWrite(nomeDiv,str);
}

function compilaDiv_par(img,movie,testo,tipo,titolo,did){
  var myDiv=document.getElementById(nomeDiv);
  var str,txt,tit,mov;
  var spost=200;
  //alert(movie);
  img="<img src=\""+img+"\" alt=\"\" class=\"w20\" />";
  mov="<object width=\"70\" height=\"70\" classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" id=\"movie\"><param name=\"allowScriptAccess\" value=\"sameDomain\" />" +
      "<param name=\"movie\" value=\""+movie+"\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#ffffff\" />" +
	  "<embed src=\""+movie+"\" width=\"70\" height=\"70\" quality=\"high\" bgcolor=\"#ffffff\"  name=\"movie\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /></object>"
  
  tit=(titolo!="") ? "<h4>"+titolo+"</h4>" : "";
  str="<div class=\"w99 par\">";
  switch(tipo){
   case "0": str+=tit+"<p class=\"txt\">"+testo+"</p>"; break;
   case "1": str+=tit+"<p class=\"cit\">"+testo+"</p>"; break;
   case "2": str+=tit+"<p class=\"cod\">"+testo+"</p>"; break;
   case "3": str+=tit+"<div class=\"f_right\">"+img+"<p class=\"didascalia\">"+did+"</p></div><p class=\"f_left w75 txt\">"+testo+"</p><div class=\"clear\"></div>"; break;
   case "4": str+=tit+"<div class=\"f_left\">"+img+"<p class=\"didascalia\">"+did+"</p></div><p class=\"f_left w75 txt\">"+testo+"</p><div class=\"clear\"></div>"; break;
   case "5": str+="<div class=\"center\">"+img+"<p class=\"didascalia\">"+did+"</p></div>"; break;
   case "6": str+=tit+"<div class=\"f_right w20\" >"+mov+"<p class=\"didascalia\">"+did+"</p></div><p class=\"f_left w75 txt\">"+testo+"</p><div class=\"clear\"></div>"; break;
   case "7": str+=tit+"<div class=\"f_left w20\" >"+mov+"<p class=\"didascalia\">"+did+"</p></div><p class=\"f_left w75 txt\">"+testo+"</p><div class=\"clear\"></div>"; break;
   case "8": str+=tit+"<div class=\"center w90\" >"+mov+"<p class=\"didascalia\">"+did+"</p></div><div class=\"clear\"></div>"; break;
   case "9": str+=tit+"<p class=\"ev\">"+testo+"</p>"; break;
  }
  
  str+="</div>";
 //alert(str);
 if((mouseX+widthDiv)>=1000) mouseX=mouseX-widthDiv+(2*dx);
 myDiv.style.top=mouseY+"px";
 myDiv.style.left=mouseX-spost+"px";
 myDiv.style.width=widthDiv+spost+"px";
 nome_H=nomeDiv;
 Layer_display(nomeDiv,2);
 LayerWrite(nomeDiv,str);
}

function compilaDiv_portfolio(id,autore,data_ins,note){
  var myDiv=document.getElementById(nomeDiv);
  var str="<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\" class=\"w100\">" +
  		  "<tr><td class=\"colore2 gras w40\">Codice:</td><td class=\"colore2\">"+id+"</td></tr>" +
		  "<tr><td class=\"gras\">Autore:</td><td>"+autore+"</td></tr>" +
		  "<tr><td class=\"colore2 gras\">Inserimento:</td><td class=\"colore2\">"+data_ins+"</td></tr>" +
		  "<tr><td class=\"gras\">Note:</td><td>"+note+"</td></tr>" +
  		  "</table>";
		  
 if((mouseX+widthDiv)>=1000) mouseX=mouseX-widthDiv+(2*dx);
 myDiv.style.top=mouseY+"px";
 myDiv.style.left=mouseX+"px";
 myDiv.style.width=widthDiv+"px";
 nome_H=nomeDiv;
 Layer_display(nomeDiv,2);
 LayerWrite(nomeDiv,str);
}

function compilaDiv_utenti(id,classe,data_crea,skype,msn,tel,cell,fax,citta,accesso,ip){
  var myDiv=document.getElementById(nomeDiv);
  var str="<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\" class=\"w100\">" +
  		  "<tr><td class=\"colore2 gras w40\">Codice:</td><td class=\"colore2\">"+id+"</td></tr>" +
		  "<tr><td class=\"gras\">Classe:</td><td>"+classe+"</td></tr>" +
		  "<tr><td class=\"colore2 gras\">Creato il:</td><td class=\"colore2\">"+data_crea+"</td></tr>" +
		  "<tr><td class=\"gras\">Skype:</td><td>"+skype+"</td></tr>" +
		  "<tr><td class=\"colore2 gras\">Msn:</td><td class=\"colore2\">"+msn+"</td></tr>" +
		  "<tr><td class=\"gras\">Tel:</td><td>"+tel+"</td></tr>" +
		  "<tr><td class=\"colore2 gras\">Cell:</td><td class=\"colore2\">"+cell+"</td></tr>" +
		  "<tr><td class=\"gras\">Fax:</td><td>"+fax+"</td></tr>" +
		  "<tr><td class=\"colore2 gras\">Citt&agrave;:</td><td class=\"colore2\">"+citta+"</td></tr>" +
		  "<tr><td class=\"gras\">Ultimo login:</td><td>"+accesso+"</td></tr>" +
		  "<tr><td class=\"colore2 gras\">Ultimo IP:</td><td class=\"colore2\">"+ip+"</td></tr>" +
  		  "</table>";
		  
 if((mouseX+widthDiv)>=1000) mouseX=mouseX-widthDiv+(2*dx);
 myDiv.style.top=mouseY+"px";
 myDiv.style.left=mouseX+"px";
 myDiv.style.width=widthDiv+"px";
 nome_H=nomeDiv;
 Layer_display(nomeDiv,2);
 LayerWrite(nomeDiv,str);
}

function compilaDiv_log(sql){
  var myDiv=document.getElementById(nomeDiv);
  var str="<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\" class=\"w100\">" +
  		  "<tr><td class=\"colore2 gras w40\">MSG:</td><td class=\"colore2\">"+sql+"</td></tr>" +
  		  "</table>";
		  
 if((mouseX+widthDiv)>=1000) mouseX=mouseX-widthDiv+(2*dx);
 myDiv.style.top=mouseY+"px";
 myDiv.style.left=mouseX+"px";
 myDiv.style.width=widthDiv+"px";
 nome_H=nomeDiv;
 Layer_display(nomeDiv,2);
 LayerWrite(nomeDiv,str);
}

function compilaDiv_corsi(id,autore,data_ins,note,d1,d2){
  var myDiv=document.getElementById(nomeDiv);
  var str="<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\" class=\"w100\">" +
  		  "<tr><td class=\"colore2 gras w40\">Codice:</td><td class=\"colore2\">"+id+"</td></tr>" +
		  "<tr><td class=\"gras\">Autore:</td><td>"+autore+"</td></tr>" +
		  "<tr><td class=\"colore2 gras\">Iscrizione:</td><td class=\"colore2\">"+d1+"</td></tr>" +
		  "<tr><td class=\"gras\">Fine iscrizione:</td><td>"+d2+"</td></tr>" +
		  "<tr><td class=\"colore2 gras\">Inserimento:</td><td class=\"colore2\">"+data_ins+"</td></tr>" +
		  "<tr><td class=\"gras\">Note:</td><td>"+note+"</td></tr>" +
  		  "</table>";
		  
 if((mouseX+widthDiv)>=1000) mouseX=mouseX-widthDiv+(2*dx);
 myDiv.style.top=mouseY+"px";
 myDiv.style.left=mouseX+"px";
 myDiv.style.width=widthDiv+"px";
 nome_H=nomeDiv;
 Layer_display(nomeDiv,2);
 LayerWrite(nomeDiv,str);
}

function chiudiMSG(){
 Layer_display("cont_confermato",0);
 clearTimeout(timeMSG_H);
}

function compilaDiv_helpdesk(id,operatore,data_stop,stato,lett){
  var myDiv=document.getElementById(nomeDiv);
  var str="<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\" class=\"w100\">" +
  		  "<tr><td class=\"colore2 gras w40\">Codice:</td><td class=\"colore2\">"+id+"</td></tr>" +
		  "<tr><td class=\"gras\">Operatore:</td><td>"+operatore+"</td></tr>" +
		  "<tr><td class=\"colore2 gras\">Chiusura:</td><td class=\"colore2\">"+data_stop+"</td></tr>" +
		  "<tr><td class=\"gras\">Stato:</td><td>"+stato+"</td></tr>" +
		  "<tr><td class=\"colore2 gras\">Autore:</td><td class=\"colore2\">"+lett+"</td></tr>" +
  		  "</table>";
		  
 if((mouseX+widthDiv)>=1000) mouseX=mouseX-widthDiv+(2*dx);
 myDiv.style.top=mouseY+"px";
 myDiv.style.left=mouseX+"px";
 myDiv.style.width=widthDiv+"px";
 nome_H=nomeDiv;
 Layer_display(nomeDiv,2);
 LayerWrite(nomeDiv,str);
}

function compilaDiv_gallery(id,autore,data_ins,note){
  var myDiv=document.getElementById(nomeDiv);
  var str="<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\" class=\"w100\">" +
  		  "<tr><td class=\"colore2 gras w40\">Codice:</td><td class=\"colore2\">"+id+"</td></tr>" +
		  "<tr><td class=\"gras\">Autore:</td><td>"+autore+"</td></tr>" +
		  "<tr><td class=\"colore2 gras\">Avvio:</td><td class=\"colore2\">"+data_ins+"</td></tr>" +
		  "<tr><td class=\"gras\">Note:</td><td>"+note+"</td></tr>" +
  		  "</table>";
		  
 if((mouseX+widthDiv)>=1000) mouseX=mouseX-widthDiv+(2*dx);
 myDiv.style.top=mouseY+"px";
 myDiv.style.left=mouseX+"px";
 myDiv.style.width=widthDiv+"px";
 nome_H=nomeDiv;
 Layer_display(nomeDiv,2);
 LayerWrite(nomeDiv,str);
}

function compilaDiv_note(tit,testo,data1,data2,cond){
  var myDiv=document.getElementById(nomeDiv);
  var cond=(cond) ? "Nota condivisa" : "Nota non condivisa";
  
  var str="<p><b>"+tit+"</b><br />"+testo+"</p>"+
		  "<p>Data: "+data1+"<br />Scadenza: "+data2+"<br />"+cond+"</p>";

 if((mouseX+widthDiv)>=1000) mouseX=mouseX-widthDiv+(2*dx);
 myDiv.style.top=mouseY+"px";
 myDiv.style.left=mouseX+"px";
 myDiv.style.width=widthDiv+"px";
 Layer_display(nomeDiv,2);
 LayerWrite(nomeDiv,str);

}




// FUNZIONE PER LE STATISTICHE
function compilaDiv(str){
  var a,tmpStr;
  var myDiv=document.getElementById(nomeDiv);
  var a=str.split("<br />");
  var tmpStr="<table border=\"0\" cellpadding=\"0\" cellpadding=\"0\" summary=\"dati pagina\" class=\"w99\">";
  tmpStr+="<caption class=\"nascosto\">Dati pagina</caption><tbody></tbody>";
  cl=0;
  for(i=0;i<a.length;i++){
   sf=(cl)? "colore2" : "";
   tmpStr+="<tr>";
   tmpStr+="<td class=\""+sf+"\">"+a[i]+"</td>";
   tmpStr+="</tr>";
   cl=!cl;
  }
  
  tmpStr+="</tbody></table>";
  LayerWrite(nomeDiv, tmpStr);
  myDiv.style.top=mouseY-100+"px";
  myDiv.style.left=mouseX+50+"px";
  myDiv.style.width=div_width+"px";
  Layer_display(nomeDiv,2);

}

function compilaDiv_img(img){
  var myDiv=document.getElementById(nomeDiv);
  var str,txt,tit,mov;
  var spost=0;
  //alert(movie);
  img="<img src=\""+img+"\" alt=\"\" style=\"width:250px\" />";
  str="<div class=\"w99\">"+img+"</div>";

 if((mouseX+widthDiv)>=1000) mouseX=mouseX-widthDiv+(2*dx);
 myDiv.style.top=mouseY+"px";
 myDiv.style.left=mouseX-spost+"px";
 myDiv.style.width=widthDiv+spost+"px";
 nome_H=nomeDiv;
 Layer_display(nomeDiv,2);
 LayerWrite(nomeDiv,str);
}

