/*CAMBIO PAGINA RICERCHE OFFERTE*/
function cambioPaginaOfferte (curPage, tipo, id_off)
{
    $('#'+tipo+'').load(link+'dettaglio_offerta_elenco.php?tipo='+tipo+'&cur_page='+curPage+'&id_off='+id_off);    
}
/*FINE CAMBIO PAGINA RICERCHE OFFERTE*/

/*DELETE RECORD RICERCHE SALVATE*/
function deleteRicerca (id_off, curPage)
{
    $('#ricerche_salvate').load(link+'ricerche_salvate.php?azione=elimina&id_off='+id_off+'&cur_page='+curPage);    
}
/*FINE DELETE RECORD RICERCHE SALVATE*/

/*CAMBIO PAGINA RICERCHE SALVATE*/
function cambioPaginaRicerche (curPage)
{
    $('#ricerche_salvate').html('<center><br><br><br><br><img src="'+link+'img/indicator-big.gif" width="32" height="32" /><br><br><br><br></center>');
    setTimeout('ricerche_salvate('+curPage+')', 200);
}

function ricerche_salvate (curPage)
{
    $('#ricerche_salvate').load(link+'ricerche_salvate.php?cur_page='+curPage);    
}
/*FINE CAMBIO PAGINA RICERCHE SALVATE*/

/*CAMBIA PERIODO*/
function controlloPeriodo(errore1)
{
    var dal = document.getElementById('StartDate').value;
    var al = document.getElementById('EndDate').value;
    
    if ( (dal==0) || (al==0) )
    {
        alert (errore1);
        return false;
    }
    else
        return true;
}
/*CAMBIA PERIODO*/

/*BOX LOGIN*/
function svuota(campo)
{
	campo.value="";
}

function changefield(divChange)
{
	document.getElementById(divChange).innerHTML = "<input id=\"idPass\" style=\"width:140px;\" type=\"password\" name=\"password\">";
	setTimeout("document.getElementById('idPass').focus();", 100);
}
/*BOX LOGIN*/

/* MOSTRA NOME */
function MostraNome(nome,codice)
{
  document.getElementById('flashcontent').style.display='none';
  document.getElementById('dove').value=nome;
}

function ChangeWidth(tobj,cur_w,max_w,delay,step)
{
  var width=cur_w+step;
  tobj.style.width=''+width;
  setTimeout("ChangeWidth("+tobj+",cur_w,max_w,delay,step)",100);
}

var scrolla=true;

function SettScroll()
{
  var obj1=document.getElementById('box_sett_sec');
  if(obj1!=null)
  {
    if(obj1.style.display=='block' && scrolla)
    {
      height=(document.body.clientHeight)/2-300+document.body.scrollTop;
      alert(height);
      obj1.style.top=height+'px';
    }
  }
  else
    alert("null");
}
/* MOSTRA NOME */

/* ABILITA CAMPI DISABILITATI*/
function abilitaInput(campo, valore)
{
    if (valore != 0)
        document.getElementById(campo).disabled=false;
    else    
        document.getElementById(campo).disabled=true;
}
/* FINE ABILITA CAMPI DISABILITATI*/

/* CAMBIO PREZZO ISCRIZIONE EVENTO */

function ButtonOverOld(id_img,nome_file,ext_file)
{
  var img_lb=document.getElementById(id_img+'_lb');
  var img_mb=document.getElementById(id_img+'_mb');
  var img_rb=document.getElementById(id_img+'_rb');

  img_lb.src='img/'+nome_file+'_left_over.'+ext_file;
  img_mb.style.backgroundImage='url(img/'+nome_file+'_mid_over.'+ext_file+')';
  img_rb.src='img/'+nome_file+'_right_over.'+ext_file;
}

function ButtonOutOld(id_img,nome_file,ext_file)
{
  //alert("Prova");
  var img_lb=document.getElementById(id_img+'_lb');
  var img_mb=document.getElementById(id_img+'_mb');
  var img_rb=document.getElementById(id_img+'_rb');
  
  img_lb.src='img/'+nome_file+'_left.'+ext_file;
  img_mb.style.backgroundImage='url(img/'+nome_file+'_mid.'+ext_file+')';
  img_rb.src='img/'+nome_file+'_right.'+ext_file;
}

