var graphimage="../js/poll.gif"

//DEFINE GRAPH VALUES [Item name, absolute value]
var graphx=new Array()

//YOU CAN DEFINE MULTIPLE GRAPHS, eg:
//var graphy=new Array()

// g = the array that has the (x,y) values
// gwidth = width of the graph in pixels
// highestValue = highest value of the x
// division = no of x point coordinates that will be marked
// increment = numeric increment of x point coordinates
function graphit(g,gwidth,highestValue,division, increment, noOfYShown){

    output='<table border="0" cellspacing="0" cellpadding="0" bgcolor="#EEEEEE"><tr><td><table>'
    for (i=0;i<g.length && i < noOfYShown;i++){
        output+='<tr><td height="20"><font face="Helvetica, Helv, Arial" size="-1">'+g[i][0]+'&nbsp;</font></td></tr>'
    }
    for (j=i;j<noOfYShown;j++){
        output+='<tr><td height="20"></td></tr>'
    }
    output+='</table></td><td><table cellpadding="1" cellspacing="0" border="0" bgcolor="#000000"><tr><td>'
    output+='<table border="0" cellspacing="0" cellpadding="0" bgcolor="#EEEEEE">'
    for (k=0;k<g.length && k < noOfYShown;k++){
        calpercentage=Math.round(g[k][1]*100/highestValue)
        calwidth=Math.round(gwidth*(division/(division+1))*(calpercentage/100))
        output+='<tr><td height="20" width="'+calwidth+'"><img src="'+graphimage+'" width="'+calwidth+'" height="14"></td></tr>'
    }
    for (m=k;m<noOfYShown;m++){
        output+='<tr><td height="20"></td></tr>'
    }
    output+='<tr><td height="20" width="'+gwidth+'"></td></tr>'

    output+='</table></td></tr></table>'
    output+='</td></tr><tr><td align=right><font face="Helvetica, Helv, Arial" size="-1">0</font></td><td>'
    // table for x point coordinates
    output+='<table width=100%><tr>'
    for (i = 1; i <= division + 1; i++){
        output+='<td align=right><font face="Helvetica, Helv, Arial" size="-1">'+(i*(increment*1))+'</font></td>'
    }
    output+='</tr></table>'
    // end of table for x point coordinates
    output+='</td></tr></table>'
    document.write(output)
}