
function getWidth(){var winWidth=800;var d=document;if(typeof window.innerWidth!='undefined'){winWidth=window.innerWidth;}else{if(d.documentElement&&typeof d.documentElement.clientWidth!='undefined'&&d.documentElement.clientWidth!=0){winWidth=d.documentElement.clientWidth;}else{if(d.body&&typeof d.body.clientWidth!='undefined'){winWidth=d.body.clientWidth;}}}
return winWidth;}
var mapWidth=600;var mapHeight=800;function latToScale(lat,offset){return(-1*((lat-90)/180))*mapHeight-offset;}
function lonToScale(lon,offset){return(((lon+180)/360))*mapWidth-offset+mapWidth/2;}
function zoom(factor){var emap=document.getElementsByTagName('img');for(i=0;i<emap.length-2;i++)
{mapWidth=emap[i].offsetWidth;var diffWidth=mapWidth;mapWidth=Math.floor(mapWidth*factor);diffWidth-=mapWidth;mapHeight=emap[i].offsetHeight;var diffHeight=mapHeight;mapHeight=Math.floor(mapHeight*factor);diffHeight-=mapHeight;emap[i].style.width=mapWidth+'px';emap[i].style.height=mapHeight+'px';}
return false;}
function zoomOut(){zoom(1/1.2);}
function zoomIn(){zoom(1.2);}
function getDragParent(el){var oldEl=el;while(el){el=el.parentNode;if(el.id=="maptable"||el.nodeName.toUpperCase()=='BODY'){return oldEl;}
oldEl=el;}}
var offsetX,offsetY,draggingThing,scr;function nullFunc(e){return false;}
function moveDrag(e){e=e||event;offsetY=e.clientY;if(draggingThing){document.getElementById("book-area").scrollTop=scr-e.clientY;return true;}}
function endDrag(e){if(draggingThing)draggingThing.className='drag';draggingThing=null;document.body.onmousemove=null;document.body.onmouseend=null;document.onselectstart=null;}
function startDrag(e){draggingThing=getDragParent(e.srcElement||e.target);offsetY=e.clientY;document.onmousemove=moveDrag;document.onmouseup=endDrag;document.onselectstart=nullFunc;scr=document.getElementById("book-area").scrollTop+e.clientY;draggingThing.className='dragging';}
