function formcontrol ()
{
    var risposta='';
    if ($('nome').get('value')=='') risposta+="\nil nominativo";
    if ($('email').get('value')=='') risposta+="\nil telefono di riferimento";

    if ($('accetto').get('checked')==false) risposta+="\nil consenso al trattamento dei dati";
    
    if (risposta!="")   {
        alert("Mancano le seguenti informazioni:\n"+risposta);
        return false;
    }
    else return true;
}



function emailvalid(email)
{
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))
return (true);
else
return (false);
}



var slideInFunction = function() {
	this.start({'height':96,'border-width':3,'width':133,'left':-67});
	
}
var slideOutFunction = function() {	
	this.start({'height':0,'border-width':0,'width':0,'left':0});
}

var cancall = function(){
   $$('.box').each(function(el){
      el.setStyles({'display':'none'});
      });
   $$('.tab').each(function(el){
      el.setStyles({'background-image':'url("'+'immagini/taboff.jpg'+'")'});
      });
}

var vmodelli=function(){
   cancall();
   $('boxmodelli').setStyles({'display':'block'});
   $('tabmodelli').setStyles({'background-image':'url("'+'immagini/tabcurr.jpg'+'")'});
}
var vspecifiche=function(){
   cancall();
   $('boxspecifiche').setStyles({'display':'block'});
   $('tabspecifiche').setStyles({'background-image':'url("'+'immagini/tabcurr.jpg'+'")'});
}
var vrcg=function(){
   cancall();
   $('boxrcg').setStyles({'display':'block'});
   $('tabrcg').setStyles({'background-image':'url("'+'immagini/tabcurr.jpg'+'")'});
}
var vdischi=function(){
   cancall();
   $('boxdischi').setStyles({'display':'block'});
   $('tabdischi').setStyles({'background-image':'url("'+'immagini/tabcurr.jpg'+'")'});
}
var vtamburi=function(){
   cancall();
   $('boxtamburi').setStyles({'display':'block'});
   $('tabtamburi').setStyles({'background-image':'url("'+'immagini/tabcurr.jpg'+'")'});
}
var vrcf=function(){
   cancall();
   $('boxrcf').setStyles({'display':'block'});
   $('tabrcf').setStyles({'background-image':'url("'+'immagini/tabcurr.jpg'+'")'});
}
var vimmagini=function(){
   cancall();
   $('boximmagini').setStyles({'display':'block'});
   $('tabimmagini').setStyles({'background-image':'url("'+'immagini/tabcurr.jpg'+'")'});
}





