/*********************************************************************************************/
/* BlakeMedia Library
/* "Stacker" plugin
/*
/* DESC:    	Stacking notifications.
/* AUTHOR:		Jared Williams (BlakeMedia)
/* VERSION:		1.0
/* CREATED: 	24 October 2012
/* MODIFIED:	02 May 2013
/*
/* (c) Copyright 2002-2012 BlakeMedia & MediaIQ Group PLC
/*********************************************************************************************/
var stacker=function(g){var l=this;this.instantiated=false;var a=new Array(),c=new Array(),h=new Array(),b=0;_MaxStack=6,_Style=null,_StyleBefore=null,_StyleActive=null,_StyleAfter=null,_DurationIn=500,_DurationActive=2000,_DurationOut=1000,_Easing=null,_Autoload=true;function k(){e();if(_Autoload){f()}}function e(){if("max" in g){_MaxStack=g.max}if("global" in g){_Style=g.global}if("before" in g){_StyleBefore=g.before}if("active" in g){_StyleActive=g.active}if("after" in g){_StyleAfter=g.after}if("intime" in g){_DurationIn=g.intime}if("activetime" in g){_DurationActive=g.activetime}if("outtime" in g){_DurationOut=g.outtime}if("easing" in g){_Easing=g.easing}if("autoload" in g){_Autoload=g.autoload}bm.logConsole("Variables passed and filled",LOG_SYSTEM,l)}this.about=function(){return{name:"Stacker",shortname:"stacker",description:"Stacking notifications.",version:"1.0",library:"2.0",author:"Jared Williams (BlakeMedia)",datecreated:"24 Oct 2012",datemodified:"02 May 2013"}};function f(){}function i(m){c[c.length]=m}function d(m){var n=$(document.createElement("div"));n.append('<div class="content"><div class="title">'+m.title+'</div><div class="message">'+m.message+"</div></div>");if(typeof _Style=="object"){n.css(_Style)}else{if(typeof _Style=="string"){n.addClass(_Style)}else{n.css({width:300,height:100,position:"fixed",top:10,background:"#FFF"})}}return n}function j(n,q,m){var p=h[n];if(!q){q=0}var o=b;setTimeout(function(){},q);if(p){p.delay(q).animate({right:200,opacity:0},_DurationOut,_Easing,function(){h[n]=null;if(o>=n){b=0;h=new Array()}p.remove()});if(typeof m=="function"){m()}}}this.pushMessage=function(p,o,m){var s={title:p,message:o};i(s);var r=d(s);$("body").append(r);var n=h.length;h[n]=r;if(typeof _StyleBefore=="object"){r.css(_StyleBefore)}else{if(typeof _StyleBefore=="string"){r.addClass(_StyleBefore)}else{r.css({right:-200})}}if(b>1){r.css({top:((b*100)+10)})}else{if(b==1){r.css({top:110})}}r.animate({right:10,opacity:1},_DurationIn,_Easing);var q=function(){if(b>=_MaxStack){}};j(b,_DurationActive,q);if(b>=_MaxStack){b=0;h=new Array()}else{b=b+1}bm.logConsole("Pushed message onto stack",LOG_NOTICE,l);if(typeof m=="function"){m()}};this.push=function(o,n,m){l.pushMessage(o,n,m)};k()};