	var navigation = function(id,target){
		this.menuContainer = typeof id == 'string' ? document.getElementById(id) : id ;
		this.targetContainer = typeof target == 'string' ? document.getElementById(target) : target ;
		this.ul = this.menuContainer.getElementsByTagName('ul');
		this.li = this.menuContainer.getElementsByTagName('li');
		this.a = this.menuContainer.getElementsByTagName('a');
		this.menuObject = {};
		this.slideObject = {};
		this.getURL();
		this.setHrefObject();
	};
	navigation.prototype.getURL = function(){
		this.url = window.location.toString();
		this.urlArray = this.url.replace(/[^0-9,]/g,'').split(',');
		//alert(this.urlArray);
	};
	navigation.prototype.setHrefObject = function(){
		var _this = this;
		for(var i=0;i<this.a.length; i++){
			this.a[i].onclick = function(){ return false; }
			var 	href 		= this.a[i].href.toString(),
				rel 		= href.replace(/\?a=/g,'#'),
				hrefArray 	= href.replace(/[^0-9,]/g,'').split(','),
				currentKey 	= hrefArray[hrefArray.length-1],
				label 	= this.a[i].innerHTML,
				type 		= this.a[i].rel.split('|');
			this.menuObject[label] = [{
				'currentKey' : currentKey,
				'currentUrl' : hrefArray.toString(),
				'currentRel' : rel,
				'contentType' : type[0],
				'hasContent' : type[1]
			}];
			if(this.a[i].className == 'level1' 
			&& this.a[i].parentNode.nextSibling
			&& this.a[i].parentNode.nextSibling.tagName == 'UL'){
				this.slideObject[label] = new Fx.Slide(this.a[i].parentNode.nextSibling,{duration:400,transition: Fx.Transitions.Quart.easeOut});
				this.slideObject[label].hide();
				this.a[i].addEvent('click', function(e){
					e.stop();
					_this.current = this;
					if(_this.opened){
						_this.slideObject[_this.opened].toggle();
						_this.opened = null;
					}
					_this.slideObject[this.innerHTML].toggle();
					if(!_this.slideObject[this.innerHTML].open)_this.opened = this.innerHTML;
				});
				this.slideObject[label].addEvent('complete',function(){
					_this.getValue(_this.current);
				})
			}else{
				this.a[i].onmousedown = function(){
					_this.current = this;
					if(_this.opened && this.className!="level2"){
						_this.slideObject[_this.opened].toggle();
						_this.opened = null;
					}else{
						_this.getValue(this); 
					}
				}
			}
		}
	};
	navigation.prototype.getValue = function(current){
		if(current.parentNode.parentNode.className.match(/select/)) return false;
		window.location = '#'+this.menuObject[current.innerHTML][0]['currentUrl'];
		this.setCss(current);
		var 	_this = this,
			fx2 = new Fx.Tween($(this.targetContainer),{duration:200}),
			type = _this.menuObject[current.innerHTML][0]['contentType'];;
		XMLHttp.get(
			'xhr.getdata.php',
			'?id='+this.menuObject[current.innerHTML][0]['currentKey'],
			function(){
				_this.targetContainer.set('opacity','0');
			},
			function(){
				fx2.start('opacity','0','1');
				_this.targetContainer.innerHTML = XMLHttp.responseText;
				switch(type){
					case "1":
					break;
					case "2":
					break;
					case "3":
						new _this.multiGal();
					break;
					case "4":
					break;
					case "5":
						if(document.getElementById('sound_gallery')) new _this.soundGal();
						if(document.getElementById('clip_container')) new setClipPlayer();
					break;
					case "5":
					break;
					case "6":
					break;
					case "7":
					break;
				}
			}
		)
	};
	navigation.prototype.setCss = function(current){
		for(var i=0;i<this.a.length; i++)
			this.a[i].parentNode.parentNode.className = '';
		current.parentNode.parentNode.className =  'select';
	};
	navigation.prototype.soundGal = function(){
		var _this = this;
		this.playerSlideOb = {};
		this.outerContainer = document.getElementById('sound_gallery');
		this.href = this.outerContainer.getElementsByTagName('a');
		for(var i=0;i<this.href.length;i++){
			this.href[i].onclick = function(){ return false; };
		}
		var accordion = new Accordion('a.open_player','div.player_container',{
			transition: Fx.Transitions.Quart.easeOut,
			duration: 400,
			opacity : false,
			display : null,
			alwaysHide : true,
			'onActive' : function(){
				if(_this.currentElement)
					_this.currentElement.innerHTML = '&nbsp;';
			},
			'onComplete' : function(){
				_this.currentElement = null;
				if(document.getElementById('dynplayer')){
					var playerContainer = document.getElementById('dynplayer').parentNode;
					document.getElementById('dynplayer').sendEvent('STOP');
					playerContainer.removeChild(document.getElementById('dynplayer'));
					playerContainer.innerHTML = '&nbsp;';
					document.getElementById('staticplayer').sendEvent('VOLUME',100);
				}
				for(var i=0; i<this.elements.length; i++){
					if(this.elements[i].offsetHeight>0) _this.currentElement = this.elements[i];
				}
				if(_this.currentElement){
					_this.setPlayer(_this.currentElement,_this.currentElement.getAttribute('rel'));
					document.getElementById('staticplayer').sendEvent('VOLUME',0);
					_this.setCss(_this.currentElement.parentNode.getElementsByTagName('a')[0]);
				}else{
					_this.setCss();
				}
			}
		},$('accordion'));
		this.setCss = function(current){
			for(var i=0;i<this.href.length; i++) this.href[i].className = this.href[i].className.replace(/selected/g,'');
			if(current) current.className = current.className+" selected";
		};
		this.setPlayer = function(element,file){
			_this.s1 = new SWFObject('__flvplayer/player.swf','dynplayer','100%','20','9','#ffffff');
			_this.s1.addParam('allowfullscreen','false');
			_this.s1.addParam('allowscriptaccess','always');
			_this.s1.addParam('wmode','opaque');
			_this.s1.addParam('flashvars','file='+file+'&autostart=true');
			_this.s1.write(element);
		};
	};
	
	navigation.prototype.multiGal = function(){
		if(document.getElementById('portfolio'))
			new portfolio();
	};
	
	var iegal = function(){
		var _this = this;
		this.playerSlideOb = {};
		if(!document.getElementById('sound_gallery')) return false;
		this.outerContainer = document.getElementById('sound_gallery');
		this.href = this.outerContainer.getElementsByTagName('a');
		for(var i=0;i<this.href.length;i++){
			this.href[i].onclick = function(){ return false; };
		}
		var accordion = new Accordion('a.open_player','div.player_container',{
			transition: Fx.Transitions.Quart.easeOut,
			duration: 400,
			opacity : false,
			alwaysHide : true,
			display : null,
			'onActive' : function(){
				if(_this.currentElement)
					_this.currentElement.innerHTML = '&nbsp;';
			},
			'onComplete' : function(){
				_this.currentElement = null;
				try{
				if(document.getElementById('dynplayer')){
					var playerContainer = document.getElementById('dynplayer').parentNode;
					document.getElementById('dynplayer').sendEvent('VOLUME',0);
					document.getElementById('dynplayer').sendEvent('STOP');
					playerContainer.removeChild(document.getElementById('dynplayer'));
					playerContainer.innerHTML = '&nbsp;';
					if(!mootool.ie) document.getElementById('staticplayer').sendEvent('VOLUME',100);
				}
				for(var i=0; i<this.elements.length; i++){
					if(this.elements[i].offsetHeight>0) _this.currentElement = this.elements[i];
				} 
				if(_this.currentElement){
					_this.setPlayer(_this.currentElement,_this.currentElement.getAttribute('rel'));
					if(!mootool.ie) document.getElementById('staticplayer').sendEvent('VOLUME',0);
					_this.setCss(_this.currentElement.parentNode.getElementsByTagName('a')[0]);
				}else{
					_this.setCss();
				}
				}catch(e){}
			}
		},$('accordion'));
		this.setCss = function(current){
			for(var i=0;i<this.href.length; i++) this.href[i].className = this.href[i].className.replace(/selected/g,'');
			if(current) current.className = current.className+" selected";
		};
		this.setPlayer = function(element,file){
			element.innerHTML = 
				'<div style="font:11px arial;text-align:center;color:#E05E25;">'+
				'<b>FlashPlayer</b> is required to play this track. '+
				'<a style="color:#E05E25;text-decoration:underline;font-weight:bold;" href="http://www.adobe.com/fr/products/flashplayer/">Get it now!</a>'+
				'</div>'; 
			_this.s1 = new SWFObject('__flvplayer/player.swf','dynplayer','100%','20','9','#ffffff');
			_this.s1.addParam('allowfullscreen','false');
			_this.s1.addParam('allowscriptaccess','always');
			_this.s1.addParam('wmode','opaque');
			_this.s1.addParam('flashvars','file='+file+'&autostart=true');
			_this.s1.write(element);
		};
	};
	
	var portfolio = function(){
		var accordion = new Accordion('a.portfolio_toggle','div.item_container',{
			transition: Fx.Transitions.Quart.easeOut,
			duration: 400,
			alwaysHide : true,
			display: null,
		},$('accordion'));
		var h2 = document.getElementById('portfolio').getElementsByTagName('h2');
		for(var i=0; i<h2.length; i++){
			h2[i].childNodes[0].onmousedown = function(){
				if(this.style.color){
					this.style.color = '';
				}else{
					for(var i=0; i<h2.length; i++) h2[i].childNodes[0].style.color = '';
					this.style.color = '#009DE0';
				}
			}
		}
	};
	
	var setClipPlayer = function(){
		var _this = this, l = window.location.toString();
		this.path = l.substring(0,l.lastIndexOf('/')+1);
		this.container = document.getElementById('clip_container');
		this.href = this.container.getElementsByTagName('a');
		for(var i=0;i<this.href.length;i++){
			this.href[i].onmouseup = function(){
				_this.createBG();
				_this.createPlayerContainer(this.getAttribute('rel'));
			}
		}
	};
	setClipPlayer.prototype.createPlayerContainer = function(file){
		var _this = this;
		this.plContainer = new Element('div',{
			'styles' : {
				'position' : 'fixed',
				'width' : '320px',
				'height' : '240px',
				'top' : '50%',
				'left' : '50%',
				'margin-top' : '-120px',
				'margin-left' : '-160px',
				'background-color' : '#000'
			}
		});
		document.body.appendChild(this.plContainer);
		this.insertPlayer(this.path+file);
	};
	setClipPlayer.prototype.createBG = function(){
		var _this = this;
		this.BG = new Element('div',{
			'styles' : {
				'position' : 'fixed',
				'top' : 0,
				'left' : 0,
				'bottom' : 0,
				'right' : 0,
				'background-color' : '#000',
				'opacity' : 0.8
			}
		});
		this.BG.onmouseup = function(){ _this.removePlayer(); };
		document.body.appendChild(this.BG);
	};
	setClipPlayer.prototype.removePlayer = function(){
		document.body.removeChild(this.BG);
		document.body.removeChild(this.plContainer);
	};
	setClipPlayer.prototype.insertPlayer = function(file){
		var s1 = new SWFObject('__flvplayer/player.swf','dynplayer','320','240','9','#ffffff');
		s1.addParam('allowfullscreen','false');
		s1.addParam('allowscriptaccess','always');
		s1.addParam('wmode','transparent');
		s1.addParam('flashvars','file='+file+'&autostart=true&controlbar=over');
		s1.write(this.plContainer);
	};
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	