var tover=new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);

function ActButtonOver(id,id_img,nome_file,ext_file)
{
  var img_lb=document.getElementById(id_img+'_lb');
  var img_mb=document.getElementById(id_img+'_mb');
  var img_rb=document.getElementById(id_img+'_rb');

  if(tover[id]==1)
  { 
    img_lb.src='img/'+nome_file+'_left_over.'+ext_file;
    img_mb.src='img/'+nome_file+'_mid_over.'+ext_file;
    img_rb.src='img/'+nome_file+'_right_over.'+ext_file;
  }
}

function ActButtonOut(id,id_img,nome_file,ext_file)
{
  var img_lb=document.getElementById(id_img+'_lb');
  var img_mb=document.getElementById(id_img+'_mb');
  var img_rb=document.getElementById(id_img+'_rb');
  
  if(tover[id]==0)
  {
    img_lb.src='img/'+nome_file+'_left.'+ext_file;
    img_mb.src='img/'+nome_file+'_mid.'+ext_file;
    img_rb.src='img/'+nome_file+'_right.'+ext_file;
  }  
}

function ButtonOver(id,id_img,nome_file,ext_file)
{
  tover[id]=1;
  setTimeout(function(){ActButtonOver(id,id_img,nome_file,ext_file)},100);  
}

function ButtonOut(id,id_img,nome_file,ext_file)
{
  tover[id]=0;
  setTimeout(function(){ActButtonOut(id,id_img,nome_file,ext_file)},100);  
}

function controlloCampiIscrizione ()
{
		i=0;
		
		if (document.iscrizioneEvento.cognome.value=="")
			i++;

		if (document.iscrizioneEvento.nome.value=="")
			i++;

		if (document.iscrizioneEvento.tel_cell.value=="")
			i++;

		if (document.iscrizioneEvento.email.value=="")
			i++;

		if (document.iscrizioneEvento.indirizzo.value=="")
			i++;

		if (document.iscrizioneEvento.cod_fisc.value=="")
			i++;

		if (document.iscrizioneEvento.azi_rag_sociale.value=="")
			i++;

		if (document.iscrizioneEvento.azi_indirizzo.value=="")
			i++;

		if (document.iscrizioneEvento.azi_citta.value=="")
			i++;

		if (document.iscrizioneEvento.azi_prov.value=="")
			i++;

		if (document.iscrizioneEvento.azi_cap.value=="")
			i++;

		if (document.iscrizioneEvento.azi_tel.value=="")
			i++;

		if (document.iscrizioneEvento.azi_fax.value=="")
			i++;

		if (document.iscrizioneEvento.azi_piva.value=="")
			i++;

		if (document.iscrizioneEvento.azi_cod_fisc.value=="")
			i++;
		
		if (document.iscrizioneEvento.consensoprivacy.checked == false)
			i++;
			
		if (i==0)
			return true;
		else
		{
			alert ("TUTTI I CAMPI SONO OBBLIGATORI");		
			return false;
		}
}
/* CAMBIO PREZZO ISCRIZIONE EVENTO */


/* CAMBIO PREZZO ISCRIZIONE EVENTO */
function cambioPrezzoIscrizione (prezzoBase, prezzoHotel)
{
	totale = prezzoBase+prezzoHotel;
	document.getElementById('totPaga').value=totale+".00";
}
/* CAMBIO PREZZO ISCRIZIONE EVENTO */


/* CONTROLLO LOGIN */
function controlloLogin()
{
  var oXmlHttp = zXmlHttp.createRequest();
	var url = "./function/login.php?user="+document.formLogin.user.value+"&pass="+document.formLogin.pass.value;
  oXmlHttp.open('get', url, true);
  oXmlHttp.onreadystatechange = function ()
  {
      if (oXmlHttp.readyState==4)
      {
          if (oXmlHttp.status==200)
          {
              var risposta=oXmlHttp.responseText;
              
              if (risposta=="yes")
                document.formLogin.submit();
              else
              	alert ("Login o Password errati!");

              return;
          }
          if (oXmlHttp.status==404)
          {
              alert('La pagina '+ url + ' non esiste!');
          }
          else alert('Errore, status: '+oXmlHttp.status);
      }
  }
  oXmlHttp.send(null);
    
  return false;
}
/* FINE CONTROLLO LOGIN */


