// *** Copyright (c)2002 Jim Massey. All rights reserved  ***********
// *** massey@stlouis-shopper.com **************
// *** No Warranty - certified to work with nothing ***
// *** developed to work with mozilla kiosk **** 

window.addEventListener("load", populate_list, false);
var static_uri_list_label = "";

function populate_list() {
// **** This function is a bad hack. 
// **** There must be a better way to find the length of a stringbundle.
// **** This routine just crashes when there are no more matching entries
// **** in the bundle.
	dump("**-ZZZdumpIT---**\n");
	var Ai=1;
  	var AbaseName = "uriString";
	var AbaseValue = "uriValue";
	var Aed = document.getElementById("teststrings");
	var Acount = Aed.getString("uriCount");
	dump("**-ZZZdumpITAA---**" + Acount + "\n");	

 do {
	dump("**-ZZZdumpITAA---**" + Acount + "\n");
  	 var Aeddie = Aed.getString(AbaseName + Ai);
	 var AeddieV = Aed.getString(AbaseValue + Ai);
	++Ai;
	dump("**-dumpITAA---**" + Aeddie + AeddieV + Acount + "\n");
	uri_drop_down(Aeddie, AeddieV);
	dump("**-dumpITBB---**\n");
    } while (Ai <= Acount);	
dump ("*@*@= FINISHED DO LOOP\n");
static_uri_list_label = document.getElementById("uriList").getAttribute("label");
}

 function url_list() {
// **** Reads the value of the menulist item clicked on
// **** and calls new_page with the uri.

	dump("DropDown URIListAA @@@@@@@@@@@@@@@@@@@@@@@\n");
	var temp = document.getElementById("uriList");
	//var site = document.getElementById("teststrings")
		//                    .getString("urilistLabel");
	//dump_stuff();
       //dump("**** current focus LABEL: " + temp.selectedItem.value + "**\n");
	new_page(temp.selectedItem.value);
	temp.setAttribute("label", static_uri_list_label);
}

// **** function to load uri entered into the uri bar ***
function url_list_inputField() {
	var temp = document.getElementById("uriList");
	new_page(temp.inputField.value);
	dump("@@@** TEXT LENGTH: " + temp.inputField.textLength + "**\n");
}

// **** Function to append an uri name/value to list ***
function uri_drop_down(Atemp, AtempV) {
var tempB = document.getElementById("uriList");
dump("****** HISTORY DROP DOWN URI LIST : " + tempB + AtempV + "\n");
	//tempB.setAttribute("editable", false);
	//tempB.setAttribute("label", Atemp);
	//tempB.setAttribute("value", AtempV);
	//var report = tempB.getAttribute("value");
	tempB.appendItem(Atemp, AtempV);
	//tempB.setAttribute("editable", true);
dump("** --" + Atemp + "--*** report\n");
}

// function dump_stuff() {
//  var i=1;
//  var j=1;
  //var test_item = PrintLoader;
//  var baseName = "testString";
//  var baseValue = "testValue";
//  var ed = document.getElementById("uriList");
  //menu_items = document.getElementById("base-sites");
  //eddie = ed.stringBundle.getSimpleEnumeration("teststrings").getNext();
  //eddie = Components.classes['@mozilla.org/intl/stringbundle;1'].getService();
  //eddie = eddie.QueryInterface(Components.interfaces.nsIStringBundle);
   
// dump("**-dump---**" + ed.inputField + "\n");
// for (var list in ed.inputField) {
//   ++j;
//   dump(list+ "*ENUM*" + j + "\n");
// }

//   dump("-----** \n" + ed +"--**Focus\n");
// }


