var _dom_objs = new Array(); // storage for objects that represent items on the page

function el(id) {
    if (typeof id == 'object' || id.tagName) { return id; }
    if (_dom_objs[id]) { return _dom_objs[id]; }
    if (document.all) {
        return document.all[id];
    } else {
        return document.getElementById(id);
    }
}



function validate_addtocart(theForm, product_qty_boxes, product_id) {

    var qty_boxes = product_qty_boxes.split(',');

    var found = 0;

    if (qty_boxes.length == 1) { return true }
    for (var i = 0; i < qty_boxes.length; i++) {
        var qty_box = qty_boxes[i];
        var qty_field = el(qty_box);
        if (qty_field.checked == true) {
            found = 1;
        }
    }
    
    if (!found) {
        var select_prod_error_el = el('select_prod_error-' + product_id);
        select_prod_error_el.innerHTML = '<span class="error"><img src="/images/checkout/common/error.gif" width="14" height="11"> Please select a size.</span>';
		select_prod_error_el.style.display = "block";
        return false;
    }
    return true;
}

