var JSPage = Class.create()

JSPage.prototype = {
	initialize : function() {
		Object.extend(window, this);
		$$("a.selRegion").each(function(item){
			Event.observe(item, "click", window.selRegion);
		});
		
		$$("a.link_idiomes").each(function(item){
			Event.observe(item, "click", window.selIdioma);
		});
	},
	
	selRegion : function(evt){
		elemento = Event.findElement(evt, "a");
		window.ocultarRegiones();
		$(elemento.getAttribute("idRegion")).show();
	},
	
	ocultarRegiones : function(){
		$$("a.selRegion").each(function(item){
			$(item.getAttribute("idRegion")).hide();
		})
	},
	
	selIdioma : function(evt){
		elemento = Event.element(evt);
		if(elemento.getAttribute("codPais") != ''){
			recordarPais = ($("recordar").checked) ? "1" : "0";
			window.location = "selIdioma.php?codPais=" + elemento.getAttribute("codPais") + "&idiomaSel=" + elemento.getAttribute("idioma") + "&recordar=" + recordarPais;
			Event.stop(evt);
		}	
	}
}


Event.observe(window,"load",function(){ new JSPage(); });