/* jQuery effects for Alsol Project */

// slide & fade function
jQuery.fn.slideFadeToggle = function(speed)
{
	return this.animate({opacity:'toggle', height:'toggle'}, speed);
};

$(document).ready(function()
{

	// LOGO
	$("#Logo").hover(
	function () {
		$(this).css({ 'cursor' : 'pointer' });
		$(this).fadeOut(200);
		$(this).fadeIn(200);
	},
	function () {
		$(this).css({ 'cursor' : 'default' });
	}
	);
	
	// PROTECTION SOLAIRE
	$("#ProtecSolaire").hide();
	$("#ProtecSolaire").animate({ opacity: "show", "color": "#f33000" }, 1500);
	$("#ProtecSolaire").animate({ "color": "#f33000"}, 2000);
	$("#ProtecSolaire").animate({ "color": "#111" }, 1500);
	

	// BODY
	$("#Menu").hide();
	$("#Menu").slideFadeToggle('slow');
	$("#PictureBox").hide();
	$("#PictureBox").fadeIn('slow');
	
	// FOOTER
	//
	$("#Footer a").hover(
	function () {
		$(this).fadeOut(200);
		$(this).fadeIn(200);
	},
	function () {
	// ne fait rien
	}
	);
	
	
	// POSTIT
	//
	// Events
	//
	// onload
	//
	// Detecte le navigateur (ie ne supporte pas les effets sur png)
	jQuery.each(jQuery.browser, function(i) {
	if($.browser.mozilla | $.browser.safari | $.browser.opera){
		$("#Postit").hide();
		$("#Postit").fadeIn('slow');
	}
	});
	//
	// onload
	$("#PostitClose").hide();
	// onclick
	$("#PostitClose").click(
	function () {
		// Detecte le navigateur (ie ne supporte pas les effets sur png)
		jQuery.each(jQuery.browser, function(i) {
		if($.browser.mozilla | $.browser.safari | $.browser.opera){
			$("#Postit").fadeOut('slow');
		}
		else
		{
			$("#Postit").hide();
		}
		});
		// Fix css de ie
		jQuery.each(jQuery.browser, function(i) {
		if($.browser.msie){
			if(window.location.pathname == "/Alsol/index.php" || window.location.pathname == "/index.php")
			{
				$("#Centre").css("margin-top" , -10);
				$("#Footer").css("margin-top", 100);
			}
		}
		});
	}
	);
	// onmouseover
	$("#Postit").hover(
	function () {
		$("#PostitClose").fadeIn();
	} ,
	function () {
		$("#PostitClose").fadeOut();
	}
	);

});