function addEvent(obj, type, fn) {
	if( obj.attachEvent ) {
			obj["e"+type+fn] = fn;
			obj[type+fn] = function(){obj["e"+type+fn]( window.event );};
			obj.attachEvent( "on"+type, obj[type+fn] );
	} else {
			obj.addEventListener( type, fn, true );
	};
}

function initBoxes() {

	closeAllBoxes();
	/*Ajoute des gestionnaires d'évènements*/
	addEvent($('identification'),'click',function(){
		if(!$('boxconn').visible()){
			openIdentification();
		}else{
			closeIdentification();
		}
	});
}

function closeAllBoxes (){
	/*Ferme toutes les boites actives par defaut*/
	if($('boxconn').visible()){
		closeIdentification();
	}
}

function openIdentification(){
	$('identification').addClassName('hover');
	$('boxconn').show();
	$('nomuser').value = "";
	$('pwd').value = "";
	$('nomuser').focus();
}
function closeIdentification(){
	$('boxconn').hide();
	$('identification').removeClassName('hover');
}

addEvent(window, 'load', initBoxes);


