var fade_in = 0;
var glossary;

var ie = (navigator.userAgent.toLowerCase().indexOf("msie") > -1 && navigator.userAgent.toLowerCase().indexOf("opera") < 0);
var ff = (navigator.userAgent.toLowerCase().indexOf("firefox") > -1);
var op = (navigator.userAgent.toLowerCase().indexOf("opera") > -1);

<!-- ************************************************** -->

function InitPage (is_home, without_glossary)
{
	if (without_glossary != 0) MarkGlossaryWords (is_home ? "news" : "page_content");
	PageFadeIn(is_home);
	ActivateMenuBubbleInfo();
	ActivateHilightImages();
	ActivateHilightLinkImages();
}

<!-- ************************************************** -->

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);
}

<!-- ************************************************** -->

var ie_content_opacity = 0;
var ie_content_fade_speed = 4;
var ie_page_init_ms = 500;

function PageFadeIn (is_home)
{
	var obj_content = FIND ("content");

	if (fade_in)
	{	
//		if (ie || ff)
		{
			if (obj_content)
			{
				if (is_home && ie_page_init_ms)
				{
					window.setTimeout ("PageFadeIn()", ie_page_init_ms);
					ie_page_init_ms = 0;
				}
				
				else if (ie_content_opacity < 100)
				{
					obj_content.style.filter = "Alpha(opacity=" + ie_content_opacity + ", finishopacity=0, style=0)";
					obj_content.style.opacity	= ie_content_opacity / 100;
					ie_content_opacity += ie_content_fade_speed;
					if (ie_content_opacity > 100) 
					{ 
						ie_content_opacity = 100;
					}
					window.setTimeout ("PageFadeIn()", 1);
				}	
				
				if (ie_content_opacity == 100)
				{
					ShowDiv ("div_form");
				}
			}
		}	
//		else
		{
//			ShowDiv ("div_form");
		}
	}
	else
	{
		if (obj_content)
		{
			obj_content.style.filter = "Alpha(opacity=100, finishopacity=0, style=0)";
			obj_content.style.opacity = "1";
		}
		ShowDiv ("div_form");
	}
}

<!-- ************************************************** -->

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 HilightImageByName (img_name)
{
	HilightImage (FIND (img_name));
}

<!-- ************************************************** -->

function HilightImage (img_obj)
{
	if (img_obj)
	{
		var source = img_obj.src + "";
		var new_source;
		var pos_ext = source.lastIndexOf (".");
		var pos_act = source.lastIndexOf ("_active");
		
		if (pos_act != -1)
		{
			new_source = source.substr (0, pos_act) + source.substr (pos_ext);
		}
		else
		{
			new_source = source.substring (0, pos_ext) + "_active" + source.substring (pos_ext);
		}
		
		img_obj.src = new_source;
	}
}

<!-- ************************************************** -->

function WriteSmallFont (fontname, string, img_class)
{
	document.write ('<span class="smallfont ' + fontname + '">' + string + '</span>');
	return;
	
	/*
	var str_len = string.length;
	var img_name;
	var str_output = "";
	var curr_char;
	var img_path = "";
	var img_ext = ".gif";
	var class_str = "";
	
	if (img_class && img_class != "")
	{
		class_str = ' class="' + img_class + '"';
	}

	for (var i = 0; i < str_len; i++)
	{
		curr_char = string.charAt (i);
		switch (curr_char)
		{
			case " ": img_name = "blank"; break;
			case "©": img_name = "copy"; break;
			case "!": img_name = ""; break;
			case "[": img_name = "para_open"; break;
			case "]": img_name = "para_close"; break;
			case ":": img_name = "colon"; break;
			case "+": img_name = "plus"; break;
			case "-": img_name = "minus"; break;
			case ";": img_name = "semicolon"; break;
			default: img_name = curr_char;
		}
		str_output = '<img' + class_str + ' src="images/fonts/' + fontname + '/font_' + img_name + '.gif" />'
		document.write (str_output);		
		
	}
	*/
}

