//JavaScript Graph-it! (Absolute)- by javascriptkit.com
//Visit JavaScript Kit (http://javascriptkit.com) for script
//Credit must stay intact for use

var graphbar="poll2.gif"

function graphit(g,gwidth){
total=0
for (i=1;i<g.length;i++)
total+=parseInt(g[i][1])

output='<table class="electiontable">'
output+='<tr class="ihead"><td class="box1">CANDIDATE</td><td class="box2">VOTES</td><td class="box3"> PERCENTAGE</td>'
for (i=1;i<g.length;i++){
calpercentage=Math.round(g[i][1]*100/total)
calwidth=Math.round(gwidth*(calpercentage/100)*.6)
output+='<tr class="items"><td>'+g[i][0]+'</td><td class="count">'+g[i][1]+'</td><td><img src="'+graphbar+'" width="'+calwidth+'" height="6"> '+calpercentage+'%</td></tr>'
}
output+='</table>'
document.write(output+'<table class="totals"><tr><td>Total votes: &nbsp '+total+'&nbsp&nbsp&nbsp</td><td textalign="right"></td></tr></table>')

}
