if(!LBS){var LBS={}}LBS.MTRAVEL={};LBS.MTRAVEL.parseResponse=function(m){var e=LBS.MTRAVEL;var c=function(o){var q=b(o.firstChild);if(q===null){return new e.RouteResponse(o)}else{if(q.tagName=="ERROR"){return a(o)}}var r=new e.RouteResponse(o);var p=q;do{var n=i(p);if(n==null){return null}r.addRoute(n);p=b(p.nextSibling)}while(p!=null);return r};var i=function(o){var n=new e.Route();n.setShapeFile(o.getAttribute("shapefile"));var q=b(o.firstChild);if(q==null||q.tagName!="LENGTH"){return null}n.setDuration(parseFloat(q.getAttribute("time")*60));n.setLength(parseFloat(q.getAttribute("dist")));q=b(q.nextSibling);if(q===null){return null}while(q!==null&&q.tagName=="SERVICE"){h(q);q=b(q.nextSibling)}if(q===null){return null}var p=null;if(q.tagName=="POINT"){p=j(q)}else{if(q.tagName=="STOP"){p=d(q)}else{return null}}if(p==null){return null}n.setStartLocation(p);q=b(q.nextSibling);while(q!==null){var r=null;if(q.tagName=="WALK"){r=f(q)}else{if(q.tagName=="LINE"){r=k(q)}else{break}}n.addLeg(r);q=b(q.nextSibling)}if(q===null){return null}var s=null;if(q.tagName=="POINT"){s=j(q)}else{if(q.tagName=="STOP"){s=d(q)}else{return null}}if(s==null){return null}n.setEndLocation(s);q=b(q.nextSibling);if(q!=null){return null}return n};var h=function(o){var n=new e.Service();return n};var j=function(q){var u=new e.Point();u.setCoordinates({x:q.getAttribute("x"),y:q.getAttribute("y")});var s=b(q.firstChild);if(s==null){return null}var t=l(s.getAttribute("date"),s.getAttribute("time"));u.setArrivalDateTime(t);var v=b(s.nextSibling);if(v==null){return null}var r=l(v.getAttribute("date"),v.getAttribute("time"));u.setDepartureDateTime(r);var p=b(v.nextSibling);while(p!==null){if(p.tagName=="NAME"){var n=p.getAttribute("lang");var o=p.getAttribute("val");u.setName(n,o)}p=b(p.nextSibling)}return u};var d=function(n){var t=new e.Stop();t.setCoordinates({x:n.getAttribute("x"),y:n.getAttribute("y")});var r=n.getAttribute("code");var s=r.split(":");if(s.length<2){t.setCode(s[0])}else{t.setOwner(s[0]);t.setCode(s[1])}t.setId(n.getAttribute("id"));t.setUid(n.getAttribute("uid"));var v=b(n.firstChild);if(v==null){return null}var w=l(v.getAttribute("date"),v.getAttribute("time"));t.setArrivalDateTime(w);var x=b(v.nextSibling);if(x==null){return null}var u=l(x.getAttribute("date"),x.getAttribute("time"));t.setDepartureDateTime(u);var q=b(x.nextSibling);while(q!==null){if(q.tagName=="NAME"){var o=q.getAttribute("lang");var p=q.getAttribute("val");t.setName(o,p)}q=b(q.nextSibling)}return t};var g=function(v){var q=new e.MapLoc();q.setCoordinates({x:v.getAttribute("x"),y:v.getAttribute("y")});var s=b(v.firstChild);if(s==null){return null}var t=l(s.getAttribute("date"),s.getAttribute("time"));q.setArrivalDateTime(t);var u=b(s.nextSibling);if(u==null){return null}var r=l(u.getAttribute("date"),u.getAttribute("time"));q.setDepartureDateTime(r);var p=b(u.nextSibling);while(p!==null){if(p.tagName=="NAME"){var n=p.getAttribute("lang");var o=p.getAttribute("val");q.setName(n,o)}p=b(p.nextSibling)}return q};var f=function(s){var p=new e.Walk();var r=b(s.firstChild);if(r==null||r.tagName!="LENGTH"){return null}p.setDuration(parseFloat(r.getAttribute("time")));p.setLength(parseFloat(r.getAttribute("dist")));r=b(r.nextSibling);if(r===null){return null}while(r!==null){if(r.tagName=="POINT"){var n=j(r);p.addLocation(n)}else{if(r.tagName=="STOP"){var q=d(r);p.addLocation(q)}else{if(r.tagName=="MAPLOC"){var o=g(r);p.addLocation(o)}else{}}}r=b(r.nextSibling)}return p};var k=function(r){var o=new e.Line();o.setId(r.getAttribute("id"));o.setCode(r.getAttribute("code"));o.setType(r.getAttribute("type"));o.setMobility(r.getAttribute("mobility"));var q=b(r.firstChild);while(q!==null&&q.tagName=="SREF"){q=b(q.nextSibling)}if(q==null||q.tagName!="LENGTH"){return null}o.setDuration(parseFloat(q.getAttribute("time")));o.setLength(parseFloat(q.getAttribute("dist")));q=b(q.nextSibling);if(q===null){return null}while(q!==null){if(q.tagName=="POINT"){var n=j(q);o.addLocation(n)}else{if(q.tagName=="STOP"){var p=d(q);o.addLocation(p)}else{}}q=b(q.nextSibling)}return o};var l=function(s,r){var u=new Date();var p=s.substring(0,4);u.setYear(p);var o=s.substring(4,6);if(o.charAt(0)=="0"){o=o.charAt(1)}u.setMonth(o-1);var q=s.substring(6,8);if(q.charAt(0)=="0"){q=q.charAt(1)}u.setDate(q);var n=r.substring(0,2);if(n.charAt(0)=="0"){n=n.charAt(1)}u.setHours(n);var t=r.substring(2,4);if(t.charAt(0)=="0"){t=t.charAt(1)}u.setMinutes(t);u.setSeconds(0);u.setMilliseconds(0);return u};var b=function(n){while(n!=null&&n.nodeType!=1){n=n.nextSibling}return n};var a=function(n){var o=new e.ErrorResponse(m);return o};return c(m)};LBS.MTRAVEL.Response=function(a){this.getResponseDom=function(){return b};var b=a};LBS.MTRAVEL.RouteResponse=function(a){LBS.MTRAVEL.Response.call(this,a);this.getRoutes=function(){return b};this.addRoute=function(c){b.push(c)};var b=[]};LBS.MTRAVEL.RouteResponse.prototype=new LBS.MTRAVEL.Response;LBS.MTRAVEL.RouteResponse.prototype.constructor=LBS.MTRAVEL.RouteResponse;LBS.MTRAVEL.ErrorResponse=function(a){LBS.MTRAVEL.Response.call(this,a)};LBS.MTRAVEL.ErrorResponse.prototype=new LBS.MTRAVEL.Response;LBS.MTRAVEL.ErrorResponse.prototype.constructor=LBS.MTRAVEL.ErrorResponse;LBS.MTRAVEL.Route=function(){this.getShapeFile=function(){return b};this.setShapeFile=function(g){b=g};this.getDuration=function(){return e};this.setDuration=function(g){e=g};this.getLength=function(){return f};this.setLength=function(g){f=g};this.getStartLocation=function(){return c};this.setStartLocation=function(g){c=g};this.getEndLocation=function(){return a};this.setEndLocation=function(g){a=g};this.getStartDateTime=function(){var g=d[0].getLocations();return g[0].getArrivalDateTime()};this.getEndDateTime=function(){var g=d[d.length-1].getLocations();return g[g.length-1].getDepartureDateTime()};this.getLegs=function(){return d};this.addLeg=function(g){d.push(g)};var f=null;var e=null;var c=null;var a=null;var d=[];var b=null};LBS.MTRAVEL.Location=function(){this.getCoordinates=function(){return b};this.setCoordinates=function(e){b=e};this.getArrivalDateTime=function(){return d};this.setArrivalDateTime=function(e){d=e};this.getDepartureDateTime=function(){return c};this.setDepartureDateTime=function(e){c=e};this.setName=function(g,e){for(var f in a){if(a[f].lang==g){a[f].val=e;return}}a.push({lang:g,name:e})};this.getName=function(f){for(var e in a){if(a[e].lang==f){return a[e].name}}return null};var b=null;var d=null;var c=null;var a=[]};LBS.MTRAVEL.Point=function(){LBS.MTRAVEL.Location.call(this)};LBS.MTRAVEL.Point.prototype=new LBS.MTRAVEL.Location;LBS.MTRAVEL.Point.prototype.constructor=LBS.MTRAVEL.Point;LBS.MTRAVEL.Stop=function(){LBS.MTRAVEL.Location.call(this);this.setCode=function(e){b=e};this.getCode=function(){return b};this.setOwner=function(e){d=e};this.getOwner=function(){return d};this.setId=function(e){a=e};this.getId=function(){return a};this.setUid=function(e){c=e};this.getUid=function(){return c};var b=null;var d=null;var a=null;var c=null};LBS.MTRAVEL.Stop.prototype=new LBS.MTRAVEL.Location;LBS.MTRAVEL.Stop.prototype.constructor=LBS.MTRAVEL.Stop;LBS.MTRAVEL.MapLoc=function(){LBS.MTRAVEL.Location.call(this)};LBS.MTRAVEL.MapLoc.prototype=new LBS.MTRAVEL.Location;LBS.MTRAVEL.MapLoc.prototype.constructor=LBS.MTRAVEL.MapLoc;LBS.MTRAVEL.Leg=function(){this.getDuration=function(){return b};this.setDuration=function(d){b=d};this.getLength=function(){return c};this.setLength=function(d){c=d};this.getLocations=function(){return a};this.addLocation=function(d){a.push(d)};this.getStartDateTime=function(){return a[0].getDepartureDateTime()};this.getEndDateTime=function(){return a[a.length-1].getArrivalDateTime()};var c=null;var b=null;var a=[]};LBS.MTRAVEL.Walk=function(){LBS.MTRAVEL.Leg.call(this)};LBS.MTRAVEL.Walk.prototype=new LBS.MTRAVEL.Leg;LBS.MTRAVEL.Walk.prototype.constructor=LBS.MTRAVEL.Walk;LBS.MTRAVEL.Line=function(){LBS.MTRAVEL.Leg.call(this);this.getId=function(){return c};this.setId=function(e){c=e};this.getCode=function(){return b};this.setCode=function(e){b=e};this.getType=function(){return a};this.setType=function(e){a=e};this.getMobility=function(){return d};this.setMobility=function(e){d=e};var c=null;var b=null;var a=null;var d=null};LBS.MTRAVEL.Line.prototype=new LBS.MTRAVEL.Leg;LBS.MTRAVEL.Line.prototype.constructor=LBS.MTRAVEL.Line;LBS.MTRAVEL.Service=function(){};
