//===========================================================================
// (c) 2004 Peter W. Sachs                             Autor: Peter W. Sachs
// Alle Rechte an diesem Programm/Skript liegen beim Autor. Jede Nutzung und
// jede Veränderung dieses Programms/Skripts muss vom Autor genehmigt sein.
//===========================================================================

function tagesdatum(format) {
	heute = new Date();
	jjjj = heute.getFullYear();
	//jjjj = heute.getYear();
		if (jjjj < 999) jjjj+=1900;
		tt = heute.getDate();
		if (tt < 10) tt = "0" + tt;
            mm = heute.getMonth()+1;
		if (mm < 10) mm = "0" + mm;
		if (format == 1) return tt ;
		if (format == 2) return mm ;
		if (format == 3) return jjjj ;
		return tt + "." + mm + "." + jjjj ;
	}

function openCal(strDatum, strName, intWidth , strDat1)
{	// Falls ein Datum strDat1 uebergeben wird, startet der Kalender in dem entsprechenden Monat
    if (strDat1.length > 7)
    {
		var elemente = strDat1.split(".");
		var intMonth = elemente[1];
		var intYear = elemente[2];
		strDatum = strDatum + "&year=" + intYear + "&month=" + intMonth;
    }
    Test = window.open(strDatum, strName, 'width='+intWidth+',height=150,scrollbars=no,noresize');
    if (document.all)
	{
		var ClickX = window.event.x;
		var ClickY = window.event.y;
		if (navigator.appVersion.indexOf("MSIE 5")>0 )
		{
			Test.moveTo(ClickX+window.screenLeft+5, ClickY+window.screenTop-50);
		}
	}
}

function Go(x) {
			/* keine Aktion ohne Url */
		if( x == "nothing") {
			document.forms[0].reset();
			document.forms[0].elements[0].blur();
			window.location.href = this.location.href;
		return;
		}
			/* wieder komplett neu in den Browser */
		if(x.substring(0,10) == "http://www") {
			document.forms[0].reset();
			document.forms[0].elements[0].blur();
			top.location.href=x;
		return;
		}
			/* im derzeitigen Fenster bleiben */
			document.forms[0].reset();
			document.forms[0].elements[0].blur();
			window.location.href = x;
		return;
	}

function getBrowser() {
	brow="";
	if ( document.layers ) brow="N4";
	else if ( document.all ) brow="IE";
	else if ( document.getElementById ) brow="W3C";
	return brow;
}

function getVersion() {
	appv=navigator.appVersion;
	pos=appv.lastIndexOf("MSIE ")
	if (pos) {
	msapp=appv.substr(pos+5,1);
		return msapp
	}
	return parseInt(navigator.appVersion);
}

function focusok() {
	brow=getBrowser();
	ver=getVersion();
	if ( brow=="N4" ) return 1;
	if ( brow=="IE" && ver>4) return 1;
	return 0;
}

function hilfe(url,id,hoehe,breite) {
	if ( url=="" ) return;
	if ( hoehe=="" ) hoehe=300;
	if ( breite=="" ) breite=300;
	if ( id=="" ) id="ph1";
	prm="width=" + breite + ",height=" + hoehe + ",dependent=yes, locationbar=no, menubar=no";
	wid=window.open(url,id,prm);
	if ( focusok() ) wid.focus();
}

function loadframe(url1,f1,url2,f2,focus,id) {
	//if ( hoehe!="" ) hilfe(url2
	if ( url1!="" ) parent.frames[f1].location.href=url1;
	if ( id!="" ) {
		w2(url2,id);
		//if ( (focus!="w2") && (focusok())) parent.frames[focus].focus();
	}
	else {
		if ( f2!="" ) parent.frames[f2].location.href=url2;
		if ( focusok() ) parent.frames[focus].focus();
	}
}

function w2(url,id){
	if ( url=="" ) url=this.location.href;
	prm="scrollbars=yes,toolbar=yes";
	  // SSL muss separat sein mit Status/Befehlszeile, damit das Schloss sichtbar ist
	  // fuer Form-Eingaben und Info Eingaben Seitenbreite 610
	if ( id=="sslw2" ) prm="scrollbars=yes,toolbar=yes,status=yes,dependent=yes,height=620,width=630";
	  // fuer ganzseitige SSL-Fenster
	if ( id=="sslw2max" ) prm="scrollbars=yes,toolbar=yes,status=yes,dependent=yes,width=800";
	if ( id=="" ) id="jw2";
	if ( !focusok() ) {
		date=new Date();
		id=date.getTime();
	}
	wid=window.open(url,id,prm);
	if ( focusok()) wid.focus();
}

function setC(c,v,path,minutes)
	{
		if ( path=="" ) path="/";
		var domain="jossgrund.de";
		var end = new Date();
		var endts = end.getTime() + (minutes * 60 * 1000); //
		end.setTime(endts);
		str=c+"="+v+" ; path="+path;
		if ( minutes!=0 ) str=str+" ; expires="+end.toGMTString();
		document.cookie=str;
	}

function setProfil(topic)
	{
		var domain="jossgrund.de";
		var end = new Date();
		var endts = end.getTime() + (365 * 24 * 60 * 60 * 1000); //10 Jahre
		end.setTime(endts);
		var len = document.form1.schema.length;
		var i=0;
		while ((i<len)&&(document.form1.schema[i].checked==false)) { i++ }
		if ((i<len)&&(document.form1.schema[i].checked==true)) {
			str="color"+topic+"="+document.form1.schema[i].value+" ; expires="+end.toGMTString()+" ; path=/"; // domain="+domain;
			document.cookie=str;
			top.location.reload();
		}
	}

