/*
if (document.layers){
    window.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
    window.onmousedown=rightclick;
    window.onmouseup=rightclick;

    function rightclick(e) {
    if (e.which == 3) {
    // Put right mouse code here
    alert('Hmmm, hier gibts nix zu sehen...');
    return false;
    }
    else {
        return true;
        }
    }
}
if (document.all){
    function click() {
    if (event.button==2) {
    alert('Hmmm, hier gibts nix zu sehen...')
    }

    if (event.button==3) {
    alert('Hmmm, hier gibts nix zu sehen...')}
    }
    document.onmousedown=click
}
*/

function FS_windowWidth() //v1.0 Frank Salm
{
 if (window.innerWidth)
   return window.innerWidth;
 else
   if (document.body && document.body.offsetWidth)
     return document.body.offsetWidth;
   else
     return 0;
}

function FS_windowHeight() //v1.0 Frank Salm
{
 if (window.innerHeight)
   return window.innerHeight;
 else
   if (document.body && document.body.offsetHeight)
     return document.body.offsetHeight;
   else
     return 0;
}

function fsCenter()
{
alert("W");
  var x = Math.floor( (FS_windowWidth() - 784) / 2);
//  var y = Math.floor( (FS_windowHeight() - 564) / 2);
  y = 10;
  if ( ! (x > 10) )
    x = 0;
  if ( ! (y > 10) )
    y = 0;

  Top = y;
  Left = x;

  FS_showHideLayersExt( 'mainlayer', '', 'show', 0, 0 );
}

function fsFindObj(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=MM_findObj(n,d.layers[i].document); return x;
}

function fsFind(name) {
  var obj;

  obj = document.getElementById(name);
  if (! obj) {
    obj = document.getElementsByName(name)[0];
  }
  if (! obj) {
  	obj = fsFindObj(name);
  }

  return obj;
}



function nn4()	{
  if (document.layers)
    location.reload();
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
   if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
     document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
   else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
 }
MM_reloadPage(true);

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v3.0
  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=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_showHideLayers()
{
  var i,p,v,obj,args = MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) {
    if ((obj=MM_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 FS_showHideLayersExt() //v1.0 Frank Salm
{
  var i,p,v,obj,args = FS_showHideLayersExt.arguments;
  for ( i = 0; i < (args.length-2); i += 5 ) {
    if ((obj=MM_findObj(args[i]))!=null) {
      v=args[i+2];
      if ( obj.style ) {
        obj = obj.style;
        v=(v=='show')?'visible':(v='hide')?'hidden':v;
      }
      obj.top  = args[i+3] + window.Top;
      obj.left = args[i+4] + window.Left;
      obj.visibility = v;
    }
  }
}

function fsSubmitForm( form, url ) //v1.0 Frank Salm
{
  var o = MM_findObj( form );
  o.action = url;
  o.method = "post";
  o.submit();
}


function fsSubmit( url ) //v1.0 Frank Salm
{
  var o = MM_findObj( 'mainform' );
  o.action = url;
  o.method = "post";
  o.submit();
}



function fsOpenPopUp( url, width, height ) {
  page = open ("","PopUp","toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width=" + width + ",height=" + height);
  page.location = url;
  page.focus();
}

function fsOpenPopUpStatic( url, width, height ) {
  page = open ("","PopUp","toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=" + width + ",height=" + height);
  page.location = url;
  page.focus();
}

// -------------------------------------------------------------------------------

function fsStrExists( ctrlname, cmp ) {
	var str = fsFind(ctrlname).value;
	var tmp = "";
	if ( str.length > 0 ) {
		var posA = 0;
		for ( var posB = 0; posB <= str.length; posB++ ) {
			if ( (str.substring( posB, posB+1 ) == "_") || (posB == str.length) ) {
				tmp = str.substring( posA, posB );
				posA = posB+1;
				if ( cmp == tmp ) {
					return true;
				}
			}
		}
	}
	return false;
}

function fsStrAdd( ctrlname, cmp ) {
	var str = fsFind(ctrlname).value;
	var tmp = "";
	if ( str.length > 0 ) {
		var posA = 0;
		for ( var posB = 0; posB <= str.length; posB++ ) {
			if ( (str.substring( posB, posB+1 ) == "_") || (posB == str.length) ) {
				tmp = str.substring( posA, posB );
				posA = posB+1;
				if ( cmp == tmp ) {
					return;
				}
			}
		}

	}

	if ( str.length > 0 ) {
		str += "_";
	}
	str += cmp;
	fsFind(ctrlname).value = str;
}

function fsStrDel( ctrlname, cmp ) {
	var str = fsFind(ctrlname).value;
	var tmp = "";
	var neu = "";
	if ( str.length > 0 ) {
		var posA = 0;
		for ( var posB = 0; posB <= str.length; posB++ ) {
			if ( (str.substring( posB, posB+1 ) == "_") || (posB == str.length) ) {
			tmp = str.substring( posA, posB );
			posA = posB+1;
			if ( cmp != tmp ) {
				if ( neu.length > 0 ) {
					neu += "_";
				}
					neu += tmp;
				}
			}
		}
	}
	fsFind(ctrlname).value = neu;
}


  function fsTblGetSingleSelection( ctrlname ) {
	var str = fsFind(ctrlname).value;
	var rslt = "";
    var tmp = "";
    if ( str.length > 0 ) {
      var posA = 0;
      for ( var posB = 0; posB <= str.length; posB++ ) {
        if ( (str.substring( posB, posB+1 ) == "_") || (posB == str.length) ) {
          tmp = str.substring( posA, posB );
          posA = posB+1;

		  if ( tmp.substring(0,1) == '#' ) {
		  	rslt = tmp.substring(1,tmp.length);
		  	break;
		  }
        }
      }
    }
    return rslt;
  }

  
  function fsTblSetSingleSelection( ctrlname, sel ) {
	var str = fsFind(ctrlname).value;
	var neu = "";
    var tmp = "";

  	neu += '#' + sel.toString();
    if ( str.length > 0 ) {
      var posA = 0;
      for ( var posB = 0; posB <= str.length; posB++ ) {
        if ( (str.substring( posB, posB+1 ) == "_") || (posB == str.length) ) {
          tmp = str.substring( posA, posB );
          posA = posB+1;

		  if ( tmp.substring(0,1) != '#' ) {
		  	neu = neu + "_" + tmp;
		  }
        }
      }
    }
	fsFind(ctrlname).value = neu;
  }


  function fsTblExtSelectChange ( ext, extfield ) {
  	if (ext) {
		fsFind(extfield).disabled= false;
	} else {
		fsFind(extfield).disabled= true;
		fsFind(extfield).value='';
	}
  }
  
  function fsTblExtTextChange ( event, action, actionparam ) {
  	//enter key means posting the request
	if ( getKeyCode(event) == 13 ) {
		fsAction(action, actionparam);
		if (window.event.returnValue) {
			window.event.returnValue = false;
		}
		return false;
	}
	return true;
  }
  

// -------------------------------------------------------------------------------

