// Copyright (c) 2003 Tennyson Maxwell Information Systems, Inc.  All Rights Reserved.  Unauthorized copying, reverse engineering, or use of the contents of this file is strictly prohibited.

var tppPassForms = true;
var tppAnalyze = true;

/*
function tppfr(o, f) { eval("tpp"+f+" = "+o+"."+f+"; function tppn"+f+"(a,b,c,d,e,f,g) { return tpp"+f+"(tpp"+(f.substr(0,5)=='write'?"wxfm(a,b,c,d,e,f,g))":"xfm(a),b,c,d,e,f,g)")+"; } "+o+"."+f+" = tppn"+f+";"); }
tppfr("location", "replace");
tppfr("location", "assign");
tppfr("window", "navigate");
tppfr("window", "open");
tppfr("document", "write");
tppfr("document", "writeln");
*/

function tppexplain(x)
  {
  if( !x )
    x = location.search.substr(1);
  x = x.split('&');
  var url;
  var code;
  for(var i in x)
    {
    if( x[i].substr(0,2) == 'u=' )
      url = x[i].substr(2);
    else if( x[i].substr(0,2) == 'c=' )
      code = 1*(x[i].substr(2));
    }
  document.write(tppAnalyze ? 
    'The link to <a href='+url+'>'+unescape(url)+'</a> was not copied because '+tppcodestr(code)+'<p>' :
    'The file <a href='+url+'>'+unescape(url)+'</a> is not on this WebDisc CD.<p>');
  }
function tppcodestr(x)
	{
  switch(x) {
    case 900: return "it is located too far from the project's starting point.";
    case 901: return "it is located too far outside the project boundary.";
	  case 902: return "it is not within the project boundary.";
	  case 903: return "it was excluded by the project properties.";
	  case 904: return "it was excluded by the site's Robot Exclusion properties.";
	  case 905: return "it was not needed for the project.";
	  case 906: return "the project was stopped due to a project limit property.";
	  case 908: return "it was deleted from the project.";
	  case 0: 	return "the project hasn't finished running yet.";
    }
	return "the server returned status code "+x+".";
	}
function tppmsg(x,a)
	{
  if( confirm(tppAnalyze ?
    a+"\n\nThis file was not retrieved because "+tppcodestr(x)+"\n\nDo you want to open it from the server?" :
    a+"\n\nThis file is not on the WebDisc CD.  Do you want to open it from the server?") )
		window.location = a;
	}
function tppnul(a,b,c,d,e,f,g)
	{
	return '';
	}
function tppget(f,x)
	{
	var s = tppval(f,x);
	var r = tppxfm(s);
	if( r != s )
		{
		window.location=r;
		return false;
		}
  if( !tppPassForms )
    return false;
	return confirm("Using this form requires an active Internet connection.  Press OK to submit your request, or Cancel to return to browsing.");
	}
function tppformval(x)
	{
	return x;
	}
function tppval(f,x)
	{
	var r = f.action.split('#')[0] + (f.method.toLowerCase()=='post' ? '¿' : '?');
	for( var i = 0; i < f.elements.length; i++)
		{
		var e = f.elements[i];
		if( !e.name )
			continue;
		var t = e.type.toLowerCase();
		if( t == 'submit' && !e.value )
			e.value = 'Submit Query';
		if( t == 'select-one' )
			r += e.name+'='+tppformval(e[e.selectedIndex].value)+'&';
		else if( ((t=='radio' || t=='checkbox') && e.checked) || t=='hidden' || t=='text' || t=='password' || t=='textarea' || t=='submit' )
			r+=e.name+'='+tppformval(e.value)+'&';
		}
	if( x )
		r += x;
	r = r.substr(0,r.length-1);
	if( f.method.toLowerCase()=='post' )
		r += '_TPPPOST';
	return r;
	}
function switchcd(x)
	{
	alert('The file you clicked on ('+x+') is located on Disk 2 of this WebDisc set.	Please insert Disk 2 now, and press Ok.  After the file has loaded, you must replace Disk 2 with the previously inserted disk, to continue browsing.');
	window.location = x;
	}
function tppprexfm(a)
	{
  var b = ""+a;
	/*
	if(b.substr(0,8)=='file:///')
		return b.substr(b.indexOf('/',8));
	*/
	return a;
	}
function xfmpatch(a)
	{
	return a;
	}
function tpppostload()
  {
  }
function endswith(x,y)
  {
  var a = ""+x;
  var b = ""+y;
  return a.length >= b.length && a.substr(a.length-b.length) == b;
  }
function tppload()
  {
  for( var i = 0; i < document.links.length; i++ )
    {
    var e = document.links[i];
    var s = e.childNodes.length ? e.firstChild.src : "";
    if( /\/0000\/0002.GIF$/.test(s) )
      {
      e.href = "../INDEX.HTM";
      }
    else if( e.href == "javascript:void(1)" || (/\/0000\/0004.GIF$/.test(s)) )
      {
      e.disabled = true;
      e.style.textDecoration = "none";
      e.style.cursor = "default";
      e.target = "";
      }
    else if( e.href == "javascript:void(2)" )
      {
      e.disabled = true;
      e.style.textDecoration = "none";
      e.style.cursor = "default";
      e.style.display = "none";
      e.target = "";
      }
    else if( e.href.indexOf("javascript:tppmsg(") == 0 )
      {
      e.target = "";
      }
    }
  tpppostload();
  }
function tppwxfm(a,b,c,d,e,f,g)
  {
  return a;
  }
