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