﻿Type.registerNamespace("NetMatch.Villango");

/* 

Webservices
1) NetMatch.Villango.Web09.UI.Services.Favorites
2) NetMatch.Villango.Web09.UI.Services.ViewedTrips
3) NetMatch.Villango.Web09.UI.Services.AccoDetailsSearchResults
4) NetMatch.Villango.Web.UI.Services.Rating

*/

/* 
The following controls are available:
  
1. FavoritesList control
2. ViewedTrips control
3. AccoDetailsSearchResults control
4. Rating control  
*/


Type.registerNamespace('NetMatch.Villango.Web09.UI.Services');
NetMatch.Villango.Web09.UI.Services.Favorites = function() {
    NetMatch.Villango.Web09.UI.Services.Favorites.initializeBase(this);
    this._timeout = 0;
    this._userContext = null;
    this._succeeded = null;
    this._failed = null;
}
NetMatch.Villango.Web09.UI.Services.Favorites.prototype = {
    _get_path: function() {
        var p = this.get_path();
        if (p) return p;
        else return NetMatch.Villango.Web09.UI.Services.Favorites._staticInstance.get_path();
    },
    GetLatestFavorites: function(serviceContext, includeLatestFavoriteInResponse, succeededCallback, failedCallback, userContext) {
        return this._invoke(this._get_path(), 'GetLatestFavorites', false, { serviceContext: serviceContext, includeLatestFavoriteInResponse: includeLatestFavoriteInResponse }, succeededCallback, failedCallback, userContext);
    },
    AddFavorite: function(accoItemCmsId, serviceContext, includeLatestFavoriteInResponse, succeededCallback, failedCallback, userContext) {
        return this._invoke(this._get_path(), 'AddFavorite', false, { accoItemCmsId: accoItemCmsId, serviceContext: serviceContext, includeLatestFavoriteInResponse: includeLatestFavoriteInResponse }, succeededCallback, failedCallback, userContext);
    },
    AddMultipleFavorites: function(accoItemsCmsIds, serviceContext, includeLatestFavoriteInResponse, succeededCallback, failedCallback, userContext) {
        return this._invoke(this._get_path(), 'AddMultipleFavorites', false, { accoItemsCmsIds: accoItemsCmsIds, serviceContext: serviceContext, includeLatestFavoriteInResponse: includeLatestFavoriteInResponse }, succeededCallback, failedCallback, userContext);
    },
    DeleteAllFavorites: function(serviceContext, succeededCallback, failedCallback, userContext) {
        return this._invoke(this._get_path(), 'DeleteAllFavorites', false, { serviceContext: serviceContext }, succeededCallback, failedCallback, userContext);
    },
    DeleteSelectedFavorites: function(serviceContext, accoItemsIds, succeededCallback, failedCallback, userContext) {
        return this._invoke(this._get_path(), 'DeleteSelectedFavorites', false, { serviceContext: serviceContext, accoItemsIds: accoItemsIds }, succeededCallback, failedCallback, userContext);
    }
}
NetMatch.Villango.Web09.UI.Services.Favorites.registerClass('NetMatch.Villango.Web09.UI.Services.Favorites', Sys.Net.WebServiceProxy);
NetMatch.Villango.Web09.UI.Services.Favorites._staticInstance = new NetMatch.Villango.Web09.UI.Services.Favorites();
NetMatch.Villango.Web09.UI.Services.Favorites.set_path = function(value) { NetMatch.Villango.Web09.UI.Services.Favorites._staticInstance.set_path(value); }
NetMatch.Villango.Web09.UI.Services.Favorites.get_path = function() { return NetMatch.Villango.Web09.UI.Services.Favorites._staticInstance.get_path(); }
NetMatch.Villango.Web09.UI.Services.Favorites.set_timeout = function(value) { NetMatch.Villango.Web09.UI.Services.Favorites._staticInstance.set_timeout(value); }
NetMatch.Villango.Web09.UI.Services.Favorites.get_timeout = function() { return NetMatch.Villango.Web09.UI.Services.Favorites._staticInstance.get_timeout(); }
NetMatch.Villango.Web09.UI.Services.Favorites.set_defaultUserContext = function(value) { NetMatch.Villango.Web09.UI.Services.Favorites._staticInstance.set_defaultUserContext(value); }
NetMatch.Villango.Web09.UI.Services.Favorites.get_defaultUserContext = function() { return NetMatch.Villango.Web09.UI.Services.Favorites._staticInstance.get_defaultUserContext(); }
NetMatch.Villango.Web09.UI.Services.Favorites.set_defaultSucceededCallback = function(value) { NetMatch.Villango.Web09.UI.Services.Favorites._staticInstance.set_defaultSucceededCallback(value); }
NetMatch.Villango.Web09.UI.Services.Favorites.get_defaultSucceededCallback = function() { return NetMatch.Villango.Web09.UI.Services.Favorites._staticInstance.get_defaultSucceededCallback(); }
NetMatch.Villango.Web09.UI.Services.Favorites.set_defaultFailedCallback = function(value) { NetMatch.Villango.Web09.UI.Services.Favorites._staticInstance.set_defaultFailedCallback(value); }
NetMatch.Villango.Web09.UI.Services.Favorites.get_defaultFailedCallback = function() { return NetMatch.Villango.Web09.UI.Services.Favorites._staticInstance.get_defaultFailedCallback(); }
NetMatch.Villango.Web09.UI.Services.Favorites.set_path("/UI/Services/Favorites.svc");
NetMatch.Villango.Web09.UI.Services.Favorites.GetLatestFavorites = function(serviceContext, includeLatestFavoriteInResponse, onSuccess, onFailed, userContext) { NetMatch.Villango.Web09.UI.Services.Favorites._staticInstance.GetLatestFavorites(serviceContext, includeLatestFavoriteInResponse, onSuccess, onFailed, userContext); }
NetMatch.Villango.Web09.UI.Services.Favorites.AddFavorite = function(accoItemCmsId, serviceContext, includeLatestFavoriteInResponse, onSuccess, onFailed, userContext) { NetMatch.Villango.Web09.UI.Services.Favorites._staticInstance.AddFavorite(accoItemCmsId, serviceContext, includeLatestFavoriteInResponse, onSuccess, onFailed, userContext); }
NetMatch.Villango.Web09.UI.Services.Favorites.AddMultipleFavorites = function(accoItemsCmsIds, serviceContext, includeLatestFavoriteInResponse, onSuccess, onFailed, userContext) { NetMatch.Villango.Web09.UI.Services.Favorites._staticInstance.AddMultipleFavorites(accoItemsCmsIds, serviceContext, includeLatestFavoriteInResponse, onSuccess, onFailed, userContext); }
NetMatch.Villango.Web09.UI.Services.Favorites.DeleteAllFavorites = function(serviceContext, onSuccess, onFailed, userContext) { NetMatch.Villango.Web09.UI.Services.Favorites._staticInstance.DeleteAllFavorites(serviceContext, onSuccess, onFailed, userContext); }
NetMatch.Villango.Web09.UI.Services.Favorites.DeleteSelectedFavorites = function(serviceContext, accoItemsIds, onSuccess, onFailed, userContext) { NetMatch.Villango.Web09.UI.Services.Favorites._staticInstance.DeleteSelectedFavorites(serviceContext, accoItemsIds, onSuccess, onFailed, userContext); }
var gtc = Sys.Net.WebServiceProxy._generateTypedConstructor;
Type.registerNamespace('NetMatch.Villango.Web.UI.Services');
if (typeof (NetMatch.Villango.Web.UI.Services.UIServiceContext) === 'undefined') {
    NetMatch.Villango.Web.UI.Services.UIServiceContext = gtc("UIServiceContext:http://schemas.datacontract.org/2004/07/NetMatch.Villango.Web.UI.Services");
    NetMatch.Villango.Web.UI.Services.UIServiceContext.registerClass('NetMatch.Villango.Web.UI.Services.UIServiceContext');
}
Type.registerNamespace('netmatch.villango.web09.ui.services');
if (typeof (netmatch.villango.web09.ui.services.favoritesserviceresponse) === 'undefined') {
    netmatch.villango.web09.ui.services.favoritesserviceresponse = gtc("FavoritesServiceResponse:http://NetMatch.Villango.Web09.UI.Services");
    netmatch.villango.web09.ui.services.favoritesserviceresponse.registerClass('netmatch.villango.web09.ui.services.favoritesserviceresponse');
}







