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')
                    /*,
                    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();
            }
        });
    }

    /*SqueezeBox.initialize({
    size: {x: 350, y: 400},
    ajaxOptions: {
    method: 'get'
    }
    });

    $$('#blog a').each(function(el) {
    el.addEvent('click', function(e) {
    var e=new Event(e).stop();
    SqueezeBox.fromElement(el);
    });
    });*/

    /*
    if ($('products-header')){
        $('products-header').setStyle('cursor','pointer');
        $('products-header').addEvent('click',function(ev){
            var ev=new Event(ev).stop();
            SqueezeBox.initialize({
                size: {x:500,y:500},
                sizeLoading: {x:50,y:50}
            });
            var div = new Element('div').setStyles(
            {'height':'100px;','width':'100px','position':'relative','top':'40%','left':'40%','background':'navy','color':'white'}
            ).setHTML('This is test Div');
            SqueezeBox.setContent('string', div);
        });
    }
    */

});

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