/**
 * Path permet de gerer la navigation rapide
 *
 * format :
 * <X class="js_path">
 *	<Y class="js_content"></Y>
 * </X>
 *
 * Auteur : Pierre Tachoire
 * Date : 13/01/2009
 */

var Path = Class.create({

	/**
	 * constructeur
	 */
	initialize: function() {
		var allPath = $$('.js_path');

		for( var i=0; i<allPath.length; i++ ) {
			this.initPath( allPath[i] );
		}

	},

	initPath: function( path ) {

		var contents = path.select('.js_content');

		if( path && contents ) {

			path.contents = contents;
			path.controller = this;

			path.mask = function() {
				this.controller.hide( this.contents );
			}

			//je prepare les observateurs
			path.observe('mouseover', function(event) {
				this.controller.show( this.contents );
			});
			
			path.observe('mouseout', function(event) {
				this.controller.hide( this.contents );
			});

		}

	},

	hide: function( contents ) {
		if( contents ) {
			for( var i=0; i<contents.length; i++ ) {
				contents[i].hide();
			}
		}
	},

	show: function( contents ) {
		if( contents ) {
			for( var i=0; i<contents.length; i++ ) {
				contents[i].style.display = 'block';
			}
		}
	}

});