/* Home Dispay object */ 
var displayHome = {
	TagUrlJson : "",
/* initialization functions */
		
	  init : function(){
		  displayHome.showRoomOptions();		   		 
	 },
 
 
/* bookingEngine : show and hide more criteria */
	showRoomOptions :function(){
		jQuery('#engine-criteres a').click(function() {
			if (jQuery('#more-criteria').is(":hidden")) { 
				jQuery('#more-criteria').slideDown("slow");                    
				jQuery('#engine-criteres').hide();                    
				jQuery('.roomServices').slideDown("slow");     
				jQuery('#more-criteria p').removeClass("deploy").addClass("undeploy");                         
			} else { 
				jQuery('#more-criteria').slideUp("slow");                                       
				jQuery('#engine-criteres').show();                                  
			}
		});
		jQuery('#more-criteria').click(function() {
			if (jQuery('.roomOptions').is(":hidden")) {
				jQuery('.roomOptions').slideDown();                                                              

			} else {
				jQuery('.roomServices').slideUp("slow");                                          
				jQuery('#more-criteria').slideUp("slow");
				jQuery('#advanced-search').slideUp("slow");
				jQuery('#engine-criteres').slideDown();
			}
		});
	},
	
	callback: function () {
		if (jQuery('.roomServices .codePref input:eq(0)').val() != "" || jQuery('.roomServices .tServicesSelect input:checked').length) {
			jQuery('#engine-criteres a').trigger("click");
		}
			
	}
	
}
 
var homeBookingEngine;



/* calling jQuery and the other library  */
jQuery.noConflict();
jQuery(document).ready(function(){     
	/* initialization tooltip */
	utils.tooltips.init();  

	/* initialization popup & popin  */
	popins.init();
	popups();      
	displayHome.init();   
	homeBookingEngine = new BookingEngine("bookingEngine", "homeBookingEngine", true);
	ajaxRequest._executeByUrl("/bean/getViewBeans.action?beans=SearchCriteriaViewBean|OriginViewBean","validatorInvalidState","homeBookingEngine.success(errors, response); displayHome.callback()"); 

            
}); 


