if(!LBS)var LBS={};LBS.MTRAVEL={};
LBS.MTRAVEL.parseResponse=function(h){var e=LBS.MTRAVEL,k=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";){j(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=g(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=g(a);else return null;if(c==null)return null;b.setEndLocation(c);a=f(a.nextSibling);if(a!=null)return null;return b},j=function(){return new e.Service},d=function(a){var b=new e.Point;b.setCoordinates({x:a.getAttribute("x"),
y:a.getAttribute("y")});b.setUid(a.getAttribute("uid"));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},g=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"){var l=a.getAttribute("lang");
c=a.getAttribute("val");b.setName(l,c)}else if(a.tagName=="XTRA"){l=a.getAttribute("name");c=a.getAttribute("val");b.setXtra(l,c)}a=f(a.nextSibling)}return b},i=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=g(a);b.addLocation(c)}else if(a.tagName==
"MAPLOC"){c=i(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=g(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=k(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(k){e.push(k)};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 g};this.setShapeFile=function(i){g=i};this.getDuration=function(){return e};this.setDuration=function(i){e=i};this.getLength=function(){return h};this.setLength=function(i){h=i};this.getStartLocation=function(){return k};this.setStartLocation=function(i){k=i};this.getEndLocation=function(){return j};this.setEndLocation=function(i){j=i};this.getStartDateTime=function(){return d[0].getLocations()[0].getArrivalDateTime()};this.getEndDateTime=
function(){var i=d[d.length-1].getLocations();return i[i.length-1].getDepartureDateTime()};this.getLegs=function(){return d};this.addLeg=function(i){d.push(i)};var h=null,e=null,k=null,j=null,d=[],g=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 k};this.setDepartureDateTime=function(d){k=d};this.setName=function(d,g){for(var i in j)if(j[i].lang==d){j[i].val=g;return}j.push({lang:d,name:g})};this.getName=function(d){for(var g in j)if(j[g].lang==d)return j[g].name;return null};var h=null,e=null,k=null,j=
[]};LBS.MTRAVEL.Point=function(){LBS.MTRAVEL.Location.call(this);this.setUid=function(e){h=e};this.getUid=function(){return h};var h=null};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(g){h=g};this.getCode=function(){return h};this.setOwner=function(g){e=g};this.getOwner=function(){return e};this.setId=function(g){k=g};this.getId=function(){return k};this.setUid=function(g){j=g};this.getUid=function(){return j};this.setXtra=function(g,i){for(var n in d)if(d[n].name==g){d[n].val=i;return}d.push({name:g,val:i})};this.getXtra=function(g){for(var i in d)if(d[i].name==g)return d[i].val;return null};var h=
null,e=null,k=null,j=null,d=[]};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(j){e=j};this.getLength=function(){return h};this.setLength=function(j){h=j};this.getLocations=function(){return k};this.addLocation=function(j){k.push(j)};this.getStartDateTime=function(){return k[0].getDepartureDateTime()};this.getEndDateTime=function(){return k[k.length-1].getArrivalDateTime()};var h=null,e=null,k=[]};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 k};this.setType=function(d){k=d};this.getMobility=function(){return j};this.setMobility=function(d){j=d};var h=null,e=null,k=null,j=null};LBS.MTRAVEL.Line.prototype=new LBS.MTRAVEL.Leg;LBS.MTRAVEL.Line.prototype.constructor=LBS.MTRAVEL.Line;
LBS.MTRAVEL.Service=function(){};

