function swapVisibleDivs(showDivID, hideDivID) {	// depracated; use "jqSwapDiv(showDivID, hideDivID)" instead
	document.getElementById(showDivID).style.display="block";
	document.getElementById(hideDivID).style.display="none";
}

function jqSwapDiv(showDivID, hideDivID) {	// requires jQuery JS to be loaded
	$("div#" + showDivID).show();
	$("div#" + hideDivID).hide();
}

function toggleSubDiv(theSection) {
	if (document.getElementById(theSection.id + "_sub").style.display == "none") {
		document.getElementById(theSection.id + "_sub").style.display = "block";
		document.getElementById(theSection.id + "_switch").src="/wps/_ext/images/icons/toggle_open.gif";
	} else {
		document.getElementById(theSection.id + "_sub").style.display = "none";
		document.getElementById(theSection.id + "_switch").src="/wps/_ext/images/icons/toggle_closed.gif";
	}
}

function portletHover(portletId) {
	document.getElementById('titleBarTdOf_'+portletId).className = "titleHover";
}
function portletHoverOff(portletId) {
	document.getElementById('titleBarTdOf_'+portletId).className = "titleHoverOff";
}

// position functions
function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

function findPosX(obj) {
	var curleft = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj) {
	var curtop = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

function setPosition(theObject, positionOf) {
	try {
		theObject.style.top = findPosY(document.getElementById(positionOf)) + 'px';
		theObject.style.left = eval(findPosX(document.getElementById(positionOf)) + 4) + 'px';
		theObject.style.display="inline";
	} catch(e) {
	}
}
// end position functions

function setLogoToWelcome() {
	try {
		document.getElementById("coLogoHere").innerHTML = "";	// try to find welcome portlet's display DIV 
		document.getElementById("thisCoWelcomeBox").style.display="none";	// hide this welcome box
		document.getElementById("coLogoHere").innerHTML = document.getElementById("thisCoLogo").innerHTML;	// copy logo to welcome portlet's display DIV
		document.getElementById("thrcWelcomeDynDiv").style.display="block";	// show welcome portlet DIV
	} catch(e) {
		// alert(e);
		try {
			// document.getElementById("thisCoWelcomeBox").style.display="table";	// re-show this welcome box
		} catch(e) {
		}
	}
}

// swap two elements (usually DIVs, usually one right after the other) using jQuery slide
function jqSwapSlide(showThis, hideThis) {
	$(showThis).slideDown();
	$(hideThis).slideUp();
	return false;
}