// JavaScript Document


//////////////////////////////// CAMBIAR DE IDIOMA
function idioma(i, j){
	 var linea = new String();
	 
	 // Obtenemos la url actual
	 linea = window.location.href;
	 
	 // reemplazamos en la cadena la carpeta que contiene
	 linea = linea.replace(i, j);
	 //document.write(linea);
	 //alert(linea);
	 
	 // Sustituimos la url
	  window.location.href = linea;
}

//////////////////////////////// MOSTAR Y OCULTAR UNA CAPA
var show = false;

function opentree(tree, idObj)
{
	var cls = '';
	if (document.getElementById) {
		var el = document.getElementById (tree);
		var obj = document.getElementById(idObj);
		
		if (obj && obj.className) {
			obj.className = (obj.className == 'mostrar') ? 'ocultar' : 'mostrar';			
		}
		
	}
	return false;
}


//////////////////////// FUNCIÓN PARA VALIDAR CAMPOS DE FORMULARIO
function validar(){
				
	if(enviaDatos.nombre.value==""){
		alert("Nombre es obligatorio");
	}else if(enviaDatos.apellidos.value==""){
		alert("Apellidos es obligatorio");
	}else if(enviaDatos.email.value==""){
		alert("E-mail es obligatorio");
	}else if(enviaDatos.mensaje.value==""){
		alert("Escriba su mensaje, gracias.");
	}else{
		enviaDatos.submit();
	}
			
}
