<html>

<head>

<script language=javascript>

function graph(caption,xname,yname) {

this.caption=caption;

this.xname=xname;

this.yname=yname;

this.cols =new Array();

this.maxvalue =maxvalue;

this.maxres =maxres;

this.addcol=addcol;

}

function addcol(name,value,color) {

if (addcol.arguments.length==3) {

this.cols[this.cols.length] =new col(name,value,color);

}

else {

this.cols[this.cols.length] =new col(name,value);

}

}

function maxres() {

maxres=0;

for (i=0;i<this.cols.length;i++) {

if ((this.cols[i].value+"").indexOf('.') !=-1) {

res=((this.cols[i].value+"").length-(this.cols[i].value+"").indexOf('.'))-1;

maxres=(res>maxres)?res:maxres;

}

}

return maxres;

}

function maxvalue() {

maxvalue=0;

for (i=0;i<this.cols.length;i++) {

maxvalue=(this.cols[i].value>maxvalue)?this.cols[i].value:maxvalue;

}

return maxvalue;

}

function col(name,value,color) {

this.name=name;

this.value=value;

this.color=(col.arguments.length==3)?color:"#000000";

}

function makeChart (graph,width,height) {

y=graph.maxvalue();

maxres=graph.maxres();

y*=Math.pow(10,maxres);

y++;

x=graph.cols.length;

document.writeln("<table bgcolor=#ffffff border=0 cellspacing=0 cellpadding=0 width="+width+">");

width=Math.round(width/x);

height=Math.round(height/y);

document.writeln("<tr><td colspan="+(x*2+2)+" align=center bgcolor=#ffffff><b>"+graph.caption+"</b></td></tr>");

document.writeln("<tr><td rowspan="+(y+2)+" align=center valign=center bgcolor=#ffffff>"+graph.yname+"&nbsp;</td></tr>");

for (i=y;i>0;i--) {

document.write ("<tr>");

if (!(i%Math.round(y/10))) {

document.write("<td height="+height+">"+i/Math.pow(10,maxres)+"</td>");

}

else {

document.write("<td height="+height+" bgcolor=#ffffff></td>");

}

for (h=0;h<x;h++) {

if (graph.cols[h].value*Math.pow(10,maxres)==i) {

document.writeln("<td bgcolor="+graph.cols[h].color+" rowspan="+graph.cols[h].value*Math.pow(10,maxres)+" width="+Math.round(width*.75)+">&#160;</td>");

}

if (i==y) {

document.writeln("<td valign=bottom align=center bgcolor=#ffffff rowspan="+(y-(graph.cols[h].value*Math.pow(10,maxres)))+" width="+Math.round(width*.75)+">"+graph.cols[h].value+"</td>");

document.write("<td width="+Math.round(width/4)+" bgcolor=#ffffff rowspan="+y+">&#160;</td>");

}

}

document.writeln("</tr>");

}

document.write("<tr><td>&#160;</td>");

for (h=0;h<x;h++) {

document.writeln("<td align=center>"+graph.cols[h].name+"</td><td>&#160;</td>");

}

document.writeln ("</tr><tr><td>&#160;</td><td>&#160;</td><td colspan="+(x*2)+" align=center><br>"+graph.xname+"</td></tr></table>");

}

sales=new graph("Sales for 1988","Month","Sales");

sales.addcol("Jan",34,"#dd2222");

sales.addcol("Feb",7);

sales.addcol("Mar",12);

sales.addcol("Apr",2);

sales.addcol("May",12);

sales.addcol("Jun",17);

sales.addcol("Jul",3);

sales.addcol("Aug",8);

sales.addcol("Sep",9);

sales.addcol("Oct",0);

sales.addcol("Nov",28,"#dd2222");

sales.addcol("Dec",42,"#dd2222");

share=new graph("Market Share for our product line","Product","Percent");

share.addcol("Cookies",1.28,"#0000ff");

share.addcol("Candy",.25,"#4400bb");

share.addcol("Cupcakes",.06,"#880099");

share.addcol("Ice Cream",.24,"#aa0055");

share.addcol("Brownies",.38,"#ee0011");

score=new graph("Breakdown of Student Ranking","Score","# of Votes");

score.addcol("1",0);

score.addcol("2",2);

score.addcol("3",0);

score.addcol("4",6);

score.addcol("5",3);

score.addcol("6",12);

score.addcol("7",15);

score.addcol("8",14);

score.addcol("9",9);

score.addcol("10",4);

fib= new graph("Fibinacci Sequence","# in sequence","value");

fib.addcol("1",1);

function fibin (total,value,one,two){

value=parseInt(value);

total=parseInt(total)

one=parseInt(one);

two=parseInt(two);

if (value<total) {

fib.addcol(value,one);

fibin(total,++value,two,(one+two));

}

}

fibin(11,2,1,2);

</script>

</head>

<body bgcolor=#ffffff>

<table border=0 cellspacing=5>

<tr><td>

<script language=javascript>

makeChart (sales,325,300);

</script>

</td>

<td>

<script language=javascript>

makeChart (share,325,275);

</script>

</td></tr></table>

<center><script language=javascript>

makeChart (score,600,350);

makeChart (fib,600,350);

</script></center></body>

</html>