﻿    var stat_index = 0;
    stat_list = new Array();
    stat_list[stat_index++] = new imageItem("images/left-text-content1.gif");
    stat_list[stat_index++] = new imageItem("images/left-text-content2.gif");
    stat_list[stat_index++] = new imageItem("images/left-text-content3.gif");
    stat_list[stat_index++] = new imageItem("images/left-text-content4.gif");
        
    var number_of_stats = stat_list.length;
    
    var emp_index = 0;
    emp_list = new Array();
    emp_list[emp_index++] = new imageItem("images/right-text-content1.gif");
    emp_list[emp_index++] = new imageItem("images/right-text-content2.gif");
    emp_list[emp_index++] = new imageItem("images/right-text-content3.gif");
    emp_list[emp_index++] = new imageItem("images/right-text-content4.gif");
    emp_list[emp_index++] = new imageItem("images/right-text-content5.gif");
    
    var number_of_emps = emp_list.length;
    
    function imageItem(image_location) 
    {
        this.image_item = new Image();
        this.image_item.src = image_location;
    }

    function get_ImageItemLocation(imageObj) 
    {
        return(imageObj.image_item.src);
    }

    function generate(x, y) 
    {
        var range = y - x + 1;
        return Math.floor(Math.random() * range) + x;
    }

    function getNextImage(place) 
    {
        if (place == "stat")
        {
            stat_index = (stat_index+1) % number_of_stats;
         
            var new_image = get_ImageItemLocation(stat_list[stat_index]);
        }
        
        else  // place == employer
        {
            emp_index = (emp_index + 1) % number_of_emps;
            
            var new_image = get_ImageItemLocation(emp_list[emp_index]);
        }
        
        return(new_image);
    }
        
    function rotateImage(place) 
    {
        var new_image = getNextImage(place);
        document[place].src = new_image;
    }
        