/**
 * Common DOM element functions
 * @author Andrew O'Connor
 */

function getElem(id) {
	return document.getElementById(id);
}

function getOpenerElem(id) {
	return window.opener.document.getElementById(id);
}

function setElemContent(elem, content) {
	elem.innerHTML = content;
}

function appendElemContent(elem, content) {
	elem.innerHTML += content;
}

function prependElemContent(elem, content) {
	elem.innerHTML = content + elem.innerHTML;
}

function clearElemContent(elem) {
	elem.innerHTML = "";
}

function show(elem) {
	elem.style.display = "block";
}

function hide(elem) {
	elem.style.display = "none";
}

function showHide(elem) {
	if (elem.style.display == "none")
		elem.style.display = "block";
	else
		elem.style.display = "none";
}

function removeElem(elem) {
	elem.parentNode.removeChild(elem);
}


// window related

function newWindow(id, url, width, height) {
	specs = "width="+width+",height="+height+",scrollbars=yes";
	window.open(url, id, specs);
}
