function SB_ataGlanceSearch_initExec() {
	searchText 	= new Object();
	searchPrefs	= new Object();
	select_current = new Array();
	captureSearchText(searchText);
	captureSearchPrefs(searchPrefs);
	if(window.addEventListener){window.addEventListener("load",setAdult,false);}
	else if(window.attachEvent){window.attachEvent("onload",setAdult);}
}

	function setAdult(){
		if ((document.skylightsForm.page.value=="COMPACT" || document.skylightsForm.page.value=="AGENCY_PROFILE") && (document.skylightsForm.mode.value=='')) {
			document.getElementById('ADULTSelect').value='1';
		}
	}


	function resetCalendars () {
		if(document.skylightsForm.mode.value && (document.getElementById('mode') != null && document.getElementById('mode').value != "SNV")) {
			var dt = new Date();

			if (calObj1!=null || calObj2!=null) {
				document.getElementById('displayDate1').value = formatDate(dt,window.CP_dateFormat);
				document.getElementById('departDay1Select').value = LZ(dt.getDate());
				document.getElementById('departMonth1Select').value = ""+dt.getFullYear()+LZ(dt.getMonth()+1);
				document.getElementById('displayDate2').value = document.getElementById('displayDate1').value;
				document.getElementById('departDay2Select').value = document.getElementById('departDay1Select').value;
				document.getElementById('departMonth2Select').value = document.getElementById('departMonth1Select').value;
		
			}
		}

	}

	function emulate(e) {
		for (var i=0, option; option = e.options[i]; i++) {
			if (option.value == 'separador' || option.value == 'connex') {
				option.style.color = "graytext";
			}
			else {
				option.style.color = "menutext";
			}
		}
	}

	function restore(e) {
		if (e.options[e.selectedIndex].value == 'separador' || e.options[e.selectedIndex].value == 'connex') {
			e.selectedIndex = select_current[e.id];
		}
		else
		{
			select_current[e.id] = e.selectedIndex;
		}
	}

	function setConnexGroup(m) {
		var select		= document.getElementById( "to" + m + "Select" );
		select_current = new Array();
		select.onchange = function(){ restore(select); }
	}
	
	function setDest( mkt )
	{
		resetCalendars();
		var toList = document.getElementById( "to" + mkt + "Select" );
		eval( "document.skylightsForm.toCity" + mkt + ".value = toList.value" );
	}
	function resetDest( mkt )
	{
		if (typeof order_connections_conf == 'undefined') order_connections_conf = 1;
		var order_connections = order_connections_conf; //Sort airports separately or together.
		//var order_connections = 1; //Sort airports separately or together.
		
	    resetCalendars();


		var fromList		= document.getElementById( "from" + mkt + "Select" );
		if (!fromList)
		{
			return;
		}
		var toList		= document.getElementById( "to" + mkt + "Select" );
		var orig		= fromList.options[ fromList.selectedIndex ].value;
		var dest		= eval( "document.skylightsForm.toCity" + mkt + ".value" );
		if( typeof toOrig != 'undefined' && toOrig != '???' )
			dest = toOrig;
		
		if (order_connections == 0){
			var first_opt = toList.options[0].text;
			toList.innerHTML = "";
			toList.options[0] = new Option( first_opt );
		}
		
		if (fromList.options.length > 2)
		{
			toList.length	= 1;
			var opt = '';
			if( document.skylightsForm.frdisc )
			{
				opt = document.skylightsForm.frdisc.options[document.skylightsForm.frdisc.selectedIndex].value;
			};
			var resi = (document.skylightsForm.isresi && document.getElementById('isresi').checked ) || ( opt == "res" || opt == "famres1" || opt == "famres2" );
			var famnum = ( opt == "fam1" || opt == "fam2" );
			var submode = (document.skylightsForm.submode);
			if ( fromList.selectedIndex == 0 )
			{
			
				if( resi )
				{
					airports = AirportsResidents;
					airportsgroup = new Array();
				}
				else if( famnum )
				{
					airports = AirportsFamNum;
					airportsgroup = new Array();
				}
				else if( submode )
				{
					airports = AirportsSubmode;
					airportsgroup = new Array();
				}
				else if( document.getElementById('cFamNum') && document.getElementById('cFamNum').checked=='true' )
				{
					airports = Airports;
					airportsgroup = new Array();
				}
				else
				{
					airports = Airports;
					airportsgroup = AirportsThirdCompanyGroup;

				}
				

				for (var i = 0; i < airports.length; i++)
				{
					toList.length	+= 1;
					var l_ix		= toList.length - 1;
					var opt_str		= airports[i].name;
					
					if ( searchPrefs.DISPLAY_AIRPORT_CITY_CODES == 'true' )
					{
						opt_str		+=  " (" + airports[i].code + ")";
					}
					toList.options[l_ix]	= new Option( opt_str );
					toList.options[l_ix].value	= airports[i].code;
					if ( dest == airports[i].code )
					{
						toList.selectedIndex	= l_ix;
					}
				}

				if(airportsgroup.length > 0 && document.getElementById('cFamNum').checked != true){				
					var l_sep		= toList.length;
					toList.options[l_sep] = new Option("---------------------------------");
					toList.options[l_sep].disabled = "disabled"; 
				
				
                for (var i = 0; i < airportsgroup.length; i++)
				{
					toList.length	+= 1;
					var l_ix		= toList.length - 1;
					var opt_str		= airportsgroup[i].name;
					
					if ( searchPrefs.DISPLAY_AIRPORT_CITY_CODES == 'true' )
					{
						opt_str		+=  " (" + airportsgroup[i].code + ")";
					}
					toList.options[l_ix]	= new Option( opt_str );
					toList.options[l_ix].value	= airportsgroup[i].code;
					if ( dest == airportsgroup[i].code )
					{
						toList.selectedIndex	= l_ix;
					}
				}				
				}
			}
			else
			{
				var air;
			
				if(resi)
				{
					air		= getAirportResidents( orig );
				
				}
				else if( famnum )
				{
					air = getAirportFamNum( orig );
					
				}
				else if( submode )
				{
					air = getAirportSubmode( orig );
					
				}
				else
				{
					air		= getAirport( orig );	
					if( air == null)
					{ 
					  air = getAirportThirdCompanyGroup( orig );
					}
				}			
				
				var air_aux = new Array(air.dests.length);
				for (var i = 0; i < air.dests.length; i++)
				{
					if(air.dests[i] != null)
					{	
						if( resi )
						{
							air_aux[i]		= getAirportResidents( air.dests[i] );
						}
						else if( famnum )
						{
							air_aux[i] = getAirportFamNum( air.dests[i] );
						}
						else if( submode )
						{
							air_aux[i] = getAirportSubmode( air.dests[i] );
						}
						else
						{
							if(document.skylightsForm.mode.value == "CANY"){
								air_aux[i]		= getAirportCany( air.dests[i] );
							}else{
								air_aux[i]		= getAirport( air.dests[i] );
							}
						}
					}
			
				}			
				
				air_aux = trimSortObjArrayConn(orig,air_aux);
				
				if (order_connections == 0){
					var separador = 0;
				}
				
				for (var i = 0; i < air_aux.length; i++)
				{
					if(air_aux[i] != null)
					{
						var dest_air;
						if( resi )
						{
							dest_air		= getAirportResidents( air_aux[i].code );
						}
						else if( famnum )
						{
							dest_air = getAirportFamNum( air_aux[i].code );
						}
						else if( submode )
						{
							dest_air = getAirportSubmode( air_aux[i].code );
						}
						else
						{
							if(document.skylightsForm.mode.value == "CANY"){
								dest_air		= getAirportCany( air_aux[i].code );
							}else{
								dest_air		= getAirport( air_aux[i].code );
							}
						}

											
						if(dest_air != null) {
							toList.length	+= 1;
							var l_ix		= toList.length - 1;
							var opt_str		= dest_air.name;
							if ( searchPrefs.DISPLAY_AIRPORT_CITY_CODES == 'true' )
							{
								opt_str		+=  " (" + dest_air.code + ")";
							}

							var connection_str = getAirportFlagConnection( orig , dest_air.code );

							
							if (separador == 0 && connection_str){

								toList.options[l_ix] = new Option( "---------------------------------------" );
								toList.options[l_ix].value	= "separador";
								toList.options[l_ix].setAttribute("disabled","disabled");
								toList.options[l_ix].style.color = "menutext";
							
								l_ix ++;
								
								toList.options[l_ix] = new Option( separador_conexiones );
								toList.options[l_ix].setAttribute("disabled","disabled");
								toList.options[l_ix].value	= "connex";
								toList.options[l_ix].className 	= "toConnexiones";
								
								l_ix ++;
								
								separador ++;
							} else if (order_connections == 1 && connection_str) {
								opt_str += connection_str;
							}
							toList.options[l_ix]	= new Option( opt_str );
							toList.options[l_ix].value	= dest_air.code;
							if ( dest == dest_air.code )
							{
								toList.selectedIndex	= l_ix;
							}
						}
					}
				}
				
		if (document.getElementById('cFamNum')){
			if (document.getElementById('cFamNum').checked!= true) {
				var firstThirdCompanyGroup = true;
				var destThirdCompany=buildDestinationsThirdCompany(orig);						
				var destThirdCompanyAirport = new Array();
				for (var i = 0; i < destThirdCompany.length; i++)
				{
					var dest_air;					
					dest_air = getAirportThirdCompanyGroup( destThirdCompany[i] );
					if(dest_air != null) {
					   destThirdCompanyAirport[i] = dest_air;
					}
				}
				var destSortedThirdCompanyAirport = trimGroupNoGroupArray(destThirdCompanyAirport);
				for (var i = 0; i < destSortedThirdCompanyAirport.length; i++)
				{
					var dest_air;					
					dest_air =  destSortedThirdCompanyAirport[i] ;
					if(dest_air != null) {
						
						if(firstThirdCompanyGroup == true){
							var l_sep = toList.length;
							toList.options[l_sep] = new Option("---------------------------------");
							toList.options[l_sep].disabled = "disabled";
							firstThirdCompanyGroup = false;
						}
						toList.length	+= 1;
						var l_ix		= toList.length - 1;
						var opt_str		= dest_air.name;
						if ( searchPrefs.DISPLAY_AIRPORT_CITY_CODES == 'true' )
						{
							opt_str		+=  " (" + dest_air.code + ")";
						}

						var connection_str = getAirportFlagConnection( orig , dest_air.code );
						if (connection_str)
						{
							opt_str += connection_str;
						}

						toList.options[l_ix]	= new Option( opt_str );
						toList.options[l_ix].value	= dest_air.code;
						if ( dest == dest_air.code )
						{
							toList.selectedIndex	= l_ix;
						}
					}
				}
			  }
			}
			}
			if(resi)
			{
				fromList.length	= 1;
				for (var i = 0; i < AirportsResidents.length; i++)
				{
					fromList.length	+= 1;
					var l_ix		= fromList.length - 1;
					var opt_str		= AirportsResidents[i].name;
					if ( searchPrefs.DISPLAY_AIRPORT_CITY_CODES == 'true' )
					{
						opt_str		+=  " (" + AirportsResidents[i].code + ")";
					}
					fromList.options[l_ix]	= new Option( opt_str );
					fromList.options[l_ix].value	= AirportsResidents[i].code;
					if ( fromOrig == AirportsResidents[i].code ||  orig == AirportsResidents[i].code)
					{
						fromList.selectedIndex	= l_ix;
					}
				}
			}
			else if(famnum)
			{
				fromList.length	= 1;
				for (var i = 0; i < AirportsFamNum.length; i++)
				{
					fromList.length	+= 1;
					var l_ix		= fromList.length - 1;
					var opt_str		= AirportsFamNum[i].name;
					if ( searchPrefs.DISPLAY_AIRPORT_CITY_CODES == 'true' )
					{
						opt_str		+=  " (" + AirportsFamNum[i].code + ")";
					}
					fromList.options[l_ix]	= new Option( opt_str );
					fromList.options[l_ix].value	= AirportsFamNum[i].code;
					if ( fromOrig == AirportsFamNum[i].code ||  orig == AirportsFamNum[i].code)
					{
						fromList.selectedIndex	= l_ix;
					}
				}
			}else if( submode )
			{
				fromList.length	= 1;
				for (var i = 0; i < AirportsSubmode.length; i++)
				{
					fromList.length	+= 1;
					var l_ix		= fromList.length - 1;
					var opt_str		= AirportsSubmode[i].name;
					if ( searchPrefs.DISPLAY_AIRPORT_CITY_CODES == 'true' )
					{
						opt_str		+=  " (" + AirportsSubmode[i].code + ")";
					}
					fromList.options[l_ix]	= new Option( opt_str );
					fromList.options[l_ix].value	= AirportsSubmode[i].code;
					if ( fromOrig == AirportsSubmode[i].code ||  orig == AirportsSubmode[i].code)
					{
						fromList.selectedIndex	= l_ix;
					}
				}
			}else{
				fromList.length	= 1;
					for (var i = 0; i < Airports.length; i++)
					{
						fromList.length	+= 1;
						var l_ix		= fromList.length - 1;
						var opt_str		= Airports[i].name;
						if ( searchPrefs.DISPLAY_AIRPORT_CITY_CODES == 'true' )
						{
							opt_str		+=  " (" + Airports[i].code + ")";
						}
						fromList.options[l_ix]	= new Option( opt_str );
						fromList.options[l_ix].value	= Airports[i].code;
						if ( fromOrig == Airports[i].code ||  orig == Airports[i].code)
						{
							fromList.selectedIndex	= l_ix;
						}
					}
					if(AirportsThirdCompanyGroup.length > 0 && document.getElementById('cFamNum').checked!= true ){					
						var l_sep		= fromList.length;
						fromList.options[l_sep] = new Option("---------------------------------");
						fromList.options[l_sep].disabled = "disabled";
					}
					
					for (var i = 0; i < AirportsThirdCompanyGroup.length; i++)
					{
						fromList.length	+= 1;
						var l_ix		= fromList.length - 1;
						var opt_str		= AirportsThirdCompanyGroup[i].name;
						if ( searchPrefs.DISPLAY_AIRPORT_CITY_CODES == 'true' )
						{
							opt_str		+=  " (" + AirportsThirdCompanyGroup[i].code + ")";
						}
						fromList.options[l_ix]	= new Option( opt_str );
						fromList.options[l_ix].value	= AirportsThirdCompanyGroup[i].code;
						if ( fromOrig == AirportsThirdCompanyGroup[i].code ||  orig == AirportsThirdCompanyGroup[i].code)
						{
							fromList.selectedIndex	= l_ix;
						}
					}
					
			}
		}
		else
		{
			for (var i=0; i<toList.options.length; i++)
			{
				if ( dest == toList.options[i].value )
				{
					toList.selectedIndex	= i;
				}
			}
		}
		setDest( mkt );
		setConnexGroup( mkt );
	}

	function resetDates(checkDates)
	{
		var m1d_ix		= document.skylightsForm.departDay1.selectedIndex;
		var m1y_ix		= document.skylightsForm.departMonth1.selectedIndex;
		if ( checkDates ) {
			if ( m1y_ix > document.skylightsForm.departMonth2.selectedIndex ) {
				document.skylightsForm.departMonth2.selectedIndex	=  m1y_ix;
				document.skylightsForm.departDay2.selectedIndex	=  m1d_ix;
			}
			if ( ( (m1y_ix) == document.skylightsForm.departMonth2.selectedIndex )
			  && ( m1d_ix > document.skylightsForm.departDay2.selectedIndex ) ) {
				document.skylightsForm.departDay2.selectedIndex	=  m1d_ix;
			}
		}
	}
	function validCities()
	{
		var is_valid	= true;
		if ( document.skylightsForm.from1.selectedIndex == 0 )
		{
			alert( searchText.missingDepartCity );
			is_valid	= false;
		}
		else if ( document.skylightsForm.to1.selectedIndex == 0 )
		{
			alert( searchText.missingArriveCity );
			is_valid	= false;
		}
		else if ((searchPrefs.OFFER_OPEN_JAW_ROUTES == "true") && (document.skylightsForm.travel[2].checked))
		{
			is_valid = validateOpenJawConnections();
		}
		return is_valid;
	}
	function validPax()
	{
		var adults = document.skylightsForm.ADULT.value;
		var infants = document.skylightsForm.INFANT.value;
		var childs = document.skylightsForm.CHILD.value;
		var paxTotal = 0;
		if (searchPrefs.MAX_PASSENGERS_ALLOWED > 0)
		{
			for (i = 0; i < searchPrefs.paxTypes.length; i++)
			{
				var paxType 	= searchPrefs.paxTypes[i];
				var paxSelect	= document.getElementById(paxType +"Select");
				if(document.skylightsForm.mode.value!='HORAS48'){
					paxTotal	= eval(paxTotal) + eval(paxSelect.options[paxSelect.selectedIndex].value);
				}else{
					paxTotal=1;
				}
			}
			if (paxTotal > searchPrefs.MAX_PASSENGERS_ALLOWED)
			{
				alert("\n"	+ searchText.popup_max_passenger_amount_1
							+ searchPrefs.MAX_PASSENGERS_ALLOWED
							+ searchText.popup_max_passenger_amount_2 + "\n");
				return false;
			}
		}
		if ( paxTotal < 1)
		{
			alert(searchText.popup_missing_passenger_amount);
			return false;
		}
		if ( (adults  / infants) < 1 && (childs < adults))
		{
			alert(searchText.popup_too_many_infants);
			document.skylightsForm.INFANT.focus();
			return false;
		}
		/////// MENORES NO ACOMPAÑADOS
		if ( adults == 0 && childs > 0 )
		{
			//menos de 24h de antelación
			formatDates();
			if ( document.skylightsForm.departDate1.value == getTodayString() )
			{
				alert(searchText.popup_um_24_horas);
				return false;
			}
			for (i=0; i<searchPrefs.umDisabledCities.length; i++)
			{
				//el servicio no está disponible en aeropuerto origen o destino
				if ( document.skylightsForm.from1.value == searchPrefs.umDisabledCities[i] )
				{
					alert(searchText.popup_um_no_disponible + document.skylightsForm.from1.options[document.skylightsForm.from1.selectedIndex].text);
					return false;
				}
				if( document.skylightsForm.to1.value 	== searchPrefs.umDisabledCities[i] )
				{
					alert(searchText.popup_um_no_disponible + document.skylightsForm.to1.options[document.skylightsForm.to1.selectedIndex].text);
					return false;
				}
			}
			//menores no acompañados no pueden llevar bebés
			if ( infants > 0 )
			{
				alert(searchText.popup_um_no_bebes);
				document.skylightsForm.INFANT.focus();
				return false;
			}
			
			var is_connection = getConnection(document.skylightsForm.from1.value,document.skylightsForm.to1.value);
			if(is_connection != 0) {
				return alert(searchText.popup_um_connexiones_not_allow);
			} else {
				return confirm(searchText.popup_um_seleccion_pax);
			}
		}
		/////// FIN MENORES NO ACOMPAÑADOS
		return true;
	}
	function validDates(beginDate, endDate)
	{
		var is_valid			= true;
		var beginDateString		= new String (beginDate);
		var endDateString		= new String (endDate);
		var departDateString	= captureDateString("departDay1", "departMonth1");
		var arriveDateString	= captureDateString("departDay2", "departMonth2");
		date_message = searchText.popup_pre_flight_date_1 +
						searchText.popup_initial_flight_date +
						searchText.popup_pre_flight_date_2;
		if ( departDateString < beginDateString )
		{
			alert( date_message );
			setDate( "departDay1", "departMonth1", beginDateString );
			if( isRoundTrip() && arriveDateString < beginDateString )
				setDate( "departDay2", "departMonth2", beginDateString );
			return false;
		}
		if ( searchPrefs.final_date_used )
		{
			if( departDateString > endDateString )
			{
				is_valid = false;
				setDate( "departDay1", "departMonth1", endDateString );
			}
			if( isRoundTrip() && ( arriveDateString > endDateString ) )
			{
				is_valid = false;
				setDate( "departDay2", "departMonth2", endDateString );
			}
			if( !is_valid )
			{
				alert( searchText.popup_post_live_flight_date_1 +
						searchText.popup_final_flight_date +
						searchText.popup_post_live_flight_date_2 );
				return false;
			}
		}
		if(!validateCalendarDate("departDay1", "departMonth1", true, true))
		{
			if( isRoundTrip() || ( !isOneWay() && searchPrefs.OFFER_OPEN_JAW_ROUTES == 'true' ) )
			{
				validateCalendarDate("departDay2", "departMonth2", false, true);
			}
			return false;
		}
		if(	( isRoundTrip() || ( !isOneWay() && searchPrefs.OFFER_OPEN_JAW_ROUTES == 'true' ) ) && !validateCalendarDate("departDay2", "departMonth2", true, true) )
		{
			return false;
		}
		if ( isRoundTrip() || ( !isOneWay() && searchPrefs.OFFER_OPEN_JAW_ROUTES == 'true' ) )
		{
			if ( !validateDateOverlap("departDay1", "departMonth1", "departDay2", "departMonth2", true, true) )
			{
				return false;
			}
			else if ( searchText.sameDayWarning && arriveDateString == '' + departDateString )
			{
				is_valid		= true; 
			}
		}
		if(is_valid == true) is_valid = checkSBdata();
		return is_valid;
	}
	function formatDates()
	{
		document.skylightsForm.departDate1.value		= 		captureDateString("departDay1", "departMonth1");
		if ( document.skylightsForm.numberMarkets.value > 1 )
		{
			document.skylightsForm.departDate2.value	= captureDateString("departDay2", "departMonth2");
		}
	}
	function validateOpenJawConnections()
	{
		if ( ( ( document.skylightsForm.from1.value == document.skylightsForm.to2.value ) ||
				( document.skylightsForm.to1.value == document.skylightsForm.from2.value ) ) 
				&& ( document.skylightsForm.from2.value != '???') && ( document.skylightsForm.to2.value != '???'))
		{
			return true;
		}
		else
		{
			alert(searchText.popup_illogical_open_jaw);
			return false;
		}
	}
	function isOneWay()
	{
		return ( document.skylightsForm.travel[1].checked );
	}
	function isRoundTrip()
	{
		return ( document.skylightsForm.travel[0].checked );
	}
	function swapTravel()
	{
		if ( document.skylightsForm.travel[0].checked )
		{
			document.skylightsForm.numberMarkets.value			= 2;
			showDiv(true, 'dateSel2');
			if (searchPrefs.OFFER_OPEN_JAW_ROUTES == 'true')
			{
				showDiv(false, 'fromToSel2');
			}
		}
		else if ( document.skylightsForm.travel[1].checked )
		{
			document.skylightsForm.numberMarkets.value			= 1;
			showDiv(false, 'dateSel2');
			if (searchPrefs.OFFER_OPEN_JAW_ROUTES == 'true')
			{
				showDiv(false, 'fromToSel2');
			}
		}
		else
		{
			document.skylightsForm.numberMarkets.value			= 2;
			showDiv(true, 'dateSel2');
			showDiv(true, 'fromToSel2');
		}
	}
	function swapFam()
	{
		if ( document.skylightsForm.cFamNum.checked==true )
		{
			showDiv(true,'famNum');
			document.skylightsForm.frdisc.selectedIndex=0;
			mode_act="";
			onDescuentos();
		}
		else 
		{
			document.skylightsForm.frdisc.selectedIndex=0;
			mode_act="";
			onDescuentos();
			showDiv(false,'famNum');
		}
	}
	
	function submitSearch(beginDate, endDate)
	{
		//INICIO thirdCompanyFlights
		from = document.skylightsForm.from1.value;
		to   = document.skylightsForm.to1.value;
		for (var i=0;i<AirportsThirdCompany.length;i++){
			if(AirportsThirdCompany[i].code==from){
				for (var j=0; j<AirportsThirdCompany[i].dests.length;j++){
					if(AirportsThirdCompany[i].dests[j]==to){
						if (!validMaxMinDates()) return;				
						openMessageWindow(CompanyAirportsThirdCompany[from + to]);
						return;
					}
				}
			}	
		}
		//2x1
		if(document.skylightsForm.mode.value=="CSSV" && (document.skylightsForm.ADULT.value == "0" ||  (document.skylightsForm.ADULT.value == "1" && document.skylightsForm.CHILD.value == "0" && document.skylightsForm.INFANT.value == "0") || (document.skylightsForm.ADULT.value == "1" && document.skylightsForm.CHILD.value == "1" && document.skylightsForm.INFANT.value == "1"))){
			document.skylightsForm.mode.value="";
		}
		//INICIO cualquier dia.
		//-----------------------------------------------------//
		//if  ((document.skylightsForm.departDay1.value == "**" || document.skylightsForm.departDay2.value == "**") && (document.skylightsForm.to1.value!='ZZZ'))
		 if (document.getElementById('fechas').value=='9999') 
		{
			if  (validCities()) 
			{
				document.skylightsForm.cualquier.value = 1;
				document.skylightsForm.action = "/booking/fare-finder";
				document.skylightsForm.m1_cualquier.value = document.skylightsForm.departMonth1.value + '01' + document.skylightsForm.from1.value + document.skylightsForm.to1.value;
				document.skylightsForm.m2_cualquier.value = document.skylightsForm.departMonth2.value + '01' + document.skylightsForm.to1.value + document.skylightsForm.from1.value;
				submit_skylightsForm('FAREFINDER', 'SB', 'search');
			}
		}
		//FIN cualquier dia.
		//-----------------------------------------------------//
		else
		{
			if(document.skylightsForm.promotional_code){
				if(document.skylightsForm.promotional_code.value!=''){
					var fomentCode = document.skylightsForm.promotional_code.value;
					var fomentCodeValue = fomentCode.toUpperCase().replace(/^\s*|\s*$/g,"");
					var regFoment = /^VY-(SC|SI|MC)-[0-9]{3}$/;
					//GDC-1517 Si es de fomento no cambio el mode
					if (!regFoment.test(fomentCodeValue)){
						//GDC-1671 Si es Cecot, tampoco
						var regCecot = /^CECOT[0-9]{6}$/;
						if (!regCecot.test(fomentCodeValue)){
							if(!checkPimecCode(fomentCodeValue)){
								document.skylightsForm.mode.value  ="PLTA2";
							}
						}
					}
				}
			}
			if ( validCities() && validDates(beginDate, endDate) && validPax() && validMaxMinDates())
			{
				if ( isRoundTrip() )
				{
					document.skylightsForm.from2.value = 	document.skylightsForm.to1.value;
					document.skylightsForm.to2.value = 	document.skylightsForm.from1.value;
				}

				var connection = getConnection( document.skylightsForm.from1.value , document.skylightsForm.to1.value );

				finalDate();
				formatDates();
				var modenew = "";
				if( document.getElementById("frdisc") && document.getElementById("frdisc").selectedIndex != 0 )
				{
					var x = document.getElementById("frdisc")
					var index = x.selectedIndex;
					var option = x.options[index].value;
					var modenew = "";
					switch( option ) {
						case "res":
							modenew = "RESIDENT";
							break;
						case "fam1":
							modenew = "FN1";
							break;
						case "fam2":
							modenew = "FN2";
							break;
						case "famres1":
							modenew = "RFN1";
							break;
						case "famres2":
							modenew = "RFN2";
							break;
						}
					document.skylightsForm.mode_orig.value  = document.skylightsForm.mode.value;
					document.skylightsForm.mode.value  = modenew;
				}
				//INICIO mode PARES.
				//-----------------------------------------------------//
				if ( mode_Pares )
				{
					var fecha_actual1=document.skylightsForm.departMonth1.value + document.skylightsForm.departDay1.value;
					var fecha_actual2=document.skylightsForm.departMonth2.value + document.skylightsForm.departDay2.value;
					if (document.skylightsForm.numberMarkets.value == 2)
					{
						var condicion_fechas = fecha_actual1 >= fecha_Initial_PARES && fecha_actual1 <= fecha_Final_PARES && fecha_actual2 >= fecha_Initial_PARES && fecha_actual2 <= fecha_Final_PARES;
					}
					else
					{
						var condicion_fechas = fecha_actual1 >= fecha_Initial_PARES && fecha_actual1 <= fecha_Final_PARES;
					}	
					if (condicion_fechas)
					{
						submit_skylightsForm('SEARCH', 'SB', 'search');
					}
					else if(confirm(popup_FARES_fecha_incorrect))
					{
							document.skylightsForm.mode.value = "";
							submit_skylightsForm('SEARCH', 'SB', 'search');
					}
				}
				//FIN mode PARES.
				//-----------------------------------------------------//
				else if(controlFechas==true)
				{
					var fecha_actual1=document.skylightsForm.departMonth1.value + document.skylightsForm.departDay1.value;
					var fecha_actual2=document.skylightsForm.departMonth2.value + document.skylightsForm.departDay2.value;
					var condicion_mode;
					var condicion_fechas;
					var rutaIda=document.skylightsForm.from1.value + document.skylightsForm.to1.value
					var rutaVuelta=document.skylightsForm.from2.value + document.skylightsForm.to2.value
					if (document.skylightsForm.numberMarkets.value == 2)
					{
						condicion_fechas = !((fecha_actual1 >= fecha_Out_control_fechas_ini && fecha_actual1 <= fecha_Out_control_fechas_fin) || (fecha_actual2 >= fecha_Out_control_fechas_ini && fecha_actual2 <= fecha_Out_control_fechas_fin));
						condicion_mode   = (fecha_actual1 >= fecha_promo_date_ini && fecha_actual1 <= fecha_promo_date_fin) && (fecha_actual2 >= fecha_promo_date_ini && fecha_actual2 <= fecha_promo_date_fin);
						ruta_mode		 = rutas_promo[rutaIda] && rutas_promo[rutaVuelta];
					}
					else 
					{
						condicion_fechas = !(fecha_actual1 >= fecha_Out_control_fechas_ini && fecha_actual1 <= fecha_Out_control_fechas_fin);
						condicion_mode	 = (fecha_actual1 >= fecha_promo_date_ini && fecha_actual1 <= fecha_promo_date_fin);
						ruta_mode		 = rutas_promo[rutaIda];
					}	
					if (condicion_fechas  && condicion_mode && ruta_mode)
					{
						submit_skylightsForm('SEARCH', 'SB', 'search');
					}
					else if(!ruta_mode){
						if(confirm(popup_FARES_ruta_incorrect)){
							document.skylightsForm.mode.value = "";
							submit_skylightsForm('SEARCH', 'SB', 'search');
						}
					}
					else if(confirm(popup_FARES_fecha_incorrect))
					{
						document.skylightsForm.mode.value = "";
						submit_skylightsForm('SEARCH', 'SB', 'search');
					}
					
				}
				else
				{
					if (document.skylightsForm.mode.value == "PARES")
					{
						document.skylightsForm.mode.value = "";
					}
					submit_skylightsForm('SEARCH', 'SB', 'search');
				}
			}
		}
	}
	function submit_skylightsForm(page, module, event)
	{
		document.skylightsForm.page.value 	= page;
		document.skylightsForm.module.value	= module;			
		document.skylightsForm.event.value 	= event;
		document.skylightsForm.submit();
	}
	function onLoadAtaGlance()
	{
		//Si es cualquier dia mostramos el dia que ha marcado en el farefinder.
		if (document.skylightsForm.departDay1.selectedIndex == 0)
		{
			document.skylightsForm.departDay1.value = document.skylightsForm.departDate1.value.substr(6,2);
		}
		if (document.skylightsForm.departDay2.selectedIndex == 0)
		{
			document.skylightsForm.departDay2.value = document.skylightsForm.departDate2.value.substr(6,2);
		}
		//----------
		Set_Buscar_Fechas();

		swapTravel();
		for (i = 1; i <= document.skylightsForm.numberMarkets.value; i++)
		{
			resetDest(i);
		}
		if (document.skylightsForm.hideDateSels)
		{
			if (document.skylightsForm.hideDateSels.value == 'yes')
			{
				showDiv(false,'dateSel1');
				showDiv(false,'dateSel2');
			}
		}
	}
	function PopUp_FamNum(opcion)
	{	
		lang = document.skylightsForm.language.value;
		if ( opcion == 0 )
		{
			if (lang == "ES") 			texto = "Información para residentes:\n\nLos pasajeros residentes en las Islas Baleares, las Islas Canarias o la Ciudad Autónoma de Ceuta se pueden beneficiar de un descuento del 50 % sobre la tarifa base.\n\nEste descuento sólo se aplica en vuelos entre aeropuertos peninsulares e insulares (salvo para los residentes en Ceuta, que podrán beneficiarse de ellos en los vuelos entre Sevilla o Málaga y otros destinos nacionales peninsulares).\n\nSi eres residente puedes comprar el billete a través de los canales de venta habituales de Vueling. Los billetes multireserva sólo podrán comprarse a través del Centro de Reservas.\n\nPara obtener el descuento, deberás acreditar tu condición de residente en estos territorios aportando la documentación correspondiente antes de embarcar.\n\nVueling se reserva el derecho de hacer copias de la documentación presentada y de denegar el embarque al pasajero si detecta cualquier deficiencia o anomalía.\n\nEl pasajero que no acredite su condición de residente en los mostradores de facturación no podrá embarcar en el avión y perderá el importe del billete.\n\nLos viajeros con derecho al descuento de residente sí podrán facturar por internet.\n\n";
			else if (lang == "CA")		texto = "Informació per a residents:\n\nEls passatgers residents a les Illes Balears, les Illes Canàries o la Ciutat Autònoma de Ceuta gaudeixen d’un descompte del 50 % sobre la tarifa base.\n\nAquest descompte només s’aplica en vols entre aeroports peninsulars i insulars (excepte pels residents de Ceuta, que poden obtenir-los en els vols entre Sevilla o Màlaga i altres destinacions espanyoles a la península).\n\nEls residents poden comprar el bitllet a través dels canals de venda habituals de Vueling. Els bitllets multireserva només podran comprar-se al Centre de Reserves.\n\nPer tal d’obtenir el descompte, haureu d’acreditar la vostra condició de resident en aquests territoris aportant la documentació corresponent abans d’embarcar.\n\nVueling es reserva el dret de fer còpies de la documentació presentada i de denegar l’embarcament al passatger si hi detecta alguna deficiència o anomalia.\n\nEl passatger que no acrediti la seva condició de resident als mostradors de facturació no podrà pujar a l’avió i perdrà l’import del bitllet.\n\nEls viatgers amb dret al descompte de resident si podran facturar per internet.\n\n";
			else if (lang == "EU")		texto = "Bertakoentzako informazioa:\n\nBalear Uharteetan, Kanarian edo Ceutako Hiri Autonomoan bizi diren bidaiariek oinarrizko tarifaren gaineko % 50eko deskontua dute.\n\nDeskontu horiek soilik aplikatuko zaizkie penintsulaz kanpoko lurraldeetan bizi direnei, penintsularen eta uharteen arteko hegaldietan (kanpo geratzen dira Ceutan bizi direnak; Sevillatik/rako edo Malagatik/rako eta penintsulako beste xede nazionaletarako hegaldietan lortuko dute onura).\n\nBertakoa bazara, zure hegaldi-txartela Vueling-en ohiko salmenta-bideen bitartez eros ditzakezu. Multi-erreserba txartelak soilik Erreserba Zentroaren bitartez eros daitezke.\n\nDeskontuaz baliatu ahal izateko, bertakoa zarela egiaztatu beharko duzu, hori erakutsiko duen dokumentazioa ekarrita ontziratzea baino lehen.\n\nVueling-ek beretzat gordetzen du aipatu dokumentazioaren kopia egiteko eskubidea, edo ontziratzea debekatzeko eskubidea, baldin eta konpainiak edozein huts edo irregulartasun antzematen badu.\n\nBertakotasuna erregistratze-mahaietan frogatzen ez duen bidaiariak ezin izango du hegazkinera sartu, eta ez zaio hegazkin-txartelaren dirua itzuliko.\n\nBertakoa izateagatiko deskontu-eskubidea duten bidaiariek check-in online egin izango dute.\n\n";
			else if (lang == "EN")    	texto = "Information for residents:\n\nPassengers who are residents of the Balearic or Canary Islands, or Ceuta Autonomous City receive a 50% discount on the base fare.\n\nThese discounts are only applicable for the residents of extra-peninsular territories, on flights between the Iberian peninsula and island territories (except Ceuta residents, who can benefit from flights to/from Seville or Malaga and other national, peninsular destinations).\n\nIf you are a resident you can purchase your airfare through Vueling’s customary sales outlets. Purchasing multi-booking airfares can only be done through our Customer Service Centre.\n\nTo take advantage of this discount, you must prove you are a resident by providing the corresponding documentation before boarding.\n\nVueling reserves the right to make copies of such documentation, or refuse to allow the passenger to board if the company detects any deficiency or anomaly. Any passenger who doesn’t prove their resident status at the check-in counters will not be able to board the aircraft and the amount of their airfare will not be refunded.\n\nTravellers entitled to the resident’s discount may check in online.\n\n";
			else if (lang == "GA")    	texto = "Información para residentes:\n\nOs pasaxeiros residentes nas Illas Baleares, as Illas Canarias ou a Cidade Autónoma de Ceuta pódense beneficiar dun desconto do 50% sobre a tarifa base.\n\nEstes descontos só se aplican a residentes en territorios extrapeninsulares en voos entre aeroportos peninsulares e insulares (agás os residentes en Ceuta, que poderán beneficiarse destes descontos nos voos entre Sevilla ou Málaga e outros destinos nacionais peninsulares).\n\nSe es residente, podes comprar o billete a través das canles de venda habituais de Vueling. Os billetes multireserva só poderán comprarse a través do Centro de Reservas.\n\nPara obter o desconto, deberás acreditar a túa condición de residente, para o que deberás achegar a documentación correspondente antes do embarque.\n\nVueling resérvase o dereito de facer copias da documentación presentada e de denegar o embarque se detecta calquera deficiencia ou anomalía.\n\nO pasaxeiro que non acredite a súa condición de residente nos mostradores de facturación non poderá embarcar no avión e perderá o importe do billete.\n\nOs viaxeiros con dereito ao desconto de residente poderán realizar o check-in on-line.\n\n";
			else if (lang == "IT")    	texto = "Informazioni per residenti:\n\nI passeggeri residenti nelle Isole Baleari, nelle Isole Canarie o nella Città Autonoma di Ceuta possono usufruire di uno sconto del 50% sulla tariffa base.\n\nGli sconti sono validi solo per residenti delle aree extrapeninsulari, per voli tra aeroporti peninsulari e insulari (tranne per i residenti di Ceuta, che possono richiedere lo sconto per i voli da/verso Siviglia o Malaga e altre destinazioni peninsulari).\n\nSe sei residente, puoi acquistare il tuo biglietto attraverso i canali di vendita abituali di Vueling. L'acquisto di biglietti Multiprenotazione potrà essere realizzato solo attraverso il Centro Prenotazioni.\n\nPer ottenere lo sconto, devi attestare la residenza presentando i corrispondenti documenti prima dell'imbarco.\n\nVueling si riserva il diritto di fare copia dei suddetti documenti o di negare l'imbarco qualora la compagnia riscontrasse deficienze o anomalie.\n\nSe il passeggero non attesta la residenza ai banchi di accettazione, non potrà realizzare l'imbarco e l'importo del biglietto non verrà rimborsato.\n\nI viaggiatori con diritto allo sconto residenti possono effettuare il check-in online.\n\n";
			else if (lang == "NL")    	texto = "Informatie voor ingezetenen:\n\nIngezetenen van de Balearen, Canarische eilanden of het Autonome stadsgewest Ceuta krijgen 50% korting op het basistarief.\n\nDeze kortingen gelden uitsluitend voor inwoners van Spaanse gebieden buiten het Iberisch schiereiland voor vluchten tussen luchthavens  op het Iberisch schiereiland en de eilanden (behalve ingezetenen van  Ceuta die recht hebben op korting voor de vluchten van en naar Sevilla of Malaga en andere Spaanse bestemmingen op het Iberisch Schiereiland).\n\nBen je inwoner van een van de desbetreffende gebieden, dan kun je je ticket via de gangbare verkoopkanalen van Vueling boeken. Het boeken van meervoudige reserveringen kan alleen via de Reserveringsbalie.\n\nOm korting te krijgen moet je vóór het instappen met behulp van een legitimatiebewijs kunnen aantonen dat je ingezetene van een van de genoemde gebieden bent.\n\nVueling behoudt zich het recht voor een kopie van dit legitimatiebewijs te maken of de toegang aan boord te weigeren als er iets ontbreekt of niet klopt. Als de passagier zijn hoedanigheid van ingezetene niet kan aantonen aan de incheckbalie, kan deze niet instappen en heeft deze geen recht op terugbetaling.\n\nDe passagiers met recht op ingezetenekorting kunnen online inchecken.\n\n";
			else if (lang == "PT")    	texto = "Informação para residentes:\n\nOs passageiros residentes nas Ilhas Baleares, Canárias ou cidade autónoma de Ceuta têm um desconto de 50% sobre a tarifa base.\n\nEstes descontos só são aplicáveis para residentes em territórios extra peninsulares, em voos entre aeroportos peninsulares e insulares (salvo os residentes em Ceuta, os quais poderão beneficiar-se nos voos para/de Sevilha ou Málaga e outros destinos nacionais peninsulares).\n\nSe és residente podes comprar o teu bilhete através dos canais de venda habituais da Vueling. A compra de bilhetes multi-reserva só pode ser feita através do Centro de Reservas.\n\nPara obteres o desconto, deverás acreditar a tua condição de residente mediante a apresentação da documentação correspondente antes do embarque.\n\nA Vueling reserva-se o direito de fazer cópias da referida documentação ou negar o embarque se a companhia detectar qualquer deficiência ou anomalia.\n\nO passageiro que não acredite a sua condição de residente no balcão de check-in não poderá embarcar e não se lhe reembolsará o valor pago pelo bilhete.\n\nOs passageiros com direito ao desconto de residente podem fazer check-in online.\n\n";
			else if (lang == "FR")    	texto = "Information à l'attention des résidents:\n\nLes passagers résidents des Iles Baléares, des Canaries et de la ville autonome de Ceuta bénéficient d'une réduction de 50% sur le tarif de base.\n\nCes réductions ne sont applicables qu'aux résidents des territoires en dehors de la péninsule, sur les vols entre aéroports péninsulaires et insulaires (sauf pour les résidents de Ceuta, qui en bénéficieront sur les vols vers et depuis Séville ou Malaga et les autres destinations nationales péninsulaires).\n\nSi vous êtes résident, vous pouvez acheter votre billet sur le réseau Vueling habituel. Pour l'achat de billets avec plusieurs réservations, adressez-vous au Centre de Réservations.\n\nPour bénéficier de la réduction, vous devrez prouver votre résidence en présentant le justificatif avant l'embarquement.\n\nVueling se réserve le droit de faire des copies de ce justificatif ou de refuser l'embarquement si la compagnie détecte une anomalie.\n\nLe passager qui ne peut prouver sa résidence devant les comptoirs d'enregistrement ne pourra pas monter à bord et le prix du billet ne lui sera pas remboursé.\n\nLes voyageurs qui ont bénéficié de la réduction résident pourrant faire l'enregistrement en ligne. \n\n";
			else if (lang == "DE")    	texto = "Informationen für Bewohner:\n\nDie auf den Balearischen oder Kanarischen sowie in der Autonomen Stadt Ceuta wohnhaften Passagiere profitieren von einer Ermäßigung in Höhe von 50% auf den Grundtarif. \n\nBesagte Vergünstigung wird bei Flügen von der spanischen Halbinsel auf die Inseln und umgekehrt gewährt (die Bewohner von Ceuta profitieren zusätzlich noch bei Flügen zwischen Sevilla oder Malaga und Zielen auf der spanischen Halbinsel von besagter Vergünstigung). \n\nHaben Sie aus den genannten Gründen Anspruch auf die Ermäßigung, dann können Sie Ihr Ticket über die bekannten Verkaufskanäle von Vueling erwerben. Tickets mit mehreren Buchungen können ausschließlich über die Buchungszentrale erworben werden. \n\n Um die Ermäßigung zu erhalten, müssen Sie nachwseisen, dass Sie an den genannten Orten wohnhaft sind, indem Sie vor dem Boarding die entsprechenden Unterlagen vorlegen.\n\nVueling behält sich das Recht vor, Kopien von den vorgelegten Unterlagen zu machen und dem Passagier das Boarding zu verweigern, falls Mängel oder Abweichungen an denselben festgestellt werden sollten.\n\nSollte der Passagier am Check-in-Schalter nicht belegen, dass er an einem der genannten Orte wohnhaft ist, so kann er nicht einchecken und sein Ticket verliert seinen Wert. \n\nDie Passagiere mit Anspruch auf die genannte Ermäßigung können über Internet einchecken.\n\n";
		}
		else
		{
			if (lang == "ES") 			texto = "Información para familias numerosas:\n\nLas familias numerosas de tres hijos se pueden beneficiar de un descuento del 5 % sobre la tarifa base. Para las de más de tres hijos, el descuento es del 10 %.\n\nEstos descuentos sólo son aplicables en vuelos entre aeropuertos nacionales.\n\nSi eres miembro de una familia numerosa puedes comprar tu billete a través de los canales de venta habituales de Vueling, donde deberás acreditar tu número de título de familia numerosa.\n\nPara obtener el descuento, deberás acreditar tu condición de familia numerosa presentando la documentación correspondiente antes del embarque.\n\nVueling se reserva el derecho de hacer copias de la documentación presentada y de denegar el embarque al pasajero si la compañía detecta cualquier deficiencia o anomalía.\n\nEl pasajero que no acredite su condición de miembro de una familia numerosa en los mostradores de facturación no podrá embarcar en el avión y perderá el importe del billete.\n\nLos viajeros con derecho al descuento de familia numerosa no podrán facturar por internet.\n\n";
			else if (lang == "CA")    	texto = "Informació per a famílies nombroses:\n\nLes famílies nombroses de tres fills gaudeixen d’un descompte del 5 % sobre la tarifa base. Per les de més de tres fills, el descompte és del 10 %.\n\nAquests descomptes només són aplicables en vols entre aeroports espanyols.\n\nEls membres d’una família nombrosa poden comprar els bitllets a través dels canals de venda habituals de Vueling, on haureu d’acreditar el vostre número de títol de família nombrosa.\n\nPer tal d’obtenir el descompte, haureu d’acreditar la vostra condició de família nombrosa presentant la documentació corresponent abans d’embarcar.\n\nVueling es reserva el dret de fer còpies de la documentació presentada i de denegar l’embarcament als passatgers si hi detecta qualsevol deficiència o anomalia.\n\nEls passatgers que no acreditin la seva condició de membres d’una família nombrosa als mostradors de facturació no podran pujar a l’avió i perdran l’import del bitllet.\n\nEls viatgers amb dret al descompte de família nombrosa no podran facturar per internet.\n\n";
			else if (lang == "EU")    	texto = "Familia ugarientzako informazioa:\n\nHiru seme-alabako familia ugariek oinarrizko tarifaren gaineko % 5eko deskontua dute. Hiru seme-alaba baino gehiago dutenek, berriz, % 10ekoa.\n\nFamilia ugariei aplikatuko zaizkien deskontu horiek soilik nazio-aireportuetan abiapuntua eta helmuga duten hegaldietan egingo zaizkie.\n\nFamilia ugariko bidaiaria bazara, zure hegazkin-txartela Vueling-en ohiko salmenta-bideen bitartez eros dezakezu; horretan zure familia ugariko tituluaren zenbakia egiaztatu beharko duzu.\n\nDeskontuaz baliatu ahal izateko, familia ugarikoa zarela egiaztatu beharko duzu, hori erakutsiko duen dokumentazioa ekarrita ontziratzea baino lehen.\n\nVueling-ek beretzat gordetzen du aipatu dokumentazioaren kopia egiteko eskubidea, edo ontziratzea debekatzeko eskubidea, baldin eta konpainiak edozein huts edo irregulartasun antzematen badu.\n\nFamilia ugariaren izaera erregistratze-mahaietan frogatzen ez duen bidaiariak ezin izango du hegazkinera sartu, eta ez zaio hegazkin-txartelaren dirua itzuliko.\n\nFamilia ugarikoa izateagatiko deskontu-eskubidea duten bidaiariek ezin izango dute check-in on line egin.\n\n";
			else if (lang == "EN")    	texto = "Information for large families:\n\nFamilies with three children can claim a 5% discount on the base airfare while those with more than three children can receive a 10% discount.\n\nThese discounts are only applicable to large families, on flights originating or terminating at national airports.\n\nIf you are a passenger from a large family you can purchase your airfare through Vueling’s customary sales outlets, where you must validate your large family entitlement number.\n\nTo take advantage of this discount, you must prove that you are from a large family by providing the corresponding documentation before boarding.\n\nVueling reserves the right to make copies of such documentation, or refuse to allow the passenger to board if the company detects any deficiency or anomaly.\n\nAny passenger who doesn’t validate their large family  status at the check-in counters will not be able to board the aircraft and the amount of their airfare will not be refunded.\n\nTravellers entitled to the large family discount may not check in online.\n\n";
			else if (lang == "GA")    	texto = "Información para familias numerosas:\n\nAs familias numerosas de tres fillos pódense beneficiar dun desconto do 5% sobre a tarifa base. Para as familias de máis de tres fillos, o desconto é do 10%.\n\nEstes descontos só son aplicables a familias numerosas en voos entre aeroportos nacionais.\n\nSe es membro dunha familia numerosa, podes comprar o teu billete a través das canles de venda habituais de Vueling, onde deberás acreditar o teu número de título de familia numerosa.\n\nPara obter o desconto, deberás acreditar a túa condición de familia numerosa, para o que deberás achegar a documentación correspondente antes do embarque.\n\nVueling resérvase o dereito de facer copias da documentación presentada e de denegar o embarque se a compañía detecta calquera deficiencia ou anomalía.\n\nO pasaxeiro que non acredite a súa condición de membro dunha familia numerosa nos mostradores de facturación non poderá embarcar no avión e perderá o importe do billete.\n\nOs viaxeiros con dereito ao desconto de familia numerosa non poderán realizar o check-in on-line.\n\n";
			else if (lang == "IT")    	texto = "Informazioni per famiglie numerose:\n\nLe famiglie numerose con tre figli possono usufruire di uno sconto del 5% sulla tariffa base, mentre le famiglie con più di tre figli possono ottenere uno sconto del 10%.\n\nGli sconti sono validi solo per famiglie numerose, per voli con partenza e arrivo in aeroporti nazionali spagnoli.\n\nSe sei membro di famiglia numerosa, puoi acquistare il tuo biglietto attraverso i canali di vendita abituali di Vueling, certificando l'appartenenza a famiglia numerosa.\n\nPer ottenere lo sconto, devi attestare l'appartenenza a famiglia numerosa presentando i corrispondenti documenti prima dell'imbarco.\n\nVueling si riserva il diritto di fare copia dei suddetti documenti o di negare l'imbarco qualora la compagnia riscontrasse deficienze o anomalie.\n\nSe il passeggero non attesta la sua appartenenza a famiglia numerosa ai banchi di accettazione, non potrà realizzare l'imbarco e l'importo del biglietto non verrà rimborsato.\n\nI viaggiatori con diritto allo sconto per famiglie numerose non possono realizzare il check-in online.\n\n";
			else if (lang == "NL")    	texto = "Informatie voor grote gezinnen:\n\nGrote gezinnen met drie kinderen krijgen 5% korting over het basistarief. Grote gezinnen met meer dan drie kinderen hebben recht op 10% korting.\n\nDeze kortingen zijn alleen van toepassing voor grote gezinnen, op vluchten van en naar Spaanse luchthavens.\n\nBen je lid van een groot gezin, dan kun je je ticket via de gangbare verkoopkanalen van Vueling boeken, waar je je groot-gezincode moet opgeven.\n\nOm korting te krijgen moet je vóór het instappen met behulp van een legitimatiebewijs kunnen aantonen dat je lid van een groot gezin bent.\n\nVueling behoudt zich het recht voor een kopie van dit legitimatiebewijs te maken of de toegang aan boord te weigeren als er iets ontbreekt of niet klopt.\n\nAls de passagier zijn hoedanigheid van lid van een groot gezin niet kan aantonen aan de incheckbalie, kan deze niet instappen en heeft deze geen recht op terugbetaling.\n\nDe passagiers met recht op een groot-gezinkorting kunnen niet online inchecken.\n\n";
			else if (lang == "PT")    	texto = "Informação para famílias numerosas:\n\nAs famílias numerosas com até três filhos têm um desconto de 5% sobre a tarifa base, e as que têm mais de três filhos um desconto de 10%.\n\nEstes descontos só são aplicáveis para famílias numerosas em voos com origem e destino em aeroportos nacionais.\n\nSe és passageiro com condição de família numerosa podes comprar o teu bilhete através dos canais de venda habituais da Vueling, onde deverás acreditar o número do teu título de família numerosa.\n\nPara obteres o desconto, deverás acreditar a tua condição de família numerosa mediante a apresentação da documentação correspondente antes do embarque.\n\nA Vueling reserva-se o direito de fazer cópias da referida documentação ou negar o embarque se a companhia detectar qualquer deficiência ou anomalia.\n\nO passageiro que não acredite a sua condição de família numerosa no balcão de check-in não poderá embarcar e não se lhe reembolsará o valor pago pelo bilhete.\n\nOs passageiros com direito ao desconto de família numerosa não poderão fazer check-in online.\n\n";
			else if (lang == "FR")    	texto = "Information à l'attention des familles nombreuses:\n\nLes familles nombreuses avec trois enfants bénéficient d'une réduction de 5% sur le tarif de base et celles avec plus de trois enfants de 10%.\n\nCes réductions ne sont valables que pour les familles nombreuses, sur les vols à destination et en provenance d'aéroports nationaux.\n\nLes passagers membres d'une famille nombreuse peuvent acheter leur billet sur le réseau Vueling habituel, en indiquant le numéro de leur carte famille nombreuse.\n\nPour bénéficier de la réduction, vous devez prouver que vous êtes membre d'une famille nombreuse en présentant le justificatif avant l'embarquement.\n\nVueling se réserve le droit de faire des copies de ce justificatif ou de refuser l'embarquement si la compagnie détecte une anomalie.\n\nLe passager qui ne peut présenter de justificatif devant les comptoirs d'enregistrement ne pourra pas monter à bord et le prix du billet ne lui sera pas remboursé.\n\nLes voyageurs qui ont bénéficié de la réduction famille nombreuse ne pourront pas faire l'enregistrement en ligne.\n\n";
			else if (lang == "DE")    	texto = "Informationen für Großfamilien:\n\nFamilien mit drei Kindern profitieren von einer Ermäßigung von 5% auf den Grundtarif. Für Kinder mit mehr als drei Kindern beträgt die Ermäßigung 10%.\n\nAnspruch auf die genannte Ermäßigung besteht nur bei Flügen innerhalb Spaniens.\n\nSind Sie Mitgled einer kinderreichen Familie, können Sie Ihr Ticket über die gewohnten Vertriebskanäle von Vueling beziehen, wobei Sie die Nummer Ihrer Großfamilienbescheinigung angeben müssen.\n\nUm die Ermäßigung zu erhalten, müssen Sie die entsprechende Bescheinigung vor dem Boarding vorlegen. \n\nVueling behält sich das Recht vor, Kopien von den vorgelegten Unterlagen zu machen und dem Passagier das Boarding zu verweigern,  falls Mängel oder Abweichungen an denselben festgestellt werden sollten. \n\nSollte der Passagier am Check-in-Schalter nicht belegen, dass er Mitglied einer Großfamilie ist, so kann er nicht einchecken und sein Ticket verliert seinen Wert. \n\nDie Passagiere mit Anspruch auf die genannte Ermäßigung können nicht über Internet einchecken.\n\n";
		}
		alert(texto);
	}

	function Set_Buscar_Fechas()
	{
		document.getElementById('depart1FlexBySelect').value = document.getElementById('fechas').value;
		document.getElementById('depart2FlexBySelect').value = document.getElementById('fechas').value;
	}
	function checkPimecCode(pimecCode){
		if (typeof (pimecCode) == 'undefined') pimecCode = document.getElementById('fomentCode').value;
		
		pimecCodeValue = pimecCode.toUpperCase();
		if (pimecCode == "") return false;
		if (validaCIFsinAlerts(pimecCodeValue) ||  validarNifPimec(pimecCodeValue)){
			return true;
		}else{
			return false;
		}
	}
	function validarNifPimec(dni){
		var num_dni = dni.substring(0,8);
		var letra_dni = dni.substring(8,9);
		letra_dni = letra_dni.toUpperCase();
		var numero = num_dni % 23 + 1;
		var letra='TRWAGMYFPDXBNJZSQVHLCKET';
		letra=letra.substring(numero-1,numero);
		if (letra == letra_dni && letra_dni!=''){
			return true;
		}else{
			return false;
		}
	}
	function validaCIFsinAlerts(texto){

		var pares = 0;
		var impares = 0;
		var suma;
		var ultima;
		var unumero;
		var uletra = new Array("J","A", "B", "C", "D", "E", "F", "G", "H", "I");
		var xxx;

		texto = texto.toUpperCase();

		var regular =/^[ABCDEFGHJNPQRSUVW]\d\d\d\d\d\d\d[0-9,A-W]$/g;
		 if (!regular.exec(texto)){
			 return false;
		 }
		 else
		{
		 ultima = texto.substr(8,1);

		 for (var cont = 1 ; cont < 7 ; cont ++){
			 xxx = (2 * parseInt(texto.substr(cont++,1))).toString() + "0";
			 impares += parseInt(xxx.substr(0,1)) + parseInt(xxx.substr(1,1));
			 pares += parseInt(texto.substr(cont,1));
		 }
		 xxx = (2 * parseInt(texto.substr(cont,1))).toString() + "0";
		 impares += parseInt(xxx.substr(0,1)) + parseInt(xxx.substr(1,1));

		 suma = (pares + impares).toString();
		 unumero = parseInt(suma.substr(suma.length - 1, 1));
		 unumero = (10 - unumero).toString();
		 if(unumero >= 10) unumero = 0;

		 if ((ultima == unumero) || (ultima == uletra[unumero])) {
			 return true;
			 }
		 else {
			 return false;
			 }
		}
	}

