function SmallMenu(){function SmallMenuVoice(icon,text,callback,father,pos){this.icon=icon;this.text=text;this.callback=callback;this.father=father;this.pos=pos;this.obj=$('
  • ');if(typeof(this.icon)!="undefined"&&this.icon!=null) $(this.obj).append('');$(this.obj).append(''+this.text+'');this.appendTo=function(context){$(context).append(this.obj);$(this.obj).click(jQuery.proxy(function(){if(this.callback!=null)this.callback(this.pos);this.father.hide();},this));}} this.voices=new Array();this.obj=$('');this.position=0;this.addVoice=function(icon,text,callback){this.voices.push(new SmallMenuVoice(icon,text,callback,this,this.position++));return this;} this.show=function(context,x,y){for(var i in this.voices)this.voices[i].appendTo(this.obj);$(context).append(this.obj);$(this.obj).css("top",y).css("left",x).hide().fadeIn(300);$(this.obj).mouseleave(jQuery.proxy(function(){this.hide();},this));$(this.obj).mouseenter(jQuery.proxy(function(){clearTimeout(this.hideTimer);},this));clearTimeout(this.hideTimer);this.setHideTimer();} this.hide=function(){$(this.obj).fadeOut(300,jQuery.proxy(function(){$(this.obj).remove();$(this.obj).html("");},this));clearTimeout(this.hideTimer);} this.toggle=function(context,x,y){if($(this.obj).is(":visible"))this.hide();else this.show(context,x,y);} this.setHideTimer=function(){this.hideTimer=setTimeout(jQuery.proxy(function(){this.hide();},this),3000);} this.addClass=function(c){$(this.obj).addClass(c);}} function CButton(container,image,operation){this.container=container;this.image=image;this.operation=operation;this.imgTag=$('');this.visible=false;this.show=function(){$(this.container).append(this.imgTag);$(this.imgTag).click(jQuery.proxy(function(){if(this.operation!=null)this.operation(this);},this));this.visible=true;return this;} this.hide=function(){$(this.imgTag).remove();this.visible=false;} this.addClass=function(c){$(this.imgTag).addClass(c);return this;} this.getX=function(){return $(this.imgTag).position().left;} this.getY=function(){return $(this.imgTag).position().top;} this.isVisible=function(){return this.visible;}} function YesNoDialog(text,yes,no,callback){this.text=text;this.yes=yes;this.no=no;this.callback=callback;this.obj=$('
    ');this.yesbutton=$(''+yes+'');this.nobutton=$(''+no+'');$(this.obj).append('

    '+this.text+'

    ').append(this.yesbutton).append(this.nobutton);this.show=function(){if($(this.obj).is(":visible"))return;$("body").append(this.obj);$(this.obj).css("top",Math.round(($(window).height()-$(this.obj).outerHeight(false))/ 2.5)+"px").css("left",Math.round(($(window).width()-$(this.obj).outerWidth(false))/ 2)+"px");$(this.obj).hide().fadeIn(300);$(this.yesbutton).click(jQuery.proxy(function(){if(this.callback!=null)this.callback();this.hide();},this));$(this.nobutton).click(jQuery.proxy(function(){this.hide();},this));} this.hide=function(){$(this.obj).fadeOut(300,jQuery.proxy(function(){$(this.obj).remove();},this));} this.setCallback=function(callback){this.callback=callback;}} function OkDialog(text,ok,callback){this.text=text;this.ok=ok;this.callback=callback;this.obj=$('
    ');this.okbutton=$(''+ok+'');$(this.obj).append('

    '+this.text+'

    ').append(this.okbutton);$(this.okbutton).click(jQuery.proxy(function(){if(this.callback!=null)this.callback();this.hide();},this));this.show=function(){$("body").append(this.obj);$(this.obj).css("top",Math.round(($(window).height()-$(this.obj).outerHeight(false))/ 2)+"px").css("left",Math.round(($(window).width()-$(this.obj).outerWidth(false))/ 2)+"px");$(this.obj).hide().fadeIn(300);} this.hide=function(){$(this.obj).fadeOut(300,jQuery.proxy(function(){$(this.obj).remove();},this));} this.setCallback=function(callback){this.callback=callback;}}