var infobox_html  = '';
var loginbox_html = '<div id="rightimgbox"><img src="/tmpl/images/right_login.gif" width="171" height="179" alt="" title="" /></div>\
<div class="textbox">\
<i>Sie sind nicht eingeloggt.</i><br /><br />\
<form action="/nutzerbereich.htm" method="post" id="loginform">\
<label for="user">Nutzer</label><br />\
<input type="text" name="user" id="user" value="" /><br /><br />\
<label for="passwrd">Passwort</label><br /> \
<input type="password" name="passwrd" id="passwrd" value="" /><br /><br />\
<input type="submit" value="Login" class="submit" />\
</form>\
<small><br /><br /><a href="/zugangsdatenrettung.htm">Zugangsdaten vergessen</a>\
<br /><br />Noch keinen Nutzeraccount? <a href="/anmeldung.htm">Jetzt registrieren</a>\
</small></div>';
var suchbox_html  = '<div id="rightimgbox"><img src="/tmpl/images/right_suche.gif" width="171" height="179" alt="" title="" /></div>\
<div class="textbox">\
<form action="suche.htm" id="suchform">\
<label for="sq">Suchbegriff</label><br />\
<input type="text" name="sq" id="sq" value="" /><br /><br />\
<input type="submit" value="Ergebnisse anzeigen" class="submit" />\
</form>\
</div>';

var haslogboxani = false;
$(document).ready ( function ( ) {	infobox_html  = $("#right").html ( );
	$("#topright a").click ( function ( ) {
		$(this).blur ( );
		if ( haslogboxani ) return false;
		haslogboxani = true;
		activelinkid = $(this).attr("id");
		$("#topright a").removeClass ( "activelink" );
		$("#topright a").addClass ( "disabledlink" );
		$("#right").fadeOut ( 500, function ( ) {
			$("#right").html ( eval ( activelinkid ) );
			$("#right").fadeIn ( 3000, function ( ) { 
				haslogboxani = false;
				$("#topright a").removeClass ( "disabledlink" );
				$("#"+ activelinkid).addClass ( "activelink" );
			} );
		} );		return false;
	} );
	if ( self.location.pathname == '/suche.htm' ) {
		haslogboxani = true;
		$("#right").fadeOut ( 55, function ( ) {
			$("#right").html ( suchbox_html );
			$("#right").fadeIn ( 1000, function ( ) { 
				haslogboxani = false;
				var sqinputvalue = '';
				if ( self.location.search ) {
					sqinputvalue = self.location.search.substring(4);
					if ( sqinputvalue.indexOf('&') > - 1 ) {
						sqinputvalue = sqinputvalue.substring(0,sqinputvalue.indexOf('&'));
					}
				}
				sqinputvalue = sqinputvalue.replace('+',' ');
				sqinputvalue = unescape ( sqinputvalue );
				$("#suchform #sq").attr ( 'value', sqinputvalue );
				$("#topright a").removeClass ( "activelink" );
				$("#suchbox_html").addClass ( "activelink" );
			} );
		} );
	}
	if ( self.location.pathname == '/login.htm' ) {
		alert ( self.location.pathname );
	} } );
 
function showtogglebox ( boxid ) {
	if ( ! boxid ) return;
	haslogboxani = true;
	$("#topright a").removeClass ( "activelink" );
	$("#topright a").addClass ( "disabledlink" );
	$("#right").fadeOut ( 55, function ( ) {
		$("#right").html ( eval ( boxid ) );
		$("#right").fadeIn ( 1000, function ( ) {
			haslogboxani = false;
			$("#topright a").removeClass ( "disabledlink" );
			$("#"+ boxid).addClass ( "activelink" ); 
		} );
	} );
}

function showtaxtooltip ( xelemid, xtitle, xdesc, xlink ) {
	var newtxhtml = '<div id="taxonomytooltipcloser" onclick="closetaxdiv()">X</div><b>' + xtitle + '</b><br />' + unescape ( xdesc );
	if ( xlink != '#' ) newtxhtml = newtxhtml + '<br /><br /><small><a href="' + xlink + '">Mehr..</a></small>';
	$("#taxonomytooltip").html ( newtxhtml );
	xelemid = "#" + xelemid;
	var pos = $(xelemid).offset();  
	var width = $(xelemid).width();
	$("#taxonomytooltip").css( { "left": (pos.left + width) + "px", "top": pos.top + "px" } );
	$("#taxonomytooltip").fadeIn ( 1000 );
}

function closetaxdiv ( ) {
	$("#taxonomytooltip").hide ( 500 );
}
