$(document).ready(function(){
	//leggi tutto
	$('#read1').click(function(){
		$('.more1').slideToggle("fast");
		$('#mostra1').toggle();
		return false
	});
	$('#read2').click(function(){
		$('.more2').slideToggle("fast");
		$('#mostra2').toggle();
		return false
	});
	$('#read3').click(function(){
		$('.more3').slideToggle("fast");
		$('#mostra3').toggle();
		return false
	});
	$('#read4').click(function(){
		$('.more4').slideToggle("fast");
		$('#mostra4').toggle();
		return false
	});
	
	$('.out').click(function(){
		window.open ($(this).attr('href'),"");
		return false;
	});
	
	$('form').submit(function(){
		if(this.attr('name')=='checkavail') return true;//form di aruba
		
		var id_form=$(this).attr('id');
		var name=$('#name').val()
		var email=$('#email').val()
		var message=$('#message').val()
		var title=$('#title').val()
		var dataString='name='+name+'&email='+email+'&title='+title+'&message='+message;
		$.ajax({
	        type: 'POST',
	        url: $(this).attr('action'),
	        cache: false,
	        data: dataString,
	        success:function(){
	        	if (id_form=='contact'){
	    			$('.more4').toggle();
					$('#mostra4').toggle();
	        	}	
    			$('#'+id_form).parent().prepend('<p id="ok" class="hide">Messaggio Inviato!</p>');
    			$('#ok').fadeIn("slow");
    			$('#ok').fadeOut("slow");
  			},
	        async: false
	    })
	    
		return false;
	});


	//galleria fade
	$('#fade').cycle({ 
    fx: 'custom', 
    cssBefore: {  
        top:  0, 
        left: 0, 
        width: 0, 
        height: 0,  
        zIndex: 1  
    }, 
    animIn:  {  
        width: 280, 
        height: 250  
    }, 
    animOut: {  
        top:  200, 
        left: 200, 
        width: 0, 
        height: 0 
    }, 
    cssAfter: {  
        zIndex: 0  
    }, 
    delay: -1000 
});
});
 
$(function() {
	//Set the default directory to find the images needed
	//by the plugin (closebtn.png, blank.gif, loading images ....)
	$.fn.fancyzoom.defaultsOptions.imgDir='./images/ressources/'; //very important must finish with a /

	// Select all links in object with gallery ID using the defaults options
	$('#gallery a').fancyzoom(); 

	// Select all links with tozoom class, set the open animation time to 1000
	$('#gallery a').fancyzoom({Speed:700});

	// Select all links set the overlay opacity to 80%
	$('#gallery a').fancyzoom({overlay:0.6});
	
	//new rev > 1.2
	//apply fancyzoom effect on all image whose class is fancyzoom !!
	$('#gallery img').fancyzoom();
});


