// array containing all the images in the bar

var  bar_images = ["i1930", "i1940", "i1950", "i1955", "i1960", "i1961", "i1962", "i1963", "i1964", "i1965",
"i1966", "i1967", "i1968","i1969", "i1970", "i1971", "i1972"];

var  bar_links = ["l1930", "l1940", "l1950", "l1955", "l1960", "l1961", "l1962", "l1963", "l1964", "l1965",
"l1966", "l1967", "l1968","l1969", "l1970", "l1971", "l1972"];

var  tl_layers = ["y1930", "y1940", "y1950", "y1955", "y1960" , "y1961", "y1962", "y1963", "y1964", "y1965",
"y1966", "y1967", "y1967feb", "y1967mar", "y1967apr", "y1967may", "y1967jun", "y1967jul", "y1967aug",
"y1967sep", "y1967oct", "y1967nov", "y1967dec", "y1968","y1969", "y1970", "y1971", "y1972"];/* */

isOPERA = (navigator.userAgent.indexOf('Opera') >= 0)? true : false;
isIE    = (document.all && !isOPERA)? true : false;
isDOM   = (document.getElementById && !isIE && !isOPERA)? true : false;

function getID(id){
	if (isDOM){
		return document.getElementById(id);		
	} else if (isIE) {
		return document.all[id];
	} else {
		return false;
	}
}

function highlight_link( thelink ){
	// lowlight all
	var obj;
	for (inc=0; inc<bar_links.length; inc++) {
		daClass = "";
		obj = getID(bar_links[inc]);
     	obj.className = daClass;
	}
	
	daClass = "selected";
	obj = getID(thelink)
	obj.className = daClass;
				
}


function highlight_img( theimg ){
	// lowlight all
	var obj;
	for (inc=0; inc<bar_images.length; inc++) {
		daImage = bar_images[inc];
		daSrc = "images/heart_small_norm.gif";
		if (typeof(daImage) == 'string' && (document.getElementById || document.all)) {
      		// This whole objStr nonesense is here solely to gain compatability
      		// with ie3 for the mac.
      		objStr = 'document.' + daImage;
      		obj = eval(objStr);
     		obj.src = daSrc;
				
   		} else if ((typeof(daImage) == 'object') && daImage && daImage.src) {
      		daImage.src = daSrc;
		// this is for NS4
    	} else if ((typeof(eval("document.ns4timeline.document." + daImage)) == 'object') ){
			obj = eval("document.ns4timeline.document." + daImage);
			obj.src = daSrc;
		}
	}
	
	daSrc = "images/circle_small.gif";
	if (typeof(theimg) == 'string' && (document.getElementById || document.all)) {
      		// This whole objStr nonesense is here solely to gain compatability
      		// with ie3 for the mac.
      		objStr = 'document.' + theimg;
      		obj = eval(objStr);
     		obj.src = daSrc;
				
   		} else if ((typeof(theimg) == 'object') && theimg && theimg.src) {
      		theimg.src = daSrc;
		// this is for NS4
    	} else if ((typeof(eval("document.ns4timeline.document." + theimg)) == 'object') ){
			obj = eval("document.ns4timeline.document." + theimg);
			obj.src = daSrc;
		}
}

function WM_checkIn(WM_id) {

  // First we initialize all the variables.
  var theObj,ss,sr,i,j,WM_layers=new Array();
  // This chunk handles the IE portion of the checkIn code.
  if (document.all) {
  	
    // This checks to see if the inline style declaration has a position property associated with it. If not, it will scan the global stylesheets for the ID.
    if((document.all[WM_id].style.position != 'absolute') && (document.all[WM_id].style.position != 'relative')){
		
      // This loops through all global stylesheets and all the rules in each stylesheet, 
      // tests for the selected ID, then returns that as the object.
      for (ss=0 ; ss < document.styleSheets.length; ss++) {
	  
        for (sr=0 ; sr < document.styleSheets(ss).rules.length; sr++) { 
          if (document.styleSheets(ss).rules(sr).selectorText == '#' + WM_id) {
            theObj = document.styleSheets(ss).rules(sr).style;
            break;
          }
        }
      }
    } else {
      // This works the same as in the light version, so you can 
      // use inline styles.
      theObj = document.all[WM_id].style;
    }
  } else if(document.layers) {
    // Now we're in Netscapeland. The main problem here is finding the object in a maze of hierarchy.
    WM_layers = new Array();
    with (document) {
      for (i=0; i<layers.length; i++) WM_layers[i]=layers[i]; {
        for (i=0; i<WM_layers.length; i++) {
          if (WM_layers[i].document && WM_layers[i].document.layers) {
            for (j=0; j<WM_layers[i].document.layers.length; j++) {
              WM_layers[WM_layers.length] = WM_layers[i].document.layers[j];
            }
            if(WM_layers[i].name == WM_id){
              // So if the code matches the name of the layer, 
              // return the reference. 
              theObj = WM_layers[i];
            }
          }
        }
      }
    }
  }
  return theObj;
}

if (!document.layers) {
  var hidden = "hidden";
  var visible = "visible";
} else {
  var hidden = "hide";
  var visible = "show";
}

function show_layer( thelayer ) {

	// hide all layers
	// show the layer in the argement

  	if (document.layers || document.all) {
    		
    	// run through the args (objects) and set the visibility of each
		//hide all: daObj.visibility = hidden;
    	for (inc=0; inc<tl_layers.length; inc++) {
		//alert(inc + "/" + tl_layers.length );
      		// get a good object reference
      		var daObj = WM_checkIn(tl_layers[inc]);
           	daObj.visibility = hidden;
    	} // end for
		
		daObj = WM_checkIn(thelayer);
        daObj.visibility = visible;
		
  	} else if( document.getElementById ){
	
		for (inc=0; inc<tl_layers.length; inc++) {
			//alert("2" + arguments[0]);
			var daObj = tl_layers[inc];
			var obj = document.getElementById(daObj);
			obj.style.visibility =  hidden;
		}
		obj = document.getElementById(thelayer);
		obj.style.visibility =  visible;			
	}
	return true;
}