﻿
// Sets the height based on the parent window height
function SetPopUpHeight(popUpItemId)
{
    var popUpItem = $get(popUpItemId);
	var windowHeight = 0;
	
	// Get the window height (dependant upon browser).
	// Non-IE.
	if( typeof( window.innerWidth ) == 'number' )
		windowHeight = window.innerHeight;
	
	//IE 6+ in 'standards compliant mode'.
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
		windowHeight = document.documentElement.clientHeight;

	//IE 4 compatible.
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
		windowHeight = document.body.clientHeight;
	
    // Calculate a possible short height.
	var shortHeight = (popUpItem.options == null)? windowHeight - 150 : (popUpItem.options.length * 20) + 5;
	
	// Not many items in the list?
	if (popUpItem.options == null || popUpItem.options.length > 10 || shortHeight > windowHeight)
	    popUpItem.style.height = windowHeight - 150 + 'px';
	else
	    popUpItem.style.height = shortHeight + 'px';
}

// Sets the height based on the parent window height
function SetPopUpTextHeight(popUpItemId)
{
    var popUpItem = $get(popUpItemId);
	var windowHeight = 0;
	
	// Get the window height (dependant upon browser).
	// Non-IE.
	if( typeof( window.innerWidth ) == 'number' )
		windowHeight = window.innerHeight;
	
	//IE 6+ in 'standards compliant mode'.
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
		windowHeight = document.documentElement.clientHeight;

	//IE 4 compatible.
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
		windowHeight = document.body.clientHeight;
	
    popUpItem.style.height = (windowHeight - 20) + 'px';
}