var ancien = '1';

function masquer(onglet)
	{
	ancien = onglet;
	};

function masquer_tout()
	{
	$('.onglet').stop(true, true);
	$('.onglet').slideUp('fast');
	$('.onglet ' + '.' + ancien).stop(true, true);
	$('.onglet ' + '.' + ancien).slideUp('fast');
	$('#fleche').css('display', 'none');
	};
function afficher_tout()
	{
	$('.onglet').stop(true, true);
	$('.onglet').slideDown('fast');
	$('#fleche').css('display', 'block');
	};

function afficher(onglet, position, position_fleche)
	{
	$('.onglet ' + '.' + ancien).stop(true, true);
	if (ancien != onglet)
		{
		$('.onglet ' + '.' + ancien).slideUp('fast');
		}
	$('.onglet ' + '.' + onglet).slideDown('fast');
	$('.onglet').stop(true, true);
	$('.onglet').animate(
		{
		marginLeft: position + 'px'
		}
		, 200);
	$('#fleche').stop(true, true);
	$('#fleche').animate(
		{
		marginLeft: position_fleche + 'px'
		}
		, 200);
	};

function afficherFavoris()
	{
	if ($('#favoris2').css('display') == 'none')
		{
		$('#favoris2').stop(true, true);
		$('#favoris2').slideDown('fast');
		}
	};
function masquerFavoris()
	{
	$('#favoris2').stop(true, true);
	$('#favoris2').slideUp('fast');
	};

function orangeAgrandir(colonne)
	{
	$('#cadreorange .n' + colonne).stop(true, true);
	$('#cadreorange .n' + colonne).slideDown('fast');
	$('#cadreorange .n' + colonne).animate(
		{
		top: '-62px'
		}
	,200);
	};
function orangeReduire(colonne)
	{
	$('#cadreorange .n' + colonne).animate(
		{
		top: '0px'
		}
	,200);
	};
function login()
	{
	if ($('#login .bouton').html() == '<a href="#" onclick="login();">Fermer</a>')
		{
		$('#login').animate(
			{
			top: '-96px'
			}
		,200);
		$('#login .bouton').html('<a href="#" onclick="login();">Espace client</a>');
		}
	else
		{
		$('#login').animate(
			{
			top: '0px'
			}
		,200);
		$('#login .bouton').html('<a href="#" onclick="login();">Fermer</a>');
		}
	};

