  // drawPercentBar()
  // Written by Matthew Harvey (matt AT unlikelywords DOT com)
  // (http://www.unlikelywords.com/html-morsels/)
  // Mod by Yvonne
  // Modded by BrophY for varibles while calling function
  // (http://www.cogknition.org/knitblogging/percentagebar/)
  // Distributed under the Creative Commons 
  // "Attribution-NonCommercial-ShareAlike 2.0" License
  // (http://creativecommons.org/licenses/by-nc-sa/2.0/)


function drawPercentBar(percent, color, background, width, border, height, lineheight) 
  { 

    if (!color) { color = "#B0B0B0"; }
    if (!background) { background = "#ffffff"; }
    if (!border) { border = "#000000"; }
 
	if ( percent >= 100 ) { pcent = 100 } else { pcent = percent; }
 
    var pixels = (width * pcent) / 100; 

    document.write("<div style=\"position: relative; line-height: 1em; background-color: " 
                   + background + "; border: 1px solid " + border + "; width: " 
                   + width + "px\">"); 
    document.write("<div style=\"height: " + height + "px; width: " + pixels + "px; background-color: "
                   + color + ";\"><\/div>"); 
    document.write("<div style=\"position: absolute; text-align: center; width: " 
                   + width + "px; top: "+ lineheight + "px; left: 0\">" + percent + "%<\/div>");
    document.write("<\/div>"); 
  } 