// JavaScript Document

function prepareInternalNav() {
	if (!document.getElementById) return false;
	if (!document.getElementsByTagName) return false;
	var links=document.getElementsByTagName('a');
	var showText=true;
	for (var i=0; i<links.length; i++) {
		if (links[i].className.indexOf('readMore')==-1) continue;
		var sectionId=links[i].getAttribute('href').split('#')[1];
		document.getElementById(sectionId).style.display='none';
		links[i].destination=sectionId;
		links[i].onclick=function () {
			if (showText) {
				showSection(this.destination);
				showText=false;
				var text='Close full description'; 
				this.childNodes[0].nodeValue=text;
				return false;
				
			} else {
				hideSection(this.destination);
				var text="Read full story";
				this.childNodes[0].nodeValue=text;
				showText=true;
				
			}
		}
	}
}

function showSection(id) {
	var divs=document.getElementsByTagName('div');
	for (var i=0; i<divs.length; i++) {
		if (divs[i].className.indexOf('voiceMore')==-1) continue;
		if (divs[i].getAttribute('id') != id) {
			divs[i].style.display='none';
		} else {
			divs[i].style.display='block';
		}
	}
}

function hideSection (id) {
	document.getElementById(id).style.display='none';
}


	

addLoadEvent(prepareInternalNav);