function buttonMouseOver(id) {
	var button = document.getElementById(id + 'Button');
	if ((button != null) && (button.style.cursor == 'pointer')) {
		var button1 = document.getElementById(id);
		button1.style.display = 'none';
		var button2 = document.getElementById(id + 'MouseOver');
		button2.style.display = '';
	}
}

function buttonMouseOut(id) {
	var button = document.getElementById(id + 'Button');
	if ((button != null) && (button.style.cursor == 'pointer')) {
		var button1 = document.getElementById(id);
		button1.style.display = '';						
		var button2 = document.getElementById(id + 'MouseOver');
		button2.style.display = 'none';
	}
}

function buttonMouseUp(id, command) {
	var button = document.getElementById(id + 'Button');
	if ((button != null) && (button.style.cursor == 'pointer')) {
		var object = document.getElementById(id + 'command');
		var commands;
		if ((object.firstChild.nextSibling != null) && (object.firstChild.nextSibling.innerHTML != '')) {
			commands = object.firstChild.nextSibling.innerHTML;
		}
		else if ( object.firstChild.firstChild != null) {
			commands = object.firstChild.firstChild.nodeValue;
		}
		if (commands != null) {
			var commands = commands.split(id);
			for (index = 0; index < commands.length; index ++) {
				eval(commands[index]);
			}
		}
		else {
			if (command != '') {
				if (typeof(command) == 'string') {
					eval(command);
				}
				else if (typeof(command) == 'function') {
					command();
				}
			}
		}
	}
}

function enableButton(id) {
	var button = document.getElementById(id + 'Button');
	if (button != null) {
		button.style.cursor = 'pointer';
		var label =  document.getElementById(id + 'Label');
		label.className = 'buttonText1';
		var button1 = document.getElementById(id);
		button1.style.display = '';						
		var button2 = document.getElementById(id + 'MouseOver');
		button2.style.display = 'none';
	}
}

function disableButton(id) {
	var button = document.getElementById(id + 'Button');
	if (button != null) {
		button.style.cursor = 'default';
		var label =  document.getElementById(id + 'Label');
		label.className = 'buttonText3';
		var button1 = document.getElementById(id);
		button1.style.display = '';
		var button2 = document.getElementById(id + 'MouseOver');
		button2.style.display = 'none';
	}
}

function setCommandButton(id, command_) {
	var button = document.getElementById(id + 'Button');
	if (button != null) {
		var object = document.getElementById(id + 'command');
		if (object.firstChild.nextSibling != null) {
			object.firstChild.nextSibling.innerHTML = command_;
		}
		else {
			object.firstChild.innerHTML = command_;
		}
	}
}

// สำหรับ IE 6
function HiddenButtonMouseOverDelay(id) {
	var interval = setInterval(delay, 100);
	function delay() {
		clearInterval(interval);
		var button = document.getElementById(id + 'Button');
		if ((button != null) && (button.style.cursor == 'pointer')) {
			var button2 = document.getElementById(id + 'MouseOver');
			button2.style.display = 'none';
		}
	}
}