  	$(document).ready(function(){
    	/*$("#shd > ul").tabs();*/

      attachCalendar('shd');

	    $("#shd").submit(function() { 
					var city = "";
          var country = "";

          for (i = 0; i < this.elements['dst'].length; ++i) {
						if (this.elements['dst'][i].checked) {
							var d = this.elements['dst'][i].value.split(",");

              if (d.length == 2) {
								city = d[0];
								country = d[1];
							}
							break;
						}
					}

				  if ((city == '' && this.elements['city'].value == '') || this.elements['checkin'].value == '' || this.elements['checkout'].value == '') return false;

				  var ds = $.datepicker.parseDate('yy-mm-dd', this.elements['checkin'].value);
					var de = $.datepicker.parseDate('yy-mm-dd', this.elements['checkout'].value);

					if (de.getTime() < ds.getTime()) return false;

					this.elements['doa_dd'].value = ds.getDate();
					this.elements['doa_mm'].value = ds.getMonth()+1;
					this.elements['doa_yy'].value = ds.getFullYear();

					this.elements['dod_dd'].value = de.getDate();
					this.elements['dod_mm'].value = de.getMonth()+1;
					this.elements['dod_yy'].value = de.getFullYear();

					this.elements['checkin'].disabled = true;
					this.elements['checkout'].disabled = true;

					if (this.elements['city'].value == '') {
						this.elements['city'].value = city;
						this.elements['country'].value = country;
					}
         
				  return true;
			});

  	});


