var frameResult, botoColor, shadowColor, ligthColor;

function hrefBoto(b) {
	if (b.href != null) 
		if ((frameResult == null) ||
			(frameResult == "")) 
			window.navigate(b.href);
		else
			window.parent.frames(frameResult).location.href = b.href;
}

function clickBoto(b) {
	b.style.borderTopColor = shadowColor;
	b.style.borderLeftColor = shadowColor;
	b.style.borderBottomColor = lightColor;
	b.style.borderRightColor = lightColor;
}

function mostraBoto(b) {
	b.style.borderTopColor = lightColor;
	b.style.borderLeftColor = lightColor;
	b.style.borderBottomColor = shadowColor;
	b.style.borderRightColor = shadowColor;
}

function aplanaBoto(b) {
	b.style.borderTopColor = botoColor;
	b.style.borderLeftColor = botoColor;
	b.style.borderBottomColor = botoColor;
	b.style.borderRightColor = botoColor;
}

function mostraCelda(b, altura, aBoto) {
	if (b.id == "_BCelda_") {
		b.height = altura + 4;
		b.valign = "center";
		b.style.borderLeftColor = botoColor;
		b.style.borderRightColor = botoColor;
		b.style.borderTopColor = lightColor;
		b.style.borderBottomColor = shadowColor;
		b.style.borderStyle = "solid";
		b.style.borderWidth = aBoto + "px";
	}
}

function iniciaBoto(b, altura, aBoto) {
	b.height = altura;
	b.style.cursor = "hand";
	b.style.borderStyle = "solid";
	b.style.borderWidth = aBoto + "px";
	aplanaBoto(b);
	b.onmouseover = doBotoShow;
	b.onmouseout = doBotoHide;
	b.onmousedown = doBotoClick;
	b.onmouseup = doBotoShow;
	if (b.href != null)
		b.onclick = doBotoHRef;
}

function iniciaTaula(b, altura, aBoto) {
	for (var i = 0; i < b.rows.length; i++) 
		for (var c = 0; c < b.rows(i).cells.length; c++)
			mostraCelda(b.rows(i).cells(c), altura, aBoto); 
}

function doBotoHRef() {
	hrefBoto(window.event.srcElement);
}

function doBotoClick() {
	clickBoto(window.event.srcElement);
}

function doBotoShow() {
	mostraBoto(window.event.srcElement);
}

function doBotoHide() {
	aplanaBoto(window.event.srcElement);
}
