<?php

if ( ! @include_once( './mainfile.php' ) ) { exit( '!! INCLUDE ERROR. ACCESS DENIED !!' ); }
error_reporting( _E_VALUE );


/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | myPHPNuke Version 188_8 RC2                                          |
// +----------------------------------------------------------------------+
// | License: GNU/GPL - http://www.gnu.org/copyleft/gpl.html              |
// +----------------------------------------------------------------------+
// | Support: http://myphpnuke.com/                                       |
// +----------------------------------------------------------------------+
// | Author: myPHPNuke Dev Team                                           |
// +----------------------------------------------------------------------+
// | Copyright: © 2001-2004 myPHPNuke Dev Team                            |
// +----------------------------------------------------------------------+
// $Id: classes.php,v 1.3.2.2 2004/04/18 12:47:18 ajvwaay Exp $



/*
 * Author: Guillermo Roditi {Kaoslord}
 *  kaoslord@chaos-productions.com
 *  http://chaos-productions.com
 * License: GPL
 * Description:
 *  Alternating, a class to facilitate the alternating
 *  of values, especially good for sites with many
 *  tables that have alternating colors, the advantage
 *  of this over a function is that you can have many
 *  alternators simultaneously.
 */
class alternator
{
    /*Internal Variables*/
    var $pool;             /* value pool to pick values out of*/
    var $current_value;    /*The last value picked*/
    var $array_size;       /*The ammount of items in the array*/

    /*Functions*/

    function alternator($in_poll = null)
    {
        if ($in_poll)
        {
            $this->init($in_poll);
        }
    }


    /*init() initiates the class*/
    function init($in_pool)
    {
        $this->pool = $in_pool;
        reset($this->pool);
        $this->array_size = count($this->pool);
    }


    function get_value()
    {
        $this->current_value = current($this->pool);
        if (!next($this->pool))
        {
            reset($this->pool);
        }

        return($this->current_value);
    }
}

?>