<!-- ************************************************** -->

function ActivateThisMenuBubbleInfo()
{
	var bubble_info = "";
	
	switch (this.id)
	{
		case "link_cartoons": bubble_info = "cartoons + illustrationen"; break;
		case "link_ci": bubble_info = "corporate + print design"; break;
		case "link_web_design": bubble_info = "web design"; break;
		case "link_web_dev": bubble_info = "web development"; break;
		case "link_cms": bubble_info = "content management systeme"; break;
		case "link_xml": bubble_info = "xml technologien"; break;
		case "link_consulting": bubble_info = "consulting"; break;
	}
	
	BubbleInfo (bubble_info, "menu_preview");
}

<!-- ************************************************** -->

function ActivateMenuBubbleInfo()
{
	var allObjects = document.getElementsByTagName ('a');
	var ObjClass;

	for (var i = 0; i < allObjects.length; i++)
	{
		ObjClass = allObjects[i].className + "";
		if (ObjClass.indexOf ("bubble") != -1)
		{
			allObjects[i].onmousemove = ActivateThisMenuBubbleInfo;
			allObjects[i].onmouseout = BubbleInfoOff;
		}
	}
}

<!-- ************************************************** -->

function HilightThisImage()
{
	HilightImage (this);
}

<!-- ************************************************** -->

function ActivateHilightImages()
{	
	var allObjects = document.getElementsByTagName ('img');
	var ObjClass;

	for (var i = 0; i < allObjects.length; i++)
	{
		ObjClass = allObjects[i].className + "";
		if (ObjClass.indexOf ("hilight") != -1)
		{
			allObjects[i].onmouseover = HilightThisImage;
			allObjects[i].onmouseout = HilightThisImage;
		}
	}
}

<!-- ************************************************** -->

function HilightMyImages()
{
	var allObjects = this.getElementsByTagName ('img');
	var ObjClass;

	for (var i = 0; i < allObjects.length; i++)
	{
		HilightImage (allObjects[i]);
	}
	
}

<!-- ************************************************** -->

function ActivateHilightLinkImages()
{	
	var allObjects = document.getElementsByTagName ('a');
	var ObjClass;

	for (var i = 0; i < allObjects.length; i++)
	{
		ObjClass = allObjects[i].className + "";
		if (ObjClass.indexOf ("hilight") != -1)
		{
			allObjects[i].onmouseover = HilightMyImages;
			allObjects[i].onmouseout = HilightMyImages;
		}
	}
}

<!-- ************************************************** -->

function ToggleDiv (div_name)
{
	var obj_div = FIND (div_name);
	if (obj_div)
	{
		if (obj_div.style.visibility != "visible")
		{
			obj_div.style.visibility = "visible";
			obj_div.style.display = "block";
		}
		else
		{
			obj_div.style.visibility = "hidden";
			obj_div.style.display = "none";
		}
	}
}

<!-- ************************************************** -->

function ShowDivDependend (div_name, condition)
{
	if (condition) 	ShowDiv (div_name); 
	else 					HideDiv (div_name);
}

<!-- ************************************************** -->

function ShowDiv (div_name)
{
	var obj_div = FIND (div_name);
	if (obj_div)
	{
		obj_div.style.visibility = "visible";
		obj_div.style.display = "block";
	}
}

<!-- ************************************************** -->

function HideDiv (div_name)
{
	var obj_div = FIND (div_name);
	if (obj_div)
	{
		obj_div.style.visibility = "hidden";
		obj_div.style.display = "none";
	}
}

<!-- ************************************************** -->

var prev_service_name 	= "jolegat";
var prev_img_obj	= null;

function ActivateServiceLink (img_obj, service_name)
{
	if (service_name != prev_service_name)
	{
		if (prev_service_name != "") 
		{
			HideDiv ("desc_" + prev_service_name);
			HilightImage (prev_img_obj);
		}
		
		ShowDiv ("desc_" + service_name);
		HilightImage (img_obj);
		
		prev_service_name = service_name;
		prev_img_obj = img_obj;
	}
}

