﻿
function BuildParametricListing() {

    
    //serialize the search form
    var i = 1; 
    var serializedForm = 'ptypeid=' + document.getElementById("ptypeid").value + '||';
    var thisControl = document.getElementById("p_" + i);

    while (thisControl) {

        var thisObjectValue = thisControl.value;
        
        if (thisControl.type == 'select-one') {
            thisObjectValue = selectedValue(document.getElementById(thisControl.name));
        }
        serializedForm = serializedForm + thisControl.name + '=' + thisObjectValue + '||';
        
        i = i + 1;
        thisControl = document.getElementById("p_" + i);
    }

    //alert(serializedForm);

    ret = FunctionalSearch.ParametricListingTable(serializedForm, OnFunctionalComplete, OnFunctionalError, OnFunctionalTimeout);


}

function selectedValue(selBox) {
    return selBox.options[selBox.selectedIndex].text;
}

function OnFunctionalComplete(arg) {
    document.getElementById("ParametricListing").innerHTML = arg;

}

function OnFunctionalTimeout(arg) {
    alert('Timeout Error: ' + arg);
}

function OnFunctionalError(arg) {
    alert('WebService Error: ' + arg.get_message());
}
