function removeHTMLComments(html) 
{
		return html.replace(/<!(?:--[\s\S]*?--\s*)?>\s*/g,'');
}
	

function removeHTMLblock(aSourceString, aTagName)
{
	regexp= new RegExp ("<" + aTagName + "[^.]*\/" + aTagName + ">", "gi");
	vStrippedHTML = aSourceString.replace(regexp,"");
  
  return vStrippedHTML;

}	

function cleanText(curtext)
{
  var theText=curtext;
  //remove newspace
  theText= theText.replace(/&nbsp;/ig,"");
  
  //pause at end of paragraph
  theText= theText.replace(/<\/p>/ig,":");
  
  theText=removeHTMLblock(theText, 'script');
  
  theText=removeHTMLComments(theText);
  
  //remove tags
  theText= theText.replace(/(<([^>]+)>)/ig,"");
  
  return theText;
  
}

//saveTT need selection or finds story (sometimes not whole story)
function SaveTT2() 
{ 
  document.TexticTalkSubmit.TextIn.value=seltxt; 
  document.TexticTalkSubmit.Down.value=DLconst; 
  document.TexticTalkSubmit.submit(); 
  document.TexticTalkSubmit.Down.value=0;
}

function mp3ById(id)
{
  
  el = document.getElementById(id);
  
  curtext = el.innerHTML; 
  //clear the last text read. 
  lasttext = ""; 
  //Read it. 
  
  seltxt = cleanText(curtext);
  
  //alert(seltxt)
  
  SaveTT2();

}




