// This file scans nodes for an expand marker "{+}".
// It then adds the remainder into a hidden span, which is revealed when "see more" is clicked.
document.observe("dom:loaded", function () {
	var mynodes = $$('.text');
	mynodes.each (function(node){
		if (node.innerHTML.match(/{\+}/)) {
			var newHTML = node.innerHTML;
			newHTML = newHTML.replace(/{\+}/, ' <a href="#" onclick="Effect.Fade(this);Effect.Appear(this.nextSibling);return false;" class="expandlink">'+snippet('miscexpandmore')+'</a><span class="expandblock" style="display:none;"> ');
			newHTML = newHTML.replace(/$/, '</span>');
			node.innerHTML = newHTML;
      
      var head2nodes = node.parentNode.getElementsByTagName('h2');
/*      var newHeadNode = document.createElement("a");
      newHeadNode.setAttribute("href","#");
      newHeadNode.setAttribute("onclick","Effect.Fade($$(\'.expandlink\')[0]);Effect.Appear($$(\'.expandblock\')[0]);return false;");
      newHeadNode.appendChild((head2nodes[0]).cloneNode(true));
      head2nodes[0].parentNode.replaceChild(newHeadNode,head2nodes[0]);
 */    var newHeadHtml = '<a id="expand" href="#" onclick="Element.addClassName(\'expand\',\'no_underline\');Effect.Fade($$(\'.expandlink\')[0]);Effect.Appear($$(\'.expandblock\')[0]);return false;">' + head2nodes[0].innerHTML + '</a>';
      head2nodes[0].innerHTML = newHeadHtml;
      
			if (dtas_updateLinks) dtas_updateLinks();
		}	
	});
});

