
/*
 * This code was lifted from the article
 * Javascript includes - yet another way of RPC-ing
 * at http://www.phpied.com/
 *
 */

var included_files = new Array();

function include_dom(script_filename) {
	var html_doc = document.getElementsByTagName('head').item(0);
	var js = document.createElement('script');
	js.setAttribute('language', 'javascript');
	js.setAttribute('type', 'text/javascript');
	js.setAttribute('src', script_filename);
	html_doc.appendChild(js);
	return false;
}

function include_once(script_filename) {
	if (!in_array(script_filename, included_files)) {
		included_files[included_files.length] = script_filename;
		include_dom(script_filename);
	}
}

function in_array(needle, haystack) {
	for (var i = 0; i < haystack.length; i++) {
		if (haystack[i] == needle) {
			return true;
		}
	}
	return false;
}

/* 
 * load the external js file used by the Set links above.
 */
function load_javascript()
{
  include_once('/js/getElementsByClassName.js');
  include_once('/tcc/tc_scripts.js');
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}