var enterNormal = function() {
	new XtLightbox('.xtlightbox-gallery a');


var fotomdr =$("fotomdr");
var tastomdr =$("tastomdr");
fotomdr = new Fx.Morph(fotomdr, { link: 'cancel', transition: Fx.Transitions.Cubic.easeOut, duration:500 });
tastomdr.addEvents({
		'mouseenter': slideInFunction.bind(fotomdr),	
		'mouseleave': slideOutFunction.bind(fotomdr)
	});
var fotoswing =$("fotoswing");
var tastoswing =$("tastoswing");
fotoswing = new Fx.Morph(fotoswing, { link: 'cancel', transition: Fx.Transitions.Cubic.easeOut, duration:500 });
tastoswing.addEvents({
		'mouseenter': slideInFunction.bind(fotoswing),	
		'mouseleave': slideOutFunction.bind(fotoswing)
	});
var fotosprint =$("fotosprint");
var tastosprint =$("tastosprint");
fotosprint = new Fx.Morph(fotosprint, { link: 'cancel', transition: Fx.Transitions.Cubic.easeOut, duration:500 });
tastosprint.addEvents({
		'mouseenter': slideInFunction.bind(fotosprint),	
		'mouseleave': slideOutFunction.bind(fotosprint)
	});
var fotopendolare =$("fotopendolare");
var tastopendolare =$("tastopendolare");
fotopendolare = new Fx.Morph(fotopendolare, { link: 'cancel', transition: Fx.Transitions.Cubic.easeOut, duration:500 });
tastopendolare.addEvents({
		'mouseenter': slideInFunction.bind(fotopendolare),	
		'mouseleave': slideOutFunction.bind(fotopendolare)
	});
var fotomdn =$("fotomdn");
var tastomdn =$("tastomdn");
fotomdn = new Fx.Morph(fotomdn, { link: 'cancel', transition: Fx.Transitions.Cubic.easeOut, duration:500 });
tastomdn.addEvents({
		'mouseenter': slideInFunction.bind(fotomdn),	
		'mouseleave': slideOutFunction.bind(fotomdn)
	});
var fotoalpina =$("fotoalpina");
var tastoalpina =$("tastoalpina");
fotoalpina = new Fx.Morph(fotoalpina, { link: 'cancel', transition: Fx.Transitions.Cubic.easeOut, duration:500 });
tastoalpina.addEvents({
		'mouseenter': slideInFunction.bind(fotoalpina),	
		'mouseleave': slideOutFunction.bind(fotoalpina)
	});
var fotoquattro =$("fotoquattro");
var tastoquattro =$("tastoquattro");
fotoquattro = new Fx.Morph(fotoquattro, { link: 'cancel', transition: Fx.Transitions.Cubic.easeOut, duration:500 });
tastoquattro.addEvents({
		'mouseenter': slideInFunction.bind(fotoquattro),	
		'mouseleave': slideOutFunction.bind(fotoquattro)
	});
var fotoquattro_f =$("fotoquattro_f");
var tastoquattro_f =$("tastoquattro_f");
fotoquattro_f = new Fx.Morph(fotoquattro_f, { link: 'cancel', transition: Fx.Transitions.Cubic.easeOut, duration:500 });
tastoquattro_f.addEvents({
		'mouseenter': slideInFunction.bind(fotoquattro_f),	
		'mouseleave': slideOutFunction.bind(fotoquattro_f)
	});
var fotoalpe =$("fotoalpe");
var tastoalpe =$("tastoalpe");
fotoalpe = new Fx.Morph(fotoalpe, { link: 'cancel', transition: Fx.Transitions.Cubic.easeOut, duration:500 });
tastoalpe.addEvents({
		'mouseenter': slideInFunction.bind(fotoalpe),	
		'mouseleave': slideOutFunction.bind(fotoalpe)
	});

//$$('.comparsa')
/*
var comp=function(alt,ele){
   var elem = $(ele);
   //var left = elem.getStyle('left').toInt();
   if (alt>0)
   {
      var bord=3;
      var wid=133;
      var left=-67;
   }
   else
   {
      var bord=0;
      var wid=0;
      var left=0;

   }
//   alert(left);
   elem = new Fx.Morph(elem, { link: 'cancel', transition: Fx.Transitions.Cubic.easeOut, duration:500 });
   elem.start({'height':alt,'border-width':bord,'width':wid,'left':left});
}
var comp1=function(alt,ele){
   var elem = $(ele);
   //var left = elem.getStyle('left').toInt();
   if (alt>0)
   {
      var bord=3;
      var wid=133;
      var left=-67;
   }
   else
   {
      var bord=0;
      var wid=0;
      var left=0;

   }
//   alert(left);
   elem = new Fx.Morph(elem, { link: 'cancel', transition: Fx.Transitions.Cubic.easeOut, duration:500 });
   elem.start({'height':alt,'border-width':bord,'width':wid,'left':left});
}
var comp2=function(alt,ele){
   var elem = $(ele);
   //var left = elem.getStyle('left').toInt();
   if (alt>0)
   {
      var bord=3;
      var wid=133;
      var left=-67;
   }
   else
   {
      var bord=0;
      var wid=0;
      var left=0;

   }
//   alert(left);
   elem = new Fx.Morph(elem, { link: 'cancel', transition: Fx.Transitions.Cubic.easeOut, duration:500 });
   elem.start({'height':alt,'border-width':bord,'width':wid,'left':left});
}

var vmodellisss=function(){
      var modelli = $('boxmodelli');
      modelli = new Fx.Morph(modelli, {
         link: 'cancel',
         transition: Fx.Transitions.Cubic.easeInOut,
         duration:1500
   	});
      var rcg = $('boxrcg');
      rcg = new Fx.Morph(rcg, {
         link: 'cancel',
         transition: Fx.Transitions.Cubic.easeInOut,
         duration:1500
   	});
      var rcf = $('boxrcf');
      rcf = new Fx.Morph(rcf, {
         link: 'cancel',
         transition: Fx.Transitions.Cubic.easeInOut,
         duration:1500
   	});
      var immagini = $('boximmagini');
      immagini = new Fx.Morph(immagini, {
         link: 'cancel',
         transition: Fx.Transitions.Cubic.easeInOut,
         duration:1500
   	});

         rcf.start({'height':0});
         rcg.start({'height':600});
         modelli.start({'height':0});
         immagini.start({'height':0});
      }


*/
}

