// ============================================================================// bbb// ============================================================================function bbb() {}// ============================================================================// bbb.multiPage// ============================================================================bbb.multiPage = function(type, controls, page, max, data){    // init vars    this.node  = document.getElementById(type + 'Wrapper');    this.honey = new resource.honey(this.node, 15);    this.ajax  = new resource.utils.ajax('ajax.' + type + '.php');    this.page  = page;    this.max   = max;    this.type  = type;    this.data  = data;    this.controls = controls;        // set up the pages    this.changePage();}// set up the pagesbbb.multiPage.prototype.changePage = function(){    // get the controls    var controls = resource.utils.getElementsByClassName(this.controls, this.node);        // loop through the controls, replacing important bits    for (var i = 0; i < controls.length; i ++)    {        // get the buttons        var buttons = controls[i].getElementsByTagName('li');        var array   = new Array('Prev', '', 'Next');                // loop thorough each button        for (var j = 0; j < buttons.length; j ++)        {            // get the data to override            if ((j == 2 && this.page < this.max) || (j == 0 && this.page > 1))            {                var page = j == 2 ? this.page + 1 : j == 0 ? this.page - 1 : 1;                var data = '<a href="#" title="' + array[j] + ' page" class="' + this.type + 'Control" onclick="' + this.type + '.setData(' + page + '); return false;">' + array[j] + '</a>';            }            else if (j == 1)                var data = 'Page ' + this.page + ' / ' + this.max;            else                var data = '<span>' + array[j] + '</span>';                        // change the buttons to do what I want            buttons[j].innerHTML = data;        }    }}// set up the inspirationsbbb.multiPage.prototype.setData = function(page){    // change the title    $('newsTitle').src = '/img/headings/loadingXML.gif';        // fade out the news and get the new news    this.honey.changeFade({initial:100, alter:-10, max:0, after:this.type + ".ajax.setData('page=" + page + "', '" + this.type + ".getData(" + page + ")');"});}// create a function to get the inspirations    bbb.multiPage.prototype.getData = function(page){    // make sure the xml is valid    if(this.ajax.requestObject.readyState != 4 || this.ajax.requestObject.status != 200)        return;        // init vars    var data = this.ajax.getData('data', this.data);        // change the page number    this.page = page;        // loop through and add the new data    resource.utils.template(document.getElementById(this.type + 'Template'), document.getElementById(this.type), data);        // change the page data    this.changePage();        // unhide the page    this.honey.changeFade({initial:0, alter:10, max:100, after: "$('newsTitle').src = '/img/headings/latestNews.gif'"});}
