// DOCUMENT:  Globale Javaskript-Funktionen
// VERSION:   $Revision: 2.15 $
// DATE:      $Date: 2008-06-26 11:47:22 $
// AUTHOR:    M.Beranek
// COPYRIGHT: M.Beranek


var isNetsc = false;
var isMoz = false;
var isFF = false;
var isIE = false;
var isOP = false;
var isKonqi = false;
var isSaf = false;

var browserChecked = false;

// ---------------------------------------------------------------------------
function checkBrowser(){
	var s = navigator.userAgent.toLowerCase();

	isNetsc = false;
	isMoz = false;
	isFF = false;
	isIE = false;
	isOP = false;
	isKonqi = false;
	isSaf = false;

	netsc = false;
	moz = false;
	ff = false;
	ie = false;
	op = false;
	konqi = false;
	saf = false;

	if( s.indexOf( "netscape" ) > -1 ){ netsc = true;};
	if( s.indexOf( "mozilla" ) > -1 ){ moz = true;};
	if( s.indexOf( "firefox" ) > -1 ){ ff = true;};
	if( s.indexOf( "iceweasel" ) > -1 ){ ff = true;};
	if( s.indexOf( "msie" ) > -1 ){ ie = true;};
	if( s.indexOf( "opera" ) > -1 ){ op = true;};
	if( s.indexOf( "konqueror" ) > -1 ){ konqi = true;};
	if( s.indexOf( "safari" ) > -1 ){ saf = true;};

	if( ! ie && ! op && ! konqi && ! saf && ( moz || netsc || ff ) ){
		isIE = false;
		isOP = false;
		isKonqi = false;

		if( moz ) isMoz = true;
		if( netsc ){
			isMoz = false;
			isNetsc = true;
		}
		if( ff ){
			isMoz = false;
			isNetsc = false;
			isFF = true;
		}
	} else {

		if( ie ) isIE = true;
		if( op ){
			isIE = false;
			isOP = true;
		}
		if( konqi ){
			isIE = false;
			isOP = false;
			isKonqi = true;

		}
		if( saf ){
			isIE = false;
			isOP = false;
			isKonqi = false;
			isSaf = true;

		}

	}
	browserChecked = true;
}
// ---------------------------------------------------------------------------

function isMozilla(){
	if( ! browserChecked ) checkBrowser();
	return isMoz;
}

function isFirefox(){
	if( ! browserChecked ) checkBrowser();
	return isFF;
}

function isIExplore(){
	if( ! browserChecked ) checkBrowser();
	return isIE;
}

function isOpera(){
	if( ! browserChecked ) checkBrowser();
	return isOP;
}

function isKonqueror(){
	if( ! browserChecked ) checkBrowser();
	return isKonqi;
}

function isSafari(){
	if( ! browserChecked ) checkBrowser();
	return isSaf;

}

function browserInfo(){
	var s = "";
	if( isMozilla() ) s += "mozilla\n";
	if( isFirefox() ) s += "firefox\n";
	if( isIExplore() ) s += "iexplore\n";
	if( isOpera() ) s += "opera\n";
	if( isKonqueror() ) s += "konqueror\n";
	if( isSafari() ) s += "safari\n";

	//alert(s);

}


// ---------------------------------------------------------------------------
/** Info-Bereich oben rechts für die Kategorien setzen. */
function categoryInfo( info ){
	e = xGetElementById("category_info");
	if( e != null ){
		e.innerHTML = info;
	}
}
// ---------------------------------------------------------------------------





// ---------------------------------------------------------------------------
/* Wechselt die verschiedenen LoginBars: */
function activateLoginBar( num ){

	lb1 = xGetElementById("login_bar_loggedin_bew");
	lb2 = xGetElementById("login_bar_loggedin_ins");
	lb3 = xGetElementById("login_bar_show_login");
	lb4 = xGetElementById("login_bar_not_loggedin");


	switch( num ){

		// login_bar_loggedin_bew: Loginbar für den eingeloggten Bewerber
	case 1:{
			lb2.style.visibility = "hidden";
			lb3.style.visibility = "hidden";
			lb4.style.visibility = "hidden";
			lb1.style.visibility = "visible";
			break;
		}

		// login_bar_loggedin_ins: Loginbar für den eingeloggten Inserenten
	case 2:{
			lb1.style.visibility = "hidden";
			lb3.style.visibility = "hidden";
			lb4.style.visibility = "hidden";
			lb2.style.visibility = "visible";
			break;
		}

		// login_bar_show_login: Loginbar mit Login-Formular für den nicht-eingeloggten User
	case 3:{

			lb3.style.visibility = "visible";
			lb1.style.visibility = "hidden";
			lb2.style.visibility = "hidden";
			lb4.style.visibility = "hidden";
			document.lgin.login_benutzername.focus();
			break;
		}

		// login_bar_not_loggedin: Loginbar ohne Login-Formular für den nicht-eingeloggten User
	case 4:{
			lb1.style.visibility = "hidden";
			lb2.style.visibility = "hidden";
			lb3.style.visibility = "hidden";
			lb4.style.visibility = "visible";
			break;
		}



	}

}
// ---------------------------------------------------------------------------

var counterCorrect = 0;
var counterMaximum = -1;
function correctHeight( value ){

	++counterCorrect;

	// Falls wir gewährleisten wollen, daß die Höhenkorrektur nur x-mal
	// aufgerufen wird, kann in jeder beliebigen Seite die Variable
	// counterMaximum auf den entsprechenden Wert gesetzt werden.
	if( counterMaximum > -1 ){
		if( counterCorrect > counterMaximum)
			return;
	}

	var debug = false;

	// Diverse Höhen auslesen:
	var heightHead     = xHeight( "global_head" );
	var heightCRight   = xHeight( "container_right" );
	var heightCCenter  = xHeight( "container_center" );
	var heightCBody    = xHeight( "container_body" );
	var heightLoginBar = xHeight( "login_bar" );
	var heightNavi     = xHeight( "navi" );

	// Inhalts-Höhe unterhalb der Login-Bar:
	var heightContent  = heightCBody - heightLoginBar;

	// Höhe des Client-Fensters:
	var heightClient   = xClientHeight();

	// Maximum der obigen Größen:
	var max1 = Math.max( heightNavi, heightContent );
	var max2 = Math.max( heightCRight, heightCCenter );
	var max3 = Math.max( max1, max2 );
	var heightMax = Math.max( max3, heightClient );

	// NOTE: Da in einigen Situationen immer ein 2 Pixel hoher,
	// grauer Rand unter dem Container-Body angezeigt wird, addieren
	// wir der Einfachheit halber hier vorsorglich 2 Pixel hinzu,
	// sodaß dieser graue Rand verschwinden sollte:
	// heightMax += 2;

	// Offset zw. Footer und Inhalt:
	var offset = heightMax - heightCCenter;

	// Der Abstand zw. Footer und Inhalt soll mindestens 80 Pixel sein (urspr. 40):
	if( offset < 80 ){
		var diff = 80 - offset;

		offset = 80;
		heightMax += diff;

	}

	// Debug-Info:
	if( debug ){
		text = "Dimensionen:\n" +
			"\nHead: "    + heightHead +
			"\nCRight: "  + heightCRight +
			"\nCCenter: " + heightCCenter +
			"\nCBody: "   + heightCBody +
			"\nLbar: "    + heightLoginBar +
			"\nNavi: "    + heightNavi +
			"\nContent: " + heightContent +
			"\nOffset: "  + offset +
			"\nClient: "  + heightClient +
			"\nhMax: "    + heightMax ;
		alert( text );
	}

	// return;

	if( typeof value != "undefined" ){
		intVal = parseInt( value );
		if( ! isNaN( intVal ) ){
			heightMax += intVal;
		}
	}

	// Navi ist immer kleiner als Maximum:
	// Navi vergrößern:
	xHeight( "navi", heightMax );

	// Fuss-Element ermitteln:
	var footer = xGetElementById( "global_footer" );

	// Container-Center ist immer kleiner als Maximum:
	// Container-Center vergrößern:
	xHeight( "container_center", heightMax );

	// Falls Fuss vorhanden:
	if( footer ){

		// Margin-Top ermitteln:
		var s = new String( footer.style.marginTop );
		marTop = parseInt( s.substr(0, s.length-2) );
		if( isNaN( marTop ) ){
			marTop = 0;
		}

		// Falls Offset größer:
		if( offset > marTop ){
			// Margin-Top vergößern:
			footer.style.marginTop = offset + "px";
		}

		if( debug ){
			alert( "Footer:\n\noffset: "+offset+"\nmTop: "+marTop );
		}
	}

}


