function toggle_photo() {
	var x = $('header_main');
	var y = x.getStyle('height'); 
	var xx = y.substring(0,y.length-2); 
	if (xx == 205) {
		new Effect.Scale(x, 180, {scaleX: false, scaleContent: false, scaleMode: 'box'}); 
		new Effect.Fade('header_main_bg', { x: 900, y: 0, mode: 'relative' });
		new Effect.Fade('menu', { x: 900, y: 0, mode: 'relative' });
//		$(a).setStyle({background: 'white'});
		} 
		else if (xx > 205) {
		new Effect.Scale(x, 100, {scaleX: false, scaleMode:{originalHeight: 205}, scaleFrom: 180, scaleContent: false}); 
		new Effect.Appear('header_main_bg', { x: 900, y: 0, mode: 'relative' });
		new Effect.Appear('menu', { x: 900, y: 0, mode: 'relative' });
//		$(a).setStyle({background: ''});
		}
	}
	
function sx() {
	var x = $('photo').getStyle('left');

	var xx = x.substring(0,x.length-2);
	
	if (xx < 0) {
	new Effect.Move('photo', { x: 900, y: 0, mode: 'relative' });
	}
};

function dx() {
	x = $('photo');
	var childCount = x.getElementsByTagName('li').length;
	var gall_width = (childCount * -900) +900;
	var y = $('photo').getStyle('left');
	
	var xx = y.substring(0,y.length-2);

	if (xx > gall_width) {
	new Effect.Move('photo', { x: -900, y: 0, mode: 'relative' });
	}
};

function checkform_info() {
	var sw = 0;
	var msg = '';
	var nome = document.contatto.nome.value;
	var cognome = document.contatto.cognome.value;
	var email = document.contatto.email.value;
	var citta = document.contatto.citta.value;
	var cap = document.contatto.cap.value;

	var the_box1 = document.contatto.checklegge[0].checked;
		
		var x = document.contatto.email.value;
		var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		if (filter.test(x)) {
		//alert('YES! Correct email address');
		} else {
		
		msg += "Indirizzo email inesatto.\n" ;
		
		sw = 1 ;	
		} 


		if (!nome) {
		msg += "devi inserire il nome.\n" ;
		sw = 1 ;
		}
		
		if (!cognome) {
		msg += "devi inserire il cognome.\n" ;
		sw = 1 ;
		}
		if (!email) {
		msg += "devi inserire l\' email.\n" ;
		sw = 1 ;
		}
		if (!citta) {
		msg += "devi inserire la citta.\n" ;
		sw = 1 ;
		}
		if (!cap) {
		msg += "devi inserire il cap.\n" ;
		sw = 1 ;
		}
		
		if (the_box1 == true) {
		msg += "Devi accettare la clausola.\n" ;
		
		sw = 1 ;
		}
		
		
		
		if(sw == 1 ) {
			
			alert(msg);
			return false ;
		
		}

}

function sendMail_info() {

	var url = "" ;
	
	nome = document.contatto.nome.value ;
	cognome = document.contatto.cognome.value ;
	email = document.contatto.email.value ;
	citta = document.contatto.citta.value;
	cap = document.contatto.cap.value;
	country = document.contatto.country.value;
	
	url  = "./php/contatto.php?action=sendmail_info"  ;
	url += "&nome="+nome ;
	url += "&cognome="+cognome ;
	url += "&email="+email ;
	url += "&citta="+citta ;
	url += "&cap="+cap ;
	url += "&country="+country ;

 
	var ajaxObj = new ClassAJAX();
	ajaxObj.setExecute(false) ;
	ajaxObj.setReturn(true) ;
	ajaxObj.runAJAX(url) ;

	var html = "" ;
	var htmlOld = "" ;

	myInterval = window.setInterval(
	function() {
		htmlOld = html ;
		html = ajaxObj.getHtml() ;
		if (html != false) {
		
			if (htmlOld == html) {

				window.clearInterval(myInterval);

				var elem = eval("document.getElementById('cosa_content') ;") ;
				 
				//alert(html);
				
				elem.innerHTML=html ;

			}

		} else {
			
		}
	}
	,1) ; 
}

function checkform() {
	var sw = 0;
	var msg = '';
	
	var login = document.docform.login.value;
	var password = document.docform.password.value;
	var email = document.docform.email.value;


	var the_box1 = document.docform.checklegge[0].checked;
		
		var x = document.docform.email.value;
		var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		if (filter.test(x)) {
		//alert('YES! Correct email address');
		} else {
		
		msg += "Indirizzo email inesatto.\n" ;
		sw = 1 ;	
		} 

		if (!login) {
		msg += "devi inserire il login.\n" ;
		sw = 1 ;
		}
		
		if (!password) {
		msg += "devi inserire la password.\n" ;
		sw = 1 ;
		}

		if (!email) {
		msg += "devi inserire l\' email.\n" ;
		sw = 1 ;
		}


		if (the_box1 == true) {
		msg += "Devi accettare la clausola.\n" ;	
		sw = 1 ;
		}
	
		if(sw == 1 ) {		
			alert(msg);
			return false ;
		}
}

function dologin() { //alert('popop') ;
	var login = document.formLogin.login.value ;
	var passwd = document.formLogin.passwd.value ;
	var url = "ajax/ajax.php?center=dologinFront&login="+login+"&passwd="+passwd ;
	
	 
	
	var ajaxObj = new ClassAJAX();
	ajaxObj.setExecute(false) ;
	ajaxObj.setReturn(true) ;
	ajaxObj.runAJAX(url) ;

	var html = "" ;
	var htmlOld = "" ;

	myInterval = window.setInterval(
	function() {
		htmlOld = html ;
		html = ajaxObj.getHtml() ;
		if (html != false) {
		
			if (htmlOld == html) {

				window.clearInterval(myInterval);
				if(html =="OK") {
					window.location.reload();
				} else {
					var elem =document.getElementById('response') ; 
					elem.style.display='' ;
					elem.innerHTML=html ;
				}	
			}

		} else {
			
		}
	}
	,1) ;
}
