$(function() {
	$('#lang a').each(function(i){
		$(this).mouseenter(function() {
			$(this).css({cursor:"pointer"});
		});
		
		$(this).mouseout(function() {
			$(this).css({cursor:"default"});
		});
		
		// get the href
		
		$href = $(this).attr("href");
		
		// take the lang code
		
		$lang = $(this).html();
				
		if ($lang == "en")
		{
			$langCode = "en_US";
		}
		else
		{
			$langCode = $lang.toLowerCase() + "_" + $lang.toUpperCase();
		}
		
		if ($lang == "en")
		{
			$lang = "";
		}
		else
		{
			$lang = "_" + $lang;
		}
		
		// take the root url
		
		$endOld = $href.indexOf("?", 0);
		
		$startNew = $href.substring(0, $endOld);
		
		// compose thr url -> root?page=home_lang&hl=lang
		
		$newUrl = $startNew + "?page=home" + $lang + "&hl=" + $langCode;
		
		$(this).attr("href",$newUrl);
		/*
		$(this).click(function(){
			window.location=($newUrl);
		});*/
	});
})
