var rand = 0;
var wishkid = '';
var wishtext = '';
var alttag = '';

function chooseWishKid(num) 
{
	var randnum = Math.random();
	var inum = 6; //Total number of Kids to display

	//Randomly select wish kid to display if not alredy specified
	if (num == 0) {
	    	rand = Math.round(randnum * (inum-1)) + 1;
	}
	else {
		rand = num;
	}

	wishkids = new Array;   		
	wishkids[1] = 'images/WishKids/Alex/Alexsm.jpg';
	wishkids[2] = 'images/WishKids/Amanda/Amandasm.jpg';
	wishkids[3] = 'images/WishKids/Corina/Corinasm.jpg';
	wishkids[4] = 'images/WishKids/Madeline/Madelism.jpg';
	wishkids[5] = 'images/WishKids/Gregorio/Gregorsm.jpg';
	wishkids[6] = 'images/WishKids/Will/Willsm.jpg';
	//wishkids[7] = 'images/WishKids/Tess/Tesssm.jpg';
	
	text = new Array;
	text[1] = '"I wish to snorkle in Hawaii!"<p></p><a href="javascript:LinkToPage(1);">Read more...</a>';
	text[2] = '"I wish to go to the Kentucky Derby!"<p></p><a href="javascript:LinkToPage(2);">Read more...</a>';
	text[3] = '"I wish for a Beethoven dog!"<p></p><a href="javascript:LinkToPage(3);">Read more...</a>';
	text[4] = '"I wish to go to Walt Disney World!"<p></p><a href="javascript:LinkToPage(4);">Read more...</a>';
	text[5] = '"I wish to go to the US Open!"<p></p><a href="javascript:LinkToPage(5);">Read more...</a>';
	text[6] = '"I wish to be a top gun!"<p></p><a href="javascript:LinkToPage(6);">Read more...</a>';
	//text[7] = '"I wish to go to Walt Disney World!"<p></p><a href="javascript:LinkToPage(8);">Read more...</a>';

	alt = new Array;
	alt[1] = "Read about Alex's wish";
	alt[2] = "Read about Amanda's wish";
	alt[3] = "Read about Corina's wish";
	alt[4] = "Read about Madeline's wish";
	alt[5] = "Read about Gregorio's wish";
	alt[6] = "Read about Will's wish";
	//alt[7] = "Read about Tess's wish";
	
	wishkid = wishkids[rand];
	wishtext = text[rand];
	alttag = alt[rand];
	
	if (document.title == "Wishes") {	
		var imagename = "WishKid" + rand;
		eval("document." + imagename + ".src = wishkid");
		eval("document." + imagename + ".alt = alttag");
	} else {
		document.WishKid.src = wishkid;
		document.WishKid.alt = alttag;
	}

	document.write (wishtext);

	return rand;
}

function LinkToPage(loc){
	if (loc != 0)
		rand = loc;
	
	location = new Array;
	location[1] = 'WishKids/Alex.htm';
	location[2] = 'WishKids/Amanda.htm';
	location[3] = 'WishKids/Corina.htm';
	location[4] = 'WishKids/Madeline.htm';
	location[5] = 'WishKids/Gregorio.htm';
	location[6] = 'WishKids/Will.htm';
	//location[7] = 'WishKids/Tess.htm';
	
	location.href = location[rand];
}