function Spinner(C, F, A, H, B, I, D, E, G) {
    this.func = F;
    this.inc = parseFloat(D);
    this.price = B;
    this.keynum;
    this.keychar;
    this.numcheck;
    this.running = false;
    this.count = 0;
    this.id = A;
    this.label = G;
    this.currentVal = parseFloat(C);
    this.spinnerId = 'spinner'+new Date().getTime();
    if (E == null) {
        E = null
    }
    if (this.inc == null) {
        this.inc = 1
    }
    C = (C + "").replace(/\./, ",");
    if (I == null) {
        document.write('<table id="'+this.spinnerId+'" cellpadding="0" cellspacing="0"><tr><td rowspan="2">' + this.label + '</td><td rowspan="2"><input id="' + A + '" name="' + A + '" value="' + C + '" type="text" ' + (
                E ? 'readonly="readonly"' :
                "") + ' style="width:' + H + 'px;margin-left:5px;text-align: right;" onkeydown="return this.spinner.noChars(event)"  onkeyup="this.spinner.addZero(this)" /></td><td><img src="/images/spinnerIncrement.gif" id="inc" style="margin-left:2px;" onmouseup="this.parentNode.parentNode.parentNode.firstChild.childNodes[1].firstChild.spinner.running = false" onmouseout="this.parentNode.parentNode.parentNode.firstChild.childNodes[1].firstChild.spinner.running = false" onmousedown="this.parentNode.parentNode.parentNode.firstChild.childNodes[1].firstChild.spinner.runIncrement(this.parentNode.parentNode.parentNode.firstChild.childNodes[1].firstChild)" /></td></tr><tr><td><img src="/images/spinnerDecrement.gif" style="margin-left:2px;" id="dec" onmouseup="this.parentNode.parentNode.parentNode.firstChild.childNodes[1].firstChild.spinner.running = false" onmousedown="this.parentNode.parentNode.parentNode.firstChild.childNodes[1].firstChild.spinner.runDecrement(this.parentNode.parentNode.parentNode.firstChild.childNodes[1].firstChild)" /></td></tr></table>')
    } else {
        document.getElementById(I).innerHTML = '<table id="'+this.spinnerId+'" cellpadding="0" cellspacing="0"><tr><td rowspan="2">' + this.label + '</td><td rowspan="2"><input id="' + A + '" name="' + A + '" value="' + C + '" type="text" ' + (
                E ? 'readonly="readonly"' :
                "") + ' style="width:' + H + 'px;margin-left:5px;text-align: right;" onkeydown="return this.spinner.noChars(event)"  onkeyup="this.spinner.addZero(this)" /></td><td><img src="/images/spinnerIncrement.gif" id="inc" style="margin-left:2px;" onmouseup="this.parentNode.parentNode.parentNode.firstChild.childNodes[1].firstChild.spinner.running = false" onmousedown="this.parentNode.parentNode.parentNode.firstChild.childNodes[1].firstChild.spinner.runIncrement(this.parentNode.parentNode.parentNode.firstChild.childNodes[1].firstChild)" /></td></tr><tr><td><img src="/images/spinnerDecrement.gif" style="margin-left:2px;" id="dec" onmouseup="this.parentNode.parentNode.parentNode.firstChild.childNodes[1].firstChild.spinner.running = false" onmousedown="this.parentNode.parentNode.parentNode.firstChild.childNodes[1].firstChild.spinner.runDecrement(this.parentNode.parentNode.parentNode.firstChild.childNodes[1].firstChild)" /></td></tr></table>'
    }
    document.getElementById(A).spinner = this
}
Spinner.prototype.noChars = function(A) {
    if (window.event) {
        keynum = A.keyCode
    } else {
        if (A.which) {
            keynum = A.which
        }
    }
    if (keynum == 8) {
        return true
    }
    keychar = String.fromCharCode(keynum);
    numcheck = /\d/;
    return numcheck.test(keychar)
};
Spinner.prototype.runIncrement = function(A) {
    this.running = true;
    this.count = 0;
    this.increment(A)
};
Spinner.prototype.runDecrement = function(A) {
    this.running = true;
    this.count = 0;
    this.decrement(A)
};
Spinner.prototype.addZero = function(A) {
    if (A.value == "" || A.value == "0") {
        A.value = this.inc
    }
    if (this.func != null) {
        this.func(A.value, this.price, A.id)
    }
};
Spinner.prototype.increment = function(C) {
    var B;
    var A;
    if (this.running) {
        B = this.inc;
        this.currentVal += this.inc;
        this.currentVal = parseFloat(this.currentVal.toFixed(1));
        C.value = (this.currentVal + "").replace(/\./, ",");
        if (this.func != null) {
            if (!this.func(this.currentVal, this.price, C.id)) {
                B = this.inc;
                this.currentVal -= this.inc;
                this.currentVal = parseFloat(this.currentVal.toFixed(1));
                C.value = (this.currentVal + "").replace(/\./, ",");
                return
            }
        }
        this.e = C;
        setTimeout('document.getElementById("' + this.id + '").spinner.increment(document.getElementById("' + this.id + '").spinner.e)',
                ++this.count < 5 ? 150 : this.count > 10 ? 50 : 100)
    }
};
Spinner.prototype.decrement = function(E, D, C, B) {
    var D;
    var A;
    if (this.running) {
        D = this.inc;
        if (this.currentVal == D) {
            return
        }
        this.currentVal -= this.inc;
        this.currentVal = parseFloat(this.currentVal.toFixed(1));
        E.value = (this.currentVal + "").replace(/\./, ",");
        if (this.func != null) {
            if (!this.func(this.currentVal, this.price, E.id)) {
                this.currentVal += this.inc;
                this.currentVal = parseFloat(this.currentVal.toFixed(1));
                E.value = (this.currentVal + "").replace(/\./, ",");
                return
            }
        }
        this.e = E;
        setTimeout('document.getElementById("' + this.id + '").spinner.decrement(document.getElementById("' + this.id + '").spinner.e)',
                ++this.count < 5 ? 150 : this.count > 10 ? 50 : 100)
    }
}