﻿//Trova un elemento DOM in base alla parte finale dell'id
//E' particolarmente utile quando si vogliono trovare elementi
//che hanno il runat="server"
function FindElementById(csValueId, csElementName) {
    var cPnl = document.getElementsByTagName(csElementName);
    nCnt = cPnl.length;
    for (i = 0; i < nCnt; i++) {
        cItem = cPnl[i];
        csId = cItem.getAttribute('id');
        //l'elemento contiene il nome csId?
        if (csId.lastIndexOf(csValueId) != -1) {
            cPnl = cPnl[i];
            break;
        }
    }

    return cPnl;
}
