function getNextsibling(n)
{
x=n.nextSibling;
while (x.nodeType!=1)
  {
  x=x.nextSibling;
  }
return x;
}
function replacecarriagereturn(textarea,replaceWith)  
{   
	textarea.value = escape(textarea.value);  
	//encode all characters in text area  
	//to find carriage return character  
	for(i=0; i < textarea.value.length; i++)  
	{   
		//loop through string, replacing carriage return   
		//encoding with HTML break tag  
		if(textarea.value.indexOf("%0D%0A") > -1)  
		{   
		  //Windows encodes returns as \r\n hex  
		  textarea.value=textarea.value.replace("%0D%0A",replaceWith);  
		}  
		else if(textarea.value.indexOf("%0A") > -1)  
		{   
		  //Unix encodes returns as \n hex  
		  textarea.value=textarea.value.replace("%0A",replaceWith);  
		}  
		else if(textarea.value.indexOf("%0D") > -1)  
		{   
		  //Macintosh encodes returns as \r hex  
		  textarea.value=textarea.value.replace("%0D",replaceWith);  
		}  
	}  
	textarea.value=unescape(textarea.value);  
	//decode all characters in text area back  
}  
function Info (){
	//this.infoOBJ = this;
	this.arrCallers = null;
	this.strCallersHolderID = "herotext";
	this.strInfoDisplayTitleID = "infoTitleDisplayer";
	this.strInfoDisplayBodyID = "infoDisplayer";
	this.strIMGdisplayID = "heroimg";
	this.paraIMGsrcHoldBaseID = "imgSRChold";
	this.currentInfoTitle = "";
	this.currentInfoBody = "";
	this.domInfoBodyDisplay = null;
	this.domInfoTitleDisplay = null;
	this.domIMGdisplay = null;
}

Info.prototype.init = function()
{
  this.arrCallers = document.getElementById(this.strCallersHolderID).getElementsByTagName("a");
  this.domInfoBodyDisplay = document.getElementById(this.strInfoDisplayBodyID);
  this.domInfoTitleDisplay = document.getElementById(this.strInfoDisplayTitleID);
  this.domIMGdisplay = document.getElementById(this.strIMGdisplayID);
}

Info.prototype.loadInfoItem = function()
{
	this.domInfoBodyDisplay.innerHTML = "";
	this.domInfoTitleDisplay.innerHTML = "";
	this.domInfoBodyDisplay.innerHTML = this.currentInfoBody;
	this.domInfoTitleDisplay.innerHTML = this.currentInfoTitle;
}

Info.prototype.assignCallbacks = function(objRef)
{
  for(var i=0; i < this.arrCallers.length; i++){
	  this.arrCallers[i].onclick = function(){
		  var callerIndex = this.id.substring(this.id.indexOf("_")+1,this.id.length);
		  objRef.domIMGdisplay.style.display = "none";
		  objRef.domIMGdisplay.setAttribute("src","");
		  var elParBody = getNextsibling(this.parentNode);
		  var elParImgSrcContainer = getNextsibling(getNextsibling(this.parentNode));
		  if(elParImgSrcContainer.id == (objRef.paraIMGsrcHoldBaseID + callerIndex)) {
			  objRef.domIMGdisplay.style.display = "block";  
			  objRef.domIMGdisplay.setAttribute("src",elParImgSrcContainer.childNodes[0].nodeValue);
		  }
		  objRef.currentInfoBody = elParBody.innerHTML;//elParBody.childNodes[0].nodeValue;
		  objRef.currentInfoTitle  = this.innerHTML;
		  objRef.loadInfoItem();
		  objRef.setActive(callerIndex);
	  }
  }
}

Info.prototype.setActive = function(intCallerIndex)
{
	for(var i=0; i < this.arrCallers.length; i++){
		this.arrCallers[i].style.fontWeight = "normal";
	}
	this.arrCallers[intCallerIndex].style.fontWeight = "bold";
}