﻿; function TransitInfo(language, from, to, date, time, routeType) {
    this.language = language;
    this.from = from;
    this.to = to;
    this.date = date;
    this.time = time;
    this.routeType = routeType;
}

function GoogleMap() {
}

jQuery.extend(GoogleMap.prototype, {
    constants: {
        transitUrl: 'http://www.google.com/maps?ie=UTF8&f=d&dirflg=r&hl=##language##&saddr=##from##&daddr=##to##&ttype=##routeType##&date=##date##&time=##time##',
        languageTemplate: '##language##',
        fromTemplate: '##from##',
        toTemplate: '##to##',
        dateTemplate: '##date##',
        timeTemplate: '##time##',
        routeTypeTemplate: '##routeType##'
    },

    getTransitUrl: function (transitInfo) {
        var url = this.constants.transitUrl.replace(this.constants.languageTemplate, transitInfo.language);
        url = url.replace(this.constants.fromTemplate, transitInfo.from);
        url = url.replace(this.constants.toTemplate, transitInfo.to);
        url = url.replace(this.constants.dateTemplate, transitInfo.date);
        url = url.replace(this.constants.timeTemplate, transitInfo.time);
        url = url.replace(this.constants.routeTypeTemplate, transitInfo.routeType);

        return url;
    }


});

var googleMap = new GoogleMap();
