﻿book_appointment = {

    consultation_pop_status: 0,

    pop_bound: 0,

    init: function () {
        $('a[id=' + arguments[0] + ']').bind('click', function () {
            book_appointment.show_pop();
            return false;
        });
    },

    show_pop: function () {
        this.consultation_asked = 1;
        if (this.pop_bound == 0) {
            $('.book_appointment_pop > div.button_set > input#book_appointment_btn_find').click(function () {
                $('.book_appointment_pop > div.button_set').html('<img src="/_common/img/2-0.gif" />&nbsp;FINDING CENTRES&hellip;');
                window.location = '/store-locator/get_position.ashx?postcode=' + $('#book_appointment_postcode').val() + '&type=2&coe=True';
                return false;
            });
            $('.book_appointment_pop_bg').click(function () {
                book_appointment.show_pop();
            });
            this.pop_bound = 1;
        }
        if (this.consultation_pop_status == 0) {
            book_appointment.book_pop_center();
            $('.book_appointment_pop_bg').css({ "opacity": "0.7" });
            $('.book_appointment_pop').fadeIn('slow');
            $('.book_appointment_pop_bg').fadeIn('slow');
            this.consultation_pop_status = 1;
        }
        else {
            $('.book_appointment_pop').fadeOut('slow');
            $('.book_appointment_pop_bg').fadeOut('slow');
            this.consultation_pop_status = 0;
        }
    },

    book_pop_center: function () {
        var w_width = document.documentElement.clientWidth;
        var w_height = document.documentElement.clientHeight;
        var p_width = $('.book_appointment_pop').width();
        var p_height = $('.book_appointment_pop').height();
        $('.book_appointment_pop_bg').css({
            "height": w_height
        });
    }
};