/*******************************************************\
*	Datei: Seitenschutz.js				*
*	Autor: Mathias Aust, BSK-Webmaster		*
*	Stand: 12.07.2003				*
*							*
* Duch einbinden diese Skripts wird sowohl die rechte	*
* Maustaste, als auch das selektieren von Text der ent-	*
* sprechenden HTML-Seite unterbunden.			*
*							*
* Desweiteren unterbindet dieses Skript das laden 	*
* einzelner Seiten der BSK-Homepage bzw. das laden	*
* in einem fremden Frameset.				*
*							*
* Zusätzlich beinhaltet diese Skript noch Module, die  	*
* es ermöglichen, auf allen das Skript einbindenden	*
* Seiten diverse Informationen zu generieren.		*
* Dazu zählen:						*
*							*
*	- Copyright-Statement				*
*	- Update-Statement				*
*							*
*********************************************************
*							*
* Als Befehlsreferenz diente SELFHTML Version 8.0 von	*
* Stefan Münz. (http://selfaktuell.teamone.de)		*
*							*
\*******************************************************/

// ** Begin Funktions-Definition **  \\

// ##################################################################
// Nachfolgende Variablen dürfen geändert (angepasst) werden 

// Adresse der Homepage: 
var redirectorAdress = "http://www.kusunoki.de";

// Seiteninhaber (Copyright):
var CopyrightInhaber = "Thomas Heinze";

// Link zur Datei mit dem Copyright (z.B. "Ordner/Datei.htm")
var LinkZiel = "impressum.html";


// ##################################################################
// !!! Anleitung !!! 
//
// ******************************************************************************************************
//        EINBINDEN DES SEITENSCHUTZES ...

// Um den Seitenschutz zu nutzen muss folgender Quelltext in die Datei eingebunden werden:
// ( ohne '/*' bzw '*/' )
/*
	<script language="JavaScript" type="text/javascript" src="/...PFADzurDATEI.../SeitenSchutz.js">
	</script>
*/

// Um das Copyright zu nutzen nachfolgenden Quelltext ein die Datei einbinden:
// ( ohne '/*' bzw '*/' )
/*


	<!-- Copyright-Code Bereich (Begin)-->
		<center>
		<hr>
		<font face="Verdana" size="1">
		<script language="javascript">
		<!--
			// Code written by Mathias Aust, BSK-Webmaster February 2003
			document.write(Copyright);
		//-->
		</script>
		</font>
		</center>
	<!-- Copyright-Code Bereich (End)-->


*/

// ******************************************************************************************************

// ##################################################################
// !!! Nachfolgender Quelltext darf nicht geändert werden !!! 
//

function refresh()
{   	
	this.location.reload();
};

function SetCopyright()
{
	var CopyrightText = new Array();	
	CopyrightText[0] = "letzte Änderung am: ";
	CopyrightText[1] = "";
	CopyrightText[2] = "<a href='" + GetRootPath()+LinkZiel + "'>Copyright</a> ";
	CopyrightText[3]= "© by " + CopyrightInhaber + " ";
	
	CopyrightText[4] = new Date(document.lastModified);
	CopyrightText[5] = CopyrightText[4].getDate();
	CopyrightText[6] = CopyrightText[4].getMonth()+1;
	CopyrightText[7] = CopyrightText[4].getYear();
	
	CopyrightText[8] = new Date;
	CopyrightText[9] = CopyrightText[8].getYear();
	
	CopyrightText[0] += CopyrightText[5]+"."+CopyrightText[6]+"."+CopyrightText[7]+"<br>";
	CopyrightText[1] += CopyrightText[2]+ CopyrightText[3]+CopyrightText[9]+" (<a href='http://www.kusunoki.de'>http://www.kusunoki.de</a>)<br>";	
	
	//return CopyrightText;
	return CopyrightText[1]+CopyrightText[0];
};

