    //********************************************************************************************
    //* I apologize ahead of time for the ugliness of this file, but I used some code from other *
    //* places and didn't get around to cleaning it up. For the most part, this stuff is pretty  *
    //* easy and the rest is fairly clearly documented                                           *
    //********************************************************************************************


//**************
// Change the block style of an object. I did this operation so often, I decided to make it a shorter function
//**************
	function block_on(id)
	{
		document.getElementById(id).style.display = "block";
	}
	function block_off(id)
	{
		document.getElementById(id).style.display = "none";
	}

//**************
// Change the visibility of an object. I did this operation so often, I decided to make it a shorter function
//**************
	function vis_on(id)
	{
		document.getElementById(id).style.visibility = "visible";
	}
	function vis_off(id)
	{
		document.getElementById(id).style.visibility = "hidden";
	}


//**************
// Scroll top functions
//**************
	function get_scroll()
	{
		var x,y;
		if (self.pageYOffset) // all except Explorer
		{
			x = self.pageXOffset;
			y = self.pageYOffset;
		}
		else if (document.documentElement && document.documentElement.scrollTop)
			// Explorer 6 Strict
		{
			x = document.documentElement.scrollLeft;
			y = document.documentElement.scrollTop;
		}
		else if (document.body) // all other Explorers
		{
			x = document.body.scrollLeft;
			y = document.body.scrollTop;
		}
		return y;
	}

	// Based on code from quirksmode.org
	function scroll_y()
	{
		var y;
		if (self.pageYOffset) // all except Explorer
			y = self.pageYOffset;
		else if (document.documentElement && document.documentElement.scrollTop)
			// Explorer 6 Strict
			y = document.documentElement.scrollTop;
		else if (document.body) // all other Explorers
			y = document.body.scrollTop;
		return y;
	}

	// Based on quirksmode.org code
	function set_scroll(y)
	{
		if (document.documentElement && document.documentElement.scrollTop)
			// Explorer 6 Strict
			document.documentElement.scrollTop = y;
		else if (document.body) // all other Explorers
			document.body.scrollTop = y;
	}

	// Based on quirksmode.org code
	function page_width()
	{
		var x;
		var test1 = document.body.scrollHeight;
		var test2 = document.body.offsetHeight
		if (test1 > test2) // all but Explorer Mac
			x = document.body.scrollWidth;
		else // Explorer Mac;
		     //would also work in Explorer 6 Strict, Mozilla and Safari
			x = document.body.offsetWidth;
		return x;
	}

	// Based on quirksmode.org code
	function page_height()
	{
		var y;
		var test1 = document.body.scrollHeight;
		var test2 = document.body.offsetHeight
		if (test1 > test2) // all but Explorer Mac
			y = document.body.scrollHeight;
		else // Explorer Mac;
		     //would also work in Explorer 6 Strict, Mozilla and Safari
			y = document.body.offsetHeight;
		return y;
	}

//**************
// Scroll top functions
//**************
	function page_bottom()
	{
		return scroll_y()+document.body.offsetHeight;
	}

/**
* Find and return the center of the screen 
*
* @return int
*/
	function screen_center()
	{

		if (window.innerWidth)
		{
			s_center = window.innerWidth/2;
		}
		else
		{
			s_center = document.documentElement.offsetWidth/2;
		}
		return s_center;
	}
	
	
/**
* Simple function for finding if the sent coordinates are in a rectangular area
* @return boolean
*/
	function in_rect(x,y,x1,y1,x2,y2) 
	{
		if ( (x > x2) || (x < x1) || (y > y2) || (y < y1) )
			return false;
		return true;
	}


/** 
* Hides or unhides all select fields on the page                             
* @param string Value is either "visible" or "hidden" to accomplish the switching on and off of the select fields                                     
*/
   	function select_vis(hide){
        for (i=0;(i<document.forms.length) && (i<10);i++)	// The i < 10 is just a failsafe. that won't happen on this page
        {
            for (j=0;j<document.forms[i].elements.length;j++)
            {
                if (document.forms[i].elements[j].type.indexOf('select')>-1)
                    document.forms[i].elements[j].style.visibility=hide
            }
        }
   	}
   

