bt_soins_selectionne = null;

// loading utilisé sur chaque page
function loading_accueil_soins()
{
	//preload_BT_accueil_soins
	$$(".bt_accueil_soins").each(function(image){
		new BT_accueil_soins(image)
	});
	
	if($('img_general')){
		$('img_bloc_h').innerHTML = $('img_general').innerHTML
	}
}

Event.observe(window,"load",loading_accueil_soins,false)

BT_accueil_soins = Class.create();
BT_accueil_soins.prototype = {
	   initialize: function(img) {
			this.image = img;
			this.source = this.image.src;
			this.url = this.source.substring(0,this.source.lastIndexOf('.'));
			this.format = this.source.substring(this.source.lastIndexOf('.'),this.source.length);
			this.source_on = this.url+"_on"+this.format;
			//assigning our method to the event
			this.image.onmouseover = this.change_on.bindAsEventListener(this);
			this.image.onmouseout = this.change_off.bindAsEventListener(this);
			this.image.onclick = this.maj_contenu.bindAsEventListener(this);
			this.rollover_actif = true;
			this.id_base = this.image.id.substring(3,this.image.id.length);
			
			if(this.id_base == "menu_1"){
				this.maj_contenu()
			}
	   },
	   change_on: function(evt) {
		 if(this.rollover_actif) this.set_src_on();
	   },
	   change_off: function(evt) {
		 if(this.rollover_actif) this.set_src_off();
	   },
	   maj_contenu: function(evt) {
		 
		 if(bt_soins_selectionne != null)
		 {
			 bt_soins_selectionne.set_src_off()
			 bt_soins_selectionne.set_rollover_actif(true);
		 }
		 
		 bt_soins_selectionne = this;
		 
		 this.set_rollover_actif(false);
		 this.set_src_on();
		 
		 $('encart_SB_D').innerHTML = $('c_'+this.id_base).innerHTML
		 if($('img_'+this.id_base) != null)
		 {
			 $('img_bloc_h').innerHTML = $('img_'+this.id_base).innerHTML
		 }
		 return false;
	   },
	   set_rollover_actif: function(bool) {
		 this.rollover_actif = bool;
	   },
	   set_src_off: function() {
		 this.image.src = this.source;
	   },
	   set_src_on: function() {
		 this.image.src = this.source_on;
	   }

	};