Type.registerNamespace('NetMatch.Villango.Web09.UI.Services');
NetMatch.Villango.Web09.UI.Services.ViewedTrips = function() {
    NetMatch.Villango.Web09.UI.Services.ViewedTrips.initializeBase(this);
    this._timeout = 0;
    this._userContext = null;
    this._succeeded = null;
    this._failed = null;
}
NetMatch.Villango.Web09.UI.Services.ViewedTrips.prototype = {
    _get_path: function() {
        var p = this.get_path();
        if (p) return p;
        else return NetMatch.Villango.Web09.UI.Services.ViewedTrips._staticInstance.get_path();
    },
    AddViewedTrip: function(serviceContext, accoItemId, returnLatestViewedTripHtml, succeededCallback, failedCallback, userContext) {
        return this._invoke(this._get_path(), 'AddViewedTrip', false, { serviceContext: serviceContext, accoItemId: accoItemId, returnLatestViewedTripHtml: returnLatestViewedTripHtml }, succeededCallback, failedCallback, userContext);
    },
    GetLatestViewedTrip: function(serviceContext, excludeAccoItemId, returnLatestViewedTripHtml, succeededCallback, failedCallback, userContext) {
        return this._invoke(this._get_path(), 'GetLatestViewedTrip', false, { serviceContext: serviceContext, excludeAccoItemId: excludeAccoItemId, returnLatestViewedTripHtml: returnLatestViewedTripHtml }, succeededCallback, failedCallback, userContext);
    },
    DeleteAllViewedTrips: function(serviceContext, succeededCallback, failedCallback, userContext) {
        return this._invoke(this._get_path(), 'DeleteAllViewedTrips', false, { serviceContext: serviceContext }, succeededCallback, failedCallback, userContext);
    },
    DeleteSelectedViewedTrips: function(serviceContext, selectedAccoItemIds, succeededCallback, failedCallback, userContext) {
        return this._invoke(this._get_path(), 'DeleteSelectedViewedTrips', false, { serviceContext: serviceContext, selectedAccoItemIds: selectedAccoItemIds }, succeededCallback, failedCallback, userContext);
    }
}
NetMatch.Villango.Web09.UI.Services.ViewedTrips.registerClass('NetMatch.Villango.Web09.UI.Services.ViewedTrips', Sys.Net.WebServiceProxy);
NetMatch.Villango.Web09.UI.Services.ViewedTrips._staticInstance = new NetMatch.Villango.Web09.UI.Services.ViewedTrips();
NetMatch.Villango.Web09.UI.Services.ViewedTrips.set_path = function(value) { NetMatch.Villango.Web09.UI.Services.ViewedTrips._staticInstance.set_path(value); }
NetMatch.Villango.Web09.UI.Services.ViewedTrips.get_path = function() { return NetMatch.Villango.Web09.UI.Services.ViewedTrips._staticInstance.get_path(); }
NetMatch.Villango.Web09.UI.Services.ViewedTrips.set_timeout = function(value) { NetMatch.Villango.Web09.UI.Services.ViewedTrips._staticInstance.set_timeout(value); }
NetMatch.Villango.Web09.UI.Services.ViewedTrips.get_timeout = function() { return NetMatch.Villango.Web09.UI.Services.ViewedTrips._staticInstance.get_timeout(); }
NetMatch.Villango.Web09.UI.Services.ViewedTrips.set_defaultUserContext = function(value) { NetMatch.Villango.Web09.UI.Services.ViewedTrips._staticInstance.set_defaultUserContext(value); }
NetMatch.Villango.Web09.UI.Services.ViewedTrips.get_defaultUserContext = function() { return NetMatch.Villango.Web09.UI.Services.ViewedTrips._staticInstance.get_defaultUserContext(); }
NetMatch.Villango.Web09.UI.Services.ViewedTrips.set_defaultSucceededCallback = function(value) { NetMatch.Villango.Web09.UI.Services.ViewedTrips._staticInstance.set_defaultSucceededCallback(value); }
NetMatch.Villango.Web09.UI.Services.ViewedTrips.get_defaultSucceededCallback = function() { return NetMatch.Villango.Web09.UI.Services.ViewedTrips._staticInstance.get_defaultSucceededCallback(); }
NetMatch.Villango.Web09.UI.Services.ViewedTrips.set_defaultFailedCallback = function(value) { NetMatch.Villango.Web09.UI.Services.ViewedTrips._staticInstance.set_defaultFailedCallback(value); }
NetMatch.Villango.Web09.UI.Services.ViewedTrips.get_defaultFailedCallback = function() { return NetMatch.Villango.Web09.UI.Services.ViewedTrips._staticInstance.get_defaultFailedCallback(); }
NetMatch.Villango.Web09.UI.Services.ViewedTrips.set_path("/UI/Services/ViewedTrips.svc");
NetMatch.Villango.Web09.UI.Services.ViewedTrips.AddViewedTrip = function(serviceContext, accoItemId, returnLatestViewedTripHtml, onSuccess, onFailed, userContext) { NetMatch.Villango.Web09.UI.Services.ViewedTrips._staticInstance.AddViewedTrip(serviceContext, accoItemId, returnLatestViewedTripHtml, onSuccess, onFailed, userContext); }
NetMatch.Villango.Web09.UI.Services.ViewedTrips.GetLatestViewedTrip = function(serviceContext, excludeAccoItemId, returnLatestViewedTripHtml, onSuccess, onFailed, userContext) { NetMatch.Villango.Web09.UI.Services.ViewedTrips._staticInstance.GetLatestViewedTrip(serviceContext, excludeAccoItemId, returnLatestViewedTripHtml, onSuccess, onFailed, userContext); }
NetMatch.Villango.Web09.UI.Services.ViewedTrips.DeleteAllViewedTrips = function(serviceContext, onSuccess, onFailed, userContext) { NetMatch.Villango.Web09.UI.Services.ViewedTrips._staticInstance.DeleteAllViewedTrips(serviceContext, onSuccess, onFailed, userContext); }
NetMatch.Villango.Web09.UI.Services.ViewedTrips.DeleteSelectedViewedTrips = function(serviceContext, selectedAccoItemIds, onSuccess, onFailed, userContext) { NetMatch.Villango.Web09.UI.Services.ViewedTrips._staticInstance.DeleteSelectedViewedTrips(serviceContext, selectedAccoItemIds, onSuccess, onFailed, userContext); }
var gtc = Sys.Net.WebServiceProxy._generateTypedConstructor;
Type.registerNamespace('NetMatch.Villango.Web.UI.Services');
if (typeof (NetMatch.Villango.Web.UI.Services.UIServiceContext) === 'undefined') {
    NetMatch.Villango.Web.UI.Services.UIServiceContext = gtc("UIServiceContext:http://schemas.datacontract.org/2004/07/NetMatch.Villango.Web.UI.Services");
    NetMatch.Villango.Web.UI.Services.UIServiceContext.registerClass('NetMatch.Villango.Web.UI.Services.UIServiceContext');
}
Type.registerNamespace('netmatch.villango.web09.ui.services');
if (typeof (netmatch.villango.web09.ui.services.viewedtripsserviceresponse) === 'undefined') {
    netmatch.villango.web09.ui.services.viewedtripsserviceresponse = gtc("ViewedTripsServiceResponse:http://NetMatch.Villango.Web09.UI.Services");
    netmatch.villango.web09.ui.services.viewedtripsserviceresponse.registerClass('netmatch.villango.web09.ui.services.viewedtripsserviceresponse');
}





