$.widget("ui.hotelsSearchForm", {

  /*********************************************************
                                               init controls
   *********************************************************/

	init_AlCa: function(values) {
		this.controls.AlCa = $('#AlCa').stringSelect({options: formDefaults.AlCa, selectedValue: values.AlCa})
	},


  /*********************************************************
                                              /init controls
   *********************************************************/

	getParams: function() {
		var params = {}

 		this.controls.AlCa.stringSelect('getParams', params)

		return params
	},


	search: function() {
		//window.location.href = '/tour/#tsf='+makeQuery(this.getParams())+';tsr=page=1'
		//hash = ''+location.hash
	},


	init_tsf: function() {
		var tsf = this.tsf = parseQuery(parseHash().tsf || this.getData('last_tsf'))

		var tsf2 = parseHash().tsf2
		if (tsf2) {

			// only keep these in new tsf
			var keep = ['AlCa']

			var tsfNew = {}
			for(var i=0;i<keep.length;i++) {
				var p = keep[i]
				if (this.tsf[p]) tsfNew[p] = this.tsf[p]
			}

			// override variables with tsf2
			tsf2 = parseQuery(tsf2)
			for(var p in tsf2) {
				if (!tsf2.hasOwnProperty(p)) continue
				tsfNew[p] = tsf2[p]
			}

			this.tsf = tsfNew
		}
	},
	
	_init: function() {
		this.init.apply(this, arguments);
	},

    init: function()
    {
      /**
              * read tour search form params from #tsf=
              */
      //this.init_tsf()

      //var values = this.tsf
      //this.controls = {}
	  $.widget.prototype.init.apply(this,arguments)

      this.init_AlCa(values)

      var self = this

      $('#submit-btn-table').click(function() {
        //self.search()
      })

    }


});


