var elementCache = new Object();

function getObject (strName) {
    if (elementCache.hasOwnProperty(strName)) { return elementCache[strName]; }
    var obj;
         if (document.getElementById) { obj = document.getElementById(strName); }
    else if (document.all)            { obj = document.all[strName];            }
    else if (document.layers)         { obj = document.layers[strName];         }
    if (obj != undefined) { elementCache[strName] = obj; }
    return obj;
}

function getStyle(strId) {
    var obj = getObject(strId);
    if (obj == undefined) { return null; }
    if (obj.runtimeStyle) { return obj.runtimeStyle; }
    return obj.style;
}

function getStyleFor(obj) {
    if (obj == undefined) { return null; }
    if (obj.runtimeStyle) { return obj.runtimeStyle; }
    return obj.style;
}

function ValidateRecipe(){
    var i = 1;
    var Validated = new Boolean(true);
    while(getObject('Qty'+i) != null){
        if (isNaN(getObject('Qty'+i).value)) {
            Validated = false;
        }
        i++;
    }
    if (Validated) {
        document.aspnetForm.submit();
    } else {
        alert("For now, we can only have numbers in the Qty column,\nso if you have entered anything else, please change it to a number\nand add information in the notes column if you want.");
    }
}