var notes= Array("  C   ", "C#/Db ", "  D   ","D#/Eb ","  E   ","  F   ","F#/Gb ","  G   ","G#/Ab ","  A   ","A#/Bb ","  B   "); 


function checkEmail()

	{
	if (document.output.recipient.value=="")
		{
 		var x= prompt("What is your e-mail address?","")
		document.output.recipient.value=x
		}
	}

function showInstructions()
  {
  var x = "";
  x = x + "PRESET CHORDS/SCALES gives you a selected list of chords and scales.  PRESET TUNINGS gives you a list of preselected tunings for various instruments.  Uncheck those options in order to choose your own tunings & note combination." 
  x = x + "\n\n";
  x = x + "LEFTY shows a mirror image of the fretboard.  5 FRETS gives only five frets, as opposed to the whole neck.  " 
  x = x + "NOTES will give you the actual notes played as opposed to just markers (with an option to show only sharps, flats or both).  "
  x = x + "INFO will give you information about how a specific chord or scale is built.  "
  x = x + "\n\n";
  x = x + "For non-presets, you can choose your notes and your tuning one string/note at a time.";
  x = x + "\n\n";
  x = x + "You may cut and paste the chord chart into any file you ";
  x = x + "want, or use the button below to e-mail a copy to yourself.  (You will not be contacted for advertising ";
  x = x + "will not be stored on any server or used for any purposes other than to give you a ";
  x = x + "copy of your chord chart).";
  x = x + "\n";
  x = x + "------------------------";
  x = x + "\n";

  x = x + "This page is located at http://songweaver.com/guitar/";

 document.output.stringset.value = x;
  }

function showIntro()
  {
  var x = "";
  x = x + "This is a music theory tool designed to help guitarists (and other fretted instrument players) create chord and fingering charts for any tunings, chords or scales they desire."
  x = x + "\n\n";
  x = x + "Click on the INSTRUCTIONS button if any part of it is unclear."
  x = x + "\n\n";
  x = x + "Feel free to click on the SUPPORT THIS SITE link if you'd like to help pay for the maintence of this site."
  x = x + "\n\n";
  x = x + "------------------------";
  x = x + "\n";

  x = x + "This page is located at http://songweaver.com/guitar/";

 document.output.stringset.value = x;
  }


function showFeedback()
  {
  var x = "";
  x = x + "I'd love to hear what you have to have to say about this page."
  x = x + "\n\n";
  x = x + "If you'd like to leave a comment, suggestion, etc., about this site, just type it into this window, enter your e-mail address below, and click on the SEND ME A COPY button";

 document.output.stringset.value = x;
  }


function MakeArray (size)
  {
  this.length = size
  for (var i = 0; i <= size; i++)
 	   {this[i]=0}
   return this
   }