<!-- ************************************************** -->

function HilightSmallFont (root, orig_color, class_name)
{
	var allObjects = root.getElementsByTagName ('img');
	var ObjClass;
	var curr_src, new_src;

	for (var i = 0; i < allObjects.length; i++)
	{
		ObjClass = allObjects[i].className + "";
		if (ObjClass.indexOf (class_name) != -1)
		{
			curr_src = allObjects[i].src;
			if (curr_src.indexOf ("/re/") != -1)
			{
				new_src = curr_src.replace ("/re/", "/" + orig_color + "/");
			}
			else
			{
				new_src = curr_src.replace ("/" + orig_color + "/", "/re/");
			}
			
			allObjects[i].src = new_src;
		}
	}
}

<!-- ************************************************** -->

function ShowFooterLinks (pageid)
{
	if (pageid!='index')
	{
		document.write ('<span class="footer_link"><a href="index.html" onmouseout="HilightSmallFont (this, \'wh\', \'home\')" onmouseover="HilightSmallFont (this, \'wh\', \'home\')"><script language="javascript">WriteSmallFont ("wh", "startseite", "home")</script></a></span>');
	}
	document.write ('<span class="footer_link"><a href="#" onclick="OpenRecommendPopup();" onmouseout="HilightSmallFont (this, \'wh\', \'friend\')" onmouseover="HilightSmallFont (this, \'wh\', \'friend\')"><script language="javascript">WriteSmallFont ("wh", "recommend to a friend", "friend")</script></a></span>');
	if (ie)
	{
		document.write ('<span class="footer_link"><a href="javascript:window.external.AddFavorite (window.location.href, \'jolegat\')" onmouseout="HilightSmallFont (this, \'wh\', \'favourites\')" onmouseover="HilightSmallFont (this, \'wh\', \'favourites\')">');
		WriteSmallFont ("wh", "add to favourites", "favourites");
		document.write ('</a></span>');
	}
	if (pageid!='sitemap')
	{
		document.write ('<span class="footer_link"><a href="sitemap.html" onmouseout="HilightSmallFont (this, \'wh\', \'sitemap\')" onmouseover="HilightSmallFont (this, \'wh\', \'sitemap\')"><script language="javascript">WriteSmallFont ("wh", "sitemap", "sitemap")</script></a></span>');
	}
	else
	{
		document.write ('<span class="footer_link"><script language="javascript">WriteSmallFont ("re", "sitemap", "sitemap")</script></span>');
	}
}

<!-- ************************************************** -->

var scaling = 0;
var scaling_factor = 2;
var min_scale = -1;
var max_scale = 2;

function ScaleFontSize (object_name, scale_factor)
{
	var obj = FIND (object_name);
	if (obj)
	{
		scaling += scale_factor;
		scaling = Math.min (Math.max (scaling, min_scale), max_scale);
		SkaleFontSizeObjects (obj, scaling);
		var fontsize = FIND ('font_size');
		if (fontsize) 
			fontsize.style.fontSize = 10 + scaling;
	}
}

<!-- ************************************************** -->

function SkaleFontSizeObjects (obj, scaling)
{
	SkaleFontSizeObjectsTyped (obj, "h1", 20, scaling);
	SkaleFontSizeObjectsTyped (obj, "h2", 14, scaling);
	SkaleFontSizeObjectsTyped (obj, "h3", 13, scaling);
	SkaleFontSizeObjectsTyped (obj, "p", 11, scaling);
	SkaleFontSizeObjectsTyped (obj, "small", 9, scaling);
	SkaleFontSizeObjectsTyped (obj, "td", 11, scaling);
	SkaleFontSizeObjectsTyped (obj, "a", 11, scaling);
	SkaleFontSizeObjectsTyped (obj, "span", 11, scaling);
}

<!-- ************************************************** -->

