//===================================================================
//          PROTECTION Kit
// this script offers Link protection, Copyright protection and two zoom functions,
// which  both contain a copyright protection. The invoking page is also copyright protected.
// a special link check is done.
//
// special solutions for DOM 1, DOM 2 and no-DOM browsers. Thereīs still a bug
// not-HTML-Zoom with IE and copyright. IE4, MAC and some OPERA is not yet tested.
//
// Include this script into your page in the HEADER section:
//
// <SCRIPT LANGUAGE="JavaScript" type="text/javascript" src="check.js"></SCRIPT>
// <script type="text/javascript">
// var got = 0;
// got = checker();
// if (got == 0) { top.location.href = illegal; }
// if (got == 2) { alert(i_local); }
// </script>
// <noscript>
// <meta http-equiv="refresh" content="1;url=http://www.spitzerer.de/noscript.htm">
// </noscript>
//
//
// 1. URL Check
// first the link of accepted urlīs is tested. enter your list of trusted urlīs in the array.
// minimum URL length is 20 characters. Enter at least your own domains.
// This inhibits illegal use of your JS-Scripts  and specially this script also.
var accepted_domains = new Array(
      "http://www.glasclub.com",
      "http://aachen.glasclub.com",
      "http://hamburg.glasclub.com",
      "http://norden.glasclub.com",
      "http://nordlichter.glasclub.com",
      "http://scandinavia.glasclub.com",
      "http://glasfriendenclub.glasclub.com",
      "http://www.glasclub.org",
      "http://www.glasclub.de",
      "http://www.glas-automobil-club.com",

      "http://www.goggo-glasfahrer-dgf.de",
      "http://ud06_100.ud06.udmedia.de",
      "http://ud06.udmedia.de",
      "http://www.udmedia.de"  );
     //12345678901234567890
var illegal = "http://www.spitzerer.de/illeg.htm";    //page called illegal linking
var noscri = "http://www.spitzerer.de/noscript.htm";  //page called no Javascript
var i_local = "illegal Directory";                    //message illegal local dir
var localroot = "/spitzerer.+/";			      //local Directory permission
//
// 2. each page containing the script is copyright-protected.
// =========The Alert Messages - set the message you want======================
var n_alrt = "Copyright by Wolfgang Spitzbarth";
		//main screen copyright alarm
// above is the copyright-Message for the main screen.

// Images to be "zoomed" must have a width above 200 pixels, this is not checked.
// text should not be empty, use &nbsp; instead. An empty field may cause courious results
// with Netscape.
//
// Zooming:
// <a href="javascript:show_xx( --parameters ---)"><img src="thumbnail image" alt="" border="0"></a>
// for the different parameter-List HTML/JS  see chapter 3/4 below.

// >>>>>>>>>>>>>>>  3. HTML Zoom is done with function show_htm : <<<<<<<<<<<<<<<<

//     show_htm(pic_nam, target, width, height, bottom_text);
// e.g. show_htm('isar_64.jpg',"_blank", 640, 480, "GLAS ISAR im Rennsport 1964");
// the HTML-Window will look like:   ---------------------------------
//                                   |  t_ico   |   t_txt            |
//                                   ---------------------------------
//                                   |     Pichture centered         |
//                                   ---------------------------------
//                                   | closebutt|  bottom_text       |
//                                   ---------------------------------
// You donīt need a separate HTML-File for each zoom-Picture !
// Auto-resize provides different window-sizes without a close between
// the popups. You may adjust the parametes below fitting your needs.
// ========parameters for your individual setup of HTML Popup Window ===========
var bcol = "#dfdfdf";                                   //background color
var tit = "Oldtimer - Ausfahrten - Spass";     //page title

var fnt = "<font size=-1 color=black face=Arial>";      //bottom text font

var t_txt = "W.S. Softrans";   //Headline Text
var t_fnt = "<font size=+1 color=black face=Arial>";    //headline text font
var t_ico = "<img src='s.gif' alt='W.S.' width=40 height=40 border=0>";
                                                        //Headline Icon
