
// Common Javascript Functions
// By Daniel Rehn © 2009


function showDiv(e)
{
	var obj = document.getElementById(e);
	if(obj)
	{
		obj.style.visibility = "visible";
		obj.style.display = "block";
	}
}

function hideDiv(e)
{
	var obj = document.getElementById(e);
	if(obj)
	{
		obj.style.visibility = "hidden";
		obj.style.display = "none";
	}
}


function alterDivContent(div, content) {
	if (document.all) {
		eval("document.all."+div).innerHTML=content;
		
	} else if (document.getElementById) {
		rng = document.createRange();
		el = document.getElementById(div);
		rng.setStartBefore(el);
		htmlFrag = rng.createContextualFragment(content);
		while (el.hasChildNodes())
			el.removeChild(el.lastChild);
		el.appendChild(htmlFrag);
	}
}




var popWin = null;
var popWinDefProps = 'toolbars=1, scrollbars=0, location=0, statusbars=1, menubars=1, resizable=0, ';

function closePopWin() {
	if(popWin) {
		if(!popWin.closed == true) {
			if(popWin.window) {
				popWin.window.close();
			} else {
				popWin.close();
			}
		}
	}
}

function openPopup(url, width, height) {
	closePopWin();
	var x=(screen.width/2)-(width/2), y=(screen.height/2)-(height/2);
	var properties = popWinDefProps + ', width=' + width + ', height=' + height + ', top=' + y + ', left=' + x + '';
	popWin=window.open(url, "_blank", properties);
	popWin.focus();
}