var links = new Array();
var celebs=["paphitas:t1heo", "bannatyne:23d", "caan:28jc", "jones:100vj", "botham:b33fys", "khan:box111g", "moss:sm7", "tarrant:chu8b",   "martin:6hef","clarke:h41rdo", "humperdinck:eh1", "walsh:mrd1y", "sanderson:5tes", "daniels:mag1c", "fullerton:fiona"]
var celebweight=[15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1] //weight of each celeb above
var totalweight=eval(celebweight.join("+")) //get total weight 
var weighedcelebs=new Array() //new array to hold "weighted" celebs
var currentceleb=0

while (currentceleb<celebs.length){ //step through each celeb[] element
	for (i=0; i<celebweight[currentceleb]; i++)
		weighedcelebs[weighedcelebs.length]=celebs[currentceleb]
		currentceleb++
}

var randomnumber=Math.floor(Math.random()*totalweight)
var celeblink = weighedcelebs[randomnumber]
var celeb = celeblink.split(":")
document.write('<div id="celebPic"><div id="celebrity"><a href="http://www.regtransfers.co.uk/main/stories/' + celeb[1] + '.asp"><img src="/images_new/rotatingCelebs/'+ celeb[0] +'.jpg" title="' + celeb[0] + '" alt="celebrities" width="441" height="175" border="0"></a></div>');

document.write('<div style="margin-top:5px;">more &raquo; |')
for (j=0; j<15; j++){
	var clink = celebs[j].split(":");
	document.write('<a href="#" title="View other celebrities" onclick="changePic('+ j + ', \'' + clink[1] + '\', \'' + clink[0] +'\')">'+ (j+1) +'</a> |');
}
document.write('</div></div>')

function changePic(picNum, celebLnk, celebNew){
	document.getElementById("celebrity").innerHTML = '<a href="http://www.regtransfers.co.uk/main/stories/' + celebLnk + '.asp"><img src="/images_new/rotatingCelebs/'+ celebNew +'.jpg" title="' + celebNew + '" alt="celebrities" width="441" height="175" border="0"></a>';
}