// JavaScript Document


var origArray = new Array;		// array of the items to choose from
// List items to choose from...
origArray[0] = "<li><a href='properties/calexico.html'>Calexico Family Apartments</a></li>";
origArray[1] = "<li><a href='properties/de_anza.html'>De Anza Hotel</a></li>";
origArray[2] = "<li><a href='properties/heber.html'>Heber Family Apartments I &amp; II</a></li>";
origArray[3] = "<li><a href='properties/mariposa.html'>Mariposa</a></li>";
origArray[4] = "<li><a href='properties/paul_mirable.html'>Paul Mirable	Single Adult Res.</a></li>";
origArray[5] = "<li><a href='properties/rancho_buena_vista.html'>Rancho Buena Vista</a></li>";
origArray[6] = "<li><a href='properties/rancho_del_norte.html'>Rancho Del Norte</a></li>";
origArray[7] = "<li><a href='properties/regency.html'>Regency Centre Apartments</a></li>";
origArray[8] = "<li><a href='properties/stregis.html'>St. Regis Park Apartments</a></li>";
origArray[9] = "<li><a href='properties/villa_flores.html'>Villa de las Flores</a></li>";
origArray[10] = "<li><a href='properties/villa_serena.html'>Villa Serena</a></li>";
origArray[11] = "<li><a href='properties/village_place.html'>Village Place</a></li>";
origArray[12] = "<li><a href='properties/windwood.html'>Windwood Village</a></li>";

var numElements = origArray.length -1; // number of elements to choose from


var pickedArray = new Array;	// array of the picked items

function pickRandomSq() {
	var pick; // number 
	
	pick = Math.round(Math.random() * numElements);
	
	if (!alreadyPicked(pick)) {
		pickedArray.push(pick);
		return pick;
	} else {
		return pickRandomSq()
	}
}

function alreadyPicked(num) {
	for (var i = 0; i < pickedArray.length; i++) {
		if (num == pickedArray[i])
			return true;
	}
	
	return false;
}

function displayFeaturedItems() {
	for (i = 0; i < 3; i++) {
		// pick a random unique random entry
		pickRandomSq();
		// write that selected entry out to the browser
		document.write(origArray[pickedArray[i]]);	
	}
}
