/* configurables */
var delayTime = 0; //time delay for adding new words when 'read' more is clicked./this is not being used currently
var textEntries = 3; //number of news items to track text for/this is not being used currently

/* other variables */
var lessText = new Array();
var moreText = new Array();
var tempInterval = new Array();
var lessLink = "<br /><a href='#' onmousedown='less(this);'>read less</a>";
var moreLink = "<!--split--><br /><a href='#' onmousedown='more(this);'>read more</a>";

var noLinkText;
//var fullText; 
var x=0;
var n;

function more(whichRead){
	//alert(whichRead.getParent().id); //this won't work in IE
	
	n = whichRead.parentNode.id.charAt(4); //last character is read therefore this won't work for more than 10 items
		
	whichRead.style.display="none";
	
	arMoreText = moreText[n].split(" ");
	
	tempText = document.getElementById("item" + eval(n)).innerHTML;
	noLinkText = tempText.split ("<!--split-->");
	
	document.getElementById("item" + eval(n)).innerHTML = moreText[n] + lessLink;
	//to add 1 word at a time uncomment the line below and comment out the line above
	//tempInterval[x] = window.setTimeout("addText(" + x + ")",delayTime);
}

//Function adds the additional copy one word at a time.
//It was decided that this would not be used.
function addText(x){
		//add one more word from the arMoreText array until all have been added
		document.getElementById("item" + eval(n)).innerHTML = noLinkText[0] + " " + arMoreText[x] + "<!--split-->"; //we only need the split delimiter added at the end
		tempText = document.getElementById("item" + eval(n)).innerHTML;
		noLinkText = tempText.split ("<!--split-->");
		
		if (x < arMoreText.length-1){
			x++;
			tempInterval[x] = window.setTimeout("addText(" + x + ")",delayTime);
			
		}else{
			x=0;
			textTemp = noLinkText[0] + lessLink;
			document.getElementById("item" + eval(n)).innerHTML = textTemp;
		}
		
}

function less(whichLess){
	n = whichLess.parentNode.id.charAt(4); //last character is read therefore this won't work for more than 10 items
	
	textTemp = lessText[n] + moreLink;
	document.getElementById("item" + eval(n)).innerHTML = textTemp;
}


function changeSize(whichOne){
	//whichOne.style.height='500px';
	//alert(whichOne.parentNode.id.charAt(4));
	//whichRead.getParent().id.charAt(4);
}