function redrawHeight( value ){

	e1 = xGetElementById( "global_footer" );
	e2 = xGetElementById( "container_center" );
	e3 = xGetElementById( "navi" );

	if( e1 ){
		e1.style.marginTop = "0px";
	}

	if( e2 ){
		e2.style.minHeight = "800px";
		e2.style.height = "auto";
	}

	if( e3 ){
		e3.style.minHeight = "800px";
		e3.style.height = "auto";
	}

	correctHeight( value );
}


function backup_correctHeight(){

	var nH = xHeight( "navi" );
	var cH = xHeight( "container_center" );/* + xHeight( "info_bar" );*/   // hoehe der infobar zuviel (da infobar nicht vorhanden)
	var rH = xHeight( "container_right" ) + xHeight( "info_bar" );
	var maxH = Math.max( nH, Math.max( cH, rH ) );

	//alert( "N " + nH + " C " + cH + " R " + rH );

	var cc = xGetElementById( "container_center" );
	var ct = 0;

	if( cc != null ){

		var s = new String( cc.style.top );
		ct = parseInt( s.substr(0, s.length-2) );
		if( isNaN(ct) ){
			ct = 0;
		}

	}

	// alert( "ct " + ct );

	// Da die Höhenangaben nicht wirklich stimmen (z.B. ist die Höhe von
	// "container_body" immer 0, obwohl darin "container_center" etc. drin
	// enthalten sind), fügen wir hier immer noch einen Abstand von 50 Pixeln
	// hinzu, dann sollten wir auf der sicheren Seite sein.
	//
	// Dummerweise wird beim mehrfachen Aufruf der Funktion die Seite immer
	// länger. Daher die 50 Pixel wieder rausgenommen... bis sie irgendwo anders
	// wieder fehlen werden...


	//if(maxH<1200) maxH = 1200;
	// alert( "maxH " + maxH );

	xHeight( "navi", maxH +ct   /* + 50 */ );

	//alert( "Navi: "+ nH + " Mitte: " + cH + " Rechts: " + rH + " Max: " + maxH );

	correctFooter();
	//alert("X");

}


function correctHeightPlus( value ){
	return correctHeight( value );
}

function backup_correctHeightPlus( value ){

	var nH = xHeight( "navi" );
	var cH = xHeight( "container_center" ) + xHeight( "info_bar" );
	var rH = xHeight( "container_right" ) + xHeight( "info_bar" );
	var maxH = Math.max( nH, Math.max( cH, rH ) );

	//alert( "N "+nH+" C " + cH + " R " + rH );

	var cc = xGetElementById( "container_center" );
	var ct = 0;

	if( cc != null ){

		var s = new String( cc.style.top );
		ct = parseInt( s.substr(0, s.length-2) );
		if( isNaN(ct) ){
			ct = 0;
		}

	}


	// Da die Höhenangaben nicht wirklich stimmen (z.B. ist die Höhe von
	// "container_body" immer 0, obwohl darin "container_center" etc. drin
	// enthalten sind), fügen wir hier immer noch einen Abstend von 50 Pixeln
	// hinzu, dann sollten wir auf der sicheren Seite sein.
	//
	// Dummerweise wird beim mehrfachen Aufruf der Funktion die Seite immer
	// länger. Daher die 50 Pixel wieder rausgenommen... bis sie irgendwo anders
	// wieder fehlen werden...



	//if(maxH<1200) maxH = 1200;
	xHeight( "navi", maxH +ct );

	// alert( "Navi: "+nH+ " Mitte: " + cH + " Rechts: " + rH + " Max: " + maxH );

	correctFooter();

	xHeight( "navi", maxH +ct + value );

	//alert("X");
}


function correctFooter(){
	return;
}

function backup_correctFooter(){

	var nH = xHeight( "navi" );
	var cc = xGetElementById( "container_center" );
	var ct = 0;

	if( cc != null ){


		var s = new String( cc.style.top );
		ct = parseInt( s.substr(0, s.length-2) );
		if( isNaN(ct) ){
			ct = 0;
		}

	}


	var cH = xHeight( "container_center" ) + xHeight( "info_bar" );
	var ft = xGetElementById( "global_footer" );
	if( ft == null) return;

	if( cH < nH ){

		// Mit Timeout versehen, da sonst im IE die BG-Bilder neu geladen werden... warum auch immer.
		// xHeight( "container_center", nH - ct );
		setTimeout( "xHeight( 'container_center', " + nH + "-" +  ct +");", 100 );

		var fH = xHeight( "global_footer" );
		var nfmt = nH - cH -ct + 20;

		//alert( "Navi: " + nH + " Container: " + cH + " Container-Top: " + ct + " Footer-Margin: " + nfmt );
		if( nfmt >= 20 ){
			ft.style.marginTop = nfmt + "px";
		}
	}




}

function resetFooter(){
	var ft = xGetElementById( "global_footer" );
	if( ft == null) return;
	ft.style.marginTop = "20px";
}

// ---------------------------------------------------------------------------
function closedebug(){
	var e = xGetElementById("debug");
	e.style.visibility = "hidden";
}


// ---------------------------------------------------------------------------
function jobmerken( num, sess ){
	var link = "/job_remember.php?focus=" + num + "&" + sess;
	document.images["loader"].src = link;
}

// ---------------------------------------------------------------------------
function openwin( url, name, w, h, mode, center){
	var features = "";

	if( center == null ) center = 1;
	switch( mode ){
	case 1:{
			// mit: scrollbar, status, title
			// ohne: menu, personal, tool
			features = "location=no,alwaysRaised=yes,menubar=no,personalbar=no,scrollbars=yes,status=yes,titlebar=yes,toolbar=no,resizable=yes,";
			break;
		}
	case 2:{
			// mit: scrollbar, title
			// ohne: menu, personal, tool, status
			features = "location=no,alwaysRaised=yes,menubar=no,personalbar=no,scrollbars=yes,status=no,titlebar=yes,toolbar=no,resizable=yes,";
			break;
		}
	case 3:{
			// mit: title
			// ohne: scrollbar, menu, personal, tool, status
			features = "location=no,status=no,menubar=no,personalbar=no,scrollbars=no,titlebar=yes,toolbar=no,resizable=yes,alwaysRaised=yes,";
			break;
		}
	case 4:{
			// mit: title, menu, status
			// ohne: scrollbar, personal, tool
			features = "location=no,alwaysRaised=yes,menubar=yes,personalbar=no,scrollbars=no,status=yes,titlebar=yes,toolbar=no,resizable=yes,";
			break;
		}
	case 5:{
			// mit: title, menu, status, scrollbar, personal, tool
			// ohne:
			features = "location=no,alwaysRaised=yes,menubar=yes,personalbar=yes,scrollbars=yes,status=yes,titlebar=yes,toolbar=yes,resizable=yes,";
			break;
		}
	case 6:{
			// mit: title, menu, status, scrollbar
			// ohne: personal, tool
			features = "location=no,alwaysRaised=yes,menubar=yes,personalbar=no,scrollbars=yes,status=yes,titlebar=yes,toolbar=no,resizable=yes,";
			break;
		}
	case 7:{
			// mit: title, status
			// ohne: personal, tool, scrollbar, menu
			features = "location=no,alwaysRaised=yes,menubar=no,personalbar=no,scrollbars=no,status=yes,titlebar=yes,toolbar=no,resizable=yes,";
			break;
		}
	case 8:{
			// mit: title, scrollbar
			// ohne: menu, personal, tool, status, resize
			features = "location=no,status=no,menubar=no,personalbar=no,scrollbars=yes,titlebar=yes,toolbar=no,resizable=no,alwaysRaised=yes,";
			break;
		}
	case 9:{
			// mit: title
			// ohne: scrollbar, menu, personal, tool, status, resize
			features = "location=no,status=no,menubar=no,personalbar=no,scrollbars=no,titlebar=yes,toolbar=no,resizable=no,alwaysRaised=yes,";
			break;
		}
	case 10:{
			// mit: title, location
			// ohne: scrollbar, menu, personal, tool, status, resize
			features = "location=yes,status=no,menubar=no,personalbar=no,scrollbars=no,titlebar=yes,toolbar=no,resizable=no,alwaysRaised=yes,";
			break;
		}
	default:{
			features = "location=no,alwaysRaised=yes,menubar=no,personalbar=no,scrollbars=yes,status=yes,titlebar=yes,toolbar=no,resizable=yes,";
			break;
		}

	}
	features += "width=" + w + ",height=" + h;

	l = 0;
	t = 0;
	if( center == 1 ){
		if( screen ){
			maxW = screen.availWidth;
			maxH = screen.availHeight;
			if( maxW > w ) l = (maxW - w ) / 2;
			if( maxH > h ) t = (maxH - h ) / 2;
			l = l<0 ? 0 : l;
			t = t<0 ? 0 : t;

			// Nur für signierte Scripte:
			// features += ",screenX="+l+",screenY="+t;

			features += ",left="+l+",top="+t;
		}
	}

	nw = window.open( url, name, features);
	/*
	if( center == 1 ){
		if( (l!=0)||(t!=0)) nw.moveTo(l,t);
}
	*/
	nw.focus();

	//return nw;
}


