/*	 
Questa pagina è stata creata da Apdsoftware.it che ne è l'unica proprietaria e si riserva tutti i diritti.
Tutti i contenuti e le immagini presenti in questa pagina possono essere utilizzati solo con esplicito consenso di Apdsoftware.it.
Qualsiasi uso improprio viola le leggi sul copyright.

This page has been created by Apdsoftware.it and that is the only owner and it reserves all the rights.
All the contents and the images present in this page can be used only with explicit consent of Apdsoftware.it.
Whichever improper use breaks the laws on the copyright.

***************************************************************************************************************
*                                                                                                             *
*                               Copyright © 2008 APDSoftware. All Rights Reserved.                            *
*                                           http://www.apdsoftware.it                                         *
*                                               info@apdsoftware.it                                           *
*                                                                                                             *
***************************************************************************************************************
*/
var checkflag = "false";
function check(field) 
	{
		if (checkflag == "false") 
			{
  				for (i = 0; i < field.length; i++) 
					{
  						field[i].checked = true;
					}
  				checkflag = "true";
  				return "Uncheck all"; 
			}
		else 
			{
  				for (i = 0; i < field.length; i++) 
					{
  						field[i].checked = false; 
					}
  				checkflag = "false";
  				return "Check all"; 
			}
	}
function div_hide(id)
{
	if (document.getElementById(id).style.display == "none")
	{
		document.getElementById(id).style.display = "";
		return;
	}
	else
	{
		document.getElementById(id).style.display = "none";
		return;
	}
}
function select()
	{
		document.slfrm.action = "index.php?page=gallery&cat=" + document.getElementById('cat').value;
		document.slfrm.submit();
		document.getElementById('delg').style.display = "";
	}
function img()
{
	if (document.imgfrm.miofile.value == "")
	{
		   alert("Devi inserire un'immagine.");
	}
	else {
   document.imgfrm.action = "index.php?action=addgal";
   document.imgfrm.submit();
}
}
function category()
{
	if (document.catfrm.categoria.value == "")
	{
		   alert("Devi inserire un nome per la categoria.");
	}
	else if (document.catfrm.data.value == "")
	{
		   alert("Devi inserire una data per la categoria.");
	}         
	else {
   document.catfrm.action = "index.php?action=addcat";
   document.catfrm.submit();
}
}
function register()
{
    var filter=/^.+@.+\..{2,3}$/;
    var datainput;
    var dataverifica;
    var aaaaoutput;
    var mmoutput;
    var ggoutput;
    var dataoutput;
    var giorno = document.registerfrm.giorno.value;
    var mese = document.registerfrm.mese.value;
    var anno = document.registerfrm.anno.value;
 datainput=giorno+"-"+mese+"-"+anno;
 dataverifica =new Date(document.registerfrm.anno.value,document.registerfrm.mese.value-1,document.registerfrm.giorno.value)
    aaaaoutput=dataverifica.getFullYear().toString(); 
    mmoutput=(dataverifica.getMonth()+1).toString(); 
    ggoutput=dataverifica.getDate().toString();
    dataoutput=ggoutput+"-"+mmoutput+"-"+aaaaoutput;    
if (document.registerfrm.email.value == "" || filter.test(document.registerfrm.email.value) == 0)
    {
    alert("Devi inserire un indirizzo email valido.");
}
else if (document.registerfrm.nome.value == "")
    {
    alert("Devi inserire un nome valido.");    
}
      else if (datainput!=dataoutput)
          {
       alert("Devi inserire una data valida.");   
      }     
else if (document.registerfrm.privacy.checked == false)
    {
    alert("Devi accettare l'informativa sulla privacy.");
}
else
    {
       document.registerfrm.action = "newsletter.php?action=register";
   document.registerfrm.submit();
}
}
