 

//JavaScript Graph-it! (Absolute)- by javascriptkit.com
//Visit JavaScript Kit (http://javascriptkit.com) for script
//Credit must stay intact for use

var graphimage="../images/elements/purple_square.gif" 

//DEFINE GRAPH VALUES [Item name, absolute value]


//YOU CAN DEFINE MULTIPLE GRAPHS, eg:
//var graphy=new Array()


function graphit(g,gwidth){
total=0
for (i=0;i<g.length;i++)
total+=parseInt(g[i][1])

output='<table class="maintext" border="0" cellspacing="0" cellpadding="0">'
output+='<tr><td height="20"></td></tr>'
for (i=0;i<g.length;i++){
calpercentage=Math.round(g[i][1]*100/total)
calwidth=Math.round(gwidth*(calpercentage/100))
output+='<tr><td>'+g[i][0]+'&nbsp;</td><td><img src="'+graphimage+'" width="'+(calwidth/2)+'" height="10"> '+calpercentage+'%</td></tr>'
output+='<tr><td height="4"></td></tr>'
}
output+='</table>'
//document.write(output+'<br>Total participants: <b>'+total+'</b>')
document.write(output)

}

//CALL GRAPHIT FUNCTION
//graphit(NAME OF GRAPH ARRAY, MAXIMUM WIDTH IN PIXELS)
function createGraph(graphx)
{
 
graphit(graphx,150)
 }

 