var enterMain = function() {
	
//	enterNormal();
        if (window.innerWidth)
            theWidth=window.innerWidth;
        else if (document.documentElement && document.documentElement.clientWidth)
            theWidth=document.documentElement.clientWidth;
        else if (document.body)
            theWidth=document.body.clientWidth;


         if (window.innerHeight)
            theHeight=window.innerHeight;
         else if (document.documentElement && document.documentElement.clientHeight)
            theHeight=document.documentElement.clientHeight;
         else if (document.body)
            theHeight=document.body.clientHeight;


    var intro = $('taglio');
	intro = new Fx.Morph(intro, {
		link: 'cancel',
		transition: Fx.Transitions.Cubic.easeIn,
		duration:1500
	});
    var spazio = $('spazio');
	spazio = new Fx.Morph(spazio, {
		link: 'cancel',
		transition: Fx.Transitions.Cubic.easeInOut,
		duration:2000
	});
    var introb = $('intro');
	introb = new Fx.Morph(introb, {
		link: 'cancel',
		transition: Fx.Transitions.Cubic.easeInOut,
		duration:2000
	});
    var lans = $('lan');
    dist2=(theWidth-350)/2;
    lans.setStyles({'left':dist2,'margin-left':0});
	lans = new Fx.Morph(lans, {
		link: 'cancel',
		transition: Fx.Transitions.Cubic.easeInOut,
		duration:2000
	});
    var logos = $('logo');
    dist=(theWidth-458)/2;
    logos.setStyles({'left':dist,'margin-left':0});
	logos = new Fx.Morph(logos, {
		link: 'cancel',
		transition: Fx.Transitions.Cubic.easeInOut,
		duration:2000
	});
    var slogan = $('slogan');
	slogan.setStyles({'left':(dist+200),'margin-left':0});
    slogan = new Fx.Morph(slogan, {
		link: 'cancel',
		transition: Fx.Transitions.Cubic.easeOut,
		duration:2000
	});
    var bis=function()
    {
        //$('taglio').setStyle('width',theWidth)  
        intro.start({'margin-left':theWidth});
        
    }
    var tris=function()
    {
        $('taglio').fade('hide');
        introb.start({'height':theHeight-200,'top':200});
//        introb.start({'height':657,'top':200});
        spazio.start({'height':200});
    }
    var lan=function()
    {
        logos.start({'left':(dist-200), 'margin-left':0});
        $('lan').set('tween', {duration: 2000});
        $('lan').fade('in');
        lans.start({'left':(dist2+300)})
        
    }
    var sloganf=function()
    {
        slogan.start({'width':227,'left':(dist-103)});
    }
    var logosf=function()
    {
        logos.start({'top':50});
    }

        $('lan').fade('hide');
        $('logo').fade('hide');
        $('logo').set('tween', {duration: 2000});
        $('logo').fade('in');
        bis.delay(2000);
        logosf.delay(4000);
        tris.delay(4000);
        lan.delay(6000);
        sloganf.delay(7000);
    
    /*

    
    $('q1').addEvent('mouseenter',function()
		{
		q1.start({'height':300,'width':800});
		q2.start({'height':300,'width':50});
		q3.start({'height':50,'width':800,'line-height':30});
		q4.start({'height':50,'width':50,'line-height':30});
		});
	$('q1').addEvent('mouseleave',function()
		{
		q1.start({'height':170,'width':425,'line-height':100});
		q2.start({'height':170,'width':425,'line-height':100});
		q3.start({'height':170,'width':425,'line-height':100});
		q4.start({'height':170,'width':425,'line-height':100});
		});



	$('q2').addEvent('mouseenter',function()
		{
		q2.start({'height':300,'width':800});
		q1.start({'height':300,'width':50});
		q4.start({'height':50,'width':800,'line-height':30});
		q3.start({'height':50,'width':50,'line-height':30});
		});
	$('q2').addEvent('mouseleave',function()
		{
		q1.start({'height':170,'width':425,'line-height':100});
		q2.start({'height':170,'width':425,'line-height':100});
		q3.start({'height':170,'width':425,'line-height':100});
		q4.start({'height':170,'width':425,'line-height':100});
		});



	$('q3').addEvent('mouseenter',function()
		{
		q3.start({'height':300,'width':800});
		q4.start({'height':300,'width':50});
		q1.start({'height':50,'width':800,'line-height':30});
		q2.start({'height':50,'width':50,'line-height':30});
		});
	$('q3').addEvent('mouseleave',function()
		{
		q1.start({'height':170,'width':425,'line-height':100});
		q2.start({'height':170,'width':425,'line-height':100});
		q3.start({'height':170,'width':425,'line-height':100});
		q4.start({'height':170,'width':425,'line-height':100});
		});



	$('q4').addEvent('mouseenter',function()
		{
		q4.start({'height':300,'width':800});
		q3.start({'height':300,'width':50});
		q2.start({'height':50,'width':800,'line-height':30});
		q1.start({'height':50,'width':50,'line-height':30});
		});
	$('q4').addEvent('mouseleave',function()
		{
		q1.start({'height':170,'width':425,'line-height':100});
		q2.start({'height':170,'width':425,'line-height':100});
		q3.start({'height':170,'width':425,'line-height':100});
		q4.start({'height':170,'width':425,'line-height':100});
		});
		*/
}

