﻿// JavaScript Document


//Double Combo Box with Description Code- by Randall Wald (http://www.rwald.com)
//Visit JavaScript Kit (http://javascriptkit.com) for script
//Credit must stay intact for use

var num_of_cats = 10; // This is the number of categories, including the first, blank, category.
var open_in_newwindow=0; //Set 1 to open links in new window, 0 for no.
var option_array = new Array(num_of_cats);

option_array[0] = new Array("Seleccionar"); // This is the first (blank) category. Don't mess with it.

option_array[1] = new Array("Seleccionar",
"Sucursal Trinidad");

option_array[2] = new Array("Seleccionar",
"Sucursal Cochabamba");

option_array[3] = new Array("Seleccionar",
"Sucursal Chuquisaca");

option_array[4] = new Array("Seleccionar",
"Sucursal La Paz",
"Sucursal El Alto");

option_array[5] = new Array("Seleccionar",
"Sucursal Oruro");

option_array[6] = new Array("Seleccionar",
"Sucursal Cobija");

option_array[7] = new Array("Seleccionar",
"Sucursal Potosi",
"Sucursal Tupiza");

option_array[8] = new Array("Seleccionar",
"Santa Cruz Of. Central",
"Sucursal Montero");

option_array[9] = new Array("Seleccionar",
"Sucursal Tarija",
"Sucursal Yacuiba");




var url_array = new Array(num_of_cats);

url_array[0] = new Array("#"); // The first category. This should have no items other than "#".

url_array[1] = new Array("#", // The second category; the first "real" category. Note the initial #. That is the category which says "Please select a link." It doesn't need a URL. Start putting the other URL's in after that first line.
"strinidad.htm"); //Sucursal Trinidad

url_array[2] = new Array("#",
"scochabamba.htm"); //Sucursal Cochabamba

url_array[3] = new Array("#",
"schuquisaca.htm"); //Sucursal Chuquisaca

url_array[4] = new Array("#",
"slapaz.htm", //Sucursal La Paz
"selalto.htm"); //Sucursal El Alto

url_array[5] = new Array("#",
"soruro.htm"); //Sucursal Oruro

url_array[6] = new Array("#",
"scobija.htm"); //Sucursal Cobija

url_array[7] = new Array("#",
"spotosi.htm", //Sucursal Potosi
"stupiza.htm"); //Sucursal Tupiza

url_array[8] = new Array("#",
"ssantacruz.htm", //Central Santa Cruz
"smontero.htm"); //Sucursal Montero

url_array[9] = new Array("#",
"starija.htm", //Sucursal Tarija
"syacuiba.htm"); //Sucursal Yacuiba

function switch_select()

{
  for (loop = window.document.form_red.select_2.options.length-1; loop > 0; loop--)
  {
    window.document.form_red.select_2.options[loop] = null;
  }
  
  for (loop = 0; loop < option_array[window.document.form_red.select_1.selectedIndex].length; loop++)
  {
    window.document.form_red.select_2.options[loop] = new Option(option_array[window.document.form_red.select_1.selectedIndex][loop]);
  }
  
  window.document.form_red.select_2.selectedIndex = 0;
}
  


function box()

{
  if (window.document.form_red.select_2.selectedIndex == 0)
  {
    alert("Favor seleccionar una opción.");
  } else {
    if (open_in_newwindow==1)
    window.open(url_array[window.document.form_red.select_1.selectedIndex][window.document.form_red.select_2.selectedIndex],"_blank");
    else
    window.location=url_array[window.document.form_red.select_1.selectedIndex][window.document.form_red.select_2.selectedIndex]
  }
}

function set_orig()

{
  window.document.form_red.select_1.selectedIndex = 0;
  window.document.form_red.select_2.selectedIndex = 0;
}

window.onload=set_orig

///
