function getHTTPOBJ()
{
	try	
	{
		req = new XMLHttpRequest();
	}	
	catch(err1)	
	{
		try	
		{
			req = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch(err2)	
		{
			try	
			{
				req = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(err3)
			{
				req = false;
			}
		}
	}

	return req;
}

var http_obj = getHTTPOBJ();

function showAnalyzer()
{
	var scrollTop = document.documentElement.scrollTop + document.body.scrollTop;
	var left = document.body.offsetWidth / 2;
	var top = 150 + scrollTop;

	if(document.body.offsetWidth > 300)
	{
		left = Math.round((document.body.offsetWidth - 300) / 2);
	}
	document.getElementById('overlay_table').width = document.body.offsetWidth;
	document.getElementById('overlay_table').height = document.body.scrollHeight;
	document.getElementById('overlay_td').width = document.body.offsetWidth;
	document.getElementById('overlay_td').height = document.body.scrollHeight;
	document.getElementById('overlay').style.visibility = 'visible';
	
	return;
}

function hideAnalyzer()
{
	document.getElementById('overlay').style.visibility = 'hidden';
	return;
}

function round(amt, dec)
{
	var mul = Math.pow(10, dec);

	return parseFloat(Math.round(amt * mul) / mul);
}

function numberFormat(amt, dec)
{
	var fixed_amt = '';
	var split_amt = new String(amt).split('.');
	var suff_len;
	var suff;
	var dec_suff_diff;

	cnt = 0;

	for(i = (split_amt[0].length - 1); i >= 0; i--)
	{
		fixed_amt = split_amt[0].substr(i, 1) + fixed_amt;

		cnt++;

		if(cnt == 3 && i > 0)
		{
			fixed_amt = ',' + fixed_amt;	

			cnt = 0;
		}
	}

	if(dec > 0)
	{
		fixed_amt += '.';

		if(split_amt.length == 1)
		{
			suff_len = 0;
			suff = '';
		}
		else
		{
			suff_len = split_amt[1].length;
			suff = split_amt[1];
		}

		if(suff_len > dec)
		{
			for(i = 0; i < dec; i++)
			{
				fixed_amt = fixed_amt + suff.substr(i, 1);
			}
		}
		else
		{
			fixed_amt += suff;

			dec_suff_diff = dec - suff_len;

			for(i = 0; i < dec_suff_diff; i++)
			{
				fixed_amt += '0';
			}
		}
	}

	return fixed_amt;
}