﻿
function trim(str) {
	if (!str || typeof str != 'string')
	{ return null; }

	return str.replace(/^[\s]+/, '').replace(/[\s]+$/, '').replace(/[\s]{2,}/, ' ');
}

function setBlocksContent(catalog) {
	$.ajax({
		type: "GET",
		url: pls_appName + "AjaxSapBlock.aspx?catalog=" + catalog,
		contentType: "application/json; charset=utf-8",
		cache: false,
		success: function(msg) {
			if (msg == null || trim(msg) == "" || msg=="error") {
				$("#sapBlocksHtml").toggle(false);
			}
			else {
			    $("#sapBlocksHtml").html(msg);
			}
		}
	/*	error: function (XMLHttpRequest, textStatus, errorThrown) {
			alert(XMLHttpRequest+textStatus+errorThrown);
		}*/
	});
}