function showBlackLayer(){
	bLayer = xGetElementById( "blacklayer" );
	if( bLayer != null ){
		bLayer.style.display = "block";
		bLayer.style.zIndex = "1";
	}
}
function hideBlackLayer(){
	bLayer = xGetElementById( "blacklayer" );
	if( bLayer != null ){
		bLayer.style.display = "none";
		bLayer.style.zIndex = "0";
	}
}

// ---------------------------------------------------------------------------
function showInfoLayer(){

	showBlackLayer();

	var iLayer = xGetElementById( "infolayer" );
	if( iLayer == null ) return;
	var y1 = xScrollTop() + 44;
	iLayer.style.top = y1 + "px";
	iLayer.style.visibility = "visible";
	iLayer.style.zIndex = "30";

	pl = xHeight(iLayer) + y1 - xHeight( "navi" );
	pl = pl > 0 ? pl : 0;

	//correctHeightPlus( pl );
	// alert( pl );
	redrawHeight( pl );

}
function showInfoLayerTop(){

	showBlackLayer();

	var iLayer = xGetElementById( "infolayer" );
	if( iLayer == null ) return;
	var y1 = 44;
	iLayer.style.top = y1 + "px";
	iLayer.style.visibility = "visible";
	iLayer.style.zIndex = "30";

	pl = xHeight(iLayer) + y1 - xHeight( "navi" );
	pl = pl > 0 ? pl : 0;

	//correctHeightPlus( pl );
	redrawHeight( pl );


}
function showInfoLayerScrolledListing(){

	showBlackLayer();

	var iLayer = xGetElementById( "infolayer" );
	if( iLayer == null ) return;

	hInfo = xHeight(iLayer);
	hNavi = xHeight( "navi" );
	hCBody = xHeight( "container_body" );

	//var y1 = xScrollTop() + 70;
	st = xScrollTop();
	y1 = 0;
	if( st < 80 ){
		y1 = xScrollTop() + 146;
	} else {
		y1 = xScrollTop() + 30;
	}
	iLayer.style.top = y1 + "px";
	iLayer.style.visibility = "visible";
	iLayer.style.zIndex = "30";

	// pl = hInfo + y1 - hNavi;
	pl = hInfo + y1 - hCBody;
	pl = pl > 0 ? pl : 0;

	// alert( "hCB = "+hCBody+" st = "+st+" hInfo = "+hInfo+" hNavi = "+hNavi+" y1 = "+y1+" pl = "+pl );

	//correctHeightPlus( pl );
	redrawHeight( pl );


}
function hideInfoLayer(){
	var iLayer = xGetElementById( "infolayer" );
	if( iLayer == null ) return;
	iLayer.style.visibility = "hidden";
	iLayer.style.zIndex = "0";

	hideBlackLayer();

	//correctHeightPlus( pl );
	redrawHeight( pl );
}


// ---------------------------------------------------------------------------
function closeAllAlertBoxes(){
	al1 = xGetElementById( "info_marked" );
	al2 = xGetElementById( "info_notLoggedin" );
	al3 = xGetElementById( "info_applied" );
	al4 = xGetElementById( "info_markerlist" );
	al5 = xGetElementById( "info_recommend" );
	al6 = xGetElementById( "info_folderactions" );
	al7 = xGetElementById( "info_folderrename" );
	al8 = xGetElementById( "info_foldercreate" );
	al9 = xGetElementById( "info_folderdelete" );
	al10 = xGetElementById( "info_pj" );
	al11 = xGetElementById( "info_sessionexpire_01_bew" );
	al12 = xGetElementById( "info_needhelp" );
	al13 = xGetElementById( "info_sessionexpire_02_bew" );
	al14 = xGetElementById( "info_sessionexpire_01_ins" );
	al15 = xGetElementById( "info_sessionexpire_02_ins" );
	al16 = xGetElementById( "info_welcomeback" );


	if( al1 != null ) al1.style.visibility = "hidden";
	if( al2 != null ) al2.style.visibility = "hidden";
	if( al3 != null ) al3.style.visibility = "hidden";
	if( al4 != null ) al4.style.visibility = "hidden";
	if( al5 != null ) al5.style.visibility = "hidden";
	if( al6 != null ) al6.style.visibility = "hidden";
	if( al7 != null ) al7.style.visibility = "hidden";
	if( al8 != null ) al8.style.visibility = "hidden";
	if( al9 != null ) al9.style.visibility = "hidden";
	if( al10 != null ) al10.style.visibility = "hidden";
	if( al11 != null ) al11.style.visibility = "hidden";
	if( al12 != null ) al12.style.visibility = "hidden";
	if( al13 != null ) al13.style.visibility = "hidden";
	if( al14 != null ) al14.style.visibility = "hidden";
	if( al15 != null ) al15.style.visibility = "hidden";
	if( al16 != null ) al16.style.visibility = "hidden";
}

// ---------------------------------------------------------------------------
function lowerAllAlertBoxes(){
	al1 = xGetElementById( "info_marked" );
	al2 = xGetElementById( "info_notLoggedin" );
	al3 = xGetElementById( "info_applied" );
	al4 = xGetElementById( "info_markerlist" );
	al5 = xGetElementById( "info_recommend" );
	al6 = xGetElementById( "info_folderactions" );
	al7 = xGetElementById( "info_folderrename" );
	al8 = xGetElementById( "info_foldercreate" );
	al9 = xGetElementById( "info_folderdelete" );
	al10 = xGetElementById( "info_pj" );
	al11 = xGetElementById( "info_sessionexpire" );
	al12 = xGetElementById( "info_needhelp" );
	al13 = xGetElementById( "info_sessionexpire_02_bew" );
	al14 = xGetElementById( "info_sessionexpire_01_ins" );
	al15 = xGetElementById( "info_sessionexpire_02_ins" );
	al16 = xGetElementById( "info_welcomeback" );

	if( al1 != null ) al1.style.zIndex = 1;
	if( al2 != null ) al2.style.zIndex = 1;
	if( al3 != null ) al3.style.zIndex = 1;
	if( al4 != null ) al4.style.zIndex = 1;
	if( al5 != null ) al5.style.zIndex = 1;
	if( al6 != null ) al6.style.zIndex = 1;
	if( al7 != null ) al7.style.zIndex = 1;
	if( al8 != null ) al8.style.zIndex = 1;
	if( al9 != null ) al9.style.zIndex = 1;
	if( al10 != null ) al10.style.zIndex = 1;
	if( al11 != null ) al11.style.zIndex = 1;
	if( al12 != null ) al12.style.zIndex = 1;
	if( al13 != null ) al13.style.zIndex = 1;
	if( al14 != null ) al14.style.zIndex = 1;
	if( al15 != null ) al15.style.zIndex = 1;
	if( al16 != null ) al16.style.zIndex = 1;

}


