
// Author: Derek Allwardt. Email: derek@jazzlicks.com Web: http://www.jazzlicks.com
// Date Created: 10/16/99. Please feel free to use this script, but please keep my author information and email address in it.
// Courtesy of SimplytheBest.net (http://simplythebest.net/info/dhtml_scripts.html)
// error handling
function stopError()
{
        return true;
}
window.onerror = stopError;
if (document.images)
{
        roll = 1;
}
else
{
        roll = 0;
}
// rollover buttons
if (roll)
{
        dot = new Image() ;
        dot.src = "jscript38/dot.gif";
        line = new Image() ;
        line.src = "jscript38/line.gif";
        blank = new Image() ;
        blank.src = "jscript38/blank.gif";   
        opn = new Image() ;
        opn.src = "jscript38/open.gif"; 
        muted = new Image() ;
        muted.src = "jscript38/muted.gif";
        
        position0 = new Image() ;
        position0.src = "jscript38/blank.gif";  
        position1 = new Image() ;
        position1.src = "jscript38/blank.gif";  
        position2 = new Image() ;
        position2.src = "jscript38/position2.gif"; 
        position3 = new Image() ;
        position3.src = "jscript38/position3.gif"; 
        position4 = new Image() ;
        position4.src = "jscript38/position4.gif"; 
        position5 = new Image() ;
        position5.src = "jscript38/position5.gif"; 
        position6 = new Image() ;
        position6.src = "jscript38/position6.gif"; 
        position7 = new Image() ;
        position7.src = "jscript38/position7.gif"; 
        position8 = new Image() ;
        position8.src = "jscript38/position8.gif"; 
        position9 = new Image() ;
        position9.src = "jscript38/position9.gif"; 
        position10 = new Image() ;
        position10.src = "jscript38/position10.gif"; 
        position11 = new Image() ;
        position11.src = "jscript38/position11.gif";   
        position12 = new Image() ;
        position12.src = "jscript38/position12.gif";              
}
/******************************************************************
   function chord(name,pos,E,A,D,G,B,hE)
   
   this function has 8 parameters.
   name, pos, E, A, D, G, B, hE.
   
   name = the name you want displayed in the text box.
   
   pos = chord position. this is the graphic that appears beside 
   the first fret when a position of 2 or higher is entered as 
   the 'pos' parameter.
   
   E = low E string fret number. 0 = open string.
   
   A = A string fret number. 0 = open string.
   
   D = D string fret number. 0 = open string.
   
   G = G string fret number. 0 = open string.
   
   B = B string fret number. 0 = open string.
   
   hE. = high E  string fret number. 0 = open string.
   
*******************************************************************/
function chord(name,pos,E,A,D,G,B,hE) {
// set chord name in text field
document.chordName.nameDisplay.value = name
// set position graphic
document.images["position"].src = eval("position" + pos + ".src")
// establish string name array
strings = new Array(6)
strings[0] = "E"
strings[1] = "A"
strings[2] = "D"
strings[3] = "G"
strings[4] = "B"
strings[5] = "hE"
// loop thru open strings
   for ( var i=0; i<6; i++ ) {
	stringName = strings[i] + "0"
	
		if (eval(strings[i]) == -1 || eval(strings[i]) == null) {
   		document.images[stringName].src = muted.src
	  }
		else if (eval(strings[i]) == 0) {
   		document.images[stringName].src = opn.src
      }
      else {
   		document.images[stringName].src = blank.src
      } 
   }
//loop over E string
   for ( var i=1; i<7; i++ ) {
   	var imgName = "E" + i 
   	
   	if (E == i) {
   		document.images[imgName].src = dot.src
      }
      else {
   		document.images[imgName].src = line.src
      } 	
   }
//loop over A string
   for ( var i=1; i<7; i++ ) {
   	var imgName = "A" + i 
   	
   	if (A == i) {
   		document.images[imgName].src = dot.src
      }
      else {
   		document.images[imgName].src = line.src
      } 	
   }
//loop over D string
   for ( var i=1; i<7; i++ ) {
   	var imgName = "D" + i 
   	
   	if (D == i) {
   		document.images[imgName].src = dot.src
      }
      else {
   		document.images[imgName].src = line.src
      } 	
   }
//loop over G string
   for ( var i=1; i<7; i++ ) {
   	var imgName = "G" + i 
   	
   	if (G == i) {
   		document.images[imgName].src = dot.src
      }
      else {
   		document.images[imgName].src = line.src
      } 	
   } 
//loop over B string
   for ( var i=1; i<7; i++ ) {
   	var imgName = "B" + i 
   	
   	if (B == i) {
   		document.images[imgName].src = dot.src
      }
      else {
   		document.images[imgName].src = line.src
      } 	
   }
   
   //loop over hE string
   for ( var i=1; i<7; i++ ) {
   	var imgName = "hE" + i 
   	
   	if (hE == i) {
   		document.images[imgName].src = dot.src
      }
      else {
   		document.images[imgName].src = line.src
      } 	
   }
  
}
