function rollOn(obj){file=obj.src;obj.src=file.replace('_Off','_On');}

function rollOff(obj){file=obj.src;obj.src=file.replace('_On','_Off');}

function slideOn(obj){file=obj.className;obj.className=file.replace('_Off','_On');}

function slideOff(obj){file=obj.className;obj.className=file.replace('_On','_Off');}

var Key='';
function keyhandler(e) {
   	if ((Key >=48 && Key <=57) || (Key >=96 && Key <=105) || Key==46 || Key==8 || Key==9 || (Key >=37 && Key <=40)){return true}else{return false};
}

function validarEmail(valor) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor)){
		return (true);
	} else {
		return (false);
	}
}

function modificatamanotipografia(val,obj){
	if(typeof(obj)=='object'){
		var par=obj;
	}else{
		var par=document.getElementById(obj);
	}
	var clds=par.childNodes;
	for (var z0=0;z0<clds.length;z0++){
		if (clds[z0].nodeName=='DIV' || clds[z0].nodeName=='A'){
			if(val==1){
				clds[z0].className=clds[z0].className.replace('_2','_3');
				clds[z0].className=clds[z0].className.replace('_1','_2');
			}else{
				clds[z0].className=clds[z0].className.replace('_2','_1');
				clds[z0].className=clds[z0].className.replace('_3','_2');
			}
			modificatamanotipografia(val,clds[z0])
		}
	}
}

function buscar(){
	document.busqueda.submit();
}

function esBisiesto(year) {  
    return (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) ? true : false;  
}  

function limpiaSelect(elSelect) {  
    while( elSelect.hasChildNodes() ) {elSelect.removeChild( elSelect.firstChild );} 
}  

function aniadeOpcion(elSelect, texto, valor) {  
    var laOpcion=document.createElement("OPTION");  
    laOpcion.appendChild( document.createTextNode(texto) );  
    laOpcion.setAttribute("value",valor);  
    elSelect.appendChild(laOpcion);  
}

function rellenar_anio(elSelect,desde,hasta) { 
    for(var a=hasta;a>=desde;a--) {aniadeOpcion(elSelect, a.toString(), a.toString() );}
}

var meses=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"]; 
function rellenar_mes(elSelect) { 
    for(var a=0;a<meses.length;a++) {aniadeOpcion(elSelect, meses[a], a );}
}

function rellenar_dia(elSelect, anio, mes ) { 
    var ultimo_dia; 
    if(mes==1) {ultimo_dia=esBisiesto(anio)?29:28; }
    else if( mes==0 || mes==2 || mes==4 || mes==6 || mes==7 || mes==9 || mes==11) {ultimo_dia=31;}
    else {ultimo_dia=30;}
    for(var a=1; a<=ultimo_dia; a++) { 
        aniadeOpcion(elSelect, a, a); 
    } 
}

function actualizar() { 
    limpiaSelect(dia); 
    rellenar_dia(dia, anio.options[anio.options.selectedIndex].value, mes.options[mes.options.selectedIndex].value ); 
}
