function getElementById (obj) {
	if (document.getElementById) return document.getElementById(obj);
	if (document.all) return eval("document.all."+obj);
	return null;
}

function printButton(text,url,action,img) {
	var btn= '<table cellpadding="0" cellspacing="0" border="0" >';
	btn += '<tr><td class="botonIzquierda">&nbsp;</td>';
	btn += '<td class="botonCentro">';
	btn += '<a class="botonLink" href="' + url + '"';
	if (action != "") btn += ' onClick="javascript:'+action+'"';
	btn += ' id="boton_'+text.replace(" ","_")+'">'
	if (img != "") btn += '<img border="0" src="'+img+'">';
	btn += '<span class="botonTexto">'+text+'</span>';
	btn += '</a></td>';
	btn += '<td class="botonDerecha">&nbsp;</td></tr></table>';
	document.write(btn);
}

function printButton2(text,url,action,img) {
	var btn= '<table cellpadding="0" cellspacing="0" border="0" class="tablaBoton2">';
	btn += '<tr>';
	btn += '<td valign="middle" align="center">';
	btn += '<a class="botonLink" href="' + url + '"';
	if (action != "") btn += ' onClick="javascript:'+action+'"';
	btn += ' id="boton_'+text.replace(" ","_")+'">'
	if (img != "") btn += '<img border="0" src="'+img+'" align="absmiddle" style="margin-left:4px;">';
	btn += '<span class="botonTexto">'+text+'</span>';
	btn += '</a></td>';
	btn += '</tr></table>';
	document.write(btn);
}

function imprimirFecha (fecha) {
	var semana = [
		"Domingo", "Lunes","Martes","Miércoles","Jueves", "Viernes", "Sábado"
	];
	var meses = [
		"Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio",
		"Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"
	];
	var fechaO = new Date(fecha);
	document.write( semana[fechaO.getDay()] + ", " + fechaO.getDate() + " de " +
					meses[fechaO.getMonth()] + " de " + fechaO.getFullYear()
			);
}

var hex=255; // Initial color value.
var fadeObj = new Array();
var fdir = -1;

function setFadeObj (obj) {
	fadeObj[fadeObj.lenght] = getElementById(obj);
	alert(fadeObj.length);
}

function fadeObject(){ 
	if(hex>=0 && hex<=255) { //If color is not black yet
		hex += 11 * fdir; // increase color darkness
		if ( fadeObj[0] != null ) {
			for (i=0;i<fadeObj.lenght;i++) {
				if ( fadeObj[i] != null ) fadeObj[i].style.color="rgb("+hex+",0,0)";
			}
		}
	}
	else {
		if (hex > 255) hex=255 //reset hex value
		else hex = 0;
		fdir = fdir * -1;
	}
	if ( fadeObj[0] != null ) setTimeout("fadeObject()",15); 
}
