var rear_obs = [63,
"Red Barrel keyring",20,
"Black Prince jacket",18,
"Matching overtrousers",11,
"Turbo visor",15,
"Corker helmet",15,
"Pudding basin mooneyes",9,
"Plastic chincup",21,
"PVC seat cover",28,
"Leopard skin pattern",6,
"Bar end tassels",7,
"Ace bars/monkey hangers",16,
"Oversize forks",3,
"King and queen seat",16,
"Sidewinder",2,
"Legshields",10,
"Tin ones (not LE Velos)",4,
"Craven topbox",27,
"Knotted aero elastics",22,
"Sea socks over wellies",40,
"White silk scarf",37,
"Yellow rayon scarf",4,
"Beer towel scarf",7,
"V E S badge",2,
"Marples Must Go sticker",4,
"Crash bars",34,
"Badge bar",6,
"Fog and spot lamps",18,
"Headlamp stone guard",12,
"Headlamp cover",11,
"Goldie silencer",17,
"Dunstall megaphone",18,
"Turnout",1,
"Gas mask/tartan duffle bag",11,
"Anything cheap and rude",7,
"Parka",6,
"Above with target",0,
"Furry tails",3,
"Lots of lamps",1,
"Furry ears",2,
"Coloured headlight",5];

var most_recent = "Heather MacGregor (who should have added her red <a href=../rallies/rally_woburn.htm>Miss Fed</a> sash)";

var units = 0;

function draw_rearobs_graph() {

var wid = 200;
if (arguments.length >0) wid = 1*arguments[0];

var rearobs_links = ["red", "black", "black", "turbo", "corker", "pudding", "chincup", "seat", "seat", "tassel", "ace", "forks", "king", "side", "shield", "shield", "craven", "aero", "socks", "silk", "rayon", "towel", "ves", "marples", "crash", "badge", "lamp", "stone", "cover", "goldie", "mega", "turnout", "gas", "chart", "parka", "parka", "chart", "parka", "chart", "chart", "chart" ];

document.writeln("<div id=chart style=position:relative;width:550px;height:" + (10*rear_obs.length) + "px>");
units = wid/rear_obs[0];
var nie=10;
if (document.all) nie=0;
for (var x=1;x<rear_obs.length;x+=2) {
	document.writeln("<p class=rotitle style=top:" + (x*10-nie) + "px; onclick=\"document.getElementById('" + rearobs_links[(x-1)/2] + "').scrollIntoView()\">" + rear_obs[x] + "</p>");
	document.writeln("<div id=bar" + x + " class=robar style=width:" + (rear_obs[x+1]*units) +"px;top:" + (x*10) + "px; onclick=\"scroll_into_view('" + rearobs_links[(x-1)/2] + "')\" title='" + (Math.round(rear_obs[x+1]*100/rear_obs[0])) + "%'></div>");
	}
/*
for (var x=150+units;x<(150+wid);x+=units) {
	document.writeln("<div style=position:absolute;left:" + x + "px;width:1px;height:" + (10*rear_obs.length) + "px;background-color:#cdf;></div>");
	}
*/
var tenpcent = wid/10;
for (var x=150+tenpcent;x<(150+wid);x+=tenpcent) {
	document.writeln("<div style=position:absolute;left:" + x + "px;width:1px;height:" + (10*rear_obs.length) + "px;background-color:#cdf;></div>");
	}
 

document.writeln("<div style=position:absolute;left:150px;width:1px;height:" + (10*rear_obs.length) + "px;background-color:navy;></div>");
document.writeln("<div style=position:absolute;left:" + (150+wid) + "px;width:1px;height:" + (10*rear_obs.length) + "px;background-color:navy;></div>");
document.writeln("<div style=position:absolute;left:150px;width:" + wid + "px;height:1px;background-color:navy;overflow:hidden;></div>");
document.writeln("<div style=position:absolute;left:150px;top:" + (10*rear_obs.length) + "px;width:" + wid + "px;height:1px;background-color:navy;overflow:hidden;></div>");

if (wid < 271){
	var hinc = 119;
	var tpo = 0;
	for (var x=0; x<=Math.floor(10*rear_obs.length/hinc); x++) {
		document.write("<div class=roll style=top:" + tpo + "px;>");
		document.write("<img class=roll src=../home/graphics/blank.gif alt=\'\'>");
		document.write("<img class=roll src=../home/graphics/blank.gif alt=\'\'>");
		document.write("</div>");
		tpo+=hinc;
		}
	}

document.writeln("</div>");
create_checkboxes();
}
//------------------------------------------------
function create_checkboxes() {

document.writeln("<div id=checkbox style=position:absolute;width:35px;top:0px;>");
var checktop = 8;

for (var x=0;x<40; x++) {
	var y = (x*2+1);
	var f3 = rear_obs[y].substr(0,3);
	document.write("<div style=position:absolute;top:" + checktop + "px;width:20px;text-align:right;><input type=checkbox name=ro" + x + " value=" + f3 + x + " title=\'" + rear_obs[y] + "\' onclick=graphit(this)></div>");
	checktop +=20;
	}
document.writeln("</div>");
}
//------------------------------------------------
function graphit(ob){
var n = parseInt(ob.name.substring(2),10)*2+1;
var g = document.getElementById("bar"+n);
var s = -1;
if (ob.checked) s = 1;
g.style.width = (parseInt(g.style.width,10) + (units*s)) + "px";
}

//------------------------------------------------
function re_graph(){
var ret = false;
if (confirm('Are you sure you want to clear the form?')) {
	for (var x = 1;x<rear_obs.length;x+=2) {
		document.getElementById("bar"+x).style.width = rear_obs[x+1]*units + "px";
		}
	ret = true;
	}
return ret;
}

//------------------------------------------------
function checkSubmit()	{
if (document.phoenix3.realname.value == "" || document.phoenix3.realname.value == "Name") {
	alert("Please say who you are or use a nickname");
	document.phoenix3.realname.focus();
	document.phoenix3.realname.value = "";
	return false;
	}
if (document.phoenix3.sendit.value == "Submit")	{
	document.phoenix3.sendit.value = "Gone!";

	if (navigator.cookieEnabled){
	document.phoenix3.id.value = aCookie;
	} else {
	document.phoenix3.id.value = "Cookies disabled";
	}
	document.phoenix3.subject.value = "Rear Obs from " + document.phoenix3.realname.value;
	document.phoenix3.submit();
	}
}
//------------------------------------------------

