// *** 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", bookmarks_list_label, false);
var bookmark_count = 0;

function bookmarks_list_label() {
bookmark_list_label = document.getElementById("bookmarkList").getAttribute("label");
}

// **** add an item to the bookmark dropdown list ****
function add_bookmark() {
var tempA = window._content.location.href;
var tempB = document.getElementById("bookmarkList");
dump("****** Bookmark DROP DOWN : " + tempA + "\n");
	//tempB.setAttribute("editable", false);
	//tempB.setAttribute("label", tempA);
	var report = tempB.getAttribute("label");
	tempB.appendItem(tempA, tempA);
	//tempB.setAttribute("editable", true);
dump("** --" + report + "--*** report\n");
        bookmark_count++;
//dump_bookmarks();
}

// **** load a uri from the list into the browser ****
function load_bookmark() {

// **** Reads the value of the menulist item clicked on
// **** and calls new_page with the uri.

	//dump("DropDownListAA @@@@@@@@@@@@@@@@@@@@@@@\n");
	var temp = document.getElementById("bookmarkList");
	var list_label = temp.getAttribute("label");
	var site = temp.getAttribute("value");
	if (site == "") { return; }
	dump("DropDownList" + site +"\n");
	//dump("**** current focus " + focus + " **\n");
	new_page(site);
	temp.setAttribute("label", bookmark_list_label);
	//dump_bookmarks();

}

 function dump_bookmarks() {
var j = 0;
  var ed = document.getElementById("bookmarkList");
  //var list_label = document.getElementById("kioskDefaults").getString("bookmarkListLabel");
   //dump("**-dump LIST_ITEM---**" + list_label + "\n");
  while ( bookmark_count > 0 ) {
   var item = ed.removeItemAt(0);
   bookmark_count--;
   //dump("**&&%% -- REMOVED ITEM FROM LIST: " + bookmark_count + " --*&%*\n");
  }
  ed.setAttribute("label", bookmark_list_label);
 // dump("**-dump---**" + ed + "\n");
  //for (var list in ed) {
    // ++j;
    //dump(list + "*ENUM*" + j + "\n");
  //}

}