function Button(label,options) {
	if( options == undefined )
		options = {};

	this.options = options;
	this.icon = null;

	this.label = label;

	this.buttonObj = document.createElement('DIV');
	this.buttonObj.onclick = function(){alert('Geen actie');}
	this.buttonObj.className = 'button' + (options.className ? ' '+options.className : '');
	var me = this;
	this.buttonObj.onselectstart = function(){return false;};
	this.buttonObj.onmouseover = function(evt){me._mouseover(evt)};
	this.buttonObj.onmouseout = function(evt){me._mouseout(evt)};

	if( this.options.id )
		this.buttonObj.id = this.options.id;

	if( this.options.handler )
		this.buttonObj.onclick = this.options.handler;

	this.style = this.buttonObj.style;

	var leftImg = document.createElement('IMG');
	leftImg.src = '/beheer/images/button_left.gif';
	leftImg.style.cssFloat = 'left';
	leftImg.style.width = '3px';
	leftImg.style.height = '19px';
	this.buttonObj.appendChild(leftImg);

	labelContainer = document.createElement('DIV');
	labelContainer.style.cssFloat = 'left';

	// Start of IE positional fixes
	if( is_ie ) {
		labelContainer.style.position = 'relative';
		if( this.options.icon ) {
			labelContainer.style.top = '-3px';
			labelContainer.style.paddingTop = '1px';
		}
		else
			labelContainer.style.top = '-5px';
	}
	// End of IE positional fixes

	if( this.options.icon && ( !this.options.iconAlign || this.options.iconAlign == 'left' ) )
		labelContainer.appendChild(this._icon());

	labelContainer.appendChild(document.createTextNode(this.label));

	if( this.options.icon && this.options.iconAlign == 'right' )
		labelContainer.appendChild(this._icon());

	this.buttonObj.appendChild(labelContainer);

	var rightImg = document.createElement('IMG');
	rightImg.src = '/beheer/images/button_right.gif';
	rightImg.style.cssFloat = 'left';
	rightImg.style.width = '3px';
	rightImg.style.height = '19px';
	this.buttonObj.appendChild(rightImg);
}

Button.prototype.addToWindow = function(wnd) {
	this.wnd = wnd;
	wnd.appendChild(this.buttonObj);
}

Button.prototype._icon = function() {
	this.icon = document.createElement('IMG');
	this.icon.src = '/beheer/images/'+this.options.icon;
	if( this.options.iconAlign == 'right' )
		this.icon.style.marginLeft = '3px';
	else
		this.icon.style.marginRight = '3px';

	return this.icon;
}

Button.prototype._mouseover = function(evt) {
	if( this.icon && this.options.iconActive )
		this.icon.src = '/beheer/images/'+this.options.iconActive;

	if( this.options.mouseOver )
		this.options.mouseOver(evt);
}

Button.prototype._mouseout = function(evt) {
	if( this.icon && this.options.iconActive )
		this.icon.src = '/beheer/images/'+this.options.icon;

	if( this.options.mouseOut )
		this.options.mouseOut(evt);
}

Button.prototype.write = function(handler,pos) {
	document.write('<div onclick="'+handler+'" class="button"'+(pos==undefined?'':' style="float: '+pos+';"')+'>'+this.buttonObj.innerHTML+'</div>');
}

Button.prototype.setClickHandler = function(fnc) {
	this.buttonObj.onclick = fnc;
}