$(document).ready(function() {

$(window).bind("unload", function() {
});

$(document).ready(function() {
$("#content").animate({opacity: 1, right: "0px"}, 500);
$("#content_index").animate({opacity: 1, right: "0px"}, 500);
$("#openCloseWrapRight").animate({opacity: 1, right: "740px"}, 500);
$("#ico_photos_supersized a").animate({opacity: 1}, 1000);
$("#ico_videos_supersized a").animate({opacity: 1}, 1000);
$("#ico_profils_supersized").animate({opacity: 1}, 1000);
$("#navigation").animate({opacity: 1}, 1000);
$("#slidecaption").animate({opacity: 1}, 1000);

$("a.transition").click(function(event){
event.preventDefault();
linkLocation = this.href;
$("#content").animate({opacity: 0, right: "-1000px"}, 250, redirectPage);
$("#content_index").animate({opacity: 0, right: "-1000px"}, 250, redirectPage);
$("#openCloseWrapRight").animate({opacity: 0, right: "-1000px"}, 250, redirectPage);
$("#ico_photos_supersized a").animate({opacity: 0}, 250, redirectPage);
$("#ico_videos_supersized a").animate({opacity: 0}, 250, redirectPage);
$("#ico_profils_supersized").animate({opacity: 0}, 250, redirectPage);
$("#navigation").animate({opacity: 0}, 250, redirectPage);
$("#slidecaption").animate({opacity: 0}, 250, redirectPage);
$("#footer").animate({opacity: 0}, 250, redirectPage);
});
function redirectPage() {
window.location = linkLocation;
}

$("a.transition_supersized").click(function(event){
event.preventDefault();
linkLocation = this.href;
$("#content").animate({opacity: 0, right: "-1000px"}, 250, redirectPage);
$("#openCloseWrapRight").animate({opacity: 0, right: "-1000px"}, 250, redirectPage);
$("#ico_photos_supersized a").animate({opacity: 0}, 250, redirectPage);
$("#ico_videos_supersized a").animate({opacity: 0}, 250, redirectPage);
$("#ico_profils_supersized").animate({opacity: 0}, 250, redirectPage);
$("#navigation").animate({opacity: 0}, 250, redirectPage);
$("#slidecaption").animate({opacity: 0}, 250, redirectPage);
$("#footer").animate({opacity: 1}, 250, redirectPage);
$("#header").animate({opacity: 1}, 250, redirectPage);
$(".sidebar").animate({opacity: 1}, 250, redirectPage);
});
function redirectPage() {
window.location = linkLocation;
}

$(".menu-item a").click(function(event){
event.preventDefault();
linkLocation = this.href;
$("#content").animate({opacity: 0, right: "-1000px"}, 250, redirectPage);
$("#content_index").animate({opacity: 0, right: "-1000px"}, 250, redirectPage);
$("#openCloseWrapRight").animate({opacity: 0, right: "-1000px"}, 250, redirectPage);
$("#ico_photos_supersized a").animate({opacity: 0}, 250, redirectPage);
$("#ico_videos_supersized a").animate({opacity: 0}, 250, redirectPage);
$("#ico_profils_supersized").animate({opacity: 0}, 250, redirectPage);
$("#navigation").animate({opacity: 0}, 250, redirectPage);
$("#slidecaption").animate({opacity: 0}, 250, redirectPage);
$("#footer").animate({opacity: 0}, 250, redirectPage);
});
function redirectPage() {
window.location = linkLocation;
}

$(".rightMenuAction").click( function() {
if ($("#openCloseIdentifier").is(":hidden")) {
$("#content").animate({marginRight: "0px"}, 500 );
$(".sidebar").animate({left: "20px"}, 500 );
$(".sidebar").animate({opacity: "1"}, 500 );
$("#openCloseWrapRight").animate({right: "740px", paddingRight:"5px"}, 500 );
$("#rightMenuImage").html('<img src="http://polesdimages.fr/wp-content/themes/polesdimages/img/ico_page_on.png" alt="close" />');
$("#ico_photos a").animate({opacity: "0"}, 500 );
$("#ico_videos a").animate({opacity: "0"}, 500 );
$("#ico_profils").animate({opacity: "0"}, 500 );
$("#footer").animate({opacity: "0"}, 500 );
$("#openCloseIdentifier").show();
} else {
$("#content").animate({marginRight: "-740px"}, 500 );
$("#content").animate({opacity: "1"}, 500 );
$(".sidebar").animate({left: "-1000px"}, 500 );
$("#openCloseWrapRight").animate({right: "0px", paddingRight:"28px"}, 500 );
$("#rightMenuImage").html('<img src="http://polesdimages.fr/wp-content/themes/polesdimages/img/ico_page_off.png" alt="open" />');
$("#ico_photos a").animate({opacity: "1"}, 1500 );
$("#ico_videos a").animate({opacity: "1"}, 1500 );
$("#ico_profils").animate({opacity: "1"}, 1500 );
$("#footer").animate({opacity: "1"}, 1500 );
$("#openCloseIdentifier").hide();
}
});

});

});
