function DatesInit()
{
    $('#txtCheckIn').datePicker().dpSetSelected($('#txtCheckIn')[0].value);
    $('#txtCheckOut').datePicker().dpSetSelected($('#txtCheckOut')[0].value);
    $('#txtCheckIn').bind(
		'dpClosed',
		function(e, selectedDates) {
		    var d = selectedDates[0];
		    if (d) {
		        d = new Date(d);
		        $('#txtCheckOut').dpSetStartDate(d.addDays(1).asString());
		    }
		}
	);
		$('#txtCheckOut').bind(
		'dpClosed',
		function(e, selectedDates) {
		    var d = selectedDates[0];
		    if (d) {
		        d = new Date(d);
		        $('#txtCheckIn').dpSetEndDate(d.addDays(-1).asString());
		    }
		}
	);
}

    var sCurrControlName='';
    var ChosenCity='';
    var ChosenLocation='';

function LoadHotDeals()
{
        var oControl = $("#dHotDeals");
        oControl.fadeOut('slow');
        var sURL = '/AJAX/GetHotDeals/' + getText($('#cboCities')[0]);
        $.get(sURL, function(data) 
        {
        oControl.html(data);
        oControl.fadeIn('fast');
	})
}

function cboSet(ctlId,ctlValue)
{
$(ctlId).val(ctlValue);
}

    function LoadOptions(ParentControlText, ControlName) 
    {
        sCurrControlName = ControlName;
        var oControl = $("#" + ControlName);
        oControl.fadeOut('slow');
	$('#btnSub')[0].disabled=true;
        var sURL = '/AJAX/Get' + ControlName.replace('cbo','') + '/' + ParentControlText;
        $.get(sURL, function(data) 
        {
        oControl.html(data);
        oControl.fadeIn('fast');
	$('#btnSub')[0].disabled=false;

	if (sCurrControlName == 'cboLocations' && ChosenLocation!='')
		{
		if ($.browser.msie)
			setTimeout("cboSet('#cboLocations','" + ChosenLocation + "')",1);
		else
			$('#cboLocations').val(ChosenLocation);
		ChosenLocation='';
		}

	var tempCity;
tempCity = ChosenCity;
        if (sCurrControlName == 'cboCities') 
	    {
	    if (ChosenCity!='') 
		{
		if ($.browser.msie)
			setTimeout("cboSet('#cboCities','" + ChosenCity + "')",1);
		else
			$('#cboCities').val(ChosenCity);
		}
		ChosenCity = '';
            LoadOptions(tempCity, 'cboLocations');
	    LoadHotDeals();
	    }

        })
    }

    //get select box's text
    function getText(selBox) {
        return selBox[selBox.selectedIndex].text;
    }


    //get select box's value
    function getValue(selBox) {
        return selBox[selBox.selectedIndex].value;
    }
