// JavaScript Document
jQuery(document).ready(function(){
	//$('.menu').delay(1200).fadeTo('slow', 1.0);
	//$('.menu').delay(2100).fadeTo('slow', 0.7);
	
	$.get('contents/home.html', function(data) {	
												 			$('#home').html(data);
														  	$('#bg').addClass('home');
															$('#bg').delay(1500).fadeIn('slow');
															$('#bg').css({'opacity':'1.0'});
															$('#opaco').delay(2400).fadeIn('slow');
															$('#home').delay(2500).slideDown('slow');
															$('.cont_title').html("");
															$('#opaco').css({'background-color': 'white','opacity':'0.7'});
															});
		
	/*$('.menu').each( function(){
		$(this).mouseover(function() {$(this).css({'opacity':'1.0'});}).mouseout(function() {$(this).fadeTo('fast', 0.7)});		
	});*/
	
	$('#menupresentazione').click(function() {
		if (!$('div').is(':animated')){
			$("#wrapper").hide();
			$('.content').slideUp('slow');
			$('#opaco').fadeOut('slow');
			$('#bg').delay(800).fadeOut('slow');
			window.setTimeout(function(){$("#bg").removeClass();}, 1300);
			window.setTimeout(function(){$("#bg").addClass('presentazione');}, 1300);
			$('#bg').fadeIn('slow');
			$('#opaco').delay(1400).fadeIn('slow');
			$('.cont_title').html("Presentazione");
			$.get('contents/presentazione.html', function(data) { $('#presentazione').html(data); $('#presentazione').delay(1800).slideDown('slow');});
			}
		return false;	
	});
	
	$('#menuilcentro').click(function() {
		if (!$('div').is(':animated')){
			$("#wrapper").hide();
			$('.content').slideUp('slow');
			$('#opaco').fadeOut('slow');
			$('#bg').delay(800).fadeOut('slow');
			window.setTimeout(function(){$("#bg").removeClass();}, 1300);
			window.setTimeout(function(){$("#bg").addClass('ilcentro');}, 1300);
			$('#bg').fadeIn('slow');
			$('#opaco').delay(1400).fadeIn('slow');
			$('.cont_title').html("Il Centro");
			$('#ilcentro').delay(1800).slideDown('slow');
			$("#wrapper").delay(2500).fadeIn('slow', function(){
				$("#wrapper").css({'visibility': 'visible'});
			});
			}
    	return false;
	});
	
	$('#menubenessere').click(function() {
		if (!$('div').is(':animated')){
			$("#wrapper").hide();
			$('.content').slideUp('slow');
			$('#opaco').fadeOut('slow');
			$('#bg').delay(800).fadeOut('slow');
			window.setTimeout(function(){$("#bg").removeClass();}, 1300);
			window.setTimeout(function(){$("#bg").addClass('benessere');}, 1300);
			$('#bg').fadeIn('slow');
			$('#opaco').delay(1400).fadeIn('slow');
			$('.cont_title').html("Benessere");
			$.get('contents/benessere.html', function(data) { $('#benessere').html(data); $('#benessere').delay(1800).slideDown('slow'); });
		}
    	return false;
	});
	
	$('#menudimagrimento').click(function() {
		if (!$('div').is(':animated')){	
			$("#wrapper").hide();
			$('.content').slideUp('slow');
			$('#opaco').fadeOut('slow');
			$('#bg').delay(800).fadeOut('slow');
			window.setTimeout(function(){$("#bg").removeClass();}, 1300);
			window.setTimeout(function(){$("#bg").addClass('dimagrimento');}, 1300);
			$('#bg').fadeIn('slow');
			$('#opaco').delay(1400).fadeIn('slow');
			$('.cont_title').html("Dimagrimento");
			$.get('contents/dimagrimento.html', function(data) { $('#dimagrimento').html(data); $('#dimagrimento').delay(1800).slideDown('slow'); });
		}
    	return false;
	});
	
	$('#menuestetica').click(function() {
		if (!$('div').is(':animated')){
			$("#wrapper").hide();
			$('.content').slideUp('slow');
			$('#opaco').fadeOut('slow');
			$('#bg').delay(800).fadeOut('slow');
			window.setTimeout(function(){$("#bg").removeClass();}, 1300);
			window.setTimeout(function(){$("#bg").addClass('estetica');}, 1300);
			$('#bg').fadeIn('slow');
			$('#opaco').delay(1400).fadeIn('slow');
			$('.cont_title').html("Estetica");
			$.get('contents/estetica.html', function(data) { $('#estetica').html(data); $('#estetica').delay(1800).slideDown('slow'); });
			}
    	return false;
	});
	
	$('#menufilosofia').click(function() {
		if (!$('div').is(':animated')){
			$("#wrapper").hide();
			$('.content').slideUp('slow');
			$('#opaco').fadeOut('slow');
			$('#bg').delay(800).fadeOut('slow');
			window.setTimeout(function(){$("#bg").removeClass();}, 1300);
			window.setTimeout(function(){$("#bg").addClass('filosofia');}, 1300);
			$('#bg').fadeIn('slow');
			$('#opaco').delay(1400).fadeIn('slow');
			$('.cont_title').html("Filosofia");
			$.get('contents/filosofia.html', function(data) { $('#filosofia').html(data); $('#filosofia').delay(1800).slideDown('slow'); });
		}
    	return false;
	});
	
	$('#menuprofumeria').click(function() {
		if (!$('div').is(':animated')){
			$("#wrapper").hide();
			$('.content').slideUp('slow');
			$('#opaco').fadeOut('slow');
			$('#bg').delay(800).fadeOut('slow');
			window.setTimeout(function(){$("#bg").removeClass();}, 1300);
			window.setTimeout(function(){$("#bg").addClass('profumeria');}, 1300);
			$('#bg').fadeIn('slow');
			$('#opaco').delay(1400).fadeIn('slow');
			$('.cont_title').html("Profumeria");
			$.get('contents/profumeria.html', function(data) { $('#profumeria').html(data); $('#profumeria').delay(1800).slideDown('slow'); });
		}
    	return false;
	});
	
	$('#menumakeup').click(function() {
		if (!$('div').is(':animated')){
			$("#wrapper").hide();
			$('.content').slideUp('slow');
			$('#opaco').fadeOut('slow');
			$('#bg').delay(800).fadeOut('slow');
			window.setTimeout(function(){$("#bg").removeClass();}, 1300);
			window.setTimeout(function(){$("#bg").addClass('makeup');}, 1300);
			$('#bg').fadeIn('slow');
			$('#opaco').delay(1400).fadeIn('slow');
			$('.cont_title').html("Make-up");
			$.get('contents/makeup.html', function(data) { $('#makeup').html(data); $('#makeup').delay(1800).slideDown('slow'); });
		}
    	return false;
	});
		
	$('#menuvideo').click(function() {
		if (!$('div').is(':animated')){
			$("#wrapper").hide();
			$('.content').slideUp('slow');
			$('#opaco').fadeOut('slow');
			$('#bg').delay(800).fadeOut('slow');
			window.setTimeout(function(){$("#bg").removeClass();}, 1300);
			window.setTimeout(function(){$("#bg").addClass('video');}, 1300);
			$('#bg').fadeIn('slow');
			$('#opaco').delay(1400).fadeIn('slow');
			$('.cont_title').html("Video");
			$.get('contents/video.html', function(data) { $('#video').html(data); $('#video').delay(1800).slideDown('slow'); });
		}
    	return false;
	});
			
	$('#menucontatti').click(function() {
		if (!$('div').is(':animated')){
			$("#wrapper").hide();
			$('.content').slideUp('slow');
			$('#opaco').fadeOut('slow');
			$('#bg').delay(800).fadeOut('slow');
			window.setTimeout(function(){$("#bg").removeClass();}, 1300);
			window.setTimeout(function(){$("#bg").addClass('contatti');}, 1300);
			$('#bg').fadeIn('slow');
			$('#opaco').delay(1400).fadeIn('slow');
			$('.cont_title').html("Contatti");
			$.get('contents/contatti.html', function(data) { $('#contatti').html(data); $('#contatti').delay(1800).slideDown('slow'); });
		}
    	return false;
	});
	
	$('#menupartnership').click(function() {
		if (!$('div').is(':animated')){
			$("#wrapper").hide();
			$('.content').slideUp('slow');
			$('#opaco').fadeOut('slow');
			$('#bg').delay(800).fadeOut('slow');
			window.setTimeout(function(){$("#bg").removeClass();}, 1300);
			window.setTimeout(function(){$("#bg").addClass('partnership');}, 1300);
			$('#bg').fadeIn('slow');
			$('#opaco').delay(1400).fadeIn('slow');;
			$('.cont_title').html("Partnership");
			$.get('contents/partnership.html', function(data) { $('#partnership').html(data); $('#partnership').delay(1800).slideDown('slow'); });
		}
    	return false;
	});	
	
	$('#menupromozioni').click(function() {
		if (!$('div').is(':animated')){
			$("#wrapper").hide();
			$('.content').slideUp('slow');
			$('#opaco').fadeOut('slow');
			$('#bg').delay(800).fadeOut('slow');
			window.setTimeout(function(){$("#bg").removeClass();}, 1300);
			window.setTimeout(function(){$("#bg").addClass('promozioni');}, 1300);
			$('#bg').fadeIn('slow');
			$('#opaco').delay(1400).fadeIn('slow');
			$('.cont_title').html("Promozioni");
			$.get('contents/promozioni.html', function(data) { $('#promozioni').html(data); $('#promozioni').delay(1800).slideDown('slow'); });
		}
    	return false;
	});
});

