/*
 * Javascript for ClanRoss.org
 * Author: Christian Flanagan
 * 
 */

// Validate that the end user has selected a length of membership
function validateForm(value,tab) {
	if(value == "none") {
		switch(tab) {
		case "new":
			alert("Select the length of membership you wish to purchase.");
			break;
		case "renew":
			alert("Select a renewal option.");
			break;
		case "life":
			alert("Select a payment option.");
			break;
		case "donate":
			alert("Select a donation amount.");
			break;
		}
		return false;
	} else {
		return true;
	}
}

// Transfer the value of the option selected to the hosted_button_id hidden input
function setHiddenIdValue(val,id) {
	document.getElementById(id).value = val;
}

// Clan Officers Page: Hide and show divs matching the selected option
var currentSelection = "northwest"; // Default value
function showRegion(id) {
	// If ID has a value
	if(id) {
		// Hide the current one
		document.getElementById(currentSelection).style.display = "none";
		currentSelection = id;
	}
	// Show the selected one
	document.getElementById(currentSelection).style.display = "block";
}

function hideRegions() {
	var selectBox = document.getElementById('regions');
	var values = selectBox.options;
	for(var i=0;i<values.length;i++) {
		document.getElementById(values[i].value).style.display = "none";
	}
	showRegion();
}
