if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
	 var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
	 if(ieversion < 7) {
		alert('Veuillez effectuer une mise à jour de votre navigateur.\nCette version n\'est pas supportée par le site.'); 
	 }
}

function actualiserPanier(){
	//Permet d'actualiser le panier dans le header
	//A appele dans toute action de modification du panier
	if($('panier')){
		$('panier').load('panier_ajax');
	}
}

window.addEvent('domready', function() {
      $$('.divClickable').each(function(div){
            div.addEvent('click', function(){
                  liens = this.getElementsByTagName('a');
                  if (liens.length > 0) {
                        window.location = liens[0].href;
                  }
            });
      });
      $$('a.moodialog').each(function(link){
          link.addEvent('click', function(){
        	  new MooDialog.Iframe(link.href, {
        		  size: {
        		  	width: 800,
        		  	height: 600
        	  	  }
        	  });
        	  return false;
          });
      });
      /** ancienne version
       * vide les input quand elle ne sont pas focus sauf pour les password
       */
      $$('input').each(function(input){
    	if(!input.hasClass('no_focus')){
	  		if(input.getProperty('type') == 'text'){
	  			input.addEvent('focus', function(event){
	  				target = event.target;
	  				if(target.hasClass('password')){
	  					target.setStyle('display', 'none');
	  					password = target.getNext('input');
	  					password.setStyle('display', 'block');
	  					password.focus();
	  					password.setStyle('color', '#111111');
	  					password.addEvent('blur', function(){
	  						if(password.get('value').length <= 0){
	  							password.setStyle('display', 'none');
	  							target.setStyle('display', 'block');
	  						}
	  					});
	  				}else if(target.get('value') == target.get('rel')){
	  					target.set('value', '');
	  					target.setStyle('color', '#111111');
	  				}
	  			});
	  			input.addEvent('blur', function(event){
	  				target = event.target;
	  				if(target.get('value').length == 0){
	  					target.set('value', target.get('rel'));
	  					target.setStyle('color', '#B9B9B9');
	  				}
	  			});
	  		}
    	}
  	});      
      
      
      
	$$('.menuhover').addEvent('mouseenter', function(event){
		getid = this.get('id');
		getid = '.' + getid;
		$$(getid).setStyle('opacity', '0');
		$$(getid).setStyle('display', 'block');
		$$(getid).fade('in');
	});
	$$('.menuhover').addEvent('mouseleave', function(event){
		getid = this.get('id');
		getid = '.' + getid;
		$$(getid).setStyle('display', 'none');
	});	
     
	$$('.menuhoverstayalive').addEvent('mouseenter', function(event){
		this.setStyle('display', 'block');
		getclass = this.get('class');
		getclass = getclass.slice(0, -19);
		$(getclass).setStyle('background-position', 'bottom center');
	});
	$$('.menuhoverstayalive').addEvent('mouseleave', function(event){
		this.setStyle('display', 'none');
		$(getclass).setStyle('background-position', 'top center');
	});
      
	$$('.menuhover').addEvent('mouseenter', function(event){
		this.setStyle('background-position', 'bottom center');
	});
	$$('.menuhover').addEvent('mouseleave', function(event){
		this.setStyle('background-position', 'top center');
	});	
      
});

