function $() {
  var elements = new Array();
  for (var i = 0; i < arguments.length; i++) {
    var element = arguments[i];
    if (typeof element == 'string')
      element = document.getElementById(element);
    if (arguments.length == 1)
      return element;
    elements.push(element);
  }
  return elements;
}

function goBookmark(homepage) { 
  if (window.external && !window.sidebar) {
	var book_l = location.href;
	var book_t = document.title;
	if (homepage) {
	  book_l = 'http://www.sharesoftware24.com';
	  book_t = 'ShareSoftware24.com - Free Software Downloads';
	}
    window.external.AddFavorite(book_l, book_t); return false;
  }
  else {
    alert("Your web-browser does not support automatic addition of bookmarks.\n\n"+
		"You will have to use a key-combination or menu option specific to your browser:\n"+
		"  - for Mozilla/Mozilla Firefox and Opera try: Ctrl-D\n"+
		"  - for other browsers consult the program's help system/documentation\n\n"+
		"NOTE: The key combinations above will bookmark the page you were browsing at that moment.");
	}
}

function goMailTo(s1,s2,s3) {
  location.href = "mailto:"+s1+"@"+s2+"."+s3;
}

function relatedSoftwareTabs(obj) {
  var id = obj.id;
  for (i = 1; i < 4; i++) {
    if (id.indexOf(i) == -1) {
	  document.getElementById('soft-related-'+i).className = 'normal';
      document.getElementById('related-software-'+i).style.display = 'none';
	}
	else {
	  document.getElementById('soft-related-'+i).className = 'active';
	  document.getElementById('related-software-'+i).style.display = 'block';
	}
  }
}

function osCategoryTabs(obj) {
  var id = obj.id;
  for (i = 1; i < 5; i++) {
    if (id.indexOf(i) == -1) {
	  document.getElementById('os-category-'+i).className = 'normal';
      document.getElementById('category-frame-'+i).style.display = 'none';
	}
	else {
	  document.getElementById('os-category-'+i).className = 'active';
	  document.getElementById('category-frame-'+i).style.display = 'block';
	}
  }
}

function installSearchEngine() {
 if (window.external && ("AddSearchProvider" in window.external)) {
   // Firefox 2 and IE 7, OpenSearch
   window.external.AddSearchProvider("http://www.sharesoftware24.com/opensearch1.1.xml");
 }
}