    function sendDate(num,displayID){
		document.getElementById("dayIndex").value = num;	
		if(displayID.id == null){
		document.getElementById("displayID").value = "anchorTOPSTORIES";
		}else{
		document.getElementById("displayID").value = displayID.id;	
		}		
		var currentDate = parseInt(document.getElementById("currentdayIndex").value) + parseInt(num);
		if (currentDate > 6){
		   currentDate = 0;	   
		}else if (currentDate < 0){ 
		currentDate = 6;	
		}
		document.getElementById("currentdayIndex").value = currentDate;	
		document.form1.submit();
    }

    function showSectionByName(id){
		var anchor = document.getElementById("anchor" + id);
		showSection(id);
    }

    function showSection(section){
		var sectionName = section;  
		var spanSection = "span" + sectionName;
		var anchorSection = sectionName;
	  
		(document.getElementById(anchorSection)).style.display = "none";
		(document.getElementById(spanSection)).style.display = "";
		oldSection = document.getElementById("displayID").value;
		if (oldSection != null && oldSection != sectionName){
		var oldSpanSection = "span" + oldSection;
		var oldAnchorSection = oldSection;
		(document.getElementById(oldSpanSection)).style.display = "none";
		(document.getElementById(oldAnchorSection)).style.display = "";	
		}
		document.getElementById("displayID").value = sectionName;
		var tmpSectionName = sectionName.substring(6,sectionName.length);    
		getStoryIndex(tmpSectionName);
    }

    function getStoryIndex(section){
		ajaxPage('/portal/common/storyindex/getStoryIndex.jsp?section=' + section + "&selectedDay=" + selectedDay
		, 'story_index_body', '', '', '');
    }
    
    function changeDay(day){	   
		selectedDay = parseInt(document.getElementById("currentdayIndex").value);
		var nextDay = selectedDay;    
		var dayspan = document.getElementById("dayspan");
		dayspan.innerHTML = days[nextDay];
		//var lifeSection = "section" + sectName;
		var lifeSection = "section" + lifeSectName;
		var lifeSectionSpan = document.getElementById(lifeSection);
		var showSection = document.getElementById("displayID").value;
		if (nextDay == 0){//SUNDAY, NO LIFE
			//lifeSectionSpan.style.display = "none";
			if (oldSection == lifeSectName){//move away from LIFE
			   showSection = "anchor" + lifeSectID;
			}
		}else{
			lifeSectionSpan.style.display = "inline"; 
		}    
		showSectionByName(showSection);   
    }    
    
