/*Archivo que contien los parametros para llenar los combos de lugares (aeropuestos)*/
// matriz desdtinos
// prefijos
var TRIN='TDD';
var RIBE='RIB';
var GUAY='GYA';
var RURR='RBQ';
var SANB='SRJ';
var SANT='SRZ';
var SANTV='VVI';
var LAPA='LPB';
var COCH='CBB';
var COBI='CIJ';
var UYU='UYU';
/* Matriz de lugares*/ 	
nombre1= new Array();
nombre1[LAPA]='La Paz (LPB)';
//nombre1[RIBE]='Riberalta (RIB)';
//nombre1[GUAY]='Guayaramerin (GYA)';
nombre1[RURR]='Rurrenabaque (RBQ)';
//nombre1[SANB]='San Borja (SRJ)';
//nombre1[SANT]='Santa Cruz (SRZ)';
//nombre1[SANTV]='Santa Cruz (VVI)';
nombre1[TRIN]='Trinidad (TDD)';
//nombre1[COCH]='Cochabamba (CBB)'; 
//nombre1[COBI]='Cobija (CIJ)'; 
nombre1[UYU]='Uyuni (UYU)';
idi= new Array(LAPA,RURR,TRIN,UYU);
//idi= new Array(LAPA,RIBE,GUAY,RURR,SANB,SANT,SANTV,TRIN,COCH,COBI);

 /*Matriz de lugares y sus destinos*/
 /*

RBQ – LPB
RBQ – TDD

SRJ – LPB
SRJ – TDD
 */
