|  | var Kariu = {}; | 
        
          |  |  | 
        
          |  | Kariu.version = 0.01; | 
        
          |  |  | 
        
          |  | Kariu.list = {}; | 
        
          |  |  | 
        
          |  | Kariu.create = function( params ){ | 
        
          |  | this.genID = function(){ | 
        
          |  | return 'jqwin' + '_' + parseInt( new Date().getTime() ) + '_' + parseInt( Math.random() * 1000000 ); | 
        
          |  | }; | 
        
          |  | this.show = function( x, y ){ | 
        
          |  | if ( typeof( x ) == 'undefined' ) { x = 100; } ; | 
        
          |  | if ( typeof( y ) == 'undefined' ) { y = 100; } ; | 
        
          |  | if ( typeof( this.dom ) == 'undefined' ) { | 
        
          |  | d = '<div id="'+this.id+'"></div>'; | 
        
          |  | this.dom = $("body").append( d ) | 
        
          |  | .find( "#"+this.id ) | 
        
          |  | .attr( 'class', this.class ) | 
        
          |  | .attr( 'title', this.title ) | 
        
          |  | .css( 'position', 'absolute' ) | 
        
          |  | .css( 'display', 'none' ) | 
        
          |  | .css( 'width', this.width+'px' ) | 
        
          |  | .css( 'height', this.height+'px' ) | 
        
          |  | .dblclick(function(){Kariu.destroy(this.id)}) | 
        
          |  | .html( this.html ) | 
        
          |  | ; | 
        
          |  | } | 
        
          |  | this.dom.css( 'left', x+'px' ) | 
        
          |  | .css( 'top', y+'px' ) | 
        
          |  | .fadeIn('slow') | 
        
          |  | .draggable() | 
        
          |  | ; | 
        
          |  | Kariu.list[ this.id ] = this; | 
        
          |  | }; | 
        
          |  | this.hide = function(){ this.dom.hide( 'blind' ) }; | 
        
          |  | this.title = 'Double-Click to close this window'; | 
        
          |  | this.id = ( params.id || this.genID() ); | 
        
          |  | this.class = ( params.class || 'jqwin' ); | 
        
          |  | this.width = ( params.width || 300 ); | 
        
          |  | this.height = ( params.height || 200 ); | 
        
          |  | return this; | 
        
          |  | }; | 
        
          |  |  | 
        
          |  | Kariu.destroy = function( id ){ | 
        
          |  | target = Kariu.list[ id ]; | 
        
          |  | if ( typeof( target.dom )!= 'undefined' ) { | 
        
          |  | if ( target.dom.css('display') != 'none' ) { | 
        
          |  | target.dom.hide('explode',function(){ | 
        
          |  | $(target.dom).remove(); | 
        
          |  | $(".ui-effects-explode").remove(); | 
        
          |  | if( Kariu.list[ id ] ){ delete Kariu.list[ id ] }; | 
        
          |  | }); | 
        
          |  | }; | 
        
          |  | } | 
        
          |  | }; | 
        
          |  |  | 
        
          |  | /* | 
        
          |  |  | 
        
          |  | =head1 NAME | 
        
          |  |  | 
        
          |  | Kariu - javascript window system | 
        
          |  |  | 
        
          |  | =head1 SYNOPSIS | 
        
          |  |  | 
        
          |  | win = new Kariu.create( { width: 250, height: 150 } ); | 
        
          |  | win.html = '<p>my name is ytnobody.</p>'; | 
        
          |  | win.show( 300, 100 ); | 
        
          |  | Kariu.destroy( win.id ); | 
        
          |  |  | 
        
          |  | =head1 DEPENDENCY | 
        
          |  |  | 
        
          |  | - jquery 1.5.0 | 
        
          |  |  | 
        
          |  | - jqueryui 1.8.9 | 
        
          |  |  | 
        
          |  | =head1 AUTHOR | 
        
          |  |  | 
        
          |  | satoshi azuma | 
        
          |  |  | 
        
          |  | =head1 LICENSE | 
        
          |  |  | 
        
          |  | This script is free software. You can redistribute it and/or modify it under the same terms. | 
        
          |  |  | 
        
          |  | =cut | 
        
          |  |  | 
        
          |  | */ |