/*
 *
 * C 2009 Open Hospitality, Inc.  All rights reserved.
 *
 */
$(document).ready(function () {

    $('#pdrooms').change(function () {
        if (parseInt($('#pdrooms').val(), 10) != 1) {
			/*
			var currentform = $(this).closest('form');
            var currentaction = $(currentform).attr('action');
            $(currentform).attr('action', currentaction + $.query.set("multiroomversion", 1).toString());
            $(currentform).attr('action', currentaction + $.query.set("multiroomversion", 1).toString().replace("?", "&"));
			*/
            $('#occupancy').hide();
        } else {
            $('#occupancy').show();
        }
    });

    $('#pdrooms').parents("form").submit(function () {
        var currentaction = $(this).attr("action");
        if (parseInt($('#pdrooms').val(), 10) != 1) {
            $(this).attr('action', currentaction + $.query.set("multiroomversion", 1).toString().replace("?", "&"));
        }
    });

    $('#teaserSubmit').click(function () {
        var promo = document.getElementById('pdpromocode').value;
        if (promo == "Promo/Group Code") {
            document.getElementById('pdpromocode').value = "";
        }
    });
    $('#pdpromocode').addClass("idleField");
    $('#pdpromocode').focus(function () {
        $(this).removeClass("idleField").addClass("focusField");
        if (this.value == this.defaultValue) {
            this.value = '';
        }
        if (this.value != this.defaultValue) {
            this.select();
        }
    });
    $('#pdpromocode').blur(function () {
        $(this).removeClass("focusField").addClass("idleField");
        if ($.trim(this.value) == '') {
            this.value = (this.defaultValue ? this.defaultValue : '');
        }
    });

});