// ---------------------------------------------------------------------------
function showInfoNotLoggedin(){
	var iLayer = xGetElementById( "info_notLoggedin" );
	if( iLayer == null ){
		hideInfoLayer();
		return;
	}
	closeAllAlertBoxes();
	iLayer.style.visibility = "visible";
	iLayer.style.zIndex = "30";
}
function hideInfoNotLoggedin(){
	var iLayer = xGetElementById( "info_notLoggedin" );
	if( iLayer == null ) return;
	iLayer.style.visibility = "hidden";
	iLayer.style.zIndex = "1";
}



// ---------------------------------------------------------------------------
function showInfoWelcomeBack(){
	var iLayer = xGetElementById( "info_welcomeback" );
	if( iLayer == null ){
		hideInfoLayer();
		return;
	}
	closeAllAlertBoxes();
	iLayer.style.visibility = "visible";
	iLayer.style.zIndex = "30";
}
function hideInfoWelcomeBack(){
	var iLayer = xGetElementById( "info_welcomeback" );
	if( iLayer == null ) return;
	iLayer.style.visibility = "hidden";
	iLayer.style.zIndex = "1";
}



// ---------------------------------------------------------------------------
function showInfoNotJobber(){
	var iLayer = xGetElementById( "info_notJobber" );
	if( iLayer == null ){
		hideInfoLayer();
		return;
	}
	closeAllAlertBoxes();
	iLayer.style.visibility = "visible";
	iLayer.style.zIndex = "30";
}
function hideInfoNotJobber(){
	var iLayer = xGetElementById( "info_notJobber" );
	if( iLayer == null ) return;
	iLayer.style.visibility = "hidden";
	iLayer.style.zIndex = "1";
}



// ---------------------------------------------------------------------------
function showInfoRabattcode(){
	var iLayer = xGetElementById( "info_rabattcode" );
	if( iLayer == null ){
		hideInfoLayer();
		return;
	}
	closeAllAlertBoxes();
	iLayer.style.visibility = "visible";
	iLayer.style.zIndex = "30";
}
function hideInfoRabattcode(){
	var iLayer = xGetElementById( "info_rabattcode" );
	if( iLayer == null ) return;
	iLayer.style.visibility = "hidden";
	iLayer.style.zIndex = "1";
}



// ---------------------------------------------------------------------------
function showInfoRabattcodeBanner(){
	var iLayer = xGetElementById( "info_rabattcode_banner" );
	if( iLayer == null ){
		hideInfoLayer();
		return;
	}
	closeAllAlertBoxes();
	iLayer.style.visibility = "visible";
	iLayer.style.zIndex = "30";
}
function hideInfoRabattcodeBanner(){
	var iLayer = xGetElementById( "info_rabattcode_banner" );
	if( iLayer == null ) return;
	iLayer.style.visibility = "hidden";
	iLayer.style.zIndex = "1";
}



// ---------------------------------------------------------------------------
function showInfoMarked(){
	var iLayer = xGetElementById( "info_marked" );
	if( iLayer == null ){
		hideInfoLayer();
		return;
	}
	closeAllAlertBoxes();
	showAlertboxHelper( 120, 70, 302, 176 );
	iLayer.style.visibility = "visible";
	iLayer.style.zIndex = "30";
}
function hideInfoMarked(){
	var iLayer = xGetElementById( "info_marked" );
	if( iLayer == null ) return;
	iLayer.style.visibility = "hidden";
	iLayer.style.zIndex = "1";
	hideAlertboxHelper()
}


// ---------------------------------------------------------------------------
function showInfoPJ(){
	var iLayer = xGetElementById( "info_pj" );
	if( iLayer == null ){
		hideInfoLayer();
		return;
	}
	closeAllAlertBoxes();
	iLayer.style.visibility = "visible";
	iLayer.style.zIndex = "30";
}
function hideInfoPJ(){
	var iLayer = xGetElementById( "info_pj" );
	if( iLayer == null ) return;
	iLayer.style.visibility = "hidden";
	iLayer.style.zIndex = "1";
}




// ---------------------------------------------------------------------------
function showInfoApplied(){
	var iLayer = xGetElementById( "info_applied" );
	if( iLayer == null ){
		hideInfoLayer();
		return;
	}
	closeAllAlertBoxes();
	iLayer.style.visibility = "visible";
	iLayer.style.zIndex = "30";
}
function hideInfoApplied(){
	var iLayer = xGetElementById( "info_applied" );
	if( iLayer == null ) return;
	iLayer.style.visibility = "hidden";
	iLayer.style.zIndex = "1";
}



// ---------------------------------------------------------------------------
function showInfoNoAppsLeft(){
	var iLayer = xGetElementById( "info_noappsleft" );
	if( iLayer == null ){
		hideInfoLayer();
		return;
	}
	closeAllAlertBoxes();
	iLayer.style.visibility = "visible";
	iLayer.style.zIndex = "30";
}
function hideInfoNoAppsLeft(){
	var iLayer = xGetElementById( "info_noappsleft" );
	if( iLayer == null ) return;
	iLayer.style.visibility = "hidden";
	iLayer.style.zIndex = "1";
}



// ---------------------------------------------------------------------------
function showInfoMarkerlist(){
	var iLayer = xGetElementById( "info_markerlist" );
	if( iLayer == null ){
		hideInfoLayer();
		return;
	}
	closeAllAlertBoxes();
	iLayer.style.visibility = "visible";
	iLayer.style.zIndex = "30";
}
function hideInfoMarkerlist(){
	var iLayer = xGetElementById( "info_markerlist" );
	if( iLayer == null ) return;
	iLayer.style.visibility = "hidden";
	iLayer.style.zIndex = "1";
}



// ---------------------------------------------------------------------------
function showInfoFolderActions(){
	//showAlertboxHelperFor("info_folderactions");
	//showAlertboxHelper( 120, 70, 412, 355 );
	showAlertboxHelper( 120, 70, 410, 200 );
	var iLayer = xGetElementById( "info_folderactions" );
	if( iLayer == null ){
		hideInfoLayer();
		return;
	}
	closeAllAlertBoxes();
	iLayer.style.visibility = "visible";
	iLayer.style.zIndex = "30";
}
function hideInfoFolderActions(){
	var iLayer = xGetElementById( "info_folderactions" );
	if( iLayer == null ) return;
	iLayer.style.visibility = "hidden";
	iLayer.style.zIndex = "1";
	hideAlertboxHelper();
}


// ---------------------------------------------------------------------------
function showInfoFolderRename(){
	var iLayer = xGetElementById( "info_folderrename" );
	if( iLayer == null ){
		hideInfoLayer();
		return;
	}
	closeAllAlertBoxes();
	iLayer.style.visibility = "visible";
	iLayer.style.zIndex = "30";
	if( document.f.newfoldername ){
		document.f.newfoldername.focus();
		// document.f.newfoldername.select();
	}
}
function hideInfoFolderRename(){
	var iLayer = xGetElementById( "info_folderrename" );
	if( iLayer == null ) return;
	iLayer.style.visibility = "hidden";
	iLayer.style.zIndex = "1";
	if( document.f.save ) document.f.save.disabled = false;

}


// ---------------------------------------------------------------------------
function showInfoFolderCreate(){
	showLayer( "info_foldercreate" );
}
function hideInfoFolderCreate(){
	hideLayer( "info_foldercreate" );
	if( document.f.save ) document.f.save.disabled = false;
}


// ---------------------------------------------------------------------------
function showInfoFolderDelete(){
	showLayer( "info_folderdelete" );
}
function hideInfoFolderDelete(){
	hideLayer( "info_folderdelete" );
	if( document.f.save ) document.f.save.disabled = false;
}



