// JavaScript Document

$(document).ready(function(){
						
		var blank = new Image();
		 blank.src = 'images/pixel.gif';
		 
		 $(document).ready(function() {
		   var badBrowser = (/MSIE ((5\.5)|6)/.test(navigator.userAgent) && navigator.platform == "Win32");
		   if (badBrowser) {
			 // get all pngs on page
			 $('img[src$=.png]').each(function() {
			   if (!this.complete) {
				 this.onload = function() { fixPng(this) };
			   } else {
				 fixPng(this);
			   }
			 });
		   }
		 });
		 
		 function fixPng(png) {
		   // get src
		   var src = png.src;
		   // set width and height
		   if (!png.style.width) { png.style.width = $(png).width(); }
		   if (!png.style.height) { png.style.height = $(png).height(); }
		   // replace by blank image
		   png.onload = function() { };
		   png.src = blank.src;
		   // set filter (display original image)
		   png.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
		 }
 
		$(document).pngFix();
		
		$(document).bgStretcher({
		albums:{'Landscapes':['img/bg.jpg']},
		album: 'Landscapes', imageWidth: 1429, imageHeight: 900
		});

		$('#switch-sx').toggle(function() {
		  $('#sx').animate({ marginLeft: '-500px' },500, 'easeInCirc'); 
		  $("#switch").attr("src","img/open.gif");
	
		}, function() {
		  $('#sx').animate({ marginLeft: '0px' },500, 'easeOutCirc'); 
		  $("#switch").attr("src","img/close.gif");
		});

		
		
	});

	$(function () {
		$('img').hide();//hide all the images on the page
	});
	
	var i = 0;//initialize
	var int=0;//Internet Explorer Fix
	$(window).bind("load", function() {//The load event will only fire if the entire page or document is fully loaded
		var int = setInterval("doThis(i)",500);//500 is the fade in speed in milliseconds
	});
	
	function doThis() {
		var images = $('img').length;//count the number of images on the page
		if (i >= images) {// Loop the images
			clearInterval(int);//When it reaches the last image the loop ends
		}
		$('img:hidden').eq(0).fadeIn(500);//fades in the hidden images one by one
		i++;//add 1 to the count
	}

	var checkobj

	function agreesubmit(el){
			checkobj=el
			if (document.all||document.getElementById){
			for (i=0;i<checkobj.form.length;i++){ 
			var tempobj=checkobj.form.elements[i]
			if(tempobj.type.toLowerCase()=="submit")
			tempobj.disabled=!checkobj.checked
			}
		}
	}
	
	<!--
	function checkform (form)
	{
	  p=form.email.value.indexOf('@');
	  q=form.email.value.indexOf('.');
	  
	  if (form.nome.value == "Nome:") {
		alert( "Inserisci il tuo nome." );
		form.nome.focus();
		return false ;
	  }
	  
	 
	  if (form.email.value == "Email:") {
		alert( "Inserisci la tua email." );
		form.email.focus();
		return false ;
	  } 
	  
	  if(p<1 || p==(form.email.value.length-1)) {
		alert('Inserici un indirizzo di email valido!');
		form.email.focus();
		return false;
	  } 
	  
	  if(q<1 || q==(form.email.value.length-1)) {
		alert('Inserisci un indirizzo di email valido!');
		form.email.focus();
		return false;
	  }
		
	  return true ;
	}
	//-->

	
