///-------------------------------------------------------------------------------------------------
///                                                                                                -
///-------------------------------------------------------------------------------------------------

var arImages=new Array();

///-------------------------------------------------------------------------------------------------
/// OnLoad                                                                                         -
///-------------------------------------------------------------------------------------------------

function OnLoad()
{
   var ifo = document.getElementById("initialfocus");
   if (ifo && ifo.value)
   {
      var e = document.getElementById(ifo.value);
      if (e)
      {
         e.focus();
      }
   }
   if (typeof(AfterOnLoad)=='function')
   {
      AfterOnLoad();
   };
}

///-------------------------------------------------------------------------------------------------
/// Preload                                                                                        -
///-------------------------------------------------------------------------------------------------

function Preload()
{
   var temp = Preload.arguments; 
   for (x=0; x < temp.length; x++)
   {
      arImages[x]=new Image();
      arImages[x].src=Preload.arguments[x];
   }
}

///-------------------------------------------------------------------------------------------------
///                                                                                                -
///-------------------------------------------------------------------------------------------------


                             //////////////////////////////////////////
                             //////////////////////////////////////////
                             //////////////////////////////////////////


///-------------------------------------------------------------------------------------------------
/// OnNavBar                                                                                       -
///-------------------------------------------------------------------------------------------------

function OnNavBar(dnm, inm, cls, img)
{
   var d = document.getElementById(dnm);
   var i = document.getElementById(inm);
   if (d && i)
   {
      d.className = cls;
      i.src = img;
   }
}

///-------------------------------------------------------------------------------------------------
/// OnButton                                                                                       -
///-------------------------------------------------------------------------------------------------

function OnButton()
{
   var act = arguments[0];

   if (act == "PRINT")
   {
      print();
   }
   else
   {
      document.getElementById('ACTION').value = act;

      for (i=1; i<arguments.length; i+=2)
      {
         var name  = arguments[i];
         var value = arguments[i+1];

         document.getElementById(name).value      = value;
      }

      ExecSubmit();
   }
}

///-------------------------------------------------------------------------------------------------
/// OnHover                                                                                        -
///-------------------------------------------------------------------------------------------------

function OnHover(elem,mode,stdclass,hvrclass)
{
   if (stdclass=="" && hvrclass=="")
   {
      if (mode == 0)
      {
         elem.style.backgroundColor = (elem.style.prevBackgroundColor ? elem.style.prevBackgroundColor :'#FFFFFF');
      }
      else
      {
         elem.style.prevBackgroundColor   = elem.style.backgroundColor;
         elem.style.backgroundColor = "#FFCC80";
      }
   }
   else
   {
      elem.className = ((mode == 0) ? stdclass : hvrclass);
   }
}

///-------------------------------------------------------------------------------------------------
/// OnChangeCombobox                                                                               -
///-------------------------------------------------------------------------------------------------

function OnChangeCombobox(nm,act)
{
   document.getElementById('ACTION').value      = act;
   document.getElementById('ACTIONARG1').value  = nm;
   ExecSubmit();
}

///-------------------------------------------------------------------------------------------------
/// ExecSubmit                                                                                     -
///-------------------------------------------------------------------------------------------------

function ExecSubmit()
{
   document.getElementById('frm').submit();
}

///-------------------------------------------------------------------------------------------------
/// ExecRoadShow                                                                                   -
///-------------------------------------------------------------------------------------------------

function ExecRoadShow(termin)
{
   document.getElementById('termin').value = termin;
   document.getElementById('frm').submit();
}

///-------------------------------------------------------------------------------------------------
///                                                                                                -
///-------------------------------------------------------------------------------------------------


                             //////////////////////////////////////////
                             //////////////////////////////////////////
                             //////////////////////////////////////////


///-------------------------------------------------------------------------------------------------
/// OpenWindow                                                                                     -
///-------------------------------------------------------------------------------------------------

function OpenWindow(url, width, height)
{
   if (width==0 || height==0)
   {
      if (width  == 0) { width = screen.availWidth-30;   }
      if (height == 0) { height = screen.availHeight-90; }
      window.open(url,"","scrollbars=yes,menubar=no,height="+height+",width="+width+",top=5,left=5,resizable=yes,toolbar=no,location=no,status=yes");
   }
   else
   {
      window.open(url,"","scrollbars=yes,menubar=no,height="+height+",width="+width+",resizable=no,toolbar=no,location=no,status=yes");
   }

}

