// JavaScript Document
//

//Makes for an awesome menu popup

 function closeCountry(){
		$(this).animate({
		top: "0",
		height: "14px"
		}, 500,
		function(){
		$(".footer .copyrightLegal li ul#locale_selector li.selected").css("backgroundImage" ,"url('../images/redesign/arrow_up.gif')");
		$(this).unbind();
		$(this).mouseenter(openCountry);
		}
		);
		return 0;
}


function openCountry(){
 		$(this).animate({
 		top: "-326px", // always the height in close country - the new height
 		height: "340px"
		}, 500,
                function(){
		$(".footer .copyrightLegal li ul#locale_selector li.selected").css("backgroundImage" ,"url('../images/redesign/arrow_down.gif')");
                $(this).unbind();
                $(this).mouseleave(closeCountry);
                }
		);
		return 0;
}

function popAndLoad(){
		$(this).addClass("selected");
		newSelection =	$(this).detach();
		
		$("ul#locale_selector li").removeClass("selected");
		$("ul#locale_selector li[class!=selected]").css("backgroundImage", "none");
		$("ul#locale_selector").prepend(newSelection);	
}

// below here be a main like function

$(document).ready(function(){

//Menu functions
	$("ul#locale_selector").mouseenter(openCountry);
	$("ul#locale_selector li").click(popAndLoad);
});//ready

// ,-O
//O   )
// `-O  Ubuntu rules! Fedora Drools.

