var MooTip = new Class({
	subject: false,
	orientation: 'left',
	offset:  { x: 0, y: 0 },

	initialize: function(subject, settings){
		if(settings.offset){ this.offset = settings.offset; }
		if(settings.orientation){ this.orientation = settings.orientation; }

		if(subject){ 
			this.subject = subject;
		} else {
			return false; 
		}

		this.start();
	},

	start: function(){
		var mTips = this.subject;

		var self = this;
		var toolTips = new Tips(mTips, {
				className: 'mooTip ' + this.orientation, 
				fixed: 'true', 
				showDelay: 500, hideDelay: 500,
				offset: self.offset,  /* 1.2.5 */
				offsets: self.offset, /* 1.2.1 - legacy */

				text: function(el){
					var content = el.getChildren('.description');
					return content[0].get('html');
				},

				onShow: function(toolTipElement){
						toolTipElement.fade('in');
				},

				onHide: function(toolTipElement){
						toolTipElement.fade('out');
				}
		});
	}
});

var SiteFLIR = {
	start: function(){
		FLIR.init( { path: webroot + '/js/common/libraries/facelift/' } );

		FLIR.replace( 'h3', new FLIRStyle({ cFont:'cocon_bold_condensed', mode:'fancyfonts', ff_Wrap:true }) );
		FLIR.replace( 'div#content h4', new FLIRStyle({ cFont:'cocon_regular', mode:'fancyfonts', ff_Wrap:true }) );

		FLIR.replace( '*.flir-standard', new FLIRStyle({ cFont:'cocon_regular', mode:'fancyfonts', ff_Wrap:true }) );
		FLIR.replace( '*.flir-slim', new FLIRStyle({ cFont:'cocon_light', mode:'fancyfonts', ff_Wrap:true }) );
		FLIR.replace( '*.quote', new FLIRStyle({ cFont:'cocon_regular', mode:'fancyfonts', ff_Wrap:true }) );
	}
}

var Site = {
	start: function(){
		SiteFLIR.start();
		if(typeof(Tips) !== 'undefined'){ 
			var naviTips = new MooTip($$('#navi li.lion'), { offset: { x: 200, y: -100 } });
		}
	}
}

window.addEvent('domready', Site.start);

