rotator.col = [];

function rotator(name, speed, path, tgt) {
    this.name = name;
    this.speed = speed || 4500;
    this.path = path || "";
    this.ctr = 0;
    this.timer = 0;
    this.imgs = [];
    this.index = rotator.col.length;
    rotator.col[this.index] = this;
    this.animString = "rotator.col[" + this.index + "]";
};

rotator.prototype.addImages = function() {
    var img;
    for (var i = 0; arguments[i]; i++) {
        img = new Image();
        img.src = this.path + arguments[i];
        this.imgs[this.imgs.length] = img;
    }
};

rotator.prototype.rotate = function() {
    clearTimeout(this.timer);
    this.timer = null;
    if (this.ctr < this.imgs.length - 1)
        this.ctr++;
    else this.ctr = 0;
    var imgObj = document.images[this.name];
    if (imgObj) {
        imgObj.src = this.imgs[this.ctr].src;
        this.timer = setTimeout(this.animString + ".rotate()", this.speed);
    }
};

rotator.start = function() {
    var len = rotator.col.length, obj;
    for (var i = 0; i < len; i++) {
        obj = rotator.col[i];
        if (obj && obj.name)
            obj.timer = setTimeout(obj.animString + ".rotate()", obj.speed);
    }
};

var rotator1 = new rotator('img1', 4000, '/images/Home/');
rotator1.addImages("gigatronics-logo.png", "aeroflex_logo.gif", "agilent_logo.gif", "micrel_logo-tagline_lowres1_200x150.gif", "LXinstruments_200x150.gif", "vti_inst_logo.gif", "rohde_logo.gif", "keithley_logo.gif", "pickering_logo.gif", "ametek_logo.gif", "TTi-Logo-LXI.gif", "eads_logo.gif", "bruel_and_kjaer_logo.gif", "adlink_logo.gif", "ch_logo.gif", "cni_logo.gif", "goepel_electronic_logo.gif", "lambda_logo.gif", "pacific_logo.gif", "pacific_mindworks_lgo.gif", "phase_matrix_logo.gif", "teradyne_logo.gif", "mathworks_logo.gif", "us_logo.gif", "ztec_logo.gif", "amrel_logo.gif", "data_translation_logo.gif", "kepco_logo.gif", "shaanxi_logo.gif", "symtx_logo.gif", "yokogawa_logo.gif", "rigol.gif", "picotest_logo.jpg");
rotator.start();

