var LinkDivActive=0;
var onDiv;
var timeOnDiv;
var layerRef;
var styleRef;
var showVar;
var hideVar;
var ua=navigator.userAgent.toLowerCase();
var dom=(document.getElementById) ? 1 : 0;
var nn4=(document.layers) ? 1 : 0;
var ie=(((ua.indexOf('msie')!=-1) && (ua.indexOf('opera')==-1))) ? 1 : 0;
var opera=(ua.indexOf('opera')!=-1) ? 1 : 0;
var pos=new Array();
var XMenuOffset=0;
var YMenuOffset=10;
var divId = 'intMnu';

var w_handle = null;
	
layerRef="document.getElementById(divId)";
styleRef=".style";
showVar="'block'";
hideVar="'none'";
var imgPath = '';
  
function hideDiv(divId) 
{
  if(opera)
    document.getElementById('intMnu').style.display = 'none !important';
  else
    document.getElementById('intMnu').style.display = 'none';
}

function showDiv(divId) 
{
  if(opera)
	  document.getElementById('intMnu').style.display = 'block !important';
  else
    document.getElementById('intMnu').style.display = 'block';   
}

function showEx(divId)
{
	if (eval(layerRef)) 
  {
		if (timeOnDiv != null) 
    {
			clearTimeout(timeOnDiv);
		}
		showDiv(divId);
		onDiv=divId;
	}
}

function show(divId)
{
	if (eval(layerRef)) 
  {
		if (timeOnDiv != null) 
    {
			clearTimeout(timeOnDiv);
		}
		showDiv(divId);
		onDiv=divId;
	}
}

function timer() 
{
	timeOnDiv=setTimeout("divOut()",1000)
}

function divOut() 
{
	if (LinkDivActive==0) {
		hideDiv(onDiv);
	}
}

function over()
{
	LinkDivActive=1;
	clearTimeout(timeOnDiv);
}

function out() 
{
	LinkDivActive=0;
	timeOnDiv=setTimeout("divOut()",800)
}


  function setMenuObserver()
  {
    menu = document.getElementById('nav');
    items = menu.getElementsByTagName('li');
    for(i=0;i<items.length;i++)
    {
      if(-1 != items[i].className.indexOf('nobg'))
      { 
        items[i].onmouseover = itemOver;
        items[i].onmouseout = itemOut;
      }
    }
  }
  
  function itemOver()
  {
    if(-1 == this.getElementsByTagName('IMG')[0].src.indexOf('_active')) 
    {
      childImg = this.getElementsByTagName('IMG')[0];
      childImg.src = imgPath + childImg.name + '_over.gif';
      //window.alert(childImg.src); 
    }
  }
  
  function itemOut()
  {
    if(-1 == this.getElementsByTagName('IMG')[0].src.indexOf('_active'))
    {  
      childImg = this.getElementsByTagName('IMG')[0];
      childImg.src = imgPath + childImg.name + '.gif';
    }
  }
  
  
function setTopLinks()
{ 
 var startPos = document.getElementById('main_menu').scrollHeight + 100;
 var iterations = Math.round( (document.getElementById('content').scrollHeight - (document.getElementById('main_menu').scrollHeight + 100))/400) 
 var topVal = 0;
 
 for(var i=0; i<iterations; i++)
 {
   topVal = startPos + i*400;
   document.getElementById('content').innerHTML += '<div class="topLnk" style="top:' + topVal + 'px"><a href="#top">top</a></div>';
 }
}

  


function showPopup(url, sizeX, sizeY)
{
  window.open(url,'popup','left=40,top=40,width=' + sizeX + ', height=' + sizeY); 
  return false;
}

function showPopup(pub_uri, baseURL, sizeX, sizeY, popupType, uri_300, uri_72, kb_300, kb_72, label_300, label_72, imgText, imgTitle)
{
	var popupURL;
	var windowsizeX;
	var windowsizeY;
	var scrollbarsTxt;

	
	
	//normally we don't need scrollbars
	scrollbarsTxt = "";
	
	//build the url for the popup window, with GET parameters
	popupURL = baseURL + "?sizex=" + sizeX + "&sizey=" + sizeY
	popupURL = popupURL + "&type=" + popupType + "&pubURI=" + pub_uri
	popupURL = popupURL + "&uri300=" + uri_300 + "&uri72=" + uri_72
	popupURL = popupURL + "&kb300=" + kb_300 + "&kb72=" + kb_72
	popupURL = popupURL + "&label300=" + label_300 + "&label72=" + label_72
	popupURL = popupURL + "&imgTitle=" + imgTitle + "&imgText=" + imgText
	//now encode it
	popupURL = encodeURI(popupURL);
	 
	//get the right size for the window
	//fixed width
	windowsizeX = 560;
	//variable height
	windowsizeY = sizeY + 270;
	if (windowsizeX > 800) {
		windowsizeX = 800;
		scrollbarsTxt = ",scrollbars=yes";
	}
	if (windowsizeY > 650) {
		windowsizeY = 650;
		scrollbarsTxt = ",scrollbars=yes";
	}
	
	//check if we already have a popup window
	if (w_handle) {
		w_handle.close();
	}
	w_handle = window.open(popupURL,'Netviewer','left=40,top=40,width=' + windowsizeX + ', height=' + windowsizeY + scrollbarsTxt); 
	w_handle.focus();

  return false
}


function showhide(theId, moreId) {
	var el = document.getElementById(theId);
	var link = document.getElementById(moreId);
	var letplus = '<img src="/shared/img/icons/ar2.gif" width="16" height="16" alt="" />';
	var letmin = '<img src="/shared/img/icons/ar3.gif" width="16" height="16" alt="" />';

	if (el.style.display=="none") {
		el.style.display="";
		link.innerHTML = letmin;
    document.getElementById('erweiterte').className = 'erweiterteOn';		
	}

	else {
		el.style.display="none";
		link.innerHTML = letplus;
    document.getElementById('erweiterte').className = '';
   }

	return false;
}
