/* Copyright IBM Corp. 2001, 2008 */
/* Javascript File */ /*version 1.08 7/17/08*/
function showAllTags(){
	document.getElementById("allTags").style.top="200px";
	document.getElementById("allTags").style.left="200px";
	var vOverlay=document.getElementById("overlay");	
	//have to use javascript to get overlay to be as tall as the whole page
	var body = document.documentElement ? document.documentElement : document.body;
	var windowHeight = window.innerHeight ? window.innerHeight : body.clientHeight;	
	if (body.scrollHeight > windowHeight) windowHeight = body.scrollHeight;	
	vOverlay.style.height=windowHeight+ "px";
	vOverlay.style.display="block";	
}

function hideAllTags(){
	var vTagPopup=document.getElementById("allTags").style.top="-9999px";
	document.getElementById("overlay").style.display="none";
}

function newSort(pItem){
	clearSelection("moreSorts");
	var vParent=pItem.parentNode;
	vParent.className="lotusSelected";
	var vActiveSort=document.getElementById("lotusActiveSort");
	vActiveSort.innerHTML=pItem.innerHTML;
	reverseSort(vActiveSort); //sets initial sort direction indicator
}
	
function clearSelection(pMenu){
	var vMenu=document.getElementById(pMenu);
	for (x in vMenu.childNodes){
		vMenu.childNodes[x].className="";
	}
}
	
function clearSort(pElem){
	if(pElem.className!="") return;
	var vList=pElem.parentNode.parentNode;
	for (x in vList.childNodes){
		try{
			vList.childNodes[x].firstChild.className="";
		}catch(e){
			//nothing
		}
	}
}
	
function reverseSort(pElem){
	if (pElem.className.indexOf("lotusAscending")!=-1 || pElem.className=="") pElem.className="lotusActiveSort lotusDescending"
	else pElem.className="lotusActiveSort lotusAscending";
}

function openMoreSorts(pElem){
	document.getElementById(pElem).className += " lotusSelected";
}

function closeMoreSorts(pElem){
	document.getElementById(pElem).className = "lotusMoreSorts";
}
	
function showHoverLink(pID, pCardId, e){
	if (MenuPopup.isOpen(pID) || MenuPopup.isOpen(pCardId)) return;
	MenuPopup.showMenu( 'hoverLink', e, {placement: 'left,bottom'});
}

function showVCard(pID, pLink, e){
	var vX = getOffsetLeft(pLink,0);
	var vY = getOffsetTop(pLink,0);
	var vXY = vX + ","+ vY;
	MenuPopup.showMenu( pID, e, {placement:vXY});
}

function toggleVCard(pDiv){
	var vCard=document.getElementById(pDiv+ "Pivot");
	var vCardInfo=document.getElementById(pDiv+"Details");
	if (vCard.className.indexOf('lotusPivotNavOpen')!=-1){
		vCard.className="lotusPivotNav";
		vCardInfo.style.display="none";
	}else{
		vCard.className="lotusPivotNav lotusPivotNavOpen";
		vCardInfo.style.display="block";
	}
}

function toggleMoreApps(pDiv,pLink){
	var vSecondRow=document.getElementById(pDiv);
	if (pLink.className.indexOf("lotusMoreExpanded")!=-1){
		pLink.className="lotusMore";
		vSecondRow.style.display="none";
	}else{	
		pLink.className+=" lotusMoreExpanded";
		vSecondRow.style.display="";
	}
}

function displayMore(pMenu, pMoreControl){
	pMoreControl.style.display="none";
	document.getElementById(pMenu).style.display="block";
}
 
function toggleSearch(pElem,pForm){
   var vForm=document.getElementById(pForm);
   if (pElem.parentNode.className.indexOf("lotusTabExpanded")==-1){
	   pElem.parentNode.className+=" lotusTabExpanded";
	   vForm.style.display="block";
   }else{
	   pElem.parentNode.className="lotusSearchTab";
	   vForm.style.display="none";
   }//end if
}

function showElem(pElem){
	document.getElementById(pElem).style.display="block";
}

function hideElem(pElem){
	document.getElementById(pElem).style.display="none";
}
function getOffsetTop(pElem,pOTOP){
	//this function is called recursively until we get to the body element.  Not needed for absolutely positioned items.
	var offset = 0;
	var curElem = pElem;
	while (curElem){
		offset += curElem.offsetTop;
   		curElem = curElem.offsetParent;
   		if (curElem) offset -= curElem.scrollTop;
   	}
	return offset;
}

function getOffsetLeft(pElem,pOLEFT){
	//this function is called recursively until we get to the body element. Not needed for absolutely positioned items.
	var offset = 0;
	var curElem = pElem;
	while (curElem){
		offset += curElem.offsetLeft;
   		curElem = curElem.offsetParent;
   		if (curElem) offset -= curElem.scrollLeft;
   	}
	return offset;
}