Type.registerNamespace('NetMatch.Villango.Web09.UI.Services');
NetMatch.Villango.Web09.UI.Services.AccoDetailsSearchResults = function() {
    NetMatch.Villango.Web09.UI.Services.AccoDetailsSearchResults.initializeBase(this);
    this._timeout = 0;
    this._userContext = null;
    this._succeeded = null;
    this._failed = null;
}
NetMatch.Villango.Web09.UI.Services.AccoDetailsSearchResults.prototype = {
    _get_path: function() {
        var p = this.get_path();
        if (p) return p;
        else return NetMatch.Villango.Web09.UI.Services.AccoDetailsSearchResults._staticInstance.get_path();
    },
    GetAccoDetailsSearchResults: function(searchPageQuerystring, nref, serviceContext, succeededCallback, failedCallback, userContext) {
        return this._invoke(this._get_path(), 'GetAccoDetailsSearchResults', false, { searchPageQuerystring: searchPageQuerystring, nref: nref, serviceContext: serviceContext }, succeededCallback, failedCallback, userContext);
    } 
}
NetMatch.Villango.Web09.UI.Services.AccoDetailsSearchResults.registerClass('NetMatch.Villango.Web09.UI.Services.AccoDetailsSearchResults', Sys.Net.WebServiceProxy);
NetMatch.Villango.Web09.UI.Services.AccoDetailsSearchResults._staticInstance = new NetMatch.Villango.Web09.UI.Services.AccoDetailsSearchResults();
NetMatch.Villango.Web09.UI.Services.AccoDetailsSearchResults.set_path = function(value) { NetMatch.Villango.Web09.UI.Services.AccoDetailsSearchResults._staticInstance.set_path(value); }
NetMatch.Villango.Web09.UI.Services.AccoDetailsSearchResults.get_path = function() { return NetMatch.Villango.Web09.UI.Services.AccoDetailsSearchResults._staticInstance.get_path(); }
NetMatch.Villango.Web09.UI.Services.AccoDetailsSearchResults.set_timeout = function(value) { NetMatch.Villango.Web09.UI.Services.AccoDetailsSearchResults._staticInstance.set_timeout(value); }
NetMatch.Villango.Web09.UI.Services.AccoDetailsSearchResults.get_timeout = function() { return NetMatch.Villango.Web09.UI.Services.AccoDetailsSearchResults._staticInstance.get_timeout(); }
NetMatch.Villango.Web09.UI.Services.AccoDetailsSearchResults.set_defaultUserContext = function(value) { NetMatch.Villango.Web09.UI.Services.AccoDetailsSearchResults._staticInstance.set_defaultUserContext(value); }
NetMatch.Villango.Web09.UI.Services.AccoDetailsSearchResults.get_defaultUserContext = function() { return NetMatch.Villango.Web09.UI.Services.AccoDetailsSearchResults._staticInstance.get_defaultUserContext(); }
NetMatch.Villango.Web09.UI.Services.AccoDetailsSearchResults.set_defaultSucceededCallback = function(value) { NetMatch.Villango.Web09.UI.Services.AccoDetailsSearchResults._staticInstance.set_defaultSucceededCallback(value); }
NetMatch.Villango.Web09.UI.Services.AccoDetailsSearchResults.get_defaultSucceededCallback = function() { return NetMatch.Villango.Web09.UI.Services.AccoDetailsSearchResults._staticInstance.get_defaultSucceededCallback(); }
NetMatch.Villango.Web09.UI.Services.AccoDetailsSearchResults.set_defaultFailedCallback = function(value) { NetMatch.Villango.Web09.UI.Services.AccoDetailsSearchResults._staticInstance.set_defaultFailedCallback(value); }
NetMatch.Villango.Web09.UI.Services.AccoDetailsSearchResults.get_defaultFailedCallback = function() { return NetMatch.Villango.Web09.UI.Services.AccoDetailsSearchResults._staticInstance.get_defaultFailedCallback(); }
NetMatch.Villango.Web09.UI.Services.AccoDetailsSearchResults.set_path("/ui/services/AccoDetailsSearchResults.svc");
NetMatch.Villango.Web09.UI.Services.AccoDetailsSearchResults.GetAccoDetailsSearchResults = function(searchPageQuerystring, nref, serviceContext, onSuccess, onFailed, userContext) { NetMatch.Villango.Web09.UI.Services.AccoDetailsSearchResults._staticInstance.GetAccoDetailsSearchResults(searchPageQuerystring, nref, serviceContext, onSuccess, onFailed, userContext); }
var gtc = Sys.Net.WebServiceProxy._generateTypedConstructor;
Type.registerNamespace('NetMatch.Villango.Web.UI.Services');
if (typeof (NetMatch.Villango.Web.UI.Services.UIServiceContext) === 'undefined') {
    NetMatch.Villango.Web.UI.Services.UIServiceContext = gtc("UIServiceContext:http://schemas.datacontract.org/2004/07/NetMatch.Villango.Web.UI.Services");
    NetMatch.Villango.Web.UI.Services.UIServiceContext.registerClass('NetMatch.Villango.Web.UI.Services.UIServiceContext');
}
Type.registerNamespace('netmatch.villango.web.ui.services');
if (typeof (netmatch.villango.web.ui.services.accodetailssearchresultsresponse) === 'undefined') {
    netmatch.villango.web.ui.services.accodetailssearchresultsresponse = gtc("AccoDetailsSearchResultsResponse:http://NetMatch.Villango.Web.UI.Services");
    netmatch.villango.web.ui.services.accodetailssearchresultsresponse.registerClass('netmatch.villango.web.ui.services.accodetailssearchresultsresponse');
}

