

/* My Light */

	function myLight(){

	css = document.getElementById('skin');

	if ( css.href == '../css/skin.css' )
 		{
 			css.href= '../css/skin_light.css';
		
 		}
 		else if (( css.href= '../css/skin_light.css' ))
 		{
 			css.href= '../css/skin.css';
 			
 		}
 		else
 		{
 			css.href= '../css/skin_light.css';
			
 		}
}

/* CHANGE RESOLUTION */

function changeResolution(){
	
	css = document.getElementById('layout');

	if ( css.href == '../css/layout_800x600.css' )
 		{
 			css.href= '../css/layout_1024x768.css';
		
 		}
 		else if (( css.href= '../css/layout_1024x768.css' ))
 		{
 			css.href= '../css/layout_800x600.css';
 			
 		}
 		else
 		{
 			css.href= '../css/layout_800x600.css';
			
 		}
}


/* FORM CONTROLS */


function privacyValidator(idPush)
	{
	accept = document.getElementById('accept').checked
		if (accept == true)
		{
		document.getElementById(idPush).disabled = false;
		
		}
	
		if (accept == false)
		{
		document.getElementById(idPush).disabled = true;
		
		}
	
	}


function isNotValidEmail(elem) {
	var str = elem.value;
	var re  = /\b[a-z0-9._%-]+@[a-z0-9._%-]+\.[a-z0-9._%-]{2,4}\b/;
	if (!str.match(re))
		return false;
	else
		return true;
}



function formValidator(theForm)
{

  

  if (theForm.dato_email.value == "")
  {
    alert('La mail è obbligatoria');
    theForm.dato_email.focus();
    return (false);
  }
	
	if (!isNotValidEmail(document.forms['formContacts'].elements['dato_email']))
	{
		alert("il formato dell'email non è corretto");
		return false;
	}
	
  if (theForm.dato_nome.value == ""  || theForm.dato_cognome.value == " " )
  {
    alert('Inserire correttamente nome e cognome');
    theForm.dato_nome.focus();
    return (false);
  }


  if (theForm.dato_note.value == ""  || theForm.dato_note.value == " " )
  {
    alert('Inserire una richiesta informativa');
    theForm.dato_note.focus();
    return (false);
  }
  return (true);
}

function nlValidator(theForm)
{

  

  if (theForm.dato_email.value == "")
  {
    alert('La mail è obbligatoria');
    theForm.dato_email.focus();
    return (false);
  }
	
	if (!isNotValidEmail(document.forms['formNewsletter'].elements['dato_email']))
	{
		alert("il formato dell'email non è corretto");
		return false;
	}
	
  return (true);
}