function showChords() 
   {
   strings = new MakeArray (6);
   reverse = new MakeArray (6);
   modes = new MakeArray (30);
   descr = new MakeArray (30);
   selectedNotes = new MakeArray (9);
   
if (document.layout.presets.checked)
   {
     selectedNotes[1] = document.layout.key.options[document.layout.key.selectedIndex].value % 12
   if (document.layout.mode.options[document.layout.mode.selectedIndex].value == 0)
     {
     selectedNotes[2] = (selectedNotes[1] + 2) % 12
     selectedNotes[3] = (selectedNotes[1] + 4) % 12
     selectedNotes[4] = (selectedNotes[1] + 5) % 12
     selectedNotes[5] = (selectedNotes[1] + 7) % 12
     selectedNotes[6] = (selectedNotes[1] + 9) % 12
     selectedNotes[7] = (selectedNotes[1] + 11) % 12
     }
   if (document.layout.mode.options[document.layout.mode.selectedIndex].value == 1)
     {
     selectedNotes[2] = (selectedNotes[1] + 2) % 12
     selectedNotes[3] = (selectedNotes[1] + 3) % 12
     selectedNotes[4] = (selectedNotes[1] + 5) % 12
     selectedNotes[5] = (selectedNotes[1] + 7) % 12
     selectedNotes[6] = (selectedNotes[1] + 8) % 12
     selectedNotes[7] = (selectedNotes[1] + 11) % 12
     }
   if (document.layout.mode.options[document.layout.mode.selectedIndex].value == 2)
     {
     selectedNotes[2] = (selectedNotes[1] + 2) % 12
     selectedNotes[3] = (selectedNotes[1] + 3) % 12
     selectedNotes[4] = (selectedNotes[1] + 5) % 12
     selectedNotes[5] = (selectedNotes[1] + 7) % 12
     selectedNotes[6] = (selectedNotes[1] + 8) % 12
     selectedNotes[7] = (selectedNotes[1] + 10) % 12
     }
   if (document.layout.mode.options[document.layout.mode.selectedIndex].value == 3)
     {
     selectedNotes[2] = (selectedNotes[1] + 2) % 12
     selectedNotes[3] = (selectedNotes[1] + 3) % 12
     selectedNotes[4] = (selectedNotes[1] + 5) % 12
     selectedNotes[5] = (selectedNotes[1] + 7) % 12
     selectedNotes[6] = (selectedNotes[1] + 9) % 12
     selectedNotes[7] = (selectedNotes[1] + 10) % 12
     }
   if (document.layout.mode.options[document.layout.mode.selectedIndex].value == 4)
     {
     selectedNotes[2] = (selectedNotes[1] + 2) % 12
     selectedNotes[3] = (selectedNotes[1] + 4) % 12
     selectedNotes[4] = (selectedNotes[1] + 6) % 12
     selectedNotes[5] = (selectedNotes[1] + 7) % 12
     selectedNotes[6] = (selectedNotes[1] + 9) % 12
     selectedNotes[7] = (selectedNotes[1] + 11) % 12
     }
   if (document.layout.mode.options[document.layout.mode.selectedIndex].value == 5)
     {
     selectedNotes[2] = (selectedNotes[1] + 2) % 12
     selectedNotes[3] = (selectedNotes[1] + 4) % 12
     selectedNotes[4] = (selectedNotes[1] + 5) % 12
     selectedNotes[5] = (selectedNotes[1] + 7) % 12
     selectedNotes[6] = (selectedNotes[1] + 9) % 12
     selectedNotes[7] = (selectedNotes[1] + 10) % 12
     }
   if (document.layout.mode.options[document.layout.mode.selectedIndex].value == 6)
     {
     selectedNotes[2] = (selectedNotes[1] + 1) % 12
     selectedNotes[3] = (selectedNotes[1] + 3) % 12
     selectedNotes[4] = (selectedNotes[1] + 5) % 12
     selectedNotes[5] = (selectedNotes[1] + 7) % 12
     selectedNotes[6] = (selectedNotes[1] + 8) % 12
     selectedNotes[7] = (selectedNotes[1] + 10) % 12
     }
   if (document.layout.mode.options[document.layout.mode.selectedIndex].value == 7)
     {
     selectedNotes[2] = (selectedNotes[1] + 1) % 12
     selectedNotes[3] = (selectedNotes[1] + 3) % 12
     selectedNotes[4] = (selectedNotes[1] + 5) % 12
     selectedNotes[5] = (selectedNotes[1] + 6) % 12
     selectedNotes[6] = (selectedNotes[1] + 8) % 12
     selectedNotes[7] = (selectedNotes[1] + 10) % 12
     }
   if (document.layout.mode.options[document.layout.mode.selectedIndex].value == 8)
     {
     selectedNotes[2] = (selectedNotes[1] + 3) % 12
     selectedNotes[3] = (selectedNotes[1] + 5) % 12
     selectedNotes[4] = (selectedNotes[1] + 7) % 12
     selectedNotes[5] = (selectedNotes[1] + 10) % 12
     selectedNotes[6] = selectedNotes[1]
     selectedNotes[7] = selectedNotes[1]
     }
   if (document.layout.mode.options[document.layout.mode.selectedIndex].value == 9)
     {
     selectedNotes[2] = (selectedNotes[1] + 2) % 12
     selectedNotes[3] = (selectedNotes[1] + 4) % 12
     selectedNotes[4] = (selectedNotes[1] + 7) % 12
     selectedNotes[5] = (selectedNotes[1] + 9) % 12
     selectedNotes[6] = selectedNotes[1]
     selectedNotes[7] = selectedNotes[1]
     }
  if (document.layout.mode.options[document.layout.mode.selectedIndex].value == 10)
     {
     selectedNotes[2] = (selectedNotes[1] + 4) % 12
     selectedNotes[3] = (selectedNotes[1] + 7) % 12
     for (i = 4; i <= 7; i++)
 	   {selectedNotes[i]=selectedNotes[1]}
     }
   if (document.layout.mode.options[document.layout.mode.selectedIndex].value == 11)
     {
     selectedNotes[2] = (selectedNotes[1] + 3) % 12
     selectedNotes[3] = (selectedNotes[1] + 7) % 12
     for (i = 4; i <= 7; i++)
 	   {selectedNotes[i]=selectedNotes[1]}
     }
   if (document.layout.mode.options[document.layout.mode.selectedIndex].value == 12)
     {
     selectedNotes[2] = (selectedNotes[1] + 4) % 12
     selectedNotes[3] = (selectedNotes[1] + 7) % 12
     selectedNotes[4] = (selectedNotes[1] + 10) % 12
     for (i = 5; i <= 7; i++)
 	   {selectedNotes[i]=selectedNotes[1]}
     }
   if (document.layout.mode.options[document.layout.mode.selectedIndex].value == 13)
     {
     selectedNotes[2] = (selectedNotes[1] + 4) % 12
     selectedNotes[3] = (selectedNotes[1] + 7) % 12
     selectedNotes[4] = (selectedNotes[1] + 11) % 12
     for (i = 5; i <= 7; i++)
 	   {selectedNotes[i]=selectedNotes[1]}
     }
   if (document.layout.mode.options[document.layout.mode.selectedIndex].value == 14)
     {
     selectedNotes[2] = (selectedNotes[1] + 3) % 12
     selectedNotes[3] = (selectedNotes[1] + 7) % 12
     selectedNotes[4] = (selectedNotes[1] + 10) % 12
     for (i = 5; i <= 7; i++)
 	   {selectedNotes[i]=selectedNotes[1]}
     }
   if (document.layout.mode.options[document.layout.mode.selectedIndex].value == 15)
     {
     selectedNotes[2] = (selectedNotes[1] + 3) % 12
     selectedNotes[3] = (selectedNotes[1] + 6) % 12
     selectedNotes[4] = (selectedNotes[1] + 10) % 12
     for (i = 5; i <= 7; i++)
 	   {selectedNotes[i]=selectedNotes[1]}
     }
   if (document.layout.mode.options[document.layout.mode.selectedIndex].value == 16)
     {
     selectedNotes[2] = (selectedNotes[1] + 3) % 12
     selectedNotes[3] = (selectedNotes[1] + 6) % 12
     selectedNotes[4] = (selectedNotes[1] + 9) % 12
     for (i = 5; i <= 7; i++)
 	   {selectedNotes[i]=selectedNotes[1]}
     }
   if (document.layout.mode.options[document.layout.mode.selectedIndex].value == 17)
     {
     selectedNotes[2] = (selectedNotes[1] + 4) % 12
     selectedNotes[3] = (selectedNotes[1] + 7) % 12
     selectedNotes[4] = (selectedNotes[1] + 10) % 12
     selectedNotes[5] = (selectedNotes[1] + 2) % 12
     for (i = 6; i <= 7; i++)
 	   {selectedNotes[i]=selectedNotes[1]}
     }
   if (document.layout.mode.options[document.layout.mode.selectedIndex].value == 18)
     {
     selectedNotes[2] = (selectedNotes[1] + 4) % 12
     selectedNotes[3] = (selectedNotes[1] + 7) % 12
     selectedNotes[4] = (selectedNotes[1] + 10) % 12
     selectedNotes[5] = (selectedNotes[1] + 3) % 12
     for (i = 6; i <= 7; i++)
 	   {selectedNotes[i]=selectedNotes[1]}
     }
   if (document.layout.mode.options[document.layout.mode.selectedIndex].value == 19)
     {
     selectedNotes[2] = (selectedNotes[1] + 4) % 12
     selectedNotes[3] = (selectedNotes[1] + 7) % 12
     selectedNotes[4] = (selectedNotes[1] + 9) % 12
     for (i = 5; i <= 7; i++)
 	   {selectedNotes[i]=selectedNotes[1]}
     }
   if (document.layout.mode.options[document.layout.mode.selectedIndex].value == 20)
     {
     selectedNotes[2] = (selectedNotes[1] + 4) % 12
     selectedNotes[3] = (selectedNotes[1] + 7) % 12
     selectedNotes[4] = (selectedNotes[1] + 2) % 12
     selectedNotes[5] = (selectedNotes[1] + 9) % 12
     for (i = 6; i <= 7; i++)
 	   {selectedNotes[i]=selectedNotes[1]}
     }
   if (document.layout.mode.options[document.layout.mode.selectedIndex].value == 21)
     {
     selectedNotes[2] = (selectedNotes[1] + 2) % 12
     selectedNotes[3] = (selectedNotes[1] + 7) % 12
     for (i = 4; i <= 7; i++)
 	   {selectedNotes[i]=selectedNotes[1]}
     }
   if (document.layout.mode.options[document.layout.mode.selectedIndex].value == 22)
     {
     selectedNotes[2] = (selectedNotes[1] + 5) % 12
     selectedNotes[3] = (selectedNotes[1] + 7) % 12
     for (i = 4; i <= 7; i++)
 	   {selectedNotes[i]=selectedNotes[1]}
     }
   if (document.layout.mode.options[document.layout.mode.selectedIndex].value == 23)
     {
     selectedNotes[2] = (selectedNotes[1] + 2) % 12
     selectedNotes[3] = (selectedNotes[1] + 3) % 12
     selectedNotes[4] = (selectedNotes[1] + 5) % 12
     selectedNotes[5] = (selectedNotes[1] + 7) % 12
     selectedNotes[6] = (selectedNotes[1] + 9) % 12
     selectedNotes[7] = (selectedNotes[1] + 11) % 12
     }
   if (document.layout.mode.options[document.layout.mode.selectedIndex].value == 24)
     {
     selectedNotes[2] = (selectedNotes[1] + 4) % 12
     selectedNotes[3] = (selectedNotes[1] + 7) % 12
     selectedNotes[4] = (selectedNotes[1] + 11) % 12
     selectedNotes[5] = (selectedNotes[1] + 6) % 12
     for (i = 6; i <= 7; i++)
 	   {selectedNotes[i]=selectedNotes[1]}
     }
   if (document.layout.mode.options[document.layout.mode.selectedIndex].value == 25)
     {
     selectedNotes[2] = (selectedNotes[1] + 4) % 12
     selectedNotes[3] = (selectedNotes[1] + 8) % 12
     for (i = 4; i <= 7; i++)
 	   {selectedNotes[i]=selectedNotes[1]}
     }
   } 
  else
     {
       selectedNotes[1] = document.layout.noteA.options[document.layout.noteA.selectedIndex].value

     if (document.layout.noteB.options[document.layout.noteB.selectedIndex].value >= 0)
       {selectedNotes[2] = document.layout.noteB.options[document.layout.noteB.selectedIndex].value}
     else 
       {selectedNotes[2] = selectedNotes[1]}

     if (document.layout.noteC.options[document.layout.noteC.selectedIndex].value >= 0)
       {selectedNotes[3] = document.layout.noteC.options[document.layout.noteC.selectedIndex].value}
     else 
       {selectedNotes[3] = selectedNotes[1]}

     if (document.layout.noteD.options[document.layout.noteD.selectedIndex].value >= 0)
       {selectedNotes[4] = document.layout.noteD.options[document.layout.noteD.selectedIndex].value}
     else 
       {selectedNotes[4] = selectedNotes[1]}

     if (document.layout.noteE.options[document.layout.noteE.selectedIndex].value >= 0)
       {selectedNotes[5] = document.layout.noteE.options[document.layout.noteE.selectedIndex].value}
     else 
       {selectedNotes[5] = selectedNotes[1]}

     if (document.layout.noteF.options[document.layout.noteF.selectedIndex].value >= 0)
       {selectedNotes[6] = document.layout.noteF.options[document.layout.noteF.selectedIndex].value}
     else 
       {selectedNotes[6] = selectedNotes[1]}

     if (document.layout.noteG.options[document.layout.noteG.selectedIndex].value >= 0)
       {selectedNotes[7] = document.layout.noteG.options[document.layout.noteG.selectedIndex].value}
     else 
       {selectedNotes[7] = selectedNotes[1]}
    }

   
   var i = 0;
   var x = "";
   var startFret = 0;
   var endFret = 4;
   var startString = 1;
   var endString = 6;
   var playChar="*";
     if (document.layout.accidentals.options[document.layout.accidentals.selectedIndex].value == 1)
	{
	   notes[1] =	"  C#  ";
	   notes[3] =	"  D#  ";
	   notes[6] =	"  F#  ";
	   notes[8] =	"  G#  ";
	   notes[10] =	"  A#  ";
	}  
     if (document.layout.accidentals.options[document.layout.accidentals.selectedIndex].value == 2)
	{
	   notes[1] =	"  Db  ";
	   notes[3] =	"  Eb  ";
	   notes[6] =	"  Gb  ";
	   notes[8] =	"  Ab  ";
	   notes[10] =	"  Bb  ";
	}  

   for (i = 12; i <= 24; i++)
 	   {notes[i] = notes[i-12]}
   modes[0] =  "Ionic Mode (Major Key) ";
   modes[1] =  "Harmonic Minor Scale   ";
   modes[2] =  "Aeolian Mode           ";
   modes[3] =  "Dorian Mode            ";
   modes[4] =  "Lydian Mode            ";
   modes[5] =  "Mixolydian Mode        ";
   modes[6] =  "Phrygian Mode          ";
   modes[7] =  "Locrian Mode           ";
   modes[8] =  "Blues Scale            ";
   modes[9] =  "Pentatonic Scale       ";
   modes[10] = "Major Chord            ";
   modes[11] = "Minor Chord            ";
   modes[12] = "7th Chord              ";
   modes[13] = "Major 7th Chord        ";
   modes[14] = "Minor 7th Chord        ";
   modes[15] = "Minor 7b5 Chord        ";
   modes[16] = "Diminished Chord       ";
   modes[17] = "9th Chord              ";
   modes[18] = "7#9 Chord              ";
   modes[19] = "6th Chord              ";
   modes[20] = "6/9 Chord              ";   
   modes[21] = "Sus2 Chord             ";   
   modes[22] = "Sus4 Chord             ";   
   modes[23] = "Melodic Minor Scale    ";   
   modes[24] = "Major 7th(#11) Chord   ";
   modes[25] = "Augmented Chord        ";

   for (i = 0; i <= 30; i++)
 	   {descr[i] = "No chord or scale information currently available."}

   descr[0] = "The major (ionic) scale is one of the most common scales.  In the key of C it consists of all natural tones.";

   descr[1] = "The harmonic minor scale is a traditional minor (aeolian) scale, with the exception that it has a raised 7th, to create a leading tone.  For example, aeolian in the key of A would be all natural tones, except that the G is raised to a G#.";

   descr[2] = "Aeolian mode is a pure minor scale, with no note alterations.  It is like the major scale, with lowered 3rd, 6th and 7th.  Starting on the 6th tone of an Ionic scale will create an Aeolian scale.  Aeolian in the key of A consists of all natural tones.";

   descr[3] = "Dorian mode is a minor (aeolian) scale, but without the lowered 6th.  Starting on the 2nd tone of an Ionic scale will create a Dorian scale. D-Dorian mode consists of all natural tones.";

   descr[4] = "Lydian mode is a major scale with a raised fourth.  Starting on the 4th note of an Ionic scale will create Lydian mode. F-Lydian consists of all natural tones.";

   descr[5] = "Mixolydian mode is a major scale with a lowered 7th.  Starting on the 5th note of an Ionic scale will create Moxilydian mode.  G-Mixolydian consists of all natural tones.";

   descr[6] = "Phrygian mode is a minor (aeolian) scale with a lowered 2nd.   Starting on the 3rd tone of an Ionic scale will create a Phrygian scale.  E-Phrygian consists of all natural tones.";

   descr[7] = "Locrian mode is a minor (aeolian) scale with a lowered 2nd and 5th.   Starting on the 7th tone of an Ionic scale will create an Locrian scale.  B-Locrian consists of all natural tones.";

   descr[8] = "Pentatonic scales are 5-note minor scales.  They use the 1st, 3rd, 4th, 5th and 7th notes of an Aeolian minor scale.  A-minor-pent for example, would be A, C, D, E, G.";

   descr[9] = "A common major pentatonic (5-note) scale is to use the 1st, 2nd, 3rd, 5th, and 6th of a major scale.  C-pentatonic, for example, would be C, D, E, G, A.";

   descr[10] = "Major chords use the 1st, 3rd and 5th tones of the major key.  C-Major, for example, would be C, E, G."
   descr[11] = "Minor chords use the 1st, 3rd and 5th tones of the minor key.  A-Minor, for example, would be A, C, E."  
   descr[12] = "7th chords use the 1st, 3rd, 5th and lowered 7th notes of the major key.  C7, for example, would be C, E, G, Bb."
   descr[13] = "Major 7th chords use the 1st, 3rd, 5th and 7th notes of a major key.  Cmaj7, for example, would be C, E, G, B."
   descr[14] = "Minor 7th chords use the 1st, 3rd, 5th and 7th notes of a minor key.  Amin7, for example, would be A C, E, G."
   descr[15] = "Minor 7th chords use the 1st, 3rd, lowered 5th and 7th notes of a minor key.  Amin7, for example, would be A C, Eb, G."
   descr[16] = "Diminished chords use the 1st, 3rd, lowered 5th and lowered 7th notes of a minor key.  Adim, for example, would be A, C, Eb, Gb."
   descr[17] = "9th chords are like 7th chords, with an added 9th.  C9, for example, would be C, E, G, Bb, D"
   descr[18] = "7#9th chords are like 7th chords, with an added raised 9th.  C9, for example, would be C, E, G, Bb, D#"
   descr[19] = "6th chords use the 1st, 3rd, 5th and 6th notes of a major key.  C6, for example, would be C, E, G, A."
   descr[20] = "6/9 chords use the 1st, 3rd, 5th, 6th and 9th notes of a major key.  C6/9, for example, would be C, E, G, A, D."
   descr[21] = "Sus2 chords use the 1st, 2nd and 5th notes of a major key.  Csus2, for example, would be C, D, G."
   descr[22] = "Sus4 chords use the 1st, 4th and 5th notes of a major key.  Csus4, for example, would be C, F, G."
   descr[23] = "The melodic minor scale is a traditional minor (aeolian) scale, with the exception that it has a raised 6th and 7th.  For example, aeolian in the key of A would be all natural tones, except that the F is raised to an F# and the G is raised to a G#.";
   descr[24] = "Major 7th(#11) chords use the 1st, 3rd, 5th, 7th notes of a major key with a raised 11th.  Cmaj7(#11), for example, would be C, E, G, B, F#."
   descr[25] = "Augmented chords use the 1st, 3rd and raised 5th notes of a major key.  Caug, for example, would be C, E, G#."

if (document.layout.pretuning.checked)
   {
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 0)
     {
     document.layout.fourString.checked = (1==2);
     strings[6] = 4;
     strings[5] = 11;
     strings[4] = 7;
     strings[3] = 2;
     strings[2] = 9;
     strings[1] = 4;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 1)
     {
     document.layout.fourString.checked = (1==2);
     strings[6] = 4;
     strings[5] = 11;
     strings[4] = 7;
     strings[3] = 2;
     strings[2] = 9;
     strings[1] = 2;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 2)
     {
     document.layout.fourString.checked = (1==2);
     strings[6] = 2;
     strings[5] = 11;
     strings[4] = 7;
     strings[3] = 2;
     strings[2] = 9;
     strings[1] = 2;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 3)
     {
     document.layout.fourString.checked = (1==2);
     strings[6] = 2;
     strings[5] = 9;
     strings[4] = 6;
     strings[3] = 2;
     strings[2] = 9;
     strings[1] = 2;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 4)
     {
     document.layout.fourString.checked = (1==2);
     strings[6] = 2;
     strings[5] = 9;
     strings[4] = 7;
     strings[3] = 2;
     strings[2] = 9;
     strings[1] = 2;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 5)
     {
     document.layout.fourString.checked = (1==2);
     strings[6] = 2;
     strings[5] = 11;
     strings[4] = 7;
     strings[3] = 2;
     strings[2] = 7;
     strings[1] = 2;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 6)
     {
     document.layout.fourString.checked = (1==2);
     strings[6] = 4;
     strings[5] = 11;
     strings[4] = 7;
     strings[3] = 2;
     strings[2] = 7;
     strings[1] = 2;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 7)
     {
     document.layout.fourString.checked = (1==2);
     strings[6] = 4;
     strings[5] = 11;
     strings[4] = 6;
     strings[3] = 2;
     strings[2] = 9;
     strings[1] = 4;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 8)
     {
     document.layout.fourString.checked = (1==2);
     strings[6] = 4;
     strings[5] = 0;
     strings[4] = 7;
     strings[3] = 0;
     strings[2] = 7;
     strings[1] = 0;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 9)
     {
     document.layout.fourString.checked = (1==2);
     strings[6] = 4;
     strings[5] = 11;
     strings[4] = 8;
     strings[3] = 4;
     strings[2] = 8;
     strings[1] = 4;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 10)
     {
     document.layout.fourString.checked = (1==2);
     strings[6] = 4;
     strings[5] = 11;
     strings[4] = 8;
     strings[3] = 2;
     strings[2] = 8;
     strings[1] = 4;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 11)
     {
     document.layout.fourString.checked = (1==2);
     strings[6] = 4;
     strings[5] = 11;
     strings[4] = 7;
     strings[3] = 2;
     strings[2] = 9;
     strings[1] = 0;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 12)
     {
     document.layout.fourString.checked = (1==2);
     strings[6] = 4;
     strings[5] = 11;
     strings[4] = 7;
     strings[3] = 2;
     strings[2] = 7;
     strings[1] = 0;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 13)
     {
     document.layout.fourString.checked = (1==1);
     strings[6] = 0;
     strings[5] = 0;
     strings[4] = 2;
     strings[3] = 11;
     strings[2] = 7;
     strings[1] = 0;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 14)
     {
     document.layout.fourString.checked = (1==1);
     strings[6] = 0;
     strings[5] = 0;
     strings[4] = 2;
     strings[3] = 11;
     strings[2] = 7;
     strings[1] = 2;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 15)
     {
     document.layout.fourString.checked = (1==1);
     strings[6] = 0;
     strings[5] = 0;
     strings[4] = 4;
     strings[3] = 9;
     strings[2] = 2;
     strings[1] = 7;
     }
  if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 16)
     {
     document.layout.fourString.checked = (1==1);
     strings[6] = 0;
     strings[5] = 0;
     strings[4] = 11;
     strings[3] = 6;
     strings[2] = 2;
     strings[1] = 9;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 17)
     {
     document.layout.fourString.checked = (1==1);
     strings[6] = 0;
     strings[5] = 0;
     strings[4] = 9;
     strings[3] = 6;
     strings[2] = 2;
     strings[1] = 9;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 18)
     {
     document.layout.fourString.checked = (1==1);
     strings[6] = 0;
     strings[5] = 0;
     strings[4] = 7;
     strings[3] = 2;
     strings[2] = 9;
     strings[1] = 4;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 19)
     {
     document.layout.fourString.checked = (1==1);
     strings[6] = 0;
     strings[5] = 0;
     strings[4] = 3;
     strings[3] = 10;
     strings[2] = 7;
     strings[1] = 3;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 21)
     {
     document.layout.fourString.checked = (1==0);
     strings[6] = 9;
     strings[5] = 4;
     strings[4] = 0;
     strings[3] = 7;
     strings[2] = 2;
     strings[1] = 9;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 22)
     {
     document.layout.fourString.checked = (1==2);
     strings[6] = 3;
     strings[5] = 10;
     strings[4] = 6;
     strings[3] = 1;
     strings[2] = 8;
     strings[1] = 3;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 23)
     {
     document.layout.fourString.checked = (1==2);
     strings[6] = 2;
     strings[5] = 9;
     strings[4] = 5;
     strings[3] = 0;
     strings[2] = 7;
     strings[1] = 2;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 24)
     {
     document.layout.fourString.checked = (1==1);
     strings[6] = 0;
     strings[5] = 0;
     strings[4] = 3;
     strings[3] = 0;
     strings[2] = 8;
     strings[1] = 3;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 25)
     {
     document.layout.fourString.checked = (1==1);
     strings[6] = 0;
     strings[5] = 0;
     strings[4] = 1;
     strings[3] = 10;
     strings[2] = 6;
     strings[1] = 1;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 26)
     {
     document.layout.fourString.checked = (1==1);
     strings[6] = 0;
     strings[5] = 0;
     strings[4] = 7;
     strings[3] = 2;
     strings[2] = 9;
     strings[1] = 2;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 27)
     {
     document.layout.fourString.checked = (1==1);
     strings[6] = 0;
     strings[5] = 0;
     strings[4] = 9;
     strings[3] = 2;
     strings[2] = 7;
     strings[1] = 0;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 28)
     {
     document.layout.fourString.checked = (1==1);
     strings[6] = 0;
     strings[5] = 0;
     strings[4] = 7;
     strings[3] = 2;
     strings[2] = 7;
     strings[1] = 0;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 29)
     {
     document.layout.fourString.checked = (1==1);
     strings[6] = 0;
     strings[5] = 0;
     strings[4] = 2;
     strings[3] = 9;
     strings[2] = 7;
     strings[1] = 2;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 30)
     {
     document.layout.fourString.checked = (1==1);
     strings[6] = 0;
     strings[5] = 0;
     strings[4] = 4;
     strings[3] = 11;
     strings[2] = 7;
     strings[1] = 2
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 31)
     {
     document.layout.fourString.checked = (1==1);
     strings[6] = 0;
     strings[5] = 0;
     strings[4] = 9;
     strings[3] = 2;
     strings[2] = 9;
     strings[1] = 2;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 32)
     {
     document.layout.fourString.checked = (1==1);
     strings[6] = 0;
     strings[5] = 0;
     strings[4] = 7;
     strings[3] = 2;
     strings[2] = 10;
     strings[1] = 5;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 33)
     {
     document.layout.fourString.checked = (1==1);
     strings[6] = 0;
     strings[5] = 0;
     strings[4] = 6;
     strings[3] = 1;
     strings[2] = 9;
     strings[1] = 4;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 34)
     {
     document.layout.fourString.checked = (1==2);
     strings[6] = 1;
     strings[5] = 8;
     strings[4] = 4;
     strings[3] = 11;
     strings[2] = 6;
     strings[1] = 1;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 35)
     {
     document.layout.fourString.checked = (1==2);
     strings[6] = 5;
     strings[5] = 0;
     strings[4] = 8;
     strings[3] = 3;
     strings[2] = 10;
     strings[1] = 5;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 36)
     {
     document.layout.fourString.checked = (1==1);
     strings[6] = 0;
     strings[5] = 0;
     strings[4] = 2;
     strings[3] = 9;
     strings[2] = 6;
     strings[1] = 2;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 37)
     {
     document.layout.fourString.checked = (1==2);
     strings[6] =4;
     strings[5] =9;
     strings[4] =7;
     strings[3] =2;
     strings[2] =7;
     strings[1] =0;            
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 38)
     {
     document.layout.fourString.checked = (1==2);
     strings[6] =1;
     strings[5] =9;
     strings[4] =6;
     strings[3] =2;
     strings[2] =9;
     strings[1] =2;            
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 39)
     {
     document.layout.fourString.checked = (1==2);
     strings[6] =0;
     strings[5] =9;
     strings[4] =6;
     strings[3] =2;
     strings[2] =9;
     strings[1] =2;            
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 40)
     {
     document.layout.fourString.checked = (1==2);
     strings[6] =2;
     strings[5] =9;
     strings[4] =4;
     strings[3] =2;
     strings[2] =9;
     strings[1] =2;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 41)
     {
     document.layout.fourString.checked = (1==2);
     strings[6] =4;
     strings[5] =9;
     strings[4] =7;
     strings[3] =0;
     strings[2] =7;
     strings[1] =0;            
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 42)
     {
     document.layout.fourString.checked = (1==2);
     strings[6] =2;
     strings[5] =10;
     strings[4] =7;
     strings[3] =2;
     strings[2] =7;
     strings[1] =2;            
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 43)
     {
     document.layout.fourString.checked = (1==2);
     strings[6] =4;
     strings[5] =11;
     strings[4] =7;
     strings[3] =4;
     strings[2] =11;
     strings[1] =4;
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 44)
     {
     document.layout.fourString.checked = (1==2);
     strings[6] =5;
     strings[5] =0;
     strings[4] =7;
     strings[3] =2;
     strings[2] =9;
     strings[1] =4;     
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 45)
     {
     document.layout.fourString.checked = (1==2);
     strings[6] =4;
     strings[5] =11;
     strings[4] =4;
     strings[3] =4;
     strings[2] =9;
     strings[1] =4;     
     }
   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 46)
     {
     document.layout.fourString.checked = (1==1);
     strings[6] =4;
     strings[5] =11;
     strings[4] =7;
     strings[3] =2;
     strings[2] =9;
     strings[1] =9;
     }

   if (document.layout.tunings.options[document.layout.tunings.selectedIndex].value == 47)
     {
     document.layout.fourString.checked = (1==1);
     strings[6] =4;
     strings[5] =11;
     strings[4] =2;
     strings[3] =9;
     strings[2] =2;
     strings[1] =7;
     }
 }
