var holdlast=0;
var holdcode='';
var topplace=391;
var leftplace=81;
var stopper=0;
function blockitup(num){
	if ((parseInt(holdlast)+parseInt(num))<101){
	holdlast=parseInt(holdlast)+parseInt(num);
	} else {return;}
	var starthere=0;
  	topplace=391;
	do {
		starthere++;
		holdcode=holdcode + '<div class="blocks" id="b' + starthere + '" style="top:' + topplace + 'px; left:81px;"><img src="images/redblock.gif"></div>';
		topplace=topplace-39;
	}
	while (starthere<10&&starthere<holdlast)

  	topplace=391;
	if (holdlast>10){
		do {
			starthere++;
			holdcode=holdcode + '<div class="blocks" id="b' + starthere + '" style="top:' + topplace + 'px; left:120px;"><img src="images/yellowblock.gif"></div>';
			topplace=topplace-39;
		}
		while (starthere<20&&starthere<holdlast)
	}
	topplace=391;
	if (holdlast>20){
		do {
			starthere++;
			holdcode=holdcode + '<div class="blocks" id="b' + starthere + '" style="top:' + topplace + 'px; left:159px;"><img src="images/blueblock.gif"></div>';
			topplace=topplace-39;
		}
		while (starthere<30&&starthere<holdlast)
	}
	topplace=391;
	if (holdlast>30){
		do {
			starthere++;
			holdcode=holdcode + '<div class="blocks" id="b' + starthere + '" style="top:' + topplace + 'px; left:198px;"><img src="images/orangeblock.gif"></div>';
			topplace=topplace-39;
		}
		while (starthere<40&&starthere<holdlast)
	}
	topplace=391;
	if (holdlast>40){
		do {
			starthere++;
			holdcode=holdcode + '<div class="blocks" id="b' + starthere + '" style="top:' + topplace + 'px; left:237px;"><img src="images/greenblock.gif"></div>';
			topplace=topplace-39;
		}
		while (starthere<50&&starthere<holdlast)
	}
	topplace=391;
	if (holdlast>50){
		do {
			starthere++;
			holdcode=holdcode + '<div class="blocks" id="b' + starthere + '" style="top:' + topplace + 'px; left:276px;"><img src="images/redblock.gif"></div>';
			topplace=topplace-39;
		}
		while (starthere<60&&starthere<holdlast)
	}
	topplace=391;
	if (holdlast>60){
		do {
			starthere++;
			holdcode=holdcode + '<div class="blocks" id="b' + starthere + '" style="top:' + topplace + 'px; left:315px;"><img src="images/yellowblock.gif"></div>';
			topplace=topplace-39;
		}
		while (starthere<70&&starthere<holdlast)
	}
	topplace=391;
	if (holdlast>70){
		do {
			starthere++;
			holdcode=holdcode + '<div class="blocks" id="b' + starthere + '" style="top:' + topplace + 'px; left:354px;"><img src="images/blueblock.gif"></div>';
			topplace=topplace-39;
		}
		while (starthere<80&&starthere<holdlast)
	}
	topplace=391;
	if (holdlast>80){
		do {
			starthere++;
			holdcode=holdcode + '<div class="blocks" id="b' + starthere + '" style="top:' + topplace + 'px; left:393px;"><img src="images/orangeblock.gif"></div>';
			topplace=topplace-39;
		}
		while (starthere<90&&starthere<holdlast)
	}
	topplace=391;
	if (holdlast>90){
		do {
			starthere++;
			holdcode=holdcode + '<div class="blocks" id="b' + starthere + '" style="top:' + topplace + 'px; left:432px;"><img src="images/greenblock.gif"></div>';
			topplace=topplace-39;
		}
		while (starthere<100&&starthere<holdlast)
	}
document.getElementById('blockbuilder').innerHTML=holdcode;
}

