$(document).ready(function()
{
	newSelect = document.createElement("select");
	$(newSelect).attr('id','CT_LanguageSelectTag');
	$(newSelect).change(function()
	{
		theLink = $("select option:selected").attr('value');
		window.location = theLink;
	});
	
	counter = 0;
	
	$("#language-interface li").each(function()
	{
		theLink = $(this).children("a:first").attr('href');
		theText = $(this).text();
		newOption = document.createElement("option");
		
		$(newOption).attr('value',theLink);
		$(newOption).text(theText);
		
		$(newOption).appendTo(newSelect);
		
		if($(this).hasClass('active'))
		{ $(newOption).attr('selected','true'); }
		
		counter++;
	});
	
	if (counter == 0) { $("#CT_LanguageSelector").css('display','none'); }
	$("#CT_LanguageSelector").prepend($(newSelect));
	$("#CT_LanguageSelector ul").remove();
	$("#CT_LanguageSelector").css('visibility','visible');
});