var PixelsRegex=/^-?(\d*)/;function stripPx(b){var a=PixelsRegex.exec(b);return parseInt(a[0],10)}var DigitsRegex=/([^\d]*)(\d*)([^\d]*)$/;function stripToId(b){var a=DigitsRegex.exec(b);return parseInt(a[2],10)}function adjustAreaCoords(f,g,e){var b=parseInt(g,10);var a=parseInt(e,10);if(isNaN(b)||isNaN(a)){alert("adjustAreaCoords: diff_x and diff_y have to be integers! Giving up...");return f}var h="";var d=f.split(",");for(var c=0;c<(d.length-1);c+=2){h+=","+(parseInt(d[c],10)+b)+","+(parseInt(d[c+1],10)+a)}return h.substr(1)}function VMap(e,b,f,i,g,c,h,a){this.p=e;this.ip="#"+e;this.cp="."+e;this.FrameId=this.ip+"Frame";this.StatusId=this.ip+"Status";this.SlitFrameId=this.ip+"SlitFrame";this.SlitId=this.ip+"Slit";this.DragSpacerId=this.ip+"DragSpacer";this.PopoverArrowId=this.ip+"PopoverArrow";this.PopoverContentId=this.ip+"PopoverContent";this.PopoverSiegelId=this.ip+"PopoverSiegel";this.NaviID=this.ip+"Navigation";this.ImageMapAreas=this.ip+"ImgMap area";this.frame=b;this.RpcBase=c;this.imgDir=h;this.VWidth=stripPx($(this.FrameId).css("width"));this.VHeight=stripPx($(this.FrameId).css("height"));this.sBlasen=[this.imgDir+"sprechblase-ol.png",this.imgDir+"sprechblase-om.png",this.imgDir+"sprechblase-or.png",this.imgDir+"sprechblase-ul.png",this.imgDir+"sprechblase-um.png",this.imgDir+"sprechblase-ur.png"];for(var d=0;d<this.sBlasen.length;++d){$("body").append('<img src="'+this.sBlasen[d]+'" alt="" border="0" style="position:absolute;top:-1000px;left:-1000px;" />')}this.HANDLER_NULL=0;this.HANDLER_GOTO_URL=1;this.HANDLER_ZOOM_IN_ITEM=2;this.HANDLER_ZOOM_OUT_ITEM=3;this.reset(f,i,g,a)}VMap.prototype.reset=function(e,j,h,a){var g=$(this.SlitId).offset();this.slitX=g.left;this.slitY=g.top;this.slitW=$(this.SlitId).width();this.slitH=$(this.SlitId).height();this.slitFrameX=stripPx($(this.SlitFrameId).css("left"));this.slitFrameY=stripPx($(this.SlitFrameId).css("top"));this.slitFrameW=$(this.SlitFrameId).width();this.slitFrameH=$(this.SlitFrameId).height();this.currentHighlight=null;this.popoverVisible=false;this.currentPopId=null;this.VXDiff=0;this.VYDiff=0;this.VCenter={x:0,y:0};this.DRAG_LOCK=false;this.DRAG_LOCK_SHORT=false;this.DRAG_RELEASE=null;this.POP_HIDE_TIME_OUT=null;this.POP_REPOS_TIME_OUT=null;this.NAV_HIDE_TIME_OUT=null;this.Z=j;this.Znext=h;this.Zprev=e;this.infoContentIndex=0;this.keepHL=null;this.ref_x=null;this.ref_y=null;this.TYPE="all";this.SpotFilters={};this.HANDLERS=a.handlers;var b=this;var d=this.p;if(null!=a){if(a.keep_highlight){this.showHighlight(a.keep_highlight);this.keepHL=a.keep_highlight;$(this.ip+"Highlight-"+this.keepHL).bind("mouseenter",function(){b.hideHighlight()})}if(a.ref_x){this.REF_X=a.ref_x}if(a.ref_y){this.REF_Y=a.ref_y}if(a.type){this.TYPE=a.type}if(a.spotFilters){this.SpotFilters=a.spotFilters}if(a.ebutton){this.ebutton=1}else{this.ebutton=0}if(a.bereich){this.bereich=a.bereich}else{this.bereich=0}}window.setTimeout(this.p+".normalizeHighlight();",250);if(0==this.Znext){$(this.ip+"ZoomInButton").hide()}else{$(this.ip+"ZoomInButton").show()}if(0==this.Zprev){$(this.ip+"ZoomOutButton").hide()}else{$(this.ip+"ZoomOutButton").show()}$(this.SlitFrameId+" *").data("theMap",b);$(this.ImageMapAreas).each(function(){var i=$(this).attr("href");var k=stripToId($(this).attr("id"));$(this).data("theMap",b);$(this).attr("href","javascript:"+d+".onHighlightClicked('"+k+"','"+$(this).attr("href")+"');");$(b.ip+"Highlight-"+k).data("mapHref",i)});$(this.SlitId).draggable({cursor:"move",containment:"parent",start:function(){b.hidePopover();b.DRAG_LOCK=true;b.DRAG_LOCK_SHORT=true;if(null!==map.DRAG_RELEASE){window.clearTimeout(map.DRAG_RELEASE);b.DRAG_RELEASE=null}},stop:function(){b.REF_X=null;b.REF_Y=null;b.DRAG_LOCK_SHORT=false;b.DRAG_RELEASE=window.setTimeout(function(){b.DRAG_LOCK=false},350);b.resetSlit()}});$(this.SlitId+" div"+this.cp+"Spot").each(function(){$(this).css("z-index","20");$(this).hover(function(){b.htmlHoverInfo($(this).attr("id"))},function(){b.startHidePopover()});$(this).data("pover",{status:"undone",html:""})});var f=[];$(this.cp+"Highlight").each(function(){f.push($(this).attr("src"))});for(var c=0;c<f.length;++c){(new Image()).src=f[c]}$(this.cp+"Highlight").css("z-index","19");$(this.SlitId).append('<div id="'+this.p+'PopoverContent" style="position:absolute;left:-2000px;top:-2000px;width:200px;padding:0px;margin:0px;z-index:95;text-align:left;vertical-align:middle;"></div>');$(this.SlitId).append('<div id="'+this.p+'PopoverArrow" style="position:absolute;left:-2000px;top:-2000px;padding:0px;margin:0px;z-index:90;"></div>');$(this.SlitId).append('<div id="'+this.p+'PopoverSiegel" style="position:absolute;left:-2000px;top:-2000px;padding:0px;margin:0px;z-index:99;"></div>');$(this.PopoverContentId).bind("mouseover",function(){b.stopHidePopover()});$(this.DragSpacerId).click(function(){b.hidePopover()});$(this.DragSpacerId).css("z-index","14");this.updateVisibleCoords()};VMap.prototype.updateVisibleCoords=function(){this.VXDiff=Math.abs(stripPx($(this.SlitId).css("left"))+stripPx($(this.SlitFrameId).css("left")));this.VYDiff=Math.abs(stripPx($(this.SlitId).css("top"))+stripPx($(this.SlitFrameId).css("top")));this.VCenter.x=Math.floor(0.5*this.VWidth)+this.VXDiff;this.VCenter.y=Math.floor(0.5*this.VHeight)+this.VYDiff};VMap.prototype.resetSlit=function(){this.updateVisibleCoords()};VMap.prototype.receiveImagesAndMaps=function(b){if("OK"==b.status){for(var a=0;a<b.spots.length;++a){$(this.SlitId).append('<div class="'+this.p+"Spot"+b.spots[a]["type"]+'" id="'+this.p+"Spot-"+b.spots[a].pID+'" style="position:absolute;left:'+b.spots[a].x+"px;top:"+b.spots[a].y+"px;width:"+b.spots[a].width+"px;height:"+b.spots[a].height+'px;padding:0px;margin:0px;z-index:20;" onmouseover="'+this.p+".htmlHoverInfo('"+this.p+"Spot-"+b.spots[a].pID+'\');" onmouseout="'+this.p+'.startHidePopover();"><img src="'+b.spots[a].image+'" width="'+b.spots[a].width+'" height="'+b.spots[a].height+'" alt="'+b.spots[a].name+'" border="0" /></div>')}this.updateVisibleCoords()}else{if("failed"==b.status){if(b.row&&-1!=b.row){if(this.CACHED.minY>=this.VYDiff){this.CACHED.minY=this.VYDiff}else{this.CACHED.maxRow=this.TY+this.ROWS-1}}if(b.column&&-1!=b.column){if(b.column<=this.TX){this.CACHED.minCol=this.TX}else{this.CACHED.maxCol=this.TX+this.COLS-1}}}}};VMap.prototype.showHighlight=function(a){if(!this.DRAG_LOCK_SHORT){if(a!=this.currentHighlight){this.hideHighlight()}$(this.ip+"Highlight-"+a).show();$(this.ip+"Highlight-"+a).css({zIndex:11});this.currentHighlight=a}};VMap.prototype.normalizeHighlight=function(){if(this.currentHighlight){$(this.ip+"Highlight-"+this.currentHighlight).css({zIndex:11})}};VMap.prototype.hideHighlight=function(){if(null!=this.currentHighlight&&this.currentHighlight!=this.keepHL){$(this.ip+"Highlight-"+this.currentHighlight).fadeOut("fast");this.currentHighlight=null}};VMap.prototype.onHighlightClicked=function(c,b){if(!this.DRAG_LOCK){if(this.popoverVisible){this.hidePopover()}else{if(this.HANDLERS.highlights&&this.HANDLERS.highlights["click"]){switch(this.HANDLERS.highlights["click"][0]){case this.HANDLER_GOTO_URL:if("0"!=this.Znext){this.Z=this.Znext}$(this.ip+"PostForm").append($("<input type='hidden' name='selectland' value='"+stripToId(c)+"' />"));$(this.ip+"PostForm").attr("action",b);$(this.ip+"PostForm").submit();break;case this.HANDLER_ZOOM_IN_ITEM:case this.HANDLER_ZOOM_OUT_ITEM:default:this.keepHL=null;var a=this;$.getJSON(this.RpcBase,{action:"regionClicked",rID:stripToId(c),frame:a.frame,z:this.Z,next_zoom:this.Znext,prev_zoom:this.Zprev,instance:this.p,tx:this.TX,ty:this.TY},function(d){a.receiveNewMap(d)});break}}}}};VMap.prototype.htmlHoverInfo=function(c){var g="#"+c;this.infoContentIndex=0;if($(g).data&&$(g).data("pover")&&"OK"==$(g).data("pover").status){this.showPopover(c,$(g).data("pover").html,$(g).data("siegel"))}else{var d=this;var a=0;if($.browser.msie){a=1}var l=stripPx($(g).css("left"));var k=stripPx($(g).css("top"));var n=stripPx($(g).width());var f=stripPx($(g).height());var o=(new Date()).getTime();var i=this.ebutton;var j=this.bereich;$.getJSON(this.RpcBase,{action:"mapSpotMouseOverInfo",x:l,y:k,w:n,h:f,instance:d.p,frame:d.frame,zoom:d.Z,which:c,fID:stripToId(c),time:o,ebutton:i,bereich:j},function(b){d.retrievePopover(b)})}};VMap.prototype.retrievePopover=function(a){if("OK"==a.status){this.infoContentIndex=0;if(1==a.cache||null==a.cache){$("#"+a.which).data("pover",{status:a.status,html:a.html})}this.showPopover(a.which,a.html,a.siegel)}};VMap.prototype.showPopover=function(i,c,e){if(!this.DRAG_LOCK){if(this.currentPopoversId!=i||!this.popoverVisible){var g="#"+i;var a=stripPx($(g).css("left"));var f=stripPx($(g).css("top"));var b=stripPx($(g).width());var d=stripPx($(g).height());if(a<this.VXDiff-9||a>this.VWidth+this.VXDiff+9||f<this.VYDiff-9||f>this.VYDiff+this.VHeight+9){this.hidePopover();return}$(this.PopoverArrowId).empty();this.hidePopover();$(this.PopoverContentId).html(c);this.repositionPopover(i,a,f,b,d,e)}this.currentPopoversId=i;this.status("")}};VMap.prototype.hidePopover=function(){if(null!=this.POP_HIDE_TIME_OUT){window.clearTimeout(this.POP_HIDE_TIME_OUT);this.POP_HIDE_TIME_OUT=null}if(null!=this.POP_REPOS_TIME_OUT){window.clearTimeout(this.POP_REPOS_TIME_OUT);this.POP_REPOS_TIME_OUT=null}$(this.PopoverContentId).css({position:"absolute",left:"-2000px",top:"-2000px",width:"",height:"",padding:"0px",margin:"0px","z-index":"95"});$(this.PopoverContentId).empty();$(this.PopoverArrowId).css({position:"absolute",left:"-2000px",top:"-2000px",padding:"0px",width:"30px",height:"30px",margin:"0px","z-index":"90"});$(this.PopoverSiegelId).css({position:"absolute",left:"-2000px",top:"-2000px",padding:"0px",width:"30px",height:"30px",margin:"0px","z-index":"99"});this.popoverVisible=false};VMap.prototype.startHidePopover=function(){if(null==this.POP_HIDE_TIME_OUT){var a=this;this.POP_HIDE_TIME_OUT=window.setTimeout(function(){a.hidePopover()},500)}};VMap.prototype.stopHidePopover=function(){var a=this;if(null!=this.POP_HIDE_TIME_OUT){window.clearTimeout(this.POP_HIDE_TIME_OUT);this.POP_HIDE_TIME_OUT=null}};VMap.prototype.repositionPopover=function(s,z,u,E,d,a){$(this.PopoverContentId).show();var F=this.VXDiff;var g=this.VYDiff;var C=F+this.VWidth;var c=g+this.VHeight;var p=Math.floor(z+(E/2));var o=parseInt(u);var A=parseInt(d);var q=parseInt(E);var B=10;var j=9;var G=j;var f=14;var D=p-Math.floor(j/2);var v=o-f;var H=this.sBlasen[1];var n=false;if(o<this.VCenter.y){n=true;v=o+A}var l=4+this.VXDiff;var k=C-4;var i=$(this.PopoverContentId).width();var r=$(this.PopoverContentId).height();var e=p-Math.floor(i/2);var b=o+A+f;if(e<l){G=B;D=p+Math.floor(B/2);e=l;if(n){H=this.sBlasen[0]}else{H=this.sBlasen[3]}}else{if(p+Math.floor(i/2)>=k){G=B;D=p-B;e=k-i;if(n){H=this.sBlasen[2]}else{H=this.sBlasen[5]}}else{if(n){H=this.sBlasen[1]}else{H=this.sBlasen[4]}}}$(this.PopoverArrowId).html('<img src="'+H+'" width="'+G+'" height="'+f+'" alt="" border="0" style="border-style:none;padding:0px;margin:0px;" />');$(this.PopoverArrowId).css({left:D+"px",top:v+"px",width:G+"px",height:f+"px"});if(n){b=o+A+f}else{b=o-($(this.PopoverContentId).height()+f)}$(this.PopoverContentId).css({left:e+"px",top:+b+"px"});$(this.PopoverContentId).mouseout(function(){t.startHidePopover()});$(this.PopoverContentId).mouseover(function(){t.stopHidePopover()});var t=this;$(this.PopoverArrowId+" img").each(function(){if($.browser.msie&&(document.body.filters)){var m="display:inline-block;";var h='<span style="display:inline-block;position:relative;margin-left:'+$(this).css("left")+"px;width:"+$(this).width()+"px; height:"+$(this).height()+"px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+this.src+"', sizingMethod='scale'); \"></span>";this.outerHTML=h}$(this).mouseout(function(){t.startHidePopover()});$(this).mouseover(function(){t.stopHidePopover()})});if(null!=this.POP_REPOS_TIME_OUT){window.clearTimeout(this.POP_REPOS_TIME_OUT);this.POP_REPOS_TIME_OUT=null}if(a){a.y=b-40;if(60>e-this.VXDiff){a.x=e+i-60}else{a.x=e-50}$("#"+s).data("siegel",a);this.showSiegel(a)}this.popoverVisible=true};VMap.prototype.showSiegel=function(b){if(b){var a=this;$(this.PopoverSiegelId).html(b.icon);$(this.PopoverSiegelId+" img").each(function(){$(this).mouseout(function(){a.startHidePopover()});$(this).mouseover(function(){a.stopHidePopover()});if($.browser.msie&&(document.body.filters)){var d="display:inline-block;";var c='<span style="display:inline-block;position:relative;width:'+b.w+"px; height:"+b.h+"px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+$(this).attr("src")+"', sizingMethod='scale'); \"></span>";this.outerHTML=c}});$(this.PopoverSiegelId).css({position:"absolute",left:b.x+"px",top:b.y+"px",width:b.w+"px",height:b.h+"px","z-index":"99"});$(this.PopoverSiegelId).show()}};VMap.prototype.zoomIn=function(a,c,b){if(this.Znext){this.zoom(a,c,this.Znext)}};VMap.prototype.zoomOut=function(a,c,b){if(this.Zprev){this.zoom(a,c,this.Zprev)}};VMap.prototype.zoom=function(b,e,d,c){if(null!=this.REF_X&&null!=this.REF_Y){b=this.REF_X;e=this.REF_Y}else{if(null==b){b=this.VCenter.x}if(null==e){e=this.VCenter.y}}if(d<this.Z){b=b>>1;e=e>>1}else{b=b<<1;e=e<<1}var a=this;jQuery.getJSON(this.RpcBase+"?action=newMap&instance="+this.p+"&zoom="+d+"&frame="+this.frame+"&x="+b+"&y="+e+"&type="+this.TYPE,function(f){a.receiveNewMap(f)})};VMap.prototype.receiveNewMap=function(a){if("OK"==a.status){$(this.ip+"Frame").html(a.html);this.reset(a.tx1,a.ty1,a.tx2,a.ty2,a.prev_zoom,a.current_zoom,a.next_zoom,a.opts)}};VMap.prototype.gotoURL=function(a){top.document.location.href=a};VMap.prototype.filterSpots=function(a){$("."+this.p+"Spot").each(function(){if("all"==a||$(this).hasClass(a)){$(this).show();$(this).css("z-index","19")}else{$(this).hide()}});this.TYPE=a;this.hideNavigation();if(5!=this.Z){this.zoom(this.VCenter.x,this.VCenter.y,5)}};VMap.prototype.infoContentShowIndex=function(a){if(this.infoContentIndex!=a){$(".InfoJourney").eq(this.infoContentIndex).hide();this.infoContentIndex=a;$(".InfoJourney").eq(this.infoContentIndex).show();if(a==this.infoContentIndex){$("#InfoContentDownButton").hide()}else{$("#InfoContentDownButton").show()}if(0==this.infoContentIndex){$("#InfoContentUpButton").hide()}else{$("#InfoContentUpButton").show()}$(".InfoButtonActive").addClass("InfoButton");$(".InfoButtonActive").removeClass("InfoButtonActive");$(".InfoButton").eq(this.infoContentIndex).addClass("InfoButtonActive")}};VMap.prototype.infoContentNext=function(a){if(this.infoContentIndex<a){$(".InfoJourney").eq(this.infoContentIndex).hide();this.infoContentIndex++;$(".InfoJourney").eq(this.infoContentIndex).show();if(a==this.infoContentIndex){$("#InfoContentDownButton").hide()}else{$("#InfoContentDownButton").show()}$("#InfoContentUpButton").show();$(".InfoButtonActive").addClass("InfoButton");$(".InfoButtonActive").removeClass("InfoButtonActive");$(".InfoButton").eq(this.infoContentIndex).addClass("InfoButtonActive")}};VMap.prototype.infoContentPrevious=function(){if(this.infoContentIndex>0){$(".InfoJourney").eq(this.infoContentIndex).hide();this.infoContentIndex--;$(".InfoJourney").eq(this.infoContentIndex).show();if(0==this.infoContentIndex){$("#InfoContentUpButton").hide()}else{$("#InfoContentUpButton").show()}$("#InfoContentDownButton").show();$(".InfoButtonActive").addClass("InfoButton");$(".InfoButtonActive").removeClass("InfoButtonActive");$(".InfoButton").eq(this.infoContentIndex).addClass("InfoButtonActive")}};VMap.prototype.status=function(a){if(this.popoverVisible){var c=$(this.PopoverContentId).offset();var b=$(this.StatusId).offset();if(c.top+$(this.PopoverContentId).height()>b.top){$(this.StatusId).html("")}else{$(this.StatusId).html(a)}}else{$(this.StatusId).html(a)}};
