// ###########################  OBJETO DE CONFIGURACION #################################

configForm = {
	productsOffered 		:	'|H|F|HF|',
	defautlProduct			:	'HF',
	selectedProduct			:	'HF',
	autocompleteOrigenMode	:	'airport',
	autocompleteDestinoMode	:	'city',
	missingFieldMessage		:	'Los campos marcados con rojo son requeridos:\n\n',
	defaultflightType		:	'redondo',
	ajaxURL					: 	location.href.split("/")[0]+"//"+location.href.split("/")[2] + '/gbgwl/hierarchylocationsearch.do',
	myLocation				: 	location.href.split("/")[0]+"//"+location.href.split("/")[2] + '/gbgwl/common/landing.jsp?wl=one',
	spinerURL				:	location.href.split("/")[0]+"//"+location.href.split("/")[2] + '/theme/html_one/site/configuracion/spinner/loader.swf',
	//spinerURL				:	'http://www.globogo.com/theme/images/common/spinner/loader.swf',
	inputDestinoHiden		:	'destinoHidden',
	inputOrigenHiden		:	'origenHidden',
	HotelChildMaxAge		:	'11',
	HotelInfantMaxAge		:	'1',
	PackageChildMaxAge		:	'11',
	PackageInfantMaxAge		:	'1',
	AirChildMaxAge			:	'11',
	AirInfantMaxAge			: 	'1',
	GoogleAnalyticsAccount	:	'',
	siteTitle				:   'globoGO'
};

//-----------------------------------------------------------------------------------------

$(function(){
	configForm.siteTitle= $('#siteTitle').get(0).value;
	document.title = configForm.siteTitle;
	configForm.productsOffered = $('#productTypesOffered').get(0).value;
	configForm.defautlProduct = $('#defaultProductType').get(0).value;
	configForm.selectedProduct = $('#defaultProductType').get(0).value;
	configForm.HotelChildMaxAge= $('#HotelChildMaxAge').get(0).value;
	configForm.HotelInfantMaxAge= $('#HotelInfantMaxAge').get(0).value;
	configForm.PackageChildMaxAge= $('#PackageChildMaxAge').get(0).value;
	configForm.PackageInfantMaxAge= $('#PackageInfantMaxAge').get(0).value;
	configForm.AirChildMaxAge= $('#AirChildMaxAge').get(0).value;
	configForm.AirInfantMaxAge= $('#AirInfantMaxAge').get(0).value;
	configForm.GoogleAnalyticsAccount= $('#GoogleAnalyticsAccount').get(0).value;
	
	initialize();
});




// ###################	 INICIALIZACION DEL CALENDARIO ########################################

$(function(){
	$('#fecha-Inicio').datePicker({clickInput:true,createButton:false});
	$('#fecha-Fin').datePicker({clickInput:true,createButton:false});
	$('.date-pick').datePickerMultiMonth({numMonths: 2});
	$('.date-pick').dpSetOffset(0, 115);
    $('.date-pick').dpSetPosition($.dpConst.POS_AUTO, $.dpConst.POS_AUTO);
});

// ----------------------------------------------------------------------------------------------

// ###################	 INICIALIZACION AUTOCOMPLETADO DE LOCALIDADES ###########################

$(function (){
	$('input#origen').jSuggest({
			url: 		configForm.ajaxURL + "?locationType=" + configForm.autocompleteOrigenMode + "&searchableOnly=false",
			type: 		"GET",
			data: 		"ajaxSearch", 
			autoChange:	false,
			id: 		"origen"
		});	
	
});


$.fn.jSuggest.defaults = {
		minchar: 3,
		opacity: 1.0,
		zindex: 20000,
		delay: 0,
		loadingImg: 'images/ajax-loader.gif',
		loadingText: 'Cargando...',
		autoChange: true,
		url: "",
		type: "GET",
		data: ""
	};

//--------------------------------------------------------------------------------------------------

