function nl_getRootPath()
{
	var f = document.location.href + "";
	if (f.lastIndexOf("/archive/") >= 0) {
		f = f.substring(0,f.lastIndexOf("/archive/")+1);
	}
	return f;
}
document.write('<sc'+'ript src="'+nl_getRootPath()+'javascript/lib/prototype.js"></scr'+'ipt>');
document.write('<sc'+'ript src="'+nl_getRootPath()+'javascript/lib/scriptaculous.js"></scr'+'ipt>');
document.write('<sc'+'ript src="'+nl_getRootPath()+'javascript/utils/Delegate.js"></scr'+'ipt>');

// Event Binding Code
if (null == versionID) var versionID = new Array(); versionID[versionID.length] = ("Event Binding: v1.0\n");

/**
 * Function that returns the url of the the podcast sindication xml
 */
function getUrltoXml()
{
	var hostname = document.location.hostname;
	var pathname = document.location.pathname;
	
	var lastSlash = pathname.lastIndexOf('/');
	var secondLastSlash = pathname.lastIndexOf('/', lastSlash-1);
	var thirdLastSlash = pathname.lastIndexOf('/', secondLastSlash-1);
	var path = pathname.substring(0, thirdLastSlash);

	return hostname + path + '/podcast.xml';
}

function nl_onLoad() {
  if (null == document.nl_config) { alert("General initialisation failed!  Please contact webteam@netlanguages.com."); return; }
  if (null == document.nl_config.onload) { alert("ONLOAD initialisation failed!  Please contact webteam@netlanguages.com."); return; }
  eval (document.nl_config.onload);
  document.nl_config.loaded = true;
}
function nl_onUnload() {
  if (null == document.nl_config) { alert("General initialisation failed!  Please contact webteam@netlanguages.com."); return; }
  if (null == document.nl_config.onunload) { alert("ONUNLOAD initialisation failed!  Please contact webteam@netlanguages.com."); return; }
  eval (document.nl_config.onunload);
}
function nl_wrap(nl_code) {
  if (null == document.nl_config) { alert("General initialisation failed!  Please contact webteam@netlanguages.com."); return; }
  if (! document.nl_config.loaded) { alert("Please wait until the page has finished loading before doing the exercises!"); return; }
  eval(nl_code);
}
function _addEvent(ev,code) {
  if (ev.toLowerCase() == "onload") this.onload += code + ";\n ";
  else if (ev.toLowerCase() == "onunload") this.onunload += code;
  else alert("Event '"+ev+"' not supported\nCould not bind '"+code+"'.");
}

document.nl_config = new Object();
document.nl_config.loaded=false; document.nl_config.onload="";
document.nl_config.onunload=""; document.nl_config.add = _addEvent;
window.onload=nl_onLoad;
window.onunload=nl_onUnload;

function nl_error()
{
  var e = "\nSorry, a JavaScript error has occurred!\n\n";
  e += "This error probably occurred because you have a popup blocker turned on. " +
    "Please ensure that all popup blockers are turned off.\n\n" +
    "If you cannot identify the problem, please contact Net Languages (support@netlanguages.com) with this error and version information:\n\n";
  e += "Error Information:\n";
  if (null != arguments)
  {
    if (null != arguments.length)
    {
      e += "      Desc:"+" " + arguments[0] + "\n";
      e += "      File:"+" " + arguments[1] + "\n";
      e += "      Line:"+" " + arguments[2] + "\n";
    }
    else
      e += "      Error :!\n";
  }
  else
    e += "      No error information found!\n";

  e += "Browser Information:\n";
  e += "      "+navigator.appName+" - "+navigator.appVersion+" - "+navigator.appCodeName+"\n";
  e += "\nThank-you!\n";
  alert(e);
  return true;
}

window.onerror = nl_error;

// End of Event Binding Code