// ---------------------------------------------------------------------------
function showLayer( name ){
	var iLayer = xGetElementById( name );
	if( iLayer == null ) return;
	closeAllAlertBoxes();
	iLayer.style.visibility = "visible";
	iLayer.style.zIndex = "30";
}
function hideLayer( name ){
	var iLayer = xGetElementById( name );
	if( iLayer == null ) return;
	iLayer.style.visibility = "hidden";
	iLayer.style.zIndex = "1";
}


// ---------------------------------------------------------------------------
function activatePic( num ){
	deactivateAllPics();

	el = "";
	switch( num ){
	case 1: {
			el = "delpic01";
			break;
		}
	case 2: {
			el = "delpic02";
			break;
		}
	case 3: {
			el = "delpic03";
			break;
		}
	case 4: {
			el = "delpic04";
			break;
		}
	case 5: {
			el = "delpic05";
			break;
		}
	case 6: {
			el = "delpic06";
			break;
		}

	}

	e = xGetElementById( el );
	if( e == null ) return;

	e.style.display = "block";

}

function deactivatePic( num ){
	el = "";

	switch( num ){
	case 1: {
			el = "delpic01";
			break;
		}
	case 2: {
			el = "delpic02";
			break;
		}
	case 3: {
			el = "delpic03";
			break;
		}
	case 4: {
			el = "delpic04";
			break;
		}
	case 5: {
			el = "delpic05";
			break;
		}
	case 6: {
			el = "delpic06";
			break;
		}

	}

	e = xGetElementById( el );
	if( e == null ) return;

	e.style.display = "none";

}


function deactivateAllPics(){
	deactivatePic(1);
	deactivatePic(2);
	deactivatePic(3);
	deactivatePic(4);
	deactivatePic(5);
	deactivatePic(6);

}


function showInfoPicDel(){
	var iLayer = xGetElementById( "info_picdel" );
	if( iLayer == null ){
		hideInfoLayer();
		return;
	}
	closeAllAlertBoxes();
	iLayer.style.visibility = "visible";
	iLayer.style.zIndex = "30";
}
function hideInfoPicDel(){
	var iLayer = xGetElementById( "info_picdel" );
	if( iLayer == null ) return;
	iLayer.style.visibility = "hidden";
	iLayer.style.zIndex = "1";
}




// ---------------------------------------------------------------------------
function enableAlbum01(){
	e = xGetElementById( "album01" );
	if( e == null ) return;
	e.style.display = "block";
	e = xGetElementById( "album01_disabled" );
	if( e == null ) return;
	e.style.display = "none";
}
function enableAlbum02(){
	e = xGetElementById( "album02" );
	if( e == null ) return;
	e.style.display = "block";
	e = xGetElementById( "album02_disabled" );
	if( e == null ) return;
	e.style.display = "none";
}
function enableAlbum03(){
	e = xGetElementById( "album03" );
	if( e == null ) return;
	e.style.display = "block";
	e = xGetElementById( "album03_disabled" );
	if( e == null ) return;
	e.style.display = "none";
}

function disableAlbum01(){
	e = xGetElementById( "album01" );
	if( e == null ) return;
	e.style.display = "none";
	e = xGetElementById( "album01_disabled" );
	if( e == null ) return;
	e.style.display = "block";
}
function disableAlbum02(){
	e = xGetElementById( "album02" );
	if( e == null ) return;
	e.style.display = "none";
	e = xGetElementById( "album02_disabled" );
	if( e == null ) return;
	e.style.display = "block";
}
function disableAlbum03(){
	e = xGetElementById( "album03" );
	if( e == null ) return;
	e.style.display = "none";
	e = xGetElementById( "album03_disabled" );
	if( e == null ) return;
	e.style.display = "block";
}


function hideAlbum01(){
	e = xGetElementById( "album01" );
	if( e == null ) return;
	e.style.display = "none";
	e = xGetElementById( "album01_disabled" );
	if( e == null ) return;
	e.style.display = "none";
}
function hideAlbum02(){
	e = xGetElementById( "album02" );
	if( e == null ) return;
	e.style.display = "none";
	e = xGetElementById( "album02_disabled" );
	if( e == null ) return;
	e.style.display = "none";
}
function hideAlbum03(){
	e = xGetElementById( "album03" );
	if( e == null ) return;
	e.style.display = "none";
	e = xGetElementById( "album03_disabled" );
	if( e == null ) return;
	e.style.display = "none";
}


function showInfoPicMove(){
	var iLayer = xGetElementById( "info_picmove" );
	if( iLayer == null ){
		hideInfoLayer();
		return;
	}
	closeAllAlertBoxes();
	iLayer.style.visibility = "visible";
	iLayer.style.zIndex = "30";
}
function hideInfoPicMove(){
	var iLayer = xGetElementById( "info_picmove" );
	if( iLayer == null ) return;
	iLayer.style.visibility = "hidden";
	iLayer.style.zIndex = "1";
}





// ---------------------------------------------------------------------------
function showInfoAlbumRename(){
	var iLayer = xGetElementById( "info_albumrename" );
	if( iLayer == null ){
		hideInfoLayer();
		return;
	}
	closeAllAlertBoxes();
	iLayer.style.visibility = "visible";
	iLayer.style.zIndex = "30";
}
function hideInfoAlbumRename(){
	var iLayer = xGetElementById( "info_albumrename" );
	if( iLayer == null ) return;
	iLayer.style.visibility = "hidden";
	iLayer.style.zIndex = "1";
}


// ---------------------------------------------------------------------------
function showInfoRecommend(){
	var iLayer = xGetElementById( "info_recommend" );
	if( iLayer == null ){
		hideInfoLayer();
		return;
	}
	closeAllAlertBoxes();
	showAlertboxHelper( 76, 100, 442, 456 );
	// document.rec.sendmail.value = recommend_button_init;
	iLayer.style.visibility = "visible";
	iLayer.style.zIndex = "30";
}
function hideInfoRecommend(){
	var iLayer = xGetElementById( "info_recommend" );
	if( iLayer == null ) return;
	hideAlertboxHelper();
	iLayer.style.visibility = "hidden";
	iLayer.style.zIndex = "1";
}



// ---------------------------------------------------------------------------
function showInfoDelApp(){
	var iLayer = xGetElementById( "info_del_app" );
	if( iLayer == null ){
		hideInfoLayer();
		return;
	}
	closeAllAlertBoxes();
	iLayer.style.visibility = "visible";
	iLayer.style.zIndex = "30";
}
function hideInfoDelApp(){
	var iLayer = xGetElementById( "info_del_app" );
	if( iLayer == null ) return;
	iLayer.style.visibility = "hidden";
	iLayer.style.zIndex = "1";
}





// ---------------------------------------------------------------------------


function trim( s ){
	return s.replace(/^\s*|\s*$/g, "");
}

function emailCheck( email ){
	p1 = email.search( /.+@.+\...+/ );
	return (p1>-1);
}