Type.registerNamespace('NetMatch.Villango.Web.UI.Services');
NetMatch.Villango.Web.UI.Services.Rating = function() {
    NetMatch.Villango.Web.UI.Services.Rating.initializeBase(this);
    this._timeout = 0;
    this._userContext = null;
    this._succeeded = null;
    this._failed = null;
}
NetMatch.Villango.Web.UI.Services.Rating.prototype = {
    _get_path: function() {
        var p = this.get_path();
        if (p) return p;
        else return NetMatch.Villango.Web.UI.Services.Rating._staticInstance.get_path();
    },
    GetRatingDetails: function(serviceContext, ratingValues, accoName, clientIdRatingContainer, mouseClickPositionY, succeededCallback, failedCallback, userContext) {
        return this._invoke(this._get_path(), 'GetRatingDetails', false, { serviceContext: serviceContext, ratingValues: ratingValues, accoName: accoName, clientIdRatingContainer: clientIdRatingContainer, mouseClickPositionY: mouseClickPositionY }, succeededCallback, failedCallback, userContext);
    } 
}
NetMatch.Villango.Web.UI.Services.Rating.registerClass('NetMatch.Villango.Web.UI.Services.Rating', Sys.Net.WebServiceProxy);
NetMatch.Villango.Web.UI.Services.Rating._staticInstance = new NetMatch.Villango.Web.UI.Services.Rating();
NetMatch.Villango.Web.UI.Services.Rating.set_path = function(value) { NetMatch.Villango.Web.UI.Services.Rating._staticInstance.set_path(value); }
NetMatch.Villango.Web.UI.Services.Rating.get_path = function() { return NetMatch.Villango.Web.UI.Services.Rating._staticInstance.get_path(); }
NetMatch.Villango.Web.UI.Services.Rating.set_timeout = function(value) { NetMatch.Villango.Web.UI.Services.Rating._staticInstance.set_timeout(value); }
NetMatch.Villango.Web.UI.Services.Rating.get_timeout = function() { return NetMatch.Villango.Web.UI.Services.Rating._staticInstance.get_timeout(); }
NetMatch.Villango.Web.UI.Services.Rating.set_defaultUserContext = function(value) { NetMatch.Villango.Web.UI.Services.Rating._staticInstance.set_defaultUserContext(value); }
NetMatch.Villango.Web.UI.Services.Rating.get_defaultUserContext = function() { return NetMatch.Villango.Web.UI.Services.Rating._staticInstance.get_defaultUserContext(); }
NetMatch.Villango.Web.UI.Services.Rating.set_defaultSucceededCallback = function(value) { NetMatch.Villango.Web.UI.Services.Rating._staticInstance.set_defaultSucceededCallback(value); }
NetMatch.Villango.Web.UI.Services.Rating.get_defaultSucceededCallback = function() { return NetMatch.Villango.Web.UI.Services.Rating._staticInstance.get_defaultSucceededCallback(); }
NetMatch.Villango.Web.UI.Services.Rating.set_defaultFailedCallback = function(value) { NetMatch.Villango.Web.UI.Services.Rating._staticInstance.set_defaultFailedCallback(value); }
NetMatch.Villango.Web.UI.Services.Rating.get_defaultFailedCallback = function() { return NetMatch.Villango.Web.UI.Services.Rating._staticInstance.get_defaultFailedCallback(); }
NetMatch.Villango.Web.UI.Services.Rating.set_path("/ui/services/Rating.svc");
NetMatch.Villango.Web.UI.Services.Rating.GetRatingDetails = function(serviceContext, ratingValues, accoName, clientIdRatingContainer, mouseClickPositionY, onSuccess, onFailed, userContext) { NetMatch.Villango.Web.UI.Services.Rating._staticInstance.GetRatingDetails(serviceContext, ratingValues, accoName, clientIdRatingContainer, mouseClickPositionY, onSuccess, onFailed, userContext); }
var gtc = Sys.Net.WebServiceProxy._generateTypedConstructor;
if (typeof (NetMatch.Villango.Web.UI.Services.UIServiceContext) === 'undefined') {
    NetMatch.Villango.Web.UI.Services.UIServiceContext = gtc("UIServiceContext:http://schemas.datacontract.org/2004/07/NetMatch.Villango.Web.UI.Services");
    NetMatch.Villango.Web.UI.Services.UIServiceContext.registerClass('NetMatch.Villango.Web.UI.Services.UIServiceContext');
}


