
Ext.onReady(function() {
		
	var context = 'struttura';

	cercaPrenota_init(context);
	
//	// *******************************************************************
//	// Ripristino il valore di default. Serve per IE e il back del browser
//	// che sovrascrive l'impostazione iniziale
//	// *******************************************************************
//	var numberOfNights = document.getElementById("cercaPrenota_struttura_numberOfNights");
//	var default_numberOfNights = document.getElementById("cercaPrenota_struttura_default_numberOfNights");
//
//	var rooms = document.getElementById("cercaPrenota_struttura_rooms");
//	var default_rooms = document.getElementById("cercaPrenota_struttura_default_rooms");
//
//	var productTypes = new Array(); var productTypesDefault = new Array();
//	var adults = new Array();       var adultsDefault = new Array();
//	var children = new Array(); 	var childrenDefault = new Array();
//	var childrenAges = new Array();	var childrenAgesDefault = new Array();
//	for (var i = 1; i <= 5; i++) {
//		productTypes[i] = document.getElementById("cercaPrenota_struttura_room" + i + "_product_type");
//		productTypesDefault[i] = document.getElementById("cercaPrenota_struttura_default_room" + i + "_product_type");
//
//		adults[i] = document.getElementById("cercaPrenota_struttura_room" + i + "_adults");
//		adultsDefault[i] = document.getElementById("cercaPrenota_struttura_default_room" + i + "_adults");
//
//		children[i] = document.getElementById("cercaPrenota_struttura_room" + i + "_children");
//		childrenDefault[i] = document.getElementById("cercaPrenota_struttura_default_room" + i + "_children");
//
//		childrenAges[i] = new Array(); childrenAgesDefault[i] = new Array();
//		for(var j = 1; j <= 4; j++) {
//			childrenAges[i][j] = document.getElementById("cercaPrenota_struttura_room" + i + "_age" + j);
//			childrenAgesDefault[i][j] = document.getElementById("cercaPrenota_struttura_default_room" + i + "_age" + j);
//		}
//	}
//	
//	numberOfNights.value = default_numberOfNights.value;
//	rooms.value = default_rooms.value;
//
//	for (var i = 1; i <= 5; i++) {
//		productTypes[i].value = productTypesDefault[i].value;
//		adults[i].value = adultsDefault[i].value;
//		children[i].value = childrenDefault[i].value;
//
//		for(var j = 1; j <= 4; j++) {
//			childrenAges[i][j].value = childrenAgesDefault[i][j].value;
//		}
//	}
//	// *******************************************************************


	showHideMinPrice(getAccoProductTypeParam());
	
});



/*
 * Ritorna il product type associato al tab selezionato
 */
function getAccoProductTypeParam(){
	if(Ext.getDom("tabCamereCP")['className'].indexOf("ui-tabs-selected")>-1){
		return "Accommodation";
	}else{
		return "Package";
	}
};

	      
function showHideMinPrice(selectedAccoProductType){
	
	//console.log("INVOCATA show HIDE MIN PRICE");
	
	if(Ext.getDom("cpValueMinPriceDiv")==null || Ext.getDom("cpLabelMinPriceDiv")==null){
		return;
	}
	
	if(selectedAccoProductType==lastSearchAccoProductType){
		Ext.getDom("cpValueMinPriceDiv").style.display = "block";
		Ext.getDom("cpLabelMinPriceDiv").style.display = "block";
		if (Ext.getDom("cpBookDiv")) {
			Ext.getDom("cpBookDiv").style.display = "block";
		}
		Ext.getDom("cpValueMinPriceDivEmpty").style.display = "none";
		Ext.getDom("cpLabelMinPriceDivEmpty").style.display = "none";
		if (Ext.getDom("cpBookDivEmpty")) {
			Ext.getDom("cpBookDivEmpty").style.display = "none";
		}
	}else{
		Ext.getDom("cpValueMinPriceDivEmpty").style.display = "block";
		Ext.getDom("cpLabelMinPriceDivEmpty").style.display = "block";
		if (Ext.getDom("cpBookDivEmpty")) {
			Ext.getDom("cpBookDivEmpty").style.display = "block";
		}
		Ext.getDom("cpValueMinPriceDiv").style.display = "none";
		Ext.getDom("cpLabelMinPriceDiv").style.display = "none";
		if (Ext.getDom("cpBookDiv")) {
			Ext.getDom("cpBookDiv").style.display = "none";
		}
	}
};