var recommend_button;
var recommended = false;
function recommendJob(){

	if( recommended ){
		hideInfoLayer();
		hideInfoRecommend();
		return;
	}

	e = 0;

	em_s = trim(document.rec.se.value);

	em1 = trim(document.rec.r1.value);
	em2 = trim(document.rec.r2.value);
	em3 = trim(document.rec.r3.value);
	em4 = trim(document.rec.r4.value);

	e += trim(document.rec.sn.value).length == 0 ? 1 : 0;
	e += emailCheck( em_s ) ? 0 : 2;


	rcv = ( em1.length > 0 )
	      || (em2.length > 0)
	      || (em3.length > 0)
	      || (em4.length > 0);

	if( rcv && (em1.length==0) ){
		if(em2.length>0){
			document.rec.r1.value = document.rec.r2.value;
			document.rec.r2.value = document.rec.r3.value;
			document.rec.r3.value = document.rec.r4.value;
			document.rec.r4.value = "";
		} else if(em3.length>0){
			document.rec.r1.value = document.rec.r3.value;
			document.rec.r2.value = document.rec.r4.value;
			document.rec.r3.value = "";
			document.rec.r4.value = "";
		} else {
			document.rec.r1.value = document.rec.r4.value;
			document.rec.r2.value = "";
			document.rec.r3.value = "";
			document.rec.r4.value = "";
		}
		em1 = trim( document.rec.r1.value );
		em2 = trim( document.rec.r2.value );
		em3 = trim( document.rec.r3.value );
		em4 = trim( document.rec.r4.value );

	}


	e += rcv & emailCheck(em1) ? 0 : 4;

	e += (  (em2.length>0 ) && !emailCheck(em2)  ) ?  8 : 0;
	e += (  (em3.length>0 ) && !emailCheck(em3)  ) ? 16 : 0;
	e += (  (em4.length>0 ) && !emailCheck(em4)  ) ? 32 : 0;

	if( document.rec.agb.type == "checkbox")
		e += document.rec.agb.checked ? 0 : 64;
	else if( document.rec.agb.type == "hidden")
		e += document.rec.agb.value == 1 ? 0 : 64;

	if( document.rec.ds.type == "checkbox")
		e += document.rec.ds.checked ? 0 : 128;
	else if( document.rec.ds.type == "hidden")
		e += document.rec.ds.value == 1 ? 0 : 128;


	e_sn = xGetElementById( "sn" );
	e_se = xGetElementById( "se" );

	e_r1 = xGetElementById( "r1" );
	e_r2 = xGetElementById( "r2" );
	e_r3 = xGetElementById( "r3" );
	e_r4 = xGetElementById( "r4" );

	e_td01 = xGetElementById( "td01" );
	e_td02 = xGetElementById( "td02" );
	e_td03 = xGetElementById( "td03" );
	e_td04 = xGetElementById( "td04" );
	e_td05 = xGetElementById( "td05" );
	e_td06 = xGetElementById( "td06" );

	e_agbbox  = xGetElementById( "agbbox" );
	e_agblink = xGetElementById( "agblink" );
	e_dsbox   = xGetElementById( "dsbox" );
	e_dslink  = xGetElementById( "dslink" );

	errormsg1 = "";
	errormsg2 = "";

	if( (e&1)==1){
		e_td01.className = "userinput_err";
		e_sn.className = "input_std_err";
		errormsg1 = err01;
	} else {
		e_td01.className = "userinput";
		e_sn.className = "input_std";
	}

	if( (e&2)==2){
		e_td02.className = "userinput_err";
		e_se.className = "input_std_err";
		errormsg2 = err02;
	} else {
		e_td02.className = "userinput";
		e_se.className = "input_std";
	}

	if( (e&4)==4){
		e_td03.className = "userinput_err";
		e_r1.className = "input_std_err";
		errormsg2 = err02;
	} else {
		e_td03.className = "userinput";
		e_r1.className = "input_std";
		errormsg2 = err02;
	}


	if( (e&8)==8){
		e_td04.className = "userinput_err";
		e_r2.className = "input_std_err";
		errormsg2 = err02;
	} else {
		e_td04.className = "userinput";
		e_r2.className = "input_std";
	}

	if( (e&16)==16){
		e_td05.className = "userinput_err";
		e_r3.className = "input_std_err";
		errormsg2 = err02;
	} else {
		e_td05.className = "userinput";
		e_r3.className = "input_std";
	}

	if( (e&32)==32){
		e_td06.className = "userinput_err";
		e_r4.className = "input_std_err";
		errormsg2 = err02;
	} else {
		e_td06.className = "userinput";
		e_r4.className = "input_std";
	}

	// Checkbox:
	if( (e&64)==64){
		if(e_agbbox) e_agbbox.className = "userinput_chk_err";
		if(e_agblink) e_agblink.className = "userinput_chk_err";
	} else {
		if(e_agbbox) e_agbbox.className = "userinput_chk";
		if(e_agblink) e_agblink.className = "userinput_chk";
	}

	// Checkbox:
	if( (e&128)==128){
		if(e_dsbox) e_dsbox.className = "userinput_chk_err";
		if(e_dslink) e_dslink.className = "userinput_chk_err";
	} else {
		if(e_dsbox) e_dsbox.className = "userinput_chk";
		if(e_dslink) e_dslink.className = "userinput_chk";
	}

	// alert( "Error-Code: " + e );
	err = xGetElementById( "rc_errmsg" );
	if( e == 0 ){
		err.style.display = "none";

		document.rec.sendmail.value = recommend_button;
		recommended = true;

		setTimeout( "hideInfoLayer();hideInfoRecommend();", 1500 );

		req = "/action/job_recommendation_action.php?focus=" + escape( document.rec.jobid.value )
		      + "&sn=" + escape( trim(document.rec.sn.value) )
		      + "&se=" + escape( em_s )
		      + "&r1=" + escape( em1 )
		      + "&r2=" + escape( em2 )
		      + "&r3=" + escape( em3 )
		      + "&r4=" + escape( em4 )
		      + "&msg=" + escape( document.rec.msg.value )
		      + "&agb=1"
		      + "&ds=1"

		      document.images["loader"].src = req;

	} else {
		err.style.display = "block";
		e_msg = errormsg1;

		if( errormsg2.length > 0 ){
			if( e_msg.length > 0 ){
				e_msg += "<BR>"+errormsg2;
			} else {
				e_msg = errormsg2
			        }

		        }

		        err.innerHTML = e_msg;
		//alert( e );
	}


}

/************************************************************************************/
function showLanguages(){
	el_1 = xGetElementById( "login_navi" );
	el_2 = xGetElementById( "login_language_select" );

	if( el_1 != null ) el_1.style.display = "none";
	if( el_2 != null ) el_2.style.display = "inline";

}

function hideLanguages(){
	el_1 = xGetElementById( "login_language_select" );
	el_2 = xGetElementById( "login_navi" );

	if( el_1 != null ) el_1.style.display = "none";
	if( el_2 != null ) el_2.style.display = "inline";


}


function getXMLHttp(){
	var req = false;
	if( window.XMLHttpRequest ){
		try{
			req = new XMLHttpRequest();
		} catch(e){
			req = false;
		}
	} else if( window.ActiveXObject ){
		try{
			req = new ActiveXObject( "Msxml2.XMLHTTP" );
		} catch(e) {
			try{
				req = new ActiveXObject( "Microsoft.XMLHTTP" );
			} catch(e){
				req = false;
			}
		}
	}
	return req;
}


function addFavorite(url,titel){
	if( isIExplore() ){
		if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)){
			window.external.addFavorite(url,titel)
		}
	}
	else {

		if( isFirefox() ){
			window.sidebar.addPanel(titel,url,'');
		}

	}
}



// ---------------------------------------------------------------------------
function setSteps( num ){
	m = "";
	switch( num ){
	case 10:{
			m = "steps10";
			break;
		}
	case 20:{
			m = "steps20";
			break;
		}
	case 30:{
			m = "steps30";
			break;
		}
	}
	var link = "/action/b_cookie.php?mode=" + m + "&" + sess;
	document.images["loader"].src = link;
}


// ---------------------------------------------------------------------------
function setStepsApp( num ){
	m = "";
	switch( num ){
	case 10:{
			m = "appsteps10";
			break;
		}
	case 20:{
			m = "appsteps20";
			break;
		}
	case 30:{
			m = "appsteps30";
			break;
		}
	}
	var link = "/action/a_cookie.php?mode=" + m + "&" + sess;
	document.images["loader"].src = link;
}


// ---------------------------------------------------------------------------
function setStepsInv( num ){
	m = "";
	switch( num ){
	case 10:{
			m = "invsteps10";
			break;
		}
	case 20:{
			m = "invsteps20";
			break;
		}
	case 30:{
			m = "invsteps30";
			break;
		}
	}
	var link = "/action/a_cookie.php?mode=" + m + "&" + sess;
	document.images["loader"].src = link;
}



// ---------------------------------------------------------------------------
function setFrameHeight( num ){
	var link = "/action/a_cookie.php?mode=appframe&param=" + escape( num ) + "&" + sess;
	document.images["loader"].src = link;
}


function flashWorkaround(){

	return;

	flashObjekte = new Array();

	if( document.getElementsByTagName )
		flashObjekte=document.getElementsByTagName( "object" );

	for( flashIndex=0; flashIndex<flashObjekte.length; flashIndex++ )
		flashObjekte[ flashIndex ].outerHTML = flashObjekte[ flashIndex ].outerHTML;

}