/*
1. FavoritesList control. 
*/

NetMatch.Villango.FavoritesList = function(element) {
    NetMatch.Villango.FavoritesList.initializeBase(this, [element]);

    // The WebService
    this._WebService = NetMatch.Villango.Web09.UI.Services.Favorites;

    // Path of the current page		
    this._CurrentPath = null;

    // The active site variation code
    this._SiteVariationCode = null;
    this._ServiceContext = null;

    // Initialized on the control.
    this._AddedToFavoriteText = null;
    this._AddedToFavoriteClassName = null;
    this._AddedToFavoriteFirstChildClass = null;
    this._UserContextTopFavoritesCountClientId = null;
    this._IncludeLatestFavoriteInResponse = null;
}

NetMatch.Villango.FavoritesList.prototype = {
    initialize: function() {
        NetMatch.Villango.FavoritesList.callBaseMethod(this, 'initialize');

        // Initialize the webservice reference. 
        // We pass the current control id (get_id()) + this._UserContextTopFavoritesCountClientId as usercontext to the callback method, 
        // as a reference to the (this) control that invoked the webservice.         
        // This is needed because the webservice returns asynchronously and we do not have a control reference anymore in the callback.
        this._WebService.set_defaultSucceededCallback(this.SucceededCallback);
        this._WebService.set_defaultFailedCallback(this.FailedCallback);
        this._WebService.set_defaultUserContext(this.get_id() + '|' + this._UserContextTopFavoritesCountClientId);

        // Create the UIServiceContext
        this._ServiceContext = new NetMatch.Villango.Web.UI.Services.UIServiceContext(); // Defined in FavoritesList.svc/js
        this._ServiceContext.SiteVariationCode = this._SiteVariationCode;
        this._ServiceContext.CurrentPath = this._CurrentPath;

        // Load the user's favorites
        this.getLatestFavorites();
    },
    dispose: function() {
        //Add custom dispose actions here
        NetMatch.Villango.FavoritesList.callBaseMethod(this, 'dispose');
    }
}

/// <summary>
/// Gets the user's favorites from the Favorites.svc webservice. 
/// </summary>
NetMatch.Villango.FavoritesList.prototype.getLatestFavorites = function() {
    this._WebService.GetLatestFavorites(this._ServiceContext, this._IncludeLatestFavoriteInResponse);
}

/// <summary>
/// Adds the specified object to the user's favorites using the Favorites.svc webservice and updates
/// the user interface to reflect this.
/// </summary>
NetMatch.Villango.FavoritesList.prototype.addFavorite = function(accoItemId, addToFavoritesClientId) {
    var lAccoItemCmsId = parseInt(accoItemId);

    this._WebService.AddFavorite(lAccoItemCmsId, this._ServiceContext, this._IncludeLatestFavoriteInResponse);

    // Hide the hyperlink to make sure the user can't click more than once.
    var lAddToFavoritesControl = document.getElementById(addToFavoritesClientId);
    if (lAddToFavoritesControl != null) {

        // Make the addFavorite readonly
        lAddToFavoritesControl.className = this._AddedToFavoriteClassName;
        lAddToFavoritesControl.onclick = '';

        var lChildren;

        // In case search page
        var i;
        lChildren = lAddToFavoritesControl.getElementsByTagName('SPAN');
        for (i = 0; i < lChildren.length; i++) {
            lChildren[i].innerHTML = "&nbsp;";
            lChildren[i].title = this._AddedToFavoriteText;
            if (this._AddedToFavoriteFirstChildClass != null && this._AddedToFavoriteFirstChildClass != undefined && this._AddedToFavoriteFirstChildClass != '') {
                lChildren[i].className = this._AddedToFavoriteFirstChildClass;
            }
        }

        // In case acco Details page
        lChildren = lAddToFavoritesControl.getElementsByTagName('A');
        for (i = 0; i < lChildren.length; i++) {
            lChildren[i].innerHTML = this._AddedToFavoriteText;
        }
    }
}

