var server = window.location.hostname;
function getParameter ( queryString, parameterName )
{
// Add "=" to the parameter name (i.e. parameterName=value)
  var parameterName = parameterName + "=";
  if ( queryString.length > 0 )
  {
// Find the beginning of the string
    begin = queryString.indexOf ( parameterName );
// If the parameter name is not found, skip it, otherwise return the value
    if ( begin != -1 )
    {
// Add the length (integer) to the beginning
      begin += parameterName.length;
// Multiple parameters are separated by the "&" sign
      end = queryString.indexOf ( "&" , begin );
      if ( end == -1 )
      {
        end = queryString.length
      }
// Return the string
      return unescape ( queryString.substring ( begin, end ) );
    }
// Return "null" if no parameter has been found
    return "null";
  }
}
function changeHomepage(s)
{
	if(s != "")
	{
		switch(s)
		{
			case "de":
				top.location.replace("http://@ERROR/german/homepage!readform");
				break;
			case "en":
				top.location.replace("http://@ERROR/english/homepage!readform");
				break;
			case "es":
				top.location.replace("http://@ERROR/spanish/homepage!readform");
				break;
			case "fr":
				top.location.replace("http://@ERROR/french/homepage!readform");
				break;
			case "it":
				top.location.replace("http://@ERROR/italian/homepage!readform");
				break;
// Bei der Überschrift soll nichts ausgelöst werden!
			case "headline":
				break;
			default:
				var values = s.split(";");
				var url = getValueByTag("url", values);
				if(url)
				{
					var target=getValueByTag("target", values);
					if(target)
					{
						if(target == "_blank")
						{
							window.open("http:" + url, target);
							return;
						}
						else
						{
							var loc = getTargetFrame(target, top);
							if(loc)
							{
								loc.location.href="http:" + url;
								return;
							}
						}
					}
					top.location.href="http:" + url;
				}
				else
					top.location.href="http:" + s;
				break;	
		}
	}
}
function getValueByTag(tag, values)
{
	for (var index in values)
	{
		if(values[index].substr(0, tag.length + 1) == (tag + "="))
		{
			return(values[index].substr(tag.length + 1));
		}
	}
}
function getTargetFrame(name, loc)
{
	if(loc.name == name)
		return(loc);
	else
		for(var i=0;loc.frames[i];i++)
		{
			var l = getTargetFrame(name, loc.frames[i])
			if(l)
				return(l);
		}
}
function showSearchWindow(key, language)
{
	if(key == "" && top.searchWindow)
	{
		if(!top.searchWindow.closed)
		{
			top.searchWindow.focus();
			return;
		}
	}
	document.searchForm.action="http://" + server + "/main/searchresults!open&Query=" + key + "&Start=1&Count=10&scope=1&SearchMax=100&l=" + language;
	startX = window.screen.width - 450 - 10;
	startY = window.screen.height - 500 - 10;
	sw = window.open("http://" + server + "/main/BlankForm!open", "KistersSearchWindow", "resizable=yes,top=" + startY + ", left=" + startX + ",dependent=yes,scrollbars=yes, height=500,width=450");
	if(sw.outerHeight)
	{
		sw.outerHeight = 500;
		sw.outerWidth = 450;
	}
	else
		sw.resizeTo(450, 500);
	sw.moveTo(startX, startY);
	top.searchWindow = sw;
	sw.focus();
}
function showSub(id)
{
  hideAll();
  if(document.getElementById(id))
    document.getElementById(id).style.display = "block";
}
function hideAll()
{
  if(document.getElementById("010"))
    document.getElementById("010").style.display = "none";
  if(document.getElementById("020"))
    document.getElementById("020").style.display = "none";
  if(document.getElementById("025"))
    document.getElementById("025").style.display = "none";
  if(document.getElementById("030"))
    document.getElementById("030").style.display = "none";
  if(document.getElementById("040"))
    document.getElementById("040").style.display = "none";
  if(document.getElementById("050"))
    document.getElementById("050").style.display = "none";
  if(document.getElementById("060"))
    document.getElementById("060").style.display = "none";
  if(document.getElementById("070"))
    document.getElementById("070").style.display = "none";
}