else
   {
   strings[6] = (document.layout.HiEstring.options[document.layout.HiEstring.selectedIndex].value % 100);
   strings[5] = (document.layout.Bstring.options[document.layout.Bstring.selectedIndex].value % 100);
   strings[4] = (document.layout.Gstring.options[document.layout.Gstring.selectedIndex].value % 100);
   strings[3] = (document.layout.Dstring.options[document.layout.Dstring.selectedIndex].value % 100);
   strings[2] = (document.layout.Astring.options[document.layout.Astring.selectedIndex].value % 100)
   strings[1] = (document.layout.LoEstring.options[document.layout.LoEstring.selectedIndex].value % 100)
   }

if (document.layout.lefty.checked)
   {
   reverse[1] = strings[6];
   reverse[2] = strings[5];
   reverse[3] = strings[4];
   reverse[4] = strings[3];
   reverse[5] = strings[2];
   reverse[6] = strings[1];   
   strings[1] = reverse[1];
   strings[2] = reverse[2];
   strings[3] = reverse[3];
   strings[4] = reverse[4];
   strings[5] = reverse[5];
   strings[6] = reverse[6];
   }
if (document.layout.presets.checked)
  { 
   x = "";
if (document.layout.lefty.checked)
		{x = x + "LEFT-HAND MODE\n\n"}

   var mode = document.layout.mode.options[document.layout.mode.selectedIndex].value;
   if (document.layout.showInfo.checked && (mode == 0 || mode == 2 || mode == 3 || mode == 4 || mode == 5 || mode == 6 || mode == 7) )
       {
       if (mode == 0 || mode == 2 || mode == 3 || mode == 4 || mode == 5 || mode == 6 || mode == 7)
          {key = document.layout.key.options[document.layout.key.selectedIndex].value % 12
           if (mode == 2)
              {key = (key + 3);
                mode = 0}
           if (mode == 3)
              {key = (key + 10);
                mode = 0}
           if (mode == 4)
              {key = (key + 7);
                mode = 0}
           if (mode == 5)
              {key = (key + 5);
                mode = 0}
           if (mode == 6)
              {key = (key + 8);
                mode = 0}
           if (mode == 7)
              {key = (key + 1);
                mode = 0}
           x = x + notes[(key) % 12];
           x = x + modes[(mode) % 100];
	   x = x + "\n";      
           x = x + notes[(key+2) % 12];
           x = x + modes[(mode + 3) % 100];
	   x = x + "\n";      
           x = x + notes[(key+4) % 12];
           x = x + modes[(mode + 6) % 100];
	   x = x + "\n";
           x = x + notes[(key+5) % 12];
           x = x + modes[(mode + 4) % 100];
	   x = x + "\n";
           x = x + notes[(key+7) % 12];
           x = x + modes[(mode + 5) % 100];
	   x = x + "\n";
	   x = x + notes[(key+9) % 12];
           x = x + modes[(mode + 2) % 100];
	   x = x + "\n";      
	   x = x + notes[(key+11) % 12];
           x = x + modes[(mode + 7) % 100];
           }      
       }
    else
       {
    x = x + notes[document.layout.key.options[document.layout.key.selectedIndex].value]
    x = x + modes[document.layout.mode.options[document.layout.mode.selectedIndex].value]
       }
  startFret = document.layout.startingFret.options[document.layout.startingFret.selectedIndex].value % 12;

  if (startFret == 1)
    {}
  else if (startFret == 2)
    {x = x + "Capo: I"}
  else if (startFret == 3)
    {x = x + "Capo: II"}
  else if (startFret == 4)
    {x = x + "Capo: III"}
  else if (startFret == 5)
    {x = x + "Capo: IV"}
  else if (startFret == 6)
    {x = x + "Capo: V"}
  else if (startFret == 7)
    {x = x + "Capo: VI"}
  else if (startFret == 8)
    {x = x + "Capo: VII"}
  else if (startFret == 9)
    {x = x + "Capo: VIII"}
  else if (startFret == 10)
    {x = x + "Capo: IX"}
  else if (startFret == 11)
    {x = x + "Capo: X"}
    if (document.layout.showInfo.checked)
      {x = x + "\n" + descr[document.layout.mode.options[document.layout.mode.selectedIndex].value]
       x = x + "\n\n"
      }
  }