/// <summary>
/// Adds the specified objects to the user's favorites using the Favorites.svc webservice and updates
/// the user interface to reflect this.
/// </summary>	
/// <param name="selectedAccommodationItems">Instance variable of class SelectedAccommodationItems defined in general.js</param>
/// <param name="addToFavoritesClientId">The clientId containing the html.</param>
NetMatch.Villango.FavoritesList.prototype.addMultipleFavorites = function(event, selectedAccommodationItemsArray, noTripsSelectedPopupClientId) {

    if (selectedAccommodationItemsArray.length > 0) {
        this._WebService.AddMultipleFavorites(selectedAccommodationItemsArray, this._ServiceContext, this._IncludeLatestFavoriteInResponse);
        var lAccommodationIndex;

        // Foreach accommodation, find the matching tag button at the page, and disable it
        for (lAccommodationIndex = 0; lAccommodationIndex < selectedAccommodationItemsArray.length; lAccommodationIndex++) {

            // THe tag name of each favorite is concat of 'TagFavorite' and the Accommodation CMS Id
            var lMatchingTagName = 'TagFavorite-' + selectedAccommodationItemsArray[lAccommodationIndex];
            var lQueryExpr = "div[name='" + lMatchingTagName + "']";

            // Matching the div element of this Accommodation
            var lMatchingTags = $(lQueryExpr);

            // If found exactly one element disable it.
            if (lMatchingTags != null && lMatchingTags.length == 1) {
                var lAddToFavoritesControl = lMatchingTags[0];
                if (lAddToFavoritesControl != null) {
                    // Make the addFavorite readonly
                    lAddToFavoritesControl.className = this._AddedToFavoriteClassName;
                    lAddToFavoritesControl.onclick = '';

                    var lChildren;

                    // In case search page
                    var i;
                    lChildren = lAddToFavoritesControl.getElementsByTagName('SPAN');
                    for (i = 0; i < lChildren.length; i++) {
                        lChildren[i].innerHTML = "&nbsp;";
                        lChildren[i].title = this._AddedToFavoriteText;
                        if (this._AddedToFavoriteFirstChildClass != null && this._AddedToFavoriteFirstChildClass != undefined && this._AddedToFavoriteFirstChildClass != '') {
                            lChildren[i].className = this._AddedToFavoriteFirstChildClass;
                        }
                    }

                    // In case acco Details page
                    lChildren = lAddToFavoritesControl.getElementsByTagName('A');
                    for (i = 0; i < lChildren.length; i++) {
                        lChildren[i].innerHTML = this._AddedToFavoriteText;
                    }
                }
            }
        }
    }
    else {
        // Function openFloatingPopup is defined in general.js.
        openFloatingPopup(event, noTripsSelectedPopupClientId, undefined, undefined);
    }
}

NetMatch.Villango.FavoritesList.prototype.deleteAllFavorites = function() {
    // Assign an event when the call is done.
    this._WebService.set_defaultSucceededCallback(this.DeleteFavoritesSucceededCallback);

    /// <summary>Deletes all favorites for a website user.</summary>
    this._WebService.DeleteAllFavorites(this._ServiceContext);
}

NetMatch.Villango.FavoritesList.prototype.deleteSelectedFavorites = function(event, selectedAccommodationItemsArray, noTripsSelectedPopupClientId) {
    if (selectedAccommodationItemsArray.length > 0) {
        // Assign an event when the call is done.
        this._WebService.set_defaultSucceededCallback(this.DeleteFavoritesSucceededCallback);

        this._WebService.DeleteSelectedFavorites(this._ServiceContext, selectedAccommodationItemsArray);
    }
    else {
        // Function openFloatingPopup is defined in general.js.
        openFloatingPopup(event, noTripsSelectedPopupClientId, undefined, undefined);
    }
}

/// <summary>
/// Called when the GetLatestFavorites() or AddFavorite() webservice method returns. 
/// Updates the inner html of the root element.
/// </summary>
NetMatch.Villango.FavoritesList.prototype.SucceededCallback = function(result, userContext) {
    // Split the user context, since we have persisited multiple client ids
    var lControlsArray = userContext.split("|");

    // Step1: Update the html in the guided navigation
    var lFavoritesInGuidedNav = $get(lControlsArray[0]);
    if (lFavoritesInGuidedNav != null) {
        if (result == null || result.Html == null) {
            lFavoritesInGuidedNav.innerHTML = '';
        }
        else {
            var lUserContextElement = document.getElementById('usercontext');
            if (lUserContextElement != null) lUserContextElement.style.display = 'block';

            lFavoritesInGuidedNav.innerHTML = result.Html;
            PersistTabState('userFavorites', 'closed', 'VillangoTabUserPreferences');
        }
    }

    // Step2: Update the count in the user context top
    var lUserContextTopFavCnt = $('#' + lControlsArray[1]);
    lUserContextTopFavCnt.html(result.FavoritesCount);
}

NetMatch.Villango.FavoritesList.prototype.DeleteFavoritesSucceededCallback = function() {
    // Refresh the page.
    window.location.reload(true);
}

NetMatch.Villango.FavoritesList.prototype.FailedCallback = function() {
    /// <summary>Called when the GetRandomObjectHtml() webservice method fails.</summary>	
    // TODO: provide error handling
}

NetMatch.Villango.FavoritesList.registerClass('NetMatch.Villango.FavoritesList', Sys.UI.Control);


/*
End of	FavoritesList control.
*/






