/**
 * Simple validation of PromoKey code.
 * This code only checks that the code is 10 characters in length and the code only contains
 * alpha numerical characters.
 *
 * @author      Joris van de Sande      <joris[at]prezent.nl>
 * @copyright   Prezent Internet BV     http://www.prezent.nl
 */
function validatePromoKey(code) {
    if (! /^[a-zA-Z0-9]{10}$/.test(code)) {
        alert('Uw PromoKey code dient uit 10 karakters te bestaan (letters en/of cijfers).');
        return (false);
    }
    return (true);
}

// Register onload event handler (we are lucky this is the only event that has to be fired onload,
// otherwise the event could be overwritten by another script)
window.onload = function() {
    var btn = new getObj('btnNext');       // Use getObj for maximum compatibility.
    if (btn.obj) {
        btn.obj.onclick = function () { return (validatePromoKey(this.form.elements['promokey'].value)); };
        btn.obj.form.onsubmit = function () { return (validatePromoKey(this.elements['promokey'].value)); };
    }
}