// JavaScript Document



    $(document).ready(function() {
		
		//1.this is for the home page four-columns-container links.on hover vogliamo visualizzare la coloured strip e cambiare colore al testo
        $(".home-four-columns-container .column a").mouseenter(function() {
			var color_column=$(this).closest('.column').children('.coloured-strip').css('color');
            $(this).closest('.column').children('.coloured-strip').fadeIn(600);
			$(this).siblings('p').add(this).animate({color:color_column},1000);
			$('.header').animate({backgroundColor:color_column},1000);
        });
		$(".home-four-columns-container .column a").mouseleave(function() {
    		$(this).closest('.column').children('.coloured-strip').fadeOut(600);
			$(this).siblings('p').add(this).animate({color:'#59AC98'},1000);
			$('.header').animate({backgroundColor:'#207199'},1000);
		})//end 1
		
		
		//2.color effect on navigation links
		
		$('.navigation-list a').mouseenter(function(){
			
			$(this).animate({color:'#ADF2BA'},800);	
		});//end 2
		
		$('.navigation-list a').mouseleave(function(){
			
			$(this).animate({color:'white'},1000);	
		});//end 2
		
		//3.fade caption homepage slide on hover
		
		$('.home-slide-show .caption').mouseenter(function(){
				$(this).fadeTo('slow', 0.5);
			
			})
			
		$('.home-slide-show .caption').mouseleave(function(){
				$(this).fadeTo('slow', 1);
			
			})
		
		//end 3
		
	//5.Get the caption of the first image from REL attribute and display it
    	$('.title-caption').html($('#slideshow').find('img.active').attr('title'))
    .animate({opacity: 1}, 1000);
	
	 $('.payoff-caption').html($('#slideshow').find('img.active').attr('rel'))
    .animate({opacity: 1}, 1000);
	$('.caption').fadeIn(4000);
	//end 5
	
	
	
	
	//6.FOCUS AND FOCUS OUT ON CONTACT FORM
		$('.contact-form input,.contact-form textarea').focus(function(){
			$(this).animate({backgroundColor:'white'}, 1000);	
		})
		
		$('.contact-form input,.contact-form textarea').focusout(function(){
			$(this).animate({backgroundColor:'#F3FEFF'}, 2000);	
		})		
	//end of 6
	
	
			//7.slide toggle price-list 
		


    $(".trigger-price-list").click(function(){

		if ($(".price-list").is(":hidden")){
                        $(".price-list").slideDown("slow");
						$(".price-list,.holder-price-list").animate({opacity:0.9},2000);
						$(".holder-price-list").animate({backgroundColor:'#F3FEFF'},3000);
						$(".trigger-price-list").animate({'padding-top':5,'padding-bottom':5},100);
						$('a.trigger-price-list').html('<div class="close"></div>');
                    }
                    else{
                        $(".price-list").slideUp("slow");
						$(".holder-price-list").animate({backgroundColor:'white'},600);
						$(".trigger-price-list").animate({'padding-top':0,'padding-bottom':0},200);
						$('a.trigger-price-list').html('<div class="euro"></div>');
                    }
        	


    });


		
		//
	
	
	});//end document ready 







//
//		outside document ready!!!!
//
//
//




		//4.slide show in the home page
			function slideSwitch() {
				var $active = $('#slideshow IMG.active');
				
				if ( $active.length == 0 ) $active = $('#slideshow IMG:last');
				
				var $next =  $active.next().length ? $active.next()
				: $('#slideshow IMG:first');
				
				$active.addClass('last-active');
				
	//Get the caption of the first image from REL attribute and display it
    $('.title-caption').html($('#slideshow').find('img.active').attr('title'))
    .animate({opacity: 1}, 1000);
	
	 $('.payoff-caption').html($('#slideshow').find('img.active').attr('rel'))
    .animate({opacity: 1}, 1000);
				
				//
				$next.css({opacity: 0.0})
				.addClass('active')
				.animate({opacity: 1.0}, 1000, function() {
				$active.removeClass('active last-active');
				});
			}

		$(function() {
			setInterval( "slideSwitch()", 4000 );
		});
		
		//end 4
    

//function to syle button contact form submit
			$(function() {
            $( ".contact-form input:submit").button();
            });
//