/*
2. ViewedTrips control. 
*/
NetMatch.Villango.ViewedTrips = function(element) {
    NetMatch.Villango.ViewedTrips.initializeBase(this, [element]);

    // fields		
    this._WebService = NetMatch.Villango.Web09.UI.Services.ViewedTrips;
    // Path of the current page		
    this._CurrentPath = null;

    // The active site variation code
    this._SiteVariationCode = null;
    this._ServiceContext = null;
    this._AccoItemId = 0;
    this._UserContextTopViewedTripsCountClientId = null;
    this._ReturnLatestViewedTripHtml = null;
}

NetMatch.Villango.ViewedTrips.prototype = {
    initialize: function() {
        NetMatch.Villango.ViewedTrips.callBaseMethod(this, 'initialize');
        // Initialize the webservice reference. We pass the current control id (get_id()) as usercontext to the callback 
        // method, as a reference to the (this) control that invoked the webservice. This is needed because the webservice returns asynchronously and
        // we do not have a control reference anymore in the callback.
        this._WebService.set_defaultSucceededCallback(this.SucceededCallback);
        this._WebService.set_defaultFailedCallback(this.FailedCallback);
        this._WebService.set_defaultUserContext(this.get_id() + '|' + this._UserContextTopViewedTripsCountClientId);

        // The service context
        this._ServiceContext = new NetMatch.Villango.Web.UI.Services.UIServiceContext(); // Defined in ViewedTrips.svc/js ==> JSON on WCF
        this._ServiceContext.SiteVariationCode = this._SiteVariationCode;
        this._ServiceContext.CurrentPath = this._CurrentPath;

        if (this._AccoItemId > 0) {
            // We are on the accommodation details page. 
            // The current accommodation will be added to the viewed trips.
            // The viewed trips will be presented to the website user.
            this.addViewedTrip();
        }
        else {
            // We are on any page except the accommodation details page.
            // The viewed accommodation will presented to the website user.
            this.getLatestViewedTrip();
        }
    },
    dispose: function() {
        //Add custom dispose actions here
        NetMatch.Villango.ViewedTrips.callBaseMethod(this, 'dispose');
    }
}

/// <summary>
/// Gets the user's latest viewed trip from the ViewedTrips.svc webservice. 
/// </summary>
NetMatch.Villango.ViewedTrips.prototype.getLatestViewedTrip = function() {
this._WebService.GetLatestViewedTrip(this._ServiceContext, this._AccoItemId, this._ReturnLatestViewedTripHtml);
}

/// <summary>
/// Gets the user's latest viewed trip from the ViewedTrips.svc webservice. 
/// </summary>
NetMatch.Villango.ViewedTrips.prototype.addViewedTrip = function() {
this._WebService.AddViewedTrip(this._ServiceContext, this._AccoItemId, this._ReturnLatestViewedTripHtml);
}

NetMatch.Villango.ViewedTrips.prototype.deleteAllViewedTrips = function() {
    // Set the callback
    this._WebService.set_defaultSucceededCallback(this.DeleteSucceededCallback);

    // Delete the viewed trips on the server.
    this._WebService.DeleteAllViewedTrips(this._ServiceContext);
}

NetMatch.Villango.ViewedTrips.prototype.deleteSelectedViewedTrips = function(event, selectedAccommodationItemsArray, noTripsSelectedPopupClientId) {
    // Check if there are items selected to delete.
    if (selectedAccommodationItemsArray.length > 0) {
        // Set the callback
        this._WebService.set_defaultSucceededCallback(this.DeleteSucceededCallback);

        this._WebService.DeleteSelectedViewedTrips(this._ServiceContext, selectedAccommodationItemsArray);
    }
    else {
        // Function openFloatingPopup is defined in general.js.
        openFloatingPopup(event, noTripsSelectedPopupClientId, undefined, undefined);
    }
}

/// <summary>
/// Called when the GetLatestViewedTrip webservice method returns.  
/// Updates the inner html of the root element.
/// </summary>
NetMatch.Villango.ViewedTrips.prototype.SucceededCallback = function(result, userContext) {
    // Split the user context, since we have persisited multiple client ids
    var lControlsArray = userContext.split("|");

    // Step1: Update the html in the guided navigation
    var lViewedTripInGuidedNav = $get(lControlsArray[0]);
    if (lViewedTripInGuidedNav != null) {
        if (result != null && result.Html != null) {
            // Set the html.
            lViewedTripInGuidedNav.innerHTML = result.Html;

            PersistTabState('userHistory', 'closed', 'VillangoTabUserPreferences');

            // Show the div
            var lUserContextDiv = document.getElementById('usercontext');
            if (lUserContextDiv != null) lUserContextDiv.style.display = 'block';
        }
        else {
            lViewedTripInGuidedNav.innerHTML = '';
        }
    }

    // Step 2: Update the User context top
    var lUserContextTopVT = $('#' + lControlsArray[1]);
    lUserContextTopVT.html(result.ViewedTripsCount);
}

NetMatch.Villango.ViewedTrips.prototype.DeleteSucceededCallback = function(result, userContext) {
    // Refresh the page.
    window.location.reload(true);
}

/// <summary>
/// Called when the webservice method fails.
/// </summary>	
NetMatch.Villango.ViewedTrips.prototype.FailedCallback = function() { }

NetMatch.Villango.ViewedTrips.registerClass('NetMatch.Villango.ViewedTrips', Sys.UI.Control);

/*
End of	Viewed Trips control.
*/


/*
3. AccoDetailsSearchResults
*/
NetMatch.Villango.AccoDetailsSearchResults = function(element) {
    NetMatch.Villango.AccoDetailsSearchResults.initializeBase(this, [element]);

    // fields
    this._WebService = NetMatch.Villango.Web09.UI.Services.AccoDetailsSearchResults;
    // Path of the current page		
    this._CurrentPath = null;
    // The active site variation code
    this._SiteVariationCode = null;
    this._ServiceContext = null;
    // Client control ID's.
    this._SearchSuggestionsClientID = null;
    this._ResultActionsClientID = null;
    this._DescriptorsClientID = null;
    // The NREF
    this.nRef = null;
}

