//  Place your application-specific JavaScript functions and classes here
//  This file is automatically included by javascript_include_tag :defaults
    function show_popup(target_window) {
        $('#' + target_window).fadeIn('fast');
    }
    function close_popup(target_window) {
        $('#' + target_window).hide();
        return false;
    }

    //Popup ---- START
    function Popup(title,width,source_id){
        this.id='popup_text';
        this.source_id=source_id;
        this.title = title;
        this.width = width
        if(this.source_id != null)
            $('#'+this.source_id+'').hide();
        if($('#'+this.id+'').attr('id')==undefined){
            $("body").append("<div id='"+this.id+"'></div>");
        }

        this.show = function(source_id) {
            if(source_id != null)
                $('#'+this.id+'').html($('#'+source_id+'').html());
            else if (this.source_id != null)
                $('#'+this.id+'').html($('#'+this.source_id+'').html());
            $('#'+this.id+'').dialog("destroy");
            $('#'+this.id+'').dialog({title: this.title, autoOpen: false, dialogClass: 'popup_title', width: this.width, resizable: false });
            $('#'+this.id+'').dialog('open');
            return false;
        }

        this.hide = function() {
            $('#'+this.id+'').dialog('close');
            return false;
        }
    }
    //Popup ---- END