/**
 * document.getElementsByClassName is deprecated in Prototype 1.6, and seems buggy in ff3
 * This method should do the same job.
 * @param _desiredClass
 * @param ancestorElement
 * @returns Array of descendants with desired class
 */
getDescendantsByClassName = function(_desiredClass, ancestorElement ){
    //REL-706 PGS-244: text field in editlive is not removed on delete due to "nullpointerexception" here when compositionoutcomeforms does not exist.
    //quick-fixing here by catching and swallowing exception when this element is null (kremt)
    var _descendants = [];
    
    if(ancestorElement)
    try {
        var desc_ = $(ancestorElement.id).descendants();
        for (var i = 0; i < desc_.length; i++) {
            var descy = desc_[i];
            if (descy.hasClassName(_desiredClass)) {
                //alert('getDescendantsByClassName '+descy.className+'_'+descy.id);
                _descendants[_descendants.length] = descy;
            }
        }
    } catch(ex) {
        //alert('exception getting descendants for '+ancestorElement);
    }
    return _descendants;
}

function legalXMLString(str){
//    str = str.replace(/&/g, "&amp;");
    return str.escapeHTML();
}

function legalXMLAttribute(str){
    str = legalXMLString(str);
    str = str.replace(/\"/g, "&quot;");
    return str;
}