function SkaleFontSizeObjectsTyped (root_object, object_name, default_size, scaling)
{
	var objects = root_object.getElementsByTagName (object_name);
	if (objects)
	{
		var count_objects = objects.length;
		var i;
		for (i = 0; i != count_objects; i++)
		{
			objects[i].style.fontSize = default_size + scaling_factor * scaling;
			SkaleFontSizeObjects (objects[i], scaling);
		}
	}
}

<!-- ************************************************** -->

document.onmousemove = GetPos;
var mouse_posx = 0;
var mouse_posy = 0;
var menu_preview = "";

function GetPos (event)
{
	if (ie)
	{
		if (document.body)
		{
			mouse_posx = window.event.clientX + document.body.scrollLeft;
			mouse_posy = window.event.clientY + document.body.scrollTop;
		}
	}
	else
	{
		mouse_posx = event.pageX;
		mouse_posy = event.pageY;
	}
}

function BubbleInfo (info_text, bubble_obj_name, bubble_flag)
{
	var bubble_obj = FIND (bubble_obj_name);
	var text_bubble_obj = FIND ("text_"+ bubble_obj_name);
	
	if (bubble_obj && text_bubble_obj)
	{
		if (bubble_obj_name == "glossary_bubble")
		{
			ShowDivDependend ("info_glossary_bubble", bubble_flag);
		}
	
		if (info_text != bubble_obj)
		{
			if (ie) 	text_bubble_obj.innerText = info_text; 
			else 		text_bubble_obj.firstChild.nodeValue = info_text; 
		}
		
		if (info_text == "")
		{
			HideDiv (bubble_obj_name);
		}
		else
		{
			bubble_obj.style.top = mouse_posy + 12;
			bubble_obj.style.left = mouse_posx + 12;
			ShowDiv (bubble_obj_name);
		}
	}
	
	menu_preview = info_text;
}

function BubbleInfoOff()
{
	HideDiv ("menu_preview");
	HideDiv ("glossary_bubble");
}

<!-- ************************************************** -->

function OpenWindow (win_href, win_title, win_width, win_height, win_center, with_scrollbars, win_resizable, with_bar)
{

	if (win_height > screen.availHeight - 50)
		win_height = screen.availHeight - 50;

	win_width = win_width - 0;
	if (with_scrollbars == 'true')
	{
		win_width += 20;
	}
	
	var win_flags = "width=" + win_width + ",height=" + win_height;
	win_flags += ",resizable=yes,dependent=yes";
	
	if (with_scrollbars == 'true')
	{
		win_flags += ",scrollbars=yes";
	}
	
	if (win_center)
	{
		var win_left = Math.ceil ((screen.availWidth - win_width) / 2);
		var win_top  = Math.ceil ((screen.availHeight - win_height) / 3);
		win_flags	+= ",left=" + win_left + ",top=" + win_top;
	}
	
	win_flags += ",resizable=" + ((win_resizable == "true") ? "yes" : "no");
	win_flags += ",location=" + ((with_bar == "true") ? "yes" : "no");
	win_flags += ",menubar=" + ((with_bar == "true") ? "yes" : "no");
	win_flags += ",toolbar=" + ((with_bar == "true") ? "yes" : "no");

	window.open (win_href, win_title, win_flags);
}

<!-- ************************************************** -->

function GetQueryValue (query_name)
{
	var result = "";
	var url_str = document.location.href;
	var query_pos = url_str.indexOf ("?") + 1;
	if (query_pos >= 0)
	{
		var query_str = url_str.substr (query_pos);
		
		if (query_name != "")
		{
			var query_collection = query_str.split ("&");
			var single_query_str;
			var single_query;
			var query_val;
			var found = false;
			
			for (var i = 0; i < query_collection.length && !found; i++)
			{
				single_query= query_collection [i].split ("=");
				if (single_query[0] == query_name)
				{
					query_val = single_query[1] + "";
					if (query_val != "undefined")
					{
						result = query_val;
					}
					found = true;
				}
			}
		}
		else
		{
			result = query_str;
		}
		return unescape (result);
	}
}

