function sendError(domain)
{
	var html = $$('html')[0].innerHTML;

	new Ajax.Request('http://' + domain + '/beta/saveError',
	{
		method: 'post',
		parameters:
		{
			source: html
		},
		onSuccess: function()
		{
			var url = location.href.replace(/[\/]/g, '$');
			location.href = 'http://' + domain + '/beta/sendError/' + url;
		}
	});
}

function initSidebar()
{
	resizeSidebar(true);
}

function resizeSidebar()
{
	var minimize = (arguments[0]) ? true : false;
	var _height = 460;

	if(!$('contentWithSidebar'))
		return true;

	var content = $('contentWithSidebar').down();
	var sidebar = $('contentWithSidebar').down().next();
	var contentTile = sidebarTile = null;

	sidebarHeight = sidebar.offsetHeight;
	contentHeight = content.offsetHeight;

	if($('withSidebarContentTile'))
		contentTile = $('withSidebarContentTile');

	if($('withSidebarSidebarTile'))
		sidebarTile = $('withSidebarSidebarTile');

	if((sidebarHeight > 460 || contentHeight > 460) && minimize)
	{
		if(contentTile != null)
		{
			if(window.ie6)
			{
				contentTile.style.height = (_height - 20) + 'px';
			}
			else
			{
				contentTile.style.minHeight = (_height - 20) + 'px';
				contentTile.style.height = 'auto';
			}
		}
		else
		{
			if(window.ie6)
			{
				content.style.height = _height + 'px';
			}
			else
			{
				content.style.minHeight = _height + 'px';
				content.style.height = 'auto';
			}
		}

		if(sidebarTile != null)
		{
			if(window.ie6)
			{
				sidebarTile.style.height = (_height - 20) + 'px';
			}
			else
			{
				sidebarTile.style.minHeight = (_height - 20) + 'px';
				sidebarTile.style.height = 'auto';
			}
		}
		else
		{
			if(window.ie6)
			{
				sidebar.style.height = _height + 'px';
			}
			else
			{
				sidebar.style.minHeight = _height + 'px';
				sidebar.style.height = 'auto';
			}
		}

		sidebarHeight = sidebar.offsetHeight;
		contentHeight = content.offsetHeight;
	}

	if(contentHeight > _height)
		_height = contentHeight;

	if(sidebarHeight > _height)
		_height = sidebarHeight;

	if(contentTile != null)
	{
		if(window.ie6)
		{
			contentTile.style.height = (_height - 20) + 'px';
		}
		else
		{
			contentTile.style.minHeight = (_height - 20) + 'px';
			contentTile.style.height = 'auto';
		}
	}
	else
	{
		if(window.ie6)
		{
			content.style.height = _height + 'px';
		}
		else
		{
			content.style.minHeight = _height + 'px';
			content.style.height = 'auto';
		}
	}

	if(sidebarTile != null)
	{
		if(window.ie6)
		{
			sidebarTile.style.height = (_height - 20) + 'px';
		}
		else
		{
			sidebarTile.style.minHeight = (_height - 20) + 'px';
			sidebarTile.style.height = 'auto';
		}
	}
	else
	{
		if(window.ie6)
		{
			sidebar.style.height = _height + 'px';
		}
		else
		{
			sidebar.style.minHeight = _height + 'px';
			sidebar.style.height = 'auto';
		}
	}

	return true;
}

function checkbox()
{
	if(arguments.length < 2)
		return false

	el = arguments[0];
	var expandEl = getEl(arguments[1]);

	var invert = (arguments[2]) ? true : false;

	if(el.checked == true)
	{
		if(invert)
			show(expandEl);
		else
			hide(expandEl);
	}
	else
	{
		if(invert)
			hide(expandEl);
		else
			show(expandEl);
	}

	resizeSidebar(true);
}

function showSelects()
{
	$$('select').each(function(select)
	{
		select.style.visibility = 'visible';
	});
}

function hideSelects()
{
	$$('select').each(function(select)
	{
		select.style.visibility = 'hidden';
	});
}
