/* E3H - JavaScript Document */
var myTabs;
window.addEvent('domready', function(){
	Cufon.replace('#site #content #page .content h4');

	// SWIFF EXPRESS INSTALL
	Swiff.ExpressInstall = new Class({
		 Extends: Swiff,
			 options: {
			   expressInstall: '/swf/expressInstall.swf'
		   },
			 initialize: function(path, version, build, options){
			   if(Browser.Plugins.Flash.version >= version && Browser.Plugins.Flash.build >= build) this.parent(path, options);
			   else this.parent(this.options.expressInstall, $extend({vars: {
				   MMPlayerType: (Browser.Engine.trident) ? 'ActiveX' : 'PlugIn',
				   MMredirectURL: window.location,
				   MMdoctitle: document.title.slice(0, 47) + ' - Flash Player Installation'
			   }}, options));
		   }
	});
	
	// MENU PRINCIPAL
	if($('menu')) {
		$('menu').getElement('ul').getChildren().each(function(item, index){
			item.getElement('a').addEvents({
				mouseenter: function(event){
					this.get('tween', {property: 'opacity', duration: 'short'}).start(0.0001)
				},
				mouseleave: function(event){
					this.get('tween', {property: 'opacity', duration: 'long'}).start(1)
				}
			});
		});
	}
	// MENU BLOC
	if($('blocks')) {
		$('blocks').getElement('ul').getChildren().each(function(item, index){
			item.getElement('h3').getElement('a').addEvents({
				mouseenter: function(event){
					this.get('tween', {property: 'opacity', duration: 'short'}).start(0.0001)
				},
				mouseleave: function(event){
					this.get('tween', {property: 'opacity', duration: 'long'}).start(1)
				}
			});
		});
	}
	
	// TABS
	if(!Browser.Engine.trident4) {
		if($('buttons')) {
			myTabs = new SlidingTabs('buttons', 'panes');
			myTabs.changeTo(1);
			
			// this sets up the previous/next buttons, if you want them
			if($('precedent')) $('precedent').addEvent('click', myTabs.previous.bind(myTabs));
			if($('suivant')) $('suivant').addEvent('click', myTabs.next.bind(myTabs));
			
			// this sets it up to work even if it's width isn't a set amount of pixels
			window.addEvent('resize', myTabs.recalcWidths.bind(myTabs));
		}
	}
	
	$$('a.target-blank').addEvent('click', function(event){
		event.stop();
		window.open(this.get('href'));
	});
});