function setupTooltips(){var n=["INPUT","TEXTAREA","SELECT"];for(var f in n){var a=document.body.getElementsByTagName(n[f]);for(var e=0;e<a.length;e++){var m=a[e].getAttribute("tooltip");if(m){var b=a[e].getAttribute("tooltipconfig");var o={};if(b){var d=b.split(",");for(var c=0;c<d.length;c++){var k=d[c].split("=");var h=k.shift();var g=k.join("=");o[h]=g;}}var l=new Tooltip(a[e],m,o);}}}}function Tooltip(c,d,b){this.target=c;this.tooltipText=d;this.config=b;this.elm=null;this.animations=[];this.animating=false;var a=this;if("attachEvent" in document){c.attachEvent("onfocus",function(f){a.onFocus(f);});c.attachEvent("onblur",function(f){a.onBlur(f);});}else{c.addEventListener("focus",function(f){a.onFocus(f);},false);c.addEventListener("blur",function(f){a.onBlur(f);},false);}}Tooltip.prototype.processAnimations=function(){if(this.animating==true){return;}if(this.animations.length>0){this.animating=true;var a=this;var c=this.animations.shift();var b=(new Date()).valueOf();setTimeout(function(){var d=(new Date()).valueOf();var e=(d-b)/c.interval;if(e>1){e=1;}c.animate(e);if(e==1){c.complete();a.animating=false;if(a.animations.length>0){a.processAnimations();}}else{setTimeout(arguments.callee,33);}},33);}};Tooltip.prototype.animate=function(c,a,b){this.animations.push({animate:c,interval:a,complete:b});this.processAnimations();};Tooltip.prototype.onBlur=function(b){if(!b){b=window.event;}var a=this;if(this.elm!=null){this.animate(function(d){d=1-d;function c(f){if(!f){return;}for(var e=0;e<f.childNodes.length;e++){c(f.childNodes[e]);}if("style" in f){f.style.opacity=d;f.style.mozOpacity=Math.round(255*d);f.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity="+Math.round(100*d)+")";}}c(a.elm);},250,function(){function c(e){if(!e){return;}for(var d=0;d<e.childNodes.length;d++){c(e.childNodes[d]);}if("style" in e){e.style.filter="";}}c(a.elm);document.body.removeChild(a.elm);a.elm=null;});}};Tooltip.prototype.onFocus=function(e){var d=("arrow" in this.config)?this.config.arrow:"west";if(!e){e=window.event;}var g=this.createTooltipDOM();var c=function(h){return(h)?(((h.offsetLeft)?h.offsetLeft:0)+arguments.callee(h.offsetParent)):0;}(this.target);var a=function(h){return(h)?(((h.offsetTop)?h.offsetTop:0)+arguments.callee(h.offsetParent)):0;}(this.target);var f=this.target.offsetWidth;var b=this.target.offsetHeight;switch(d){case"north":g.element.style.left=c+f/2+g.left+"px";g.element.style.top=a+b+4+g.top+"px";break;case"east":g.element.style.left=c+g.left-4+"px";g.element.style.top=a+b/2+g.top+"px";break;case"south":g.element.style.left=c+f/2+g.left+"px";g.element.style.top=a-4+g.top+"px";break;case"west":default:g.element.style.left=c+f+4+g.left+"px";g.element.style.top=a+b/2+g.top+"px";break;}g.element.style.visibility="hidden";document.body.appendChild(g.element);this.elm=g.element;this.animate(function(i){function h(k){if(!k){return;}for(var j=0;j<k.childNodes.length;j++){h(k.childNodes[j]);}if("style" in k){k.style.opacity=i;k.style.mozOpacity=Math.round(255*i);k.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity="+Math.round(100*i)+")";}}h(g.element);g.element.style.visibility="visible";},250,function(){function h(k){if(!k){return;}for(var j=0;j<k.childNodes.length;j++){h(k.childNodes[j]);}if("style" in k){k.style.filter="";}}h(g.element);});};Tooltip.prototype.createTooltipDOM=function(){var r=0;var q=0;var c=document.createElement("DIV");var d=("color" in this.config)?this.config.color:"#ffee99";var p=("maxwidth" in this.config)?parseInt(this.config.maxwidth):200;var a=("bordercolor" in this.config)?this.config.bordercolor:"#ddcc77";var t=("arrow" in this.config)?this.config.arrow:"west";var u=("borderwidth" in this.config)?parseInt(this.config.borderwidth):1;c.innerHTML=this.tooltipText;c.style.padding="8px";c.style.color="#333";c.style.backgroundColor=d;c.style.position="absolute";c.style.fontFamily="Arial";c.style.fontSize="12px";c.style.fontWeight="bold";function i(x){var o=x.cloneNode(true);o.style.visibility="hidden";o.style.left="0";o.style.top="0";document.body.appendChild(o,true);var w=o.offsetWidth;var v=o.offsetHeight;document.body.removeChild(o);return[w,v];}var j=i(c);var s=j[0];var e=j[1];if(p>0&&s>p){c.style.width=p+"px";var j=i(c);var s=j[0];var e=j[1];}var h=e+(u*2);var g=s+(u*2);var m=c.cloneNode(true);m.style.width=s+(u*2)+"px";m.style.height=h+"px";m.style.backgroundColor=a;m.style.padding="0";m.innerHTML="";c.style.left=u+"px";c.style.top=u+"px";m.appendChild(c,true);c=m;var f=0;var n=0;function b(w,v,x){var o=document.createElement("DIV");o.style.position="absolute";o.style.width="0";o.style.height="0";o.style.lineHeight="0";o.style.fontSize="0";o.style.padding="0";switch(x){case"west":o.style.borderRight=w+"px solid "+v;o.style.borderTop=(w/2)+"px dashed transparent";o.style.borderBottom=(w/2)+"px dashed transparent";break;case"east":o.style.borderLeft=w+"px solid "+v;o.style.borderTop=(w/2)+"px dashed transparent";o.style.borderBottom=(w/2)+"px dashed transparent";break;case"north":o.style.borderBottom=w+"px solid "+v;o.style.borderLeft=(w/2)+"px dashed transparent";o.style.borderRight=(w/2)+"px dashed transparent";break;case"south":o.style.borderTop=w+"px solid "+v;o.style.borderLeft=(w/2)+"px dashed transparent";o.style.borderRight=(w/2)+"px dashed transparent";break;}return o;}switch(t){case"north":var k=b(16+u,a,t);k.style.left=g/2-(16+u)/2+"px";k.style.top="-"+(16+u)+"px";var l=b(16,d,t);l.style.left="-8px";l.style.top=u*2+"px";k.appendChild(l,true);f=-g/2;n=16+u;break;case"east":var k=b(16+u,a,t);k.style.left=g-u+"px";k.style.top=h/2-(16+u)/2+"px";var l=b(16,d,t);l.style.left="-"+(16+u*2)+"px";l.style.top="-8px";k.appendChild(l,true);f=-g-16-u;n=-h/2;break;case"south":var k=b(16+u,a,t);k.style.left=g/2-(16+u)/2+"px";k.style.top=h-u+"px";var l=b(16,d,t);l.style.left="-8px";l.style.top="-"+(16+u*2)+"px";k.appendChild(l,true);f=-g/2;n=-h-16-u;break;case"west":default:var k=b(16+u,a,t);k.style.left="-"+(16+u)+"px";k.style.top=h/2-(16+u)/2+"px";var l=b(16,d,t);l.style.left=u*2+"px";l.style.top="-8px";k.appendChild(l,true);f=16+u;n=-h/2;break;}c.appendChild(k,true);return{element:c,left:f,top:n};};if("attachEvent" in window){window.attachEvent("onload",setupTooltips);}else{window.addEventListener("load",setupTooltips,false);}
