//pretty photo
	$(document).ready(function(){
		$("a[rel^='prettyPhoto']").prettyPhoto();
		$('img.attachment-thumbnail[title]').each(function() { $(this).removeAttr('title'); });
		$('img.attachment-thumbnail[title]').each(function() { $(this).removeAttr('alt'); });
		$('.gallery-row a').each(function() { $(this).removeAttr('title'); });
	});


//preloading 
$(function () {
	//$('.preload').hide();//hide all the images on the page
	$('.play,.magnifier').css({opacity:0});
	$('.preload').css({opacity:0});
	$('.preload').addClass("animated");
	$('.play,.magnifier').addClass("animated_icon");
	
	
	
	// Recent Projects animation

	$('.view_project').css({ opacity: 0 });

	$('.view_project').hover(function(){

	    $(this).addClass('current_project');
	    $('.current_project').stop().animate({ opacity: 1 }, 300);

	}, function(){

	     $('.current_project').stop().animate({ opacity: 0 }, 300);
	     $('.current_project').removeClass('current_project');

	});
	
	
	
});


var i = 0;//initialize
var cint=0;//Internet Explorer Fix
$(window).bind("load", function() {//The load event will only fire if the entire page or document is fully loaded
	var cint = setInterval("doThis(i)",72);//500 is the fade in speed in milliseconds

});

function doThis() {
	var images = $('.preload').length;//count the number of images on the page
	if (i >= images) {// Loop the images
		clearInterval(cint);//When it reaches the last image the loop ends
	}
	$('.preload:hidden').eq(i).fadeIn(500);//fades in the hidden images one by one
	$('.animated_icon').eq(0).animate({opacity:1},{"duration": 1500});
	$('.animated').eq(0).animate({opacity:1},{"duration": 1500});
	$('.animated').eq(0).removeClass("animated");
	$('.animated_icon').eq(0).removeClass("animated_icon");
	i++;//add 1 to the count
}

$(window).bind("load", function() {
	
$('.headline').delay(2000).fadeIn(1000);
$('.headline_en').delay(2000).fadeIn(1000);
$('.headline_fr').delay(2000).fadeIn(1000);

});

// $(window).bind("load", function() {//The load event will only fire if the entire page or document is fully loaded
// 
// });

//Effetcs
// $(document).ready(function(){
// 	
// 	
// 	if (!$('#nav li').hasClass('current_page_item')) {	
// 	
// 		$("#nav li a").hover(function() {
// 		               $(this).stop().animate({ marginLeft: "-15px"}, 200);
// 		               },function() {
// 		               $(this).stop().animate({ marginLeft: "0" }, 200);
// 		               });	
// 	}
// 	
//  
//  });




// $(document).ready(function(){
// 	
// 	$('#nav li').each(function(index) {
// 	 //alert(index + ': ' + $(this).text());   
// 	//alert(index + ': ' + $(this).prev());
// 
// 		if ( $(this).hasClass('current_page_item')) {
// 
// 				$(this).hover(function() {
// 					               $(this).stop().animate({ marginLeft: "0"}, 200);
// 					               },function() {
// 					               $(this).stop().animate({ marginLeft: "0" }, 200);
// 					               });//fine hover func
// 
// 
// 		}//fine hasclass
// 
// 		else  {
// 
// 
// 				$(this).hover(function() {
// 					               $(this).stop().animate({ marginLeft: "-15px"}, 200);
// 					               },function() {
// 					               $(this).stop().animate({ marginLeft: "0" }, 200);
// 					               });//fine hover func
// 
// 		} //fine else
// 
// 
// 
// 	}); //fine each
//  
//  }); //fine docready






//Slideshow Partner

function slideSwitch() {
    var $active = $('#slideshow DIV.active');

    if ( $active.length == 0 ) $active = $('#slideshow DIV:last');

    // use this to pull the divs in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow DIV:first');

    // uncomment below to pull the divs randomly
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 5000 );
});




//Slideshow Certificazioni

function slideSwitch_cert() {
    var $active = $('#slideshow-cert DIV.active');

    if ( $active.length == 0 ) $active = $('#slideshow-cert DIV:last');

    // use this to pull the divs in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow-cert DIV:first');

    // uncomment below to pull the divs randomly
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch_cert()", 2000 );
});





// Cform
$(document).ready(function(){
	$('body.page-id-207 .cform select option').each(function(){
        var theText = $(this).val();
		var	val2 = jQuery.trim($(this).val());

        $(this).addClass(val2);
    });
 }); //fine docready