/*CONTROLLO CAMPI CONTATTI*/

function controllo(){
	
	var privacy = document.forms['form'].elements['privacy'][0].checked;
	var nome = document.forms['form'].elements['nome'].value;
	var cognome = document.forms['form'].elements['cognome'].value;
	var indirizzo = document.forms['form'].elements['indirizzo'].value;
	var citta = document.forms['form'].elements['citta'].value;
	var telefono = document.forms['form'].elements['telefono'].value;
	var cellulare = document.forms['form'].elements['cellulare'].value;
	var email = document.forms['form'].elements['email'].value;
	var richiesta = document.forms['form'].elements['richiesta'].value;
	var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
	
	if(privacy == false){
		   document.getElementById('privacycheck').innerHTML = "<td><font color=\"#9d3c5e\">Devi accettare le condizioni</font></td>";
		   var passato1 = false;
       }else{
		   document.getElementById('privacycheck').innerHTML = "<td><font color=\"#333333\">OK</font></td>";
		   var passato1 = true;
       }
	if(nome==""){
		   document.getElementById('nomecheck').innerHTML = "<td><font color=\"#9d3c5e\">Nome non inserito</font></td>";
		   var passato2 = false;
       }else{
		   document.getElementById('nomecheck').innerHTML = "<td><font color=\"#333333\">OK</font></td>";
		   var passato2 = true;
       }
	if(cognome==""){
		   document.getElementById('cognomecheck').innerHTML = "<td><font color=\"#9d3c5e\">Cognome non inserito</font></td>";
		   var passato3 = false;
       }else{
		   document.getElementById('cognomecheck').innerHTML = "<td><font color=\"#333333\">OK</font></td>";
		   var passato3 = true;
       }
	if(indirizzo==""){
		   document.getElementById('indirizzocheck').innerHTML = "<td><font color=\"#9d3c5e\">Indirizzo non inserito</font></td>";
		   var passato4 = false;
       }else{
		   document.getElementById('indirizzocheck').innerHTML = "<td><font color=\"#333333\">OK</font></td>";
		   var passato4 = true;
       }
	if(citta==""){
		   document.getElementById('cittacheck').innerHTML = "<td><font color=\"#9d3c5e\">citt&agrave; non inserita</font></td>";
		   var passato5 = false;
       }else{
		   document.getElementById('cittacheck').innerHTML = "<td><font color=\"#333333\">OK</font></td>";
		   var passato5 = true;
       }
	if(telefono=="" || isNaN(telefono)){
		   document.getElementById('telefonocheck').innerHTML = "<td><font color=\"#9d3c5e\">Telefono non inserito correttamente</font></td>";
		   var passato6 = false;
       }else{
		   document.getElementById('telefonocheck').innerHTML = "<td><font color=\"#333333\">OK</font></td>";
		   var passato6 = true;
       }
	if(cellulare=="" || isNaN(cellulare)){
		   document.getElementById('cellularecheck').innerHTML = "<td><font color=\"#9d3c5e\">Cellulare non inserito correttamente</font></td>";
		   var passato7 = false;
       }else{
		   document.getElementById('cellularecheck').innerHTML = "<td><font color=\"#333333\">OK</font></td>";
		   var passato7 = true;
       }
	if(email=="" || !email_reg_exp.test(email)){
		   document.getElementById('emailcheck').innerHTML = "<td><font color=\"#9d3c5e\">Email non inserita correttamente</font></td>";
		   var passato8 = false;
       }else{
		   document.getElementById('emailcheck').innerHTML = "<td><font color=\"#333333\">OK</font></td>";
		   var passato8 = true;
       }
	if(richiesta==""){
		   document.getElementById('richiestacheck').innerHTML = "<td><font color=\"#9d3c5e\">Richiesta non inserita</font></td>";
		   var passato9 = false;
       }else{
		   document.getElementById('richiestacheck').innerHTML = "<td><font color=\"#333333\">OK</font></td>";
		   var passato9 = true;
       }
	   
	 if(passato1 == true && passato2 == true && passato3 == true && passato4 == true && passato5 == true && passato6 == true && passato7 == true && passato8 == true && passato9 == true){
		 return true;
	 }else{
		 return false;
	 }
}