<!-- ************************************************** -->

function GetQueryValueBool (query_name)
{
	var result = false;
	var result_str = GetQueryValue (query_name).toLowerCase();
	if (result_str == "true" || result_str == "1") result = true;
	return result;
}

<!-- ************************************************** -->

function SetText (node_id, text)
{
	var elem = FIND (node_id);
	if (elem)
		elem.firstChild.nodeValue = text;
}

<!-- ************************************************** -->

function GetText (node_id)
{
	var elem = FIND (node_id);
	if (elem)
		return elem.firstChild.nodeValue + "";
}

<!-- ************************************************** -->

var cartoon_image_nr = GetQueryValue ("image_nr");
var cartoon_thumbnail_view = GetQueryValue ("thumbs");
var cartoon_series_id = GetQueryValue ("series_id");
var cartoon_lang_id = GetQueryValue ("lang_id");

function CartoonGalleryGo()
{
	window.location.href =
		window.location.href.substring(0, window.location.href.indexOf("?")) + "?"
		+ "image_nr=" + cartoon_image_nr 
		+ "&thumbs=" + cartoon_thumbnail_view
		+ "&series_id=" + cartoon_series_id
		+ "&lang_id=" + cartoon_lang_id
		;
}

<!-- ************************************************** -->

function CartoonGo (img_nr)
{
	cartoon_image_nr = img_nr; 
	CartoonGalleryGo();
}

<!-- ************************************************** -->

function CartoonGoImage (img_nr)
{
	cartoon_image_nr = img_nr; 
	cartoon_thumbnail_view = 'false';
	CartoonGalleryGo();
}

<!-- ************************************************** -->

function CartoonGoThumbs()
{
	cartoon_image_nr = 0;
	cartoon_thumbnail_view = 'true';
	CartoonGalleryGo();
}

<!-- ************************************************** -->

function CartoonGoSeries (series_id)
{
	cartoon_series_id = series_id;
	cartoon_image_nr = 0;
	cartoon_thumbnail_view = 'true';
	CartoonGalleryGo();
}

<!-- ************************************************** -->

function CartoonSwitchLang (lang_id)
{
	cartoon_series_id = "";
	cartoon_image_nr = 0;
	cartoon_thumbnail_view = 'true';
	cartoon_lang_id = lang_id;
	CartoonGalleryGo();
}

<!-- ************************************************** -->

function ToggleSelect (select_id, img_id)
{
	ToggleDiv (select_id);
	var button_obj = FIND (select_id + "_img");
	if (button_obj)
	{
		if (button_obj.src.indexOf ("open_") != -1)
			button_obj.src = button_obj.src.replace ("open_", "close_");
		else
			button_obj.src = button_obj.src.replace ("close_", "open_");
	}
}

<!-- ************************************************** -->

function CloseSelect (select_id, img_id)
{
	HideDiv (select_id);
	var button_obj = FIND (select_id + "_img");
	if (button_obj)
	{
		button_obj.src = button_obj.src.replace ("close_", "open_");
	}
}

<!-- ************************************************** -->

function ShowCategoryIcons (info_object_name)
{
	var info_object = FIND (info_object_name);
	if (info_object)
	{
		var categories_string = info_object.className;
		WriteSmallFont ("wh", "  Kategorien       ", "");
		ShowCategoryIcon (info_object_name, categories_string, "ill", "cartoons + illustrationen", "illustrations.html");
		ShowCategoryIcon (info_object_name, categories_string, "ci", "corporate design", "ci.html");
		ShowCategoryIcon (info_object_name, categories_string, "wdes", "web design", "web_design.html");
		ShowCategoryIcon (info_object_name, categories_string, "wdev", "web development", "web_dev.html");
		ShowCategoryIcon (info_object_name, categories_string, "cms", "cms", "cms.html");
		ShowCategoryIcon (info_object_name, categories_string, "xml", "xml", "xml.html");
		ShowCategoryIcon (info_object_name, categories_string, "con", "consulting", "consulting.html");
	}
}

