/*
jQuery Meerkat Plugin :: Version 1.0
Copyright (c) 2009 Jarod Taylor (http://www.jarodtaylor.com)
Licensed under the MIT (license.txt)
*/

function meerkat(options) {
	
	this.settings = {
		showMeerkatOnLoad: 'false',
		close: 'none',
		dontShow: 'none',
		dontShowExpire: 0,
		removeCookie: 'none',
		meerkatPosition: 'bottom',
		animation: 'slide',
		animationSpeed: 'slow',
		height: 'auto',
		background: 'none'
	}

	if(options){
		jQuery.extend(this.settings, options);
	}

	var settings = this.settings;

	//popup
	jQuery('#publicite a').click(function(){
		jQuery("#meerkat").hide();
		jQuery("#meerkat-wrap").hide();
		window.open(jQuery(this).attr('href'));
		return false;
	});
	//modif Ben (bouton fermer)
	$('a.enter-site').html('Fermer &nbsp; X');

	jQuery('html, body').css({'margin':'0', 'padding':'0', 'height':'100%'});
	jQuery('#meerkat').wrap('<div id="meerkat-wrap"><div id="meerkat-container">' + '</div></div>');

	jQuery('#meerkat-wrap').css({'position':'fixed', 'width':'100%', 'height': settings.height}).css(settings.meerkatPosition,"0");
	jQuery('#meerkat-container').css({'background': settings.background, 'height': settings.height});
	//Give the close and dontShow elements a cursor (there's no need to use a href)
	jQuery(settings.close+","+settings.dontShow).css({"cursor":"pointer"});
	
	
	if(jQuery.browser.msie && jQuery.browser.version <= 6){
		jQuery('#meerkat-bg').css("display", "none");	
	}
	
	if ( settings.animation == "fade" ){
		//jQuery('#meerkat-wrap').show();
		jQuery(settings.close).click(function(){
			jQuery("#meerkat-wrap").fadeOut(settings.animationSpeed);								
		});
		
		jQuery(settings.dontShow).click(function () {			
			jQuery("#meerkat-wrap").fadeOut();
		});
	}
}

