// ActionScript Document
function redirect(DivTimer,time,url,txt)
	{
		document.getElementById(DivTimer).innerHTML = 'Vous allez &ecirc;tre redirig&eacute; vers <a href="'+url+'">'+txt+'</a> dans ' + time + ' secondes.';
		if(time < 1)
			window.location.href = url;
		time = time - 1;
		setTimeout("redirect('"+DivTimer+"',"+time+",'"+url+"','"+txt+"')",1000);
	}
window.addEvent('domready', function() {
	$('ajaxLogon').addEvent('submit', function(e) {
		/**
		 * Prevent the submit event
		 */
		new Event(e).stop();
	 
		/**
		 * This empties the log and shows the spinning indicator
		 */
		var log = $('reponse').empty().addClass('ajax-loading');
		$('textinfoaccueil').empty();
 
		/**
		 * send takes care of encoding and returns the Ajax instance.
		 * onComplete removes the spinner from the log.
		 */
		this.send({
			update: log,
			onComplete: function() {
				log.removeClass('ajax-loading');
				$$('.bandeau-09_2').setHTML('<a href="index.php?p=espace">&nbsp;Espace client</a>');
				//$$('.link2connect').setHTML('<a href="pages/logout.php" id="lienStyle" onclick="if(confirm(\'Si vous continuer vous aller perdre votre panier en cours\r\nContinuer ?\')) return true; else return false;">Deconnexion</a>');
				redirect('timer',5,'index.php','Accueil');
			}
		});
	});
});