// Adapted from SmartWebby.com (http://www.smartwebby.com/dhtml/)
//**************************************************************************************//
function getImage(name) {
  if (document.layers) {
    return findImage(name,document);
  }
  else
    return document.getElementById(name);
  return null;
}
function findImage(name,doc) {
  var i, img;
  for (i = 0; i < doc.images.length; i++)
    if (doc.images[i].name == name)
      return doc.images[i];
  for (i = 0; i < doc.layers.length; i++)
    if ((img = findImage(name, doc.layers[i].document)) != null) {
      img.container = doc.layers[i];
      return img;
    }
  return null;
}

function get_obj_left(obj) {
  var x;
  if (document.layers) {
    if (obj.container != undefined)
      return obj.container.pageX + obj.x;
    else
      return obj.x;
  }
  else {
    x = 0;
    while (obj.offsetParent != null) {
      x += obj.offsetLeft;
      obj = obj.offsetParent;
    }
    x += obj.offsetLeft;
    return x;
  }
  return -1;
}

function get_obj_top(obj) {
  var y;
  if (document.layers) {
    if (obj.container != undefined)
      return obj.container.pageY + obj.y;
    else
      return obj.y;
  }
  else {
    y = 0;
    while (obj.offsetParent != null) {
      y += obj.offsetTop;
      obj = obj.offsetParent;
    }
    y += obj.offsetTop;
    return y;
  }
  return -1;
}

//**************************************************************************************//
	
/**
 * Set the left position of an object
 */
	function set_left(id,left)
	{
    	document.getElementById(id).style.left = left + "px";
	}
    
/**
 * Set the top position of an object
 */
	function set_top(id,top)
	{
    	document.getElementById(id).style.top = top + "px";
	}
    
/**
 * Set the bottom position of an object
 */
	function set_bottom(id,bottom)
	{
    	set_top(id,bottom-get_height(id));
	}
    
/**
 * Set the right position of an object
 */
	function set_right(id,right)
	{
    	set_left(id,right-get_width(id));
	}
    
/**
 * Gets the width of a div or layer
 */
	function get_width(id)
	{
		if (document.layers)
		{
			if (document.layers[id].document.width)
				return document.layers[id].document.width;
			else												// Because of the common <ilayer><layer> technique, we need to access the width of the inner layer with this line
				return document.layers[id].document.layers[0].document.width;
		}
		else 
			return document.getElementById(id).offsetWidth;		
	}
	
/**
 * Gets the height of a div or layer
 */
	function get_height(id)
	{
		if (document.layers)
		{
			if (document.layers[id].document.height)
				return document.layers[id].document.height;
			else												// Because of the common <ilayer><layer> technique, we need to access the width of the inner layer with this line
				return document.layers[id].document.layers[0].document.height;
		}
		else 
			return document.getElementById(id).offsetHeight;		
	}

/**
 * Sets the height of a div or layer
 */
	function set_height(id,height)
	{
		if (document.layers)
		{
			// This inner section is untested and probably doesn't work right, but that only matters for old browsers so fix it if you need to
			if (document.layers[id].document.height)
				document.layers[id].document.height = height;
			else												// Because of the common <ilayer><layer> technique, we need to access the width of the inner layer with this line
				document.layers[id].document.layers[0].document.height = height;
		}
		else 
			document.getElementById(id).style.height = height+"px";		
	}

/**
 * Get the left position of an object
 */
	function get_left(id)
	{
    	return get_obj_left(document.getElementById(id));
	}
    
/**
 * Get the top position of an object
 */
	function get_top(id)
	{
    	return get_obj_top(document.getElementById(id));
	}
    
/**
 * Gets the right edge of an object
 */
    function get_right(id)
    {
        return (get_left(id) + get_width(id));
        
    }

/**
 * Gets the bottom edge of an object
 */
    function get_bottom(id)
    {
        return (get_top(id) + get_height(id));
        
    }



