//  Javascript to Squelch ThirdVoice version 4.1
//
//  Copyright 1999 by Ed Zahurak.  All Rights Reserved.  Yadda Yadda.
//  email: tjunkie@digitech.org
//  http://www.digitech.org/~tjunkie/funk_thirdvoice.html
//  Terms of Usage and Distribution.
//  --------------------------------
//  This script is freely distributable, and any modification is allowed,
//  provided this notice remains attached, and you're using this script
//  to squelch thirdvoice.  Use of this script to make thirdvoice tougher
//  to beat is expressly prohibited.  Use of this script by or for any
//  means constitutes on your part an agreement with these terms.  If you
//  do not agree with these terms, delete this script immediately.
//
//  In the interest of bandwidth-saving, feel free to remove any and all
//  comments including/after this one in your "live" version of this
//  script.  I just want the above notice intact, thanks.
//
//  Say No to Drugs.  Quit smoking.  Thou shalt not commit adultery.
//  Live Long, and Prosper.  Ich bin ein Berliner... Oh, you get the point.
//
//  SayNoToThirdVoice.com: http://saynotothirdvoice.com
//  3V-Combat Techniques: http://www.cse.msu.edu/~bowersj2/
//
//  Instructions
// -------------
//  Insert this stuff at the -bottom- of your HTML page.  Bottom.  Trust me.
//  The very LAST thing before the BODY tag. 
//  That's pretty much how easy it is.  If you want it to do something other
//  than bug users of 3V to turn it off, change the "Found3V()"
//  function.
//
//  History
// -------------
//  9/15/99 - Version 4.1 - Added another netscape-specific 3V detection function.
//            Detects 3V before notes are posted.
//  9/14/99 - Version 4 - Total Rebuild, yet again, but I think I've got
//              it right this time.
//  9/13/99 - Version 3.0 - Total Rebuild.
//  7/01/99 - Major fixes to reduce the script's performance hit.
//  7/01/99 - Bugfix - script errors may occur if you don't clearInterval
//            before a redirection.
//  6/30/99 - Released new script, this one.
//  6/28/99 - Original Release

//  Here it is: The new netscape-only 3V Detection function.  It
//  works because of the way javascript works:  if there's two functions
//  with the same name, it calls the LAST one loaded.  TVDocumentComplete
//  is the function that fires when 3V loads a page.  We've replaced that
//  function with one that does our magic.
//  Just uncomment the lines below if you want to use this.

	function TVDocumentComplete()
	{
	   alert( "Sorry, Third Voice isn't allowed on this site\nPlease disable Third Voice and\nc'mon back.  Thanks!" );
	   document.location.href = "http://www.steelguitarinfo.com/whynotv.html";
	}

//  function to run if thirdvoice notes are found
//  replace with any devious function that you wish. ;)

// just some variable initialization.
  var found = 0;
  var iv = null;

// set mydomain to the value for your domain.  For example, "geocities.com"
// don't worry about this if you're using a checktype of "thirdvoice"
  var mydomain = "digitech.org";  

// set checktype to "domain" to check for images not from your domain.
// set checktype to "thirdvoice" to check for images containing thirdvoice.com
//     in their urls.  
//  var checktype = "domain";
  var checktype = "thirdvoice";  
//  This is the function that executes if 3V is found to be running
  function Found3V()
  {
    found++;
    if ( found == 1 )
    {
    	if ( iv != null)
    	{
    	  clearInterval( iv );
    	}
//  Uncomment the following line to display an alert box.  
    alert( "Sorry, Third Voice is not allowed on this site\nPlease disable Third Voice and\nc'mon back.  Thanks!" );
    
//  Uncomment the following line to ship them off to another URL.
      document.location.href = "http://www.steelguitarinfo.com/whynotv.html";
    }
  }

// This one does the checking for 3V  
  function Check3V( start, level )
  {
    if ( start.images )
    {
      if ( checktype == "domain" )
      {
        for ( i = 0; i < start.images.length; i++ )
        {
          test_this = start.images[i].src;
          if ( test_this.indexOf( mydomain ) == -1)
          {
            Found3V();
            break;
          }
        }
      }
// if it's not "domain", assume it's checking for thirdvoice.com.
      else
      {
        for ( i = 0; i < start.images.length; i++ )
        {
          test_this = start.images[i].src;
          if ( test_this.indexOf( "thirdvoice.com" ) != -1 )
          {
            Found3V();
            break;
          }
        }      
      }

	 if ( document.layers && level < 2 )
	 {
	 	for ( x = 0;  x < (start.layers.length - 1); x++ )
		{
		  Check3V( start.layers[x].document, level + 1 );
		}
	 }
	  
    }
  }

// This actually runs the function
  Check3V( document , 1 );
  
// Check MSIE versions every 2 seconds for page updates.
// wish there was some way around this, but there isn't,
// currently.  MSIE is slow to begin with, and now we're
// bogging it down some more.
  if (!(document.layers))
  {
    iv = setInterval( "Check3V( document, 1)", 2 * 1000 );
  }

