

		var IsGrabbed = function() {
			top = crane.GetTop()+65;

			if(top > 347)
				top = 347;

			left = crane.GetLeft()+23;
			if(left <= 60) {		// Claw has reached the drop-off with payload.
				left = 60;
				state = 'won';
			}
		};

		this.GetError = function(offset) {
			return Math.floor(160/(.1*offset+1)-60);
		};

		this.Update = function () {

			if(crane.GetState() == 'down' && state=='resting') {
				var offset = Math.abs(left - crane.GetLeft()-23);
				error = this.GetError(offset);
				if(erro