/*
 BtnElement Class v1.0
 update 2007.06.21
 create K.Kubonaka 
*/

function BtnElement(elm, type, arg) {
	this.elm = elm;
	this.type = type;
	
	if (arg != undefined) {
		this.normal = arg[0];
		this.hover = arg[1];
	}
}

var _BtnElement = BtnElement.prototype;


//:::::::::::::::::::::::::::::::
// 選択時処理

_BtnElement.doSelect = function() {
	this.changeClass(this.hover);
	this.deleteEvent();
};


//:::::::::::::::::::::::::::::::
// イベント削除

_BtnElement.deleteEvent = function() {
	this.elm.onmouseover = null;
	this.elm.onmouseout = null;
};


//:::::::::::::::::::::::::::::::
// イベントセット

_BtnElement.setEvent = function() {
	var me = this;
	this.changeClass(this.normal);
	if (this.type == "css") {
		this.elm.onmouseover = function() {
			me.changeClass(me.hover);
		};
		
		this.elm.onmouseout = function() {
			me.changeClass(me.normal);
		};
	} else if (this.type == "image") {
		this.elm.onmouseover = function() {
			
		};
		
		this.elm.onmouseout = function() {
			
		};
	}
};


_BtnElement.changeClass = function(str) {
	this.elm.setAttribute("class", str);
	this.elm.setAttribute("className", str);
};