else
 {
 x = "Notes:  "
    x = x + notes[selectedNotes[1]] + "\n"
    for (i = 2; i <= 7; i++)
       {if (selectedNotes[i] != selectedNotes[i-1] && selectedNotes[i] != selectedNotes[1])
          {x = x + "        " + notes[selectedNotes[i]] + "\n"}
        }
 }

   if (document.layout.fourString.checked)
      {  if (document.layout.lefty.checked)
            {startString=3;
             endString=6      }
       else
            {startString=1;
             endString=4      }
       }


  if (document.layout.fourString.checked)
     {x = x + "\n      *******OPEN********"}
  else
     {x = x + "\n      *************OPEN**************";}
  x = x + "\n    ";
    
if (document.layout.presets.checked)
	{temp=1}
else 	{temp=0}

    for (i = startString; i <= endString; i++)
      {x = x + notes[(strings[i]+startFret-temp)%12]}
  x = x + "\n";
  x = x + "\n      ";
  i = 0;

  for (n = startString; n <= endString; n++)
      {
      if ( (strings[n] + i + startFret-temp) % 12 == selectedNotes[1] || (strings[n] + i +startFret-temp) % 12 == selectedNotes[2] || (strings[n] + i +startFret-temp) % 12 == selectedNotes[3] || (strings[n] + i +startFret-temp) % 12 == selectedNotes[4] || (strings[n] + i +startFret-temp) % 12 == selectedNotes[5] || (strings[n] + i +startFret-temp) % 12 == selectedNotes[6] || (strings[n] + i +startFret-temp) % 12 == selectedNotes[7] )
          {x = x + "O     "}
	else
          {x = x + "X     "}
      }

  x = x + "\n";


  startFret = document.layout.startingFret.options[document.layout.startingFret.selectedIndex].value % 12;
