function showElem(elem, commID, iconDivID){
	if(elem.id.indexOf(commID) > -1){
		elem.style.display = 'block';
	}
    document.getElementById(iconDivID).src = PTIncluder.imageServerURL + 'plumtree/portal/custom/LiquidSkin/SafecoCom/CTRL_LeftJSNavigation-SubMandatoryNavCommunties/minus.gif'; 
} 

function hideElem(elem, commID, iconDivID){
	//page versus community handling  
	if(elem.id.indexOf(commID + '_P') > -1){  
		elem.style.display = 'none';  
	} else if (elem.id.indexOf(commID + '_C') > -1) {  
		//if it is a comm, hide it and all its sub elements 
		elem.style.display = 'none';  
		ShowHideSubNav(elem.id,'hide'); 
	}  
	document.getElementById(iconDivID).src = PTIncluder.imageServerURL + 'plumtree/portal/custom/LiquidSkin/SafecoCom/CTRL_LeftJSNavigation-SubMandatoryNavCommunties/plus.gif'; 
} 

function ShowHideSubNav(commID,forceaction){
	var commregexp = new RegExp('^' + commID + '_[P;C]\\d+$', 'i'); 
	var leftNavDivID = 'CTRL_LeftJSNavigation-SubMandatoryNavCommunties';
	var iconDivID = commID + 'icon';
	var elems, i;
	elems = document.getElementById(leftNavDivID).childNodes; 
	for(i = 0; i<elems.length; i++){  
		if (elems[i].nodeName=="DIV"){ 
			if(elems[i].id.search(commregexp) > -1){  
				if(forceaction == 'display'){ 
					showElem(elems[i],commID,iconDivID); 
				} else if (forceaction == 'hide'){ 
					hideElem(elems[i],commID,iconDivID); 
				} else { 
					if(elems[i].style.display == 'none'){ //display 
						showElem(elems[i],commID,iconDivID); 
					} else { //hide 
						hideElem(elems[i],commID,iconDivID); 
					} 
				} 
			} 
		} 
	} 
	return true; 
}