window.addEvent('load',function(){
    if( $('InputCountry') ){
        /*/////////////////////////////////////////////////////////////////////////////////////////////
        // Dynamic Country / Province Toggling
        /*/////////////////////////////////////////////////////////////////////////////////////////////
        $('InputCountry').addEvent('change',function(){
            var pars = $('InputCountry').name+'='+$('InputCountry').options[$('InputCountry').selectedIndex].value;
            if ($('InputCountry').options[$('InputCountry').selectedIndex].value != ""){
                new Ajax( '/ajax/select_province.php', {
                    method: 'post',
                    postBody: pars,
                    update: $('InputProvinceDiv')
                } ).request();
            }
        });
    }

    if( $('Country') ){
        /*/////////////////////////////////////////////////////////////////////////////////////////////
        // Dynamic Country / Province Toggling
        /*/////////////////////////////////////////////////////////////////////////////////////////////
        $('Country').addEvent('change',function(){
            var pars = $('Country').name+'='+$('Country').options[$('Country').selectedIndex].value;
            if ($('Country').options[$('Country').selectedIndex].value != ""){
                new Ajax( '/ajax/select_province.php', {
                    method: 'post',
                    postBody: pars,
                    update: $('InputProvinceDiv')
                } ).request();
            }
        });
    }

    if( $('shipping_Country') ){
        /*/////////////////////////////////////////////////////////////////////////////////////////////
        // Dynamic Country / Province Toggling
        /*/////////////////////////////////////////////////////////////////////////////////////////////
        $('shipping_Country').addEvent('change',function(){
            var pars = 'country_code='+$('shipping_Country').options[$('shipping_Country').selectedIndex].value+'&field_id=shipping_InputProvince&field_name=shipping_province_code';
            if ($('shipping_Country').options[$('shipping_Country').selectedIndex].value != ""){
                new Ajax( '/ajax/select_province.php', {
                    method: 'post',
                    postBody: pars,
                    update: $('shipping_InputProvinceDiv')
                } ).request();
            }
        });
    }

    if ( $('topbanner-menu') ){
        $('topbanner-menu').getChildren().each(function(li){
            if (li.getLast().getTag() == 'ul'){
                var alink = li.getFirst();
                alink.setStyle('cursor','default');
                alink.addEvent('click',function(ev){var ev=new Event(ev).stop(); });
            }
        });
    }

    if ( $('CFCLientQuestion') ){
        $$('#CFClient input').each(function(inp){
            inp.addEvent('click',function(){
                $('CFProgramDiv').setStyle('display',(inp.value=='yes')?'block':'none');
            });
            if ( inp.checked ){
                $('CFProgramDiv').setStyle('display',(inp.value=='yes')?'block':'none');
            }
        });
    }

});

function UpdateProvince(src, dest){
    src.addEvent('change', function(){ dest.value = src.value;});
}