fullentity = new Array();
fullentity[LAPA] = new Array() // LA PAZ
//fullentity[LAPA][1] = [RIBE,nombre1[RIBE]];
//fullentity[LAPA][2] = [GUAY,nombre1[GUAY]];
fullentity[LAPA][0] = [RURR,nombre1[RURR]];
fullentity[LAPA][1] = [UYU,nombre1[UYU]];
fullentity[LAPA][2] = [TRIN,nombre1[TRIN]];
//fullentity[LAPA][1] = [SANB,nombre1[SANB]];
//fullentity[LAPA][5] = [SANT,nombre1[SANT]];
//fullentity[LAPA][6] = [SANTV,nombre1[SANTV]];
//fullentity[LAPA][7] = [COBI,nombre1[COBI]];
//fullentity[LAPA][8] = [COCH,nombre1[COCH]];
fullentity[TRIN] = new Array()// TRINIDAD
//fullentity[TRIN][1] = [RIBE,nombre1[RIBE]];
//fullentity[TRIN][2] = [GUAY,nombre1[GUAY]];
fullentity[TRIN][0] = [RURR,nombre1[RURR]];
//fullentity[TRIN][1] = [SANB,nombre1[SANB]];
fullentity[TRIN][1] = [UYU,nombre1[UYU]];
fullentity[TRIN][2] = [LAPA,nombre1[LAPA]];
//fullentity[TRIN][5] = [SANT,nombre1[SANT]];
//fullentity[TRIN][6] = [SANTV,nombre1[SANTV]];
//fullentity[TRIN][7] = [COBI,nombre1[COBI]];
//fullentity[TRIN][8] = [COCH,nombre1[COCH]];
fullentity[RURR] = new Array() //RURRENABAQUE
fullentity[RURR][0] = [LAPA,nombre1[LAPA]];
fullentity[RURR][1] = [TRIN,nombre1[TRIN]];
fullentity[RURR][2] = [UYU,nombre1[UYU]];
//fullentity[RURR][2] = [RIBE,nombre1[RIBE]];
//fullentity[RURR][3] = [GUAY,nombre1[GUAY]];
//fullentity[RURR][4] = [SANT,nombre1[SANT]];
//fullentity[RURR][5] = [SANTV,nombre1[SANTV]];
//fullentity[RURR][6] = [COBI,nombre1[COBI]];
fullentity[UYU] = new Array() // UYUNI
fullentity[UYU][0] = [LAPA,nombre1[LAPA]];
fullentity[UYU][1] = [RURR,nombre1[RURR]];
fullentity[UYU][2] = [TRIN,nombre1[TRIN]];
//fullentity[UYU][3] = [RIBE,nombre1[RIBE]];
//fullentity[UYU][4] = [GUAY,nombre1[GUAY]];
//fullentity[UYU][5] = [SANB,nombre1[SANB]];
//fullentity[UYU][6] = [SANT,nombre1[SANT]];
//fullentity[UYU][7] = [SANTV,nombre1[SANTV]];
/*
fullentity[SANB] = new Array() //SAN BORJA
fullentity[SANB][0] = [LAPA,nombre1[LAPA]];
//fullentity[SANB][1] = [TRIN,nombre1[TRIN]];
//fullentity[SANB][2] = [RIBE,nombre1[RIBE]];
//fullentity[SANB][3] = [GUAY,nombre1[GUAY]];
//fullentity[SANB][4] = [SANT,nombre1[SANT]];
//fullentity[SANB][5] = [SANTV,nombre1[SANTV]];
//fullentity[SANB][6] = [COBI,nombre1[COBI]];
fullentity[GUAY] = new Array() // GUAYARAMERIN
fullentity[GUAY][0] =  [LAPA,nombre1[LAPA]];
fullentity[GUAY][1] =  [TRIN,nombre1[TRIN]];
fullentity[GUAY][2] = [RIBE,nombre1[RIBE]];
fullentity[GUAY][3] = [RURR,nombre1[RURR]];
fullentity[GUAY][4] = [SANB,nombre1[SANB]];
fullentity[GUAY][5] = [SANT,nombre1[SANT]];
fullentity[GUAY][6] = [SANTV,nombre1[SANTV]];
fullentity[GUAY][7] = [COBI,nombre1[COBI]];
fullentity[RIBE] = new Array() // RIBERALTA
fullentity[RIBE][0] = [LAPA,nombre1[LAPA]];
fullentity[RIBE][1] = [TRIN,nombre1[TRIN]];
fullentity[RIBE][2] = [GUAY,nombre1[GUAY]];
fullentity[RIBE][3] = [RURR,nombre1[RURR]];
fullentity[RIBE][4] = [SANB,nombre1[SANB]];
fullentity[RIBE][5] = [SANT,nombre1[SANT]];
fullentity[RIBE][6] = [SANTV,nombre1[SANTV]];
fullentity[RIBE][7] = [COBI,nombre1[COBI]];
fullentity[SANT] = new Array() // SANTA CRUZ
fullentity[SANT][0] = [LAPA,nombre1[LAPA]];
fullentity[SANT][1] = [TRIN,nombre1[TRIN]];
fullentity[SANT][2] = [RIBE,nombre1[RIBE]];
fullentity[SANT][3] = [GUAY,nombre1[GUAY]];
fullentity[SANT][4] = [SANB,nombre1[SANB]];
fullentity[SANT][5] = [RURR,nombre1[RURR]];
fullentity[SANT][6] = [COCH,nombre1[COCH]];
fullentity[SANT][7] = [COBI,nombre1[COBI]];
fullentity[SANTV] = new Array() // SANTA CRUZ
fullentity[SANTV][0] = [LAPA,nombre1[LAPA]];
fullentity[SANTV][1] = [TRIN,nombre1[TRIN]];
fullentity[SANTV][2] = [RIBE,nombre1[RIBE]];
fullentity[SANTV][3] = [GUAY,nombre1[GUAY]];
fullentity[SANTV][4] = [SANB,nombre1[SANB]];
fullentity[SANTV][5] = [RURR,nombre1[RURR]];
fullentity[SANTV][6] = [COCH,nombre1[COCH]];
fullentity[SANTV][7] = [COBI,nombre1[COBI]];
fullentity[COCH] = new Array() // Cochabamba
fullentity[COCH][0] = [SANT,nombre1[SANT]];
fullentity[COCH][1] = [SANTV,nombre1[SANTV]];
fullentity[COCH][2] = [TRIN,nombre1[TRIN]];
fullentity[COCH][3] = [COBI,nombre1[COBI]];
fullentity[COCH][4] = [LAPA,nombre1[LAPA]];
fullentity[COBI] = new Array() // Cobija
fullentity[COBI][0] = [TRIN,nombre1[TRIN]];
fullentity[COBI][1] = [RIBE,nombre1[RIBE]];
fullentity[COBI][2] = [GUAY,nombre1[GUAY]];
fullentity[COBI][3] = [RURR,nombre1[RURR]];
fullentity[COBI][4] = [SANB,nombre1[SANB]];
fullentity[COBI][5] = [SANT,nombre1[SANT]];
fullentity[COBI][6] = [SANTV,nombre1[SANTV]];
fullentity[COBI][7] = [LAPA,nombre1[LAPA]];*/
// cambio de origen, form1
grupoSel = 0;

function llena_origen(){
	z=document.reservas;				
	tt = z.origen.length;
//	alert(tt);
	for (t=tt-1; t>=0; t--)
			z.origen[t] = null;	
	//alert(idi.length)		;
	for (i=0;i<idi.length;i++)
	{		var option0 = new Option(nombre1[idi[i]],idi[i]);	
			z.origen[i] = option0;
	}			
} 
/*Funcion que cambia el contenido de el destino en funcion al origen */
function cambia_entidades(unmark){
	z=document.reservas;	
	if (unmark==null) 
	   qitem = z.origen.value;
	else
	   qitem='LPB';		
	if (fullentity[qitem].length>0)
	 {	tt = z.destino.length;
		for (t=tt-1; t>=0; t--)
			z.destino[t] = null;
		for (t=0; t<fullentity[qitem].length; t++)
			{	var option0 = new Option(fullentity[qitem][t][1], fullentity[qitem][t][0]);
				z.destino[t] = option0;
			}
		z.destino.options[0].selected=true;
	 }
	 else
	 {	alert('No tiene destino');
	 }
} 
/* Función que para inicialzar los datos al cargar la página */
function cambia_entidades_1st(){
	//iniciar();
	z=document.reservas;	
	z.origen.options[0].text = z.origen.options[0].text;
	cambia_entidades();
	//z=document.form2;
}
onload=cambia_entidades_1st;


