var mainPath = '';
if(window.location.host == '442.loc')
{
	mainPath = '';
}else{
	mainPath = 'fileadmin/templates/';
}

var flashed = false;

/* via @appden, Scott Kyle, http://appden.com/javascript/fun-with-custom-events-on-elements-in-mootools/ */
Native.implement([Element, Window, Document, Events], {
	oneEvent: function(type, fn) {
		return this.addEvent(type, function() {
			this.removeEvent(type, arguments.callee);
			return fn.apply(this, arguments);
		});
	}
});


window.addEvent('domready', function()
{
	if(Browser.Plugins.Flash.version > 7)
	{
		flashed = true;
		$('container').addClass('flashed');
	}
	if($('photosAccueil'))
	{
		if(flashed && Browser.Engine.name != 'safari')
		{
/*			$('photosAccueil').set('html','');
			var photos = new Swiff(mainPath+"flash/diaporama.swf", { id: 'photos', width:'100%', height: 1050, params: { 'wmode': 'transparent','AllowScriptAccess':'always' }, vars: { xmlFile:"index.php?id=41" } });
			photos.inject('photosAccueil');
*/
		}
	}
	$$('.selector').each(function(el,index){
		var selectors = new myULSelects({sel:el});
	});
	$$('.table-c table').each(function(table, ind){
		var sortIndex = 0;
		table.getElements('th').each(function(el,index){
			if(el.hasClass('default')){
				sortIndex = index;
			}
		});
		//alert('table to sort : ' + table);
		//var sortIt = new sortableTable(table, {overCls: 'over', sortOn:sortIndex, onClick: function(){alert(this.id)}});	
	});
	
	if(typeof(bureau) == 'object') 
	{
		bureau.init();
	}
	
	$$('input[type=text]','input[type=password]','textarea').each(function(el){
		el.addEvents({
			'focus':function(){
				this.addClass('focus');
			}
			,'blur':function(){
				this.removeClass('focus');
			}
		})
	});
	//contentTransition.hide();
});


