var fitTextInBox_maxWidth = false;
var fitTextInBox_maxHeight = false;
var fitTextInBox_currentWidth = false;
var fitTextInBox_currentBox = false;
var fitTextInBox_currentTextObj = false;

function fitTextInBox(boxID,maxHeight)
{
	if(maxHeight)fitTextInBox_maxHeight=maxHeight; else fitTextInBox_maxHeight = 10000;
	var obj = document.getElementById(boxID);
	fitTextInBox_maxWidth = obj.offsetWidth;	
	fitTextInBox_currentBox = obj;
	fitTextInBox_currentTextObj = obj.getElementsByTagName('SPAN')[0];
	fitTextInBox_currentTextObj.style.fontSize = '1px';
	fitTextInBox_currentWidth = fitTextInBox_currentTextObj.offsetWidth;
	fitTextInBoxAutoFit();
	
}	

function fitTextInBoxAutoFit()
{
	var tmpFontSize = fitTextInBox_currentTextObj.style.fontSize.replace('px','')/1;
	fitTextInBox_currentTextObj.style.fontSize = tmpFontSize + 1 + 'px';
	var tmpWidth = fitTextInBox_currentTextObj.offsetWidth;
	var tmpHeight = fitTextInBox_currentTextObj.offsetHeight;
	if(tmpWidth>=fitTextInBox_currentWidth && tmpWidth<fitTextInBox_maxWidth && tmpHeight<fitTextInBox_maxHeight && tmpFontSize<300){		
		fitTextInBox_currentWidth = fitTextInBox_currentTextObj.offsetWidth;	
		fitTextInBoxAutoFit();
	}else{
		fitTextInBox_currentTextObj.style.fontSize = fitTextInBox_currentTextObj.style.fontSize.replace('px','')/1 - 1 + 'px';
	}		
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
