// JavaScript Document
function addEvent(obj, evType, fn){
 if (obj.addEventListener){
   obj.addEventListener(evType, fn, true);
   return true;
 } else if (obj.attachEvent){
   var r = obj.attachEvent("on"+evType, fn);
   return r;
 } else {
   return false;
 }
}



/*
Created by Travis Clark
Last Updated: 07-08-2007

Description: 
  this function maintains an elastic Container height of atleast 
  the height of the Navigation bar, plus 80px (which is the top offset of the Navigation bar)

tested on browsers: IE6, IE7, Opera 9, Firefox 2

NOTES:
   assumes the top offset of Navigation is 80px
*/
function maintain_size()
{
	//check to make sure "getElementById() works
	if (!document.getElementById) return;
	
	//check for existance of .offsetHeight
	if (!document.getElementById("Container").offsetHeight)  return;
	if (!document.getElementById("Navigation").offsetHeight) return;
	
	//check for existance of .style
	if (!document.getElementById("Container").style)  return;
	if (!document.getElementById("Navigation").style) return;

	//calculate minimum height = height of Navigation + 80px (the offset of Navigation...check /templates/_css/main.css)
	var Container_desired_height = document.getElementById("Navigation").offsetHeight + 80;
	
	//if (Container is not high enough) change its height to the minimum height
	if (document.getElementById("Container").offsetHeight < Container_desired_height)
	  document.getElementById("Container").style.height = Container_desired_height + 'px';
}





// Object Functions
// copyright Stephen Chapman, 4th Jan 2005
//  you may copy these functions but please keep the copyright notice as well
function objWidth(objectID) {
	var obj = xDOM(objectID,0); 
	if(obj.offsetWidth) return  obj.offsetWidth; 
	if (obj.clip) return obj.clip.width; 
	return 0;
	}        
function objHeight(objectID) {
	var obj = xDOM(objectID,0); 
	if(obj.offsetHeight) return  obj.offsetHeight; 
	if (obj.clip) return obj.clip.height; 
	return 0;
	}    
function objLeft(objectID) {
	var obj = xDOM(objectID,0);
	var objs = xDOM(objectID,1);
	if(objs.left) return objs.left;
	if (objs.pixelLeft) return objs.pixelLeft;
	if (obj.offsetLeft) return obj.offsetLeft;
	return 0;
	}
function objTop(objectID) {
	var obj = xDOM(objectID,0);
	var objs = xDOM(objectID,1); 
	if(objs.top) return objs.top; 
	if (objs.pixelTop) return objs.pixelTop; 
	if (obj.offsetTop) return obj.offsetTop; 
	return 0;
	} 
function objRight(objectID) {
	return objLeft(objectID)+objWidth(objectID);
	} 
function objBottom(objectID) {
	return objTop(objectID)+objHeight(objectID);
	} 
function objLayer(objectID) {
	var objs = xDOM(objectID,1); 
	if(objs.zIndex) return objs.zIndex; 
	return 0;
	} 
function objVisible(objectID) {
	var objs = xDOM(objectID,1); 
	if(objs.visibility == 'hide' || objs.visibility == 'hidden') return 'hidden'; 
	return 'visible';
	}
                    




















window.onload = maintain_size;
addEvent(window, 'onload', maintain_size);