NetMatch.Villango.AccoDetailsSearchResults.prototype = {
    initialize: function() {
        NetMatch.Villango.AccoDetailsSearchResults.callBaseMethod(this, 'initialize');
        // Initialize the webservice reference. We pass the current control id (get_id()) as usercontext to the callback 
        // method, as a reference to the (this) control that invoked the webservice. 
        // This is needed because the webservice returns asynchronously and
        // we do not have a control reference anymore in the callback.                               
        this._WebService.set_defaultSucceededCallback(this.SucceededCallback);
        this._WebService.set_defaultFailedCallback(this.FailedCallback);
        this._WebService.set_defaultUserContext(this._SearchSuggestionsClientID + '|' + this._ResultActionsClientID + '|' + this._DescriptorsClientID);
        // the UIServiceContext
        this._ServiceContext = new NetMatch.Villango.Web.UI.Services.UIServiceContext(); // Defined in AccoDetailsSearchResults.svc/js
        this._ServiceContext.SiteVariationCode = this._SiteVariationCode;
        this._ServiceContext.CurrentPath = this._CurrentPath;

        // Load the user's favorites
        this.getAccoDetailsSearchResults();
    },
    dispose: function() {
        //Add custom dispose actions here
        NetMatch.Villango.AccoDetailsSearchResults.callBaseMethod(this, 'dispose');
    }
}

NetMatch.Villango.AccoDetailsSearchResults.prototype.getAccoDetailsSearchResults = function() {
    // Try to get the last search page request.
    var lSearchPageUrl = getCookie('VILASRU');

    // Get the search page results for the pager and the flash component.
    this._WebService.GetAccoDetailsSearchResults(lSearchPageUrl, this.nRef, this._ServiceContext);
}

NetMatch.Villango.AccoDetailsSearchResults.prototype.SucceededCallback = function(result, userContext) {
    // Get the id's for the divs from the user context, these values are stored in the initialize.
    var lControlsArray = userContext.split("|");

    if (result.SearchSuggestionsHtml != undefined && result.SearchSuggestionsHtml != '') {
        var lElement = document.getElementById('usercontext');
        if (lElement != null) lElement.style.display = 'block';
        // Use sethtml to make sure the script in the html is actually executed!
        sethtml(lControlsArray[0], result.SearchSuggestionsHtml);

        PersistTabState('searchSuggestions', 'closed', 'VillangoTabUserPreferences');
    }

    if (result.ResultActionsHtml != undefined && result.ResultActionsHtml != '') {
        var lPagerContainer = document.getElementById(lControlsArray[1]);
        lPagerContainer.innerHTML = result.ResultActionsHtml;
    }

    if (result.DescriptorsHtml != undefined && result.DescriptorsHtml != '') {
        var lDescriptorsContainer = document.getElementById(lControlsArray[2]);
        lDescriptorsContainer.innerHTML = result.DescriptorsHtml;
    }
}

NetMatch.Villango.AccoDetailsSearchResults.prototype.FailedCallback = function() {

}

NetMatch.Villango.AccoDetailsSearchResults.registerClass('NetMatch.Villango.AccoDetailsSearchResults', Sys.UI.Control);


/*
end of AccoDetailsSearchResults control
*/


/*
4. Rating control. 
*/
NetMatch.Villango.Rating = function(element) {
    NetMatch.Villango.Rating.initializeBase(this, [element]);

    // fields		
    this._WebService = NetMatch.Villango.Web.UI.Services.Rating;
    // Path of the current page		
    this._CurrentPath = null;
    // The active site variation code
    this._SiteVariationCode = null;
    this._ServiceContext = null;
}

NetMatch.Villango.Rating.prototype = {
    initialize: function() {
        NetMatch.Villango.Rating.callBaseMethod(this, 'initialize');
        // Initialize the webservice reference. We pass the current control id (get_id()) as usercontext to the callback 
        // method, as a reference to the (this) control that invoked the webservice. This is needed because the webservice returns asynchronously and
        // we do not have a control reference anymore in the callback.
        this._WebService.set_defaultSucceededCallback(this.SucceededCallback);
        this._WebService.set_defaultFailedCallback(this.FailedCallback);
        this._WebService.set_defaultUserContext(this.get_id());
        this._ServiceContext = new NetMatch.Villango.Web.UI.Services.UIServiceContext(); // Defined in Rating.svc/js
        this._ServiceContext.SiteVariationCode = this._SiteVariationCode;
        this._ServiceContext.CurrentPath = this._CurrentPath;
    },
    dispose: function() {
        //Add custom dispose actions here
        NetMatch.Villango.Rating.callBaseMethod(this, 'dispose');
    }
}

$GetRatingDetails = function(clientId, ratingValues, accoName, mouseClickPositionY) {
    /// <summary>Shortcut for the invoking the GetRatingDetails function on the control specified by "clientId". </summary>
    var Control = $find(clientId);
    if (Control != null) Control.getRatingDetailsInternal(ratingValues, accoName, clientId, mouseClickPositionY);
}

NetMatch.Villango.Rating.prototype.getRatingDetailsInternal = function(ratingValues, accoName, clientId, mouseClickPositionY) {
    this._WebService.GetRatingDetails(this._ServiceContext, ratingValues, accoName, clientId, mouseClickPositionY);
}

NetMatch.Villango.Rating.prototype.SucceededCallback = function(result, userContext) {
    /// <summary>Called when the GetRatingDetails() webservice method returns. Updates the inner html of the root element.</summary>
    var ContentElement = $get(userContext);
    if (ContentElement != null) {
        ContentElement.innerHTML = result;
    }
}

NetMatch.Villango.Rating.prototype.FailedCallback = function() {
    /// <summary>Called when the GetRating() webservice method fails.</summary>	
    // TODO: provide error handling
}

NetMatch.Villango.Rating.registerClass('NetMatch.Villango.Rating', Sys.UI.Control);
/*
End of rating control. 
*/



if (typeof (Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();