/* Función que carga anticipadamente las imagenes */function loadImages(){	if (document.getElementById) { /* DOM3 = IE5, NS6 */		$('hidepage').setStyle({'display' : 'none', 'visibility' : 'hidden'});	}	else {		if (document.layers) { /* Netscape 4 */			$('hidepage').setStyle({'display' : 'none', 'visibility' : 'hidden'});		}		else { /* IE 4 */			$('hidepage').setStyle({'display' : 'none', 'visibility' : 'hidden'});		}	}}/* LTrim(string) : Returns a copy of a string without leading spaces. */function ltrim(str){   var whitespace = new String(" \t\n\r");   var s = new String(str);   if (whitespace.indexOf(s.charAt(0)) != -1) {      var j=0, i = s.length;      while (j < i && whitespace.indexOf(s.charAt(j)) != -1)         j++;      s = s.substring(j, i);   }   return s;}/* RTrim(string) : Returns a copy of a string without trailing spaces. */function rtrim(str){   var whitespace = new String(" \t\n\r");   var s = new String(str);   if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {      var i = s.length - 1;      while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)         i--;      s = s.substring(0, i+1);   }   return s;}/* Trim(string) : Returns a copy of a string without leading or trailing spaces */function trim(str) {   return rtrim(ltrim(str));}/* Función que abre una ventana emergente */var win = null;function popup(pagina,titulo,w,h){	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;	estilo ='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',menubar=no,scrollbars=yes,toolbar=no,location=no,directories=no,resizable=no';	win = window.open(pagina,titulo,estilo)}/* Función que cambia la cantidad de resultados de páginas */function change_respage( url ) {    loadMainContent(url);}/* Función que cambia el tamaño de la fuente */function changeSize(clase, size){	$(clase).className = 'size-' + size;	switch(size)	{		case 1:			$('size-1').style.fontWeight = "bold";			$('size-2').style.fontWeight = "normal";		break;		case 2:			$('size-2').style.fontWeight = "bold";			$('size-1').style.fontWeight = "normal";		break;	}}/* Cambiar */var nav = window.Event ? true : false; //objeto en el que se definen los events del objeto window/************* Funciones para validar la entrada por teclado *******************//*     Retroceso	: 	8	Enter 		: 	13	Espacio 	: 	32    Suprimir	: 	46    Cursores    :   37 - 40    '/'		    : 	47	'@'		    :	64	'-'		    :	45	'_'		    :	95	','         :   44    '.'         : 	46    0..9        : 	48 a 57		'A'..'Z'	: 	65 a 90	'a'..'z'	: 	97 a 122	ñ			: 	241	Ñ			: 	209		Caracteres	: 	123 a 255	Caracteres	: 	192 a 255 (grado)		Ctrl+C		: 	99	Ctrl+V		: 	118	*/function validate_number(event){    var key = event.charCode ? event.charCode : event.keyCode;    return (key <= 13 || (key > 34 && key < 47) || (key >= 48 && key <= 57)); }function validate_text(event) {    var key = event.charCode ? event.charCode : event.keyCode;    return (key <= 13 || key == 32 || (key > 34 && key < 47) || (key >= 65 && key <= 96) || (key >= 97 && key <= 122)|| key == 241 || key == 209 || key >= 192) ;}function validate_id(event) {    var key = event.charCode ? event.charCode : event.keyCode;    return (key <= 13 || (key > 34 && key < 47) || key==95 || (key >= 65 && key <= 90) || (key >= 97 && key <= 122) || (key >= 48 && key <= 57)); }function validate_text_number(event) {	return (validate_number(event) || validate_text(event));}function validate_email(event){	var key = event.charCode ? event.charCode : event.keyCode;	return (key <= 13 || (key > 34 && key < 47) || key==95 || (key >= 48 && key <= 57) || (key >= 65 && key <= 90) || (key >= 97 && key <= 122) || key == 64); }/* ContactUs */function validate_contactus ( frm, url, urltogo) {    msg = '';    if ($F('userid') == '0') {        $('userid').focus();        msg += '\t- Destinatario no seleccionado\n';        $('userid').className = 'requiredfield';    } else {        $('userid').className = 'field';    }    if (trim($F('name')) == '') {        if (trim(msg) == '') {            $('name').focus();        }        msg += '\t- Nombre no introducido\n';        $('name').className = 'requiredfield';    } else {        $('name').className = 'field';    }    if (trim($F('email')) == '') {        if (trim(msg) == '') {            $('email').focus();        }        msg += '\t- Correo electrónico no introducido\n';        $('email').className = 'requiredfield';    } else {        $('email').className = 'field';    }    if (trim($F('occupation')) == '') {        if (trim(msg) == '') {            $('occupation').focus();        }        msg += '\t- Ocupación no introducido\n';        $('occupation').className = 'requiredfield';    } else {        $('occupation').className = 'field';    }    if (trim($F('message')) == '') {        if (trim(msg) == '') {            $('message').focus();        }        msg += '\t- Mensaje no introducido\n';        $('message').className = 'requiredfield';    } else {        $('message').className = 'field';    }        if (trim(msg) == '') {        sendForm(url, urltogo, $(frm).serialize());    } else {        alert('Los campos siguientes son erróneos:\n' + msg);    }}
