// JavaScript Document
function listen(even, elem, func) {


	elem = document.getElementById(elem);
	
	
	document.getElementById(elem).attachEvent("on"+even,func);
    
}
function cambiarIdioma(){
	var indice = document.getElementById('idioma').selectedIndex ; //obtengo indice seleccionado
	var valor = document.getElementById('idioma').options[indice].value ; // obtengo el id seleccionado
	window.location = url[valor];
	}

function cambiarDatosContacto(){

	var indice = document.getElementById('padre').selectedIndex ; //obtengo indice seleccionado
	var valor = document.getElementById('padre').options[indice].value ; // obtengo el id seleccionado
	parsearValor(contacto[valor][0], "direccion");

	parsearValor(contacto[valor][1], "telefono");
	parsearValor(contacto[valor][2], "cp");
	cambiarCoordenadas(contacto[valor][3], contacto[valor][4])
	}
function parsearValor(valor, nombre_var){
	
	if(valor=="")
		document.getElementById("li_"+nombre_var+"_contacto").className ="none" ;
	else{
		document.getElementById("li_"+nombre_var+"_contacto").className="";
		}	

	document.getElementById(nombre_var+"_contacto").innerHTML = valor;
	}	

function verCategoria(){
	
	var indice = document.getElementById('categoria').selectedIndex ; //obtengo indice seleccionado
	var valor = document.getElementById('categoria').options[indice].value ; // obtengo el id seleccionado
	var arreglo = valor.split("#")
	window.location = arreglo[1];
	}

function mostrarMapa(){
	var indice = document.getElementById('padre').selectedIndex ; //obtengo indice seleccionado
	var id = document.getElementById('padre').options[indice].value ; // obtengo el id seleccionado
	var texto =document.getElementById('padre').text;
	var url = '/index.php?module=contacto&action=popUp&template=mapa&id='+id;
	vent =window.open(url, texto, 'width=800, height=700,scrollbars=yes, statusbar=no, resizable=yes');
	centrarVentana(vent,800,700);
	}
function centrarVentana(objvent, width, height)
{

	objvent.moveTo((screen.width-width)/2,(screen.height-height)/2);
}
	