var offs = 60;                                          //offset for Head and Bottom lines
var b_but = "schlie&szlig;en/close";                    //close button text
var v_scroll = "yes";                                   //Scroll bars
var v_alrt = "Copyright Wolfgang Spitzbarth - HTML Zoomed picture ";
		//html popup window Copyright alarm

//
//
// >>>>>>>  4. Zoom without HTML is done with function show_js : <<<<<<<<<<<<<<<

//       show_js(pic_nam, width, height, scroll, time_out);
// e.g. show_js('isar_64.jpg', 640, 480, 1, 5);
// scroll=0/1 switches scrollbar on/off
// if time_out is not zero, the window livetime is set to time_out*1000
var a_alrt = "Copyright Wolfgang Spitzbarth - Zoomed picture";
		//script popup window Copyright alarm
// THERE ARE STILL PROBLEMS with IE 5/IE 6 !!!!!!
//
// >>>>>>>  5. Test conditions: <<<<<<<<<<<<<<<

// Dipl.Ing. Wolfgang Spitzbarth, E-Mail spitzerer@t-online.de, 2004
// TESTED with OS : Win NT, Win 2k, Win XP, Linux 7.0
// Tested with Browser : Netscape 4.x, 6.x, Mozilla (all), Firefox
//                       Opera
//                       Microsoft IE 5.5, IE 6 (Missing: IE4, IE5)
//

// ===========DO NOT modify below this line !==================
var n6;
var urlfound = 0;
//----------------checks the URL---------------------
function checker()
{
//alert(navigator.appName)
if (navigator.appName == 'Netscape')
	{
	n6 = false;
	if (parseInt(navigator.appVersion) > 4.9) n6 = true;
    //alert(navigator.appVersion);
	}
else
	{
       //alert(navigator.appVersion);
	}
//--- checking trusted URL sites
	refr = document.referrer.substring(0,20);
	for (i=0; i<accepted_domains.length; i++)
		{
		trust = accepted_domains[i].substring(0,20);
		if (trust == refr)
  			{
  			urlfound = 1;
			break;
  			}
		}
//------local running Version---------
if ((document.referrer.length == 0)||(document.referrer.substring(0,5) == "file:"))
  	{
  	urlfound = 1;
  	Erg = document.URL.search(/http.+/);
  	if (Erg != -1)
     		{
     		urlfound = 0;
     		}
   	if (urlfound == 1)
     		{
     		Ergebnis = document.URL.search(/glasclub.+/);
     		if (Ergebnis == -1)
         		{
         		urlfound = 2;
         		}
      		}
   	if (urlfound == 1)
     		{
		setcopyfunc();
		}
    	}
return urlfound;
}
function urlchecker()
{
var chk = 0;
   chk = checker();
   return chk;
}
//----------------alert-Fenster fuer Copyright--------------
function makealert()
{
	alert(n_alrt);
	return false;
}
//----------------alert-Fenster fuer Copyright--------------
function makalert()
{
	vchild.alert(v_alrt);
	return false;
}
//----------------alert-Fenster fuer Copyright--------------
function makaalert()
{
	achild.alert(a_alrt);
	return false;
}

//----------------function detect right mouseclick---------
function captureMousedown(evt)
{
	if (evt)
		{
		mouseClick = evt.which;
               	}
	else
		{
		evt = window.event;
		mouseClick = window.event.button;
		}
	if (mouseClick==2 || mouseClick==3)
		{
		makealert();
		return false;
		}
   	return true;
}
function capturMousedown(evt)
{
	if (evt)
		{
		mouseClick = evt.which;
               	}
	else
		{
		evt = vchild.window.event;
		mouseClick = vchild.window.event.button;
		}
	if (mouseClick==2 || mouseClick==3)
		{
		makalert();
		return false;
		}
   	return true;
}
function capturaMousedown(evt)
{
	if (evt)
		{
		mouseClick = evt.which;
               	}
	else
		{
		evt = achild.window.event;
		mouseClick = achild.window.event.button;
		}
	if (mouseClick==2 || mouseClick==3)
		{
		makaalert();
		return false;
		}
   	return true;
}

