// Allgemeine Java-Script-Funktionen
//-----------------------------------------------------------------------------

var lastmod;

//-----------------------------------------------------------------------------
function TIS_Online(js_suche,js_anbieter)
{
	if ((!js_suche && !js_anbieter) || (js_suche == "" && js_anbieter == "")) {
    	var js_link="https://www.schulportal-thueringen.de/tis-online/";
    } else {
		if (js_suche != "" && js_anbieter != "") {
	    	var js_link="https://www.schulportal-thueringen.de/tis-online?bounding=anwf=katalog;suchbegriff="+js_suche+";anbieter_bezeichnung="+js_anbieter;
	    }
		else {
	    	if (js_suche != "") var js_link="https://www.schulportal-thueringen.de/tis-online?bounding=anwf=katalog;suchbegriff="+js_suche;
	        if (js_anbieter != "") var js_link="https://www.schulportal-thueringen.de/tis-online?bounding=anwf=katalog;anbieter_bezeichnung="+js_anbieter;
	    }
	}

	fenster=window.open(js_link,"tisonline");
//	fenster.moveTo(0,0);
//	fenster.focus;
}

//-----------------------------------------------------------------------------
function Meldung(js_link,js_fenster)
{
	fenster=window.open(js_link,js_fenster,"dependent=yes,height=300,width=500,locationbar=no,menubar=no,resizable=yes,status=no");
	fenster.moveTo(250,250);
	fenster.focus;
}

//-----------------------------------------------------------------------------
function Fussnote(js_link,js_fenster)
{
	fenster=window.open(js_link,js_fenster,"dependent=yes,height=300,width=500,locationbar=no,menubar=no,resizable=yes,status=no");
	fenster.moveTo(200,200);
	fenster.focus;
}

//-----------------------------------------------------------------------------
function Annotation(js_link,js_fenster)
{
	fenster=window.open(js_link,js_fenster,"dependent=yes,height=450,width=700,locationbar=no,menubar=no,resizable=yes");
	fenster.moveTo(150,150);
	fenster.focus;
}

//-----------------------------------------------------------------------------
function zeit(frame_nr)
{
	lastmod=new Date(parent.frames[frame_nr].document.lastModified);
	if (lastmod.getYear()<2000) jahr=lastmod.getYear()+1900; else jahr=lastmod.getYear();
	if (lastmod.getYear()<10) jahr=lastmod.getYear()+2000;
	if (lastmod.getDate()<10) tag="0"+lastmod.getDate(); else tag=lastmod.getDate();
	if (lastmod.getMonth()<9) monat="0"+(lastmod.getMonth()+1); else monat=lastmod.getMonth()+1;
	if (lastmod.getMinutes()<10) min="0"+lastmod.getMinutes(); else min=lastmod.getMinutes();
	if (lastmod.getSeconds()<10) sec="0"+lastmod.getSeconds(); else sec=lastmod.getSeconds();
	document.write("am "+tag+"."+monat+"."+jahr);
//document.write("Letzte Änderung am "+lastmod.getDate()+"."+(lastmod.getMonth()+1)+"."+year+", "+lastmod.getHours()+":"+min+":"+sec);
}

//-----------------------------------------------------------------------------
// Email-Verschluesselung ueber Kodierung in Javascript
// This script is (C) Copyright 2004 Jim Tucek
// Leave these comments alone!  For more info, visit www.jracademy.com/~jtucek/email/
// Verschluesselung mit Primzahl_1 = 37 und Primzahl_2 = 13
// unter http://www.nmud.de/tools/coder2/email_protector1.html

function Email_Code(code_str, code_1, code_2, domain) {
	code_str += ' ';
	var name_len = code_str.length;
	var ziffer = 0;
	var mail_str = '';
	if (domain == '') domain = 'thillm'+'.'+'de';
	for(var zaehler = 0; zaehler < name_len; zaehler++) {
		ziffer = 0;
		while(code_str.charCodeAt(zaehler) != 32) {
			ziffer = ziffer * 10;
			ziffer = ziffer + code_str.charCodeAt(zaehler)-48;
			zaehler++;
		}
		mail_str += String.fromCharCode(Ziffer_Code(ziffer,code_1,code_2));
	}
	parent.location = 'm'+'a'+'i'+'l'+'t'+'o'+':'+mail_str+'@'+domain;
}

function Ziffer_Code(ziffer,code_1,code_2) {
	if (code_2 % 2 == 0) {
		magic = 1;
		for(var wall = 1; wall <= code_2/2; wall++) {
			movement = (ziffer*ziffer) % code_1;
			magic = (movement*magic) % code_1;
		}
	} else {
		magic = ziffer;
		for(var orange = 1; orange <= code_2/2; orange++) {
			movement = (ziffer*ziffer) % code_1;
			magic = (movement*magic) % code_1;
		}
	}
	return magic;
}

//-----------------------------------------------------------------------------
// Email-Verschluesselung ueber einfaches Javascript
function Email_Gesamt(name, domain, ld, empf)
{
	if(empf.length == 0) {
		empf = name + '@' + domain + '.' + ld;
	}
	var display_this = '<a href="mailto:' + name + '@' + domain + '.' + ld + '">' + empf + '</a>';
	document.write(display_this);
}

//-----------------------------------------------------------------------------
function DoppelLink(js_menu,js_haupt)
{
	parent.menu.location.href=js_menu;
	parent.main.location.href=js_haupt;
}

//-----------------------------------------------------------------------------
function DreifachLink(js_kopf,js_links,js_rechts)
{
	parent.frames[1].location.href=js_kopf;
	parent.frames[0].location.href=js_links;
	parent.frames[2].location.href=js_rechts;
}

//-----------------------------------------------------------------------------
function startVollbild()
{
	if(top.frames.length > 0)
		top.location.href=self.location;
}

//-----------------------------------------------------------------------------