///-------------------------------------------------------------------------------------------------
/// PrintWindow                                                                                    -
///-------------------------------------------------------------------------------------------------

function PrintWindow()
{
   window.print();
}

///-------------------------------------------------------------------------------------------------
/// CloseWindow                                                                                    -
///-------------------------------------------------------------------------------------------------

function CloseWindow()
{
   window.close();
}

///-------------------------------------------------------------------------------------------------
/// SetImage                                                                                       -
///-------------------------------------------------------------------------------------------------

function SetImage(nm, img)
{
   var e = document.getElementById(nm);
   if (e)
   {
      e.src = img;
   }
}

///-------------------------------------------------------------------------------------------------
///                                                                                                -
///-------------------------------------------------------------------------------------------------


                             //////////////////////////////////////////
                             //////////////////////////////////////////
                             //////////////////////////////////////////


///-------------------------------------------------------------------------------------------------
/// GetCookie                                                                                      -
///-------------------------------------------------------------------------------------------------

function GetCookie(name)
{
   var start = document.cookie.indexOf(name+"=");
   var len = start+name.length+1;
   if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
   if (start == -1) return null;
   var end = document.cookie.indexOf(";",len);
   if (end == -1) end = document.cookie.length;
   return unescape(document.cookie.substring(len,end));
}

///-------------------------------------------------------------------------------------------------
/// SetCookie                                                                                      -
///-------------------------------------------------------------------------------------------------

function SetCookie(name,value,expires,path,domain,secure)
{
   expires = new Date(2099,11,31);
   var cookieString = name + "=" +escape(value) +
      ( (expires) ? ";expires=" + expires.toGMTString() : "") +
      ( (path) ? ";path=" + path : "") +
      ( (domain) ? ";domain=" + domain : "") +
      ( (secure) ? ";secure" : "");
   document.cookie = cookieString;
}

///-------------------------------------------------------------------------------------------------
/// DeleteCookie                                                                                   -
///-------------------------------------------------------------------------------------------------

function DeleteCookie(name,path,domain)
{
   if (Get_Cookie(name)) document.cookie = name + "=" +
      ( (path) ? ";path=" + path : "") +
      ( (domain) ? ";domain=" + domain : "") +
      ";expires=Thu, 01-Jan-70 00:00:01 GMT";
} 

///-------------------------------------------------------------------------------------------------
///                                                                                                -
///-------------------------------------------------------------------------------------------------


                             //////////////////////////////////////////
                             //////////////////////////////////////////
                             //////////////////////////////////////////


///-------------------------------------------------------------------------------------------------
/// Clear                                                                                          -
///-------------------------------------------------------------------------------------------------

function Clear(nm)
{
   var e = window.document.getElementById(nm);
   if (!e)
   {
      return;
   }
   e.value = "";
}

///-------------------------------------------------------------------------------------------------
/// Check                                                                                          -
///-------------------------------------------------------------------------------------------------

function Check(ctr,tp,nm,txt)
{
   var e = window.document.getElementById(nm);
   if (e)
   {
      if (tp == "TB")
      {
         if (e.value == "")
         {
            if (ctr == "UK")
            {
               alert("The field '" + txt + "' may not be empty.");
            }
            else
            {
               alert("Das Feld '" + txt + "' darf nicht leer sein.");
            }
            e.focus();
            return 0;
         }
      }
      else
      {
         if (e.selectedIndex <= 0)
         {
            if (ctr == "UK")
            {
               alert("Please select a value in field '" + txt + "'.");
            }
            else
            {
               alert("Bitte selektieren Sie einen Wert im Feld '" + txt + "'.");
            }
            e.focus();
            return 0;
         }
      }
   }
   return 1;
}

///-------------------------------------------------------------------------------------------------
/// Set                                                                                            -
///-------------------------------------------------------------------------------------------------

function Set(nm)
{
   var e = window.document.getElementById(nm);
   if (!e)
   {
      return;
   }
   e.checked = "checked";
}

///-------------------------------------------------------------------------------------------------
/// Reset                                                                                          -
///-------------------------------------------------------------------------------------------------

function Reset(nm)
{
   var e = window.document.getElementById(nm);
   if (!e)
   {
      return;
   }
   e.checked = "";
}

///-------------------------------------------------------------------------------------------------
/// EOF                                                                                            -
///-------------------------------------------------------------------------------------------------