<!-- ************************************************** -->

function ShowCategoryIcon (info_object_name, all_categories, category, text, link_url)
{
	if (all_categories.indexOf ("-" + category) != -1)
	{
		document.write ('<a href="' + link_url + '" onmouseover="HilightSmallFont (this, \'bl\', \'' + info_object_name + '_' + category + '\')" onmouseout="HilightSmallFont (this, \'bl\', \'' + info_object_name + '_' + category + '\')">');
		WriteSmallFont ("bl", text + "    ", info_object_name + '_' + category);
		document.write ('</a>');
	}
}

<!-- ************************************************** -->

var ref_cats = new Array("ill", "ci", "wdes", "wdev", "cms", "xml", "con");
var ref_flags = new Array (ref_cats.length);

function InitReferences()
{
	var i;
	var ref_id = GetQueryValue ("ref_id");
	var ref_class = GetQueryValue ("ref_class");
	
	if (ref_id != "")
	{
		var obj = FIND (ref_id);
		if (obj)
		{
			ShowDiv (ref_id);
			SetText ("reference_statistics", "Bitte wählen Sie aus den oben angeführten Kategorien um weitere Referenzen einzusehen.");
		}
	}
	else if (ref_class != "")
	{
		var allObjects = FIND ('page_content').getElementsByTagName ('div');
		var count_references = 0;
		var i;
		
		for (i = 0; i < allObjects.length; i++)
		{
			ObjClass = allObjects[i].className + "";
			if (ObjClass.indexOf ("reference") != -1 && ObjClass.indexOf (ref_class) != -1) 
			{
				ShowDiv (allObjects[i].id);
				count_references++;
			}
		}
	
		if (count_references)
			SetText ("reference_statistics", "Gefundene Referenzen zu [" + ref_class + "]: " + count_references);
		else
			SetText ("reference_statistics", "Bitte wählen Sie aus den oben angeführten Kategorien.");
	}
	else
	{
		var active_references = false;
		for (i = 0; i < ref_cats.length; i++)
		{
			ref_flags[i] = GetQueryValueBool ("ref_cat_" + ref_cats[i]);
			if (ref_flags[i]) active_references = true;
			InitReferencesIcon (i);
		}
		
		if (active_references)	ShowReferences();
		
		else
		{
	// ???		ReferencesShowLatest (5);
		}
	}
}

<!-- ************************************************** -->

function GetCatIndex (cat_name)
{
	var result = -1;
	var i;
	for (i = 0; i < ref_cats.length && result < 0; i++)
	{
		if (ref_cats[i] == cat_name) result = i;
	}
	return i - 1;
}

<!-- ************************************************** -->

function InitReferencesIcon (i)
{
	var icon_obj = FIND ("icon_select_" + ref_cats[i]);
	if (icon_obj)
	{
		icon_obj.src = icon_obj.src.replace (ref_flags[i] ? "_off" : "_on", ref_flags[i] ? "_on" : "_off");
	}
}

<!-- ************************************************** -->

function ReferencesSetCategories (activate)
{
	var i;
	for (i = 0; i < ref_cats.length; i++)
	{
		ref_flags[i] = activate;
		InitReferencesIcon (i);
	}
	ShowReferences();
}

<!-- ************************************************** -->

function ReferencesShowCategory (cat_name)
{
	var cat_index = GetCatIndex (cat_name);
	ref_flags[cat_index] = !ref_flags[cat_index];
	InitReferencesIcon (cat_index);
	ShowReferences();
}

<!-- ************************************************** -->

function ReferencesShowLatest (max_count)
{
	var allObjects = FIND ('page_content').getElementsByTagName ('div');
	var ObjClass;
	var count_shown = 0;
	var i;
	for (i = 0; i < allObjects.length; i++)
	{
		ObjClass = allObjects[i].className + "";
		if (ObjClass.indexOf ("reference") != -1) 
		{
			if (count_shown < max_count)
			{
				ShowDiv (allObjects[i].id);
				count_shown++;
			}
			else
			{
				HideDiv (allObjects[i].id);
			}
		}
	}
	SetText ("reference_statistics", "Aktuellste " + count_shown + " Referenzen.");
}

