var ie = navigator.userAgent.toLowerCase().indexOf("msie")>-1 && navigator.userAgent.toLowerCase().indexOf("opera")< 0;
var ie7 = navigator.userAgent.toLowerCase().indexOf("msie 7.")>-1;
var ie_version;

if (ie)
{
	ie_version = parseInt (navigator.userAgent.toLowerCase().substr (navigator.userAgent.toLowerCase().indexOf("msie") + 5, 1));
}

function fj_findObj(n, d) 
{
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=fj_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function fj_showHideLayers() {
  var i,p,v,obj,args=fj_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=fj_findObj(args[i]))!=null) { v=args[i+2];
	if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
	obj.visibility=v; }
}


<!-- ************************************************** -->

function FIND(item) 
{
	if( window.mmIsOpera ) return(document.getElementById(item));
	if (document.all) return(document.all[item]);
	if (document.getElementById) return(document.getElementById(item));
	return(false);
}

<!-- ************************************************** -->

function BubbleInfo (bubble_text)
{
	var bubble_obj = FIND ("glossary_bubble");
	if (bubble_obj)
	{
		SetText ("text_glossary_bubble", bubble_text);
		
		if (mouse_posy + 12 > jlGetWinInfo ("height")  - bubble_obj.offsetHeight)
		{	
			bubble_obj.style.top = mouse_posy + 12 + pageOffset().top - bubble_obj.offsetHeight + "px";
		}
		else
		{
			bubble_obj.style.top = mouse_posy + 12 + pageOffset().top + "px";
		}

		if (mouse_posx + 12 > jlGetWinInfo ("width") - bubble_obj.offsetWidth)
		{
			bubble_obj.style.left = mouse_posx + 12 + pageOffset().left - bubble_obj.offsetWidth + "px";
		}
		else
		{
			bubble_obj.style.left = mouse_posx + 12 + pageOffset().left + "px";
		}
	}
	
	ShowDiv ("glossary_bubble");
}

<!-- ************************************************** -->

function ShowDiv (para_name)
{
	var para = FIND (para_name);
	if (para)
	{
		para.style.visibility = "visible";
		para.style.display = "block";
	}
}

<!-- ************************************************** -->

function HideDiv (para_name)
{
	var para = FIND (para_name);
	if (para)
	{
		para.style.visibility = "hidden";
		para.style.display = "none";
	}
}


<!-- ************************************************** -->

function NumStr (string, length)
{
	var result = "";
	var zerocount = length - string.length;
	if (zerocount > 0)
	{
		for (i = 0; i != zerocount; i++)
			result += "0";
	}
	result += string;
	return result;
}

<!-- ************************************************** -->

var glossary_on = false;


function ShowGlossary (on_title, off_title, page_type)
{
	glossary_on = !glossary_on;
	if (glossary_on)
	{
		HideDiv ("JO_SPECIALS");
		HideDiv ("DARINA_CONTENT");
		ShowDiv ("glossarycontainer");
		SetText ("glossarybutton", off_title);
	}
	else
	{
		ShowDiv ("JO_SPECIALS");
		ShowDiv ("DARINA_CONTENT");
		HideDiv ("glossarycontainer");
		SetText ("glossarybutton", on_title);
	} 
}

<!-- ************************************************** -->

function BuildGlossary()
{
	for (var glossary_word in glossary) 
	{
		document.write ("<tr>");
		document.write ("<td class='title'>" + glossary_word + "<td />");
		document.write ("<td>" + glossary[glossary_word] + "<td />");
		document.write ("</tr>");
	}
}

<!-- ************************************************** -->

function OutputDate (lang)
{
	var thisdate = new Date();
	var m_de  	= new Array ("Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember");
	var m_en		= new Array ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
	var result 	= "";
	var month  	= thisdate.getMonth();
	var daystr	= thisdate.getDate() + "";
	
	result += daystr + (lang=="de" ? "." : "") + "&#160;";
	result += (lang == "de" ? m_de[month] : m_en[month]) + "&#160;";
	result += thisdate.getYear() + "&#160;";
	result += NumStr (thisdate.getHours() + "", 2) + ":" + NumStr (thisdate.getMinutes() + "", 2) + "&#160;";
	return result;
}

<!-- ************************************************** -->

function SetText (node_id, text)
{
	var elem = FIND (node_id);
	if (elem)
		elem.firstChild.nodeValue = text;
}