function right(e)   //just the same as captureMousedown
{
   r =  captureMousedown(e)
   return r;
}
//-----------inhibit copy keys---------------
function captureKey(evt)
{
	if (evt)
		{
		keycode = evt.which;
		}
	else
		{
	    	evt = window.event;
       		keycode = evt.keyCode;
		}
       	if ( keycode < 37 || keycode > 40 )
		{
		makealert();
		return false;
    		}
       return true;
}
//-----------inhibit copy keys---------------
function capturKey(evt)
{
	if (evt)
		{
		keycode = evt.which;
		}
	else
		{
	    	evt = vchild.window.event;
       		keycode = evt.keyCode;
		}
       	if ( keycode < 37 || keycode > 40 )
		{
		makalert();
		return false;
    		}
       return true;
}
//-----------inhibit copy keys---------------
function capturaKey(evt)
{
	if (evt)
		{
		keycode = evt.which;
		}
	else
		{
	    	evt = achild.window.event;
       		keycode = evt.keyCode;
		}
       	if ( keycode < 37 || keycode > 40 )
		{
		makaalert();
		return false;
    		}
       return true;
}

//-----------set the event handlers--------------
function setcopyfunc()
{
	if (document.layers)
		{
        	if (navigator.appName == 'Netscape')
            		{
			if (n6) {
	    			document.captureEvents(Event.CONTEXTMENU);
   		 		}
			//else    {
	    			document.captureEvents(Event.MOUSEDOWN);
   		 	//	}
			}
		else
			{
			window.captureEvents(Event.MOUSEDOWN);
			document.captureEvents(Event.MOUSEDOWN);
			}
		//document.captureEvents(Event.KEYPRESS);
		//document.captureEvents(Event.KEYDOWN);
		//document.captureEvents(Event.KEYUP);
		document.captureEvents(Event.CONTEXTMENU);
		}
       	if (navigator.appName == 'Netscape')
       		{
		if (n6) {
			document.oncontextmenu = makealert;
	 		}
		//else    {
			document.onmousedown = captureMousedown;
	 	//	}
		}
	else
		{
		document.onmousedown = captureMousedown;
		}
	//document.onkeypress  = captureKey;
	//document.onkeyup     = captureKey;
	//document.onkeydown   = captureKey;
	window.onmousedown   = captureMousedown;
	document.oncontextmenu = makealert;

}


//----------zoom popup window ---------------
function myzoom(nam, x, y, scroll, tim )
{
     show_js(nam, x,y,scroll, tim);
}
//----------zoom popup window ---------------
function myhzoom(nam, x, y, ttx )
{
ttt = "&nbsp; ";
     if (strlen(ttx) > 0) ttt = ttx;
     show_htm(nam, "_blank", x,y, ttt);
}

var tbar = "<td align=center width=80>" +t_ico+ "</td>" +
	   "<td align=left>" +t_fnt+" "+t_txt+ "</font></td></tr><tr>";
var syc =  "" ;
this.lastWidth = 0;
this.lastHeight = 0;
this.vchild = null;

