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";){k(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=p(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},k=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},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=g(a);b.addLocation(c)}else if(a.tagName==
"MAPLOC"){c=j(a);b.addLocation(c)}else if(a.tagName=="SHAPE"){c=o(a);for(var l in c)b.addMapCoordinate(c[l])}a=f(a.nextSibling)}return b},o=function(a){var b=[];if(a.childNodes.length>0){a=a.childNodes[0].nodeValue.split("\n");for(var c in a){var l=a[c].split(" ");l[0]!=""&&typeof l[0]!="undefined"&&l[1]!=""&&typeof l[1]!="undefined"&&b.push({x:l[0],y:l[1]})}}return b},p=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)}else if(a.tagName=="SHAPE"){c=o(a);for(var l in c)b.addMapCoordinate(c[l])}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 q=b.substring(0,2)*1;b=b.substring(2,4)*1;return new Date(c,l-1,a,q,b)},f=function(a){for(;a!=null&&a.nodeType!=1;)a=a.nextSibling;return a},r=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 r(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 g};this.setShapeFile=function(j){g=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 k};this.setEndLocation=function(j){k=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,k=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 i};this.setDepartureDateTime=function(d){i=d};this.setName=function(d,g){for(var j in k)if(k[j].lang==d){k[j].val=g;return}k.push({lang:d,name:g})};this.getName=function(d){for(var g in k)if(k[g].lang==d)return k[g].name;return null};var h=null,e=null,i=null,k=
[]};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){i=g};this.getId=function(){return i};this.setUid=function(g){k=g};this.getUid=function(){return k};this.setXtra=function(g,j){for(var n in d)if(d[n].name==g){d[n].val=j;return}d.push({name:g,val:j})};this.getXtra=function(g){for(var j in d)if(d[j].name==g)return d[j].val;return null};var h=
null,e=null,i=null,k=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(d){e=d};this.getLength=function(){return h};this.setLength=function(d){h=d};this.getLocations=function(){return i};this.addLocation=function(d){k.length==0&&k.push(d.getCoordinates());i.push(d)};this.getMapCoordinates=function(){var d=k;i!=null&&i.length>0&&d.push(i[i.length-1].getCoordinates());return d};this.addMapCoordinate=function(d){k.push(d)};this.getStartDateTime=function(){return i[0].getDepartureDateTime()};
this.getEndDateTime=function(){return i[i.length-1].getArrivalDateTime()};var h=null,e=null,i=[],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 i};this.setType=function(d){i=d};this.getMobility=function(){return k};this.setMobility=function(d){k=d};var h=null,e=null,i=null,k=null};LBS.MTRAVEL.Line.prototype=new LBS.MTRAVEL.Leg;LBS.MTRAVEL.Line.prototype.constructor=LBS.MTRAVEL.Line;LBS.MTRAVEL.Service=function(){};

