var _GOF_CONTAINER_REGION;
var _GOF_CONTAINER_ID;

//Function to set the content of a site div to be full height of window
function setFullHeight() {
	var containerDiv = document.getElementById(_GOF_CONTAINER_ID);
	if(!containerDiv)
		return;
	
	if(_GOF_CONTAINER_REGION) {		
		if((_GOF_CONTAINER_REGION.bottom - _GOF_CONTAINER_REGION.top) < YAHOO.util.Dom.getViewportHeight()) 
			containerDiv.style.height = YAHOO.util.Dom.getViewportHeight()+'px';
		else if((_GOF_CONTAINER_REGION.bottom - _GOF_CONTAINER_REGION.top) > YAHOO.util.Dom.getViewportHeight())
			containerDiv.style.height = (_GOF_CONTAINER_REGION.bottom - _GOF_CONTAINER_REGION.top)+'px';
	} 
	
}

/**
 * @param array args
 * arg[0] = id of div that will be stretched
 * arg[1] = id of div that is used as place holder to calculate the current height of the window
 */
//same as setFullHeight function, except, this only occurs on load, performing some initializations
function initSetFullHeight(args) {
	if(args.length<1)
		return;
	_GOF_CONTAINER_ID = args[0];
	var containerDiv = document.getElementById(_GOF_CONTAINER_ID);
	if(!containerDiv)
		return;
	var main = YAHOO.util.Dom.getElementsByClassName(args[1]);
	_GOF_CONTAINER_REGION = YAHOO.util.Dom.getRegion(args[1]);
	
	if(_GOF_CONTAINER_REGION) {
		if((_GOF_CONTAINER_REGION.bottom - _GOF_CONTAINER_REGION.top) < YAHOO.util.Dom.getViewportHeight()) 
			containerDiv.style.height = YAHOO.util.Dom.getViewportHeight()+'px';
	} 

}

//the first argument is the id of the element that needs to exist before javascript function can be executed
//needed to be a DOMReady event because firefox completed the dom before images are loaded which gives bad
//height values - David Molesky
YAHOO.util.Event.onDOMReady(function(){
																		 initSetFullHeight(['main_border','main'])
																		 });
//YAHOO.util.Event.onAvailable(initSetFullHeight,['main_border','main']);
YAHOO.util.Event.addListener(window, 'resize', setFullHeight);
