function g(id) {
	if (document.getElementById) var returnVar = document.getElementById(id);
	else if (document.all) var returnVar = document.all[id];
	else if (document.layers) var returnVar = document.layers[id];
	return returnVar;
}

function comprobar() {
	if (g("titulo").value=="") {
		g("titulo").focus();
		alert("Por favor, indica un título.");
		return false;
	} else if (g("fecha").value=="") {
		g("fecha").focus();
		alert("Por favor, indica una fecha.");
		return false;
	} else return true;
}

function ajustarContacto() {
	at=parseInt(valorEstilo("capa_telefono","width"));
	ac=parseInt(valorEstilo("capa_correo","width"));
	if (at!=anchoTelefono) g("capa_telefono").style.width=((at+anchoTelefono)/2)+'px';
	if (ac!=anchoCorreo) g("capa_correo").style.width=((ac+anchoCorreo)/2)+'px';
}

function ajustarTiras() {
	for (i=0; i<d.length; i++) {
		if ((cat==i) || ((i==0) && (cat==-1))) {
			if (g("r"+i)) g("r"+i).style.visibility='visible';
			if (d[i]<20) d[i]=parseInt((d[i]+20)/2);
		} else {
			if (g("r"+i)) g("r"+i).style.visibility='hidden';
			if (d[i]>1) d[i]=parseInt(d[i]/2);
		}
		if (g("t"+i)) {
			g("t"+i).style.marginTop=d[i]+'px';
			g("t"+i).style.marginLeft=parseInt(d[i]/3.5)+'px';
		}
	}
}

function valorEstilo(objeto, estilo) {
    if(g(objeto).currentStyle) {
        var convertToCamelCase = estilo.replace(/\-(.)/g, function(m, l){return l.toUpperCase()});
        return g(objeto).currentStyle[convertToCamelCase];
    } else if (window.getComputedStyle) {
        var elementStyle = window.getComputedStyle(g(objeto), "");
        return elementStyle.getPropertyValue(estilo);
    }
}

function cambiar(id,src) {
	g(id).src=src;
}