
    /* 
        Created by The Rich M. Project 
        code started:   06/29/2003
        code updated:   06/19/2008
        image updated:  see below
    */


    // added weighted javascript taken from here:
    // http://javascriptkit.com/javatutors/weighrandom2.shtml

    // start of code 
    var imagecountarray=["1","2","3","4","5","6"] // count
    var imageweightarray=[1, 1, 1, 1, 1, 1] // weight of each element above


    // Define Arrays
    photo = new Array;
    links = new Array;
    descs = new Array;
    mywidth = new Array;
    myheight = new Array;

   // Define the Photo, link, and Desctiption width and height for each photo.
   // Images must be placed in the folder: ./images/
   
    var mynumber = 1;
    photo[mynumber] = "mn_jpg1.jpg";
    links[mynumber] = "#";
    descs[mynumber] = "";
    mywidth[mynumber]  = 700;
    myheight[mynumber] = 400;

    var mynumber = 2;    
    photo[mynumber] = "mn_jpg2.jpg";
    links[mynumber] = "#";
    descs[mynumber] = "";
    mywidth[mynumber]  = 700;
    myheight[mynumber] = 400;

    var mynumber = 3;
    photo[mynumber] = "mn_jpg3.jpg";
    links[mynumber] = "#";
    descs[mynumber] = "";
    mywidth[mynumber]  = 700;
    myheight[mynumber] = 400;
	
    var mynumber = 4;
    photo[mynumber] = "mn_jpg4.jpg";
    links[mynumber] = "#";
    descs[mynumber] = "";
    mywidth[mynumber]  = 700;
    myheight[mynumber] = 400;
	
    var mynumber = 5;
    photo[mynumber] = "mn_jpg5.jpg";
    links[mynumber] = "#";
    descs[mynumber] = "";
    mywidth[mynumber]  = 700;
    myheight[mynumber] = 400;
	
    var mynumber = 6;
    photo[mynumber] = "mn_jpg6.jpg";
    links[mynumber] = "#";
    descs[mynumber] = "";
    mywidth[mynumber]  = 700;
    myheight[mynumber] = 400;

// Generate a random number based on the weighted values
var totalweight=eval(imageweightarray.join("+")) //get total weight (add them all together)
var weighedimagecountarray=new Array() //new array to hold "weighted" imagecountarray
var currentimagecount=0

while (currentimagecount<imagecountarray.length){ //step through each fruit[] element
for (i=0; i<imageweightarray[currentimagecount]; i++)
weighedimagecountarray[weighedimagecountarray.length]=imagecountarray[currentimagecount]
currentimagecount++
}


var randomnumber= Math.floor(Math.random()*totalweight)
var whichimage = weighedimagecountarray[randomnumber];
 

    // Define the output variables
    var photopath = "./images/" + photo[whichimage];
    var photourl = links[whichimage];
    var photodes = descs[whichimage];
    var photow  =   mywidth[whichimage];
    var photoh  =   myheight[whichimage];



// Output the image URL and description to HTML
document.write("<IMG SRC='" + photopath + "' width='" + photow + "' height='" + photoh + "' border='0' alt='' name='mainphoto2'  title='" + photodes + "'></a>");
//{ORIGINAL CODE LINE] document.write("<A HREF='" + photourl + "'><IMG SRC='" + photopath + "' width='" + photow + "' height='" + photoh + "' border='0' alt='' name='mainphoto2'  title='" + photodes + "'></a>");

// end of code