if (!window.addEventListener){window.attachEvent('onload', function() {fixAnchorLinks();});}else{window.addEventListener('load', function() {fixAnchorLinks();}, false);}
/* anchors */
function fixAnchorLinks(){a=document.getElementById('content').getElementsByTagName('A');for(i=0;i<a.length;i++){ap=a[i].pathname;if(ap.substr(0,1)!=='/')ap='/'+ap;if(a[i].hash && ap==window.location.pathname){a[i].onclick=function(){return jumpTo(this.hash)};}}}function jumpTo(anchor){anchor=anchor.substr(1);step=parseInt(document.getElementById(anchor).offsetTop / 5);scrolltoAnchor(anchor,step);return false;}function scrolltoAnchor(anchor,step){document.getElementById('content').scrollTop+=step;if(document.getElementById('content').scrollTop+step > document.getElementById(anchor).offsetTop){document.getElementById(anchor).scrollIntoView();document.getElementById('content').scrollTop -=19;return;}setTimeout( function(){scrolltoAnchor(anchor,step);},1);}
/* tooltip */
var x_offset=15;var y_offset=15;var minwidth=80;var t_margin=20;var flex_width;var pop_enabled=false;var pop_minwidth;var pop_obj;var obj_alt;var elcurrent;function createPopup(){pop_obj=document.createElement('div');pop_obj.style.position='absolute';pop_obj.style.left='-9999px';pop_obj.style.zIndex='10';pop_obj.style.marginRight=t_margin+'px';pop_obj.style.zoom='1';document.body.appendChild(pop_obj);}function showPopup(el,content){if(!pop_obj)createPopup();if(elcurrent && elcurrent==el)return;elcurrent=el;flex_width=false;pop_obj.innerHTML=content;pop_obj.className='popup';initPopup(el);}function showTooltip(el,content){if(!pop_obj)createPopup();if(elcurrent && elcurrent==el)return;elcurrent=el;flex_width=true;if(el.title){el.alt=el.title; el.title='';}pop_obj.innerHTML=(content)? content: el.alt;obj_alt=el.alt; el.alt='';pop_obj.offsetWidth>minwidth? pop_minwidth=minwidth: pop_minwidth=pop_obj.offsetWidth;pop_obj.className='tooltip';s=el.onmousemove+'';if(s.length>10 && s.indexOf('movePopup')==-1)el.onmouseover=el.onmousemove;initPopup(el);}function initPopup(el){el.onmousemove=movePopup;el.onmouseout=function(){hidePopup()};el.onclick=function(){hidePopup()};pop_enabled=true;}function movePopup(e){if(pop_enabled){e=e || window.event;var x=e.clientX+x_offset;var y=e.clientY+y_offset;var x_cur=x;var y_cur=y;if(flex_width){if(x+pop_minwidth>document.documentElement.clientWidth-x_offset-t_margin){pop_obj.style.width=(pop_minwidth)+'px';x=document.documentElement.clientWidth - pop_minwidth-x_offset-t_margin;}else{pop_obj.style.width='auto';}}else{if(x+pop_obj.offsetWidth>document.documentElement.clientWidth)x=x-pop_obj.offsetWidth;}if(y+pop_obj.offsetHeight>document.documentElement.clientHeight)y=y-pop_obj.offsetHeight;if(x<x_cur && y<y_cur){y=(y_cur-y<y+pop_obj.offsetHeight-y_cur)? y_cur : y_cur-pop_obj.offsetHeight-2*y_offset;}pop_obj.style.left=x+'px';pop_obj.style.top=y+'px';}}function hidePopup(){pop_enabled=false;pop_obj.style.left="-9999px";pop_obj.style.width='auto';if(obj_alt){elcurrent.alt=obj_alt; obj_alt='';}elcurrent=null;}
/* img zoom */
function doZoom(img){if(img.className.indexOf('zoom-out')!==-1) {img.className=img.className.replace('zoom-out','zoom-in');}else{img.className=img.className.replace('zoom-in','zoom-out');}}
