// JavaScript Document

$(document).ready(function() {
			/* Find all friendly UL's */
			$('ul.SearchableSelect').each(function()
			{
			/* Hide list element */
			$(this).css("display", "none");

			/* Create new ID for the select, use existent Id of UL but add the _Select prefix */
			var ElementId = $(this).attr("id") + "_Select";

			/* Create new Select-element */
			$(this).after("<select id='" + ElementId + "' class='SearchableSelect'></select>");

			/* Loop-through list and add children to select */
			$(this).find("li").each(function()
			{
			/* Setup values */
			var Anchor = $(this).find("a").eq(0), Value = (Anchor.length > 0 ? $(Anchor).attr("href") : '');
			var SelectedElement = ($(this).hasClass("SelectedItem") ? ' selected' : '');

			/* Add child to select */
			$("#"+ElementId).append("<option value='"+Value+"'"+SelectedElement+">"+$(this).html()+"</option>");
			});
			});

			/* Hook selects */
			$("select.SearchableSelect").change(function()
			{
			if(this.value.length > 0) window.location.href = this.value;
			});
		});
