function helpon() {
	var winw = (screen.width - 250);
	var winh = (screen.height - 30);
	var winh2 = (screen.height - 80);
	var helpurl = "/wim-help/index.htm";
	parent.window.resizeTo(winw,winh);
	parent.window.moveTo(250,0);
	HelpWindow = window.open(helpurl,'help',' toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=yes,copyhistory=no,width=240,height='+winh2+',top=0,left=0');
	HelpWindow.focus();
}

function helpoff() {
	var winw = screen.width;
	var winh = screen.height;
	parent.window.resizeTo(winw,winh);
	parent.window.moveTo(0,0);
}

function layerWrite(id,nestref,text) {

	ns4 = (document.layers)? true:false
	ns6 = (!document.all && document.getElementById) ? true : false;
	ie4 = (document.all)? true:false

	if (ns4) {
		var lyr = (nestref)? eval('document.'+nestref+'.document.'+id+'.document') : document.layers[id].document
		lyr.open()
		lyr.write(text)
		lyr.close()
	}
	else if (ie4) document.all[id].innerHTML = text
	else if (ns6||ie5) {
			elm = document.getElementById(id);
		  	elm.innerHTML = text
		}
}

// Show/Hide functions for non-pointer layer/objects
function show(id) {

	ns4 = (document.layers)? true:false
	ns6 = (!document.all && document.getElementById) ? true : false;
	ie4 = (document.all)? true:false
	ie5 = (document.all && document.getElementById) ? true : false;

        if ((ns4) && (document.layers[id])) document.layers[id].visibility = "show"
        else if (ie4) document.all[id].style.visibility = "visible"
		else if (ns6||ie5) {
				elm = document.getElementById(id);
			  	elm.style.visibility = "visible";
		}

}

function hide(id) {

	ns4 = (document.layers)? true:false
	ns6 = (!document.all && document.getElementById) ? true : false;
	ie4 = (document.all)? true:false
	ie5 = (document.all && document.getElementById) ? true : false;

        if ((ns4) && (document.layers[id])) document.layers[id].visibility = "hide"
        else if (ie4) document.all[id].style.visibility = "hidden"
		else if (ns6||ie5) {
				elm = document.getElementById(id);
			  	elm.style.visibility = "hidden";
		}
}

//Zufallszahl
function randInt(min,max)
{
        var div = (max - min) + 1
        var randNum = Math.random()
        for (var i = 0; i <= div - 1; i++)
        {
                if (randNum >= i / div && randNum < (i+1) / div)
                        {return i + min}
        }
}

//Linking table cell
function mClick(cell) {
    if(event.srcElement.tagName=='TD') {
      cell.children.tags('A')[0].click();
    }
}



//Style
function getstyle(obj,att) {
  if (document.all)
  x = document.all[obj].style.getAttribute(att,"false");
  else x=document.getElementById(obj).style.fontSize;
  return x;
}

function setstyle(obj,att,val) {
 if (document.all)
  document.all[obj].style.setAttribute(att,val,"false");
 else document.getElementById(obj).style[att] = val;
}

function popupwindow(url, w, h)  { 
  var winl = (screen.width - w) / 2;
  var wint = (screen.height - h) / 2;
  newWindow = window.open(url,'zoom'+w+h,' toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=yes,copyhistory=no,width='+w+',height='+h+',top='+wint+',left='+winl);
  if (parseInt(navigator.appVersion) >= 4) { newWindow.window.focus(); }
}

function popupwindow2(url, w, h)  { 
  var winl = (screen.width - w) / 2;
  var wint = (screen.height - h) / 2;
  newWindow = window.open(url,'zoom'+w+h,' toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width='+w+',height='+h+',top='+wint+',left='+winl);
  if (parseInt(navigator.appVersion) >= 4) { newWindow.window.focus(); }
}

function zoom1(url, w, h) 
 {
  var winl = (screen.width - w) / 2;
  var wint = (screen.height - h) / 2;
  newWindow = window.open(url,'zoom'+w+h,' fullscreen=yes,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no,copyhistory=no');	
  newWindow.resizeTo(h+20,w+20);
  newWindow.moveTo(winl,wint);

  if (parseInt(navigator.appVersion) >= 4) { newWindow.window.focus(); }
}

function zoom(urlPop, windowW, windowH) 
 {
// Amazing Frameless Popup Window - Version I
// (C) 2000 www.CodeLifter.com
// Free for all users, but leave in this  header

windowW = windowW;
windowH = windowH+20;

// set the screen position where the popup should appear
var windowX = (screen.width - windowW) / 2; // from left
var windowY = (screen.height - windowH) / 2; // from top

// set the title of the page
var title =  "GLOBAL 2000"

// set this to true if the popup should close
// upon leaving the launching page; else, false
var autoclose = true

// ============================
// do not edit below this line
// ============================
s = "width="+windowW+",height="+windowH;
var beIE = document.all?true:false

  if (beIE){
    NFW = window.open("","popFrameless","fullscreen,"+s)     
    NFW.blur()
    window.focus()       
    NFW.resizeTo(windowW,windowH)
    NFW.moveTo(windowX,windowY)
    var frameString=""+
"<html>"+
"<head>"+
"<title>"+title+"</title>"+
"</head>"+
"<frameset rows='*,20' framespacing=2 border=0 frameborder=0 style='border:2px solid #5EC431;'>"+
"<frame name='top' src='"+urlPop+"' scrolling=no >"+
"<frame name='bottom' src='/nav/close_window.htm' scrolling='no'>"+
"</frameset>"+
"</html>"
    NFW.document.open();
    NFW.document.write(frameString)
    NFW.document.close()
  } else {
    NFW=window.open(urlPop,"popFrameless","scrollbars,"+s)
    NFW.blur()
    window.focus() 
    NFW.resizeTo(windowW,windowH)
    NFW.moveTo(windowX,windowY)
  }   
  NFW.focus()   
  if (autoclose){
    window.onunload = function(){NFW.close()}
  }
}




//  Cookie Functions -- "Night of the Living Cookie" Version (25-Jul-96)

// "Internal" function to return the decoded value of a cookie
function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}

//  Function to correct for 2.x Mac date bug.  Call this function to
//  fix a date object prior to passing it to SetCookie.
function FixCookieDate (date) {
  var base = new Date(0);
  var skew = base.getTime(); // dawn of (Unix) time - should be 0
  if (skew > 0)  // Except on the Mac - ahead of its time
    date.setTime (date.getTime() - skew);
}

//  Function to return the value of the cookie specified by "name".
function GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break; 
  }
  return null;
}

//  Function to create or update a cookie.
function SetCookie (name,value,expires,path,domain,secure) {
  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

//  Function to delete a cookie. (Sets expiration date to start of epoch)
function DeleteCookie (name,path,domain) {
  if (GetCookie(name)) {
    document.cookie = name + "=" +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

