//-------------------------------------------------------------------------- //
// 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 desenhaTeclado(spanId, Titulo, strAcorde){
//if (document.referrer  != '' && document.referrer.substr(0, 25) != 'http://www.tocando.com.br' && document.referrer.substr(0, 24) != 'http://www.cifras.com.br') return

//strAcorde = '1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33' //(strAcorde)
strAcorde = le(strAcorde)


spanAcorde = eval ("document.all.acorde" + spanId)
spanNotas = eval ("document.all.notas" + spanId)
arrAcorde = strAcorde.split(' ')
acorde = '<table border=0><tr><td> <br><table width=205 height=55 border=0 cellpadding="0" cellspacing="0"><tr height=68><td width=3><img src="images/teclado.png"></td></tr></table></td></tr></table>'
notas = '<table border=0><tr><td> <a href=""><b>' + Titulo + '</b></a><br><table width=205 height=68 border=0 cellpadding="0" cellspacing="0"><tr height=68><td width=3></td>'
posArray = 0
tecla = 0
for (n=1; n<=33; n++){
if (n != 6 && n != 14 && n!= 20 && n!= 28) tecla ++
if (tecla == 13) tecla = 1
if (tecla==parseInt(arrAcorde[posArray])){
if (tecla == 2 || tecla == 4 || tecla == 7 || tecla == 9 || tecla == 11)
{notas += '<td align=right width=6><br><img src=images/o_branco2.gif><br><br><br></td>'}
else
{notas += '<td align=right width=6><br><br><br><img src=images/o_preto.gif></td>'}
posArray ++}
else
{notas += '<td align=right width=6></td>'}}
notas += "<td width=6></td></tr></table></td></tr><tr><td colspan=33 align=center>"
if (spanId != 1000 && arrAcordes[spanId - 1].length > 1) 
{notas += '<a style=cursor:hand onClick=\'variaTeclado(' + spanId + ',\"' + Titulo + '\")\' class=font1>variation</a>'}
else
notas += " "
notas += "</td></tr></table>"
if (spanId != 1000) {
spanAcorde.style.left = leftX + 15;
spanNotas.style.left = leftX + 17}
spanAcorde.innerHTML = acorde;
spanNotas.innerHTML = notas;
leftX += 220
if (leftX == 660) leftX = 0}
function variaTeclado(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 % 3) == 0 ? 3 * 220 : (spanId % 3) * 220) - 220
	desenhaTeclado(spanId, Titulo, strAcorde)
}

function derivacoes(chord)
{
chord = replaceChars(chord, '+', '%2b')
chord = replaceChars(chord, '#', '%23')
window.open('frm_dicionario.asp?acorde=' + chord, 'deriva', 'width=500, height=600')
}
function replaceChars(entry, out, add)
 {
	temp = ""  + entry;
	while (temp.indexOf(out)>-1) {
	pos= temp.indexOf(out);
	temp = "" + (temp.substring(0, pos) + add + temp.substring((pos + out.length), temp.length));
	}
	return temp;
}
function replaceSubstring(inputString, fromString, toString) {
   var temp = inputString;
   if (fromString == "") {
      return inputString;
   }
   if (toString.indexOf(fromString) == -1) { 
      while (temp.indexOf(fromString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(fromString));
         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
         temp = toTheLeft + toString + toTheRight;
      }
   } else { 
      var midStrings = new Array("~", "`", "_", "^", "#");
      var midStringLen = 1;
      var midString = "";
      while (midString == "") {
         for (var i=0; i < midStrings.length; i++) {
            var tempMidString = "";
            for (var j=0; j < midStringLen; j++) { tempMidString += midStrings[i]; }
            if (fromString.indexOf(tempMidString) == -1) {
               midString = tempMidString;
               i = midStrings.length + 1;
            }
         }
      } 
	     while (temp.indexOf(fromString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(fromString));
         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
         temp = toTheLeft + midString + toTheRight;
      }
      while (temp.indexOf(midString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(midString));
         var toTheRight = temp.substring(temp.indexOf(midString)+midString.length, temp.length);
         temp = toTheLeft + toString + toTheRight;
      }
   } 
   return temp; 
} 


function le(txt)
{
	rtxt = replaceSubstring(txt,  "A" , "2")
	rtxt = replaceSubstring(rtxt, "S" , "3")
	rtxt = replaceSubstring(rtxt, "D" , "0")
	rtxt = replaceSubstring(rtxt, "F" , "1")
	rtxt = replaceSubstring(rtxt, "G" , "5")
	rtxt = replaceSubstring(rtxt, "H" , "4")
	rtxt = replaceSubstring(rtxt, "J" , "6")
	rtxt = replaceSubstring(rtxt, "K" , "7")
	rtxt = replaceSubstring(rtxt, "L" , "8")
	rtxt = replaceSubstring(rtxt, "O" , "9")
	return rtxt
}

-->
