// JavaScript Document

function changeDeck() {
	
	var newDeckString = $("#deckselector").val();
	
	//only if you didn't select the blank option
	if (newDeckString != "") {

		var sUnits=new Array(15);
		
	sUnits[0]  = 'One';
	sUnits[1]  = 'Two';
	sUnits[2]  = 'Three';
	sUnits[3]  = 'Four';
	sUnits[4]  = 'Five';
	sUnits[5]  = 'Six';
	sUnits[6]  = 'Seven';
	sUnits[7]  = 'Eight';
	sUnits[8] = 'Nine';
	sUnits[9] = 'Ten';
	sUnits[10] = 'Eleven';
	sUnits[11] = 'Twelve';
	sUnits[12] = 'Thirteen';
	sUnits[13] = 'Fourteen';
	sUnits[14] = 'Fifteen';


		//split the string by the underscores
		var ar = newDeckString.split("_");
		var shipname = "";
		
		if (ar[0] == "f") {
			shipname = "freedom";
		} else {
			shipname = "mariner"
		}
		
		var decknum = ar[1];
	
		//swap out the ship thumbnail
		$("#shipthumbnail").attr("src","img/deckplans/deck_"+decknum+"_"+shipname+"_ship.gif");
		
		//swap out the large ship image
		$("#deckimage").attr("src","img/deckplans/"+shipname+"_map_deck"+decknum+".gif");
		
		//set the new deck title (need the word instead of the number)
		$("#decktitle").text("Deck "+sUnits[decknum-1]);
		
		//get the HTML from the deck content you need
		var contentHTML = $("#deck"+decknum).html();
		
		$("#deckcontent").html(contentHTML);
	
	}

	
}