var originalCouponCode = null;

function inactivateButton(buttonNode) {
	addClass(buttonNode, 'rollOverInactive');
	buttonNode.setAttribute('src', buttonNode.getAttribute('src').replace(/normal/,'inactive'));
	buttonNode.setAttribute('src', buttonNode.getAttribute('src').replace(/over/,'inactive'));
	buttonNode.disabled = 'disabled';

	buttonNode.onmouseover = function(){}
	buttonNode.onmouseout = function(){}
	initInputRollover();
}
function activateButton(buttonNode) {
	removeClass(buttonNode, 'rollOverInactive');
	buttonNode.setAttribute('src', buttonNode.getAttribute('src').replace(/inactive/,'normal'));
	buttonNode.disabled = false;

	buttonNode.onmouseover = function(){}
	buttonNode.onmouseout = function(){}
	initInputRollover();
}

function initCouponRefresh() {
	var inputNode = document.getElementById('id_gutschein');
	var buttonNode = document.getElementById('refreshCart');
	
	if (inputNode && buttonNode) {
	
		originalCouponCode = inputNode.value;
		inactivateButton(buttonNode);
		
		
		
		inputNode.onkeyup = function() {
			var buttonNode = document.getElementById('refreshCart');
			if (buttonNode) {
				if (this.value != originalCouponCode) {
					activateButton(buttonNode);
				} else {
					inactivateButton(buttonNode);
				}
			}
		}
	}
}

addInitFunction(initCouponRefresh);