function internalUse()
{
	if (window.location.protocol == "http:")
	{
		// Einzelne Seite geladen...
		if (window.name=="" && isSubPath())
		{	
			//alert("Seite ohne Frame geladen");	
			window.location . href = redirectorAdress;
			
		};
		
		// Fremdes Frameset...
		if (parent.name!= "" && isSubPath())
		{
			//alert("fremdes Frameset");
			top.location . href = redirectorAdress;
		};
		
	}
};

function DoNothing()
{
	return false;
};

function MSBrowser(e)
{
	if(e.which==1)
	{
		window.releaseEvents(Event.MOUSEMOVE);
		window.onmousemove=null;
	}
};

function DisplayCopyright()
{
	Datum = new Date();
	Jahr = " "+Datum.getYear();
	alert(unescape("(C) by "+CopyrightInhaber)+ Jahr);
	return false;
};

function nMSBrowser(e)
{
	if(e.which==1)
	{
		window.captureEvents(Event.MOUSEMOVE);
		window.onmousemove=DoNothing;
	}

	if(e.which==3)
	{
		return DisplayCopyright();
	}
};

function nMSBrowserMAIN()
{
	ButtonEvent=event.button;	
	if(ButtonEvent==2||ButtonEvent==3) DisplayCopyright();
};

function SignSide()
{
	for(lp=0;lp<document.all.length;lp++)
	{
		if(document.all[lp].style.visibility!="hidden")
		{
			document.all[lp].style.visibility="hidden";
			document.all[lp].id="-Marked-";
		}
	}
};

function PostSignSide()
{
	for (lp=0;lp<document.all.length;lp++)
	{
		if(document.all[lp].id=="-Marked-")
			document.all[lp].style.visibility="";
	}
};

function isSubPath()
{
	pfad = window.location.href;
	protokoll = window.location.protocol;
	
	i = pfad.length-1;		
	Anzahl = 0;	
	
	while (i>=0 && pfad.charAt(i)!=":")
	{
		if (pfad.charAt(i) == "/") Anzahl++;
		i--;
	}
	
	if (protokoll=="file:") Anzahl -= 2;	
	if (protokoll=="http:")	Anzahl -= 3;

	if (Anzahl > 0)
		return 1
	else
		return 0
};

function GetRootPath()
{
	pfad = window.location.href;
	protokoll = window.location.protocol;
	
	i = pfad.length-1;		
	Anzahl = 0;	
	
	while (i>=0 && pfad.charAt(i)!=":")
	{
		if (pfad.charAt(i) == "/") Anzahl++;
		i--;
	}
	
	if (protokoll=="file:") Anzahl -= 2;	
	if (protokoll=="http:")	Anzahl -= 3;
	
	Root = "";
	if (Anzahl > 0)
		while (Anzahl >0)
		{
			Root+="../";
			Anzahl--;
		}
	
	return Root;
};

// ** Ende Funktions-Definition ** \\


// Start avoiding of foreigen Site use...
//internalUse();

// Set Copyright-Statement...
var Copyright = SetCopyright();


// ** Sicherungs-Routinen ** \\
HTMLContent=document.all;
HTMLElements=document.getElementById;

if(HTMLContent)
{
	if(HTMLElements)
	{
		document.oncontextmenu=DisplayCopyright;
		document.onselectstart=DoNothing;
	}
	else
	{
		document.onmousedown=nMSBrowserMAIN;
	}
}

if(HTMLElements&&!HTMLContent)
{
	document.onmousedown=DoNothing;
	document.onmouseup=nMSBrowser;
	document.oncontextmenu=DoNothing;
}

if(document.layers)
{
	window.captureEvents(Event.MOUSEUP|Event.MOUSEDOWN);
	window.onmousedown=DisplayCopyright;
	window.onmouseup=MSBrowser;
}

window.onbeforeprint=SignSide;
window.onafterprint=PostSignSide;