function textfeldFlashWorkaround(){
	tf = xGetElementById( "textfeld" );
	if( tf != null ){
		tf.outerHTML = tf.outerHTML;
	}
}

function preloadBGImages(){

	im = new Image();

	var site;

	// TODO: URL anpassen:
	site = "http://www.jacktiger.com";

	im.src = site + "/images_global/frame_job_standard/ro.gif";
	im.src = site + "/images_global/frame_job_standard/lo.gif";
	im.src = site + "/images_global/frame_job_standard/ru.gif";
	im.src = site + "/images_global/frame_job_standard/lu.gif";

	im.src = site + "/images_global/frame_job_hotjob/ro.gif";
	im.src = site + "/images_global/frame_job_hotjob/lo.gif";
	im.src = site + "/images_global/frame_job_hotjob/ru.gif";
	im.src = site + "/images_global/frame_job_hotjob/lu.gif";


}


// ---------------------------------------------------------------------------
function setDirectOkay( b ){
	m = "dokayoff";
	if( b ){
		m = "dokayon";
	}
	var link = "/action/a_cookie.php?mode=" + m + "&" + sess;
	document.images["loader"].src = link;
}


/******************************************************************************/
/******************************************************************************/
/***                                                                        ***/
/***  Externes Javaskript zur Deaktivierung des ActiveX-Flash-Humbuks       ***/
/***                                                                        ***/
/******************************************************************************/
/******************************************************************************/
var bo_ns_id = 0;

function startIeFix(){
	if(isIE2()){
		document.write('<div id="bo_ns_id_' + bo_ns_id + '"><!-- ');
	}
}

function endIeFix(){
	if(isIE2()){
		document.write('</div>');
		var theObject = document.getElementById("bo_ns_id_" + bo_ns_id++);
		var theCode = theObject.innerHTML;
		theCode = theCode.substring(4 ,9+theCode.indexOf("</object>"));
		document.write(theCode);
	}
}

function isIE2(){
	// only for Win IE 6+
	// But not in Windows 98, Me, NT 4.0, 2000
	var strBrwsr= navigator.userAgent.toLowerCase();
	if(strBrwsr.indexOf("msie") > -1 && strBrwsr.indexOf("mac") < 0){
		if(parseInt(strBrwsr.charAt(strBrwsr.indexOf("msie")+5)) < 6){
			return false;
		}
		if(strBrwsr.indexOf("win98") > -1 ||
		        strBrwsr.indexOf("win 9x 4.90") > -1 ||
		        strBrwsr.indexOf("winnt4.0") > -1 ||
		        strBrwsr.indexOf("windows nt 5.0") > -1)
		{
			return false;
		}
		return true;
	} else {
		return false;
	}
}


// ---------------------------------------------------------------------------
function keepAlive(){
	link = "/action/keep_alive_action.php?" + sess;
	im = document.images["loader"];
	if( im != null ){ im.src = link; }
}


// ---------------------------------------------------------------------------
// Session-Parameter:
var sessionParam;

// ---------------------------------------------------------------------------
function showInfoSessionExpire( elid ){
	var iLayer = xGetElementById( elid );
	if( iLayer == null ){
		hideInfoLayer();
		return;
	}
	closeAllAlertBoxes();
	iLayer.style.visibility = "visible";
	iLayer.style.zIndex = "30";
}
function hideInfoSessionExpire( elid ){
	var iLayer = xGetElementById( elid );
	if( iLayer == null ) return;
	iLayer.style.visibility = "hidden";
	iLayer.style.zIndex = "1";
}


// ---------------------------------------------------------------------------
function showInfoSessionExpire01B(){
	pling();
	showAlertboxHelper( 140,100,302,184 );
	showInfoSessionExpire( "info_sessionexpire_01_bew" );
}
function hideInfoSessionExpire01B(){
	hideAlertboxHelper();
	hideInfoSessionExpire( "info_sessionexpire_01_bew" );
}
function sessionExpire01B(){
	showInfoLayerScrolledListing();
	showInfoSessionExpire01B();
}


// ---------------------------------------------------------------------------
function showInfoSessionExpire02B(){
	pling();
	showAlertboxHelper( 140,100,302,222 );
	showInfoSessionExpire( "info_sessionexpire_02_bew" );
}
function hideInfoSessionExpire02B(){
	hideAlertboxHelper();
	hideInfoSessionExpire( "info_sessionexpire_02_bew" );
}
function sessionExpire02B(){
	showInfoLayerScrolledListing();
	hideInfoSessionExpire01B();
	showInfoSessionExpire02B();

	// Logout durchführen, falls noch nicht geschehen:
	var logoutRequest = getXMLHttp();

	// Falls Request-Objekt vorhanden:
	if( logoutRequest ){

		// URL und Parameter:
		var url;
		var params = sessionParam + "&do_logout=1";

		// URL:
		url = "http://www.jacktiger.com/action/logout_action.php?" + params;

		// Request senden:
		logoutRequest.open( "GET", url, true );
		logoutRequest.send("");

	}
}


// ---------------------------------------------------------------------------
function showInfoSessionExpire01I(){
	pling();
	showAlertboxHelper( 140,100,302,226 );
	showInfoSessionExpire( "info_sessionexpire_01_ins" );
}
function hideInfoSessionExpire01I(){
	hideAlertboxHelper();
	hideInfoSessionExpire( "info_sessionexpire_01_ins" );
}
function sessionExpire01I(){
	showInfoLayerScrolledListing();
	showInfoSessionExpire01I();
}


// ---------------------------------------------------------------------------
function showInfoSessionExpire02I(){
	pling();
	showAlertboxHelper( 140,100,302,268 );
	showInfoSessionExpire( "info_sessionexpire_02_ins" );
}
function hideInfoSessionExpire02I(){
	hideAlertboxHelper();
	hideInfoSessionExpire( "info_sessionexpire_02_ins" );
}

function sessionExpire02I(){
	showInfoLayerScrolledListing();
	hideInfoSessionExpire01I();
	showInfoSessionExpire02I();

	// Logout durchführen, falls noch nicht geschehen:
	var logoutRequest = getXMLHttp();

	// Falls Request-Objekt vorhanden:
	if( logoutRequest ){

		// URL und Parameter:
		var url;
		var params = sessionParam + "&do_logout=1";

		// URL:
		url = "http://www.jacktiger.com/action/logout_action.php?" + params;

		// Request senden:
		logoutRequest.open( "GET", url, true );
		logoutRequest.send("");

	}
}

// ---------------------------------------------------------------------------
function keepMeLoggedIn(){
	hideInfoLayer();
	hideInfoSessionExpire02I();
	hideInfoSessionExpire02B();
	/*
	link = "/action/keep_alive_action.php?" + sess;
	im = document.images["loader"];
	if( im != null ){
		im.src = link;
	} else {
		location.reload();
	}
	*/
	location.reload();
}

var remainingSeconds;
function countDown(){
	--remainingSeconds;
	showRemainingLoginTime();
}

var remainingTxt;
var expiredTxt;
var remainingMin;
function showRemainingLoginTime(){

	// Stunden:
	// 1 Stunde = 3600 Sekunden, 1/3600 = 0.00027777777777778
	hours = Math.floor( remainingSeconds * 0.00027777777777778 );

	// Minuten:
	// 1 Minute = 60 Sekunden, 1/60 = 0.016666666666667
	minutes = Math.floor( (remainingSeconds % 3600) * 0.016666666666667 );
	minutesPad = minutes < 10 ? "0" + minutes : minutes;

	// Sekunden:
	seconds = remainingSeconds % 60;
	secondsPad = seconds < 10 ? "0" + seconds : seconds;

	// Ausgabe:
	zeit = "";
	if( hours > 0 ){
		zeit = hours + ":" + minutesPad + ":" + secondsPad;
	}
	else {
		zeit = minutesPad + ":" + secondsPad;
	}

	log01 = xGetElementById( "logtimer_bew" );
	log02 = xGetElementById( "logtimer_ins" );

	if( ( hours <= 0 ) && ( minutes <= 0 ) && ( seconds <= 0 ) ){

		window.status = "" + expiredTxt;

		if( log01 ){
			log01.innerHTML = expiredTxt;
		}

		if( log02 ){
			log02.innerHTML = expiredTxt;
		}

		return true;
	}

	else {
		window.status = "" + remainingTxt + " " + zeit;

		myURL = "/popups/logintime.php?" + sessionParam;
		myLink = "<a href=\"javascript:openwin('" + myURL + "','logintime',400,330,1);\">[?]</a>"

		if( log01 ){
			log01.innerHTML = remainingTxt + " " + zeit + " " + remainingMin + " " + myLink;
		}

		if( log02 ){
			log02.innerHTML = remainingTxt + " " + zeit + " " + remainingMin + " " + myLink;
		}

		return true;
	}

}


