﻿// JScript File

	function setHeight(elId, headerHeight)
	{
		var myEl = getElement(elId);
		
		if(myEl != null)
		{
			var myElStyle = myEl.style;
			var curHeight = parseInt(myElStyle.height);
			var browseH = parseInt(getbrowserWindowHeight())-(12);
			
			
			if(curHeight < browseH)
			{
				var newHeight = browseH + 'px';
				myElStyle.height = newHeight;
			}
		}
		else
		{
		alert('myEl is null');
		}
	}
	

function getbrowserWindowHeight(){
		var windowHeight = 601;
		// Firefox
		if(document.layers||(document.getElementById&&!document.all))
		{ 
			windowHeight=window.innerHeight-133;  
		}
		// IE
		else if(document.all)
		{
			/*
			var bodyHeight=document.body.offsetHeight;
			var winHeight = document.body.style.height
			alert('bodyHeight = '+bodyHeight+' windowHeight = '+winHeight);
			*/
			windowHeight=document.body.style.height;//document.body.offsetHeight;
		}
		return windowHeight;
	}


	function getElement(id){
		if(document.getElementById){    
			getElement = function(id){ return document.getElementById(id); }    
		}
		else if(document.all){        
			getElement = function(id){ 
				return document.all[id]; };    
		}
		else if(document.layers){        
			getElement = function(id){ 
				return document.layers[id]; };    
		}
		else{        
			getElement = function() { return null; };    
		}    
		
		//return the result of the new function.    
		return getElement(id);
		
	}
	
