bubbleUniqueID=0;function HintBubble(element,content,options){this.element=jQuery(element);this.content=content;this.id="hintbubble-"+(bubbleUniqueID++);if(typeof options!="undefined"){this.options=options;}else{this.options={};} this.obj=jQuery('
');jQuery(this.obj).attr("id",this.id);this.closeObj=jQuery('Continua');this.cancelObj=jQuery('Termina tutorial');this.arrowSize=8;this.fadeTime=600;this.browserDataPre="hintbubble-";this.show=function(){if(!this.canShow())return;jQuery("body").append(this.obj);jQuery(this.obj).html(this.content);jQuery(this.obj).append(this.closeObj);jQuery(this.obj).append(this.cancelObj);jQuery(this.obj).append('
');jQuery(this.obj).addClass(this.options.type);jQuery(this.obj).css("width",this.options.width+"px");var rect=this.element.offset();var top=0;var left=0;switch(this.options.type){case"top":top=rect.top-jQuery(this.obj).outerHeight(false)-this.arrowSize;left=rect.left+((jQuery(this.element).outerWidth(false)-jQuery(this.obj).outerWidth(false))/ 2);break;case"bottom":top=rect.top+jQuery(this.element).outerHeight(false)+this.arrowSize;left=rect.left+((jQuery(this.element).outerWidth(false)-jQuery(this.obj).outerWidth(false))/ 2);break;case"left":top=rect.top+((jQuery(this.element).outerHeight(false)-jQuery(this.obj).outerHeight(false))/ 2);left=rect.left-jQuery(this.obj).outerWidth(false)-this.arrowSize;break;case"right":top=rect.top+((jQuery(this.element).outerHeight(false)-jQuery(this.obj).outerHeight(false))/ 2);left=rect.left+jQuery(this.element).outerWidth(false)+this.arrowSize;break;} top=Math.max(0,Math.min(jQuery("body").height(),Math.round(top)));left=Math.max(0,Math.min(jQuery("body").width(),Math.round(left)));jQuery(this.obj).css("left",left+"px").css("top",top+"px").hide().fadeIn(this.fadeTime);var arrowtop=-1;var arrowleft=-1;switch(this.options.type){case"top":arrowleft=(rect.left+(jQuery(this.element).width()/ 2))-left-this.arrowSize;break;case"bottom":arrowleft=(rect.left+(jQuery(this.element).width()/ 2))-left-this.arrowSize;break;case"left":arrowtop=(rect.top+(jQuery(this.element).height()/ 2))-top-this.arrowSize;break;case"right":arrowtop=(rect.top+(jQuery(this.element).height()/ 2))-top-this.arrowSize;break;} arrowtop=Math.round(arrowtop);arrowleft=Math.round(arrowleft);if(arrowtop>=0){jQuery('head').append('');} if(arrowleft>=0){jQuery('head').append('');} this.bindCloseClick();} this.intializeOptions=function(){if(typeof this.options.type=="undefined")this.options.type="left";if(typeof this.options.width=="undefined")this.options.width=400;} this.intializeOptions();this.bindCloseClick=function(){jQuery(this.closeObj).click(jQuery.proxy(function(e){e.preventDefault();jQuery(this.obj).fadeOut(this.fadeTime,jQuery.proxy(function(){jQuery(this.obj).remove();},this));this.setShowedOnBrowserData();if(this.options.onClose){this.options.onClose();}},this));jQuery(this.cancelObj).click(jQuery.proxy(function(e){e.preventDefault();jQuery(this.obj).fadeOut(this.fadeTime,jQuery.proxy(function(){jQuery(this.obj).remove();},this));this.setShowedOnBrowserData();},this));};this.setShowedOnBrowserData=function(){if(this.options.remember){jQuery.jStorage.set(this.browserDataPre+this.options.remember,"true");}} this.canShow=function(){var el_exists=jQuery(this.element).length>0;var stored_value=jQuery.jStorage.get(this.browserDataPre+this.options.remember);var already_showed=this.options.remember&&stored_value&&stored_value=="true";return(el_exists&&!already_showed)||(this.options.force);}}