<!--		
// Two functions for rollover image swapping
function hideit(id) { // hide an element
	var e = document.getElementById(id);
	e.style.display = 'none';
}

function showit(id) { // show an element
	var e = document.getElementById(id);
	e.style.display = 'block';
}

// Suite of functions for scrollable text areas 
// with custom scrollbar elements

var scrollspeed = 4; // # of pixels to move at a time
var scrolltiming = 1; // millisecond delay between moving content
var scrollID = 0; 
var moveit = 0; // Switch for drag scrolling
var thebox = document.getElementById('scrolling_content'); // Element containing text.
var keycode = 0;

// Function to scroll down
function scrolldown(pos,clip_top,clip_right,clip_bottom,clip_left,scroll_min,scroll_max) {
	if(undefined===window.keep_pos) {
		keep_pos=pos;
		keep_clip_top=clip_top;
		keep_clip_bottom=clip_bottom;
	}
	if(pos-keep_pos-clip_top+clip_bottom >= thebox.offsetHeight) {
		clearInterval(scrollID);
	} else {
		if(thebox.offsetHeight>clip_bottom) {
			scroller = document.getElementById('scrollbutton');
			keep_pos -= scrollspeed;
			keep_clip_top += scrollspeed;
			keep_clip_bottom += scrollspeed;
			thebox.style.top=keep_pos + "px";
			thebox.style.clip="rect(" + 
				keep_clip_top + "px, " + 
				clip_right + "px, " + 
				keep_clip_bottom + "px, " + 
				clip_left + "px)";
			scroller.style.top=Math.round(scroll_min+(scroll_max-scroll_min)*(pos-keep_pos)/(thebox.offsetHeight+clip_top-clip_bottom)) + "px";
		}
	}
}

// Loop scroll down function
function do_scrolldown(pos,clip_top,clip_right,clip_bottom,clip_left,scroll_min,scroll_max) {
	scrollID = setInterval('scrolldown(' +
			pos + ',' +
			clip_top + ',' +
			clip_right + ',' +
			clip_bottom + ',' +
			clip_left + ',' +
			scroll_min + ',' +
			scroll_max + ')', scrolltiming);
}

// Function to scroll up
function scrollup(pos,clip_top,clip_right,clip_bottom,clip_left,scroll_min,scroll_max) {
	if(keep_pos>=pos || undefined===keep_pos) {
		clearInterval(scrollID);
	} else {
		scroller = document.getElementById('scrollbutton');
		keep_pos += scrollspeed;
		keep_clip_top -= scrollspeed;
		keep_clip_bottom -= scrollspeed;
		thebox.style.top=keep_pos + "px";
		thebox.style.clip="rect(" +
			keep_clip_top + "px, " +
			clip_right + "px, " +
			keep_clip_bottom + "px, " +
			clip_left + "px)";
		scroller.style.top=Math.round(scroll_min+(scroll_max-scroll_min)*(pos-keep_pos)/(thebox.offsetHeight+clip_top-clip_bottom)) + "px";
	}
}

// Loop scroll up function
function do_scrollup(pos,clip_top,clip_right,clip_bottom,clip_left,scroll_min,scroll_max) {
	scrollID = setInterval('scrollup(' +
			pos + ',' +
			clip_top + ',' +
			clip_right + ',' +
			clip_bottom + ',' +
			clip_left + ',' +
			scroll_min + ',' +
			scroll_max + ')', scrolltiming);
}

// Stop Scrolling up or down
function stop_scroll() {
	clearInterval(scrollID);
}

// Get keypress info
function whichkey(e) {
	var thekey;
	if(window.event) {
		thekey=event.keycode;
	} else if(e.which) {
		thekey=e.which;
	}
	return thekey;
}

// Scroll with keypress 
function key_scroll(keycode,pos,clip_top,clip_right,clip_bottom,clip_left,scroll_min,scroll_max) {
	if(keycode=='40') {
		do_scrolldown(pos,clip_top,clip_right,clip_bottom,clip_left,scroll_min,scroll_max);
	} else if(keycode=='38') {
		do_scrollup(pos,clip_top,clip_right,clip_bottom,clip_left,scroll_min,scroll_max);
	}
}

