// (c) Widgit

var Point={lastEvent:null,lastSpan:null,lastMousePosX:0,lastMousePosY:0,tooltipTargetX:0,tooltipTargetY:0,timeoutId:0,tooltipDiv:null,imageLoadTimer:0,waitIconDiv:null,pointActive:false,requestedWord:"",array_contains:function(arr,val){for(var i=0,len=arr.length;i<len;i++){if(arr[i]==val){return true;}}
return false;},hasClass:function(el,cssClass){if(el.className){var classNames=el.className.split(" ");return Point.array_contains(classNames,cssClass);}
return false;},createCookie:function(name,value,days){var expires="";if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));expires="; expires="+date.toGMTString();}
document.cookie=name+"="+value+expires+"; path=/";},readCookie:function(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' '){c=c.substring(1,c.length);}
if(c.indexOf(nameEQ)===0){return c.substring(nameEQ.length,c.length);}}
return null;},eraseCookie:function(name){createCookie(name,"",-1);},formatEvent:function(eventRef){var isIE=(navigator.userAgent.indexOf('compatible')>-1)&&(navigator.userAgent.indexOf('MSIE')>-1)&&(!(navigator.userAgent.indexOf('Opera')>-1));var isWin=(navigator.platform=='Win32')||(navigator.platform=='Windows');if((isIE)&&(isWin))
{eventRef.charCode=(eventRef.type=='keypress')?eventRef.keyCode:0;eventRef.eventPhase=2;eventRef.isChar=(eventRef.charCode>0);eventRef.pageX=eventRef.clientX+document.documentElement.scrollLeft+document.body.scrollLeft;eventRef.pageY=eventRef.clientY+document.documentElement.scrollTop+document.body.scrollTop;eventRef.preventDefault=function()
{Point.returnValue=false;};if(eventRef.type=='mouseout')
{eventRef.relatedTarget=eventRef.toElement;}
else if(eventRef.type=='mouseover')
{eventRef.relatedTarget=eventRef.fromElement;}
eventRef.stopPropagation=function()
{Point.cancelBubble=true;};eventRef.target=eventRef.srcElement;eventRef.time=(new Date()).getTime();}
return eventRef;},sendRequest:function(url,callback,postData){var req=Point.createXMLHTTPObject();if(!req){return;}
var method=(postData)?"POST":"GET";req.open(method,url,true);req.setRequestHeader('User-Agent','XMLHTTP/1.0');if(postData){req.setRequestHeader('Content-type','application/x-www-form-urlencoded');}
req.onreadystatechange=function(){if(req.readyState!=4){return;}
if(req.status!=200&&req.status!=304){return;}
callback(req);};if(req.readyState==4){return;}
req.send(postData);},createXMLHTTPObject:function(){var XMLHttpFactories=[function(){return new XMLHttpRequest();},function(){return new ActiveXObject("Msxml2.XMLHTTP");},function(){return new ActiveXObject("Msxml3.XMLHTTP");},function(){return new ActiveXObject("Microsoft.XMLHTTP");}];var xmlhttp=false;for(var i=0;i<XMLHttpFactories.length;i++){try{xmlhttp=XMLHttpFactories[i]();}
catch(e){continue;}
break;}
return xmlhttp;},addNode:function(parent,node,next){if(next===null){parent.appendChild(node);}else{parent.insertBefore(node,next);}},stripPunctuation:function(word){return word.replace(/^[^\w]+/,"").replace(/[^\w]$/,"");},spanify:function(node){if(node!==null){var c=node.childNodes;for(var i=0;i<c.length;i++){var child=c[i];var nextNode=null;if(i<c.length-1){nextNode=c[i+1];}
if(child.nodeType==3){node.removeChild(child);--i;var str=child.data;while(str.length>0){var wordmatch=str.match(/^[^\s]+/);if(wordmatch!==null){var word=wordmatch[0];var newspan=document.createElement("span");newspan.className="point_sym_hover_span";newspan.onmousemove=Point.processHover;newspan.onmouseout=Point.cancelHover;newspan.onmouseenter=Point.highlightSpan;newspan.onmouseleave=Point.unhighlightSpan;var newtext=document.createTextNode(word);newspan.appendChild(newtext);Point.addNode(node,newspan,nextNode);++i;str=str.slice(word.length);}
var spacematch=str.match(/^\s+/);if(spacematch!==null){var spacetext=spacematch[0];var space=document.createTextNode(spacetext);Point.addNode(node,space,nextNode);++i;str=str.slice(space.length);}}}
else{Point.spanify(child);}}}},setSpanClasses:function(node){if(node!==null){var c=node.childNodes;for(var i=0;i<c.length;i++){var child=c[i];var nextNode=null;if(i<c.length-1){nextNode=c[i+1];}
if(child.nodeType==1){if(((child.className=="point_sym_hover_span")||(child.className=="point_sym_hover_span_hl"))&&(!Point.pointActive)){child.className="point_sym_hover_span_disabled";}
if(((child.className=="point_sym_hover_span_nosymbol")||(child.className=="point_sym_hover_span_nosymbol_hl"))&&(!Point.pointActive)){child.className="point_sym_hover_span_nosymbol_disabled";}
if((child.className=="point_sym_hover_span_disabled")&&(Point.pointActive)){child.className="point_sym_hover_span";}
if((child.className=="point_sym_hover_span_nosymbol_disabled")&&(Point.pointActive)){child.className="point_sym_hover_span_nosymbol";}}
Point.setSpanClasses(child);}}},findElements:function(node){if(node!==null){var processChildren=true;if(node.nodeType==1){if(Point.hasClass(node,Point.pointEnabledDivClass)){Point.spanify(node);processChildren=false;}}
if(processChildren){var c=node.childNodes;for(var i=0;i<c.length;i++){Point.findElements(c[i]);}}}},nodeText:function(node){var str="";if(node!==null){var c=node.childNodes;for(var i=0;i<c.length;i++){if(c[i].nodeType==3){str+=c[i].data;}}}
return str;},receiveTipData:function(req){str=req.responseText;if(str.replace(/^\s+|\s+$/g,'')===''){str="No Symbol";}
Point.showTip(str,Point.lastMousePosX,Point.lastMousePosY);},startHover:function(){if(Point.findContentById===true)
{var node=document.getElementById(Point.pointEnabledDivId);Point.spanify(node);}else{Point.findElements(document);}
Point.addWaitIcon();},unloadedImageCount:function(node,count){var ct=count;if(node!==null){var c=node.childNodes;for(var i=0;i<c.length;i++){var child=c[i];if(child.nodeType==1){if(child.tagName=="IMG"){if(child.complete!==true){ct++;}}}
ct=Point.unloadedImageCount(child,ct);}}
return ct;},disableSpansForWord:function(node,word){if(node!==null){var c=node.childNodes;for(var i=0;i<c.length;i++){var child=c[i];if((child.nodeType==1)&&((child.className=='point_sym_hover_span')||(child.className=='point_sym_hover_span_hl'))&&(Point.stripPunctuation(Point.nodeText(child))==word)){child.className='point_sym_hover_span_nosymbol';if(child.className=='point_sym_hover_span_hl'){child.className='point_sym_hover_span_nosymbol_hl';}
else{child.className='point_sym_hover_span_nosymbol';}}
Point.disableSpansForWord(child,word);}}},showTip:function(content,x,y){if(Point.tooltipDiv){document.body.removeChild(Point.tooltipDiv);Point.tooltipDiv=null;}
if(content.indexOf("<img")>-1){Point.tooltipDiv=document.createElement("div");Point.tooltipDiv.id="point_Point.tooltipDiv";Point.tooltipDiv.className="point_sym_tooltip";Point.tooltipDiv.innerHTML=content;Point.imageLoadTimer=setInterval(Point.checkSymbolsLoaded,50);Point.tooltipDiv.style.left="0px";Point.tooltipDiv.style.top="0px";Point.tooltipDiv.style.visibility="hidden";Point.tooltipTargetX=x+10;Point.tooltipTargetY=y+4;Point.waitIconDiv.style.left=(x+10)+"px";Point.waitIconDiv.style.top=(y+4)+"px";Point.waitIconDiv.style.display="";document.body.appendChild(Point.tooltipDiv);}else{Point.disableSpansForWord(document,Point.requestedWord);}},addWaitIcon:function(){Point.waitIconDiv=document.createElement("div");Point.waitIconDiv.id="point_waiticon";Point.waitIconDiv.className="point_waiticon";Point.waitIconDiv.style.display="none";document.body.appendChild(Point.waitIconDiv);},setPointState:function(enabled)
{Point.pointActive=enabled;Point.setSpanClasses(document);},enablePoint:function(startImmediately)
{var start=startImmediately;if(typeof(startImmediately)=='undefined'){start=true;}
if(Point.readCookie('point_enabled')==='true'){start=true;}
if(Point.readCookie('point_enabled')==='false'){start=false;}
Point.startHover();Point.setPointState(start);Point.updatePointImage();},updatePointImage:function()
{image=document.getElementById("point_togglebutton");if(image!==null){image.src=Point.pointActive?Point.enabledPointImage:Point.disabledPointImage;}},togglePoint:function()
{Point.setPointState(!Point.pointActive);Point.updatePointImage();Point.createCookie('point_enabled',Point.pointActive===true?'true':'false',90);},doHover:function(){if(Point.pointActive){var targ=Point.lastEvent.target||Point.lastEvent.srcElement;if(targ.nodeType==3){targ=targ.parentNode;}
if((targ.className=='point_sym_hover_span')||(targ.className=='point_sym_hover_span_hl')){Point.requestedWord=Point.stripPunctuation(Point.nodeText(targ));Point.sendRequest(Point.proxyUrl+"?word="+Point.requestedWord,Point.receiveTipData);}}},highlightSpan:function(){window.event.srcElement.className=window.event.srcElement.className+'_hl';},unhighlightSpan:function(){window.event.srcElement.className=window.event.srcElement.className.replace(/_hl$/,"");},processHover:function(evt){if(Point.pointActive){if(Point.tooltipDiv===null){var posx=0;var posy=0;var e=Point.formatEvent(evt||window.event);Point.lastEvent=e;if(e.pageX||e.pageY){posx=e.pageX;posy=e.pageY;}
else if(e.clientX||e.clientY){posx=e.clientX+document.body.scrollLeft+
document.documentElement.scrollLeft;posy=e.clientY+document.body.scrollTop+
document.documentElement.scrollTop;}
if((Point.lastMousePosX==posx)&&(Point.lastMousePosY==posy)){return;}
Point.lastMousePosX=posx;Point.lastMousePosY=posy;Point.cancelHover();Point.timeoutId=setTimeout(Point.doHover,Point.hoverTimeout);}}},cancelHover:function(){if(Point.tooltipDiv){document.body.removeChild(Point.tooltipDiv);Point.tooltipDiv=null;}
Point.waitIconDiv.style.display="none";if(Point.timeoutId){clearTimeout(Point.timeoutId);Point.timeoutId=0;}
clearInterval(Point.imageLoadTimer);},checkSymbolsLoaded:function(){var imageLoadCount=Point.unloadedImageCount(Point.tooltipDiv,0);if(imageLoadCount===0)
{clearInterval(Point.imageLoadTimer);var windowwidth=0,windowheight=0;if(typeof(window.innerWidth)=='number'){windowwidth=window.innerWidth;windowheight=window.innerHeight;}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){windowwidth=document.documentElement.clientWidth;windowheight=document.documentElement.clientHeight;}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){windowwidth=document.body.clientWidth;windowheight=document.body.clientHeight;}
Point.waitIconDiv.style.display="none";var divbase=Point.tooltipTargetY+Point.tooltipDiv.clientHeight;var divright=Point.tooltipTargetX+Point.tooltipDiv.clientWidth;var vistop=document.documentElement.scrollTop+document.body.scrollTop;var visleft=document.documentElement.scrollLeft+document.body.scrollLeft;var divheight=Point.tooltipDiv.clientHeight;var divwidth=Point.tooltipDiv.clientWidth;var visbase=vistop+windowheight;var visright=visleft+windowwidth;var baseoverlap=divbase-visbase;var rightoverlap=divright-visright;if(baseoverlap>0){var newtop=Point.tooltipTargetY-baseoverlap-20;if(newtop<vistop){newtop=vistop+5;}
Point.tooltipTargetY=newtop;}
if(rightoverlap>0){var newleft=Point.tooltipTargetX-Point.tooltipDiv.offsetWidth-20;if(newleft>=visleft){Point.tooltipTargetX=newleft;}}
Point.tooltipDiv.style.left=Point.tooltipTargetX+"px";Point.tooltipDiv.style.top=Point.tooltipTargetY+"px";Point.tooltipDiv.style.visibility="";}}};