/* APRI CHIUDI DIV */
function activeDivEventi(idDiv)
{
		if (document.getElementById(idDiv).style.display=='none')
			document.getElementById(idDiv).style.display='block';
		else
			document.getElementById(idDiv).style.display='none';
}
/* FINE APRI CHIUDI DIV */

/* APRI CHIUDI SOTTO MENU */
function activeMenu(idMenu)
{
		if (document.getElementById('menu_'+idMenu).style.display=='none')
			document.getElementById('menu_'+idMenu).style.display='block';
		else
			document.getElementById('menu_'+idMenu).style.display='none';
}
/* FINE APRI CHIUDI SOTTO MENU */

function InsFoto(id_img,new_file,err_mess)
{
  var image=document.getElementById(id_img);
  var tokens = new_file.value.split('.');
  var ext=tokens[tokens.length-1];
  ext=ext.toLowerCase();
  if(ext=="gif" || ext=="png" || ext=="jpg" || ext=="bmp")
  {
    var newImg = new Image();
    newImg.src = new_file.value;
    var height = newImg.height;
    var width = newImg.width; 
    image.src=new_file.value;
    alert(new_file.value);
  }
  else
  {
    alert(err_mess);
  }
}

 function CH_Lang(Lang,Pagina)
  		  {
  		    document.ch_lang.Lang.value=Lang;
  		    document.ch_lang.Pagina.value=Pagina;
  		    document.ch_lang.submit();
        }
        function CH_Page(Pagina)
  		  {
  		    document.ch_page.Pagina.value=Pagina;
  		    document.ch_page.submit();
        }
        
        function MostraBox(id_box)
        {
          var box=document.getElementById(id_box);
          var mos=document.getElementById(id_box+'M');
          var nas=document.getElementById(id_box+'N');
          mos.style.display='none';
          nas.style.display='block';
          box.style.height='';
        }
        function NascondiBox(id_box, height)
        {
          var box=document.getElementById(id_box);
          var mos=document.getElementById(id_box+'M');
          var nas=document.getElementById(id_box+'N');
          mos.style.display='block';
          nas.style.display='none';
          box.style.height=height+'px';
          box.style.overflow='hidden';
        }
        
        var nEspLav2=2;
        function AddEspLav2(id_div,nEspLav)
        {
          var tdiv=""+id_div+nEspLav;
          var ndiv=""+id_div+(nEspLav+1);
          var div=document.getElementById(tdiv);
          //var div=document.getElementById(id_div);
          var text1=div.innerHTML;
          var text2='<table cellpadding="0" cellspacing="5" border="0"><tbody class="testo_normal">';
          text2=text2+'<tr><td>Settore:</td><td><input type="text" name="Settore'+nEspLav+'" size="34" value=""></td></tr>';
          text2=text2+'<tr><td>Datore di lavoro:</td><td><input type="text" name="Datore'+nEspLav+'" size="34" value=""></td></tr>';
          text2=text2+'<tr><td>Periodo:</td><td>dal&nbsp;<input type="text" name="Dal'+nEspLav+'" size="8" value=""><img style="cursor: pointer;" title="Scegli la data" src="calendario/calendar_3.png" onclick="displayDatePicker(\'Dal'+nEspLav+'\', false, \'ymd\', \'-\');">&nbsp;&nbsp;al&nbsp;<input type="text" name="Al'+nEspLav+'" size="8" value=""><img style="cursor: pointer;" title="Scegli la data" src="calendario/calendar_3.png" onclick="displayDatePicker(\'Al'+nEspLav+'\', false, \'ymd\', \'-\');"></td></tr>';
          text2=text2+'<tr><td>Mansione:</td><td><input type="text" name="Mansione'+nEspLav+'" size="34" value=""></td></tr>';
          text2=text2+'<tr><td>Tipo di contratto:</td><td><input type="text" name="Contratto'+nEspLav+'" size="34" value=""></td></tr>';
          text2=text2+'<tr><td>Retribuzione annua lorda:</td><td><input type="text" name="Stip'+nEspLav+'" size="34" value=""></td></tr>';
          text2=text2+'<tr><td colspan="2" height="5"></td></tr></tbody></table><div id="'+ndiv+'"></div>';
          //document.write(text1+text2);
          div.innerHTML=text2;
        }
        
        var nLingua2=2;
        function AddLingua2(id_div,nLingua)
        {
          var tdiv=""+id_div+nLingua;
          var ndiv=""+id_div+(nLingua+1);
          var div=document.getElementById(tdiv);
          //var div=document.getElementById(id_div);
          var text1=div.innerHTML;
          var text2='<table cellpadding="0" cellspacing="5" border="0"><tbody class="testo_normal"><tr>';
          text2=text2+'<td>Lingua:</td><td><input type="text" id="inpLingua'+nLingua+'" name="inpLingua'+nLingua+'" style="display: none;" size="15" value="<Lingua>" onclick="this.value=\'\';">';
          text2=text2+'<select style="width: 115px;" name="Lingua'+nLingua+'" onchange="if(this.value==\'7\') {this.style.display=\'none\'; document.getElementById(\'inpLingua'+nLingua+'\').style.display=\'block\';}"><option value="0" >Scegli</option><option value="1" >Inglese</option><option value="2" >Francese</option><option value="3" >Tedesco</option><option value="4" >Italiano</option><option value="5" >Spagnolo</option><option value="6" >Russo</option><option value="7" >Altro</option></select></td>';
          text2=text2+'<td>&nbsp;&nbsp;&nbsp;Livello : Orale</td><td><select name="CapOra'+nLingua+'"><option value="1" >1</option><option value="2" >2</option><option value="3" >3</option><option value="4" >4</option><option value="5" >5</option></select></td>';
          text2=text2+'<td>Scritto</td><td><select name="CapScr'+nLingua+'"><option value="1" >1</option><option value="2" >2</option><option value="3" >3</option><option value="4" >4</option><option value="5" >5</option></select></td>';
          text2=text2+'</tr></tbody></table><div id="'+ndiv+'"></div>';
          //document.write(text1+text2);
          div.innerHTML=text2;
        }
        
        var nTitStud2=2;
        function AddTitStud2(id_div,nTitStud)
        {
          var div=document.getElementById(id_div);
          var text1=div.innerHTML;
          var text2='<table cellpadding="0" cellspacing="5" border="0"><tbody class="testo_normal">';
          text2=text2+'<tr><td>Titolo di studio:</td><td><input type="text" size="34" name="TitStud'+nTitStud+'" /></td></tr>';
          text2=text2+'</tbody></table>';
          div.innerHTML=text1+text2;
        }
        
        var nCert2=2;
        function AddCert2(id_div,nCert)
        {
          var div=document.getElementById(id_div);
          var text1=div.innerHTML;
          var text2='<table cellpadding="0" cellspacing="5" border="0"><tbody class="testo_normal">';
          text2=text2+'<tr><td>Certificazioni/Attestati:</td><td><input type="text" size="34" name="Certif'+nCert+'" /></td></tr>';
          text2=text2+'</tbody></table>';
          //document.write(text1+text2);
          div.innerHTML=text1+text2;
        }
        
        var nConTec2=2;
        function AddConTec2(id_div,nConTec)
        {
          var tdiv=""+id_div+nConTec;
          var ndiv=""+id_div+(nConTec+1);
          var div=document.getElementById(tdiv);
          //var div=document.getElementById(id_div);
          var text1=div.innerHTML;
          var text2='<table cellpadding="0" cellspacing="5" border="0"><tbody class="testo_normal">';
          text2=text2+'<tr><td>Descrizione:</td><td><input type="text" name="ConTec'+nConTec+'" value="" size="30" /></td><td>&nbsp;&nbsp;&nbsp;Livello :</td>';
          text2=text2+'<td><select name="ValConTec'+nConTec+'"><option value="1" >1</option><option value="2" >2</option><option value="3" >3</option><option value="4" >4</option><option value="5" >5</option></select></td></tr>';
          text2=text2+'</tbody></table><div id="'+ndiv+'"></div>';
          //document.write(text1+text2);
          div.innerHTML=text2;
        }
        
        
        

