//------- DROPDOWN MENU CONTROL SUITE START -------

function doMenu(id){

  var obj = document.getElementById(id);
  var obj_list = document.getElementById(id + '_dropdown');

  if(obj_list.style.display == ''){

    rollMenu(id, 0);

  }

  if(obj_list.style.display == 'none'){

    rollMenu(id, null);

  }

}

function rollMenu(id, goal){

  var obj_list = document.getElementById(id + '_dropdown');

  if(obj_list.style.display == 'none'){

    if(parseFloat(obj_list.style.height) != 0){

      obj_list.style.height = 0 + "px";

    }

    obj_list.style.display = '';

  }

  if(goal == null){

    goal = obj_list.scrollHeight + 2;

    if(navigator.vendor == undefined){

      if(goal > 100){

        goal = 100;

      }

    }

  }

  if(Math.abs(parseFloat(obj_list.style.height) - goal) > 3){

    var obj_height = parseFloat(obj_list.style.height) + (Math.floor(.4 * (goal - parseFloat(obj_list.style.height))));
    obj_list.style.height = obj_height + 'px';
    var func_str = "rollMenu('" + id + "', " + goal + ")";
    window.setTimeout(func_str, 30);

  }else{

    obj_list.style.height = goal + "px";

    if(goal == 0){

      obj_list.style.display = 'none';

    }

  }

}

function setMenuValue(id, text, value){

  var obj_text = document.getElementById(id + "_text");
  var obj = document.getElementById(id);

  obj_text.value = text;
  obj.value = value;

  obj_text.focus();

  doMenu(id);

}

function captureKey(e){

  IE = (document.all);
  NS = (document.layers);

  whichASC = (NS) ? e.which : event.keyCode;
  whichObj = (NS) ? e.target : event.srcElement;
  whichKey = String.fromCharCode(whichASC).toLowerCase();

  event_arr = new Array(whichKey, whichObj);

  return event_arr;

}

function cKeyNextOpt(key, text_arr, cur_obj){

  opt_arr = new Array();
  opt_start = 0;
  set_start = false;

  regexp = new RegExp("^" + key);

  for(i=0; i<text_arr.length; i++){

    if(regexp.test(text_arr[i].toLowerCase())){

      opt_arr.push(text_arr[i]);

      if(set_start === false){

        opt_start = i;
        set_start = true;

      }

    }

  }

  if(opt_arr.length != 0){

    for(i=0; i<opt_arr.length; i++){

      if(cur_obj.value == opt_arr[i]){

        if(i < (opt_arr.length - 1)){

          nextOpt = opt_start + i + 1;
          break;

        }else{

          nextOpt = opt_start;
          break;

        }

      }

      nextOpt = opt_start;

    }

    return nextOpt;

  }else{

    return false;

  }

}

//------- DROPDOWN MENU CONTROL SUITE END -------

function writeFlash(id, src, width, height, param, param_val){

  document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"" + width + "\" height=\"" + height + "\" id=\"" + id + "\" align=\"middle\">");

  for(i=0; i<param.length; i++){

    document.write("<param name=\"" + param[i] + "\" value=\"" + param_val[i] + "\" />");
 
  }

  document.write("<embed src=\"" + src + "\" quality=\"high\" bgcolor=\"#ffffff\" width=\"" + width + "\" height=\"" + height + "\" name=\"" + id + "\" align=\"middle\" allowScriptAccess=\"always\" wmode=\"transparent\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />");
  document.write("</object>");

}

    