// ---------------------------------------------------------------------------
function pling(){

	// SWF-Object
	plingSWF = new SWFObject( "/flash/session_alarm.swf", "pling_pling", "1", "1", "6", "#ffffff");

	// Put in Div-Tag "info_pling"
	plingSWF.write( "info_pling" );

	// clear after 10 seconds:
	setTimeout( clearPling, 10000 );

}

function clearPling(){
	plingDiv = xGetElementById( "info_pling" );
	plingDiv.innerHTML = "";
}


// ---------------------------------------------------------------------------
function askForHelp(){
	//alert( "Frage" );
	showInfoLayer();
	showInfoNeedHelp();
}

function showInfoNeedHelp(){
	var iLayer = xGetElementById( "info_needhelp" );
	if( iLayer == null ){
		hideInfoLayer();
		return;
	}
	closeAllAlertBoxes();

	// NOTE: 2x aufrufen für IE... :S
	showAlertboxHelperFor( "info_needhelp" );
	showAlertboxHelperFor( "alert_inner_needhelp" );

	iLayer.style.visibility = "visible";
	iLayer.style.zIndex = "30";
}
function hideInfoNeedHelp(){
	var iLayer = xGetElementById( "info_needhelp" );
	if( iLayer == null ) return;
	iLayer.style.visibility = "hidden";
	iLayer.style.zIndex = "1";
	hideAlertboxHelper();
}

function dontShowNeedHelpAgain(){

	now = new Date;
	currTime = now.getTime();

	// 10 Minuten: 10 * 60 * 1000 = 600000
	// offset = currTime + 600000;

	// 1 Tag: 24 * 60 * 60 * 1000 = 86400000
	// offset = currTime + 86400000;

	// 60 Tage: 60 * 24 * 60 * 60 * 1000 = 5184000000
	offset = currTime + 5184000000;

	c1  = "needhelp=1;expires=" + cookieDate(offset)+";path=/";
	c2  = "helptime=" + currTime + ";expires=" + cookieDate(offset)+";path=/";

	document.cookie = c1;
	document.cookie = c2;

}

function needHelpMaybeLater(){

	now = new Date;
	currTime = now.getTime();

	// 10 Minuten: 10 * 60 * 1000 = 600000
	// offset = currTime + 600000;

	// 1 Tag: 24 * 60 * 60 * 1000 = 86400000
	offset = currTime + 86400000;

	c1  = "needhelp=2;expires=" + cookieDate(offset) + ";path=/";
	c2  = "helptime=" + currTime + ";expires=" + cookieDate(offset) + ";path=/";

	document.cookie = c1;
	document.cookie = c2;
}

function cookieDate( timeStamp ){
	d = new Date();
	d.setTime( timeStamp );
	return d.toGMTString();
}


function checkNeedHelp(){
	// alert( document.cookie );

	// Cookie auslesen:
	cookieString = new String( document.cookie );

	// Aufsplitten in die einzelnen Einträge:
	cookiePairs = cookieString.split( ";" );

	// Aktueller Timestamp:
	now = new Date;

	// Cookie-Werte:
	needHelpValue = 0;
	needHelpTime  = 0;

	// Verzoegerung, falls der User auf "im moment nicht" klickt:
	// 30 Min = 30 * 60 * 1000 =
	delayFor = 1800000;

	// Alle Key-Value-Paare durchlaufen:
	for( var idx=0; idx < cookiePairs.length; idx++ ){

		// Aktuelles Paar:
		pair = cookiePairs[idx];

		// Führendes Leerzeichen entfernen, falls vorhanden:
		if( pair.charAt(0) == " " )
			pair = pair.substr( 1, pair.length -1 );

		// "key=value" aufsplitten:
		values = pair.split( "=" );

		// Es müssen exakt zwei Einträge vorhanden sein:
		if( values.length == 2 ){

			// Key-1 heisst "needhelp"
			if( values[0] == "needhelp" )
				needHelpValue = values[1];

			// Key-2 heisst "helptime"
			if( values[0] == "helptime" )
				needHelpTime = values[1];

		}

	}

	// alert( "NeedHelp from Cookie: " + needHelpValue );
	// alert( "NeedHelp Time: " + needHelpTime );

	// Die ausgelesenen Cookie-Werte sind Strings. Wir brauchen aber Integer:
	needHelpValueInt = parseInt( needHelpValue );
	needHelpTimeInt  = parseInt( needHelpTime );

	// Bei nicht-interpretierbaren Werten auf 0 setzen:
	if( isNaN( needHelpValueInt ) ) needHelpValueInt = 0;
	if( isNaN( needHelpTime     ) ) needHelpTime = 0;

	// Hilfs-Box anzeigen: ja/nein
	enableHelper = true;

	// 30 Min = 30*60*1000 = 9000000
	//  5 Min =  5*60*1000 =  300000
	//  1 Min =  1*60*1000 =   60000
	// 10 Sek =    10*1000 =   10000
	helperTimeout = 300000;
	// helperTimeout = 10000;              // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Entfernen!!!

	// Cookie auswerten:
	switch( needHelpValueInt ){

		// Cookie nicht gesetzt:
		case 0:{
			// alert( "help enabled" );
			enableHelper = true;
			break;
		}

		// Keine Hilfe:
		case 1: {
			// alert( "help disabled" );
			enableHelper = false;
			break;
		}

		// Hilfe später:
		case 2: {
			// Zeitdifferenz vom "jetzt-nicht"-Klick bis jetzt:
			diff = now.getTime() - needHelpTimeInt;
			diffSec = Math.round(diff / 1000);
			diffMin = Math.floor(diffSec / 60);
			diffSecMod = diffSec % 60;
			// alert( "help delayed since " + diffMin + " min. " + diffSecMod + " sec." );

			// Wenn der Timestamp im Cookie älter ist als "delayFor" MiliSekunden:
			if( diff > delayFor ){
				// Hilfe anbieten:
				// alert( "delayed help now active" );
				enableHelper = true;
			}
			else{
				// Hilfe noch nicht anbieten:
				// alert( "help delayed" );
				enableHelper = false;
			}

			break;
		}

		// Ansonsten:
		default: {
			// alert( "help enabled" );
			enableHelper = true;
			break;
		}
	}

	if( enableHelper ){
		// alert( "Helper enabled" );
		setTimeout( askForHelp, helperTimeout );
	}

}


function hideAlertboxHelper(){
	iFrame = xGetElementById( "alertbox_helper" );
	if( iFrame != null ){
		iFrame.style.visibility = "hidden"
		iFrame.style.zIndex = "1";
	}
}

function showAlertboxHelper( x, y, w, h ){
	iFrame = xGetElementById( "alertbox_helper" );
	if( iFrame != null ){
		if( h > 0 ) xHeight( "alertbox_helper", h );
		if( w > 0 ) xWidth(  "alertbox_helper", w );
		if( y > 0 ) xTop(    "alertbox_helper", y );
		if( x > 0 ) xLeft(   "alertbox_helper", x );

		iFrame.style.visibility = "visible";
		iFrame.style.zIndex = "25";
	}
}

function showAlertboxHelperFor( elementname ){
	if( isIExplore() ){
		alertboxHeight = xHeight( elementname );
		alertboxWidth  = xWidth(  elementname );
		alertboxTop    = xTop(    elementname );
		alertboxLeft   = xLeft(   elementname );

		showAlertboxHelper( alertboxLeft, alertboxTop, alertboxWidth, alertboxHeight );
	}
}
