



var layer_geo = new Layer("geo_search", "link_geo_search");
var layer_address = new Layer("address_search", "link_address_search");
var layer_poi = new Layer("point_interest_search", "link_point_interest_search");
var searchLayerGroup = new LayerGroup();
searchLayerGroup.setLayerGroup(new Array(layer_geo, layer_address, layer_poi));

var urlCalendarHome_iFrame = '/nh/Layer.Controller?event=3&formName=searchForm&calendarDivName=calendar&fIniVisualInputName=stdate&fIniInputName=fini&fOutVisualInputName=enddate&fOutInputName=fout&startDateDayId=startDateDay&endDateDayId=endDateDay&nnightsName=nights&twoDates=1&twoMonth=1&dateSelectedID=dateSelected';

var SCR_MSG_HOME_ESCRIBA_E_MAIL = 'please enter your e-mail';

function initHome() {
	var f = document.searchForm;

	// back browser
	var stype = f.stype.value;
	if (stype != 1) {
		searchLayerGroup.showSelectedLayer(stype - 1);
	}

	if(f.country1.selectedIndex > 0) {
		changeCountry(f.country1, f.city1, f.hotel1, 'All cities', 'All hotels');
	}

	if(f.country2.selectedIndex > 0)
		changeCountry(f.country2, f.city2, null, 'Select a city', null, jsCitiesSearch);

	if(f.country3.selectedIndex > 0)
		changeCountry(f.country3, f.city3, null, 'Select a city', null, jsCitiesSearch);

	// Init Quick Search Element
	auto = new AutoSuggest(document.getElementById('stext1'), document.searchForm.country1, document.searchForm.city1, document.searchForm.hotel1, quickSearchResults, "submitHomeSearchForm()");
    document.searchForm.stext1.value = 'City, hotel or point of interest' ;
	// Init Banner rotation
	changeAdvertisement();
}

function submitHomeSearchForm() {
	var url = submitSearchForm();
	if (url !== false) document.location.href=url;
}

function submitSuscriber(f) {
    if ( !isValidEmail(f.p_email) ) {
		alert('The email you have entered is not valid');
		return false;
	}
    f.submit();
	//window.location ='/pls/porweb/porweb.NH_SUBSCRIPTION_SCREEN.SCREEN_STEP1?p_idioma=en?p_login='+ email.value;
}