ConvenoConst={APP:{APP_ID:0,PRI_LANG:1,NAME:2,NAME_SID:3,APP_LOGO_PATH:4,IS_ORTHOGRAPHIC:5,HFOV:6,VIEW_ID:7,VISIBILITY_BITS:8,USE_SKYBOX:9,BGCOLOR:10},CAT:{CAT_ID:0,PARENT_CAT_ID:1,NAME:2,NAME_SID:3,CONTENT:4,CONTENT_SID:5,ICON_PATH:6,IS_LEGEND:7,DISPLAY_ORDER:8},PMK:{PMK_ID:0,NAME:1,NAME_SID:2,CONTENT:3,CONTENT_SID:4,ICON_PATH:5,ICON_HOTSPOTX:6,ICON_HOTSPOTY:7,BLDG_BBL_ID:8,BLOCK_BBL_ID:9,LEVEL_BBL_ID:10,VISIBILITY_BITS:11,NODE_ID:12,VIEW_ID:13,LABEL_COLOR:14,MAX_LABEL_DIST:15,CAN_LOOKAROUND:16,
LOOKAROUND_Y_OFFSET:17,IS_DISABLED:18,IS_START_POINT:19},MAP_PMK_CAT:{PMK_ID:0,CAT_ID:1,DISPLAY_ORDER:2},BLDG:{NAME:0,NAME_SID:1,DISPLAY_ORDER:2},BLOCK:{NAME:0,NAME_SID:1,DISPLAY_ORDER:2},LEVEL:{NAME:0,NAME_SID:1,DISPLAY_ORDER:2},VIEW:{EYE_X:0,EYE_Y:1,EYE_Z:2,ORT_X:3,ORT_Y:4,ORT_Z:5,TARGET_DIST:6},NODE:{X:0,Y:1,Z:2,BLDG_BBL_ID:3,BLOCK_BBL_ID:4,LEVEL_BBL_ID:5,NODE_CLASS:6},EDGE:{START_NODE_ID:0,END_NODE_ID:1,DIRECTION:2,TO_WEIGHT:3,FROM_WEIGHT:4,EDGE_CLASS:5},SEG:{SEG_ID:0,VISIBILITY_BITS:1,START_NODE_ID:2,
END_NODE_ID:3,DIRECTION:4,TO_WEIGHT:5,FROM_WEIGHT:6,EDGE_CLASS:7},GUIDE:{SEG_ID:0,IS_ON_EDGE:1,CONTENT:2,CONTENT_SID:3,VIEW_ID:4,TRANSITION:5},EDGE_CLASS:{FLOOR:0,ESCALATOR:1,STAIRCASE:2,LIFT:3,RAMP:4,TRAVELLATOR:5},AVG_WALKING_SPEED:75.10272,POLL_INTERVAL:50,EYE_STABLE_PERIOD:250};
ConvenoCore=function(){function t(b,e,g){if(this instanceof arguments.callee){q=this;d=b;if(arguments.length==3){c=g.lang?g.lang:"en";i=g}else{c=e.lang?e.lang:"en";i=e}m=$(e.contentdiv);f=new EventObject;if(typeof d.cat=="undefined")d.cat={};if(typeof d.pmk=="undefined")d.pmk={};if(typeof d.view=="undefined")d.view={};if(typeof d.node=="undefined")d.node={};if(i.eventlog!=false)elog=EventLog.CreateConvenoHelper(this,g.via?g.via:"-");typeof window.OnConvenoLoaded=="function"&&window.OnConvenoLoaded(this)}else alert("Construct this object before use")}
var q=null,d=null,m=null,n={},f=null,c=null,j=null,i={},h=ConvenoConst.CAT,l=ConvenoConst.PMK,o=ConvenoConst.MAP_PMK_CAT;t.prototype={SortByIndex:function(b,e,g){e.sort(function(r,u){r=b[r][g];u=b[u][g];if(r<u)return-1;else if(u<r)return 1;return 0})},GetData:function(){return d},AddPage:function(b){if(b instanceof ConvenoPage)n[b.name]=b},GetPage:function(b){return n[b]},SetContentHtml:function(b){m.html(b)},GetLanguage:function(){return c},SetLanguage:function(b){var e=c;c=b;b!=e&&q.Emit("OnLanguageChanged",
b,e)},GetParam:function(b){return i[b]},SetParam:function(b,e){i[b]=e},GetContentObject:function(){return m},AddListener:function(b,e){f.attachEvent(b,e)},RemoveListener:function(b,e){f.detachEvent(b,e)},Emit:function(){return f.raiseEvent.apply(f,arguments)},Display:function(b,e,g){b||(b="/");q.Emit("OnPageRequest",b,e);b=n[b];if(typeof b!="undefined"){j=b;b.Execute(e,g)}},Refresh:function(){j&&j.Refresh()},LegendClicked:function(b){q.Emit("OnLegendClicked",b)},GetSubcategories:function(b){var e=
d.cat,g=[],r=0;for(var u in e)if(e[u][h.PARENT_CAT_ID]==b&&!e[u][h.IS_LEGEND])g[r++]=u;this.SortByIndex(e,g,h.DISPLAY_ORDER);b=[];for(u in g)b.push(e[g[u]]);return b},GetPlacemarks:function(b){var e=d.map_pmk_cat,g=[],r=0;for(var u in e)if(e[u][o.CAT_ID]==b)g[r++]=u;this.SortByIndex(e,g,o.DISPLAY_ORDER);b=[];for(u in g)(r=d.pmk[e[g[u]][o.PMK_ID]])&&b.push(r);return b},GetBuilding:function(b){if(d.bbl2)if(b=d.bbl2[b])return b._;return null},GetBlock:function(b,e){if(d.bbl2)if(d.bbl2[b])if(b=d.bbl2[b][e])return b._;
return null},GetLevel:function(b,e,g){if(d.bbl2)if(d.bbl2[b])if(d.bbl2[b][e])if(b=d.bbl2[b][e][g])return b;return null},GetPlacemarkByNodeId:function(b){var e=d.pmk;for(var g in e)if(e[g][l.NODE_ID]==b)return e[g];return null},GetPlacemarkById:function(b){return(b=d.pmk[b])?b:null},BeginLookaround:function(b){q.Emit("OnBeginLookaround",b)},EndLookaround:function(){q.Emit("OnEndLookaround")},GetString:function(b,e){if(b=d.str[b])return b[c]?b[c]:e;return e},GetBBLString:function(b,e){if(b=d.bblstr[b])return b[c]?
b[c]:e;return e},_:null};return t}();
ConvenoPage=function(){function t(n,f){if(arguments.length!=0)if(n instanceof ConvenoCore){this.core=n;this.name=f}else{alert("Please initialize with an instance of ConvenoCore");return null}}var q=ConvenoConst.APP,d=ConvenoConst.CAT,m={en:true,ms:true};t.prototype={core:null,name:null,lastparam:null,lastcaller:null,ToString:function(){return this.name},IsRomanized:function(n){return m[n]==true},PreparePage:function(){return true},UpdateDom:function(){},UpdateContent:function(){},SetCommonElements:function(n,
f){n=this.core.GetData();if(typeof f=="function"){this.BindClick(".Conveno_BtnBack",f);$(".Conveno_BtnBack").removeClass("hidden")}else $(".Conveno_BtnBack").addClass("hidden");var c=this;this.BindClick(".Conveno_BtnMain",function(){c.core.Display()});$(".Conveno_BtnMain").removeClass("hidden");this.SetHtmlIf(n.app[q.APP_LOGO_PATH],".Conveno_AppLogo",'<img src="'+n.app[q.APP_LOGO_PATH]+'" border=0>');f=$(".Conveno_Legend");if(!f.hasClass("done")){var j=f.find("ul");for(var i in n.cat){var h=n.cat[i];
if(h[d.IS_LEGEND]){var l="<li>";l+='<input class="Conveno_CbLegend" type="checkbox">';l+='<a href="javascript:void(0);">';if(h[d.ICON_PATH]){l+='<span class="Conveno_Icon">';l+='<img src="'+h[d.ICON_PATH]+'" border=0>';l+="</span>"}l+='<span class="Conveno_Name">';l+=c.core.GetString(h[d.NAME_SID],h[d.NAME]);l+="</span>";l+="</a></li>";l=$(l);var o=l.find(".Conveno_CbLegend");l.find("a").click(function(b,e){return function(){var g=!b.attr("checked");b.attr("checked",g);c.core.LegendClicked({cat_id:e,
show:g})}}(o,h[d.CAT_ID]));o.click(function(b){return function(){c.core.LegendClicked({cat_id:b,show:this.checked})}}(h[d.CAT_ID]));l.appendTo(j)}}f.addClass("done")}i=c.core.GetLanguage();c.IsRomanized(i)?$(".Conveno_BtnName").removeClass("hidden"):$(".Conveno_BtnName").addClass("hidden")},Refresh:function(){this.Execute(this.lastparam,this.lastcaller,true)},Execute:function(n,f,c){if(!this.PreparePage(n))return this.core.Display();this.lastparam=n;this.lastcaller=f;n&&this.core.Emit("OnPageBegin",
this.name,n);var j=this.core.GetContentObject(),i=this.name;if(i=="/")i="ConvenoApp";var h=j.attr("class");j.removeClass(h);j.addClass(i);this.UpdateDom(n,f);this.SetCommonElements(n,f);this.UpdateContent(n,f);c||this.core.Emit("OnContentUpdated",this.name,n);this.core.Emit("OnPageReady",this.name,n)},SetHtmlIf:function(n,f,c){if(f=$(f))if(n){f.html(c);f.removeClass("hidden")}else f.addClass("hidden")},BindClick:function(n,f){n=typeof n=="string"?$(n):n;n.unbind("click");typeof f=="function"&&n.bind("click",
f)},_:null};return t}();function ConvenoApp(t){ConvenoPage.call(this,t,"/")}ConvenoApp.prototype=new ConvenoPage;ConvenoApp.prototype.Execute=function(){this.core.Display("ConvenoCategory",{cat_id:null})};
ConvenoCategory=function(){function t(f){ConvenoPage.call(this,f,"ConvenoCategory");q=this;d=f}var q,d,m=ConvenoConst.CAT,n=ConvenoConst.PMK;t.prototype=new ConvenoPage;t.prototype.PreparePage=function(f){var c=d.GetData(),j=f.cat_id;c=c.cat;var i;if(c[j])i=j;else for(var h in c)if(j==null&&c[h][m.PARENT_CAT_ID]==null){i=h;break}if(!i)return false;f.cat_id=i;return true};t.prototype.UpdateDom=function(f){d.SetContentHtml('<div class="Conveno_Title">\t<span class="Conveno_Icon"></span>\t<span class="Conveno_Name"></span></div><div class="Conveno_Description"></div><div class="Conveno_CategoryList"></div><div class="Conveno_PlacemarkList"></div>');
d.GetContentObject().addClass("cat_id-"+f.cat_id)};t.prototype.UpdateContent=function(f,c){var j=d.GetData(),i=d.GetContentObject(),h=j.cat,l=f.cat_id,o=function(r,u){return function(){d.Display(q.name,r,u)}}(f,c);q.SetHtmlIf(h[l][m.ICON_PATH],$(".Conveno_Icon").get(0),'<img src="'+h[l][m.ICON_PATH]+'" border=0>');j=d.GetString(h[l][m.NAME_SID],h[l][m.NAME]);q.SetHtmlIf(j,i.find(".Conveno_Name"),j);j=d.GetString(h[l][m.CONTENT_SID],h[l][m.CONTENT]);q.SetHtmlIf(j,i.find(".Conveno_Description"),j);
j=d.GetSubcategories(f.cat_id);if(!j||j.length==0)$(".Conveno_CategoryList").addClass("hidden");else{var b=$("<ul></ul>");for(var e in j){var g='<li><a href="javascript:void(0);">';if(j[e][m.ICON_PATH]){g+='<span class="Conveno_Icon">';g+='<img src="'+j[e][m.ICON_PATH]+'" border=0>';g+="</span>"}g+='<span class="Conveno_Name">';g+=d.GetString(j[e][m.NAME_SID],j[e][m.NAME]);g+="</span>";g+="</a></li>";g=$(g);g.find("a").click(function(r){return function(){d.Display("ConvenoCategory",{cat_id:r},o)}}(j[e][m.CAT_ID]));
g.appendTo(b)}i.find(".Conveno_CategoryList").append(b)}j=d.GetPlacemarks(f.cat_id);if(!j||j.length==0)$(".Conveno_PlacemarkList").addClass("hidden");else{b=$("<ul></ul>");for(e in j){g='<li><a href="javascript:void(0);">';if(j[e][n.ICON_PATH]){g+='<span class="Conveno_Icon">';g+='<img src="'+j[e][n.ICON_PATH]+'" border=0>';g+="</span>"}g+='<span class="Conveno_Name">';g+=d.GetString(j[e][n.NAME_SID],j[e][n.NAME]);g+="</span>";g+="</a></li>";g=$(g);g.find("a").click(function(r){return function(){d.Display("ConvenoPlacemark",
{pmk_id:r,cat_id:l},o)}}(j[e][n.PMK_ID]));g.appendTo(b)}i.find(".Conveno_PlacemarkList").empty().append(b)}if(!c&&h[l][m.PARENT_CAT_ID]!=null){q.BindClick(".Conveno_BtnBack",function(){d.Display("ConvenoCategory",{cat_id:h[l][m.PARENT_CAT_ID]})});$(".Conveno_BtnBack").removeClass("hidden")}};return t}();
ConvenoPlacemark=function(){function t(i){ConvenoPage.call(this,i,"ConvenoPlacemark");q=this;d=i}var q,d,m=ConvenoConst.PMK,n=ConvenoConst.BLDG,f=ConvenoConst.BLOCK,c=ConvenoConst.LEVEL,j=ConvenoConst.SEG;t.prototype=new ConvenoPage;t.prototype.PreparePage=function(i){if(d.GetData().pmk[i.pmk_id])return true;return false};t.prototype.UpdateDom=function(i){d.SetContentHtml('<div class="Conveno_BBL"><span class="Conveno_Building"></span><span class="Conveno_Block"></span><span class="Conveno_Level"></span></div><div class="Conveno_Title">\t<span class="Conveno_Icon"></span>\t<span class="Conveno_Name"></span></div><button class="Conveno_BtnLookaroundStart">Lookaround</button><div class="Conveno_Description"></div><div class="Conveno_GettingHere"><div class="Conveno_Text">How do I get here from:</div></div>');
d.GetContentObject().addClass("pmk_id-"+i.pmk_id)};t.prototype.UpdateContent=function(i,h){var l=d.GetData(),o=d.GetContentObject(),b=l.pmk[i.pmk_id],e=function(z,E){return function(){d.Display(q.name,z,E)}}(i,h);q.SetHtmlIf(b[m.ICON_PATH],$(".Conveno_Icon").get(0),'<img src="'+b[m.ICON_PATH]+'" border=0>');var g=d.GetString(b[m.NAME_SID],b[m.NAME]);q.SetHtmlIf(g,o.find(".Conveno_Name"),g);g=d.GetString(b[m.CONTENT_SID],b[m.CONTENT]);q.SetHtmlIf(g,o.find(".Conveno_Description"),g);g=d.GetBuilding(b[m.BLDG_BBL_ID]);
var r=d.GetBlock(b[m.BLDG_BBL_ID],b[m.BLOCK_BBL_ID]),u=d.GetLevel(b[m.BLDG_BBL_ID],b[m.BLOCK_BBL_ID],b[m.LEVEL_BBL_ID]);g?q.SetHtmlIf(true,o.find(".Conveno_Building"),d.GetBBLString(g[n.NAME_SID],g[n.NAME])):o.find(".Conveno_Building").addClass("hidden");r?q.SetHtmlIf(true,o.find(".Conveno_Block"),d.GetBBLString(r[f.NAME_SID],r[f.NAME])):o.find(".Conveno_Block").addClass("hidden");u?q.SetHtmlIf(true,o.find(".Conveno_Level"),d.GetBBLString(u[c.NAME_SID],u[c.NAME])):o.find(".Conveno_Level").addClass("hidden");
!g&&!r&&!u&&$(".Conveno_BBL").addClass("hidden");rows=l.path;l=[];for(var A in rows)rows[A].dst_pmk_id==i.pmk_id&&rows[A].segment&&l.push({index:A,row:rows[A]});if(l.length==0)o.find(".Conveno_GettingHere").addClass("hidden");else{g=$("<ul></ul>");for(A in l)if(r=d.GetPlacemarkByNodeId(l[A].row.segment[0][j.START_NODE_ID])){u='<li><a href="javascript:void(0);">';u+='<span class="Conveno_StartLocation">';u+=d.GetString(r[m.NAME_SID],r[m.NAME]);u+="</span>";u+="</a></li>";r=$(u);r.find("a").click(function(z){return function(){d.Display("ConvenoPath",
{path_index:z,cat_id:i.cat_id},e)}}(l[A].index));r.appendTo(g)}o.find(".Conveno_GettingHere").append(g)}if((b[m.CAN_LOOKAROUND]==null||b[m.CAN_LOOKAROUND]==true)&&b[m.LEVEL_BBL_ID]!=null){o=$(".Conveno_BtnLookaroundStart");o.click(function(){d.BeginLookaround(i.pmk_id)});o=$(".Conveno_BtnLookaroundStop");o.click(function(){d.EndLookaround()})}else $(".Conveno_BtnLookaroundStart").addClass("hidden");if(!h&&i.cat_id){q.BindClick(".Conveno_BtnBack",function(){d.Display("ConvenoCategory",{cat_id:i.cat_id})});
$(".Conveno_BtnBack").removeClass("hidden")}};return t}();
ConvenoPath=function(){function t(f){ConvenoPage.call(this,f,"ConvenoPath");q=this;d=f}var q,d,m=ConvenoConst.PMK,n=ConvenoConst.SEG;t.prototype=new ConvenoPage;t.prototype.PreparePage=function(f){var c=d.GetData();f=f.path_index;if(!(f<c.path.length))return false;if(!c.path[f].segment)return false;return true};t.prototype.UpdateDom=function(f){d.SetContentHtml('<div class="Conveno_FromTo">From</div><div class="Conveno_Source"></div><div class="Conveno_FromTo">To</div><div class="Conveno_Destination"></div><div class="Conveno_PathInfo">\t<div><span class="Conveno_Text">Walking distance</span><span class="Conveno_WalkingDist"></span><span class="Conveno_Unit">m</span></div>\t<div><span class="Conveno_Text">Walking time</span><span class="Conveno_WalkingTime"></span><span class="Conveno_Unit">mins</span></div></div><div class="Conveno_PathAction">\t<button class="Conveno_BtnExpand">Expand</button>\t<button class="Conveno_BtnGuideMe">Guide Me</button></div>');d.GetContentObject().addClass("path_index-"+
f.path_index)};t.prototype.UpdateContent=function(f,c){var j=function(r,u){return function(){d.Display(q.name,r,u)}}(f,c),i=d.GetData(),h=d.GetContentObject(),l=f.path_index;i=i.path[l];var o=d.GetPlacemarkById(i.dst_pmk_id);if(!o){d.Display();return false}var b=i.segment[0][n.START_NODE_ID],e=i.estdist,g=i.esttime;e+=0.5;g+=0.5;q.SetHtmlIf(true,h.find(".Conveno_WalkingDist"),e.toFixed(0));q.SetHtmlIf(true,h.find(".Conveno_WalkingTime"),g.toFixed(0));b=d.GetPlacemarkByNodeId(b);if(!b){d.Display();
return false}e=d.GetString(b[m.NAME_SID],b[m.NAME]);q.SetHtmlIf(b,h.find(".Conveno_Source"),e);b=d.GetString(o[m.NAME_SID],o[m.NAME]);q.SetHtmlIf(true,h.find(".Conveno_Destination"),b);q.BindClick(h.find(".Conveno_BtnExpand"),function(){d.Display("ConvenoPlacemark",{pmk_id:o[m.PMK_ID],cat_id:f.cat_id,glide:false})});i.guide&&i.guide.length>0?q.BindClick(h.find(".Conveno_BtnGuideMe"),function(){d.Display("ConvenoGuide",{path_index:l,guide_index:0,cat_id:f.cat_id},j)}):h.find(".Conveno_BtnGuideMe").addClass("hidden");
if(!c){q.BindClick(".Conveno_BtnBack",function(){d.Display("ConvenoPlacemark",{pmk_id:o[m.PMK_ID],cat_id:f.cat_id})});$(".Conveno_BtnBack").removeClass("hidden")}};return t}();
ConvenoGuide=function(){function t(n){ConvenoPage.call(this,n,"ConvenoGuide");q=this;d=n}var q,d,m=ConvenoConst.GUIDE;t.prototype=new ConvenoPage;t.prototype.PreparePage=function(n){var f=d.GetData();n=n.path_index;if(!(n<f.path.length))return false;if(!f.path[n].guide)return false;return true};t.prototype.UpdateDom=function(n){d.SetContentHtml('<div class="Conveno_GuideText"></div><div class="Conveno_GuideAction">\t<span class="Conveno_GuideCount"></span>\t<button class="Conveno_BtnGuidePrev">Prev</button>\t<button class="Conveno_BtnGuideNext">Next</button>\t<button class="Conveno_BtnGuideEnd">End</button></div>');d.GetContentObject().addClass("path_index-"+
n.path_index)};t.prototype.UpdateContent=function(n,f){var c=d.GetData(),j=d.GetContentObject(),i=n.path_index,h=n.guide_index?n.guide_index:0,l=c.path[i];if(!l)return false;c=l.guide[h];if(!c)return false;c=d.GetString(c[m.CONTENT_SID],c[m.CONTENT]);q.SetHtmlIf(c,j.find(".Conveno_GuideText"),c);c=h+1+"/"+l.guide.length;j.find(".Conveno_GuideCount").text(c);c=j.find(".Conveno_BtnGuidePrev");var o=j.find(".Conveno_BtnGuideNext");j=j.find(".Conveno_BtnGuideEnd");h==0?c.addClass("hidden"):q.BindClick(c,
function(){d.Display("ConvenoGuide",{path_index:i,guide_index:h-1,cat_id:n.cat_id})});if(h<l.guide.length-1){q.BindClick(o,function(){d.Display("ConvenoGuide",{path_index:i,guide_index:h+1,cat_id:n.cat_id})});j.addClass("hidden")}else{o.addClass("hidden");q.BindClick(j,function(){d.Display("ConvenoPlacemark",{pmk_id:l.dst_pmk_id,cat_id:n.cat_id})})}if(!f){this.BindClick(".Conveno_BtnBack",function(){d.Display("ConvenoPath",{path_index:i,cat_id:n.cat_id})});$(".Conveno_BtnBack").removeClass("hidden")}};
return t}();
DottedPath=function(){function t(c,j,i,h){q=this;d=c;m=[];n=0;this.iconPath=j;this.hotspotx=i;this.hotspoty=h}var q,d,m,n,f;t.prototype={iconPath:null,hotspotx:null,hotspoty:null,isHidden:false,vertices:null,Clear:function(){q.vertices=null;q.Hide();n=0},Make:function(c){if(c){if(q.vertices!==c)q.vertices=c;f||(f=d.CreateIconStyle(q.iconPath?d.CreateImage(q.iconPath):null,q.hotspotx?q.hotspotx:"50%",q.hotspoty?q.hotspoty:"100%"));var j=d.GetEye(),i=j.GetPosition();j=j.GetHorizontalFieldOfView()/2;
j=d.GetWidth()/2/Math.tan(j);var h=0,l=0,o=0;for(var b in c){var e=c[b],g=new Vec3(e.x1,e.y1,e.z1),r=new Vec3(e.x2,e.y2,e.z2);e=r.Minus(g);var u=e.Length();e.Normalize();r=20*g.Plus(r).Scale(0.5).Minus(i).Length()/j;if(b==0)h+=r;for(;h<u;){var A=g.Plus(e.Scale(h)),z;if(l<m.length){z=m[l++];q.isHidden||z.Show()}else{z=d.CreatePlacemark("","");z.GetStyleSet().SetGeometryStyle(f);z.SetInteractivity(false);d.AddPlacemark(z);q.isHidden&&z.Hide();m.push(z);l++;o++}z.GetGeometry().SetPosition(A.x,A.y,A.z);
h+=r}h-=u}for(b=l;b<n;b++)m[b].Hide();n=l}},Refresh:function(){!q.isHidden&&q.vertices&&q.Make(q.vertices)},Show:function(){if(q.isHidden!=false){q.isHidden=false;for(var c=0;c<n;c++)m[c].Show()}},Hide:function(){if(q.isHidden!=true){q.isHidden=true;for(var c=0;c<n;c++)m[c].Hide()}}};return t}();
LinePath=function(){function t(i,h,l){var o=h.Scale(0.5).Plus(l),b=(new Vec3(0,1,0)).Cross(h);h=b.Scale(0.3).Plus(l);l=b.Scale(-0.3).Plus(l);i.AppendVertex(h.x,h.y,h.z);i.AppendVertex(o.x,o.y,o.z);i.AppendVertex(l.x,l.y,l.z)}function q(i,h){var l=h&&h.color?h.color:"000000";h=h&&h.showarrow?h.showarrow:false;d=this;m=i;$arrgpmk=[];n=[];f=m.CreateLineStyle(m.CreateColor(l),Germanium.GeometryStyle.LinePattern.Dashed2,null,6,Germanium.LineStyle.Animation.Forward);c=h;j=m.CreateLineStyle(m.CreateColor(l),
Germanium.GeometryStyle.LinePattern.Solid,null,4)}var d,m,n,f,c,j;q.prototype={Clear:function(){for(var i in $arrgpmk)m.RemovePlacemark($arrgpmk[i]);$arrgpmk=[];n=[];d.path_index=null},Make:function(i){var h,l,o,b,e;for(var g in i){var r=i[g];if(!(h==r.x1&&l==r.y1&&o==r.z1)){e=m.CreateLineStringGeometry();n.push(e);l=m.CreatePlacemark("",null,e);l.GetStyleSet().SetGeometryStyle(f);l.SetInteractivity(false);$arrgpmk.push(l);m.AddPlacemark(l);l.Show();h=r.x1;l=r.y1;o=r.z1;b=m.CreateVector3(h,l,o);e.AppendVertex(b)}b=
m.CreateVector3(r.x2,r.y2,r.z2);e.AppendVertex(b);if(c&&r.type!=ConvenoConst.EDGE_CLASS.LIFT){l=new Vec3(h,l,o);o=new Vec3(r.x2,r.y2,r.z2);h=o.Minus(l);if(h.Length()>3){h.Normalize();o=l.Plus(o).Scale(0.5);l=m.CreatePlacemark();l.HideLabel();b=m.CreateLineStringGeometry();l.SetGeometry(b);l.GetStyleSet().SetGeometryStyle(j);l.SetInteractivity(false);t(b,h,o);m.AddPlacemark(l);$arrgpmk.push(l)}}h=r.x2;l=r.y2;o=r.z2}},Show:function(){for(var i in $arrgpmk)$arrgpmk[i].Show()},Hide:function(){for(var i in $arrgpmk)$arrgpmk[i].Hide()}};
return q}();
ConvenoLevelSelect=function(){function t(l){ConvenoPage.call(this,l,"ConvenoLevelSelect");q=this;d=l}var q,d,m,n=0,f=ConvenoConst.CAT,c=ConvenoConst.PMK,j=ConvenoConst.BLOCK,i=ConvenoConst.LEVEL,h=ConvenoConst.MAP_PMK_CAT;t.prototype=new ConvenoPage;t.prototype.PreparePage=function(){if(m==undefined){var l=d.GetData(),o={};for(var b in l.map_pmk_cat){var e=l.map_pmk_cat[b],g=e[h.PMK_ID];e=e[h.CAT_ID];var r=o[g];if(!r){r={};o[g]=r}if(r=l.cat[e])o[g][e]=r[f.IS_LEGEND]}m={};for(b in l.pmk){r=l.pmk[b];
var u=r[c.BLDG_BBL_ID],A=r[c.BLOCK_BBL_ID],z=r[c.LEVEL_BBL_ID];g=r[c.PMK_ID];var E=true;for(e in o[g])if(o[g][e]==0){E=false;break}if(!E)if(z)if(d.GetLevel(u,A,z)!=null){u=u+"/"+A;g=m[u];if(!g){g={};m[u]=g;n++}u=g[z];if(!u){u=[];g[z]=u}u.push(r)}}}return true};t.prototype.UpdateDom=function(){d.SetContentHtml('<div class="Conveno_Title">\t<span class="Conveno_Icon"></span>\t<span class="Conveno_Name"></span></div><div class="Conveno_GroupList"></div>')};t.prototype.UpdateContent=function(l,o){var b=
function(a,k){return function(){d.Display(q.name,a,k)}}(l,o);d.GetData();for(var e in m){var g='<div class="Conveno_BlockGroup"><div class="Conveno_Title"><span class="Conveno_Icon"></span><span class="Conveno_Name"></span></div></div>';l=$(g);o=$("<ul></ul>");l.append(o);var r=m[e],u=e.match(/(.+)\/(.*)/),A=u[1];u=u[2];var z=[],E=[];g=0;for(var G in r){z[g]=G;var D=d.GetLevel(A,u,G);E[G]=D[i.DISPLAY_ORDER];g++}z.sort(function(a,k){return E[k]-E[a]});for(var J in z){G=z[J];g=d.GetBlock(A,u);n!=1?
l.find(".Conveno_Name").text(d.GetBBLString(g[j.NAME_SID],g[j.NAME])):l.find(".Conveno_Title").addClass("hidden");if(D=d.GetLevel(A,u,G)){g='<li><a href="javascript:void(0);">'+d.GetBBLString(D[i.NAME_SID],D[i.NAME])+"</a></li>";g=$(g);D=function(a,k,s,p){return function(){d.Display("ConvenoByLevel",{building_id:a,block_id:k,level_id:s,arrpmk:p},b)}}(A,u,G,r[G]);g.find("a").click(D);g.appendTo(o)}}$(".Conveno_GroupList").append(l)}};return t}();
ConvenoByLevel=function(){function t(f){ConvenoPage.call(this,f,"ConvenoByLevel");q=this;d=f}var q,d,m=ConvenoConst.PMK,n=ConvenoConst.LEVEL;t.prototype=new ConvenoPage;t.prototype.PreparePage=function(){return true};t.prototype.UpdateDom=function(){d.SetContentHtml('<div class="Conveno_Title">\t<span class="Conveno_Name"></span></div><div class="Conveno_PlacemarkList"></div>')};t.prototype.UpdateContent=function(f,c){var j=function(e,g){return function(){d.Display(q.name,e,g)}}(f,c);d.GetData();
c=d.GetContentObject();var i=f.arrpmk;(f=d.GetLevel(f.building_id,f.block_id,f.level_id))&&c.find(".Conveno_Name").text(d.GetBBLString(f[n.NAME_SID],f[n.NAME]));f=[];var h=0;for(var l in i)f[h++]=l;d.SortByIndex(i,f,m.NAME);h=$("<ul></ul>");for(l in f){var o=i[f[l]],b='<li><a href="javascript:void(0);">';if(o[m.ICON_PATH]){b+='<span class="Conveno_Icon">';b+='<img src="'+o[m.ICON_PATH]+'" border=0>';b+="</span>"}b+='<span class="Conveno_Name">';b+=d.GetString(o[m.NAME_SID],o[m.NAME]);b+="</span>";
b+="</a></li>";b=$(b);b.find("a").click(function(e){return function(){d.Display("ConvenoPlacemark",{pmk_id:e},j)}}(o[m.PMK_ID]));b.appendTo(h)}c.find(".Conveno_PlacemarkList").append(h)};return t}();
ConvenoNameGroup=function(){function t(i,h){ConvenoPage.call(this,i,"ConvenoNameGroup");q=this;d=i;(n=h)||(n={"A to F":["a","f"],"G to L":["g","l"],"M to S":["m","s"],"T to Z":["t","z"]})}var q,d,m,n,f=ConvenoConst.CAT,c=ConvenoConst.PMK,j=ConvenoConst.MAP_PMK_CAT;t.prototype=new ConvenoPage;t.prototype.PreparePage=function(){var i=q.core.GetLanguage();if(!q.IsRomanized(i))return false;if(m==undefined){i=d.GetData();var h={};for(var l in i.map_pmk_cat){var o=i.map_pmk_cat[l],b=o[j.PMK_ID];o=o[j.CAT_ID];
var e=h[b];if(!e){e={};h[b]=e}if(e=i.cat[o])h[b][o]=e[f.IS_LEGEND]}m={};for(var g in n)m[g]=[];m.Others=[];for(l in i.pmk){e=i.pmk[l];var r=d.GetString(e[c.NAME_SID],e[c.NAME]);b=e[c.PMK_ID];var u=true;for(o in h[b])if(h[b][o]==0){u=false;break}if(!u){b=r.toLowerCase().charAt(0);r=false;for(g in n){u=n[g][1];if(b>=n[g][0]&&b<=u){m[g].push(e);r=true;break}}r||m.Others.push(e)}}}return true};t.prototype.UpdateDom=function(){d.SetContentHtml('<div class="Conveno_Title">\t<span class="Conveno_Icon"></span>\t<span class="Conveno_Name"></span></div><div class="Conveno_GroupList"></div>')};
t.prototype.UpdateContent=function(i,h){var l=function(e,g){return function(){d.Display(q.name,e,g)}}(i,h);d.GetData();i=d.GetContentObject();h=$("<ul></ul>");for(var o in m){var b=$('<li><a href="javascript:void(0);">'+o+"</a></li>");if(m[o].length==0){b.addClass("disabled");b.find("a").addClass("disabled")}else b.find("a").click(function(e,g){return function(){d.Display("ConvenoByName",{range:e,arrpmk:g},l)}}(o,m[o]));b.appendTo(h)}i.find(".Conveno_GroupList").append(h)};return t}();
ConvenoByName=function(){function t(n){ConvenoPage.call(this,n,"ConvenoByName");q=this;d=n}var q,d,m=ConvenoConst.PMK;t.prototype=new ConvenoPage;t.prototype.PreparePage=function(){var n=q.core.GetLanguage();if(!q.IsRomanized(n))return false;return true};t.prototype.UpdateDom=function(){d.SetContentHtml('<div class="Conveno_Title">\t<span class="Conveno_Icon"></span>\t<span class="Conveno_Name"></span></div><div class="Conveno_PlacemarkList"></div>')};t.prototype.UpdateContent=function(n,f){var c=
function(b,e){return function(){d.Display(q.name,b,e)}}(n,f);d.GetData();f=d.GetContentObject();n=n.arrpmk;var j=[],i=0;for(var h in n)j[i++]=h;d.SortByIndex(n,j,m.NAME);i=$("<ul></ul>");for(h in j){var l=n[j[h]],o='<li><a href="javascript:void(0);">';if(l[m.ICON_PATH]){o+='<span class="Conveno_Icon">';o+='<img src="'+l[m.ICON_PATH]+'" border=0>';o+="</span>"}o+='<span class="Conveno_Name">';o+=d.GetString(l[m.NAME_SID],l[m.NAME]);o+="</span>";o+="</a></li>";o=$(o);o.find("a").click(function(b){return function(){d.Display("ConvenoPlacemark",
{pmk_id:b},c)}}(l[m.PMK_ID]));o.appendTo(i)}f.find(".Conveno_PlacemarkList").append(i)};return t}();
ConvenoGerm=function(){function t(a){return j.CreateEyeParams(a[0],a[1],a[2],a[3],a[4],a[5],a[6])}function q(a,k){if(!a||!k)return false;var s=a.GetPosition();a=a.GetOrientation();var p=k.GetPosition();k=k.GetOrientation();return s.x==p.x&&s.y==p.y&&s.z==p.z&&a.x==k.x&&a.y==k.y&&a.z==k.z}function d(a){var k="",s,p,v,w,y,x=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");x<a.length;){s=z.indexOf(a.charAt(x++));p=z.indexOf(a.charAt(x++));w=z.indexOf(a.charAt(x++));y=z.indexOf(a.charAt(x++));s=s<<2|p>>4;
p=(p&15)<<4|w>>2;v=(w&3)<<6|y;k+=String.fromCharCode(s);if(w!=64)k+=String.fromCharCode(p);if(y!=64)k+=String.fromCharCode(v)}return k=m(k)}function m(a){for(var k="",s=0,p=c1=c2=0;s<a.length;){p=a.charCodeAt(s);if(p<128){k+=String.fromCharCode(p);s++}else if(p>191&&p<224){c2=a.charCodeAt(s+1);k+=String.fromCharCode((p&31)<<6|c2&63);s+=2}else{c2=a.charCodeAt(s+1);c3=a.charCodeAt(s+2);k+=String.fromCharCode((p&15)<<12|(c2&63)<<6|c3&63);s+=3}}return k}function n(){var a=h.pmk;this.map_id_gpmk={};if(j.CreateBalloonStyle){var k=
j.CreateBalloonStyle();k.SetCloseButtonVisibility(false);k.SetOutlineColor("cccccc")}for(var s in a){var p=a[s],v=h.node[p[e.NODE_ID]];if(v)try{var w=p[e.ICON_HOTSPOTX]?p[e.ICON_HOTSPOTX]:"50%",y=p[e.ICON_HOTSPOTY]?p[e.ICON_HOTSPOTY]:"100%",x=p[e.ICON_PATH],B=j.CreatePointGeometry(v[g.X],v[g.Y],v[g.Z]),F=i.GetString(p[e.NAME_SID],p[e.NAME]),C=j.CreatePlacemark(F,'<div class="ConvenoGerm_Wrapper"></div>',B),H=j.CreateIconStyle(x?j.CreateImage(x):null,w,y),I=C.GetStyleSet();I.SetGeometryStyle(H);if(p[e.LABEL_COLOR]){var L=
j.CreateLabelStyle(j.CreateColor(p[e.LABEL_COLOR]));I.SetLabelStyle(L)}var K=parseFloat(p[e.MAX_LABEL_DIST]);if(K>0){C.SetMaxViewDistance(K);C.SetMaxLabelViewDistance(K)}j.CreateBalloonStyle&&C.GetStyleSet().SetBalloonStyle(k);j.AddPlacemark(C);C.Hide();this.map_id_gpmk[s]=C;this.map_handle_pmk[C.GetHandle()]=a[s]}catch(M){}}}function f(a,k){c=this;i=a;j=k;h=a.GetData();this.map_id_gpmk={};this.map_handle_pmk={};this.map_cat_vis={};this.map_pmk_vis={};this.sameLevelVisibility=false}var c,j,i,h,l,
o=null,b=ConvenoConst.APP,e=ConvenoConst.PMK,g=ConvenoConst.NODE,r=ConvenoConst.SEG,u=ConvenoConst.GUIDE,A=ConvenoConst.MAP_PMK_CAT,z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";f.prototype.curpmk=null;f.prototype.visualpath=null;f.prototype.Initialize=function(a,k,s){l={ConvenoCategory:f.prototype.UpdateCategory,ConvenoPlacemark:f.prototype.UpdatePlacemark,ConvenoPath:f.prototype.UpdatePath,ConvenoGuide:f.prototype.UpdateGuide};i.AddListener("OnContentUpdated",function(w,
y){(w=l[w])&&w(y)});i.AddListener("OnPageRequest",function(w,y){w=="/"&&c.UpdateApp(y)});i.AddListener("OnLegendClicked",function(w){c.SetCategoryVisibility(w.cat_id,w.show);c.UpdatePlacemarksVisibility()});i.AddListener("OnBeginLookaround",function(){$(".Conveno_BtnLookaroundStop").removeClass("hidden");$(".Conveno_BtnLookaroundStart").addClass("hidden")});i.AddListener("OnLookaroundCancelled",function(){if(!$(".Conveno_BtnLookaroundStop").hasClass("hidden")){$(".Conveno_BtnLookaroundStop").addClass("hidden");
$(".Conveno_BtnLookaroundStart").removeClass("hidden")}});var p=j.GetEye();if(typeof a.backgroundcolor=="string"){var v=j.CreateColor(a.backgroundcolor);j.GetOptions().SetBackgroundColor(v)}typeof a.showgrid=="undefined"||a.showgrid==false?p.HideGrid():p.ShowGrid();typeof a.eyecontrol=="undefined"||parseInt(a.eyecontrol)==1?germ.GetOptions().SetEyeControlsVisible(true):germ.GetOptions().SetEyeControlsVisible(false);if(!h.dataset._)return s("No dataset defined");p="";if(a.origin)p=a.origin;p+=h.dataset._;
j.Load(p,null,function(){c.OnLoad(a,k);i.Emit("ConvenoGerm.Ready",c)},s)};f.prototype.UpdatePlacemarkLabel=function(){for(var a in c.map_id_gpmk){var k=a,s=h.pmk[k];c.map_id_gpmk[k].SetName(i.GetString(s[e.NAME_SID],s[e.NAME]))}};f.prototype.OnLoad=function(a,k){var s=j.GetEye();typeof a.showsky=="undefined"||a.showsky?j.GetOptions().SetUseSkybox(true):j.GetOptions().SetUseSkybox(false);h.app[ConvenoConst.APP.IS_ORTHOGRAPHIC]&&s.SetOrthographicProjection(true);h.app[ConvenoConst.APP.HFOV]&&s.SetHorizontalFieldOfView(h.app[ConvenoConst.APP.HFOV]*
Math.PI/180);n.apply(this);j.AddEventHandler(Germanium.Event.OnGlideCompleted,f.prototype.OnGlideCompleted);j.AddEventHandler(Germanium.Event.OnGlideCancelled,f.prototype.OnGlideCancelled);j.AddEventHandler(Germanium.Event.OnPlacemarkActivated,f.prototype.OnPlacemarkActivated);j.AddEventHandler(Germanium.Event.OnPlacemarkDeactivate,f.prototype.OnPlacemarkDeactivate);i.AddListener("OnPlacemarkClicked",f.prototype.OnPlacemarkClicked);i.AddListener("OnBeginLookaround",f.prototype.StartLookaround);i.AddListener("OnEndLookaround",
f.prototype.StopLookaround);i.AddListener("OnLanguageChanged",f.prototype.UpdatePlacemarkLabel);this.StartDetectCameraMovement();if(a.pathstyle=="line"&&Germanium.GetAPIVersion()>new Germanium.Version(1,3,0,0))c.visualpath=new LinePath(j,{color:a.linepathcolor?a.linepathcolor:"ff0000",showarrow:a.showarrow});else{c.visualpath=new DottedPath(j,a.dottedpathicon?a.dottedpathicon:"common/dot-red-outlined.png");j.AddEventHandler(Germanium.Event.OnGlideCompleted,function(){c.visualpath.Refresh()});i.AddListener("OnCameraStopped",
function(){c.visualpath.Refresh()})}typeof k=="function"&&k()};f.prototype.Deinitialize=function(){c.StopDetectCameraMovement()};f.prototype.StartDetectCameraMovement=function(){c.StopDetectCameraMovement();c.timer=setInterval(function(){c.PollCameraMovement()},ConvenoConst.EYE_STABLE_PERIOD)};f.prototype.StopDetectCameraMovement=function(){if(c.timer){clearInterval(c.timer);c.timer=null}};f.prototype.Zoom=function(a){var k=a.mouseButton==Germanium.MouseButtons.Left?true:false;if(a.shiftKey)k=false;
try{var s=j.GetEye(),p=s.Compute3DIntersection(a.windowX,a.windowY);if(p){var v=new Vec3(s.GetPosition()),w=(new Vec3(p)).Minus(v).Length();a=k?0.1*w:10*w;if(a<1.5)a=1.5;j.GetEye().GlideTargetToEyeParams(p,j.GetEye().GetOrientation(),a)}}catch(y){}};var E=null,G=false;f.prototype.PollCameraMovement=function(){var a=j.GetEye().GetParams();if(E!=null)if(q(a,E)){if(!G){i.Emit("OnCameraStopped");G=true}}else G=false;E=a};var D;f.prototype.UponGlideCompleted=function(a){D=a};f.prototype.OnGlideCompleted=
function(){typeof D=="function"&&D.apply(this,arguments);D=null};f.prototype.OnGlideCancelled=function(){D=null};f.prototype.IsGliding=function(){return D!=null};f.prototype.SetCurrentPlacemark=function(a){this.curpmk=a?h.pmk[a]:null};f.prototype.GetCurrentPlacemark=function(){return this.curpmk};var J=false;f.prototype.SetActivePlacemark=function(a){var k=j.GetActivePlacemark();k&&k.GetHandle();J=true;j.SetActivePlacemark(a);k&&k.GetHandle()==a.GetHandle()&&f.prototype.OnPlacemarkActivated()};f.prototype.OnPlacemarkActivated=
function(a){if(J){J=false;i.Emit("OnPlacemarkActivated",a)}else i.Emit("OnPlacemarkClicked",a)};f.prototype.OnPlacemarkDeactivate=function(a){i.Emit("OnPlacemarkDeactivate",a)};f.prototype.OnPlacemarkClicked=function(a){a=a.placemark.GetHandle();if(a=c.map_handle_pmk[a]){var k=true;if(o==a[e.VISIBILITY_BITS])k=false;i.Display("ConvenoPlacemark",{pmk_id:a[e.PMK_ID],glide:false,setVisibility:k})}};f.prototype.SetCategoryVisibility=function(a,k){c.map_cat_vis[a]=k};f.prototype.SetSameLevelVisibility=
function(a){c.sameLevelVisibility=a};f.prototype.UpdatePlacemarksVisibility=function(a){var k;if(i.GetParam("expt-inferplacemark")&&a&&a.keywords)k=a.keywords;var s=function(N){return(new String(N)).replace(/[ \\\/,]/g,"").toLowerCase()};for(var p in k)k[p]=s(k[p]);for(var v in c.map_id_gpmk){var w=h.pmk[v],y=c.map_id_gpmk[v],x=false;if(y){if(c.curpmk&&v==c.curpmk[e.PMK_ID])x=true;if(c.map_pmk_vis[v])x=true;if(!x&&k)for(p in k)if(s(w[e.NAME]).indexOf(k[p])==0){var B=w[e.BLDG_BBL_ID],F=w[e.BLOCK_BBL_ID],
C=w[e.LEVEL_BBL_ID],H=j.GetLevelByBBLId(B,F,C);if(!(H&&H.IsHidden()))if(B+"/"+F+"/"+C==a.levelhash){x=true;break}}if(!x){var I=false,L=true;for(p in h.map_pmk_cat)if(h.map_pmk_cat[p][A.PMK_ID]==v){B=h.map_pmk_cat[p][A.CAT_ID];if(c.map_cat_vis[B]===true){I=true;break}L&=c.map_cat_vis[B]===undefined}if(c.curpmk){B=c.curpmk[e.BLDG_BBL_ID];F=c.curpmk[e.BLOCK_BBL_ID];C=c.curpmk[e.LEVEL_BBL_ID];if(w[e.BLDG_BBL_ID]==B&&w[e.BLOCK_BBL_ID]==F&&w[e.LEVEL_BBL_ID]==C&&C){var K=j.GetBuildingByBBLId(B),M=j.GetBlockByBBLId(B,
F);if(H=j.GetLevelByBBLId(B,F,C))if(!(H.IsHidden()||M.IsHidden()||K.IsHidden())&&(I||L&&c.sameLevelVisibility))x=true}}if(!w[e.LEVEL_BBL_ID]&&I)x=true}y.SetVisibility(x)}}};f.prototype.HideAllPlacemarks=function(){c.curpmk=null;for(var a in c.map_id_gpmk)c.map_id_gpmk[a].SetVisibility(false)};f.prototype.SetVisibilityAllLevels=function(a){if(a===null)a=false;o=null;for(var k=j.GetNumberOfBuildings(),s=0;s<k;){var p=j.GetBuildingByIndex(s);p.SetVisibility(a);for(var v=p.GetNumberOfBlocks(),w=0;w<v;){var y=
p.GetBlockByIndex(w);y.SetVisibility(a);for(y=y.GetBottomLevel();y;y=y.GetLevelAbove())y.SetVisibility(a);w++}s++}};f.prototype.UnhideAllLevels=function(){c.SetVisibilityAllLevels(true)};f.prototype.SetVisibilityFromString=function(a){o=a;var k=d(a);a=[];for(var s=k.length,p=0;p<s;p++){var v=k.charCodeAt(p);a.push((v&1)==1);a.push((v>>1&1)==1);a.push((v>>2&1)==1);a.push((v>>3&1)==1);a.push((v>>4&1)==1);a.push((v>>5&1)==1);a.push((v>>6&1)==1);a.push((v>>7&1)==1)}k=0;s=j.GetNumberOfBuildings();for(p=
0;p<s;p++){v=j.GetBuildingByIndex(p);v.SetVisibility(a[k++]);for(var w=v.GetNumberOfBlocks(),y=0;y<w;y++){var x=v.GetBlockByIndex(y);x.SetVisibility(a[k++]);for(var B=x.GetNumberOfLevels(),F=0;F<B;F++)x.GetLevelByIndex(F).SetVisibility(a[k++])}}};f.prototype.UpdateApp=function(a){var k=j.GetEye();k.CancelGlide();k.DisableRotation();c.SetCurrentPlacemark(null);c.map_pmk_vis={};c.UpdatePlacemarksVisibility();c.HideVisualPath();c.UnhideAllLevels();if((a=h.app[b.VIEW_ID])&&h.view&&h.view[a]){a=h.view[a];
a=t(a);k.SetParams(a)}};f.prototype.UpdateCategory=function(){c.HideVisualPath()};f.prototype.UpdatePlacemark=function(a){var k=a.pmk_id,s=h.pmk[k],p=c.map_id_gpmk[k];c.HideVisualPath();a.setVisibility!==false&&s[e.VISIBILITY_BITS]&&c.SetVisibilityFromString(s[e.VISIBILITY_BITS]);c.SetCurrentPlacemark(k);c.map_pmk_vis={};c.UpdatePlacemarksVisibility();if(a.glide!==false){var v=h.view[s[e.VIEW_ID]];if(v){var w=j.GetEye();(function(){var y=t(v);w.GlideEyeTo({eyeParams:y,speedMultiplier:i.GetParam("speed"),
useParabola:i.GetParam("useparabola")})})()}else c.SetActivePlacemark(p)}};f.prototype.HideVisualPath=function(){c.visualpath&&c.visualpath.Hide()};f.prototype.ShowVisualPath=function(a){if(c.visualpath)if(c.visualpath.path_index==a)c.visualpath.Show();else{var k=h.path[a];if(k){var s=h.node;k=k.segment;var p=[];for(var v in k){var w=k[v][r.START_NODE_ID],y=k[v][r.END_NODE_ID];p.push({x1:s[w][g.X],y1:s[w][g.Y],z1:s[w][g.Z],x2:s[y][g.X],y2:s[y][g.Y],z2:s[y][g.Z],type:k[v][r.EDGE_CLASS]})}c.visualpath.Clear();
c.visualpath.Show();c.visualpath.Make(p);c.visualpath.path_index=a}}};f.prototype.UpdatePath=function(a){var k=h.path[a.path_index],s=i.GetPlacemarkById(k.dst_pmk_id);if(s){s[e.VISIBILITY_BITS]&&c.SetVisibilityFromString(s[e.VISIBILITY_BITS]);c.SetCurrentPlacemark(k.dst_pmk_id);s=i.GetPlacemarkByNodeId(k.segment[0][r.START_NODE_ID]);c.map_pmk_vis={};c.map_pmk_vis[s[e.PMK_ID]]=true;c.UpdatePlacemarksVisibility();if(k=h.view[k.view_id]){k=t(k);s=j.GetEye();c.UponGlideCompleted(false);s.GlideEyeTo({eyeParams:k,
speedMultiplier:i.GetParam("speed"),useParabola:i.GetParam("useparabola")})}c.ShowVisualPath(a.path_index)}};f.prototype.UpdateGuide=function(a){var k=h.path[a.path_index],s=k.guide[a.guide_index],p=s[u.SEG_ID],v;for(var w in k.segment)if(k.segment[w][r.SEG_ID]==p){v=k.segment[w];break}if(k=s[u.VIEW_ID])if(k=h.view[k]){k=t(k);p=j.GetEye();c.UponGlideCompleted(false);w=i.GetParam("speed");if(i.GetParam("adaptivespeed")){w=p.GetParams();var y=new Vec3(w.GetPosition()),x=new Vec3(k.GetPosition());w=
1/(0.1*x.Minus(y).Length()+1);var B=new Vec3(0,1,0);x=h.node[v[ConvenoConst.SEG.START_NODE_ID]];x=new Vec3(x[0],x[1],x[2]);x=x.Minus(y).Normalize();w=0.5+0.3*(Math.abs(x.Dot(B))*2/Math.PI)+0.2*w}p.GlideEyeTo({eyeParams:k,speedMultiplier:w,useParabola:i.GetParam("useparabola")})}v&&v[r.VISIBILITY_BITS]&&c.SetVisibilityFromString(v[r.VISIBILITY_BITS]);k={};if(i.GetParam("expt-inferplacemark")){w=new RegExp("<em>(.*?)</em>","g");for(p=[];B=w.exec(s[u.CONTENT]);)p.push(B[1]);x=h.node[v[r.START_NODE_ID]];
s=x[g.BLDG_BBL_ID]+"/"+x[g.BLOCK_BBL_ID]+"/"+x[g.LEVEL_BBL_ID];k.keywords=p;k.levelhash=s}c.UpdatePlacemarksVisibility(k);c.ShowVisualPath(a.path_index)};f.prototype.StartLookaround=function(a){var k=i.GetPlacemarkById(a);if(!k)return false;var s=k[e.BLDG_BBL_ID],p=k[e.BLOCK_BBL_ID],v=k[e.LEVEL_BBL_ID],w=null;if(s&&p&&v)w=j.GetLevelByBBLId(s,p,v);if(!w)return false;c.HideAllPlacemarks();c.SetCurrentPlacemark(a);c.UponGlideCompleted(function(){c.UnhideAllLevels();j.GetEye().EnableRotation()});j.AddEventHandler(Germanium.Event.OnAutoRotateCancelled,
f.prototype.OnLookaroundCancelled);j.AddEventHandler(Germanium.Event.OnGlideCancelled,function(){i.Emit("OnLookaroundCancelled");c.UpdatePlacemarksVisibility()});a=h.node[k[e.NODE_ID]];k=k[e.LOOKAROUND_Y_OFFSET];w=k==null?w.GetFloorHeight()+1.65:a[g.Y]+k;w=j.CreateEyeParams(a[g.X],w,a[g.Z]+1,0,0,0,1);j.GetEye().GlideEyeToEyeParams(w)};f.prototype.StopLookaround=function(){j.GetEye().IsGliding()&&j.GetEye().CancelGlide();if(j.GetEye().IsRotating()){c.OnLookaroundCancelled();j.GetEye().DisableRotation()}};
f.prototype.OnLookaroundCancelled=function(){i.Emit("OnLookaroundCancelled");j.RemoveEventHandler(Germanium.Event.OnAutoRotateCancelled,f.prototype.OnLookaroundCancelled);var a=c.curpmk;if(!a)return false;c.UpdatePlacemark({pmk_id:a[e.PMK_ID]})};f.prototype.GetGuidePosition=function(a,k){a=h.path[a];if(k==undefined)k=0;k=a.guide[k];var s=k[u.SEG_ID],p;for(var v in a.segment)if(a.segment[v][r.SEG_ID]==s){p=a.segment[v];break}if(p){v=h.node[p[r.START_NODE_ID]];p=h.node[p[r.END_NODE_ID]];if(k[u.IS_ON_EDGE]){k=
(v[g.X]+p[g.X])/2;a=(v[g.Y]+p[g.Y])/2;p=(v[g.Z]+p[g.Z])/2}else{k=v[g.X];a=v[g.Y];p=v[g.Z]}return[k,a,p]}else return null};f.prototype.GetGermPlacemarkById=function(a){return c.map_id_gpmk[a]};f.prototype.GetPathSourcePlacemark=function(a){a=h.path[a].segment;if(!a)return null;a=i.GetPlacemarkByNodeId(a[0][r.START_NODE_ID]);if(!a)return null;return a[e.PMK_ID]};return f}();

