function addEvent(elm, evType, fn, useCapture)
{
		if(elm.addEventListener)
		{
			elm.addEventListener(evType, fn, useCapture);
			return true;
		}
		else if (elm.attachEvent)
		{
			var r = elm.attachEvent('on' + evType, fn);
			return r;
		}
		else
		{
			elm['on' + evType] = fn;
		}
}

function addPrintLinks()
{
var el = document.getElementsByTagName("div");
for (i=0;i<el.length;i++)
	{
	if (el[i].className=="print_section")
		{
		var newLink = document.createElement("a");
		var newLink2 = document.createElement("a");
		var newLinkText = document.createTextNode("print song");
		var newLinkText2 = document.createTextNode(" ");

		var newLinkPara = document.createElement("p");
		newLinkPara.setAttribute("class","printbutton");
		
		//set up the 'print this section' link
		newLink.setAttribute("href","#");
		var btId = "printbut_" + el[i].id;
		newLink.setAttribute("id",btId);
		newLink.appendChild(newLinkText);
		newLink.setAttribute("href","#");
		newLinkPara.appendChild(newLink);
		
		//set up the print all link
		newLink2.setAttribute("href","#");
		var bt2Id = "printall_" + el[i].id;
		newLink2.setAttribute("id",bt2Id);
		newLink2.appendChild(newLinkText2);
		newLink2.setAttribute("href","#");
		newLinkPara.appendChild(newLink2);

		//add the behaviours for the new links
		newLink.onclick = togglePrintDisplay;
		newLink.onkeypress = togglePrintDisplay;
		newLink2.onclick = printAll;
		newLink2.onkeypress = printAll;

		//insert the para and the two links into the DOM
		el[i].appendChild(newLinkPara);
		
		}
	}
}

function togglePrintDisplay(e)
{
var whatSection = this.id.split("_");
whatSection = whatSection[1];
var el = document.getElementsByTagName("div");
for (i=0;i<el.length;i++)
	{
	if (el[i].className.indexOf("section")!=-1)
		{
		el[i].removeAttribute("className");
		if (el[i].id==whatSection)
			{
			//show only this section for print
			el[i].setAttribute("className","print_section print");
			el[i].setAttribute("class","print_section print");
			}
		else
			{
			//hide the sections from print-out
			el[i].setAttribute("className","print_section noprint");
			el[i].setAttribute("class","print_section noprint");
			}
		}
	}

if (window.event) 
	{
	window.event.returnValue = false;
	window.event.cancelBubble = true;
	} 
else if (e) 
	{
	e.stopPropagation();
	e.preventDefault();
	}

window.print();
}

function printAll(e)
{
var el = document.getElementsByTagName("div");
for (i=0;i<el.length;i++)
	{
	if (el[i].className.indexOf("print_section")!=-1)
		{
		el[i].setAttribute("className","print_section print");
		el[i].setAttribute("class","print_section print");
		}
	}
if (window.event) 
	{
	window.event.returnValue = false;
	window.event.cancelBubble = true;
	} 
else if (e) 
	{
	e.stopPropagation();
	e.preventDefault();
	}
window.print();
}
addEvent(window, 'load', addPrintLinks, false);

function dsp(loc){
   if(document.getElementById){
      var foc=loc.firstChild;
      foc=loc.firstChild.innerHTML?
         loc.firstChild:
         loc.firstChild.nextSibling;
      foc.innerHTML=foc.innerHTML=='+'?'-':'+';
      foc=loc.parentNode.nextSibling.style?
         loc.parentNode.nextSibling:
         loc.parentNode.nextSibling.nextSibling;
      foc.style.display=foc.style.display=='block'?'none':'block';}}  

if(!document.getElementById)
   document.write('<style type="text/css"><!--\n'+
      '.dspcont{display:block;}\n'+
      '//--></style>');