﻿//v1.0b
// Initiate Flash and do some custom forms stuff
// Custom stuff
// Copyright 2005-2007 Adobe Systems Incorporated.  All rights reserved.
function getElementByName(thisForm, elementName) {
    var returnVal = null;
    for (var i = 0; i < thisForm.elements.length; i++) {
        //alert(thisForm.elements[i].name);
        if (thisForm.elements[i].name.toUpperCase() == elementName.toUpperCase()) {
            returnVal = thisForm.elements[i];
            break;
        }
    }
    return returnVal;
}
function checkCustomFields(thisForm) {


    for (var i = 0; i < thisForm.elements.length; i++) {
        thisElement = thisForm.elements[i];
        if (thisElement.name == 'accountType') {
            buildCustomField(thisForm, thisElement.options[thisElement.selectedIndex].value);
        }
    }
    //alert(getElementByName(thisForm, 'custom').value);
}
function buildCustomField(thisForm, value) {

    var customField = getElementByName(thisForm, 'custom');

    var currentValue = "";
    currentValue += customField.value;
    var newValue = (currentValue == "") ? value : currentValue + "," + value;
    getElementByName(thisForm, 'custom').value = newValue;
    //alert("custom value = " + newValue);
    return true;
}
