Object.extend(Prototype.Browser, {
    IE6:     Prototype.Browser.IE && (typeof window.XMLHttpRequest == "undefined"),
    IE7:     Prototype.Browser.IE && (typeof window.XMLHttpRequest == "object")
});

var timed = Array();
function showById(id,alignobj)
{
	timed[id] = true;
	if($(id) != null && alignobj != null)
	{
		Element.absolutize($(id));
		Element.extend(alignobj);
		addheight	=	parseInt(alignobj.getStyle('border-bottom-width'));
		Element.clonePosition($(id),alignobj,{setHeight: false,setWidth: false, offsetTop:(43-addheight)});
		if($(id).visible() == false) $(id).show();
	}
}
function hideById(id)
{
	if(timed[id] == false && $(id) != null)
		$(id).hide();
	else
	{
	//	setTimeout("hideById('"+id+"')",500);
	}
}
function hideTimeout(id)
{
	timed[id] = false;
	setTimeout("hideById('"+id+"')",500);
}

Event.observe( window, 'load', function() {	maxWidthMain();	});
Event.observe( window, 'resize', function() {	maxWidthMain();	});
Event.observe( window, 'scroll', function() {	maxWidthMain();	});
function maxWidthMain()
{
	maxHeightBody();
	maxHeightIB();
	autoWidthIB();
}
function maxHeightBody()
{
	var mybody		=	$$('body')[0];
	var maxheight	=	document.viewport.getHeight();
	
	var newheight	=	maxheight-10;
	if(newheight > 0)
		mybody.setStyle({height: newheight+'px'});
}
function maxHeightIB()
{
	var maxheight	=	document.viewport.getHeight();
	var newheight	=	maxheight-285;
	if(newheight > 100)
		$('inbox21').setStyle({height: newheight+'px'});
}
function autoWidthIB()
{
	var newwidth	=	($('inbox21').scrollHeight > $('inbox21').offsetHeight) ? '677px' : '660px';
	$('inbox21').setStyle({width: newwidth});
	//alert(typeof($('inbox21').scrollHeight)+'-'+typeof($('inbox21').offsetHeight)+'='+$('inbox21').scrollHeight+'-'+$('inbox21').offsetHeight);
}
