/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

var ATC_CA = {

    accomodations:null,
    areas: null,
    peoples: null,


    init: function(){
        jQuery("#left-check-avail").bind('click',ATC_CA.click);

        ATC_CA.accomodations = jQuery("select#ca_accomodations");
        ATC_CA.areas = jQuery("select#ca_areas");
        ATC_CA.peoples = jQuery("select#ca_peoples");
    },

    click: function(evt){
        evt.preventDefault();
        var a = ATC_CA.accomodations.val();
        var b = ATC_CA.areas.val();
        var c = ATC_CA.peoples.val();

        if( a != "0"){
            location.href = a;
            return;
        }

        if( b != "0"){

            var uri = b;
            if(c != 0)uri += "?peoples="+c;

            location.href = uri;
            return;
        }


    }
}


jQuery(document).ready(function(){
ATC_CA.init();
});



