$(document).ready(function() {
    $("ul.vlsDropdown").each(generateVlsDropdown);
    $("ul.vlsDropdown").hover(showVlsDropdown, hideVlsDropdown);
});

function generateVlsDropdown() {
	//~ reposition selected to first
	var selectedLi = $(this).children("li#selected");
	selectedLi.clone().prependTo($(this));
	selectedLi.remove();
	//~ write an <a> and transfer the @ref to it
	$(this).children("li").wrapInner("<a></a>");
	$(this).find('a').each(function() {
		$(this).attr('href',$(this).parent('li').attr('vls:href'));
	});
}
function showVlsDropdown() {
		$(this).children('li').show()
}
function hideVlsDropdown() {
		$(this).children('li:not(#selected)').hide()
}


