//-------------------------------------------------------------------------- //
// Este script está registrado no Registro de Títulos e Documentos           //
// de Petrópolis / RJ Protocolado no livro nº 35101 livro B13 selo RDT50443  //
// A cópia não autorizada deste script acarretará em ação judicial (art 127) // 
// Desenvolvido por Peter M Jordan - tocando@tocando.com.br                  //
//-------------------------------------------------------------------------- //




































function derivacoes(chord)
{
	chord = replaceChars(chord, '+', '%2b')
	chord = replaceChars(chord, '#', '%23')
	window.open('frm_dicionario.asp?acorde=' + chord, 'deriva', 'width=500, height=600')
}
function variaAcorde(spanId, Titulo)
{
	totalAcordes = arrAcordes[spanId - 1].length
	arrPosAcorde[spanId - 1] = (((arrPosAcorde[spanId - 1] + 1) >= totalAcordes) ? 0 : arrPosAcorde[spanId - 1] + 1);
	strAcorde = arrAcordes[spanId - 1][arrPosAcorde[spanId - 1]] 
	leftX = ((spanId % 8) == 0 ? 8 * 80 : (spanId % 8) * 80) - 80
	desenhaAcorde(spanId, Titulo, strAcorde)
}
stop=1;

function reverseAcordes() 
{
	leftX = 0
	direcao *= -1
	if (direcao == 1) {document.getElementById("direcao2").innerHTML = "Acordes p/ Canhoto"} else {document.getElementById("direcao2").innerHTML = "Acordes p/ Destro"}
	for (a=0; a<arrDesenhos.length; a++)
	{
		desenhaAcorde(a + 1, arrDesenhos [a], arrAcordes [a][arrPosAcorde[a]]);
	}
}
var direcao = 1

