function gup(name) {
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp(regexS);
  var results = regex.exec(window.location.href);
  if(results == null)
    return "";
  else
    return results[1];
}
function changebackgroundonload(){
	var bkgd = gup('bk');
	if (bkgd == 0) {image = 'white.jpg'}
	else if (bkgd == 1) {image = 'graph_paper_grid2.gif'}
	else if (bkgd == 2) {image = 'graph_paper_grid3.jpg'}
	else if (bkgd == 3) {image = 'yellow_lined_paper_1.jpg'}
	else if (bkgd == 4) {image = 'lined_paper_1.jpg'}
	newimage = 'url(images/'+image+')';
	document.getElementById('backgroundtd').style.backgroundImage = newimage;
	document.getElementById('backgroundtd2').style.backgroundImage = newimage;
	window.bk = bkgd;
}

//function to write the header of the table with the background image included - can be adjusted for the td background
var bk = '';
function changebackgroundimage(image, linknumber) {
	newimage = 'url(images/'+image+')';
	document.getElementById('backgroundtd').style.backgroundImage = newimage;
	document.getElementById('backgroundtd2').style.backgroundImage = newimage;
	window.bk = linknumber;
}