if (document.layout.firstpos.checked)
   {endFret = startFret+5}
else
   {endFret = 15}

  for (i = startFret; i < endFret; i++)
   {        


  x = x + "      ";
    for (n = startString; n < endString; n++)  
       {if (i == startFret)
            {x = x + "+====="}
         else         
            {x = x + "+-----"}
        }
  x = x + "+\n";
  x = x + "      ";
    for (n = startString; n < endString; n++)  
       {x = x + "|     "}
  x = x + "|\n";
  x = x + "  ";
   if (i >= 1)
     { x = x + i }
   else 
     { x = x + " "}
 
  if (i <= 9)
     {x = x + " "}

  for (n = startString; n <= endString; n++)
      {
      if ( (strings[n] + i) % 12 == selectedNotes[1] || (strings[n] + i) % 12 == selectedNotes[2] || (strings[n] + i) % 12 == selectedNotes[3] || (strings[n] + i) % 12 == selectedNotes[4] || (strings[n] + i) % 12 == selectedNotes[5] || (strings[n] + i) % 12 == selectedNotes[6] || (strings[n] + i) % 12 == selectedNotes[7] )
          {
           if (document.layout.showNotes.checked)
            {x = x + notes[(strings[n] + i) % 12]}
           else
            {x = x + "  "+playChar+"   "}
           }
	else
          {x = x + "  |   "}
      }
  x = x +"\n"  

  
  x = x + "      ";
    for (n = startString; n < endString; n++)  
       {x = x + "|     "}
  x = x + "|\n";
   }

  x = x + "      ";
    for (n = startString; n < endString; n++)  
       {x = x + "+-----"}
  x = x + "+\n";

 document.output.stringset.value = x;
  
   }


