// do not remove, else ssl warnings shall follow


Ext.BLANK_IMAGE_URL = root + '/scripts/ext-2.0/resources/images/default/s.gif';



        var unsaved = false;

        function enableSave()
        {
                if( true )
                {
                        var submit_button = document.getElementById( 'service_submit' );

                        if( submit_button )
                        {
                                submit_button.disabled = false;
                                unsaved = true;
                        }
                }
        }

        function enableInput( value, id )
        {
                var item = document.getElementById( id );
                item.disabled = !value;
        }

        function dropService( service_id )
        {
                // put up a dialog asking if user wants to save changes
                Ext.Msg.confirm('Drop case', 'Are you sure you want to drop this case?', function(button) {
                        if ( button == 'yes' )
                        {
                                window.location = root + 'service/drop/' + service_id;
                        }
                });
        }

        function checkJavascript()
        {
                var check_javascript = document.getElementById( 'check_javascript' );

                if( check_javascript )
                {
                        check_javascript.value = 'yes';
                }
        }

        function followLink( path )
        {
                if( unsaved )
                {
                        // put up a dialog asking if user wants to save changes
                        Ext.Msg.confirm('Discard', 'Discard Changes?', function(button) {
                                if ( button == 'yes' )
                                {
                                        window.location = path;
                                }
                        });
                }
                else
                {
                        window.location = path;
                }
        }

        function toggleDisclosure( box_id )
        {
                var box = document.getElementById( box_id );

                if( box )
                {
                        var current_class = box.getAttribute( 'class' );

                        if( current_class == 'disclosure disclosure_show' )
                        {
                                current_class = 'disclosure_hide';
                        }
                        else
                        {
                                current_class = 'disclosure_show';
                        }

                        box.setAttribute( 'class', 'disclosure ' + current_class );
                        box.setAttribute( 'className', current_class );

                }
        }


        function addQuestion( table_id, reason_id )
        {
                var question_id = reason_id + '/0/' + new Date().getTime();
                Ext.DomHelper.append( table_id, {
                        tag: 'tr', children: [
                                { tag: 'th', html: '<input type="checkbox" name="q[]" value="' + question_id + '" onclick="enableSave()">' },
                                { tag: 'td', html: '<textarea name="qt[' + question_id + ']"></textarea>' }
                        ]
                });

        }

        /* used for keeping alive */
        function heartbeat()
        {
                Ext.Ajax.request({
                        url : root + 'json/heartbeat' ,
                        method: 'POST',
                        params: { url: this.location.href }
                });
        }

        if (keep_alive)
        {
                interval = 1000 * 30;  // 30 seconds
                setInterval(heartbeat, interval);
        }


function deleteInvoice(id)
{
    if (confirm("Are you sure you want to delete this invoice?"))
    {
        window.location = root + 'invoices/delete-invoice/' + id;
    }
}