﻿/* 
Author: Steve Shier
Date: 1/19/2008
used by store/detail.aspx page only
addresses following problem:
On the detail.aspx page, if one fails to select delivery type, and gets the delivery type error, when they correct that error the error message does not go away.
*/
function AdjustAttributeValidationMessage() {
    var ErrorMessageID = "ErrorMessage"; //error message id,currently we are using hard coded id-could change later if StoreFront Allows us to modify
    //is an attirubte selected?
    // alert('entered DisplayAttributeValidationMessage');
    //    alert("selected index=" + document.Form2.ProductDetail11_CAttributeControl1_DlAttributes__ctl0_AttributeName.selectedIndex);
    var dropdownObj = document.Form2.ProductDetail11_CAttributeControl1_DlAttributes__ctl0_AttributeName;
    if (dropdownObj != null && dropdownObj.selectedIndex != null) {
        var indexSelected = dropdownObj.selectedIndex;
        var valueSelected = dropdownObj[indexSelected].value;
        //   alert("selected value=" + document.Form2.ProductDetail11_CAttributeControl1_DlAttributes__ctl0_AttributeName[indexSelected].value);
        if (valueSelected != '-1') {
            //yes, so clear out this part of the message (otherwise do nothing)
            //currently we are using hard coded control name-could change later if StoreFront Allows us to modify
            var obj = document.getElementById(ErrorMessageID);
            if (!obj)
                return;
            //alert('CHOOSE DELIVERY TYPE NOT SELECTED');
            // alert(obj.innerHTML);
            obj.innerHTML = obj.innerHTML.replace("CHOOSE DELIVERY TYPE Required", "");
        }
    }
}
