// ***********************************************************************************
//  Copyright by NetCare - Computer & Netzwerk  www.NCPS.de
//  Die Nutzung ist ausschliesslich nur dann gestattet, wenn dieser Copyright-Vermerk
//  unverändert bleibt!
// ***********************************************************************************

window.onerror=ErrorHandler;
var bDebug=false;


function ErrorHandler()
{
  if (bDebug)  {alert("Fehler aufgetreten!!!!!!!!!!");}
  return true;
}


function trim(sStrX)
{
  if ((sStrX.length)==0) {return(sStrX);}
  while(sStrX.substring(0,1)==' ')  {sStrX = sStrX.substring(1,sStrX.length);}
  while(sStrX.substring(sStrX.length-1,sStrX.length)==' ')  {sStrX=sStrX.substring(0,sStrX.length-1);}
  return(sStrX);
}


function ExecFind(sHref, sParams)
{
  if (location.replace)
    {
    location.replace(sHref + sParams);
    }
  else
    {
    }
  return;
		//window.location.replace("http://www.ncps.de");
  //window.location.replace('/doSearch.htm'+p1);         //IE
		//location.replace("/index.htm");
		//window.document.location.replace("http://www.ncps.de");
		//window.location.href("http://www.ncps.de/index.htm");
  //z=window.open('http://www.ncps.de', 'UUUU', ' target="_self" ');   z.focus();
}

function CheckField2()
{
  var errNo=0;  var sValue="";  var doSearchEnable=true;
		if (doSearchEnable==false) {return false;}
  if (document.getElementsByName)
    {
    if (document.getElementsByName("FindText1"))
      {
      if (document.FindForm.elements[0])
        {
        if (document.FindForm.elements[0].value)
          {
          sValue=document.FindForm.elements[0].value;
          }
        else { errNo=4; }
        }
      else { errNo=3; }
      }
    else { errNo=2; }
    }
  else { errNo=1; }

  if (errNo==0)
    {
    sValue = trim(sValue);
    //alert('sValue: -' + sValue + '-');  return;
    if (sValue!="")  {ExecFind('/doSearch.htm', '?search=' + sValue);}
				else {document.FindForm.elements[0].value="";}
    }
  else
    { if (bDebug)  {alert("errNo: " + errNo);} }
		return;		// Ohne Wert!!
}


// <a href="pic_or.htm" onclick="return popup(this,222,333)" title="win">xy</a>
// ODER 
// <a href="pic_or.htm" onclick="return popup(this)" title="win">xy</a>
// <a href="/doSearch.htm" onclick="return popup(this,550,450)" title="Oeffnen im Popup ....">zzz</a>
// PopWin wird geschlossen, wenn das Hauptfenster wieder angeklickt wird!
var popwin = null; 

function popup(obj,breite,hoehe) 
{ 
  var url = (obj.getAttribute) ? obj.getAttribute('href') : obj.href; 
		if (!url) return true; 
		breite = (breite) ? breite += 20 : 400; 
		hoehe = (hoehe) ? hoehe += 25 : 300; 
		// var params = 'width='+breite+',height='+hoehe;   ODER   var params = 'width='+breite+',height='+hoehe+',resizable,scrollbars';
		var params = 'width='+breite+',height='+hoehe+',resizable,scrollbars'; 
		popdown(); popwin = window.open(url,'',params); return (popwin) ? false : true; 
} 

function popdown() 
{ if (popwin && !popwin.closed) popwin.close(); } 

window.onunload = popdown; 
window.onfocus = popdown; 

// EOF
