jQuery.Pointer=function(options){if(!options){options={}}options.side=options.side||120;options.pointerClass=options.pointerClass||"pointer";options.pointer=options.pointer||false;var onClick=options.onClick||false;var $p=null;var e=null;var $e=null;var point=null;var shown=false;if(options.pointer){$p=$(options.pointer)}else{$p=$("<div></div>").appendTo("body").addClass(options.pointerClass).width(options.side).height(options.side).appendTo("body");$("<div></div>").width(options.side-2).height(options.side-2).appendTo($p)}var ep=null;var ew=null;var eh=null;var s=$p.outerWidth();var r=s/2;function bind(el){e=el;$e=$(e);ep=$e.offset();ew=$e.width();eh=$e.height()}this.assoc=function(el){bind(el)};this.start=function(el,onClickCallback){bind(el);var me=this;hide();$p.css("cursor","crosshair").bind("click",me,doPoint);$e.css("cursor","crosshair").bind("click",me,doPoint);onClick=onClickCallback};function moveRelPx(x,y){$p.css("left",x<r?ep.left:(ew-x<r?ep.left+ew-s:ep.left+x-r)).css("top",y<r?ep.top:(eh-y<r?ep.top+eh-s:ep.top+y-r)).css("z-index",3)}this.moveToPoint=function(x,y){moveAbs(x,y)};function moveAbs(pageX,pageY){var x=pageX-ep.left;var y=pageY-ep.top;point={x:x/ew,y:y/eh};$p.css("left",x<r?ep.left:(ew-x<r?ep.left+ew-s:pageX-r)).css("top",y<r?ep.top:(eh-y<r?ep.top+eh-s:pageY-r)).css("z-index",3)}function doPoint(e){var x=e.pageX-ep.left;var y=e.pageY-ep.top;point={x:x/ew,y:y/eh};moveRelPx(x,y);show();if(onClick){onClick(e.data,e)}}function show(){if(shown){return}$p.show();shown=true}function hide(){if(!shown){return}$p.hide();shown=false}this.show=function(){show()};this.hide=function(){hide()};this.stop=function(){this.unbind();$p.hide().css("cursor","pointer");$e.css("cursor","pointer")};this.unbind=function(){var me=this;$e.unbind("click",doPoint);$p.unbind("click",doPoint)};this.getPos=function(){return $p.offset()};this.getSide=function(){return $p.width()};this.e=function(){return $e};this.getPoint=function(){return point}};jQuery.fn.extend({taglist:function(options){if(!options||!options.tags){return false}options.ulClass=options.ulClass||"taglist_class";options.liClass=options.liClass||"taglist_class";options.formatTag=options.formatTag||formatTag;function formatTag(tag,$img){return $("<li></li>").addClass(options.liClass).html(tag.text)}return this.each(function(){var $d=$(this);var $i=$("#"+this.getAttribute("img"));var tags=options.tags[this.getAttribute("for")];var $ul=$("<ul></ul>").addClass(options.ulClass).appendTo($d);$.each(tags,function(k,t){$ul.append(options.formatTag(t,$i))})})}});