﻿//-----------------------------------------------------------------------------
// Common
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
// String.trim
//
// Trims a string.
//-----------------------------------------------------------------------------

String.prototype.trim = function()
{
	var re = /^\s+|\s+$/g;
	return function() { return this.replace(re, ""); };
}();

//-----------------------------------------------------------------------------

function ShowPanel(id, height, fade)
{	
	if ((height == null) || (height == ''))
		height = 'auto';
			
	if (fade == undefined)
		fade = false;

	var object = $("#" + id);
				
	object.removeClass("hidden");
	object.css("height", height);
		
	if (fade)
	{
		object.hide();
		object.fadeIn("slow");
	}
}

//-----------------------------------------------------------------------------

function HidePanel(id)
{
	var object = $("#" + id);
	
	object.addClass("hidden");
}

//-----------------------------------------------------------------------------

function GetErrorHtml(errorCode, errorMessage)
{
	var html = errorMessage + '<br /><span class="error-code">(Error code ' + errorCode + ')</span>';
	return html;
}

//-----------------------------------------------------------------------------




