/* Create, then append, a new TextNode object. */

function newTextElement(elemID,arrayname,num,prefix) {
arrayname = eval(arrayname);
var newelement = document.getElementById(elemID); 
var newtext = document.createTextNode(prefix + arrayname[num]);
newelement.appendChild(newtext);
}

/* Create the dynamic content for the front page. */ 

function showcase(num) {
newTextElement('featuredesc','productdesc',num,"");
newTextElement('featurename','productname',num,"");
newTextElement('featurebio','productbio',num,"");
newTextElement('featuremore','moredesc',num,"");

/* Create the new IMG object. */ 

var PicObj = document.createElement("IMG");
PicObj.id = "picture";
PicObj.src = largeimg[num];

document.getElementById('productpic').appendChild(PicObj);
}

/* obtain a random positive number between lownum and highnum */ 

function randomize(lownum, highnum) {
return Math.floor(Math.abs(Math.random() * (highnum - lownum + 1) - 0.0000000001)) + lownum;
}

/* Display a random product on the first page. */ 
function randomshowcase() {
showcase (randomize (0, productdesc.length-1));
}











