	 /*
 * menuExpandable2.js - implements an expandable menu based on a HTML list
 * Author: Dave Lindquist (http://www.gazingus.org)
 * Tweeked for use with Definition Lists by Chad Salganik
 */

/*if (!document.getElementById)
    document.getElementById = function() { return null; }*/
    
    
    
 var headline_count;
var headline_interval;
var old_headline = 0;
var current_headline=0;

$(document).ready(function(){
  headline_count = $("div.headline").size();

  $("div.headline:eq("+current_headline+")").css('left','0px');
  
  headline_interval = setInterval(headline_rotate,20000); //time in milliseconds
  $('#scrollup2').hover(function() {
    clearInterval(headline_interval);
  }, function() {
    headline_interval = setInterval(headline_rotate,20000); //time in milliseconds
    headline_rotate();
  });
});

function headline_rotate() {
  current_headline = (old_headline + 1) % headline_count; 
  //remainder will always equal old_headline until it reaches headline_count - at which point it becomes zero. clock arithmetic
  $("div.headline:eq(" + old_headline + ")").animate({left: -374},"slow", function() {
    $(this).css('left','374px');
    });
  $("div.headline:eq(" + current_headline + ")").show().animate({left: 0},"slow");  
  old_headline = current_headline;
}



    

window.onload = function() {
if (!document.getElementById){ return null; }
	var dls = document.getElementsByTagName('dl');
	var z = dls[0].getElementsByTagName('dd');
	for (var i=0;i<z.length;i++){z[i].style.display="none";}	
	var y = dls[0].getElementsByTagName('dt');
	for (var i=0;i<y.length;i++){
 		y[i].onclick = function(){	
		var exitstrategy = 0;
		thename=this.nextSibling;
		while (thename.nodeName != 'DD') {
  		thename=thename.nextSibling;
  		exitstrategy++;
  		if (exitstrategy > 5) { break; }
		}
		var display = thename.style.display;
		this.style.backgroundImage = (display == "block") ? "url(images/style/plus.gif)" : "url(images/style/minus.gif)";
		thename.style.display = (display == "block") ? "none" : "block";
   	return false;
}}

	var dls = document.getElementsByTagName('dl');
	var z = dls[1].getElementsByTagName('dd');
	for (var i=0;i<z.length;i++){z[i].style.display="none";}	
	var y = dls[1].getElementsByTagName('dt');
	for (var i=0;i<y.length;i++){
 		y[i].onclick = function(){	
		var exitstrategy = 0;
		thename=this.nextSibling;
		while (thename.nodeName != 'DD') {
  		thename=thename.nextSibling;
  		exitstrategy++;
  		if (exitstrategy > 5) { break; }
		}
		var display = thename.style.display;
		this.style.backgroundImage = (display == "block") ? "url(images/style/plus.gif)" : "url(images/style/minus.gif)";
		thename.style.display = (display == "block") ? "none" : "block";
   	return false;
}}


}
