jQuery.fn.extend({meerkat:function(c){var f={background:"none",opacity:null,height:"auto",width:"100%",position:"bottom",close:".close",dontShowAgain:"#dont-show",animationIn:"none",animationOut:null,easingIn:"swing",easingOut:"swing",animationSpeed:"normal",cookieExpires:0,removeCookie:".removeCookie",delay:0,onMeerkatShow:function(){},onMeerkatClose:function(){},timer:null};var d=jQuery.extend(f,c);if(jQuery.easing.def){d.easingIn=d.easingIn;d.easingOut=d.easingOut}else{d.easingIn="swing";d.easingOut="swing"}if(d.animationOut===null){d.animationOut=d.animationIn}d.delay=d.delay*1000;if(d.timer!=null){d.timer=d.timer*1000}function b(i,j,k){if(k){var h=new Date();h.setTime(h.getTime()+(k*24*60*60*1000));var g="; expires="+h.toGMTString()}else{var g=""}document.cookie=i+"="+j+g+"; path=/"}function e(h){var k=h+"=";var g=document.cookie.split(";");for(var j=0;j<g.length;j++){var l=g[j];while(l.charAt(0)===" "){l=l.substring(1,l.length)}if(l.indexOf(k)===0){return l.substring(k.length,l.length)}}return null}function a(g){b(g,"",-1)}jQuery(d.removeCookie).click(function(){a("meerkat")});return this.each(function(){var h=jQuery(this);if(e("meerkat")!="dontshow"){d.onMeerkatShow.call(this);function i(l,k){var o=jQuery("#meerkat-wrap");if(k==="slide"){if(d.position==="left"||d.position==="right"){var n="width"}else{var n="height"}}else{var n="opacity"}var m={};m[n]=l;if(l==="show"){if(k!=="none"){if(d.delay>0){jQuery(o).hide().delay(d.delay).animate(m,d.animationSpeed,d.easingIn)}else{jQuery(o).hide().animate(m,d.animationSpeed,d.easingIn)}}else{if((k==="none")&&(d.delay>0)){jQuery(o).hide().delay(d.delay).show(0)}else{jQuery(o).show()}}jQuery(h).show(0)}if(l==="hide"){if(k!=="none"){if(d.timer!==null){jQuery(o).delay(d.timer).animate(m,d.animationSpeed,d.easingOut,function(){jQuery(this).destroyMeerkat()})}jQuery(d.close).click(function(){d.onMeerkatClose.call(this);jQuery(o).stop().animate(m,d.animationSpeed,d.easingOut,function(){jQuery(this).destroyMeerkat()});return false});jQuery(d.dontShowAgain).click(function(){d.onMeerkatClose.call(this);jQuery(o).stop().animate(m,d.animationSpeed,d.easingOut,function(){jQuery(this).destroyMeerkat()});b("meerkat","dontshow",d.cookieExpires);return false})}else{if((k==="none")&&(d.timer!==null)){jQuery(o).delay(d.timer).hide(0).queue(function(){jQuery(this).destroyMeerkat()})}else{jQuery(d.close).click(function(){d.onMeerkatClose.call(this);jQuery(o).hide().queue(function(){jQuery(this).destroyMeerkat()});return false});jQuery(d.dontShowAgain).click(function(){d.onMeerkatClose.call(this);jQuery(o).hide().queue(function(){jQuery(this).destroyMeerkat()});b("meerkat","dontshow",d.cookieExpires);return false})}}}}jQuery("html, body").css({margin:"0",height:"100%"});jQuery(h).wrap('<div id="meerkat-wrap"><div id="meerkat-container"></div></div>');jQuery("#meerkat-wrap").css({position:"fixed","z-index":"10000",width:d.width,height:d.height}).css(d.position,"0");jQuery("#meerkat-container").css({background:d.background,height:d.height});if(d.position==="left"||d.position==="right"){jQuery("#meerkat-wrap").css("top",0)}if(d.opacity!=null){jQuery("#meerkat-wrap").prepend('<div class="opacity-layer"></div>');jQuery("#meerkat-container").css({background:"transparent","z-index":"2",position:"relative"});jQuery(".opacity-layer").css({position:"absolute",top:"0",height:"100%",width:"100%",background:d.background,opacity:d.opacity})}if(jQuery.browser.msie&&jQuery.browser.version<=6){jQuery("#meerkat-wrap").css({position:"absolute",bottom:"-1px","z-index":"0"});if(jQuery("#ie6-content-container").length==0){jQuery("body").children().filter(function(k){return jQuery(this).attr("id")!="meerkat-wrap"}).wrapAll('<div id="ie6-content-container"></div>');jQuery("html, body").css({height:"100%",width:"100%",overflow:"hidden"});jQuery("#ie6-content-container").css({overflow:"auto",width:"100%",height:"100%",position:"absolute"});var j=document.body.currentStyle.backgroundColor+" ";j+=document.body.currentStyle.backgroundImage+" ";j+=document.body.currentStyle.backgroundRepeat+" ";j+=document.body.currentStyle.backgroundAttachment+" ";j+=document.body.currentStyle.backgroundPositionX+" ";j+=document.body.currentStyle.backgroundPositionY;jQuery("body").css({background:"none"});jQuery("#ie6-content-container").css({background:j})}var g=document.getElementById("ie6-content-container");if((g.clientHeight<g.scrollHeight)&&(d.position!="left")){jQuery("#meerkat-wrap").css({right:"17px"})}}switch(d.animationIn){case"slide":i("show","slide");break;case"fade":i("show","fade");break;case"none":i("show","none");break;default:alert('The animationIn option only accepts "slide", "fade", or "none"')}switch(d.animationOut){case"slide":i("hide","slide");break;case"fade":i("hide","fade");break;case"none":if(d.timer!=null){jQuery("#meerkat-wrap").delay(d.timer).hide(0).queue(function(){jQuery(this).destroyMeerkat()})}jQuery(d.close).click(function(){d.onMeerkatClose.call(this);jQuery("#meerkat-wrap").hide().queue(function(){jQuery(this).destroyMeerkat()})});jQuery(d.dontShowAgain).click(function(){d.onMeerkatClose.call(this);jQuery("#meerkat-wrap").hide().queue(function(){jQuery(this).destroyMeerkat()});b("meerkat","dontshow",d.cookieExpires)});break;default:alert('The animationOut option only accepts "slide", "fade", or "none"')}}else{jQuery(h).hide()}})},destroyMeerkat:function(){jQuery("#meerkat-wrap").replaceWith(jQuery("#meerkat-container").contents().hide())}});
