google.setOnLoadCallback(function() {

	/**
	 * Trigger Funktion um Link über Maus/Tastatur auszulesen
	 */
	var getLink = function(t){
		document.location.href = t;
	}



	$("#institutions").fadeTo('fast', 0.25);
	$("#institutions").selectable({
		disabled : false
	});

	$("#sections").selectable({
		selected : function(event, ui) {
			$("#institutions").selectable("option", "disabled", false);
			$("#institutions").fadeTo('slow', 1.0);

			$("#institutions li a").click(function(){
						document.location = $("#sections li.ui-selected a").attr('href') + '?location=' + $(this).attr('href');
					}).keypress(function(b) {
						if(b.which == 13){
							var selectedLink = $("#sections li.ui-selected a").attr('href') + '?location=' + $(this).attr('href');
							getLink(selectedLink);
							return false;
							//document.location = selectedLink; //$("#sections li.ui-selected a").attr('href') + '?location=' + $(this).attr('href');
						}
					});
		}
	});

	$("#sections").keypress(function(e){
		if(e.which == 13){
			$("#institutions").selectable("option", "disabled", false);
			$("#institutions").fadeTo('slow', 1.0);
								$("#institutions li a").keypress(function(b) {
									if(b.which == 13){
										getLink( $(e.target).attr('href') + '?location=' + $(this).attr('href'));
										return false;
									}
							});
			return false ;
		}

	});




});

