
    //addEvent(window,'load',inicializarEventosMenu,false);

    function inicializarEventosMenu(){
		var ob;
		for(f=1;f<=7;f++){
			ob=document.getElementById('icono'+f);
			addEvent(ob,'mouseover',cambiarIcono,false);
			addEvent(ob,'mouseout',volverIcono,false);			
	    }	
    }

    function cambiarIcono(e){
		if (window.event){
			window.event.returnValue=false;
			var id=window.event.srcElement.getAttribute("id");
			document.getElementById(id).src=devolverRutaIcono(id,1);
		}else
			if (e){
				e.preventDefault();
				var id=e.target.getAttribute('id');
				document.getElementById(id).src=devolverRutaIcono(id,1);
			}
    }
	
    function volverIcono(e){
		if (window.event){
			window.event.returnValue=false;
			var id=window.event.srcElement.getAttribute("id");
			document.getElementById(id).src=devolverRutaIcono(id,0);
		}else
			if (e){
				e.preventDefault();
				var id=e.target.getAttribute('id');
				document.getElementById(id).src=devolverRutaIcono(id,0);
			}
    }
	
	function devolverRutaIcono(id,flag){
		switch(id){
			case "icono1":
				ruta="images/iconos/inicio";
			break;
			case "icono2":
				ruta="images/iconos/microfono";
			break;
			case "icono3":
				ruta="images/iconos/oyentes";
			break;			
			case "icono4":
				ruta="images/iconos/aire";
			break;
			case "icono5":
				ruta="images/iconos/programacion";
			break;
			case "icono6":
				ruta="images/iconos/testigo";
			break;
			case "icono7":
				ruta="images/iconos/contactenos";
			break;				
		}
		if (flag == 0)
			ruta = ruta + '.jpg';
		else
			ruta = ruta + '2.jpg';			
		return ruta;
	}
	
    function addEvent(elemento,nomevento,funcion,captura){
		if (elemento.attachEvent){
			elemento.attachEvent('on'+nomevento,funcion);
			return true;
		}else
			if (elemento.addEventListener){
				elemento.addEventListener(nomevento,funcion,captura);
				return true;
			}else
				return false;
    }
	

// ******************* Validar e-mail *********************

function mail(texto){

    var mailres = true;            
    var cadena = "abcdefghijklmnñopqrstuvwxyzABCDEFGHIJKLMNÑOPQRSTUVWXYZ1234567890@._-";  

    var arroba = texto.indexOf("@",0);

    if ((texto.lastIndexOf("@")) != arroba) arroba = -1;

    var punto = texto.lastIndexOf(".");

     for (var contador = 0 ; contador < texto.length ; contador++){

        if (cadena.indexOf(texto.substr(contador, 1),0) == -1){

            mailres = false;

            break;
     }
    }

    if ((arroba > 1) && (arroba + 1 < punto) && (punto + 1 < (texto.length)) && (mailres == true) && (texto.indexOf("..",0) == -1))

     	mailres = true;

    else

     	mailres = false;

    return mailres;
}


// ******************* Validar espacios en blanco *********************

function valCampo(texto){
	texto = texto.replace(/^\s+|\s+$/g,"");
	return !(texto == "" || texto == null);

}

function validar_envio(){
	nombre = document.getElementById('txtnombre').value;
	email = document.getElementById('txtmail').value;
	mensaje = document.getElementById('txtmsj').value;
	
	if (!mail(email) || !valCampo(nombre) || !valCampo(mensaje)){

		alert('Campos no válidos, verifique.');
		return false;
	}
	else
		return true;

}

function validar_busqueda(){
	buscar = document.getElementById('txtbuscar').value;
	
	if (!valCampo(buscar)){
		alert('Debe ingresar un texto para realizar la búsqueda.');
	}
	else
		document.forms.item('frmbuscar').submit();

}

function validar_reg_oyente(){
	ci = document.getElementById('txtci').value;
	nombre = document.getElementById('txtnom').value;
	
	if (!valCampo(nombre)){

		alert('Debe completar el campo NOMBRE.');
		return false;
	}
	else
		if (!validar_CI(ci)){
			alert('La Cédula ingresada posee un formato incorrecto, verifique.');
			return false;			
		}else
			return true;
}

function validar_CI(xci){
	if (!valCampo(xci))
		return false;
	else
		return xci > 99999;
}