function desenhaAcorde(spanId, Titulo, strAcorde){
spanAcorde = document.getElementById('acorde' + spanId)
spanNotas = document.getElementById('notas' + spanId)
arrAcorde = strAcorde.split(' ')
var min = 100
var max = toques = 0
var bolTonica = true
tds = new Array()
for (n = 0; n < arrAcorde.length; n++){
arrAc = arrAcorde[n]
if (arrAc != "X"){
if (arrAc != "0" && parseInt(arrAc) < min) min = parseInt(arrAc)
if (parseInt(arrAc) > max) max = parseInt(arrAc)
if (arrAc.substring(0,1) != "P" && arrAc != "0") toques ++
if (bolTonica) {tonica = n; bolTonica = false;}}}

var primeiroTraste = min
if (max <=5) min = 1
acorde = "<table border=0><tr><td width=17 valign=top align=right class=smalltext><br>" + (min == 1 ? "" : min + "ª") + "</td><td class='smalltext'><b><a class=acorde style='cursor:pointer'>" + Titulo + "</a></b><br>";
acorde +="<img src='imagens/c/cavaq.gif'>"

if (spanId != 1000 && arrAcordes[spanId - 1].length > 1) {
acorde +="<table border=0 width=48 cellpadding=0 cellspacing=0 height=20>"
acorde +="<tr><td colspan=2 align=center><br><a style=cursor:pointer class='smalltext noprint' onClick=\"variaAcorde(" + spanId + ", '" + Titulo + "');\">variação</a></td></tr></table>"}


acorde +="</td></tr><tr><td></td><td> </td></tr></table>"
notas = "<br><img height=3><br><table border=0 cellpadding=0 cellspacing=0 width=52 height=85>"
dedo = 1
//-----

for (traste = min; traste <= min + 4; traste ++){
notas +="<tr height=16>"
pestana = false
trasteVazio = true;
for (corda = 0; corda <= 3; corda ++){
tds[corda] ="<td width=13 valign=bottom height=16>"
//notas +="<td width=13 valign=bottom height=16>" 
posPestana = (arrAcorde[corda]  == "P" + traste)
if (arrAcorde[corda] == traste || pestana || posPestana){
trasteVazio = false;
if ((toques > 4 && traste == primeiroTraste) || pestana || posPestana)
{
if (!pestana) dedo ++
pestana = true
tds[corda] += "<img src='imagens/c/pestana.bmp' width=13 height=3 align=top>"
//notas += "<img src='imagens/c/pestana.bmp' width=13 height=3 align=top>"
}
else
{
tds[corda] += "<img src=imagens/c/" + dedo + ".gif align=absmiddle>"; dedo ++
}
}
tds[corda] += "</td>"
} 
if (trasteVazio && dedo > 1 && dedo < 3 && toques <4) dedo ++

if (direcao == -1) 
{
	for (n=3; n>=0; n--)
	{
		notas += tds[n]
	}
} else
{
	for (n=0; n<=3; n++)
	{
		notas += tds[n]
	}
}



notas +="</tr>"}
notas +="<tr height=16>"

if (direcao == -1) 
{
	for (n = arrAcorde.length-1; n>=0; n--){
	notas += "<td width=13 class='smalltext' align=center>" + (arrAcorde[n] == "X" ? "<img src='imagens/c/x.gif' align=absmiddle>" : (tonica == n ? "<img src='imagens/c/o_minusculo.gif' align=absmiddle>" :"<img src='imagens/c/o_minusculo2.gif' align=absmiddle>")) + "</td>"}
}
else
{
	for (n = 0; n < arrAcorde.length; n++){
	notas += "<td width=13 class='smalltext' align=center>" + (arrAcorde[n] == "X" ? "<img src='imagens/c/x.gif' align=absmiddle />" : (tonica == n ? "<img src='imagens/c/o_minusculo.gif' align=absmiddle />" :"<img src='imagens/c/o_minusculo2.gif' align=absmiddle />")) + "</td>"}
}



//for (n = 0; n < arrAcorde.length; n++){
//notas += "<td width=13 class='smalltext' align=center>" + (arrAcorde[n] == "X" ? "<img src='imagens/c/x.gif' align=absmiddle>" : (tonica == n ? "<img src='imagens/c/o_minusculo.gif' align=absmiddle>" :"<img src='imagens/c/o_minusculo2.gif' align=absmiddle>")) + "</td>"}


notas +="</tr>"
notas +="</table>"
spanAcorde.innerHTML = acorde;
if (spanId != 1000) {
	if (ns6){spanNotas.style.top ='-11px';}
	spanAcorde.style.left = '5px';
	spanNotas.style.left = '25px' ;
}
spanNotas.innerHTML = notas;
leftX += 80
if (leftX == 640) leftX = 0
}

function MD(e,pDetalhes)
{
	var offSetX1 = (ns6)?0:0;
	var offSetY1 = (ns6)?0:0;
	var offSetX2 = (ns6)?22:22;
	var offSetY2 = (ns6)?-11:0;
	curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
	curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;

	for (n=0; n< arrDesenhos.length; n++){if (pDetalhes == arrDesenhos[n] || pDetalhes == arrDesenhos[n]) break;}
	totalAcordes = arrAcordes[n].length
	strAcorde = arrAcordes[n][arrPosAcorde[n]] 
	document.getElementById('acorde1000').style.filter = 'progid:DXImageTransform.Microsoft.Shadow(direction=130,color=gray,strength=8);'

	document.getElementById('acorde1000').style.display = "block"

	document.getElementById('notas1000').style.display = "block"

	desenhaAcorde(1000, pDetalhes, strAcorde)

	document.getElementById('notas1000').style.top = (curY + offSetY2 - 50) + 'px'; //-80 + window.event.y + IEHorizontal
	document.getElementById('acorde1000').style.top = (curY + offSetY1 - 50) + 'px'; //-80 + window.event.y + IEHorizontal
	document.getElementById('notas1000').style.left = (curX + offSetX2 + 20) + 'px'; //window.event.x + (keyb == "true" ? 0 : 20) + 30
	document.getElementById('acorde1000').style.left = (curX + offSetX1 + 20) + 'px'; //window.event.x + 30
}

function AD(pDetalhes) {
document.getElementById('acorde1000').style.display = "none";
document.getElementById('notas1000').style.display = "none";
}


-->
