//jQuery.noConflict();

function showMessage(text)
{
	if (text == null || text == "" || !text) {
		text = "Default message text";
	}
	
	jQuery('#message_caption').html("Message");
	jQuery('#popup_message').html('<p>' + text + '</p>');
	jQuery('#popup').show();
	jQuery('#warning').show();
	jQuery('#error').hide();
	
	document.getElementById('popup').scrollIntoView();
	
	setTimeout(hideAlert, 1000);
}

function showError(text)
{
	if (text == null || text == "" || !text) {
		text = "Default message text";
	}
	
	jQuery('#popup_error').html('<p>' + text + '</p>');
	jQuery('#popup').show();
	jQuery('#error').show();
	jQuery('#warning').hide();
	
	if (!document.getElementById('popup')) {
		
	} else {
		document.getElementById('popup').scrollIntoView();
	}	
}

function hideAlert()
{
	jQuery('#popup').hide();
	jQuery('#warning').hide();
	jQuery('#error').hide();
}

function JSON_decode(str) {
    return eval('(' + str + ')');
}

var common = {
	toggleAllCheckboxes: function(checked, name) {
		jQuery("input[@name*="+name+"]").attr("checked", checked);
	},
	
	addVar2Tpl: function(varName) {
		var object = jQuery("textarea:first");
		object.html(object.html() + varName);
	}
}