//The parameters are loaded into a hash.

var parameters = $H(window.location.search.toQueryParams());

var formField_prefix = 'formfield_';
var errorField = "formfield_ErrorText";

// Try to match form IDs with querystring items
function formInitialiser() {
    // Loop through the items and update if they exist in any form
    parameters.each(function(pair) {
        if (pair.key.startsWith(formField_prefix)) {
            var ele = $(pair.key);
            if (ele != null) {
                if (pair.key == errorField) {
                    ele.innerHTML = pair.value;
                    ele.show();
                } else {
                    ele.value = pair.value;
                }
            }
         }
    })
}

