//Pop up window displaying affiliate agreement
function openpopup(){
	var popurl="html/Affiliate-agreement.htm"
	winpops=window.open(popurl,"","width=630,height=560,resizable,scrollbars")
}

function ClientCallback(result, context)
{
    var lstState = document.getElementById(context.id);
    lstState.innerHTML= "";
    if (result == null || result == "")
    {
        var optionNoState = document.createElement("option");
        optionNoState.value = "No State";
        optionNoState.innerHTML = "No State";
        lstState.appendChild(optionNoState);
        lstState.disabled = true;
    }    
    else
    {
        lstState.disabled = false;
        var argumentList = result.split('#');
        var states = argumentList[0].split('|');
        for (var i = 0; i < states.length - 1; ++i)
        {
            if (states[i] != null)
            {
                var properties = states[i].split(';');
                if (properties.length == 2)
                {
                    var shortStateName = properties[0];
                    var stateName = properties[1];
                    var option = document.createElement("option");
                    option.value = shortStateName;
                    option.innerHTML = stateName;
                    lstState.appendChild(option);
                }
            }
        }
        var achSwitch = argumentList[1].split('|');
        
        for (var i = 0; i < achSwitch.length - 1; i++)
        {
            var properties = achSwitch[i].split(';');
            var switchControl = document.getElementById(properties[0]);
            var switchValue = properties[1];
            switchControl.disabled = switchValue;            
        }
    }
 }
 
 function DisableACH(argumentList)
 {
    var achSwitch = argumentList.split('|');
        
    for (var i = 0; i < achSwitch.length; i++)
    {    
        var properties = achSwitch[i].split(';');
        var switchControl = document.getElementById(properties[0]);
        var switchValue = properties[1];
        switchControl.disabled = switchValue;      
    }
 }