function goToLit()
	{
	var linkList =   new Array();
	linkList[1] = "1574240684";
	linkList[2] = "0634001388";
	linkList[3] = "0679742751";
	linkList[4] = "0786667109";
	linkList[5] = "0786605634";
	var x = Math.round(Math.random()*4);
	var newUrl = "http://www.amazon.com/exec/obidos/ASIN/"+ linkList[x+1] + "/songweavercom/";
	top.location.href=newUrl
	}

function Support()
	{
	var newUrl = "support.html";
	top.location.href=newUrl
	}

function Suggest()
	{
	x = "To suggest a tuning, first make sure that the PRESET TUNINGS option is NOT checked.  Then make your note selection under the STRINGS section.";
	x = x + "\n\n";
	x = x + "When done, click on the RECOMMEND THIS TUNING button.";
	x = x + "\n\n";
	x = x + "Be sure to go from lowest to highest pitch, top to bottom.";

 	document.output.stringset.value = x;
	}

function Recommend()
	{
	checkEmail();
	document.layout.pretuning.checked = (1==2);
	document.recommend.recip.value=document.output.recipient.value;	
	document.layout.fourString.checked;
	document.recommend.ins_type.value = prompt("What instrument(s) is this for?",document.recommend.ins_type.value)
	x = document.recommend.ins_type.value+": ";
	 
	var a = (document.layout.HiEstring.options[document.layout.HiEstring.selectedIndex].value % 100);
	var b = (document.layout.Bstring.options[document.layout.Bstring.selectedIndex].value % 100);
	var c = (document.layout.Gstring.options[document.layout.Gstring.selectedIndex].value % 100);
	var d = (document.layout.Dstring.options[document.layout.Dstring.selectedIndex].value % 100);
	var e = (document.layout.Astring.options[document.layout.Astring.selectedIndex].value % 100)
	var f = (document.layout.LoEstring.options[document.layout.LoEstring.selectedIndex].value % 100)

	x = x + notes[f]+notes[e]+notes[d]+notes[c]
	if (document.layout.fourString.checked == false)
		{x = x + notes[b]+notes[a]}

	x = x +"             if (document.layout.mode.options[document.layout.mode.selectedIndex].value == 9999)     {";
	if (document.layout.fourString.checked == false)
		{x = x + "document.layout.fourString.checked = (1==2);            "}
	else 	{x = x + "document.layout.fourString.checked = (1==1);            "}

	x = x +"strings[6] ="+a+";     ";
	x = x +"strings[5] ="+b+";     ";
	x = x +"strings[4] ="+c+";     ";
	x = x +"strings[3] ="+d+";     ";

	if (document.layout.fourString.checked == false)
		{
		x = x +"strings[2] ="+e+";     ";
		x = x +"strings[1] ="+f+";     ";
		}
	else
		{
		x = x +"strings[2] =0;     ";
		x = x +"strings[1] =0;             }";
		}
	
	document.recommend.suggestion.value=x;
	}


function jw()
	{
	var newUrl = "http://juliewaters.com/";
	top.location.href=newUrl
	}


