
contents=new Array();

function TCN_addContent(str){
	contents.push(str);
	arrayValues = new Array();
	for(i=0;i<contents.length;i++){
		arrayValues[i]=contents[i].split(separator);
	}
}

function TCN_makeComboGroup(){
	comboGroup=new Array();
	args=TCN_makeComboGroup.arguments;
	for(i=0;i<args.length;i++){
		comboGroup[i]=MM_findObj(args[i]);
	}
}

function TCN_startCombo(){
	combo1=comboGroup[0];
	for (i=0;i<arrayValues.length;i++){
		existe=false;
		for(j=0;j<combo1.options.length;j++){
			if(arrayValues[i][0]==combo1.options[j].text){
				existe=true;
			}
		}
		if(existe==false){
			combo1.options[combo1.options.length]=new Option(arrayValues[i][0],arrayValues[i][1]);
		}//end if
	}//for(i)
	combo1.options[0].selected=true;
	TCN_reload(combo1);
	otra(document.form1.subarea);
}//function

function TCN_reload(from){
//averiguamos el indice del combo que llama:
var ar = from.options[from.selectedIndex].value;
var nom_ar = from.options[from.selectedIndex].text;
//var clasif2 = from.options[from.selectedIndex].text;
//alert("area: " + ar);
//alert(clasif2);
document.form1.areaphp.value = ar;
document.form1.nombre_ar.value = nom_ar;
//alert(document.form1.destinophp.value);

  	for(j=0;j<comboGroup.length;j++){
		if(comboGroup[j]==from){
			//el nuestro es el siguiente
			i=j+1;
			thisCombo=comboGroup[i];
			prevCombo=comboGroup[i-1];
			prevComboTextIndex=j*2;
			thisComboIndex=i;
			thisComboTextIndex=(i*2);
			thisComboValueIndex=(i*2)+1;
		}
	}
	for (m=thisCombo.options.length-1;m>=0;m--){
		thisCombo.options[m]=null;
	}
	for(i=0;i<arrayValues.length;i++){
		existe=false;
		if(arrayValues[i][prevComboTextIndex]==prevCombo.options[prevCombo.selectedIndex].text){
			for(j=0;j<thisCombo.options.length;j++){
				if(arrayValues[i][thisComboTextIndex]==thisCombo.options[j].text){
					existe=true;
				}
			}
			if(existe==false){
				thisCombo.options[thisCombo.options.length]=new Option(arrayValues[i][thisComboTextIndex],arrayValues[i][thisComboValueIndex]);
			}
		}
	}
	//thisCombo.options[0].text = "HOTEL";
	thisCombo.options[0].selected=true;
	if(thisComboIndex<comboGroup.length-1){
		TCN_reload(thisCombo);
	}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  
  if(!d) d=document; 
  if((p=n.indexOf("?"))>0&&parent.frames.length) {
  d=parent.frames[n.substring(p+1)].document; 
  n=n.substring(0,p);
  }
  if(!(x=d[n])&&d.all) x=d.all[n]; 
  for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); 
  return x;
}



function otra(menu){
var suba = menu.options[menu.selectedIndex].value;
var nom_suba = menu.options[menu.selectedIndex].text;
//var destino = document.form1.destino.options[selectedIndex].text;
//alert("subarea: " + suba);
document.form1.subphp.value = suba;
document.form1.nombre_sub.value = nom_suba;
//alert(document.form1.hotelphp.value);
//alert(destino);
}

function otra2(menu,id){
var letra2 = menu.options[menu.selectedIndex].value;
//var destino = document.form1.destino.options[selectedIndex].text;
//alert(sub);

//var cad = "aagregar_empresa.php?let=" + letra2;

var cad = "?let=" + letra2 + "&amp;id=" + id;
top.location.href = cad;
//thisCombo.options[menu.selectedIndex].selected=true;
//document.form1.subphp.value = sub;
//alert(document.form1.hotelphp.value);
//alert(destino);
}

function otrab(menu){
var letra2 = menu.options[menu.selectedIndex].value;
//var destino = document.form1.destino.options[selectedIndex].text;
//alert(sub);

//var cad = "aagregar_empresa.php?let=" + letra2;

var cad = "?let=" + letra2;
top.location.href = cad;
//thisCombo.options[menu.selectedIndex].selected=true;
//document.form1.subphp.value = sub;
//alert(document.form1.hotelphp.value);
//alert(destino);
}

function otra3(menu){
var zon = menu.options[menu.selectedIndex].value;
//alert("zona: " + zon);
document.form1.zonaphp.value = zon;
//alert(document.form1.hotelphp.value);
//alert(destino);
}

