/* Nome Cliente 	narducci */
/* Creato:			28/07/2009 */
/* Autore:			fabio@evoluzionetelematica.it */
/* Ultima Modifica:	gg/mm/aaaa	Autore: Nome Cognome */




//<![CDATA[

var narducci = {

    // Utilizzare una variabile per fare riferimento al file SWF incorporato.

	startLoad: function(){
		if ($$('.fieldset-chiedInfo') != '') narducci.initForm()
		if ($$('.button-chiedInfo') != '') narducci.mostraForm()
		
	},
	
	
	
	startDomReady: function(){
		if ($('show')) narducci.initSlide()
		if ($('modelli')) narducci.modelli()
		if ($('gallery')) narducci.initGallery() //milkbox
		if ($('aspnetForm')) narducci.initSqueezeBox()
		if ($('aspnetForm')) narducci.initFormCheck()
		if ($$('.boxed') != '') narducci.initSqueezeBox()
	},	
	
	
	initSlide: function(){					   
	    var data = { 
	      '1.jpg': { caption: 'Narducci' }, 
		  '2.jpg': { caption: 'Narducci' }, 
		  '3.jpg': { caption: 'Narducci' }, 
		  '4.jpg': { caption: 'Narducci' }, 
		  '5.jpg': { caption: 'Narducci' }
	    	    }; 
	    var myShow = new Slideshow('show', data, {controller: false, height: 291, hu: '../img/images/', thumbnails: false, width: 650}); 
	  },

        
	initFormCheck: function() { 
		FormCheck = new FormCheck('aspnetForm');
	},

	
	initGallery: function() { // Inizializzo la gallery delle foto con zoom
		Milkbox = new Milkbox();
	},

	initSqueezeBox: function() // Inizializzo lo squeezebox x effetto lightbox x iFrame
	{
		SqueezeBox.assign($$('.boxed'), {
			parse: 'rel'
		});
	}, // Fine initSqueezeBox()
	


	// METODI X FORM	
	/* Metodo usato per mostrare/nascondere la form x chiedere informazioni */
	mostraForm: function(){
		
		var result = $$('.fieldset-chiedInfo')[0]
		
		if (result) {
			
			var mySlide = new Fx.Slide(result);
			
			mySlide.toggle();
			$$('.button-chiedInfo-btnInfo').addEvent('click', function(e){
				e = new Event(e);
				mySlide.toggle();
				e.stop();
			});
		}
	
	},
	
	initForm: function()
	{

		var list = new Array;
		
		var myInput = $$('.fieldset-chiedInfo label input');
		var myTextarea = $$('.fieldset-chiedInfo label textarea');
		var mySelect = $$('.fieldset-chiedInfo label select');
		var errorMsg = $$('.fieldset-chiedInfo label span');
		
		var list = list.concat(myInput, myTextarea, mySelect)
		
		list.each(function(element) {


			var myEffects = new Fx.Morph(element, {duration: 300, transition: Fx.Transitions.Sine.easeOut});


			element.addEvent('focus', function(){
				myEffects.start({
					'background-color': '#ef8f29',
					'color': '#fff'
				});
			element.getParent().getChildren('span').setStyle('display', 'none')
			
			})

			element.addEvent('blur', function(){
				myEffects.start({
					'background-color': '#fff',
					'color': '#333'
				});
			})			
				
		});
		
		errorMsg.each(function(element) {
			
			element.getParent().addEvent('click', function(){
				element.setStyle('display', 'none')
			});
		
		})
		// loop through all anchor tags
	}

	
} // chiusura classe narducci

///////////////////////////////////////////////////////

window.addEvent('domready', narducci.startDomReady);
window.addEvent('load', narducci.startLoad);
//]]>