var i = new Array; function set_range(sym_i, field_name){ //get the current index. var current = field_name.options[field_name.options.selectedIndex].value; //if the current one is out of line hit it and then put it in line. if ( current < i[sym_i].from_year ){ current = i[sym_i].from_year; } if ( current > i[sym_i].to_year ){ current = i[sym_i].to_year; } field_name.options.length = 0; var k = 0; for(j = i[sym_i].from_year; j <= i[sym_i].to_year; j++){ field_name.options[k] = new Option(j,j,false,(j == current ? true : false)); k++; } } function get_range(sym_field, field_to_set, sym_list, desc_id) { var field = document.getElementById(sym_field); var cur_entry = field.value; cur_entry = cur_entry.toUpperCase(); field.value = cur_entry; var description = document.getElementById(desc_id); var found = 'false'; var cur_len = cur_entry.length; var output = ''; var list = document.getElementById(sym_list); var index = 0; var count = 0; var COLS = 6; var rows = 0; if(cur_len > 1) { getSymMatches(cur_entry); output += ""; for(index = 0; index < i.length; index++){ if(i[index].sym.substr(0, cur_len).toUpperCase() == cur_entry.toUpperCase()) { count ++; if((count - 1) % COLS == 0){ output +=""; rows++; } output += ""; if(count % COLS == 0) output +=""; } if(i[index].sym.toUpperCase() == cur_entry.toUpperCase()){ set_range(index, field_to_set); description.innerHTML = i[index].name; //alert(index); //output = ''; found = 'true'; //break; } } if(found == 'false' && cur_entry.length >= 1){ description.innerHTML = ''; } if(output) { output += "
Top Symbols Matching '"+cur_entry+"'
"; output += i[index].sym; //output += " - " + i[index].name; output += "
"; list.innerHTML = output; list.style.marginTop = (30 + (rows * 19)) * -1; //alert(count); list.style.visibility = 'visible'; } else { list.innerHTML = ''; list.style.visibility = 'hidden'; } } else { list.style.visibility = 'hidden'; description.innerHTML = ''; } } function hide_matches(sym_matches) { var matches = document.getElementById(sym_matches); matches.style.visibility = 'hidden'; } function choose_sym(sym_input, index, matches, desc_id) { var sym = document.getElementById(sym_input); var desc = document.getElementById(desc_id); var list = document.getElementById(matches); //hide the junk desc.innerHTML = i[index].name; list.innerHTML = ''; list.style.visibility = 'hidden'; //update the field sym.value = i[index].sym; } function showDesc() { document.getElementById('comment').className='visible_desc'; document.getElementById('intro').className='hidden_desc'; } function hideDesc() { document.getElementById('comment').className='hidden_desc'; document.getElementById('intro').className='visible_desc'; } function getSymMatches(sym) { dojo.io.bind({ url: "/sym_dates.cgi?sym="+sym, load: function(type,data,evt){ }, error: function(type, error){ alert("Error: "+ type + " n " + error); }, sync: true, useCache: true, mimetype: "text/javascript" }); }