var page=0, box=null, maxPage, Geo;var map;var cTO=Array();document.onmousemove=updateBox;function Init(){maxPage=getMaxPage();Update();}/* --- google maps --- */function Map(cont){if (GBrowserIsCompatible()){map=new GMap2(document.getElementById("cont1"));map.setMapType(G_SATELLITE_MAP );map.disableDragging();map.setCenter(new GLatLng(Geo[0].x, Geo[0].y), Geo[0].zoom);if(Geo.length>1){var d_t=40, d_a=0.00002, d_z=5; t=1000;var distance, angle, d_x, d_y;for(var i=1; i<Geo.length; i++){d_x=(Geo[i-1].x-Geo[i].x);d_y=(Geo[i-1].y-Geo[i].y);distance=Math.sqrt(Math.pow(d_x,2)+Math.pow(d_y,2));zoom=Geo[i].zoom-Geo[i-1].zoom;angle=Math.atan2(d_x,d_y)+Math.PI;steps=Math.ceil(distance/d_a);inter_z=zoom / steps;inter_x=d_a * Math.sin(angle);inter_y=d_a * Math.cos(angle);for(var n=0; n<steps; n++){cTO[cTO.length]=setTimeout("map.panTo(new GLatLng("+(Geo[i-1].x+n*inter_x)+","+(Geo[i-1].y+n*inter_y)+"));",t);t+=d_t;}cTO[cTO.length]=setTimeout("map.panTo(new GLatLng("+(Geo[i].x)+","+(Geo[i].y)+"));",t);}}}}function Clear(){for(var i=0; i<cTO.length; i++)clearTimeout(cTO[i]);}function Parse(el){var tmp;var steps=el.innerHTML.split(";");Geo=Array();for(var i=0; i<steps.length-1; ++i)if(steps.length>0)Geo[i]=new Element(steps[i].split(","));}function Element(ar){this.x=parseFloat(ar[0]);this.y=parseFloat(ar[1]);this.zoom=parseFloat(ar[2]);this.arrow=ar[3];}function Next(){page=page+2;if(page>maxPage) page=maxPage;Update();}function Prev(){page=page-2;if(page<0) page=0;Update();}function Update(){GUnload();Clear();var prev=document.getElementById("prev");var next=document.getElementById("next");var pl=document.getElementById("pl");var pr=document.getElementById("pr");var one=document.getElementById("p_"+page);var two=document.getElementById("p_"+(page+1)); document.getElementById("cont1").innerHTML="";document.getElementById("cont1").style.backgroundColor="";document.getElementById("cont2").innerHTML="";document.getElementById("arrow").style.display="none";if(one.title == "t"){document.getElementById("cont1").innerHTML=one.innerHTML;} else if(one.title == "m"){Parse(one);if(Geo[0].arrow != 'false')document.getElementById("arrow").style.display="block";Map(one);}if(two)if(two.title == "t"){document.getElementById("cont2").innerHTML=two.innerHTML;} else if(two.title == "m"){Parse(two);Map("cont1");}if(page>1){pl.innerHTML="- "+page+" -";pr.innerHTML="- "+(page+1)+" -";} else {pl.innerHTML="";pr.innerHTML="";}if(page<1){prev.onmouseover=null;prev.onclick=null;prev.style.cursor="default";prev.style.backgroundImage="";} else {prev.onmouseover=function (){ this.style.backgroundImage="url(images/prev.jpg)" };prev.onclick=function (){ Prev() };prev.onmouseout=function (){ this.style.backgroundImage=""; };prev.style.cursor="pointer";}if((page+1) >= maxPage){next.onmouseover=null;next.onclick=null;next.style.cursor="default";next.style.backgroundImage="";} else {next.onmouseover=function (){ this.style.backgroundImage="url(images/next.jpg)" };next.onclick=function (){ Next() };next.onmouseout=function (){ this.style.backgroundImage=""; };next.style.cursor="pointer";}}function getMaxPage(){var i=0;while(document.getElementById("p_"+i))i++;return --i;}function updateBox(e){    if(!e) e=window.event;    var body=(window.document.compatMode && window.document.compatMode == "CSS1Compat") ?    window.document.documentElement : window.document.body || null;        y=e.pageY ? e.pageY : e.clientY+body.scrollTop;    x=e.pageX ? e.pageX : e.clientX+body.scrollLeft; vert=screen.width;hori=screen.height;boxwidth=320;if (box != null){if((x+boxwidth+20)>vert)box.style.left=(x-20-boxwidth)+"px";else box.style.left=(x+20)+"px";if(y>380){box.style.top = (y-300)+"px";} else {box.style.top = (y+10)+"px";}}}function showBox(id){box=document.getElementById(id);box.style.display="block"}function hideBox(){box.style.display="none";}
