

function Utenti(record)
{
 this.nome = "";
 this.email = "";
 this.attiva = ""
  this.splitString = newsletter__splitString;
 
  this.splitString(record);
}

function newsletter__splitString(record)
{
 if(!record) return false;
 
 //record = record.slice(1,-1);
 
 tmp = record.split(",");
 
 this.nome = tmp[0];
 this.email = tmp[1];
 this.attiva = tmp[2];

 
 return true;
}

var utenze = [];

//funzioni della newsletter
   
 function visibleEditor(iddy)
 {
  
  document.getElementById(iddy).style.visibility = "visible";
 }
 
 function hiddenEditor(iddy)
 {
  
  document.getElementById(iddy).innerHTML = "";
 }
 
 var editor = ""; 
 function memorizzaEditor()
 {
   editor = document.getElementById('ed').innerHTML;
 }
 
 function showEditor()
 {
  document.getElementById('ed').innerHTML = editor;
 }
 
 function largeImage(iddy)
 {
   document.getElementById(iddy).style.width="150px";
   document.getElementById(iddy).style.height="100px";
 }
 
 function smallImage(iddy)
 {
   document.getElementById(iddy).style.width="120px";
   document.getElementById(iddy).style.height="70px";
 }
 
 function showTableUtenti()
 {
   
   
   str = "<div id='list'><p>Lista indirizzi email</p>TOT :"+utenze.length+" <table width='100%'>";
   for(i=0; i<utenze.length; i++)
   {
   str += "<tr onclick='alert(\"Attenzione se vuoi eliminare una email, clicca sul cestino \");'>";
     str += "<th>"+ i +"</th>";
     str += "<th>"+ utenze[i].nome +"</th>";
     str += "<th>"+ utenze[i].email +"</th>";
     if(utenze[i].attiva == "1") str += "<th>SI</th>";  
      else str += "<th>NO</th>";
     str += "</tr></div>";
   }
   
   document.getElementById('dyn').innerHTML ="<center>"+str+"</center>";
   
  
 }
 
 function deleteTableUtenti()
 {
   str = "<div id='list'><p>Qual'è l'email che vuoi cancellare?<br>Clicca su quella desiderata</p>TOT :"+utenze.length+"<table width='100%'>";
   for(i=0; i<utenze.length; i++)
   {
   str += "<tr id='e"+i+"' onclick='deleteEmail(\""+ utenze[i].email +"\",\"e"+i+"\");'>";
     str += "<th>"+ i +"</th>";
     str += "<th>"+ utenze[i].nome +"</th>";
     str += "<th>"+ utenze[i].email +"</th>";
   str += "</tr></div>";
   }
   
   document.getElementById('dyn').innerHTML ="<center>"+str+"</center>";
   
  
 }  
 
 function deleteEmail(ind_mail,iddy)
 {
   str = "<b>Vuoi eliminare </b>"+ind_mail+"?";
   str += "<form action='panelControl.php?id="+ind_mail+"' method='post'>";
   str += "<input type='submit' name='delete' value='Delete'></form>";
   
   document.getElementById('dyn').innerHTML ="<center>"+str+"</center>";
   
  
 }  
  
  
  function inserisciEmail()
  {
   str = "<div style='text-align:left; width:250px;'><b>Vuoi inserire un indirizzo email?</b><br><br><br><br>";
   str += "<form  action='' method='post'>";
   str += "Nome : <input type=\"text\" name=\"insert_nome\"/><br><br>";
   str += "Email : <input type=\"text\" name=\"insert_email\"/><br><br>";
   str += "<input type='submit' name='insert' value='inserisci'></form></div>";
   
   document.getElementById('dyn').innerHTML ="<center>"+str+"</center>";
  }
  
  function pulisciInput(iddy)
  {
   document.getElementById(iddy).value = "";
  }
  
	  //fine funzioni newsletter
	  
   
	  
	  
	  