var persist = false;

function DisplayPopup(popupName, xOffset) {
	//alert(popupName);
	persist = true;
	
	// Align popup from right
	var width;
	if (typeof window.innerWidth != 'undefined') {
		width = window.innerWidth;
		document.getElementById(popupName).style.width = '147px';
	}
	else if (typeof document.documentElement != 'undefined'	&& typeof document.documentElement.clientWidth !='undefined' && document.documentElement.clientWidth != 0) {
		width = document.documentElement.clientWidth;
		document.getElementById(popupName).style.width = '147px';
	}
	else {
		width = document.getElementsByTagName('body')[0].clientWidth;
		document.getElementById(popupName).style.width = '157px';
	}
	
	var offset = Math.round((width * .1) / 2)+xOffset;
	document.getElementById(popupName).style.right = offset + 'px';
	
	// Finally, show the pop-up
	document.getElementById(popupName).style.display = 'block';
}

function HidePopup(popupName) {
	persist = false;
	setTimeout("HidePopupReal('"+popupName+"')", 150);
}

function HidePopupReal(popupName) {
	if(!persist)
		document.getElementById(popupName).style.display = 'none';
}

function Persist() {
	persist = true;
}