// =================Zoom with HTML ========================
function show_htm(src,target,xa,ya,xtx)
{
    if(document.layers || window.opera){of=-8;} else {of=-0;}

    var html='<HTML><HEAD><title>'+tit+'</title>' +
             ' <style type="text/css"> ' +
             '   body {margin-left:'+of+'px; margin-top:'+of+'px; ' +
             '         margin-right:0px; margin-bottom:0px; ' +
             '         text-align : center; scroll:auto;} ' +
             ' </style> ' +syc+  '</HEAD>'  +
     	     '<body bgcolor='+bcol+ '>' +
             '<table border=0 width=100%><tr>' +tbar+ '<td align=center colspan=3>' +
             '<img src="' +src+ '" border="0">' +
             '</tr><tr><td align=center width=80><form name=form1>' +
             '<input type=button value='+b_but+' onclick="javascript:window.close()">' +
             '</form></td>' +
	     '<td align=center>' +fnt+' '+xtx+ '</font></td><td align=right width=124 valign=top>' +
             '<img src="cpyr-pr.gif" width=124 height=15 border=0></td></tr></table>' +
             '</body></html>';
    ya = ya + offs;
    if (vchild && !vchild.closed)
	{
      	diffX = xa - lastWidth;
      	diffY = ya - lastHeight;
      	vchild.resizeBy(diffX, diffY);
    	}
    else
	{
   	vchild=window.open("",target,"width="+xa+",height="+ya+",scrollbars="+v_scroll+",resizable=1");
    	}
    lastWidth = xa;
    lastHeight = ya;
    with (vchild.document)
	{
        open();
        write(html);
        if (navigator.appName == 'Netscape')
            	{
		if (n6)
			{
	    		vchild.captureEvents(Event.CONTEXTMENU);
   		 	vchild.oncontextmenu=makalert;
			}
		else
			{
	    		vchild.captureEvents(Event.MOUSEDOWN);
   		 	vchild.onmousedown=capturMousedown;
			}
		vchild.captureEvents(Event.KEYDOWN);
		vchild.captureEvents(Event.KEYUP);
		vchild.captureEvents(Event.KEYPRESS);
		vchild.onkeypress  = capturKey;
		vchild.onkeyup     = capturKey;
		vchild.onkeydown   = capturKey;
            	}
        else
		{
        	write('<!-- <script type="text/javascript">');
		write('vchild.window.captureEvents(Event.KEYDOWN);');
		write('vchild.window.captureEvents(Event.KEYUP);');
		write('vchild.window.captureEvents(Event.KEYPRESS);');
		write('vchild.window.captureEvents(Event.MOUSEDOWN);');
		write('vchild.window.captureEvents(Event.CONTEXTMENU);');
		write('</script>  -->');
		}
        close();
        }
   if (navigator.appName != 'Netscape')
	{
   	vchild.document.oncontextmenu = makalert;
   	vchild.document.onmousedown = capturMousedown;
   	vchild.document.onkeypress  = capturKey;
   	vchild.document.onkeyup     = capturKey;
   	vchild.document.onkeydown   = capturKey;
	}
   vchild.focus();
 }





//----------zoom popup window without HTML ---------------
this.lastaWidth = 0;
this.lastaHeight = 0;
this.achild = null;

function show_js(nam, x, y, scroll, tim )
{
   sc = "no";
   if (scroll > 0) { sc = "yes"; }
   ma = "width="+x+",height="+y+", scrollbars="+sc+", resizable=yes, locationbar=no," +
        " menubar=no, toolbar=no, status=no";
   if (achild && !achild.closed)
	{
      	diffX = x - lastaWidth;
      	diffY = y - lastaHeight;
      	achild.resizeBy(diffX, diffY);
    	}
    else
	{
        achild = window.open(nam, "achild",  ma);
	}
  if (navigator.appName == 'Netscape')
 	{
	if (n6)
		{
	    	achild.captureEvents(Event.CONTEXTMENU);
   	    	achild.oncontextmenu = makaalert;
		}
    	achild.captureEvents(Event.MOUSEDOWN);
    	achild.onmousedown=capturaMousedown;
	//	}
	achild.captureEvents(Event.KEYDOWN);
	achild.captureEvents(Event.KEYUP);
	achild.captureEvents(Event.KEYPRESS);
	achild.onkeypress  = capturaKey;
	achild.onkeyup     = capturaKey;
	achild.onkeydown   = capturaKey;
 	}
   else
	{
       	//write('<!-- <script type="text/javascript">');
   	//write('achild.window.captureEvents(Event.KEYDOWN);');
  	//write('achild.window.captureEvents(Event.KEYUP);');
	//write('achild.window.captureEvents(Event.KEYPRESS);');
	//write('achild.window.captureEvents(Event.CONTEXTMENU);');
	//write('achild.window.captureEvents(Event.MOUSEDOWN);');
	//write('</script>  -->');
	}
    lastaWidth = x;
    lastaHeight = y;
    //with (achild.document)
	//	{
        //open();
        //close();
	//	}
  if (navigator.appName != 'Netscape')
 	{
   	//achild.document.oncontextmenu = makaalert;
   	//achild.document.onmousedown = capturaMousedown;
   	//achild.document.onkeypress  = capturaKey;
   	//achild.document.onkeyup     = capturaKey;
   	//achild.document.onkeydown   = capturaKey;
	}
   achild.focus();
   if (tim > 0)
	{
        achild.setTimeout('window.close()', tim * 1000);
	}
}


