Roll = Class.create();

Roll.prototype = {
	
	initialize: function (a) {
		this.img = a.getElementsByTagName("img")[0];
		this.locked = false;
		this.firstRun = true;
		Event.observe(this.img, "mouseover", this.change.bindAsEventListener(this));
		Event.observe(this.img, "mouseout", this.change.bindAsEventListener(this));
		this.change();
	},
	
	change: function (e) {
		if (e&&this.firstRun) this.firstRun = false;
		if (!this.locked) {
			this.behavior = (!Number(this.img.src.charAt(this.img.src.length-5))&&!this.firstRun) ?1 :0;
			this.img.src = this.img.src.substring(0,this.img.src.length-5) + this.behavior + "." + this.img.src.substring(this.img.src.length-3,this.img.src.length);
		}
	},
	
	manual: function (state) {
			this.img.src = this.img.src.substring(0,this.img.src.length-5) + state + "." + this.img.src.substring(this.img.src.length-3,this.img.src.length);
	},
	
	changeTypeNavOn: function () { 
		this.firstRun = false; this.change(); this.lock(); 
	},
	
	lock: function () { 
		this.locked = true; 
	},
	
	unlock: function () { 
		this.locked = false; 
	}
	
}