// Click and drag scrollbar
function scrollit(e,pos,clip_top,clip_right,clip_bottom,clip_left,scroll_min,scroll_max) {
	if(moveit==1) {
		var y = 0;
		var ev=(!e)?window.event:e;
		if(ev.pageY) { //firefox
			y=ev.pageY;
		} else if(ev.clientY) { //IE
			y=ev.clientY;
		} else {
			return false;
		}

		// This is to fix behavior that if the mouse is depressed and released off of the body of the page, the scrollbar remains tied to the mouse.
		if(y < 5) { 
			moveit=0;
			return false;
		}
		if(y-10>scroll_min && y-10<scroll_max) {
			document.getElementById('scrollbutton').style.top = (y - 10) + "px";
			delta = Math.round((y-10-scroll_min)*(thebox.offsetHeight+clip_top-clip_bottom)/(scroll_max-scroll_min));
			keep_pos = pos-delta;
			keep_clip_top = clip_top+delta;
			keep_clip_bottom = clip_bottom+delta;
		} else if(y-10<=scroll_min) {
			document.getElementById('scrollbutton').style.top = scroll_min + "px";
			keep_pos=pos;
			keep_clip_top=clip_top;
			keep_clip_bottom=clip_bottom;
		} else if(y-10>=scroll_max) {
			document.getElementById('scrollbutton').style.top = scroll_max + "px";
			delta=thebox.offsetHeight+clip_top-clip_bottom;
			keep_pos=pos-delta;
			keep_clip_top=clip_top+delta;
			keep_clip_bottom=clip_bottom+delta;
		}
		if(thebox.offsetHeight>clip_bottom-clip_top) {
			thebox.style.top=keep_pos + "px";
			thebox.style.clip="rect(" +
				keep_clip_top + "px, " +
				clip_right + "px, " +
				keep_clip_bottom + "px, " +
				clip_left + "px)";
		}
	}	
}

// Function to scroll left
function scrollleft(left_pos,clip_top,clip_right,clip_bottom,clip_left) {
	if(undefined===window.keep_left_pos) {
		keep_left_pos=left_pos;
		keep_clip_left=clip_left;
		keep_clip_right=clip_right;
	}
	if(left_pos-keep_left_pos+clip_right >= document.getElementById('thumbs').offsetWidth) {
		clearInterval(scrollID);
	} else {
		keep_left_pos -= scrollspeed;
		keep_clip_left += scrollspeed;
		keep_clip_right += scrollspeed;
		thebox.style.left=keep_left_pos + "px";
		thebox.style.clip="rect(" + 
			clip_top + "px, " + 
			keep_clip_right + "px, " + 
			clip_bottom + "px, " + 
			keep_clip_left + "px)";
	}
}

// Loop scroll left function
function do_scrollleft(left_pos,clip_top,clip_right,clip_bottom,clip_left) {
	scrollID = setInterval('scrollleft(' +
			left_pos + ',' +
			clip_top + ',' +
			clip_right + ',' +
			clip_bottom + ',' +
			clip_left + ')', scrolltiming);
}

// Function to scroll right
function scrollright(left_pos,clip_top,clip_right,clip_bottom,clip_left) {
	if(keep_left_pos>=left_pos+clip_left || undefined===window.keep_left_pos) {
		clearInterval(scrollID);
	} else {
		keep_left_pos += scrollspeed;
		keep_clip_right -= scrollspeed;
		keep_clip_left -= scrollspeed;
		thebox.style.left=keep_left_pos + "px";
		thebox.style.clip="rect(" +
			clip_top + "px, " +
			keep_clip_right + "px, " +
			clip_bottom + "px, " +
			keep_clip_left + "px)";
	}
}

// Loop scroll right function
function do_scrollright(left_pos,clip_top,clip_right,clip_bottom,clip_left) {
	scrollID = setInterval('scrollright(' +
			left_pos + ',' +
			clip_top + ',' +
			clip_right + ',' +
			clip_bottom + ',' +
			clip_left + ')', scrolltiming);
}

// IE 6/7 doesn't support the proper clip syntax, but it works when set with javascript
function fix_ie_clip(clip_top,clip_right,clip_bottom,clip_left,theelement) {
	thebox = document.getElementById(theelement);
	thebox.style.clip="rect(" +
		clip_top + "px, " +
		clip_right + "px, " +
		clip_bottom + "px, " +
		clip_left + "px)";
	thebox.style.display='block';
}

// Firefox 3 has an unusual behavior of selecting the image when click dragging, and then while it is selected it doesn't allow a normal click-drag.  This function removes all selections from the page.
function clearselection() {
	if(moveit==1) {
		var sel;
		if(document.selection && document.selection.empty) {
			document.selection.empty();
		} else if(window.getSelection) {
			sel=window.getSelection();
			if(sel && sel.removeAllRanges)
				sel.removeAllRanges();
		}
	}
	moveit=0;
}

// Ajax functions follow:

function ajaxFunction(url,divid) {
  var xmlHttp;
  try { // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
  }
  catch (e) { // Internet Explorer 6.0+
    try {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e) { // Internet Explorer 5.5+
      try {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch (e) {
        alert("We're sorry, your browser is too old.  Please upgrade.");
        return false;
      }
    }
  }
  xmlHttp.onreadystatechange=function() {
    if(xmlHttp.readyState==4) {
      // The invisible div below is to fix a bug in IE6
      document.getElementById(divid).innerHTML="<div style=\"width:0px; height:0px; display:none;\"></div>" + xmlHttp.responseText;
    }
  }
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}

//-->
