window.addEvent('domready',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')
                    /*,
                    onComplete: function(){
                        if ( !$('same_as_billing') ){
                            if ( $('shipping_InputProvince') && $('InputProvince') ){
                                UpdateProvince($('InputProvince'), $('shipping_InputProvince'));
                            }
                            if ( $('province_code') && $('shipping_province_code')){
                                UpdateProvince($('province_code'), $('shipping_province_code'));
                            }
                        }
                    }*/
                } ).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')
                    /*,
                    onComplete: function(){
                        if ( !$('same_as_billing') ){
                            if ( $('shipping_InputProvince') && $('InputProvince') ){
                                UpdateProvince($('InputProvince'), $('shipping_InputProvince'));
                            }
                            if ( $('province_code') && $('shipping_province_code')){
                                UpdateProvince($('province_code'), $('shipping_province_code'));
                            }
                        }
                    }*/
                } ).request();
            }
        });
    }

});

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

window.addEvent('domready', function(){
    if ( $('idcssubmit') ){
        $('idcssubmit').addEvent('click',function(evt){
            var evt = new Event(evt).stop();
            var img = new Element('img').setProperty('src','/skin/hemocode/img/coming-soon.jpg');
            var boxHtml = new MooPrompt('', '', {
                buttons: 1,
                button1: img,
                width: 323,
                height: 85,
                overlay: false
            });
        });
    }
});