Event.observe( window,'load', function(){
	storeswap();
});

function clearstores()
{
	 var listings = $('country_content').select('.listing');
	 for (var i = 0; i < listings.length; i++)
	 {
		listings[i].removeClassName("show");
	 }
}


function storeswap() 
{
	var form = $('countrylist');
	var input = form['choose_country'];
	
	var theHash = document.location.hash.replace( /^#/, '' );
	
	if(theHash != '' ){
		
		input.value =  theHash.toUpperCase();
				
		var inputValue = $($(input).value + '_store');
		if(inputValue){
			inputValue.addClassName("show");		
		}else{
			input.selectedIndex = 0;
		}
				
	}else{
		input.selectedIndex = 0;
	}
		

	$(input).observe('change', function(event){
		switch ($F(input))
		{		
		case 'select':
			clearstores();
			break;
		default:
			clearstores();
			$($(input).value + '_store').addClassName("show");
			this.blur();
		}				
	});
}