<!-- ************************************************** -->

function SetAttrib (node, attrib_name, attrib_value)
{
	if (node)
	{
		var new_attrib = document.createAttribute (attrib_name);
		new_attrib.nodeValue = attrib_value;
		node.setAttributeNode (new_attrib);
	}
}

<!-- ************************************************** -->
<!-- for glossary bubble -->

document.onmousemove = GetPos;
var mouse_posx = 0;
var mouse_posy = 0;
var menu_preview = "";

function GetPos (event)
{
	if (ie)
	{
		mouse_posx = window.event.clientX;
		mouse_posy = window.event.clientY;
		if (document.body && document.body.scrollLeft) 
		{
			mouse_posx += document.body.scrollLeft;
			mouse_posy += document.body.scrollTop;
		}
	}
	else
	{
		mouse_posx = event.pageX - pageXOffset;
		mouse_posy = event.pageY - pageYOffset;		
	}
	
	//window.document.title = "mouse: " + mouse_posx + "/" + mouse_posy + " - win: " + (window.event.clientX + document.body.scrollLeft) + "/" + (window.event.clientY + document.body.scrollTop) + " - document: " + window.event.clientX + "/" + window.event.clientY + " - winsize: " + jlGetWinInfo ("docwidth") + "/" + jlGetWinInfo ("docheight");
}

<!-- ************************************************** -->

function BubbleInfoOff()
{
		HideDiv ("glossary_bubble");
}

<!-- ************************************************** -->
function MarkGlossaryWords (root_obj_name)
{
	if (glossary)
	{
		var root_obj = FIND (root_obj_name);
		if (root_obj)
		{
			var marked_content = root_obj.innerHTML;
			var counter = 0;
			var marked_word;
			var word_pos;
			var last_word_pos;
	
			for (var glossary_word in glossary) 
			{
				word_pos = marked_content.indexOf (glossary_word);
				while (word_pos != -1)
				{
					if (marked_content.substr (word_pos - 13, 10) != "BubbleInfo")
					{
						marked_word = "<span class='glossary_word' onmousemove='BubbleInfoGlossary (\"" + RealEscape (glossary_word) + "\")' onmouseout='BubbleInfoOff()'>" + RealEscape (glossary_word) + "</span>";
						marked_content = marked_content.replace (glossary_word, marked_word);
					}
					last_word_pos = word_pos;
					word_pos = (marked_content.substr (word_pos + marked_word.length)).indexOf (glossary_word);
					if (word_pos != -1) word_pos += last_word_pos + marked_word.length;
				}
			}
			root_obj.innerHTML = marked_content;
		}
	}
}

<!-- ************************************************** -->

function jlGetWinInfo (info_type)
{
	var result = 0;
	switch (info_type)
	{
		case "width": result = ie ? (document.documentElement ? document.documentElement.clientWidth : document.body.clientWidth) : window.innerWidth; break;
		case "height": result = ie ? (document.documentElement ? document.documentElement.clientHeight : document.body.clientHeight) : window.innerHeight; break;
		case "docwidth": result = ie ? document.body.clientWidth + document.body.scrollLeft : window.innerWidth; break;
		case "docheight": result = ie ? document.body.clientHeight + document.body.scrollTop : window.innerHeight; break;
	}
	return result;
}

<!-- ************************************************** -->
function pageOffset(win)
{
    if(!win) win = window;
    
    var pos = {left:0,top:0};

    if(typeof win.pageXOffset != 'undefined')
    {
         // Mozilla/Netscape
         pos.left = win.pageXOffset;
         pos.top = win.pageYOffset;
    }
    else
    {
         var obj = getBody(win);
         pos.left = obj.scrollLeft;
         pos.top = obj.scrollTop;
    }
    return pos;
}


<!-- ************************************************** -->

function getBody(w)
{
    return w.document.documentElement ? w.document.documentElement : w.document.body || null;
}

<!-- ************************************************** -->

function RealEscape (intext)
{
	var i = 0;
	var result = "";
	for (i = 0; i < intext.length; i++)
	{
		result += "&#" + intext.charCodeAt(i) + ";";
	}

	return result;
}

<!-- ************************************************** -->

function BubbleInfoGlossary (glossary_word)
{
	BubbleInfo (glossary [glossary_word]);
}


