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 R=new E.Stop();R.setCoordinates({x:N.getAttribute("x"),y:N.getAttribute("y")});var T=B(N.firstChild);if(T==null){return null}var U=L(T.getAttribute("date"),T.getAttribute("time"));R.setArrivalDateTime(U);var V=B(T.nextSibling);if(V==null){return null}var S=L(V.getAttribute("date"),V.getAttribute("time"));R.setDepartureDateTime(S);var Q=B(V.nextSibling);while(Q!==null){if(Q.tagName=="NAME"){var O=Q.getAttribute("lang");var P=Q.getAttribute("val");R.setName(O,P)}Q=B(Q.nextSibling)}return R};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)};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(){};