function updatePrice(theRegion)
{
	var priceDropdown = document.getElementById("slt_price");
	if (theRegion != "")
	{
		removeOptions(priceDropdown);
		for (var i = 0; i < region[theRegion].length; i++)
		{
			// create option and set correct value
			var newOption = document.createElement("option");
			newOption.setAttribute("value", region[theRegion][i]);
			// grab text node which is text version of price, append to the option
			var optionText = document.createTextNode(thePrices[region[theRegion][i]]);
			newOption.appendChild(optionText);
			// append the created option to the select
			priceDropdown.appendChild(newOption);
		}
	}
}

function removeOptions(priceDropdown)
{
	var theOptions = priceDropdown.getElementsByTagName("option");
	while (theOptions.length > 1)
	{
		removedNode = priceDropdown.removeChild(theOptions[theOptions.length - 1]);
	}
}

function pageLoadCheck()
{
	theVariable = getURLVar('slt_region');
	if (theVariable != "")
	{
		updatePrice(theVariable);
	}
}

function getURLVar(returnThis)
{
	var theVariable = "";
	if(location.search)
	{
		var URLVariables = location.search.split('&');
		// remove '?' from first variable
		URLVariables[0] = URLVariables[0].substring(1,URLVariables[0].length);
		for (var i = 0; i < URLVariables.length; i++)
		{
			if (URLVariables[i].indexOf(returnThis) != -1) 
			{
				theVariable = URLVariables[i].substring(returnThis.length + 1,URLVariables[i].length);
			}
		}
	}
	return theVariable;
}

window.onload = function()
{
	pageLoadCheck();
}


