﻿if (typeof (HotelsInfoControl) == 'undefined') {


	Type.registerNamespace("HotelsInfoControl");


	HotelsInfoControl.FeedByPos = function (element) {
		HotelsInfoControl.FeedByPos.initializeBase(this, [element]);

		this._service = new RoutenetFeedService();
		this._service.set_defaultUserContext(this);
		this._service.set_defaultSucceededCallback(this.ServiceCallbackSucceeded);
		this._service.set_defaultFailedCallback(this.ServiceCallbackFailed);
		this._service.set_timeout(10000);
		this._language = 'nl';
		this._pagesize = 10;
		this._currentindex = 0;
		this._position = null;

	};



	HotelsInfoControl.FeedByPos.prototype = {
		initialize: function () {
			HotelsInfoControl.FeedByPos.callBaseMethod(this, "initialize");
		},
		dispose: function () {
			HotelsInfoControl.FeedByPos.callBaseMethod(this, "dispose");
		},

		get_pagesize: function () {
			return this._pagesize;
		},
		set_pagesize: function (value) {
			this._pagesize = value;
		},

		get_currentindex: function () {
			return this._currentindex;
		},
		set_currentindex: function (value) {
			this._currentindex = value;
		},

		get_language: function () {
			return this._language;
		},
		set_language: function (value) {
			this._language = value;
		},
		get_pos: function () {
			return this._position;
		},
		set_pos: function (x, y) {
			this._position = { x: x, y: y };
		},


		NextPage: function () {
			this._currentindex += this._pagesize;
			this.Update();
		},
		PrevPage: function () {
			this._currentindex -= this._pagesize;
			this.Update();
		},

		Update: function () {
			this._service.HotelsByPosition(this._position.x, this._position.y, this._currentindex, this._pagesize, this._language);
		},

		ServiceCallbackSucceeded: function (result, userContext, methodName) {
			userContext.get_element().innerHTML = result.HTML;
		},
		ServiceCallbackFailed: function (error, userContext, methodName) {
		}


	};

	HotelsInfoControl.FeedByPos.registerClass("HotelsInfoControl.FeedByPos", Sys.UI.Behavior);

	HotelsInfoControl.FeedByRect = function (element) {
		HotelsInfoControl.FeedByRect.initializeBase(this, [element]);

		this._service = new RoutenetFeedService();
		this._service.set_defaultUserContext(this);
		this._service.set_defaultSucceededCallback(this.ServiceCallbackSucceeded);
		this._service.set_defaultFailedCallback(this.ServiceCallbackFailed);
		this._service.set_timeout(10000);
		this._language = 'nl';

		this._pagesize = 10;
		this._currentindex = 0;
		this._rect = null;
	};



	HotelsInfoControl.FeedByRect.prototype = {
		initialize: function () {
			HotelsInfoControl.FeedByRect.callBaseMethod(this, "initialize");
		},
		dispose: function () {
			HotelsInfoControl.FeedByRect.callBaseMethod(this, "dispose");
		},

		get_pagesize: function () {
			return this._pagesize;
		},
		set_pagesize: function (value) {
			this._pagesize = value;
		},

		get_currentindex: function () {
			return this._currentindex;
		},
		set_currentindex: function (value) {
			this._currentindex = value;
		},

		get_language: function () {
			return this._language;
		},
		set_language: function (value) {
			this._language = value;
		},

		get_rect: function () {
			return this._rect;
		},
		set_rect: function (value) {
			this._rect = value;
		},

		NextPage: function () {
			this._currentindex += this._pagesize;
			this.Update();
		},
		PrevPage: function () {
			this._currentindex -= this._pagesize;
			this.Update();
		},

		Update: function () {
			this._service.HotelsByRect(this._rect.toString(), this._currentindex, this._pagesize, this._language);
		},

		ServiceCallbackSucceeded: function (result, userContext, methodName) {
			userContext.get_element().innerHTML = result.HTML;
		},
		ServiceCallbackFailed: function (error, userContext, methodName) {
		}


	};

	HotelsInfoControl.FeedByRect.registerClass("HotelsInfoControl.FeedByRect", Sys.UI.Behavior);
}


	