$(document).ready(function()
	{
	image = new Image();
	image.src = "images/fond-favoris.png";
	image1 = new Image();
	image1.src = "images/onglet.png";
	image2 = new Image();
	image2.src = "images/onglet2.png";
	image3 = new Image();
	image3.src = "images/onglet3.png";
	image4 = new Image();
	image4.src = "images/onglet.png";


/*	$('#menu .bouton .accueil')		.mouseenter(function(){		afficher('accueil', 0, 0			);});
	$('#menu .bouton .nooveo')		.mouseenter(function(){		afficher('nooveo', 30, 139		);});
	$('#menu .bouton .service')		.mouseenter(function(){		afficher('Services', 172, 282		);});
	$('#menu .bouton .reference')		.mouseenter(function(){		afficher('reference', 314, 425	);});
	$('#menu .bouton .partenaire')		.mouseenter(function(){		afficher('Partenaires', 456, 568	);});
	$('#menu .bouton .revendeur')		.mouseenter(function(){		afficher('Revendeurs', 598, 711	);});
	$('#menu .bouton .contact')		.mouseenter(function(){		afficher('contact', 629, 851		);});
*/
	$('#menu .bouton .accueil')		.mouseenter(function(){		afficher('accueil', 0, 0			);});

	$('#menu .bouton .services')		.mouseenter(function(){		afficher('services', 30, 139		);});
	$('#menu .bouton .references')		.mouseenter(function(){		afficher('references', 172, 282 	);});
	$('#menu .bouton .nooveo')		.mouseenter(function(){		afficher('nooveo', 314, 425		);});
	
	$('#menu .bouton .partenaires')		.mouseenter(function(){		afficher('partenaires', 456, 568	);});
	$('#menu .bouton .revendeurs')		.mouseenter(function(){		afficher('revendeurs', 598, 711	);});
	$('#menu .bouton .contact')		.mouseenter(function(){		afficher('contact', 629, 851		);});
	
	$('#favoris')					.mouseenter(function(){		afficherFavoris(				);});
	$('#menu')					.mouseenter(function(){		afficher_tout(				);});
	$('#cadreorange .n1')			.mouseenter(function(){		orangeAgrandir(1			);});
	$('#cadreorange .n2')			.mouseenter(function(){		orangeAgrandir(2			);});
	$('#cadreorange .n3')			.mouseenter(function(){		orangeAgrandir(3			);});

	$('#menu .accueil')		.mouseleave(function(){		masquer('accueil'		);});
	$('#menu .nooveo')		.mouseleave(function(){		masquer('nooveo'		);});
	$('#menu .services')		.mouseleave(function(){		masquer('services'		);});
	$('#menu .references')	.mouseleave(function(){		masquer('references'		);});
	$('#menu .partenaires')	.mouseleave(function(){		masquer('partenaires'		);});
	$('#menu .revendeurs')	.mouseleave(function(){		masquer('revendeurs'		);});
	$('#menu .contact')		.mouseleave(function(){		masquer('contact'		);});
	$('#menu')			.mouseleave(function(){		masquer_tout(			);});
	$('#favoris')			.mouseleave(function(){		masquerFavoris(		);});
	$('#cadreorange .n1')	.mouseleave(function(){		orangeReduire(1		);});
	$('#cadreorange .n2')	.mouseleave(function(){		orangeReduire(2		);});
	$('#cadreorange .n3')	.mouseleave(function(){		orangeReduire(3		);});
	
	$('.hautPage').click(function()
		{
		var $target = $(this.hash);
		$('html,body').animate({ scrollTop: 0 }, 1000);
		return false;
		});
	
	$('#login').css('top', '-96px');
	
	$(".cadreorange").each(function()
		{
		$(this).css('top', '0');
		}); 
	
	/* ____________FORMULAIRE_____________*/
	function motDePasse(numero)
		{
		$('.motPasseClair' + numero).hide();
		$('.motPasseSecure' + numero).show();
		$('.motPasseSecure' + numero).focus();
		if($('.motPasseSecure' + numero).attr('value') == 'Mot de passe')
			{$('.motPasseSecure' + numero).attr('value', '');}
		}
	function motDePasse2(numero)
		{
		$('.motPasseSecure' + numero).hide();
		$('.motPasseClair' + numero).show();
		$('.motPasseClair' + numero).focus();
		}
	
	$("input").each(function()
		{
		if ($(this).attr("type") != 'submit')
			{
			$(this).attr("contenu", $(this).attr("value"));
			$(this).focusin(function()
				{
				if ($(this).attr('value') == $(this).attr('contenu'))
					$(this).attr('value', '');
				});
			$(this).focusout(function()
				{
				if ($(this).attr('value') == '')
					$(this).attr('value', $(this).attr('contenu'));
				});
			}
		}); 
	$("textarea").each(function()
		{
		$(this).attr("contenu", $(this).html());
		$(this).focusin(function()
			{
			if ($(this).html() == $(this).attr('contenu'))
				$(this).html('');
			});
		$(this).focusout(function()
			{
			if ($(this).html() == '')
				$(this).html($(this).attr('contenu'));
			});
		}); 
	
	$('.motPasseClair1')		.focusin(function(){		motDePasse(1			);});
	$('.motPasseClair2')		.focusin(function(){		motDePasse(2			);});
	$('.motPasseSecure1')	.mouseleave(function(){	motDePasse2(1			);});
	$('.motPasseSecure2')	.mouseleave(function(){	motDePasse2(2			);});
	
	$('.motPasseClair1').show();
	$('.motPasseSecure1').hide();
	$('.motPasseClair2').show();
	$('.motPasseSecure2').hide();
	});
	
function favoris(adresse, nom)
	{
	if ( navigator.appName != 'Microsoft Internet Explorer' )
		{
		window.sidebar.addPanel(nom,adresse,"");
		}
	else
		{
		window.external.AddFavorite(adresse,nom);
		}
	}
	
function PopupCentrer(page,largeur,hauteur) {
  var top=(screen.height-hauteur)/2;
  var left=(screen.width-largeur)/2;
  window.open(page,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+", menubar=no,resizable=no,scrollbars=yes,statusbar=no");
}

function RunFoo(swf, largeur, hauteur , couleur, nom) {
	document.write("  <object type=\"application/x-shockwave-flash\" data=\""+swf+"\" width=\""+largeur+"\" height=\""+hauteur+"\"><param name=\"movie\" value=\""+swf+"\" />  </object>");

}

/*Google analytics*/
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-999902-6']);
_gaq.push(['_trackPageview']);

(function() {
  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