<!-- ************************************************** -->

function ShowReferences()
{
	var allObjects = FIND ('page_content').getElementsByTagName ('div');
	var ObjClass;
	var count_references = 0;
	var activated;
	var i, j;
	for (i = 0; i < allObjects.length; i++)
	{
		ObjClass = allObjects[i].className + "";
		if (ObjClass.indexOf ("reference") != -1) 
		{
			HideDiv (allObjects[i].id);
		}
	}

	for (i = 0; i < allObjects.length; i++)
	{
		ObjClass = allObjects[i].className + "";
		activated = false;
		
		if (ObjClass.indexOf ("reference") != -1)	
		{
			for (j = 0; j < ref_cats.length && !activated; j++)
			{
				if (ref_flags[j])
				{		
					if (ObjClass.indexOf (ref_cats[j]) != -1)
					{
						ShowDiv (allObjects[i].id);
						count_references++;
						activated = true;
					}
				}
			}	
		}
	}
	
	if (count_references)
		SetText ("reference_statistics", "Gefundene Referenzen zu den gewählten Kategorien: " + count_references);
	else
		SetText ("reference_statistics", "Bitte wählen Sie aus den oben angeführten Kategorien.");
}

<!-- ************************************************** -->
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 word_link, show_word_link, marked_word;
	
			for (var glossary_word in glossary) 
			{
				var reg = new RegExp("(" + glossary_word + ")([^a-zA-Z])", "g");
				word_link = glossary_link [glossary_word] + "";
				show_word_link = true;
				
				if (word_link == "" || word_link == "undefined") 
				{
					word_link = "";
					show_word_link = false;
				}
				
				marked_content = marked_content.replace(reg, "---$2");
				var reg2 = new RegExp("---");
				
				while (reg2.test (marked_content)) 
				{
					marked_word = "";
					marked_word += "<a class='glossary_word' href='#' onclick='OpenWindow (\"" + word_link + "\",\"_blank\",750,550,true,\"true\",\"true\")' onmousemove='BubbleInfo (\"" + glossary [glossary_word] + "\", \"glossary_bubble\", " + show_word_link + ")' onmouseout='BubbleInfoOff()'>" + glossary_word + "<img src='images/framework/link_info.gif' /></a>";
					marked_content = marked_content.replace (reg2, marked_word);
					counter++;
				}
			}
			
			root_obj.innerHTML = marked_content;
		}
	}
}

<!-- ************************************************** -->
function OpenRecommendPopup()
{
	OpenWindow ('popup_recommend.asp', '_blank', 400, 300, true);
}

<!-- ************************************************** -->
function OpenContactPopup (topic)
{
	OpenWindow ('popup_contact.asp?topic=' + topic, '_blank', 400, 330, true);
}

<!-- ************************************************** -->

function EmailValidator (val_str)
{
	var result = true;

	if (val_str == "undefined")
	{
		result = false;
	}
	else if (!val_str || val_str == "")
	{
	}
	else
	{
		var at_pos = val_str.indexOf ("@");
		var at_dot = val_str.lastIndexOf (".");
	
		if (!CheckInvalidChars (val_str, " \t\\/#"))
			result = false;
		else
		{
			if (at_pos < 0 || at_dot < 0)
				result = false;
			else
			{
				var name_part = val_str.substring (0, at_pos);
				
				if (name_part == "" || !CheckInvalidChars (name_part, "@") || !CheckInvalidDel (name_part, ".")) 
					result = false;
				else 
				{
					var domain_part = val_str.substring (at_pos + 1, at_dot);
					
					if (name_part == "" || !CheckInvalidChars (domain_part, "@") || !CheckInvalidDel (domain_part, "."))
						result = false;
					else 
					{
						var country_part = val_str.substring (at_dot + 1);
						if (country_part == "" ||  !CheckInvalidChars (country_part, "@"))
							result = false;
					}
				}
			}
		}	
	}
	
	return result;	
}

