
// reportcall_box.js

jQuery(document).ready(function() {
    var rbox_dialog = new YAHOO.widget.Panel('reportcall', {
        'width': 600,
        'visible': true,
        'close': false,
        'fixedcenter': true,
        'modal': true
    });

    $('.callbutton').click(function() {
        var sid = this.id.split('_')[1];
        $('#reportcall').load('/report_call/' + sid + '/', function() {
            rbox_dialog.render();
            rbox_dialog.show();
            $('#cancel_call').click(function() {
                rbox_dialog.hide();
            });
            $('#callform').submit(function() {
                if($('#id_spoke_to').val().length < 3) {
                    $('#spoke_to_req').css('color', 'red');
                    return false;
                }
                if($('#id_status').val().length == 0) {
                    $('#status_req').css('color', 'red');
                    return false;
                }
                return true;
            });
        });
    });

});
