/*
$RCSfile: MacNS4SizeFix.txt,v $
$Author: cartwrie $
$Date: 2001-09-19 14:46:48+02 $ 
$Revision: 1.0 $
*/

// note: styles must be linked and defined _before_ this code is run

function MacNS4SizeFix(parrTag, parrClass)
{ 
	var bt = new BrowserTyper();
	
	function MacNS4SizeFix_resize( pstrDocObject, 
	                               parrStyleObject,
	                               pstrStyleProp,
	                               pdblMultiplier )
	{
		var strCurVal = "";
		var dblSize   = 0.0;
		var strUnits  = "";
		var ct;
		
		for ( ct=0; ct < parrStyleObject.length; ++ct )
		{
			strCurVal = eval(pstrDocObject + "." + parrStyleObject[ct] + "." + pstrStyleProp);
			
			if (strCurVal)
			{
				dblSize = 0.0;
				strCurVal.match(/^([\d\.]+)([\w]{1,3})/);
				dblSize = RegExp.$1 * pdblMultiplier; 
				
				strUnits = RegExp.$2;

				eval( pstrDocObject 
				      + "." 
				      + parrStyleObject[ct] 
				      + "." 
				      + pstrStyleProp 
				      + " = '" 
				      + dblSize 
				      + strUnits 
				      + "'" );
			} 
		}
	} ///~ MacNS4SizeFix_resize()
	
	// resize bug fix from Macromedia
	function MM_reloadPage(init)
	{
		if (init==true) 
			with (navigator) 
			{
				document.MM_pgW=innerWidth; 
				document.MM_pgH=innerHeight; 
				onresize=MM_reloadPage; 
			}
		else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) 
			location.reload();
	} ///~ MM_reloadPage()
	
	
	// call the fixer if we're a Mac, we're NS4, and we know what a RegExp is
	if (bt.is_major < 5 && bt.is_mac && bt.is_regexp)
	{
		MM_reloadPage(true);
		MacNS4SizeFix_resize( "document.tags",    parrTag,   "fontSize",   1.3 );
		MacNS4SizeFix_resize( "document.tags",    parrTag,   "lineHeight", 1.4 );
		MacNS4SizeFix_resize( "document.classes", parrClass, "fontSize",   1.3 );
		MacNS4SizeFix_resize( "document.classes", parrClass, "lineHeight", 1.4 );
	}
	// else if we're NS4/Win
	else if (bt.is_major < 5 && bt.is_nav && bt.is_regexp && bt.is_win)
	{
		MM_reloadPage(true);
		MacNS4SizeFix_resize( "document.tags",    parrTag,   "fontSize",   1.06 );
		MacNS4SizeFix_resize( "document.tags",    parrTag,   "lineHeight", 1.0 );
		MacNS4SizeFix_resize( "document.classes", parrClass, "fontSize",   1.06 );
		MacNS4SizeFix_resize( "document.classes", parrClass, "lineHeight", 1.0 );
	}
	
} ///~ MacNS4SizeFix()