<!-- ************************************************** -->

function CheckInvalidChars (container_str, inv_chars)
{
	var result = true;
	var count_chars = inv_chars.length;
	var i;
	
	for (i = 0; i < count_chars && result; i++)
	{
		if (container_str.indexOf (inv_chars.charAt (i)) >= 0)
		{
			result = false;
		}
	}
	
	return result;
}

<!-- ************************************************** -->

function CheckInvalidDel (container_str, delimiter_str)
{
	var result = true;
	
	var del_pos = container_str.indexOf (delimiter_str);
	if (!container_str.indexOf (delimiter_str)) result = false;
	else if (container_str.lastIndexOf (delimiter_str) == container_str.length - 1) result = false;
		
	return result;
}

<!-- ************************************************** -->

function CheckFormField (form_name, field_name, field_title, is_mandatory, field_validator){
	var result = true;

	var field_obj = eval ("document." + form_name + "." + field_name);
	if (field_obj)
	{
		var field_val = field_obj.value;
		var errmsg;
		if (is_mandatory && field_val == "")
		{
			result = false;
			errmsg = "Bitte befüllen Sie das Feld '" + field_title + "'!";
		}
		if (result && field_validator && field_validator != "")
		{
			switch (field_validator)
			{
				case "EMAIL":
				{
					var curr_email = field_val;
					do { curr_email = curr_email.replace(" ", ""); } while (curr_email.search (" ") != -1);
					
					if (!EmailValidator (curr_email))
					{
						result = false;
						errmsg = "Ungültige Eingabe in Feld '" + field_title + "'!";
					}
					break;
				}
				
				case "EMAILS":
				{
					var email_array = field_val.split (";");
					var count_emails = email_array.length;
					var curr_email;
					var i;
					for (i = 0; i < count_emails && result; i++)
					{
						curr_email = email_array[i];
						do { curr_email = curr_email.replace(" ", ""); } while (curr_email.search (" ") != -1);
						
						if (!EmailValidator (curr_email))
						{
							result = false;
							errmsg = "Ungültige Eingabe in Feld '" + field_title + "'!";
						}
					}
					break;
				}
			}
		}
		
		
		if (!result)
		{
			alert (errmsg);
			field_obj.focus();
		}
	}
	return result;
}

<!-- ************************************************** -->

function CenterPopupDiv (div_id, div_width, div_height)
{
	var divnode = FIND (div_id);
	if (divnode)
	{
		var win_height = GetWinInfo ("height");
		var win_width = GetWinInfo ("width");
		divnode.style.left = Math.floor ((win_width - div_width) / 2);
		divnode.style.top = Math.floor ((win_height - div_height) / 3);
	}
}

<!-- ************************************************** -->

function GetWinInfo (info_type)
{
	var result = 0;
	switch (info_type)
	{
		case "width": result = ie ? document.body.clientWidth : window.innerWidth; break;
		case "height": result = ie ? document.body.clientHeight : window.innerHeight; break;
	}
	return result;
}

//------------------------------------------------------------------------------------------------//

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;
}

<!-- ************************************************** -->

function ShowTimeNow (node_id)
{
	var timefield 	= FIND (node_id);
	if (timefield)
	{
		var timenow	 	= new Date();
		var strtime 	= OutputDate (timenow) + " | " 
							+ NumStr (timenow.getHours() + "", 2) + ":" 
							+ NumStr (timenow.getMinutes() + "", 2) + ":" 
							+ NumStr (timenow.getSeconds() + "", 2);
							
		switch (BROWSER)
		{
			case "ie": timefield.innerText = strtime; break;
			case "Opera":
			case "nn": timefield.firstChild.nodeValue = strtime; break;
		}
		
		window.setTimeout ("ShowTimeNow()",1000);
	}
}
