function __log(a){if(!__log.counter)__log.counter=0;__log.counter++;a="["+__log.counter+"] "+a;try{console.log(a)}catch(b){window.status=a}}function __dump0(a,b){var c="";b||(b=0);for(var e="",d=0;d<b+1;d++)e+="    ";if(typeof a=="object")for(var g in a){d=a[g];if(typeof d=="object"){c+=e+"'"+g+"' ...\n";try{c+=dump(d,b+1)}catch(h){}}else c+=e+"'"+g+"' => \""+d+'"\n'}else c="("+typeof a+")===>"+a+"<===";return c}function __dump(a){__log(">> dump <<\n"+__dump0(a,0))}
EventLog=function(){function a(f,j,k){b=this;c=f;d=j;g=k;e=new Date;h=[];$(window).unload(function(){i&&clearInterval(i);b.Log("Unload",null);b.Flush(false)})}var b,c,e,d,g,h,l=true,n=false,m=60,i=null;a.prototype.CreateLogEvent=function(f,j){var k={};k.datetime=(new Date).getTime();k.via=d;k.app_id=g;k.event=f;k.param=j;return k};a.prototype.Log=function(f,j){h.push(b.CreateLogEvent(f,j));l||b.Flush()};a.prototype.Flush=function(f){if(h.length>0){var j=(new Date).getTime();__log("Got "+h.length+
" items");$.ajax({type:"POST",url:c,data:{t:j,events:h},async:f||f==undefined?true:false,error:function(k,o){__log("! Error while saving: "+o)}});h=[]}};a.prototype.EnableBuffering=function(f){l=f;!l&&h.length>0&&b.Flush()};a.prototype.EnablePeriodicFlush=function(f){n=f;if(!n&&i){clearInterval(i);i=null;b.Flush()}else if(n&&!i)i=setInterval(function(){b instanceof a&&b.Flush()},m*1E3)};a.prototype.SetPeriodicFlushInterval=function(f){var j=m;if(f)m=f;if(j!=m&&i){clearInterval(i);i=setInterval(function(){b instanceof
a&&b.Flush()},m*1E3)}};return a}();
EventLog.CreateConvenoHelper=function(a,b){if(!(a.GetParam("eventlog")&&a.GetParam("eventlogurl")))return null;var c=a.GetData().app[ConvenoConst.APP.APP_ID],e=new EventLog(a.GetParam("eventlogurl"),b,c);e.EnableBuffering(true);e.EnablePeriodicFlush(true);e.Log("Start");a.AddListener("OnPageReady",function(d,g){var h=a.GetData(),l=g;switch(d){case "ConvenoPath":case "ConvenoGuide":l={path_id:h.path[g.path_index].path_id,guide_index:g.guide_index};break;case "ConvenoByName":case "ConvenoByLevel":l=null;
break;case "ConvenoPlacemark":l={pmk_id:g.pmk_id};break}e.Log(d,l)});return e};EventObject=function(){};
EventObject.prototype={_eventList:{},_getEvent:function(a,b){if(!this._eventList[a]){if(!b)return null;this._eventList[a]=[]}return this._eventList[a]},attachEvent:function(a,b){this._getEvent(a,true).push(b)},detachEvent:function(a,b){if(a=this._getEvent(a))if(typeof b=="undefined"||b===null)a.length=0;else{b=function(c,e){for(var d=c.length;d<c.length;d++)if(c[d]&&c[d]===e)return d;return-1}(a,b);b>-1&&a.splice(b,1)}},raiseEvent:function(a){var b=this._getEventHandler(a);if(b){var c=Array.prototype.slice.call(arguments);
c.shift();return b.apply(this,c)}return true},_getEventHandler:function(a){var b=this._getEvent(a,false);if(!b||b.length===0)return null;return function(){for(var c=true,e=0;e<b.length;e++){c=b[e].apply(this,arguments);if(c!=undefined&&c==false)break}return c===undefined||c!=false}}};Vec3=function(a,b,c){if(arguments.length==1){this.x=a.x;this.y=a.y;this.z=a.z}else{this.x=a;this.y=b;this.z=c}};
Vec3.prototype={Clone:function(){return new Vec3(this.x,this.y,this.z)},ToString:function(){return"("+this.x+","+this.y+","+this.z+")"},Minus:function(a){return new Vec3(this.x-a.x,this.y-a.y,this.z-a.z)},MinusEqual:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},Plus:function(a){return new Vec3(this.x+a.x,this.y+a.y,this.z+a.z)},PlusEqual:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},Scale:function(a){return new Vec3(this.x*a,this.y*a,this.z*a)},ScaleEqual:function(a){this.x*=
a;this.y*=a;this.z*=a;return this},Length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},Normalize:function(){var a=this.Length();if(a==0)return this;this.x/=a;this.y/=a;this.z/=a;return this},Cross:function(a){var b=new Vec3(0,0,0),c=this;b.x=c.y*a.z-c.z*a.y;b.y=c.z*a.x-c.x*a.z;b.z=c.x*a.y-c.y*a.x;return b},Dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z}};

