// // //GLOBAL VARIABLES var objectIdToSlideDown = false; //Flag to indicate if there is any openned (scrolled) element. var activeIdCode = false; //Id from current openned element. var slideInProgress = false; //Flag to indicate if there is a slide in progress. // function showHideContent(inputId, slideSpeed, expandMultiple) { if(slideInProgress) { return; } slideInProgress = true; if (!(slideSpeed=='1' || slideSpeed=='3' || slideSpeed=='5')) { slideSpeed = "3"; } var inputIdLegth = inputId.length; var idCode = inputId.substring(18,inputIdLegth+1); var showMoreContentContainerElement = document.getElementById('showMoreContentContainerId' + idCode); objectIdToSlideDown = false; if(!showMoreContentContainerElement.style.display || showMoreContentContainerElement.style.display=='none') { if(activeIdCode && activeIdCode!=idCode && !expandMultiple) { objectIdToSlideDown = idCode; slideContent(activeIdCode,(slideSpeed*(-1)),slideSpeed); } else { showMoreContentContainerElement.style.display='block'; showMoreContentContainerElement.style.visibility = 'visible'; slideContent(idCode,slideSpeed,slideSpeed); } } else { slideContent(idCode,(slideSpeed*(-1)),slideSpeed); activeIdCode = false; } } // function slideContent(inputId,direction,slideSpeed) { var showMoreContentContainerElement = document.getElementById('showMoreContentContainerId' + inputId); var showMoreContentElement = document.getElementById('showMoreContentId' + inputId); var showMoreHeadlineElement = document.getElementById('showMoreHeadlineId' + inputId); var height = showMoreContentContainerElement.clientHeight; if(height == 0) { height = showMoreContentContainerElement.offsetHeight; } height = height + direction; var rerunFunction = true; if((height) > showMoreContentContainerElement.scrollHeight) { height = showMoreContentContainerElement.scrollHeight; rerunFunction = false; } if(height <= 1) { height = 1; rerunFunction = false; } showMoreContentContainerElement.style.height = height + 'px'; var topPosition = height - showMoreContentElement.offsetHeight; if(topPosition > 0) { topPosition=0; } showMoreContentElement.style.top = topPosition + 'px'; if(rerunFunction) { showMoreContentElement.timer = setTimeout("slideContent('" + inputId + "'," + direction + "," + slideSpeed + ")",10); } else { if(height <= 1) { showMoreContentContainerElement.style.display='none'; document.getElementById('showLessHeadlineId' + inputId).style.visibility='hidden'; document.getElementById('showLessHeadlineId' + inputId).style.display='none'; document.getElementById('showMoreHeadlineId' + inputId).style.visibility='visible'; document.getElementById('showMoreHeadlineId' + inputId).style.display='block'; if (document.getElementById("showLessHeadlineIdExtra" + inputId)) { document.getElementById('showLessHeadlineIdExtra' + inputId).style.visibility='hidden'; document.getElementById('showLessHeadlineIdExtra' + inputId).style.display='none'; } if(objectIdToSlideDown && objectIdToSlideDown!=inputId) { document.getElementById('showMoreContentContainerId' + objectIdToSlideDown).style.display='block'; document.getElementById('showMoreContentContainerId' + objectIdToSlideDown).style.visibility='visible'; document.getElementById('showLessHeadlineId' + objectIdToSlideDown).style.visibility='visible'; document.getElementById('showLessHeadlineId' + objectIdToSlideDown).style.display='block'; document.getElementById('showMoreHeadlineId' + objectIdToSlideDown).style.visibility='hidden'; document.getElementById('showMoreHeadlineId' + objectIdToSlideDown).style.display='none'; if (document.getElementById("showLessHeadlineIdExtra" + objectIdToSlideDown)) { document.getElementById('showLessHeadlineIdExtra' + objectIdToSlideDown).style.visibility='visible'; document.getElementById('showLessHeadlineIdExtra' + objectIdToSlideDown).style.display='block'; } slideContent(objectIdToSlideDown,slideSpeed,slideSpeed); } else { if (showMoreContentElement.timer) { clearTimeout(showMoreContentElement.timer); } slideInProgress = false; } } else // The end: there is nothing to be slided anymore { document.getElementById('showLessHeadlineId' + inputId).style.visibility='visible'; document.getElementById('showLessHeadlineId' + inputId).style.display='block'; document.getElementById('showMoreHeadlineId' + inputId).style.visibility='hidden'; document.getElementById('showMoreHeadlineId' + inputId).style.display='none'; if (document.getElementById("showLessHeadlineIdExtra" + inputId)) { document.getElementById('showLessHeadlineIdExtra' + inputId).style.visibility='visible'; document.getElementById('showLessHeadlineIdExtra' + inputId).style.display='block'; } activeIdCode = inputId; if (showMoreContentElement.timer) { clearTimeout(showMoreContentElement.timer); } slideInProgress = false; } } }