// Copyright (c) 2004 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 tppnotrand() { return 0.5; }
Math.random = tppnotrand;

/*
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 debug(x)
	{
	alert(x);
	}

function tppexfm(x)
	{
	if( typeof(x) == "string" )
		{
		x = x.replace(/(\. *href|src|location) *= *(('([^\']|\\')*')|("([^\"]|\\")*"))/, "$1=tppxfm($2)");
		x = x.replace(/(\. *replace|assign|navigate|open) *\( *(('([^\']|\\')*')|("([^\"]|\\")*"))/, "$1(tppxfm($2)");
		}
	return x;
	}

function tppdu(x)
  {
  return tppsrc;
  }

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(url == undefined ? 
    'This file is not on the WebDisc CD.<p>' : 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.replace(/ /g, '+');
	}
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' || t=='button' )
			r+=e.name+'='+tppformval(e.value)+'&';
		}
	if( x )
		r += x;
	if( r.substr(r.length-1) != '?' )
		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 tppprewxfm(x)
	{
	return x;
	}
function tpppostwxfm(x)
	{
	return x;
	}
function tppprexfm(a)
	{
	/*
	var b = ""+a;
	if(b.substr(0,8)=='file:///')
		return b.substr(b.indexOf('/',8));
	*/
	if( typeof(a) != 'string' )
		return a;
	if( a.indexOf('http://www.khoslasurgicals.com/') == 0 )
		a = a.substr(31);
	a = a.replace(/,/g, '%2C');
	return a;
	}
function xfmpatch(a)
	{
	return a;
	}
function tpppostload()
  {
  }
function tppload()
  {
  for( var i = 0; i < document.links.length; i++ )
    {
    var e = document.links[i];
    if( e.href == "javascript:void(1)" )
      {
      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;
  }
function tppixfm(a,b,c,d,e,f,g)
  {
  return tppwxfm(a,b,c,d,e,f,g);
  }
