
//########################################################
var modules_people_testimonials_class_y9fxnpiy3fhr0s = new Class({
    
    //########################################################
    initialize: function() {
	    this.currId = '';
	    this.showStr = '';
	    this.quoteField = '';
    },

    //########################################################
    getPrevQuoteHtml: function(updateBlock, isRandom) {
	    return this.getQuoteHtml(true, updateBlock, isRandom);
	},

    //########################################################
    getNextQuoteHtml: function(updateBlock, isRandom) {
	    return this.getQuoteHtml(false, updateBlock, isRandom);
	},

    //########################################################
    getQuoteHtml: function(isReverse, updateBlock, isRandom, doClearInterval) {
	    var thisObj = this;

	    if ((doClearInterval==null || doClearInterval) && this.autoInterval) window.clearInterval(this.autoInterval);

	    var url = "http://www.dukeaiona.com/modules/people/testimonials/rotator_quote.php?pi=y9fxnpiy3fhr0s&show=" + escape(this.showStr) + '&quoteField=' + escape(this.quoteField);
	    var contentReq = new Request.HTML({ url: url, update: updateBlock, evalScripts: true, useAssets: true });
	    contentReq.addEvent('complete', function() { 
	    });
	    contentReq.addEvent('success', function(tree, els) { 
                updateBlock.fade("in"); 

		var currWrap = updateBlock.getFirst();
		if (currWrap) thisObj.currId = currWrap.getProperty("id");
            });
	    
	    contentReq.get({ curr: escape(this.currId), prev: (isReverse ? "1" : ""), rand: (isRandom ? "1" : "") });
            updateBlock.fade("hide"); 
	},

    //########################################################
    setAuto: function(delay, updateBlock) {
	    if (this.autoInterval) window.clearInterval(this.autoInterval);

	    var thisObj = this;
	    var call = function() { thisObj.getQuoteHtml(false, updateBlock, false, false); };
	    if (delay < 7) delay = 7;
	    this.autoInterval = window.setInterval(call, (delay*1000));
    },

    //########################################################
    setShow: function(str) {
	    this.showStr = str;
    },

    //########################################################
    setQuoteField: function(str) {
	    this.quoteField = str;
    },

    //########################################################
    dummy: function() { }
});

var modules_people_testimonials_y9fxnpiy3fhr0s = new modules_people_testimonials_class_y9fxnpiy3fhr0s();
