function button(changed, normal_1, normal_2, normal_3, normal_4, normal_5, normal_6, normal_7, normal_8)
{
	if (document.images) {
		this.name = "button" + buttons.length;
		
		if (changed) { this.changed = new Image(); this.changed.src = changed }
		if (normal_1) { this.normal_1 = new Image(); this.normal_1.src = normal_1 }
		if (normal_2) { this.normal_2 = new Image(); this.normal_2.src = normal_2 }
		if (normal_3) { this.normal_3 = new Image(); this.normal_3.src = normal_3 }
		if (normal_4) { this.normal_4 = new Image(); this.normal_4.src = normal_4 }
		if (normal_5) { this.normal_5 = new Image(); this.normal_5.src = normal_5 }
		if (normal_6) { this.normal_6 = new Image(); this.normal_6.src = normal_6 }
		if (normal_7) { this.normal_7 = new Image(); this.normal_7.src = normal_7 }
		if (normal_8) { this.normal_8 = new Image(); this.normal_8.src = normal_8 }		
	}
	
	this.GetMouse = GetMouse;
	this.MouseOver = MouseOver;
	this.MouseClick = MouseClick;

	states = new Array("");
	states[1] = 0;
	states[2] = 0;
	states[3] = 0;
	states[4] = 0;
	states[5] = 0;
	states[6] = 0;
	states[7] = 0;
	states[8] = 0;
				
	return this;
	 
	function GetMouse() { 
		if (document.images) {
		
			if (this.name == "button1" && states[1]==0) document.images[this.name].src = this.normal_1.src; 
			else if (this.name == "button2" && states[2]==0) document.images[this.name].src = this.normal_2.src; 
			else if (this.name == "button3" && states[3]==0) document.images[this.name].src = this.normal_3.src; 
			else if (this.name == "button4" && states[4]==0) document.images[this.name].src = this.normal_4.src; 
			else if (this.name == "button5" && states[5]==0) document.images[this.name].src = this.normal_5.src; 		
			else if (this.name == "button6" && states[6]==0) document.images[this.name].src = this.normal_6.src; 
			else if (this.name == "button7" && states[7]==0) document.images[this.name].src = this.normal_7.src; 
			else if (this.name == "button8" && states[8]==0) document.images[this.name].src = this.normal_8.src; 				
		}
	}
  
	function MouseOver() { 
		if (document.images && this.changed) {
			document.images[this.name].src = this.changed.src;
		 
		}
	}
	
	function MouseClick() { 
		if (document.images) {
			document.images[this.name].src = this.changed.src

			
			if (this.name == "button1") {
				states[1] = 1;
				states[2] = 0;
				states[3] = 0;
				states[4] = 0;
				states[5] = 0;
				states[6] = 0;
				states[7] = 0;
				states[8] = 0;				
				document.images["button2"].src = this.normal_2.src; 
				document.images["button3"].src = this.normal_3.src; 
				document.images["button4"].src = this.normal_4.src; 
				document.images["button5"].src = this.normal_5.src; 												
				document.images["button6"].src = this.normal_6.src; 
				document.images["button7"].src = this.normal_7.src; 
				document.images["button8"].src = this.normal_8.src; 				
			}
			else if (this.name == "button2") {
				states[1] = 0;
				states[2] = 2;
				states[3] = 0;
				states[4] = 0;
				states[5] = 0;
				states[6] = 0;
				states[7] = 0;
				states[8] = 0;					
				document.images["button1"].src = this.normal_1.src; 
				document.images["button3"].src = this.normal_3.src; 
				document.images["button4"].src = this.normal_4.src; 
				document.images["button5"].src = this.normal_5.src; 	
				document.images["button6"].src = this.normal_6.src; 
				document.images["button7"].src = this.normal_7.src; 
				document.images["button8"].src = this.normal_8.src; 																			
			}
			else if (this.name == "button3") {
				states[1] = 0;
				states[2] = 0;
				states[3] = 1;
				states[4] = 0;
				states[5] = 0;
				states[6] = 0;
				states[7] = 0;
				states[8] = 0;					
				document.images["button1"].src = this.normal_1.src; 
				document.images["button2"].src = this.normal_2.src; 
				document.images["button4"].src = this.normal_4.src; 
				document.images["button5"].src = this.normal_5.src; 
				document.images["button6"].src = this.normal_6.src; 
				document.images["button7"].src = this.normal_7.src; 
				document.images["button8"].src = this.normal_8.src; 																				
			}
			else if (this.name == "button4") {
				states[1] = 0;
				states[2] = 0;
				states[3] = 0;
				states[4] = 1;
				states[5] = 0;
				states[6] = 0;
				states[7] = 0;
				states[8] = 0;					
				document.images["button1"].src = this.normal_1.src; 
				document.images["button2"].src = this.normal_2.src; 
				document.images["button3"].src = this.normal_3.src; 
				document.images["button5"].src = this.normal_5.src; 
				document.images["button6"].src = this.normal_6.src; 
				document.images["button7"].src = this.normal_7.src; 
				document.images["button8"].src = this.normal_8.src; 																				
			}
			else if (this.name == "button5") {
				states[1] = 0;
				states[2] = 0;
				states[3] = 0;
				states[4] = 0;
				states[5] = 1;
				states[6] = 0;
				states[7] = 0;
				states[8] = 0;					
				document.images["button1"].src = this.normal_1.src; 
				document.images["button2"].src = this.normal_2.src; 
				document.images["button3"].src = this.normal_3.src; 
				document.images["button4"].src = this.normal_4.src; 	
				document.images["button6"].src = this.normal_6.src; 
				document.images["button7"].src = this.normal_7.src; 
				document.images["button8"].src = this.normal_8.src; 																			
			}												
			
			else if (this.name == "button6") {
				states[1] = 0;
				states[2] = 0;
				states[3] = 0;
				states[4] = 0;
				states[5] = 0;
				states[6] = 1;
				states[7] = 0;
				states[8] = 0;					
				document.images["button1"].src = this.normal_1.src; 
				document.images["button2"].src = this.normal_2.src; 
				document.images["button3"].src = this.normal_3.src; 
				document.images["button4"].src = this.normal_4.src; 	
				document.images["button5"].src = this.normal_5.src; 
				document.images["button7"].src = this.normal_7.src; 
				document.images["button8"].src = this.normal_8.src; 																			
			}
			else if (this.name == "button7") {
				states[1] = 0;
				states[2] = 0;
				states[3] = 0;
				states[4] = 0;
				states[5] = 0;
				states[6] = 0;
				states[7] = 1;
				states[8] = 0;					
				document.images["button1"].src = this.normal_1.src; 
				document.images["button2"].src = this.normal_2.src; 
				document.images["button3"].src = this.normal_3.src; 
				document.images["button4"].src = this.normal_4.src; 	
				document.images["button5"].src = this.normal_5.src; 
				document.images["button6"].src = this.normal_6.src; 
				document.images["button8"].src = this.normal_8.src; 																			
			}
			else if (this.name == "button8") {
				states[1] = 0;
				states[2] = 0;
				states[3] = 0;
				states[4] = 0;
				states[5] = 0;
				states[6] = 0;
				states[7] = 0;
				states[8] = 1;					
				document.images["button1"].src = this.normal_1.src; 
				document.images["button2"].src = this.normal_2.src; 
				document.images["button3"].src = this.normal_3.src; 
				document.images["button4"].src = this.normal_4.src; 	
				document.images["button5"].src = this.normal_5.src; 
				document.images["button6"].src = this.normal_6.src; 
				document.images["button7"].src = this.normal_7.src; 																			
			}									
		}
	}
}

