//==================================================
//   App Rollover Stuff
//==================================================

//--------------------------------------------------
function MouseIn(strID) {
//--------------------------------------------------


  if ( ! document.getElementById(strID) )
    return;

  doc=document.getElementById(strID)

  if (strClicked != strID) {
    doc.style.color=l_strColAppMouseIn;
    doc.style.textDecoration="underline";
  }
  return;
}

//--------------------------------------------------
function clicked(strID) {
//--------------------------------------------------
  if ( ! document.getElementById(strID) )
    return;

  doc=document.getElementById(strID)
  docClicked=document.getElementById(strClicked)

  if(strClicked != "" && eval(doc) != null)
    doc.style.color=l_strColAppMouseOut;
  if (eval(doc) == null)
    return;

  strClicked = strID;
  doc.style.color= l_strColAppClicked;
  doc.style.textDecoration="none";
  return;
}

//--------------------------------------------------
function MouseOut(strID) {
//--------------------------------------------------
  if ( ! document.getElementById(strID) )
    return;

  doc=document.getElementById(strID)

  if (strClicked != strID) {
    doc.style.color=l_strColAppMouseOut;
    doc.style.textDecoration="none";
  }
  return;
}

//--------------------------------------------------
function SetNavBar(p_lFormId) {
//--------------------------------------------------
  if(p_lFormId == null)
    return;
  if(!parent.UpAppNav)
    return;
  if(parent.UpAppNav.l_DocLoaded != 1)
    return;
  l_strId = 'Navigate' + p_lFormId;
  if (parent.UpAppNav) {
    parent.UpAppNav.clicked(l_strId);
  }
  return;
}

//--------------------------------------------------
function SetNavBarByName(p_strDivName) {
//--------------------------------------------------
  if(!IE4 && !W3C)
      return;
  l_strPlatform = navigator.platform
  if(l_strPlatform.indexOf("Mac") > -1)
    return;
  if(p_strDivName == null)
    return;
  if(!parent.UpAppNav)
    return;
  if(parent.UpAppNav.l_DocLoaded != 1)
    return;
  parent.UpAppNav.clicked(p_strDivName)
  return;
}

//--------------------------------------------------
function THMouseIn(strID) {
//--------------------------------------------------
  if ( ! document.getElementById(strID) )
    return;

  doc=document.getElementById(strID);

  if (strTHClicked != strID ) {
    doc.style.color= l_strTHMouseIn;
    doc.style.textDecoration="none";
  }
  return;
}

//--------------------------------------------------
function THclicked(strID) {
//--------------------------------------------------
  if ( ! document.getElementById(strID) )
    return;

  doc=document.getElementById(strID);

  if( strTHClicked != "" ) {
    doc.style.color= l_strTHMouseOut;
    doc.style.textDecoration="none";
  }

  doc.style.color= l_strTHMouseClicked;
  doc.style.textDecoration="none";
  return;
}

//--------------------------------------------------
function THMouseOut(strID) {
//--------------------------------------------------
  if ( ! document.getElementById(strID) )
    return;

  doc=document.getElementById(strID);

  if (strTHClicked != strID ) {
    doc.style.color= l_strTHMouseOut;
    doc.style.textDecoration="none";
  }
  return;
}

//--------------------------------------------------
function SetTemplateTop(strApp,strLoc) {
//--------------------------------------------------
  if (parent.UpAppTop) {
    parent.UpAppTop.document.getElementById('TopLocation').innerHTML = strLoc;
    parent.UpAppTop.document.getElementById('TopAppName').innerHTML = strApp;
  }
  return;
}

//--------------------------------------------------
function SetAppTop(strApp, strLoc) {
//--------------------------------------------------
  if (parent.UpAppTop) {
    parent.UpAppTop.document.getElementById('TopLocation').innerHTML = strLoc;
    parent.UpAppTop.document.getElementById('TopAppName').innerHTML = strApp;
  }
  return;
}

//--------------------------------------------------
function ElementFocus() {
//--------------------------------------------------
  for(i=0;i<document.forms[0].length;i++) {
    if (document.forms[0].elements[i].type!=null) { // <= das verhindert Probleme mit fieldset
      ele_type         = document.forms[0].elements[i].type;
      ele_style        = document.forms[0].elements[i].style.display;  // <= das verhindert Probleme mit ausgeblendeten Layern
      ele_displayStyle = document.forms[0].elements[i].getAttribute("displayStyle");
      ele_focus = window.document.forms[0].elements[i].getAttribute("UPFocusStyle");
      if (ele_focus!=null && ele_focus==0)
        break;
      if(ele_displayStyle != "hidden" && ele_style != "none" && ele_type != "select-one" && ele_type != "hidden" && ele_type != "submit" && ele_type != "button" && ele_type != "reset" && document.forms[0].elements[i].name.substr(0,6) != "SetRow") {
        window.setTimeout("document.forms[0].elements[i].focus()",100);
        return;
      }
    }
  }
  return;
}

//--------------------------------------------------
function skipWriteProtectedElement(name) {
//--------------------------------------------------
  form_length = document.forms[0].elements.length;
  form = document.forms[0];
  for (i=0;i<form_length;i++) {
    if (form.elements[i].type!=null) { // <= das verhindert Probleme mit fieldset
      if (name == form.elements[i].name) {
        //letztes Element
        if (i+1>=form_length) {
          start=0;
        } else {
          start=i+1;
        }
        for(j=start;j<form_length;j++) {
          if (form.elements[j].type!=null) { // <= das verhindert Probleme mit fieldset
            ele_type = form.elements[j].type;
            ele_style = document.forms[0].elements[i].style;  // <= das verhindert Probleme mit ausgeblendeten Layern
            if(ele_style != "hidden" && ele_type != "hidden" && form.elements[j].name.substr(0,6) != "SetRow") {
              form.elements[j].focus();
              return;
            }
          }
        }
        //Element(e) nach schreibgeschütztem Feld sind Hidden
        ElementFocus();
        return;
      }
    }
  }
}

//--------------------------------------------------
function OpenSearchHelp() {
//--------------------------------------------------
  l_strUrl = "../../../_upinclude/Script/upsearchhelp.asp";

  if(!self.wndShowSearchHelp) {
    wndShowSearchHelp = window.open(l_strUrl,"Search","dependent=yes,resizable=yes,width=750,height=600,screenX=100,screenY=100,scrollbars=yes");
  } else {
    if (self.wndShowSearchHelp.closed) {
      wndShowSearchHelp = window.open(l_strUrl,"Search","dependent=yes,resizable=yes,width=750,height=600,screenX=100,screenY=100,scrollbars=yes");
    } else {
      self.wndShowSearchHelp.document.location.href = l_strUrl;
      self.wndShowSearchHelp.focus();
    }
  }
}

