// Handles dynamic stuff on the first page of PhotoCity.

document.observe("dom:loaded", function() {

	// hide the sign-up box
	$("signup").style.display = "none";

	// clicking on SignUp NOW causes the sign up box to appear
	$("signupNOW").observe("click", function(event) {
		this.style.display = "none";
		$("signup").style.display = "block";
	});
	
	loadLocations();
	
	// hide the signup box
	$$("#signup .closeButton")[0].observe("click", function(event) {
		$("signup").slideUp();
		$("signupNOW").appear();
	});
});

// makes the location box locations have random colors
function loadLocations() {

	$$("#locations_box .location a").each(function (zone) {
			// to get light colors for the dark background
			var min = 70;
			var max = 200;
			zone.style.color = "rgb(" + randomRange(min, max) + ", " + 
						   randomRange(min, max) + ", " +
						   randomRange(min, max) + ")";	
	});
	
	// note... will do more with this later when there are more zones
	// position zone names interestingly
	//div.style.top = (i + 1) * randomRange(5, parseInt(div.getStyle("height"))) + "px";
	//div.style.left = randomRange(10, parseInt(div.parentNode.getStyle("width")) - parseInt(div.getStyle("width"))) + "px";
	//$("locations_box").style.height = parseInt($("locations_box").children[1].getStyle("height")) * (locations.length + 1) + "px";	
}

// returns a random number in the range of min to max
function randomRange(min, max) {
	min = min ? min : 0; // use 0 as default
	return Math.floor(Math.random() * max + 1) + min;
}
