(function($){ //---------------------------------------------------------------- // CWaitIcon //---------------------------------------------------------------- function CWaitIcon( url_img ) { var s = ''; s += ""; this.img = $( s ); this.img.css({ "position":"absolute", "left":"-10000px", "top":"-10000px" }); this.img.hide(); this.img.appendTo( $( 'body' ) ); } CWaitIcon.prototype = { show : function( e ) { var w = 32; var h = 32; this.img.css( { "left":(e.pageX - w/2) + "px", "top":(e.pageY - h/2) + "px" } ); this.img.show(); }, hide : function() { this.img.hide(); } } //---------------------------------------------------------------- // CApp //---------------------------------------------------------------- var app_object_selector = '.ajax-poll'; function CApp( jobj ) { this.children = []; this.jobj = jobj; this.tclass = this.getAttr( 'tclass', jobj ); this.tid = this.getAttr( 'tid', jobj ); this.url_app_entry = 'http://betbreak.com/ab/web/ajax-poll.php'; this.url_app_root = 'http://betbreak.com/ab/web/'; this.url_app_img = 'http://betbreak.com/ab/web/app.img/'; this.appid = this.makeRandomString( 64 ); this.app_init_cmd = 'init'; this.wait_icon = new CWaitIcon( this.url_app_img + 'wait.gif' ); if ( this.app_init_cmd != '' ) { this.send( { "cmd" : this.app_init_cmd } ); } } CApp.prototype = { showWaitIcon: function( e ) { this.wait_icon.show( e ); }, showTipBox: function( obj, cfg, tbox ) { period = ( "period" in cfg ) ? cfg["period"] : 2500; var tip_box; if ( typeof tbox === 'object' ) { tip_box = tbox.clone(); } else { txt = ( "txt" in cfg ) ? cfg["txt"] : "Saved!"; bgcolor = ( "background-color" in cfg ) ? cfg["background-color"] : "#60a060"; var s = ''; s += ""; s += txt; s += ""; tip_box = $( s ); } tip_box.css({ "position":"absolute", "left":"-10000px", "top":"-10000px" }); tip_box.appendTo( $( 'body' ) ); tip_box.show(); wt = tip_box.outerWidth(false); ht = tip_box.outerHeight(true); var x = obj.offset().left; var y = obj.offset().top; var w = obj.width(); var h = obj.height(); var ytd = 10; var xt = x + w/2 - wt/2; var yt = y - ht; tip_box.css( { "left":xt + "px", "top":yt + "px" } ); tip_box.fadeOut( period, function() { tip_box.remove(); }); }, //----------------------------------------------- // makeRandomString( n ) //----------------------------------------------- makeRandomString : function ( n ) { var s = ""; var src = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; for( var i=0; i < n; i++ ) { s += src.charAt( Math.floor( Math.random() * src.length ) ); } return s; }, //----------------------------------------------- // errBox //----------------------------------------------- errBox : function( data ) { var errbox_sig = ""; if ( data.substring( 0, errbox_sig.length ) == errbox_sig ) {// prevent double errbox return data; } else { var msg = ''; msg += "