// Localization
function getLocalizedText(key) {
	// Perform a synchronous AJAX call:
	var result;
	$.ajax({
		type: "GET",
		url: "AjaxLocalizationAction.action",
		data: {key: key},
		dataType: "json",
		async: false,
		success: function(obj) {
			result = obj;
		}
	});
	return result;
}

function getCumulativeOffset(element) {
	var valueT = 0, valueL = 0;
	do {
		valueT += element.offsetTop  || 0;
		valueL += element.offsetLeft || 0;
		element = element.offsetParent;
	} while (element);
	return [valueL, valueT];
}

function openPopUnder(url) {
	var popUnderWindowFeatures = "width=1002,height=625,scrollbars=0,resizable=0,toolbar=0,location=0,menubar=0,status=0,directories=0";
	var popUnderCookieName = "popunder";
	var popUnderCookieLifetime=30;

	if ($.cookie(popUnderCookieName) != "true") {
		popunderWindow = window.open(url, "popunder", popUnderWindowFeatures);
		popunderWindow.blur();
		window.focus();
		$.cookie(popUnderCookieName, "true", { expires: popUnderCookieLifetime });
	}
}

