﻿
/* ============================ GTConstants.js ===========================*/
var NODE_ELEMENT = 1;
var NODE_ATTRIBUTE = 2;

var nTimeout = 100;
 

var ids_FormIsLoading = "";
var ids_Ready = "";
var ids_LoadingData = "";
var ids_DateNotValid = "";
var ids_BrowserVersion60 = "";
var ids_TransferData = "";
var ids_NotValidEmail_Message = "";
var ids_NotValidUsername_Message = "";
var ids_NotValidPassword_Message = "";
var ids_NotEmpty_Message = "";
var ids_NoValidDate = "";
var ids_NoValidTime = "";
var ids_NoValidRange = "";
var ids_NoValidInteger = "";
var ids_NoValidNumber = "";
var ids_NoValidDouble = "";
var ids_NoValidDoubleGT0 = "";
var ids_NoValidDoubleNot0 = "";
var ids_NoValidIntegerGT0 = "";
var ids_NoValidIntegerNot0 = "";
var ids_NoValidGT0 = "";
var ids_NoValidEnum = "";
var ids_SavingData = "";
var ids_DataSaved   = "";
var ids_DataChanged = "";
var ids_DataSaving = "";
var ids_DataSaved = "";
var ids_Working = "";
var ids_RemoveSearchItemWarning = "";
var ids_ReceivingData = "";
var ids_SelectRecordFirst = "";
var ids_AskDiscardChanges = "";
var ids_AskDelete = "";
var ids_AskDeleteIrrevocably = "";
var ids_InputToLong = "";
var ids_SaveFirst = "";
var ids_SaveAndContinue = "";
var ids_DontSaveAndContinue = "";
var ids_SelectAndContinue = "";
var ids_UploadFirst = "";
var ids_UploadPickAFile = "";
var ids_DataCheckOK = "";
var ids_DataCheckNotOK = "";
var ids_AskConvertToMasterdata = "";
var ids_WebDataGridMainNotSpecified = "";
var ids_SomeInputIsWrong = "";
var ids_AskCopy = "";
var ids_UploadLastModified = "";
var ids_ShowingData = "";
var ids_WebTreeViewMainNotSpecified = "";
var ids_Successfully = "";
var ids_PromptText = "";
var ids_NoActionPossible = "";
var ids_ExportingData = "";
var ids_DataExported = "";
var ids_SelectNodeFirst = "";
var ids_SelectNodeToLoadRightSide = "";
var ids_SelectNodeToPrintRightSide = "";
var ids_SelectNodeToPrintRightSide2 = "";
var ids_SaveBeforeEditNode = "";
var ids_UpdatingData = "";
var ids_NoDataToForPasting = "";
var ids_NoEmptyString = "";
var ids_SignOnFailure = "";
var ids_AskImport = "";
var ids_AskReloadAfterDeletion = "";
var ids_AskReloadAfterMove = "";
var ids_AskReloadAfterReplace = "";
var ids_AskReloadAfterPaste = "";
var ids_AskReloadAfterImport = "";
var ids_DataHasError = "";
var ids_LongTask = "";
var ids_WebSpreadSheetMainNotSpecified = "";
var ids_Record = "";
var ids_New = "";
var ids_InformationNotSufficient = "";
var ids_RenewAlphaCategoryCompleted = "";
var ids_Close = "";
var ids_SelectAnItemFist = "";
var ids_NoReportsAvailable = "";
var ids_YouCanNotDelete = "";
var ids_DataWereRefreshed = "";
var ids_DeleteMessage = "";
var ids_TextCopyNotAllowed = "";
var ids_NoTocAttached = "";
var ids_TextWasCopiedToClipboard = "";
var ids_CheckoutFailed = "";
var ids_CheckinFailed = "";
var ids_EmailAllreadyExists = "";
var ids_AccountRequestSubmitted = "";
var ids_RetryAfterError = "";
var ids_EmailDoesNotExist = "";
var ids_PasswordRequestSubmitted = "";
var ids_SystemTaskCreated = "";


if (typeof(XmlVersion) == "undefined" || XmlVersion == null) XmlVersion = "V1";
if (typeof(Language) == "undefined" || Language == null) Language = "en-US";

if (Language=='d' || Language=='de-DE')
{
  ids_FormIsLoading = "Form lädt...";
  ids_Ready = "Bereit";
  ids_LoadingData = "Lade Daten...";
  ids_DateNotValid = "Ungültiges Datum.";
  ids_BrowserVersion60 = "Diese Funktion steht erst ab IE Version 6.0 zur Verfügung.";
  ids_TransferData = "Übernehme Daten...";
  ids_NotEmpty_Message = "Dieses Feld darf nicht leer sein."
  ids_NotValidUsername_Message = "Bitte geben Sie einen gültigen Benutzernamen an (mind. 6 Zeichen).";
  ids_NotValidPassword_Message = "Bitte geben Sie ein gültiges Passwort an.";
  ids_NotValidEmail_Message = "Bitte geben Sie eine gültige E-Mail-Adresse ein.";
  ids_NoValidDate = "Bitte geben Sie ein gültiges Datum ein.";
  ids_NoValidTime = "Bitte geben Sie eine gültige Uhrzeit ein.";
  ids_NoValidRange = "Der eingegebene Wert muss eine gültige Zahl zwischen {1} und {2} sein. Bitte verwenden Sie ein Komma als Dezimaltrennzeichen.";
  ids_NoValidInteger = "Der eingegebene Wert muss eine gültige ganze Zahl sein.";
  ids_NoValidNumber = "Der eingegebene Wert muss eine gültige Zahl sein. Bitte verwenden Sie ein Komma als Dezimaltrennzeichen.";
  ids_NoValidDouble = "Der eingegebene Wert muss eine gültige Zahl sein. Bitte verwenden Sie ein Komma als Dezimaltrennzeichen.";
  ids_NoValidDoubleGT0 = "Der eingegebene Wert muss eine gültige Zahl größer als 0 sein. Bitte verwenden Sie ein Komma als Dezimaltrennzeichen.";
  ids_NoValidDoubleNot0 = "Der eingegebene Wert muss eine gültige Zahl ungleich 0 sein. Bitte verwenden Sie ein Komma als Dezimaltrennzeichen.";
  ids_NoValidIntegerGT0 = "Der eingegebene Wert muss eine gültige ganze Zahl größer 0 sein.";
  ids_NoValidIntegerNot0 = "Der eingegebene Wert muss eine gültige ganze Zahl ungleich 0 sein.";
  ids_NoValidGT0 = "Der eingegebene Wert muss eine gültige Zahl größer 0 sein. Bitte verwenden Sie ein Komma als Dezimaltrennzeichen.";
  ids_NoValidEnum = "Der eingegebene Wert muss eine gültige ganze und eindeutige Zahl größer 0 sein.";
  ids_SavingData  = "Speichern läuft...";
  ids_DataSaved   = "Daten gespeichert";
  ids_DataChanged = "Daten wurden geändert";
  ids_DataSaving  = "Speichern läuft...";
  ids_DataSaved   = "Daten sind gespeichert";
  ids_Working = "In Arbeit...";
  ids_RemoveSearchItemWarning = "Bitte wählen Sie einen Eintrag aus, um ihn aus der Liste der Suchbegriffe zu entfernen.";
  ids_ReceivingData = "Empfange Daten...";
  ids_SelectRecordFirst = "Bitte wählen Sie zuerst mindestens einen Eintrag aus, bevor Sie diesen Vorgang fortsetzen.";
  ids_AskDiscardChanges = "Es sind noch nicht alle Änderungen gespeichert. Sie werden die Änderungen verlieren, wenn Sie fortfahren.";
  ids_AskDelete = "Klicken Sie OK, um den Löschvorgang durchzuführen.";
  ids_AskDeleteIrrevocably = "Der Datensatz wird unwiderruflich gelöscht. ";
  ids_InputToLong = "Die Eingabe kann nur {0} Zeichen enthalten.";
  ids_SaveFirst = "Bitte speichern Sie Ihre Änderungen, bevor Sie fortfahren.";
  ids_SaveAndContinue = "Bitte speichern Sie Ihre Änderungen, bevor Sie fortfahren.\nKlicken sie OK, um Ihre Daten zu speichern."
  ids_DontSaveAndContinue = "Es sind geänderte Daten vorhanden.\nKlicken sie OK, um fortzufahren ohne zu speichern."
  ids_SelectAndContinue = "Sie müssen zuerst eine Auswahl treffen, bevor Sie fortfahren können."
  ids_UploadFirst = "Bitte wählen Sie einen Eintrag aus der Auswahlliste, bevor Sie fortfahren.";
  ids_UploadPickAFile = "Bitte wählen Sie eine Datei, bevor Sie fortfahren.";
  ids_DataCheckOK = "Daten OK";
  ids_DataCheckNotOK = "Fehler";
  ids_AskConvertToMasterdata = "Bitte bestätigen Sie mit OK, dass Sie diese Daten zur Stammdate konvertieren wollen.";
  ids_WebDataGridMainNotSpecified = "Es wurde keine WebDataGridMain angegeben.";
  ids_SomeInputIsWrong = "Einige Eingaben sind falsch.";
  ids_AskCopy = "Klicken Sie OK, um den Kopiervorgang durchzuführen.";
  ids_UploadLastModified = "-FileSize- Byte, letzte Änderung am -FileDate-";
  ids_ShowingData = "Zeige Daten";
  ids_WebTreeViewMainNotSpecified = "Es wurde kein WebTreeViewMain angegeben.";
  ids_Successfully = "Die Aktion wurde erfolgreich ausgeführt.";
  ids_PromptText = "[Bitte auswählen]";
  ids_NoActionPossible = "Diese Aktion ist derzeit nicht möglich.";
  ids_ExportingData = "Daten werden exportiert ...";
  ids_DataExported = "Daten wurden exportiert.";
  ids_SelectNodeFirst = "Bitte markieren Sie einen Knoten.";
  ids_SelectNodeToLoadRightSide = "Bitte markieren Sie eine Ebene, um Daten in der rechten Seite zu laden.";
  ids_SelectNodeToPrintRightSide = "Bitte markieren Sie eine Ebene, um Daten in der rechten Seite zu drucken.";
  ids_SelectNodeToPrintRightSide2 = "Für die geladene Maske sind keine Reports verfügbar.";
  ids_SaveBeforeEditNode = "Bitte speichern Sie ihre Daten, bevor Sie den ausgewählten Knoten bearbeiten.";
  ids_UpdatingData = "Daten werden aktualisiert...";
  ids_NoDataToForPasting = "Es stehen keine Daten zum Einfügen zur Verfügung.";
  ids_NoEmptyString = "Der eingegebene Wert darf keine leere Zeichenfolge sein.";
  ids_SignOnFailure = "Anmeldung ist fehlgeschlagen.";
  ids_AskTransfer = "Klicken Sie OK, um die Übertragung der importierten Daten zu starten.";
  ids_AskReloadAfterDeletion = "Wenn Einträge gelöscht wurden, laden Sie bitte die Struktur neu, um die aktuelle Nummerierung einzusehen. Klicken Sie OK, um die Struktur neu zu laden.";
  ids_AskReloadAfterMove = "Wenn Einträge verschoben wurden, laden Sie bitte die Struktur neu, um die geänderte Struktur einzusehen. Klicken Sie OK, um die Struktur neu zu laden.";
  ids_AskReloadAfterReplace = "Wenn Einträge ersetzt wurden, laden Sie bitte die Struktur neu, um die geänderte Struktur einzusehen. Klicken Sie OK, um die Struktur neu zu laden.";
  ids_AskReloadAfterPaste = "Wenn Einträge eingefügt wurden, laden Sie bitte die Struktur neu, um die geänderte Struktur einzusehen. Klicken Sie OK, um die Struktur neu zu laden.";
  ids_AskReloadAfterImport = "Wenn Einträge eingefügt wurden, laden Sie bitte die Struktur neu, um die geänderte Struktur einzusehen. Klicken Sie OK, um die Struktur neu zu laden.";
  ids_DataHasError = "Es sind Fehler aufgetreten.";
  ids_LongTask = "Abhänging davon wieviel Daten Sie ausgewählt haben, kann der Vorgang einige Minuten dauern.";
  ids_WebSpreadSheetMainNotSpecified = "Es wurde kein WebSpreadSheetMain angegeben.";
  ids_Record = "Datensatz {0}";
  ids_New = "Neu";
  ids_InformationNotSufficient = "Die angegebenen Informationen sind zum Durchführen des Vorgangs nicht ausreichend.";
  ids_RenewAlphaCategoryCompleted = "Lexikalische Aufteilung wurde erfolgreich aktualisiert.";
  ids_Close = "Schließen";
  ids_SelectAnItemFist = "Bitte markieren Sie zuerst ein Element.";
  ids_NoReportsAvailable = "Hier stehen keine Ausdrucke zur Verfügung.";
  ids_YouCanNotDelete = "Dieser Datensatz kann nicht gelöscht werden.";
  ids_DataWereRefreshed = "Die Daten wurden erfolgreich aktualisiert.";
  ids_DeleteMessage = "Sie können den Löschvorgang nicht durchführen,da noch Positionen vorhanden sind.";
  ids_TextCopyNotAllowed = "Das Kopieren von Text ist nicht erlaubt.";
  ids_NoTocAttached = "Es ist kein verknüpftes TOC vorhanden.";
  ids_TextWasCopiedToClipboard = "Text wurde in die Zwischenablage kopiert.";
  ids_CheckoutFailed = "Das Produkt konnte nicht ausgecheckt werden, da es bereits ausgecheckt ist.";
  ids_CheckinFailed = "Das Produkt konnte nicht eingecheckt werden, da es bereits eingecheckt ist.";
  ids_EmailAllreadyExists = "Diese Email ist bereits vorhanden.";
  ids_AccountRequestSubmitted = "Die Anfrage wurde übertragen. Die Zugangsdaten werden Ihnen per Email an die angegebene Email-Adresse zu geschickt.";
  ids_RetryAfterError = "Es ist ein Fehler aufgetreten. Bitte versuchen Sie es zu einem späteren Zeitpunkt noch einmal.";
  ids_EmailDoesNotExist = "Es gibt kein Benutzerkonto mit dieser E-Mail in unserem System. Bitte geben Sie die E-Mail an, die registriert wurde oder kontaktieren Sie unseren Support.";
  ids_PasswordRequestSubmitted = "Die Anfrage wurde übertragen. Die Zugangsdaten werden Ihnen per Email an die angegebene Email-Adresse zu geschickt.";
  ids_SystemTaskCreated = "Ein Systemauftrag wurde erstellt.";
}
else if (Language=='f' || Language=='fr-FR')
{
  ids_FormIsLoading = "Chargement du formulaire ...";
  ids_Ready = "Prêt";
  ids_LoadingData = "Chargement des données en cours ...";
  ids_DateNotValid = "Date n´est pas valable";
  ids_BrowserVersion60 = "Cette option est disponible à partir de l´explorateur IE version 6.0.";
  ids_TransferData = "Transmettre données ...";
  ids_NotEmpty_Message = "Ce champ ne doit pas rester vide."
  ids_NotValidUsername_Message = "Veuillez entrer un nom d´utilisateur valable (au moin 6 lettres).";
  ids_NotValidPassword_Message = "Veuillez entrer un mot de passe valable.";
  ids_NotValidEmail_Message = "Veuillez entrer une adresse e-mail valable.";
  ids_NoValidDate = "Veuillez entrer une date valable.";
  ids_NoValidTime = "Veuillez entrer une heure valable.";
  ids_NoValidRange = "La valeur entrée doit être un chiffre valable entre {1} et {2}.";
  ids_NoValidInteger = "La valeur entrée doit être un nombre entier valable.";
  ids_NoValidNumber = "La valeur entrée doit être un chiffre valable. SVP, utilisez une virgule comme séparateur décimal.";
  ids_NoValidDouble = "La valeur entrée doit être un chiffre valable. SVP, utilisez une virgule comme séparateur décimal.";
  ids_NoValidDoubleGT0 = "La valeur entrée doit être un chiffre supérieur à zéro. SVP, utilisez une virgule comme séparateur décimal.";
  ids_NoValidDoubleNot0 = "La valeur entrée doit être un chiffre différent de zéro. SVP, utilisez une virgule comme séparateur décimal.";
  ids_NoValidIntegerGT0 = "La valeur entrée doit être un nombre entier supérieur à zéro.";
  ids_NoValidIntegerNot0 = "La valeur entrée doit être un nombre entier différent de zéro.";
  ids_NoValidGT0 = "La valeur entrée doit être un chiffre supérieur à zéro.SVP, utilisez une virgule comme séparateur décimal.";
  ids_NoValidEnum = "La valeur entrée doit être un chiffre supérieur à zéro.";
  ids_SavingData  = "Données sont en cours d'enregistrement...";
  ids_DataSaved   = "Données sont enregistrées";
  ids_DataChanged = "Données ont été modifiées";
  ids_DataSaving  = "Données sont en cours d'enregistrement...";
  ids_DataSaved   = "Données sont enregistrées";
  ids_Working = "En travail ...";
  ids_RemoveSearchItemWarning = "Veuillez marquer une entrée avant de l´éliminer de la liste de sélection.";
  ids_ReceivingData = "Reception de données ...";
  ids_SelectRecordFirst = "Vous devez sélectionner au moins un critère de choix avant de poursuivre.";
  ids_AskDiscardChanges = "Vous n´avez pas sauvegardé vos modifications. Vous allez perdre ces modifications si vous continuez.";
  ids_AskDelete = "Cliquez sur OK pour terminer la suppression.";
  ids_AskDeleteIrrevocably = "Le jeu de données va être supprimé sans appel.";
  ids_InputToLong = "Ce champ d´entrée peut seulement enregistrer {0} caractères au maximum.";
  ids_SaveFirst = "Veuillez sauvegarder vos entrées avant de poursuivre.";
  ids_SaveAndContinue = "Veuillez sauvegarder vos entrées avant de poursuivre.\nCliquez OK pour sauvegarder votre modifications."
  ids_DontSaveAndContinue = "There pending changes.\nClick OK, to continue without saving."
  ids_SelectAndContinue = "Vous devez sélectionner une valeur de la liste avant de poursuivre."
  ids_UploadFirst = "Veuillez télécharger un fichier avant de continuer.";
  ids_UploadPickAFile = "Veuillez sélectionner un fichier avant de continuer.";
  ids_DataCheckOK = "Données sont OK";
  ids_DataCheckNotOK = "Erreur";
  ids_AskConvertToMasterdata = "Confirmer en cliquant sur OK, pour confirmer que vous voulez convertir ces données pour les données de base SVP.";
  ids_WebDataGridMainNotSpecified = "Il n´y a pas de WebDataGridMain spécifié.";
  ids_SomeInputIsWrong = "Certaines entrées sont incorrectes.";
  ids_AskCopy = "Cliquez OK pour effectuer l'opération de copie.";
  ids_UploadLastModified = "-FileSize- Byte, dernière modification au -FileDate-";
  ids_ShowingData = "Aperçu des données";
  ids_WebTreeViewMainNotSpecified = "Il n´y a pas de WebTreeViewMain spécifié.";
  ids_Successfully = "La tâche a été accomplie avec succès.";
  ids_PromptText = "[Sélectionner SVP]";
  ids_NoActionPossible = "Cette option n´est pas disponible au moment.";
  ids_ExportingData = "Exporter des données ...";
  ids_DataExported = "Exportation des données terminée.";
  ids_SelectNodeFirst = "Vous devez d´abord sélectionner un nœud.";
  ids_SelectNodeToLoadRightSide = "Vous devez d´abord sélectionner un nœud.";
  ids_SelectNodeToPrintRightSide = "Vous devez d´abord sélectionner un nœud.";
  ids_SelectNodeToPrintRightSide2 = "Il n’y a pas des rapports disponibles pour la masque que vous avez selectionné.";
  ids_SaveBeforeEditNode = "Vous devez sauvegarder vos entrées avant de pouvoir éditer le nœud sélectionné.";
  ids_UpdatingData = "Mise à jour des données ...";
  ids_NoDataToForPasting = "Aucune donnée n'est disponible pour l´insertion.";
  ids_NoEmptyString = "Ce champ ne doit pas rester vide."
  ids_SignOnFailure = "Échec de la connexion.";
  ids_AskTransfer = "Cliquez OK pour commencer la transmission des données importées.";
  ids_AskReloadAfterDeletion = "S' il y a des données supprimées, veuillez recharger les données pour voir la nouvelle structure. Cliquez OK pour recharger la structure.";
  ids_AskReloadAfterMove = "S' il y a des données déplacées, veuillez recharger les données pour voir la nouvelle structure. Cliquez OK pour recharger la structure.";
  ids_AskReloadAfterReplace = "S' il y a des données remplacées, veuillez recharger les données pour voir la nouvelle structure. Cliquez OK pour recharger la structure.";
  ids_AskReloadAfterPaste = "S' il y a des données collées, veuillez recharger les données pour voir la nouvelle structure. Cliquez OK pour recharger la structure.";
  ids_AskReloadAfterImport = "S' il y a des données collées, veuillez recharger les données pour voir la nouvelle structure. Cliquez OK pour recharger la structure.";
  ids_DataHasError = "Il y a des erreurs.";
  ids_LongTask = "En fonction de la quantité de données sélectionnée, le processus  peut prendre plusieurs minutes.";
  ids_WebSpreadSheetwMainNotSpecified = "Il n´y a pas de WebSpreadSheetMain spécifié.";
  ids_Record = "Jeu de données {0}";
  ids_New = "Creer";
  ids_InformationNotSufficient = "Les données saisies ne sont pas suffisantes pour effectuer cette action.";
  ids_RenewAlphaCategoryCompleted = "La répartition alphabétique a été mis à jour avec succès.";
  ids_Close = "Fermer";
  ids_SelectAnItemFist = "Veuillez d'abord sélectionner une donnée.";
  ids_NoReportsAvailable = "Il n'y a pas des rapports disponibles.";
  ids_YouCanNotDelete = "Ce jeu de données ne peut pas être supprimé.";
  ids_DataWereRefreshed = "Les données sont actualisées.";
  ids_DeleteMessage = "Il n'est pas possible de supprimer ce jeu de données parce qu'il y a encore des détails.";
  ids_TextCopyNotAllowed = "Il n'est pas possible de copier le texte.";
  ids_NoTocAttached = "Il n'y a pas de table des matières lié.";
  ids_TextWasCopiedToClipboard = "Text was copied to clipboard.";
  ids_CheckoutFailed = "Checkout failed. The product is already checked out.";
  ids_CheckinFailed = "Checkin failed. The product is already checked in.";
  ids_EmailAllreadyExists = "E-mail allready exists.";
  ids_AccountRequestSubmitted = "Account request submitted. A message with your login data will be send to the email address stated in your request.";
  ids_RetryAfterError = "An error occurred. Please try again later.";
  ids_EmailDoesNotExist = "There is no account with this email address in our system. Please enter the email address you registered or contact our customerservice.";
  ids_PasswordRequestSubmitted = "Account request submitted. A message with your login data will be send to the email address stated in your request.";
  ids_SystemTaskCreated = "A system task was created.";
}
else if (Language=='es-ES')
{
  ids_FormIsLoading = "Cargando pantalla...";
  ids_Ready = "Listo";
  ids_LoadingData = "Cargando datos...";
  ids_DateNotValid = "Por favor introduzca una fecha válida.";
  ids_BrowserVersion60 = "Esta característica e disponible en IE Version 6.0.";
  ids_TransferData = "Datos son transmitidos...";
  ids_NotEmpty_Message = "Esta casilla no debe quedar vacía."
  ids_NotValidUsername_Message = "Por favor introduzca un nombre de usuario válido (compuesto al menos de 6 caracteres).";
  ids_NotValidPassword_Message = "Por favor introduzca un nombre de usuario válido.";
  ids_NotValidEmail_Message = "Por favor introduzca una dirección válida de email.";
  ids_NoValidDate = "Por favor introduzca una fecha válida.";
  ids_NoValidTime = "Por favor introduzca un período del día válido.";
  ids_NoValidRange = "La entrada tiene que ser un número entre {1} y {2}. Por favor use un punto como separador decimal.";
  ids_NoValidInteger = "La entrada tiene que ser un número entero válido.";
  ids_NoValidNumber = "La entrada tiene que ser un número válido. Por favor use un punto como separador decimal.";
  ids_NoValidDouble = "La entrada tiene que ser un número válido. Por favor use un punto como separador decimal.";
  ids_NoValidDoubleGT0 = "La entrada tiene que ser un número válido mayor que cero. Por favor use un punto como separador decimal.";
  ids_NoValidDoubleNot0 = "La entrada tiene que ser un número válido distinto a cero. Por favor use un punto como separador decimal.";
  ids_NoValidIntegerGT0 = "La entrada tiene que ser un número válido mayor que cero.";
  ids_NoValidIntegerNot0 = "La entrada tiene que ser un número entero válido distinto a cero.";
  ids_NoValidGT0 = "La entrada tiene que ser un número válido mayor que cero. Por favor use un punto como separador decimal.";
  ids_NoValidEnum = "La entrada tiene que ser un número entero válido mayor que cero.";
  ids_SavingData  = "Guardando datos...";
  ids_DataSaved   = "Datos han sido guardados";
  ids_DataChanged = "Datos han sido cambiados";
  ids_DataSaving  = "Guardando datos...";
  ids_DataSaved   = "Datos han sido guardados";
  ids_Working = "Trabajando...";
  ids_RemoveSearchItemWarning = "Por favor seleccione una entrada por lo borrar de la lista de criterios de selección.";
  ids_ReceivingData = "Recibido datos...";
  ids_SelectRecordFirst = "Por favor seleccione una entrada de la selección antes de que seguir.";
  ids_AskDiscardChanges = "Hay cambios sin salvar. Usted perderá estos cambios si procede.";
  ids_AskDelete = "Click ok para borrar este ítem.";
  ids_AskDeleteIrrevocably = "The record will be deleted irrevocably.";
  ids_InputToLong = "Esta casilla puede encerrar solo {0} caracteres.";
  ids_SaveFirst = "Usted debe guardar los datos antes que seguir.";
  ids_SaveAndContinue = "Usted debe guardar los datos antes que seguir.\nClique en OK para guardar los datos."
  ids_DontSaveAndContinue = "There pending changes.\nClick OK, to continue without saving."
  ids_SelectAndContinue = "Por favor seleccione una entrada de la lista antes que seguir."
  ids_UploadFirst = "Por favor seleccione un archivo por cargar antes que seguir.";
  ids_UploadPickAFile = "Por favor seleccione un archivo antes que seguir.";
  ids_DataCheckOK = "Datos OK";
  ids_DataCheckNotOK = "Error";
  ids_AskConvertToMasterdata = "Haga click en el boton OK por para confirmar la conversión en datos pricipales.";
  ids_WebDataGridMainNotSpecified = "There is no WebDataGridMain specified.";
  ids_SomeInputIsWrong = "Algunas entradas son inválidas.";
  ids_AskCopy = "Haga click en el boton OK por copiar esta entrada.";
  ids_UploadLastModified = "-FileSize- Byte, cambiado último en -FileDate-";
  ids_ShowingData = "Mostrar datos...";
  ids_WebTreeViewMainNotSpecified = "There is no specified WebTreeViewMain.";
  ids_Successfully = "Esta tarea e cerrada con èxito.";
  ids_PromptText = "[Seleccione por favor]";
  ids_NoActionPossible = "Esta característica e fuera de servicio actualmente.";
  ids_ExportingData = "Exportando datos ...";
  ids_DataExported = "Exportación cerrado.";
  ids_SelectNodeFirst = "Por favor seleccione un nodo en primer lugar.";
  ids_SelectNodeToLoadRightSide = "Por favor seleccione un nodo por cargar los datos en la página derecha.";
  ids_SelectNodeToPrintRightSide = "Por favor seleccione un nodo por imprimir los datos en la página derecha.";
  ids_SaveBeforeEditNode = "Usted debe guardar los datos antes que editar il nodo.";
  ids_UpdatingData = "Actualizar datos...";
  ids_NoDataToForPasting = "No datos disponibles por pegar.";
  ids_NoEmptyString = "La entrada no tiene que ser un espacio."
  ids_SignOnFailure = "Sign on failed.";
  ids_AskTransfer = "Haga click en el boton OK por transferir los datos importados.";
  ids_AskReloadAfterDeletion = "In order to view the updated structure, you have to reload the data after deleting entries. Click ok to reload the structure.";
  ids_AskReloadAfterMove = "In order to view the updated structure, you have to reload the data after moving entries. Click ok to reload the structure.";
  ids_AskReloadAfterReplace = "In order to view the updated structure, you have to reload the data after replacing entries. Click ok to reload the structure.";
  ids_AskReloadAfterPaste = "In order to view the updated structure, you have to reload the data after pasting entries. Click ok to reload the structure.";
  ids_AskReloadAfterImport = "In order to view the updated structure, you have to reload the data after pasting entries. Click ok to reload the structure.";
  ids_DataHasError = "Error en la página.";
  ids_LongTask = "Dependiente de la cantidad de datos, esta operación podría tardar unos minutos.";
  ids_WebSpreadSheetMainNotSpecified = "There is no specified WebSpreadSheetMain.";
  ids_Record = "Registro {0}";
  ids_New = "Nuovo";
  ids_InformationNotSufficient = "Las entradas son insufieciente por efectuar esta función.";
  ids_RenewAlphaCategoryCompleted = "Alphacategory was updated successfully.";
  ids_Close = "Cerrar";
  ids_SelectAnItemFist = "Por favor seleccione un itém.";
  ids_NoReportsAvailable = "No reportes disponibles.";
  ids_YouCanNotDelete = "Imposible borrar esto archivo.";
  ids_DataWereRefreshed = "The data have been successfully refreshed.";
  ids_DeleteMessage = "You can not delete this record, because details still exist.";
  ids_TextCopyNotAllowed = "Copiing the text is not allowed.";
  ids_NoTocAttached = "There is no TOC attached.";
  ids_TextWasCopiedToClipboard = "Text was copied to clipboard.";
  ids_CheckoutFailed = "Checkout failed. The product is already checked out.";
  ids_CheckinFailed = "Checkin failed. The product is already checked in.";
  ids_EmailAllreadyExists = "E-mail allready exists.";
  ids_AccountRequestSubmitted = "Account request submitted. A message with your login data will be send to the email address stated in your request.";
  ids_RetryAfterError = "An error occurred. Please try again later.";
  ids_EmailDoesNotExist = "There is no account with this email address in our system. Please enter the email address you registered or contact our customerservice.";
  ids_PasswordRequestSubmitted = "Account request submitted. A message with your login data will be send to the email address stated in your request.";
  ids_SystemTaskCreated = "A system task was created.";
}
else
{
  ids_FormIsLoading = "Form is loading...";
  ids_Ready = "Ready";
  ids_LoadingData = "Loading data...";
  ids_DateNotValid = "Please enter a valid date.";
  ids_BrowserVersion60 = "This feature is available as of IE Version 6.0.";
  ids_TransferData = "Transfer data...";
  ids_NotEmpty_Message = "This field must not be empty."
  ids_NotValidUsername_Message = "Please enter a valid user name (at least 6 characters).";
  ids_NotValidPassword_Message = "Please enter a valid password.";
  ids_NotValidEmail_Message = "Please enter a valid email address.";
  ids_NoValidDate = "Please enter a valid date.";
  ids_NoValidTime = "Please enter a valid time of day.";
  ids_NoValidRange = "The entered value has to be a valid number between {1} and {2}. Please use a point as decimal separator.";
  ids_NoValidInteger = "The entered value has to be a valid integer.";
  ids_NoValidNumber = "The entered value has to be a valid number. Please use a point as decimal separator.";
  ids_NoValidDouble = "The entered value has to be a valid number. Please use a point as decimal separator.";
  ids_NoValidDoubleGT0 = "The entered value has to be a valid number greater than 0. Please use a point as decimal separator.";
  ids_NoValidDoubleNot0 = "The entered value has to be a valid number not equal to 0. Please use a point as decimal separator.";
  ids_NoValidIntegerGT0 = "The entered value has to be a valid number greater than 0.";
  ids_NoValidIntegerNot0 = "The entered value has to be a valid integer not equal to 0.";
  ids_NoValidGT0 = "The entered value has to be a valid number greater than 0. Please use a point as decimal separator.";
  ids_NoValidEnum = "The entered value has to be a valid unique integer greater than 0.";
  ids_SavingData  = "Data are being saved...";
  ids_DataSaved   = "Data are saved";
  ids_DataChanged = "Data have changed";
  ids_DataSaving  = "Saving data...";
  ids_DataSaved   = "Data are saved";
  ids_Working = "Working...";
  ids_RemoveSearchItemWarning = "Please select an entry in order to remove it from the list of active selection criteria.";
  ids_ReceivingData = "Receiving data...";
  ids_SelectRecordFirst = "Please select at least one entry in the selection area before proceeding.";
  ids_AskDiscardChanges = "There are unsaved changes. You will loose these changes, if you proceed.";
  ids_AskDelete = "Click OK to delete this item.";
  ids_AskDeleteIrrevocably = "The record will be deleted irrevocably.";
  ids_InputToLong = "This input field can only hold {0} characters.";
  ids_SaveFirst = "Please save your changes before proceeding.";
  ids_SaveAndContinue = "Please save your changes before proceeding.\nClick OK to save your changes."
  ids_DontSaveAndContinue = "There pending changes.\nClick OK, to continue without saving."
  ids_SelectAndContinue = "Please select an entry from the list before proceeding."
  ids_UploadFirst = "Please upload a file before proceeding.";
  ids_UploadPickAFile = "Please select a file before proceeding.";
  ids_DataCheckOK = "Data OK";
  ids_DataCheckNotOK = "Error";
  ids_AskConvertToMasterdata = "Please press OK to confirm masterdata conversion.";
  ids_WebDataGridMainNotSpecified = "There is no WebDataGridMain specified.";
  ids_SomeInputIsWrong = "Some entries are invalid.";
  ids_AskCopy = "Click OK to copy this entry.";
  ids_UploadLastModified = "-FileSize- Byte, last modified on -FileDate-";
  ids_ShowingData = "Showing data";
  ids_WebTreeViewMainNotSpecified = "There is no specified WebTreeViewMain.";
  ids_Successfully = "The task was successfully completed.";
  ids_PromptText = "[Please choose]";
  ids_NoActionPossible = "This feature is not available at the moment.";
  ids_ExportingData = "Exporting data ...";
  ids_DataExported = "Data export completed.";
  ids_SelectNodeFirst = "Please select a node first.";
  ids_SelectNodeToLoadRightSide = "Please select a node first in oder to load data into the right side.";
  ids_SelectNodeToPrintRightSide = "Please select a node first in oder to print data of the right side.";
  ids_SelectNodeToPrintRightSide2 = "The are no reports available for the selected mask.";
  ids_SaveBeforeEditNode = "Please save your changes before editing the selected node.";
  ids_UpdatingData = "Updating data...";
  ids_NoDataToForPasting = "There are no data available for pasting.";
  ids_NoEmptyString = "The entered value must not be blank."
  ids_SignOnFailure = "Sign on failed.";
  ids_AskTransfer = "Click OK in order to transfer the imported data.";
  ids_AskReloadAfterDeletion = "In order to view the updated structure, you have to reload the data after deleting entries. Click ok to reload the structure.";
  ids_AskReloadAfterMove = "In order to view the updated structure, you have to reload the data after moving entries. Click ok to reload the structure.";
  ids_AskReloadAfterReplace = "In order to view the updated structure, you have to reload the data after replacing entries. Click ok to reload the structure.";
  ids_AskReloadAfterPaste = "In order to view the updated structure, you have to reload the data after pasting entries. Click ok to reload the structure.";
  ids_AskReloadAfterImport = "In order to view the updated structure, you have to reload the data after pasting entries. Click ok to reload the structure.";
  ids_DataHasError = "Errors have occurred.";
  ids_LongTask = "Depending on how many data you selected, this transaction will take several minutes.";
  ids_WebSpreadSheetMainNotSpecified = "There is no specified WebSpreadSheetMain.";
  ids_Record = "Record {0}";
  ids_New = "New";
  ids_InformationNotSufficient = "The entered data are not sufficient for executing this operation.";
  ids_RenewAlphaCategoryCompleted = "Alphacategory was updated successfully.";
  ids_Close = "Close";
  ids_SelectAnItemFist = "Please select an item first.";
  ids_NoReportsAvailable = "There are no reports available.";
  ids_YouCanNotDelete = "This record cannot be deleted.";
  ids_DataWereRefreshed = "The data have been successfully refreshed.";
  ids_DeleteMessage = "This record cannot be deleted due to attached detail records.";
  ids_TextCopyNotAllowed = "Copying the text is not allowed.";
  ids_NoTocAttached = "There is no TOC attached.";
  ids_TextWasCopiedToClipboard = "Text was copied to clipboard.";
  ids_CheckoutFailed = "Checkout failed. The product is already checked out.";
  ids_CheckinFailed = "Checkin failed. The product is already checked in.";
  ids_EmailAllreadyExists = "E-mail allready exists.";
  ids_AccountRequestSubmitted = "Account request submitted. A message with your login data will be send to the email address stated in your request.";
  ids_RetryAfterError = "An error occurred. Please try again later.";
  ids_EmailDoesNotExist = "There is no account with this email address in our system. Please enter the email address you registered or contact our customerservice.";
  ids_PasswordRequestSubmitted = "Account request submitted. A message with your login data will be send to the email address stated in your request.";
  ids_SystemTaskCreated = "A system task was created.";
}

var RootID_ePro = "ePro";
var RootID_ePro_SEPRO = "ePro_SEPRO";
var RootID_ePro_KAM = "ePro_KAM";
var RootID_ePro_Projects = "ePro_Projects";
var RootID_ePro_Markets = "ePro_Markets";
var RootID_SEPROnet = "SEPROnet";
var RootID_KAMnet = "KAMnet";
var RootID_eCon = "eCon";
var RootID_eCos = "eCos";
var RootID_ESPEY = "ESPEY";
var RootID_KAMnet = "KAMNet";
var RootID_NetInventory = "NetInventory";
var RootID_Metabion = "Metabion";
var RootID_MetabionWos = "MetabionWos";
var RootID_IlpSite = "IlpSite";
var RootID_Chemiehandbuch = "Chemiehandbuch";
var RootID_ProductCatalog = "ProductCatalog";
var RootID_Magnat = "Magnat";
var RootID_GSE = "GSE";
var RootID_ChromoTek = "ChromoTek";
var RootID_ChromoTekWop = "ChromoTekWop";

var Language_German = "de-DE";
var Language_English = "en-US";

var enum_MenuBarBehaviour_MouseOver = "MouseOver";
var enum_MenuBarBehaviour_Click = "Click";

var enum_ActiveStatus_Active = 1;
var enum_ActiveStatus_Inactive = 2;

var enum_UploadStorageType_Database = "Database";
var enum_UploadStorageType_FileSystem = "FileSystem";

var enum_NodeSelectionMode_TableOfContent = "TableOfContent";
var enum_NodeSelectionMode_Node = "Node";

var enum_DepartmentItemType_DepartmentUnit = 1;
var enum_DepartmentItemType_Team = 2;


var enum_CompanySelectionMode_Company = 1;
var enum_CompanySelectionMode_CompanyCode = 2;
var enum_CompanySelectionMode_CompanyLocation = 3;

var enum_ContextHelpType_Fqn = 1;
var enum_ContextHelpType_FqnAndPk = 2;
var enum_ContextHelpType_ContextHelpFqnAndPk = 3;

var enum_CheckoutState_InProcess = 1;
var enum_CheckoutState_ForApproval = 2;
var enum_CheckoutState_OriginalCheckedIn = 3;
var enum_CheckoutState_OriginalCheckedOut = 4;
var enum_CheckoutState_WorkCopy = 5;

var enum_CheckoutManagerResult_Success = 1;
var enum_CheckoutManagerResult_Failure = 2;
var enum_CheckoutManagerResult_AlreadyCheckedOut = 3;
var enum_CheckoutManagerResult_AlreadyCheckedIn = 4;
var enum_CheckoutManagerResult_NoWorkCopyFound = 5;
var enum_CheckoutManagerResult_NoValidPrimaryKey = 6;
var enum_CheckoutManagerResult_NoValidWorkCopy = 7;

var enum_ProductItemType_Root = 1;
var enum_ProductItemType_ProductRange = 2;
var enum_ProductItemType_ProductGroup = 3;
var enum_ProductItemType_ProductSection = 4;
var enum_ProductItemType_Product = 5;
var enum_ProductItemType_DrawingProduct = 6;
var enum_ProductItemType_DrawingInstallation = 7;
var enum_ProductItemType_StationarySeat = 8;
var enum_ProductItemType_ProductVariant = 9;
var enum_ProductItemType_TorqueTransmission = 10;
var enum_ProductItemType_DrawingProductList = 11;
var enum_ProductItemType_DrawingInstallationList = 12;
var enum_ProductItemType_StationarySeatList = 13;
var enum_ProductItemType_ProductVariantList = 14;
var enum_ProductItemType_TorqueTransmissionList = 15;
var enum_ProductItemType_TechnicalDiagramList = 16;
var enum_ProductItemType_TechnicalDiagram = 17;
var enum_ProductItemType_ChangeHistory = 18;
var enum_ProductItemTypeEntra_DocumentList = 19;
var enum_ProductItemTypeEntra_Document = 20;
var enum_ProductItemTypeEntra_RecycleBin = 21;

var enum_ProductInfoType_Product = 8;

var enum_TreeDialogMode_Select = 3;

var enum_TeamItemType_TeamUnit = 1;
var enum_TeamItemType_TeamMember = 2;
var enum_TeamItemType_MetaProjectFolder = 3;
var enum_TeamItemType_MetaProject = 4;
var enum_TeamItemType_Evaluation = 5;
var enum_TeamItemType_Security = 6;
var enum_TeamItemType_MetaProjectInvoice = 7;
var enum_TeamItemType_MetaProjectPurchase = 9;
var enum_TeamItemType_MetaProjectQuotation = 10;
var enum_TeamItemType_MetaProjectTimeSheet = 11;
var enum_TeamItemType_VacationSchedule = 12;
var enum_TeamItemType_VacationScheduleMember = 13;
var enum_TeamItemType_TeamRoot = 14;

var enum_TeamEvaluationItemType_TimeSheetEvaluation = 1;
var enum_TeamEvaluationItemType_MetaProjectEvaluation = 2;

var enum_TeamSecurityItemType_TeamRole = 1;
var enum_TeamSecurityItemType_TeamPrivilege = 2;
var enum_TeamSecurityItemType_TeamRoleFolder = 3;

var enum_SchemaItemType_Database = 1;
var enum_SchemaItemType_TableList = 2;
var enum_SchemaItemType_Table = 3;
var enum_SchemaItemType_ColumnList = 4;
var enum_SchemaItemType_Column = 5;
var enum_SchemaItemType_KeyList = 7;
var enum_SchemaItemType_PrimaryKey = 8;
var enum_SchemaItemType_ConstraintList = 9;
var enum_SchemaItemType_Constraint = 10;
var enum_SchemaItemType_TriggerList = 11;
var enum_SchemaItemType_Trigger = 12;
var enum_SchemaItemType_IndexList = 13;
var enum_SchemaItemType_Index = 14;
var enum_SchemaItemType_StatisticList = 15;
var enum_SchemaItemType_Statistic = 16;
var enum_SchemaItemType_SynonymList = 17;
var enum_SchemaItemType_Synonym = 18;
var enum_SchemaItemType_Programmability = 19;
var enum_SchemaItemType_SystemStoredProcedureList = 20;
var enum_SchemaItemType_SystemStoredProcedure = 21;
var enum_SchemaItemType_StoredProcedure = 22;
var enum_SchemaItemType_FunctionList = 23;
var enum_SchemaItemType_TableValuedFunctionList = 24;
var enum_SchemaItemType_TableValuedFunction = 25;
var enum_SchemaItemType_ScalarValuedFunctionList = 26;
var enum_SchemaItemType_ScalarValuedFunction = 27;
var enum_SchemaItemType_AggregateFunctionList = 28;
var enum_SchemaItemType_AggregateFunction = 29;
var enum_SchemaItemType_SystemFunctionList = 30;
var enum_SchemaItemType_SystemFunction = 31;
var enum_SchemaItemType_DatabaseTriggerList = 32;
var enum_SchemaItemType_DatabaseTrigger = 33;
var enum_SchemaItemType_AssemblyList = 34;
var enum_SchemaItemType_Assembly = 35;
var enum_SchemaItemType_TypeList = 36;
var enum_SchemaItemType_Type = 37;
var enum_SchemaItemType_RuleList = 38;
var enum_SchemaItemType_Rule = 39;
var enum_SchemaItemType_DefaultList = 40;
var enum_SchemaItemType_Default = 41;
var enum_SchemaItemType_ForeignKey = 42;
var enum_SchemaItemType_UniqueKey = 43;
var enum_SchemaItemType_DatabaseList = 44;
var enum_SchemaItemType_ViewList = 45;
var enum_SchemaItemType_View = 46;
var enum_SchemaItemType_StoredProcedureList = 47;
var enum_SchemaItemType_TableAlphaList = 48;

var enum_PagingStatus_Standard = 1;
var enum_PagingStatus_Fake = 2;

var enum_SearchOption_ExactSearch = 1;
var enum_SearchOption_FullTextSearch = 2;

var enum_CT_Unknown = 0;
var enum_CT_WebDataHeader = 1;
var enum_CT_WebDataHeader_SpyButton = 2;
var enum_CT_WebDataHeader_ContextMenuButton =3;
var enum_CT_WebDataHeader_NewButton = 4;
var enum_CT_WebDataHeader_ToggleButton = 5;
var enum_CT_WebDataHeader_InfoLabel = 6;
var enum_CT_WebDataHeader_CaptionLabel = 7;
var enum_CT_WebDataHeader_SliderContainer = 8;
var enum_CT_WebDataHeader_MessageLabel = 9;
var enum_CT_Slider_Left = 10;
var enum_CT_Slider_Middle = 11;
var enum_CT_Slider_Right = 12;
var enum_CT_Slider_Area = 13;
var enum_CT_WebSpreadSheet_Table = 14;
var enum_CT_WebDataHeader_PagingContainer = 15;
var enum_CT_PagingContainer_PagingLink = 16;
var enum_CT_SpreadSheet_ViewDetail = 17;
var enum_CT_WebSearchHeader_ToggleButton = 18;
var enum_CT_WebSearchHeader_CaptionLable = 20;
var enum_CT_WebSearchHeader_MessageLabel = 21;
var enum_CT_SelSearch_CheckBox = 22;
var enum_CT_SelSearch_TrayInButton = 23;
var enum_CT_SelSearch_TrayOutButton = 24;
var enum_CT_SelSearch_InfoButton = 25;
var enum_CT_SelSearch_ListBox = 26;
var enum_CT_PageHeader_AppLogo = 27;
var enum_CT_PageHeader_PageHeadline = 28;
var enum_CT_PageHeader_LoggedOnUser = 29;
var enum_CT_PageHeader_StatusbarContainer = 30;
var enum_CT_Statusbar_ToggleImage = 31;
var enum_CT_Statusbar_Panel1 = 32;
var enum_CT_Statusbar_Panel2 = 33;
var enum_CT_Statusbar_Panel3 = 34;
var enum_CT_Statusbar_Panel4 = 35;
var enum_CT_ChkSearch_CheckBox = 36;
var enum_CT_ChkSearch_CheckBoxSearch = 37;
var enum_CT_TxtSearch_CheckBox = 38;
var enum_CT_TxtSearch_TextBox = 39;
var enum_CT_PageFooter_Link = 40;
var enum_CT_TextBoxExtended_CustomButton = 65;
var enum_CT_TextBoxExtended_EditListButton = 67;
var enum_CT_TextBoxExtended_RefreshButton = 70;
var enum_CT_WebSplitterContainer_Left = 119;
var enum_CT_WebSplitterContainer_Middle = 120;
var enum_CT_WebSplitterContainer_Right = 121;
var enum_CT_WebPaging_LeftArrow = 137;
var enum_CT_WebPaging_Area = 138;
var enum_CT_WebPaging_RightArrow = 139;
var enum_CT_WebSpreadSheet_WebDataHeader = 142;
var enum_CT_MoverListBox2_Caption = 143;
var enum_CT_MoverListBox2_ListLeftCaption = 144;
var enum_CT_MoverListBox2_ListLeftMoveUpImage = 145;
var enum_CT_MoverListBox2_ListLeftMoveDownImage = 146;
var enum_CT_MoverListBox2_ListLeft = 147;
var enum_CT_MoverListBox2_ListSelectImage = 148;
var enum_CT_MoverListBox2_ListSelectAllImage = 149;
var enum_CT_MoverListBox2_ListDeselectAllImage = 150;
var enum_CT_MoverListBox2_ListDeselectImage = 151;
var enum_CT_MoverListBox2_ListRightCaption = 152;
var enum_CT_MoverListBox2_ListRightMoveUpImage = 153;
var enum_CT_MoverListBox2_ListRightMoveDownImage = 154;
var enum_CT_MoverListBox2_ListRight = 155;
var enum_CT_MoverListBox2_ListLeftDiv = 157;
var enum_CT_MoverListBox2_ListMiddleDiv = 158;
var enum_CT_MoverListBox2_ListRightDiv = 159;
var enum_CT_MoverListBox2_CaptionLabelDiv = 160;
var enum_CT_MoverListBox2_LeftItem = 161;
var enum_CT_MoverListBox2_RightItem = 162;
var enum_CT_MoverListBox2_ListSelectImageDiv = 163;
var enum_CT_MoverListBox2_ListSelectAllImageDiv = 164;
var enum_CT_MoverListBox2_ListDeselectAllImageDiv = 165;
var enum_CT_MoverListBox2_ListDeselectImageDiv = 166;
var enum_CT_PageHeader_AppIllustration = 173;
var enum_CT_ContextMenu_Separator = 174;
var enum_CT_WebDataFooter_PagingContainer = 176;
var enum_CT_TabMenu_TabPage = 203;
var enum_CT_NavTree_TabControl = 204;
var enum_CT_TabControl_TabStrip = 205;
var enum_CT_MenuStrip = 209;
var enum_CT_MenuStrip_MenuItem = 210;
var enum_CT_MoverListBox2_ListLeftCaptionDiv = 214;
var enum_CT_MoverListBox2_ListLeftMoveUpDownDiv = 215;
var enum_CT_MoverListBox2_ListRightCaptionDiv = 216;
var enum_CT_MoverListBox2_ListRightMoveUpDownDiv = 217;
var enum_CT_HtmlTable_ContextMenuButton = 218;
var enum_CT_NavTree_ToggleVisual = 224;
var enum_CT_NavTree_CollapseButton = 225;
var enum_CT_NavTree_ExpandButton = 226;
var enum_CT_NavTree_NavigationDiv = 228;
var enum_CT_NavTree_ToggleVisualDiv = 229;
var enum_CT_NavTree_ImageContainerDiv = 230;
var enum_CT_MoverListBox2_ListLeftCheckBox = 233;
var enum_CT_MoverListBox2_ListRightCheckBox = 234;

var ControlLayoutModeEnum_Extended = "Extended";

var enum_TocItemType_Root = 1;
var enum_TocItemType_Chapter = 2;
var enum_TocItemType_Paragraph = 3;
var enum_TocItemType_GroupingSystem = 4;
var enum_TocItemType_GroupingComponent = 5;
var enum_TocItemType_GroupingSystemAndComponent = 6;
var enum_TocItemType_DocumentationItem = 7;
var enum_TocItemType_ComponentList = 8;

var BoundProperty_None = "none";
var BoundProperty_InnerText = "innerText";
var BoundProperty_InnerHtml = "innerHTML";
var BoundProperty_Title = "title";
var BoundProperty_SelectedIndex = "selectedIndex";
var BoundProperty_Checked = "checked";
var BoundProperty_Src = "src";

var Verb_New = "New";
var Verb_Edit = "Edit";
var Verb_Move = "Move";
var Verb_Copy = "Copy";
var Verb_CopyAndMove = "CopyAndMove";
var Verb_Show = "Show";
var Verb_Save = "Save";
var Verb_FollowUp = "FollowUp";
var Verb_Select = "Select";
var Verb_Empty = "";
var Verb_ReadOnly = "ReadOnly";
var Verb_Upload = "Upload";

var DisplayOption_InFrameset = "InFrameset";
var DisplayOption_InTreeviewRightSide = "InTreeviewRightSide";
var DisplayOption_InDialog = "InDialog";
var DisplayOption_InBlankWindow = "InBlankWindow";
var DisplayOption_InXhtmlFrame = "InXhtmlFrame";

var SearchTermActionType_Unknown = "Unknown";
var SearchTermActionType_BlankPage = "BlankPage";
var SearchTermActionType_TreeView = "TreeView";
var SearchTermActionType_Dialog = "Dialog";
var SearchTermActionType_WindowsApplication = "WindowsApplication";

var DeleteInfoReturn_Unknown = "Unknown";
var DeleteInfoReturn_Replaced = "Replaced";
var DeleteInfoReturn_Deleted = "Deleted";
var DeleteInfoReturn_Error = "Error";
var DeleteInfoReturn_BadParameter = "BadParameter";

var DataType_Record = 1;

var enum_NetworkPlanActivityStatus_Created = 1;
var enum_NetworkPlanActivityStatus_Scheduled = 2;
var enum_NetworkPlanActivityStatus_MissingResource = 3;
var enum_NetworkPlanActivityStatus_Done = 4;
var enum_NetworkPlanActivityStatus_Started = 5;
var enum_NetworkPlanActivityStatus_NoResourceRequired = 6;
var enum_NetworkPlanActivityStatus_Cancelled = 7;

var enum_NetworkPlanActivityType_ApprovalOEM = 7;
var enum_NetworkPlanActivityType_ApprovalEngineer = 8;
var enum_NetworkPlanActivityType_ApprovalEnduser = 9;
var enum_NetworkPlanActivityType_Interruption = 11;

var enum_NetworkPlanAssignmentStatus_Scheduled = 1;
var enum_NetworkPlanAssignmentStatus_Done = 2;
var enum_NetworkPlanAssignmentStatus_Additional = 3;

var enum_StructureLevelType_Level1 = 1;
var enum_StructureLevelType_Level2 = 2;
var enum_StructureLevelType_Level3 = 3;

var enum_ValidationResultEnum_Success = 1;
var enum_ValidationResultEnum_Failure = 2;

var enum_TransactionScriptResultEnum_Success = 1;
var enum_TransactionScriptResultEnum_Failure = 2;
var enum_TransactionScriptResultEnum_Abort = 3;

var enum_XmlVersion_V1 = "V1";
var enum_XmlVersion_V3 = "V3";

var enum_ExchangejournalStatus_New = 1;
var enum_ExchangejournalStatus_Uploaded = 2;
var enum_ExchangejournalStatus_Imported = 3;
var enum_ExchangejournalStatus_Validated = 4;
var enum_ExchangejournalStatus_Transferred = 5;

var enum_ExchangeDirectionStatus_Export = 1;
var enum_ExchangeDirectionStatus_Import = 2;

var enum_WebPopUpBehavior_OnMouseOver = "OnMouseOver";
var enum_WebPopUpBehavior_OnClick ="OnClick";

var enum_ValidationStatus_HasErrors = 1;
var enum_ValidationStatus_Valid = 2;
var enum_ValidationStatus_New = 3;

var enum_WebServiceResult_Success = 1;
var enum_WebServiceResult_Failure = 2;
var enum_WebServiceResult_Abort = 3;

var enum_SystemTaskStatus_New = 1;
var enum_SystemTaskStatus_Running = 2;
var enum_SystemTaskStatus_Finished = 3;
var enum_SystemTaskStatus_Waiting = 4;
var enum_SystemTaskStatus_Faulty = 5;
var enum_SystemTaskStatus_Cancelled = 6;

var enum_WopOrderHeaderStatus_New = 1;
var enum_WopOrderHeaderStatus_Confirmed = 3;

var CallingMode_MainApp = "MainApp";
var CallingMode_Dialog = "Dialog";
var CallingMode_DialogDirect = "DialogDirect";
var CallingMode_DialogDirect2 = "DialogDirect2";
var CallingMode_DialogSearch = "DialogSearch"; // Dialog mit grünem Suchbereich
var CallingMode_DialogLongText = "DialogLongText";
var CallingMode_DialogInput = "DialogInput";
var CallingMode_DialogColumnOrder = "DialogColumnOrder";
var CallingMode_SystemRequirement = "SystemRequirement";
var CallingMode_AccountRequest = "AccountRequest";
var CallingMode_SelSearch = "SelSearch";
var CallingMode_TableSelection = "TableSelection";
var CallingMode_ListBoxSelection = "ListBoxSelection";
var CallingMode_ComboSelection = "ComboSelection";
var CallingMode_KAM = "KAM";
var CallingMode_TreeViewRightSide = "TreeViewRightSide";
var CallingMode_TreeViewRightSide2 = "TreeViewRightSide2";
var CallingMode_IFrame = "IFrame";
var CallingMode_GridSelection = "GridSelection";
var CallingMode_MenuStrip = "MenuStrip";
var CallingMode_ContextHelp = "ContextHelp";
var CallingMode_SubmitSelf = "SubmitSelf";
/*
    WebDataHeader = 0,
    WebDataSearchContainer = 1,
    InDialog = 2,
    WebDataRowSeperator = 3,
    WebDataToolbar = 4,
    AddRecord = 5,
    PageFooter = 6,
    PageHeader = 7,
    InTreeviewRightSide = 8,
    InBlankWindow = 9,
    ShowCopyButton = 10,
    ShowSpyButton = 11
    ShowInContainer = 12
    ShowAsXHTML = 13
    ShowSearchCriteria = 14
*/
//------------------------------------------------012345678901234
var PPInBlankWindow                            = "000010110110001";
var PPInDialog                                 = "001001110010001";
var PPInDialogWithWebDataHeader                = "101001110010001";
var PPInDialogWithWebDataToolbar               = "001011110000001";
var PPInDialogWithRowSeparator                 = "001101110010001";
var PPInDialogWithSearchContainer              = "111011110010001";
var PPInDialogWithSearchContainer2             = "111101110010001";
var PPInTreeviewRightSide                      = "000000001010001";
var PPInTreeviewRightSideWithSpyButton         = "000000001011001";
var PPInTreeviewRightSideWithFooter            = "000000101010001";
var PPInTreeviewRightSideWithWebDataToolbar    = "000010101010001";
var PPInTreeviewRightSideWithRowSeperator      = "000100001010001";
var PPInFloatingFrame                          = "000001111000001";
var PPInDialogWithManyRecords                  = "101011110000001";
var PPInDialogWithoutPageHeader                = "101011100000001";
var PPInContainer                              = "111001100010101";
var PPInTreeviewRightSideMany                  = "100111001011001";
var PPInTreeviewRightSideWithSearch            = "110011001011001";
var PPShowAsXhtml                              = "111111000011011";
var PPShowAsXhtml2                             = "111111100011011";

//--------------------------------------------------012345678901234
var PPCriteriaSelection                          = "101111110010010";
var PPTreeview                                   = "000000110000010";
var PPFDialog                                    = "000000000000010";
var PPMainApp                                    = "100000111100010";
var PPInTreeviewRightSideWithRowSeperatorAsXhtml = "000100001010011";
var PPStandard                                   = "000000000000010";
var PPStandard2                                  = "110000110001011";
var PPStandard3                                  = "000000100001010";
var PPStandard4                                  = "110010110001011";
var PPStandard5                                  = "000000110001010";
var PPStandard7                                  = "001000110001010";
//--------------------------------------------------012345678901234
var PP_000000100001010                           = "000000100001010";
var PP_000010110110001                           = "000010100110001";
var PP_001010110110001                           = "001010110110001";
var PP_110111001011011                           = "110111001011011";
var PP_110111001011001                           = "110111001011001";
var PP_001000100000010                           = "001000100000010";
var PP_001000100000000                           = "001000100000000";
var PP_100111001011011                           = "100111001011011";
var PP_100111001011001                           = "100111001011001";
var PP_001100110001010                           = "001100110001010";
var PP_001100110001000                           = "001100110001000";
var PP_100000110000010                           = "100000110000010";
var PP_100000110000000                           = "100000110000000";
var PP_111010110001011                           = "111010110001011";
var PP_100111001010000                           = "100111001010000";


/* ============================ GTVersion.js ===========================*/

targetBrowser = new browserSpecs();

function component(name, id)
{
	this.name = name;
	this.id = id;
  this.componentVersion = oClientCaps.getComponentVersion(id, "ComponentID");	
}

function browserSpecs()
{
	this.version = 0;
	this.dom = false;
	this.msie = false;
	this.gecko = false;
	this.ns4 = false;
	this.vml = false;
}

function GetBrowserVersion()
{
	this.IsIE = false;
	this.IsNS4 = false;
	this.IsGECKO = false;

	if (document.layers) this.IsNS4 = true;
	if (document.getElementById && document.all) this.IsIE = true;
	if (document.getElementById && !document.all) this.IsGECKO = true;
}

function checkBrowser()
{
  try
  {  
	  var isIE = false;
	  var isNS4 = false;
	  var isGECKO = false;
	  var version = 4;
	  var VML = new Object();
  	
	  if (document.layers) isNS4 = true;
	  if (document.getElementById && document.all) isIE = true;
	  if (document.getElementById && !document.all) isGECKO = true;
  	
  		
	  if (isIE)
	  {
      var agt = navigator.userAgent.toLowerCase();
      var is_major = parseInt(navigator.appVersion);
      var is_minor = parseFloat(navigator.appVersion);

      var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
      var is_ie3    = (is_ie && (is_major < 4));
      var is_ie4    = (is_ie && (is_major >= 4) && (agt.indexOf("msie 4")!=-1) );
      var is_ie5    = (is_ie && (is_major >= 4) && (agt.indexOf("msie 5.0")!=-1) );
      var is_ie5_5  = (is_ie && (is_major >= 4) && (agt.indexOf("msie 5.5") !=-1));
      var is_ie6    = (is_ie && (is_major >= 4) && (agt.indexOf("msie 6.")!=-1) );
      var is_ie7    = (is_ie && (is_major >= 4) && (agt.indexOf("msie 7.")!=-1) );
      var is_ie8    = (is_ie && (is_major >= 4) && (agt.indexOf("msie 8.")!=-1) );

      if (is_ie3) version = 3.0;
      if (is_ie4) version = 4.0;
      if (is_ie5) version = 5.0;
      if (is_ie5_5) version = 5.5;
      if (is_ie6) version = 6.0;
      if (is_ie7) version = 7.0;
      if (is_ie8) version = 8.0;

      if (targetBrowser.vml)
      {
	      VML = new component("VML", "{10072CEC-8CC1-11D1-986E-00A0C955B42F}");
	      //alert(VML.version);
      }
	  }
  			
	  if (!targetBrowser.msie && isIE) return (false);
	  if (!targetBrowser.gecko && isGECKO) return (false);
	  if (!targetBrowser.ns4 && isNS4) return (false);
  	
	  if (isIE && targetBrowser.version > version) return (false);
  	
	  if (targetBrowser.vml && !isIE) return (false);
	  if (targetBrowser.vml && !VML.componentVersion) return (false);    
  	    
	  return (true);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "checkBrowser", "Section1")
  }
}

/* ============================ GTWebDataGrid.js ===========================*/
window.WebDataGridCollection = new Object();
window.WebDataGridArray = new Array();
function LoadGrids()
{
  try
  { 
    EnsureWebForm();
    EnsureWebControl();
    for (var i = 0; i < WebDataGridObjects.length; i++)
    {
      var webDataGridContainer = document.getElementById(WebDataGridObjects[i])
      var webDataGrid = new WebDataGrid(webDataGridContainer);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "LoadGrids", "");
  }
}

function WebDataGrid(webDataGridContainer, oMasterRecord)
{
  try
  {
    this.Container = webDataGridContainer;
    this.Container.JsInstance = this;
    this.ObjectID = this.Container.id;
    this.ClientID = this.Container.id;
    this.ClassType = "WebDataGrid";
    
    this.TableDescriptorFqn = WebControl.GetTableDescriptorFqn(this.Container);
    this.ReportName = this.Container.getAttribute("ReportName");
    this.oMasterRecord = oMasterRecord;

    this.MenuBar = this.Container.getAttribute("MenuBar");
    this.RecordInfoSkin = Ilp.HtmlDom.GetAttribute(this.Container, "RecordInfoSkin", "None");

    this.AllowEdit = Ilp.HtmlDom.GetAttributeBool(this.Container, "AllowEdit", true);
    this.AllowNew = Ilp.HtmlDom.GetAttributeBool(this.Container, "AllowNew", true);
    this.AllowDelete = Ilp.HtmlDom.GetAttributeBool(this.Container, "AllowDelete", true);
    this.AllowCopy = Ilp.HtmlDom.GetAttributeBool(this.Container, "AllowCopy", true);

    this.ShowAlternatingColors = Ilp.HtmlDom.GetAttributeBool(this.Container, "ShowAlternatingColors", false);
    
    this.ShowRecordInfo = WebDataGrid_ShowRecordInfo;

    this.oDebugInfo = document.getElementById("DebugInfo");

    this.FocusFqn = Ilp.HtmlDom.GetAttribute(this.Container, "FocusFqn", "");

    this.UpdateControlBinding = WebDataGrid_UpdateControlBinding;

    this.SetNextPagingLinkDescriptor = WebDataGrid_SetNextPagingLinkDescriptor;
    this.Clear = WebDataGrid_Clear;
    this.ClearChildGrids = WebDataGrid_ClearChildGrids
    this.RemoveRecord = WebDataGrid_RemoveRecord;
    this.DeleteRecord = WebDataGrid_DeleteRecord;
    this.DeleteRecordByRecord = WebDataGrid_DeleteRecordByRecord;
    this.PrintRecord = WebDataGrid_PrintRecord;
    this.ShowReport = WebDataGrid_ShowReport;
    this.GoToRecord = WebDataGrid_GoToRecord;
    this.AddRecord = WebDataGrid_AddRecord;

    this.ClipCopy = WebDataGrid_ClipCopy;
    this.ClipPaste = WebDataGrid_ClipPaste;
    
    this.ShowSearch = WebDataGrid_ShowSearch;
    this.ToggleSearch = WebDataGrid_ToggleSearch;
    this.GetChildGrid = WebDataGrid_GetChildGrid;
    
    this.InsertRecord = WebDataGrid_InsertRecord;
    this.InsertCopy = WebDataGrid_InsertCopy;
    this.NewRecord = WebDataGrid_NewRecord;
    this.NewRecordOnly = WebDataGrid_NewRecordOnly;
    this.CopyRecord = WebDataGrid_CopyRecord;
    this.GetData = WebDataGrid_GetData;
    this.Hide = WebDataGrid_Hide;
    this.Show = WebDataGrid_Show;
    
    this.HideHeader = WebDataGrid_HideHeader;
    this.ShowHeader = WebDataGrid_ShowHeader;
    
    this.FillWebControls = WebDataGrid_FillWebControls;
    this.FillWebControlsT = WebDataGrid_FillWebControlsT;
    this.FillWebControlsR = WebDataGrid_FillWebControlsR;
    this.ToggleChapter = WebDataGrid_ToggleChapter;
    this.CollapseChapter = WebDataGrid_CollapseChapter;
    this.ExpandChapter = WebDataGrid_ExpandChapter;
    this.CollapseChapterDeep = WebDataGrid_CollapseChapterDeep;
    this.ExpandChapterDeep = WebDataGrid_ExpandChapterDeep;
    this.MergeRecordList = WebDataGrid_MergeRecordList;
    this.MergeRecord = WebDataGrid_MergeRecord;
    this.AppendTBody = WebDataGrid_AppendTBody;
    this.RemoveTBody = WebDataGrid_RemoveTBody;
    this.FindHeaderTables = WebDataGrid_FindHeaderTables;
    this.FindFooterTables = WebDataGrid_FindFooterTables;
    this.CreatePagingLinks = WebDataGrid_CreatePagingLinks;
    this.GetPagingInfoItemList = WebDataGrid_GetPagingInfoItemList;
    this.SetHeaderMessage = WebDataGrid_SetHeaderMessage;
    this.BindHeaderOrFooter = WebDataGrid_BindHeaderOrFooter;
    this.ProcessClick = WebDataGrid_ProcessClick;
    this.Toggle = WebDataGrid_Toggle;
    this.ShowTotal = WebDataGrid_ShowTotal;
    this.LoadData = WebDataGrid_LoadData;
    this.HideCurrentRows = WebDataGrid_HideCurrentRows;
    this.ShowCurrentRows = WebDataGrid_ShowCurrentRows;
    this.TogglePageLink = WebDataGrid_TogglePageLink;
    this.GetColumnHeaderRows = WebDataGrid_GetColumnHeaderRows;
    this.SetColumnHeaderRows = WebDataGrid_SetColumnHeader;
    this.ShowCounters = WebDataGrid_ShowCounters;
    this.HideTBodies = WebDataGrid_HideTBodies;
    this.SetFocus = WebDataGrid_SetFocus;
    this.Rebind = WebDataGrid_Rebind;
    this.RebindChildGrids = WebDataGrid_RebindChildGrids;
    this.ApplyResources = WebDataGrid_ApplyResources;
    
    this.SetTableDescriptorFqn = WebDataGrid_SetTableDescriptorFqn;

    this.GetChildGrids = WebDataGrid_GetChildGrids;
    this.ChildGridSetIf = WebDataGrid_ChildGridSetIf;
    this.ReloadGrid = WebDataGrid_ReloadGrid;
    this.ReloadChildGrid = WebDataGrid_ReloadChildGrid;
    this.ReloadMasterRecord = WebDataGrid_ReloadMasterRecord;
    
    this.ProcessContextClick = WebDataGrid_ProcessContextClick;
    this.ShowContextMenu = WebDataGrid_ShowContextMenu;
    this.GoToTopOfPage = WebDataGrid_GoToTopOfPage;
    this.GoToTopOfGrid = WebDataGrid_GoToTopOfGrid;
    
    this.SetCurrentTabPage = WebDataGrid_SetCurrentTabPage;  
    this.EditRecordInDialog = WebDataGrid_EditRecordInDialog;  
    this.SelectRecordInDialog = WebDataGrid_SelectRecordInDialog;  
    this.FindPagingLinkDescriptor = WebDataGrid_FindPagingLinkDescriptor;

    this.DropDownMenuCollection = new Object();
    this.ContextControl = null;
    
    
    this.CollapsePagingHeader = WebDataGrid_CollapsePagingHeader;
    this.ExpandPagingHeader = WebDataGrid_ExpandPagingHeader;
    this.PagingHeaderCollapsed = false;
    
    this.CollapseFooter = WebDataGrid_CollapseFooter;
    this.ExpandFooter = WebDataGrid_ExpandFooter;
    this.FooterCollapsed = false;
    
    this.Total = 0;
    this.TotalCaption = "";
    this.InfoLabel = null;
    this.ToggleButton = null;
    this.NewButton = null;

    this.PreviousPagingLinkDescriptor = null; 
    this.CurrentPagingLinkDescriptor = null; 
    this.NextPagingLinkDescriptor = null;   

    this.WebPagingHeader = null;
    this.PagingContainerHeader = null;
    this.PagingAreaHeader = null;
    this.MessageTable = null;
    
    this.WebPagingFooter = null;
    this.PagingContainerFooter = null;
    this.PagingAreaFooter = null;

    this.ColumnHeaderRows = new Array();
    this.PagingLinkDescriptorList = new WebArray();
    
    this.ChildGridCollection = new Object();
    this.ChildGridArray = new Array();

    this.MenuStripArray = new Array();

    this.ToggleChapterOnStart = this.Container.getAttribute("ToggleChapterOnStart") == "false" ? false : true;
    this.oToggledBodies = new Array();
    
    this.oTable = WebControl.GetDomElementByTagName(this.Container, "TABLE");
    this.oTHead = this.oTable.tHead;
    this.oTFoot = this.oTable.tFoot;
    
    this.Container.ContainerWidth = WebControl.CalculateTableWidth(this.oTable);
        
    var firstTBody = this.oTable.tBodies[0];

    firstTBody.ClientBoundControlArray = new Array();
    WebControl.FindClientBoundControls(firstTBody, firstTBody);
    
    var localArray = firstTBody.ClientBoundControlArray;
    for (var i = 0, len = localArray.length; i < len; i++)
    {
      var oTarget = firstTBody.ClientBoundControlArray[i];
      oTarget.setAttribute("NamingID", this.ClientID);
    }  

    this.oTBodyClone = document.createElement("TBODY");
    var rows = firstTBody.rows;
    
    for (var i = 0, len = rows.length; i < len; i++)
    {
      var row = rows[i].cloneNode(true);
      this.oTBodyClone.appendChild(row);
    }
    
    this.SingleLineLayout = false;
    if (rows.length == 1) this.SingleLineLayout = true;
    if (oMasterRecord == null) this.ChildGridLevel = 0;

    this.RowGroup = new Array();
    for (var i = 0, len = rows.length; i < len; i++)
    {
      this.RowGroup[i] = rows[i].cloneNode(true);
    }
    
    this.TBodyCounter = 0;
    WebControl.AddKpiLogMessage(new Date(), "WebDataGrid", "TableDescriptorFqn: " + this.TableDescriptorFqn);
    this.StartTime = new Date();

    this.OnBeforeClipCopyHandler = eval(this.Container.getAttribute("OnBeforeClipCopyHandler"));
    this.OnBeforeClipPasteHandler = eval(this.Container.getAttribute("OnBeforeClipPasteHandler"));

    this.OnBeforeNewRecordHandler = eval(this.Container.getAttribute("OnBeforeNewRecordHandler"));
    this.OnAfterNewRecordHandler = eval(this.Container.getAttribute("OnAfterNewRecordHandler"));
    
    this.OnBeforeCopyRecordHandler = eval(this.Container.getAttribute("OnBeforeCopyRecordHandler"));
    this.OnAfterCopyRecordHandler = eval(this.Container.getAttribute("OnAfterCopyRecordHandler"));

    this.OnAfterLoadInitialData = null;

    this.OnPrintSelectionHandler = eval(this.Container.getAttribute("OnPrintSelectionHandler"));
    this.OnGoToHandler = eval(this.Container.getAttribute("OnGoToHandler"));
    
    this.OnAfterToggleBodyHandler = eval(this.Container.getAttribute("OnAfterToggleBodyHandler"));
    this.OnAfterToggleSearchContainerHandler = eval(this.Container.getAttribute("OnAfterToggleSearchContainerHandler"));

    this.OnBeforeEditRecordHandler = eval(this.Container.getAttribute("OnBeforeEditRecordHandler"));
    this.OnAfterEditRecordHandler = eval(this.Container.getAttribute("OnAfterEditRecordHandler"));
    
    this.OnBeforeMoveRecordHandler = eval(this.Container.getAttribute("OnBeforeMoveRecordHandler"));
    this.OnAfterMoveRecordHandler = eval(this.Container.getAttribute("OnAfterMoveRecordHandler"));

    this.OnBeforeDeleteRecordHandler = eval(this.Container.getAttribute("OnBeforeDeleteRecordHandler"));
    this.OnAfterDeleteRecordHandler = eval(this.Container.getAttribute("OnAfterDeleteRecordHandler"));

    this.OnBeforeSelectRecordHandler = eval(this.Container.getAttribute("OnBeforeSelectRecordHandler"));
    this.OnAfterSelectRecordHandler = eval(this.Container.getAttribute("OnAfterSelectRecordHandler"));

    this.ShowTotalInStatusBar = Ilp.HtmlDom.GetAttributeBool(this.Container, "ShowTotalInStatusBar", "true");
    this.EnableDebugging = Ilp.HtmlDom.GetAttributeBool(this.Container, "EnableDebugging", "false");
    this.LockHeader = Ilp.HtmlDom.GetAttributeBool(this.Container, "LockHeader", "false");
    
    this.EditModal = Ilp.HtmlDom.GetAttribute(this.Container, "EditModal", "true");
    this.EditDialogUrl = Ilp.HtmlDom.GetAttribute(this.Container, "EditDialogUrl", "");
    this.EditDialogFeatures = Ilp.HtmlDom.GetAttribute(this.Container, "EditDialogFeatures", "");

    this.CopyModal = Ilp.HtmlDom.GetAttribute(this.Container, "CopyModal", "true");
    this.CopyDialogUrl = Ilp.HtmlDom.GetAttribute(this.Container, "CopyDialogUrl", "");
    this.CopyDialogFeatures = Ilp.HtmlDom.GetAttribute(this.Container, "CopyDialogFeatures", "");
      
    this.MoveModal = Ilp.HtmlDom.GetAttribute(this.Container, "MoveModal", "true");
    this.MoveDialogUrl = Ilp.HtmlDom.GetAttribute(this.Container, "MoveDialogUrl", "");
    this.MoveDialogFeatures = Ilp.HtmlDom.GetAttribute(this.Container, "MoveDialogFeatures", "");

    this.CopyAndMoveModal = Ilp.HtmlDom.GetAttribute(this.Container, "CopyAndMoveModal", "true");
    this.CopyAndMoveDialogUrl = Ilp.HtmlDom.GetAttribute(this.Container, "CopyAndMoveDialogUrl", "");
    this.CopyAndMoveDialogFeatures = Ilp.HtmlDom.GetAttribute(this.Container, "CopyAndMoveDialogFeatures", "");
      
    this.SelectionDescriptorFqn = this.Container.getAttribute("SelectionDescriptorFqn");
    if (this.SelectionDescriptorFqn == null) this.SelectionDescriptorFqn = "";

    this.SelectDialogUrl = this.Container.getAttribute("SelectDialogUrl");
    if (this.SelectDialogUrl == null) this.SelectDialogUrl = "GlobalScripts/GTCommon/TableSelection.aspx";

    this.SelectDialogFeatures = this.Container.getAttribute("SelectDialogFeatures");
    if (this.SelectDialogFeatures == null) this.SelectDialogFeatures = "dialogWidth:830px;dialogHeight:580px;scroll:Yes;status:No;resizable:Yes";

    WebControl.RemoveTBodies(this.oTable);
    
    if (this.oMasterRecord == null)
    {
      window.WebDataGridCollection[this.ClientID] = this;
      window.WebDataGridArray[window.WebDataGridArray.length] = this;
    }
    
    this.UseFilter = false;
    if (RootID == RootID_NetInventory 
        || RootID == RootID_eCon
        || RootID == RootID_eCos
        || RootID == RootID_IlpSite) 
    {
      this.UseFilter = true;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid", "");
  }
}

function WebDataGrid_Clear()
{
  try
  {
    this.ChildGridArray = new Array();
    this.MenuStripArray = new Array();
    WebControl.RemoveTBodies(this.oTable);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_Clear", "Section1")
  }
};

function WebDataGrid_ClearChildGrids()
{
  try
  {
    for (var i = 0, len = this.ChildGridArray.length; i < len; i++)
    {
      this.ChildGridArray[i].Clear();
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_ClearChildGrids", "Section1")
  }
};

function WebDataGrid_RemoveRecord(sender, silent)
{
  try
  {
    if (silent || (WebData.AskDelete() == true))
    {
      WebData.RemoveRecord(sender.oRecord);
      
      var oParent = sender.oTBody.parentElement;
      oParent.removeChild(sender.oTBody);
      
      this.ShowTotal();
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_RemoveRecord", "");
  }
};

function WebDataGrid_DeleteRecordByRecord(oRecord)
{
  try
  { 
    var sender = new Object();
    sender.oRecord = oRecord;
    sender.oTBody = WebControl.GetTBody(oRecord);
    this.DeleteRecord(sender);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_DeleteRecordByRecord", "");
  }
};

function WebDataGrid_DeleteRecord(sender)
{
  try
  { 
    var silent = false;
    var continueProgram = true;
    var deleteDescriptor = FormDescriptor.GetDeleteDescriptor(sender.oRecord.nodeName);
    if (deleteDescriptor != null)
    {
      WebControl.SetDisabled(sender);
      silent = true;
    }
    
    var args = new EventArgs();
    args.oRecord = sender.oRecord;
    
    if (typeof(this.OnBeforeDeleteRecordHandler) == "function")
    {
      this.OnBeforeDeleteRecordHandler(sender, args);
    }
  
    if (args.Cancel == false)
    {
      args.Deleted = false;
      
      if (silent == false)
      {
        var tableDescriptor = FormDescriptor.GetTableDescriptor(sender.oRecord.nodeName);
        if (tableDescriptor.getAttribute("DeleteClass") == "PagedDetailDelete")
        {
          if (WebData.AskDeleteIrrevocably() == false)
          {
            continueProgram = false; 
          }
        }
        else
        {
          if (WebData.AskDelete() == false)
          {
            continueProgram = false; 
          }
        }
      }
      
      if (continueProgram == true)
      {
        if (WebData.Delete(sender.oRecord) == true)
        {
          args.Deleted = true;
        }
      }
    }
    
    if (args.Deleted == true)
    {
      this.RemoveTBody(sender);
      this.ShowTotal();
      
      if (this.oMasterRecord && this.NewButton)
      {
        var controlTemplateWrapper = WebControl.Controls.GetInstance(this.NewButton);
        var recordWrapper = WebControl.Records.GetInstance(this.oMasterRecord)
        WebControl.SetIf(this.NewButton, controlTemplateWrapper, recordWrapper);
      }
     
      if (typeof(this.OnAfterDeleteRecordHandler) == "function")
      {
        this.OnAfterDeleteRecordHandler(sender, args);
      }
    }
    
    if (deleteDescriptor != null)
    {
      WebControl.SetEnabled(sender);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_DeleteRecord", "");
  }
};

function WebDataGrid_PrintRecord(sender)
{
  try
  { 
    if (typeof(this.OnPrintSelectionHandler) == "function")
    {
      var args = new EventArgs();
      this.OnPrintSelectionHandler(sender, args);
    }
    else
    {
      WebMessage.ShowReport(this.TableDescriptorFqn, this.ReportName);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_PrintRecord", "");
  }
};

function WebDataGrid_ShowReport(sender)
{
  try
  { 
    WebMessage.ShowReport(this.TableDescriptorFqn, this.ReportName);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_PrintRecord", "");
  }
};

function WebDataGrid_GoToRecord(sender)
{
  try
  { 
    if (typeof(this.OnGoToHandler) == "function")
    {
      var args = new EventArgs();
      this.OnGoToHandler(sender, args);
    }
    else
    {
      WebControl.Post(sender);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_GoToRecord", "");
  }
};

function WebDataGrid_AddRecord(oRecord)
{
  try
  { 
    var oTBody = this.AppendTBody(this.Container, "append", oRecord);
    this.MergeRecord(oRecord, oTBody);
    
    WebData.SetCurrentRecord(oRecord);
      
    this.ShowTotal();
    this.SetFocus(oRecord, oTBody);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_AddRecord", "");
  }
};

function WebDataGrid_InsertRecord(sender)
{
  try
  { 
    this.NewRecord(sender, "insert");
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebDataGrid_InsertRecord", "");
  }
};

function WebDataGrid_InsertCopy(sender)
{
  try
  { 
    this.CopyRecord(sender, "insert");
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebDataGrid_InsertCopy", "");
  }
};

function WebDataGrid_NewRecord(sender, mode)
{
  try
  { 
    var args = new EventArgs();
    args.WebDataGrid = this;
    
    if (typeof(this.OnBeforeNewRecordHandler) == "function")
    {
      this.OnBeforeNewRecordHandler(sender, args);
    }
    
    if (args.Cancel == false)
    {
      if (this.oMasterRecord) this.ExpandChapter();

      if (this.EditDialogUrl.length > 0)
      { 
        var iEditDialog = new IEditDialogClass(this);
        var argsTemp = this.EditRecordInDialog(sender, Verb_New, new IGridDialogClass(iEditDialog));
        var oRecordNew = argsTemp.oRecordNew;

        if (oRecordNew)
        {
          this.SetColumnHeaderRows("block");
        }
      }
      else
      {
        WebStatusBar.SetDataChangedMessage(ids_DataChanged, 1);
        this.SetColumnHeaderRows("block");
      
        var argsTemp = new EventArgs();
        var oRecordNew = this.NewRecordOnly(sender, mode, argsTemp);
      }
      
      if (oRecordNew)
      {
        WebData.SetCurrentRecord(oRecordNew);
      
        this.ShowTotal();
        this.SetFocus(oRecordNew, argsTemp.oTBody);
        
        if (this.oMasterRecord && this.NewButton)
        {
          var controlTemplateWrapper = WebControl.Controls.GetInstance(this.NewButton);
          var recordWrapper = WebControl.Records.GetInstance(this.oMasterRecord)
          WebControl.SetIf(this.NewButton, controlTemplateWrapper, recordWrapper);
        }  
      
        if (typeof(this.OnAfterNewRecordHandler) == "function")
        {
          args.oRecord = oRecordNew;
          this.OnAfterNewRecordHandler(sender, args);
        }
      }
    }
    return oRecordNew;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_NewRecord", "");
  }
};

function WebDataGrid_NewRecordOnly(sender, mode, argsTemp)
{
  try
  {
    if (argsTemp == null) argsTemp = new EventArgs();
  
    argsTemp.oRecordNew = WebData.NewRecord(this.TableDescriptorFqn);
    argsTemp.oRecordNew = WebData.AddRecord(argsTemp.oRecordNew, this.oMasterRecord, sender.oRecord);

    argsTemp.oTBody = this.AppendTBody(sender, mode, argsTemp.oRecordNew);
    this.MergeRecord(argsTemp.oRecordNew, argsTemp.oTBody);
    
    return argsTemp.oRecordNew;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_NewRecordOnly", "");
  }
};

function WebDataGrid_CopyRecord(sender, mode)
{
  try
  { 
    var oRecordNew = null;

    mode = mode == null ? "append" : mode;
    
    var args = new EventArgs();
    args.WebDataGrid = this;

    if (typeof(this.OnBeforeCopyRecordHandler) == "function")
    {
      this.OnBeforeCopyRecordHandler(sender, args);
    }

    if (args.Cancel == false)
    {
      oRecordNew = WebData.CopyRecord(sender.oRecord);
      if( mode == "insert")
      {
        oRecordNew = WebData.AddRecord(oRecordNew, this.oMasterRecord, sender.oRecord);
      }
      else
      {
        oRecordNew = WebData.AddRecord(oRecordNew, this.oMasterRecord);
      }
      
      var tableTBody = this.AppendTBody(sender, mode, oRecordNew);    
      this.MergeRecord(oRecordNew, tableTBody);
      WebData.SetCurrentRecord(oRecordNew);
      WebStatusBar.SetDataChangedMessage(ids_DataChanged, 1);
      
      this.ShowTotal();
      this.SetFocus(oRecordNew, tableTBody);
    
      if (typeof(this.OnAfterCopyRecordHandler) == "function")
      {
        var args = new EventArgs();
        args.oRecord = oRecordNew;
        this.OnAfterCopyRecordHandler(sender, args);
      }
    }
        
    return oRecordNew;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_CopyRecord", "");
  }
};

function WebDataGrid_GetData()
{
  try
  { 
    WebData.GetData();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_GetData", "")
  }
};

function WebDataGrid_ShowHeader()
{
  try
  { 
    /*
    this.PagingContainerHeader.runtimeStyle.display = "block";
    */
    Ilp.HtmlDom.SetStyle(this.PagingContainerHeader, "display", "block");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_ShowHeader", "Section1")
  }
};

function WebDataGrid_HideHeader()
{
  try
  { 
    /*
    this.PagingContainerHeader.runtimeStyle.display = "none";
    */
    Ilp.HtmlDom.SetStyle(this.PagingContainerHeader, "display", "none");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_HideHeader", "Section1")
  }
};

function WebDataGrid_Hide()
{
  try
  { 
    /*
    this.Container.runtimeStyle.display = "none";
    */
    Ilp.HtmlDom.SetStyle(this.Container, "display", "none");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_Hide", "Section1")
  }
};

function WebDataGrid_Show()
{
  try
  { 
    /*
    this.Container.runtimeStyle.display = "block";
    */
    Ilp.HtmlDom.SetStyle(this.Container, "display", "block");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_Show", "Section1")

  }
};


function WebDataGrid_FillWebControls()
{
  try
  { 
    WebStatusBar.SetStatusbarMessage(ids_LoadingData, 0);

    this.Hide();
    window.setTimeout("window.WebDataGridCollection[\"" + this.ClientID + "\"].FillWebControlsT();", 100);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_FillWebControls", "Section1")
  }
};

function WebDataGrid_FillWebControlsT()
{
  try
  { 
    this.ChildGridArray = new Array();
    this.MenuStripArray = new Array();
    this.FillWebControlsR();
    this.ShowCounters();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_FillWebControlsT", "Section1")
  }
};

function WebDataGrid_FillWebControlsR(oRecordList)
{
  try
  { 
    WebControl.AddKpiLogMessage(new Date(), "WebDataGrid_FillWebControlsR", "TableDescriptorFqn: " + this.TableDescriptorFqn);
    this.StartTime = new Date();

    if (oRecordList == null)
    {
      oRecordList = WebData.Select(this.TableDescriptorFqn);
    }
  
    this.PagingLinkDescriptorList.Clear();  
    
    this.PreviousPagingLinkDescriptor = null; 
    this.CurrentPagingLinkDescriptor = null; 
    this.NextPagingLinkDescriptor = null; 
      
    if (this.oTHead != null)
    {
      this.FindHeaderTables();
      this.CreatePagingLinks(oRecordList, this.PagingAreaHeader);
      this.SetHeaderMessage(oRecordList);
      
      this.BindHeaderOrFooter(this.oTHead);
    }
    if (this.oTFoot != null)
    {
      this.FindFooterTables(oRecordList);
      this.CreatePagingLinks(oRecordList, this.PagingAreaFooter);
    
      this.BindHeaderOrFooter(this.oTFoot);
    }
    
    WebControl.RemoveTBodies(this.oTable);
    
    this.SetColumnHeaderRows("none");
    this.MergeRecordList(oRecordList);
    this.SetCurrentTabPage();
      
    if (oRecordList.length > 0)
    {
      WebData.SetCurrentRecord(oRecordList[0]);
    }
    
    if (typeof(this.OnAfterLoadInitialData) == "function")
    {
      var args = new EventArgs();
      this.OnAfterLoadInitialData(this, args);
    }
    
    this.Show();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_FillWebControlsR", "Section1")
  }
};

function WebDataGrid_ToggleChapter(sender)
{
  try
  { 
    if (sender == null) return;
    
    var oContainer = sender.oContainer;
    if (this.CurrentPagingLinkDescriptor)
    {
      if (this.CurrentPagingLinkDescriptor.Hidden == false)
      {
        this.HideCurrentRows(false);
        this.CollapsePagingHeader();
        this.CollapseFooter();
      }
      else
      {
        this.ShowCurrentRows(false);
        this.ExpandPagingHeader();
        this.ExpandFooter();
      }
    }
    else
    {
      if (this.oToggledBodies.length == 0)
      {
        this.CollapseChapter();
      }
      else
      {
        this.ExpandChapter();
      }
    }
    if (typeof(this.OnAfterToggleBodyHandler) == "function")
    {
      var args = new EventArgs();
      this.OnAfterToggleBodyHandler(sender, args);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_ToggleChapter", "Section1")
  }
}

function WebDataGrid_CollapseChapter()
{
  try
  {
    if (this.CurrentPagingLinkDescriptor)
    {
      this.HideCurrentRows();
    }
    else
    {
      var oContainer = this.ToggleButton.oContainer;
      var oTBody = null;
      var tBodies = oContainer.oTable.tBodies;
      for (var i = 0, len = tBodies.length; i < len; i++)
      {
        oTBody = tBodies[i];
        Ilp.HtmlDom.SetStyle(oTBody, "display", "none");
        this.oToggledBodies[this.oToggledBodies.length] = oTBody;
      }
      WebControl.SetTrueImage(this.ToggleButton);
      this.SetColumnHeaderRows("none");
    }
    this.CollapsePagingHeader();
    this.CollapseFooter();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_CollapseChapter", "Section1")
  }
}

function WebDataGrid_ExpandChapter()
{
  try
  { 
    if (this.CurrentPagingLinkDescriptor)
    {
      this.ShowCurrentRows();
    }
    else
    {
      for (var i = 0, len = this.oToggledBodies.length; i < len; i++)
      {
        oTBody = this.oToggledBodies[i];
        Ilp.HtmlDom.SetStyle(oTBody, "display", "block");
      }
      WebControl.SetFalseImage(this.ToggleButton);
      this.oToggledBodies = new Array();
      this.SetColumnHeaderRows("block");
    }  
    this.ExpandPagingHeader();
    this.ExpandFooter();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_ExpandChapter", "Section1")
  }
}

function WebDataGrid_CollapseChapterDeep()
{
  try
  {
    if (this.ToggleButton)
    {
      this.CollapseChapter();
    }  
    for (var i = 0, len = this.ChildGridArray.length; i < len; i++)
    {
      this.ChildGridArray[i].CollapseChapter();
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_CollapseChapterDeep", "Section1")
  }
}

function WebDataGrid_ExpandChapterDeep()
{
  try
  {
    if (this.ToggleButton)
    {
      this.ExpandChapter();
    }  
    for (var i = 0; i < this.ChildGridArray.length; i++)
    {
      this.ChildGridArray[i].ExpandChapter();
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_ExpandChapterDeep", "Section1")
  }
}


function WebDataGrid_MergeRecordList(recordList)
{
  try
  { 
    this.DropDownMenuCollection = new Object();
    this.ContextControl = null;
    
    if (this.CurrentPagingLinkDescriptor)
    {
      this.CurrentPagingLinkDescriptor.Hidden = false;
    }
    
    for (var i = 0, len = recordList.length; i < len; i++)
    {
      //WebControl.AddKpiLogMessage(new Date(), "WebDataGrid_MergeRecordList", "RecNo (" + this.TableDescriptorFqn + "): " + String(i));

      var tableTBody = this.AppendTBody(null, "append", recordList[i], i);
      this.MergeRecord(recordList[i], tableTBody);
    }
    
    if (this.oMasterRecord)
    {
      if (this.ToggleChapterOnStart == true)
      {
        this.ToggleChapterOnStart = false;
        this.ToggleChapter(this.ToggleButton);
      }
      else
      {
        WebControl.SetFalseImage(this.ToggleButton);
        this.SetColumnHeaderRows("block");
      }
      if (recordList.length == 0) 
      {
        this.CollapsePagingHeader();
        this.CollapseFooter();
      }
      else
      {
        this.ExpandPagingHeader();
        this.ExpandFooter();
      }
      
      this.ShowTotal();
    }
    else
    {
      if (recordList.length > 0) this.SetColumnHeaderRows("block");
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_MergeRecordList", "Section1")
  }
};

function WebDataGrid_MergeRecord(oRecord, oTBody, doMerge)
{
  try
  { 
    if (UseClientResource == true)this.ApplyResources(oTBody, oRecord);
    
    doMerge = doMerge == null ? true : false;
    
    var recordWrapper = null;
    var controlTemplateWrapper = null;
    var args = new EventArgs();
        
    var aRadioButtonList = new Array();    
    var radioButtonHash = new Object();    
    
    var localArray = oTBody.ClientBoundControlArray;
    for (var i = 0, len = localArray.length; i < len; i++)
    {
      var oTarget = localArray[i];
      
      var oObject = new Object();
      oObject.oTBody = oTBody;
      oObject.oRecord = oRecord;
      oObject.oWebDataGrid = this;
      oObject.oContainer = this;
      oObject.oContainerInstance = this;
      oObject.oTable = this.oTable;
      oObject.ObjectID = oTarget.id;
      oObject.BindingIndex = i;
      oObject.id = WebControl.CreateUniqueClientId(oRecord, oTarget.id);
      
      // sort radiobuttonlist objects
      if (oTarget.getAttribute("ControlType") == "RadioButton")
      {
        var oRadioButtonList = radioButtonHash[oTarget.name];
        if ( oRadioButtonList == null )
        {
          oRadioButtonList = new Object();
          oRadioButtonList.Name = oTarget.name;
          oRadioButtonList.oRecord = oRecord;
          aRadioButtonList[aRadioButtonList.length] = oRadioButtonList;
          radioButtonHash[oTarget.name] = oRadioButtonList;
          oRadioButtonList.aRadioButtons = new Array();
        }
        oRadioButtonList.aRadioButtons[oRadioButtonList.aRadioButtons.length] = oTarget;
        oObject.name = oTarget.name;
      }
      else
      {
        oObject.name = oObject.id;
      }
      
      WebControl.MergeAttachedObjects(oObject, oTarget);
      
      controlTemplateWrapper = WebControl.Controls.GetInstance(oTarget);
      recordWrapper = WebControl.Records.GetInstance(oTarget.oRecord);
            
      var removed = false;
      var removeIf = oTarget.getAttribute("RemoveIf");
      if (typeof(removeIf) == "string")
      {
        if (removeIf.length > 0)
        {
          WebControl.CheckGalaxy(oTarget);
          eval(removeIf);
          
          if (WebData.ReturnIf == true)
          {
            if (oTarget.oGalaxy == null)
            {
              WebControl.RemoveControl(oTarget);
            }
            else
            {
              WebControl.RemoveControl(oTarget.oGalaxy);
            }
            WebData.ReturnIf = false;
            removed = true;
          }
        }
      }
      if (removed == false)
      {
        WebControl.SetEventHandler(oTarget);
        if ((controlTemplateWrapper.HasFqn == true || controlTemplateWrapper.RunMergeData == true) && doMerge == true)
        {
          WebControl.MergeData(this, oTarget, oRecord, true, controlTemplateWrapper, recordWrapper);
        }
        else
        {
          WebControl.SetIf(oTarget, controlTemplateWrapper, recordWrapper);
        }
        if (controlTemplateWrapper.ControlType != "RadioButton")
        {
          WebControl.CheckChangeTracking(oTarget, oRecord);
        }  

        if (controlTemplateWrapper.IsValidator == true)
        {
          Ilp.HtmlDom.SetStyle(oTarget, "opacity", 0.15);
        }
        if (controlTemplateWrapper.IsDeleteButton == true)
        {
          if ( ! (WebData.GetRowState(oTarget.oRecord) == "inserted"))
          {
            var allowDelete = ! ((this.AllowDelete == false) || !WebControl.IsDeletable(oTarget, oRecord, controlTemplateWrapper, recordWrapper));
            if (allowDelete == false) WebControl.SetDisabled(oTarget);
          }
        }
        else if (controlTemplateWrapper.IsCopyButton == true)
        {
          var allowCopy = ! ((this.AllowCopy == false) || !WebControl.IsCopyable(oTarget, oRecord, controlTemplateWrapper, recordWrapper));
          if (allowCopy == false) WebControl.SetDisabled(oTarget);
        }
        else if (controlTemplateWrapper.IsInsertButton == true)
        {
          var allowInsert = ! ((this.AllowEdit == false) || !WebControl.IsEditable(oTarget, oRecord, controlTemplateWrapper, recordWrapper));
          if (allowInsert == false) WebControl.SetDisabled(oTarget);
        }
      }
    }  
    
    // recreate radiobutton objects
    for (var i = 0; i < aRadioButtonList.length ; i++)
    {
      var oRadioButtonList = aRadioButtonList[i];
      var uniqueName = WebControl.CreateUniqueClientId(oRadioButtonList.oRecord, oRadioButtonList.Name);
      
      if (oRadioButtonList.aRadioButtons.length > 0)
      {
        var oFirstRadioButton = oRadioButtonList.aRadioButtons[0];
        var bindingHash = WebData.GetBindingHash(oFirstRadioButton.oFieldDescriptor.getAttribute("Fqn"), oFirstRadioButton.oRecord);
        if (WebControl.FieldToHtmlObject.Contains(bindingHash) == true) 
        {
          WebControl.FieldToHtmlObject.Set(bindingHash, null);
        }
      }
            
      for  (var j = 0; j < oRadioButtonList.aRadioButtons.length; j++)
      {
        var oOldRadioButton = oRadioButtonList.aRadioButtons[j];
        
        var outerHtml = new String("<INPUT type=\"radio\" name=\"" + uniqueName + "\"");
        outerHtml = oOldRadioButton.checked == true ? outerHtml.concat(" checked=\"checked\"") : outerHtml;
        outerHtml = outerHtml.concat(" value=\"" + oOldRadioButton.value + "\"");
        outerHtml = outerHtml.concat(">");
         
        var oNewRadioButton = document.createElement(outerHtml);

        oOldRadioButton.ObjectID = oOldRadioButton.id;
        oOldRadioButton.BindingIndex = oOldRadioButton.BindingIndex;
        oNewRadioButton.mergeAttributes(oOldRadioButton, true);
        WebControl.MergeAttachedObjects(oOldRadioButton, oNewRadioButton, false);
        WebControl.MergeAttachedEvents(oOldRadioButton, oNewRadioButton);

        var oParent = oOldRadioButton.parentElement;
        oNewRadioButton = oParent.insertBefore(oNewRadioButton, oOldRadioButton);
        oParent.removeChild(oOldRadioButton);
        oNewRadioButton.id = oOldRadioButton.id;
        
        WebControl.AddBoundControl(oNewRadioButton.oFieldDescriptor.getAttribute("Fqn"), oNewRadioButton.oRecord, oNewRadioButton);
        WebControl.CheckGalaxy(oNewRadioButton);
        oTBody.ClientBoundControlArray[oOldRadioButton.BindingIndex] = oNewRadioButton;
        if (j == 0)
        {
          WebControl.CheckChangeTracking(oNewRadioButton.oGalaxy, oRecord);
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_MergeRecord", "Section1")
  }
};

function WebDataGrid_AppendTBody(sender, mode, oRecord, index)
{
  try
  {
    mode = mode == null ? "append" : mode;
  
    var tableTBody = null;
    if (sender != null && sender.oTBody != null && sender.oTBody.nextSibling != null && mode == "insert")
    {
       tableTBody = WebControl.AddTBody(this.oTable, this.oTBodyClone, sender.oTBody.nextSibling);
    }
    else
    {
       tableTBody = WebControl.AddTBody(this.oTable, this.oTBodyClone);
    }
    if (oRecord == null)
    {
      tableTBody.id = "TB_" + tableTBody.uniqueID + "_" + String(++this.TBodyCounter);
    }
    else
    {
      tableTBody.id = WebControl.CreateTBodyID(oRecord);
    }
    
    if (this.ShowAlternatingColors == true && this.ChildGridLevel == 1)
    {
      if (index%2 == 0)
      {
        //Ilp.HtmlDom.SetStyle(tableTBody, "backgroundColor", "#D2DCE4");
        Ilp.HtmlDom.SetStyle(tableTBody, "backgroundColor", "#DEDED7");
      }
      else
      {
        //Ilp.HtmlDom.SetStyle(tableTBody, "backgroundColor", "#EDF1F5");
        Ilp.HtmlDom.SetStyle(tableTBody, "backgroundColor", "#F2F2EF");
      }
    }
    
    var cell = null;
    var separator = tableTBody.rows[0];
    if (separator && (Ilp.HtmlDom.HasAttribute(separator, "IsMasterSeperatorRow", "true")
      || Ilp.HtmlDom.HasAttribute(separator, "IsMasterSeparatorRow", "true")))
    {
      var separatorCaption = ids_Record;   
      var oSeparatorDiv = Ilp.HtmlDom.GetFirstDescendantByAttribute(separator, "ControlType", "WebDataRowSeparator");
      if (oSeparatorDiv != null)
      {
        separatorCaption = Ilp.HtmlDom.GetAttribute(oSeparatorDiv, "RecordCaption", ids_Record);
      }
      else
      {
        oSeparatorDiv = Ilp.HtmlDom.GetFirstDescendantByAttribute(separator, "ControlType", "WebDataRowSeperator");
        if (oSeparatorDiv != null)
        {
          separatorCaption = Ilp.HtmlDom.GetAttribute(oSeparatorDiv, "RecordCaption", ids_Record);
        }
      }
      cell = Ilp.HtmlDom.GetFirstDescendantByAttribute(separator, "IsDisplayCell", "true");
      if (cell)
      {
        if (WebData.GetRowState(oRecord) == RS_inserted)
        {
          separatorCaption = separatorCaption.replace("{0}", ids_New + " " + WebData.CountInserted(oRecord.nodeName, this.oMasterRecord));
        }
        else
        {  
          separatorCaption = separatorCaption.replace("{0}", String(index + 1));       
        }
        cell.innerHTML = separatorCaption;
      }
    }

    // Look for all objects to be bound
    tableTBody.ClientBoundControlArray = new Array();
    WebControl.FindNamingIDControls(tableTBody, this);
    
    tableTBody.oTBodyDescriptor = new TBodyDescriptor(this, tableTBody);
    if (this.CurrentPagingLinkDescriptor)
    {
      this.CurrentPagingLinkDescriptor.AddTBodyDescriptor(tableTBody.oTBodyDescriptor);     
    }
    
    return tableTBody;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_AppendTBody", "Section1");
  }
};

function WebDataGrid_RemoveTBody(sender)
{
  try
  {
    if (this.CurrentPagingLinkDescriptor)
    {
      this.CurrentPagingLinkDescriptor.RemoveTBodyDescriptor(sender.oTBody.oTBodyDescriptor);
    }
  
    var oParent = sender.oTBody.parentElement;
    oParent.removeChild(sender.oTBody);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_RemoveTBody", "Section1");
  }
};

function WebDataGrid_FindFooterTables(oRecordList)
{
  try
  {
    if (this.oTFoot == null) return;
    
    if(CssVersion == "GTWeb2")
    {
      var oDivList = this.oTFoot.getElementsByTagName("DIV");
      if (oDivList.length > 0)
      {
        for (var i = 0; i < oDivList.length; i++)
        {
          var oDiv = oDivList[i];
          if (oDiv.getAttribute("IsPagingContainer") == "true")
          {
            this.PagingContainerFooter = oDiv;
            this.WebPagingFooter = new WebPagingClass(this.PagingContainerFooter);
            this.PagingAreaFooter = this.WebPagingFooter.Area;
            this.PagingAreaFooter.JsInstance = this.WebPagingFooter; 
          }
        }
      }
    }
    else
    {
      if (Ilp.HtmlDom.HasChildNodes(this.oTFoot) == true)
      {
        this.PagingContainerFooter = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.oTFoot, "CT", enum_CT_WebDataFooter_PagingContainer);

        if (this.PagingContainerFooter)
        {
          this.WebPagingFooter = new WebPagingClass(this.PagingContainerFooter);
          this.PagingAreaFooter = this.WebPagingFooter.Area;
          this.PagingAreaFooter.JsInstance = this.WebPagingFooter; 
        }
      }
    }      
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_FindFooterTables", "Section1")
  }
};

function WebDataGrid_FindHeaderTables()
{
  try
  {
    this.MessageTable = null; 
    
    var oObject = new Object();
    oObject.oWebDataGrid = this;
    oObject.oContainer = this;
    oObject.oContainerInstance = this;
    oObject.oTable = this.oTable;
    oObject.oMasterRecord = this.oMasterRecord;
    
    if(CssVersion == "GTWeb2")
    {
      var oTableList = this.oTHead.getElementsByTagName("TABLE");
      if (oTableList.length > 0)
      {
        for (var i = 0; i < oTableList.length; i++)
        {
          var oTable = oTableList[i];
          if (oTable.getAttribute("IsMessageTable") == "true")
          {
            this.MessageTable = oTable;
          }
        }
      }
      var oDivList = this.oTHead.getElementsByTagName("DIV");
      if (oDivList.length > 0)
      {
        for (var i = 0; i < oDivList.length; i++)
        {
          var oDiv = oDivList[i];
          if (oDiv.getAttribute("IsPagingContainer") == "true")
          {
            this.PagingContainerHeader = oDiv;
            this.WebPagingHeader = new WebPagingClass(this.PagingContainerHeader);
            this.PagingAreaHeader = this.WebPagingHeader.Area;
            this.PagingAreaHeader.JsInstance = this.WebPagingHeader; 
          }
          else if (oDiv.getAttribute("ControlType") == "WebDataHeader")
          {
            this.WebDataHeader = oDiv;
            WebControl.FindSun(this.WebDataHeader);
          }
          else if (Ilp.HtmlDom.GetAttribute(oDiv, "CT", "0") == enum_CT_NavTree_TabControl)
          {
            this.TabControl = new TabControlClass(oDiv, this);
          }
        }
      }
    }
    else
    {
      if (Ilp.HtmlDom.HasChildNodes(this.oTHead) == true)
      {
        this.MessageTable = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.oTHead, "CT", enum_CT_WebDataHeader_MessageLabel);
        this.PagingContainerHeader = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.oTHead, "CT", enum_CT_WebDataHeader_PagingContainer);

        if (this.PagingContainerHeader)
        {
          this.WebPagingHeader = new WebPagingClass(this.PagingContainerHeader);
          this.PagingAreaHeader = this.WebPagingHeader.Area;
          this.PagingAreaHeader.JsInstance = this.WebPagingHeader; 
        }

        this.WebDataHeader = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.oTHead, "ControlType", "WebDataHeader");
        if (this.WebDataHeader)
        {
          WebControl.FindSun(this.WebDataHeader);
        }
        
        var navTreeContainer = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.oTHead, "CT", enum_CT_NavTree_TabControl);
        if (navTreeContainer)
        {
          this.TabControl = new TabControlClass(navTreeContainer, this);
        }
      }
    }

    if (this.LockHeader == true)
    {
      var oTdList = this.oTHead.getElementsByTagName("TH");
      if (oTdList.length > 0)
      {
        for (var i = 0; i < oTdList.length; i++)
        {
          var oTd = oTdList[i];
          //oTd.style.setExpression("top", "ownerDocument.parentWindow.WebControl.TheBody.scrollTop-2");
          Ilp.HtmlDom.SetExpression(oTd, "top", "ownerDocument.parentWindow.WebControl.TheBody.scrollTop-2");
          Ilp.HtmlDom.SetStyle(oTd, "position", "relative");
          Ilp.HtmlDom.SetStyle(oTd, "zIndex", 20);
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_FindHeaderTables", "Section1")
  }
};

function WebDataGrid_CreatePagingLinks(oRecordList, pagingArea)
{
  try
  {
    var oFirstRow = null;
    var oFirstCell = null;
    var oFirstLink = null;
  
    var oCell = null;
    var oLink = null;
    var oPagingInfoItem = null;
    
    if (pagingArea != null)
    {
      oFirstLink = pagingArea.getElementsByTagName("SPAN")[0].cloneNode(true);
      pagingArea.innerHTML = "";
      pagingArea.appendChild(oFirstLink);
      Ilp.HtmlDom.SetStyle(oFirstLink, "visibility", "hidden");
    }
     
    if (oRecordList.length > 0 && pagingArea != null)
    {
      var ct = Ilp.HtmlDom.GetAttribute(pagingArea.JsInstance.Container, "CT", "");
      var oFirstRecord = oRecordList[0];
      var oPagingInfoItemList = this.GetPagingInfoItemList(oFirstRecord, this.TableDescriptorFqn);
      
      if (oPagingInfoItemList && oPagingInfoItemList.length > 0)
      {
        for (var j = 0; j < oPagingInfoItemList.length; j++)
        { 
          oLink = (j == 0) ? oFirstLink : oFirstLink.cloneNode(true);
          pagingArea.appendChild(oLink);

          Ilp.HtmlDom.SetStyle(oLink, "visibility", "visible");
          oPagingInfoItem = oPagingInfoItemList[j];
          oLink.oPagingInfoItem = oPagingInfoItem;
          Ilp.HtmlDom.SetText(oLink, oPagingInfoItem.getAttribute("Text"));
          oLink.title = oPagingInfoItem.getAttribute("Title");

          oLink.oPagingLinkDescriptor = this.FindPagingLinkDescriptor(oPagingInfoItem);
          if (oLink.oPagingLinkDescriptor == null)
          {
            oLink.oPagingLinkDescriptor = new PagingLinkDescriptor(this, oLink, oPagingInfoItem, false);
            this.PagingLinkDescriptorList.Add(oLink.oPagingLinkDescriptor);
          }
          if (ct == enum_CT_WebDataHeader_PagingContainer)
          {
          }
          else if (ct == enum_CT_WebDataFooter_PagingContainer)
          {
            oLink.oPagingLinkDescriptor.oControl2 = oLink;
          }
          
          if (j == 0) oLink.oPagingLinkDescriptor.Activate();
          else oLink.oPagingLinkDescriptor.Deactivate();
          
          if (j == 0) 
          {
            oLink.oPagingLinkDescriptor.IsLoaded = true;
            this.CurrentPagingLinkDescriptor = oLink.oPagingLinkDescriptor;
          }
        }
        this.Total = Number(oPagingInfoItemList[oPagingInfoItemList.length - 1].getAttribute("CumulativeTotal"));
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_CreatePagingLinks", "Section1")
  }
};
function WebDataGrid_FindPagingLinkDescriptor(oPagingInfoItem)
{    
  var id = oPagingInfoItem.getAttribute("ID"); 
  for(var i = 0; i < this.PagingLinkDescriptorList.Count(); i++)
  {
    var oPagingLinkDescriptor = this.PagingLinkDescriptorList.Array[i];
    var id2 = oPagingLinkDescriptor.oPagingInfoItem.getAttribute("ID");
    if (id == id2)
    {
      return oPagingLinkDescriptor;
    }
  }  
  return null;
}
function WebDataGrid_GetPagingInfoItemList(oFirstRecord, tableDescriptorFqn)
{
  try
  {
    var oPagingInfoItemList = null;
    if (oFirstRecord.parentNode.nodeName == "NewDataSet")
    {
      oPagingInfoItemList = WebMessage.GetPagingInfoItemList(tableDescriptorFqn);
    }
    else
    {
      var dtrd = FormDescriptor.GetRelationByMasterDetail(oFirstRecord.parentNode.nodeName, oFirstRecord.nodeName);
      var parentValueList = "";
      if (dtrd.getAttribute("AutoRelationType") == "AutoRelation")
      {
        var fieldDescriptorList = FormDescriptor.GetPrimaryKeyFieldDescriptorListFromDtrd(dtrd);
        for (var i = 0; i < fieldDescriptorList.length; i++)
        {
          parentValueList += WebData.GetFieldValue(oFirstRecord.parentNode, fieldDescriptorList[i].getAttribute("Fqn"));
          if (i < fieldDescriptorList.length -1) parentValueList += " ";
        }
      }
      oPagingInfoItemList = WebMessage.GetPagingInfoItemList(tableDescriptorFqn, parentValueList);
    }
    
    return oPagingInfoItemList;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_GetPagingInfoItemList", "Section1")
  }
};

function WebDataGrid_SetHeaderMessage(oRecordList)
{
  try
  {
    if (this.MessageTable != null)
    {
      /*
      this.MessageTable.runtimeStyle.display = "none";
      */
      Ilp.HtmlDom.SetStyle(this.MessageTable, "display", "none");
      if (oRecordList.length == 0)
      {
        /*
        this.MessageTable.runtimeStyle.display = "block";
        */
        Ilp.HtmlDom.SetStyle(this.MessageTable, "display", "block");
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_SetHeaderMessage", "Section1")
  }
};

function WebDataGrid_BindHeaderOrFooter(oContainer)
{
  try
  {
    var recordWrapper = null;
    var controlTemplateWrapper = null;
    var args = new EventArgs();

    oContainer.ClientBoundControlArray = new Array();
    WebControl.FindClientBoundControls(oContainer, oContainer);
          
    for (var i = 0; i < oContainer.ClientBoundControlArray.length; i++)
    {
      var removed = false;
      var oTarget = oContainer.ClientBoundControlArray[i];
      var removeIf = oTarget.getAttribute("RemoveIf");
      if (typeof(removeIf) == "string")
      {
        if (removeIf.length > 0)
        {
          eval(removeIf);
          if (WebData.ReturnIf == true)
          {
            WebControl.RemoveControl(oTarget);
            WebData.ReturnIf = false;
            removed = true;
          }
        }
      }
      if (removed == false)
      {
        var oRecord = this.oMasterRecord;
        if (oRecord == null)
        {
          oRecord = WebData.GetRecord(this.TableDescriptorFqn, 0);
        }
        
        var oObject = new Object();
        oObject.oWebDataGrid = this;
        oObject.oContainer = this;
        oObject.oContainerInstance = this;
        oObject.oTable = this.oTable;
        oObject.ObjectID = oTarget.id;
        oObject.oMasterRecord = this.oMasterRecord;
        oObject.oRecord = oRecord;
        oObject.id = WebControl.CreateUniqueClientId(oRecord, oTarget.id);
        
        WebControl.MergeAttachedObjects(oObject, oTarget);
        WebControl.SetEventHandler(oTarget);
        
        if (oRecord != null)
        {
          controlTemplateWrapper = WebControl.Controls.GetInstance(oTarget);
          recordWrapper = WebControl.Records.GetInstance(oTarget.oRecord)
        
          if ((controlTemplateWrapper.HasFqn == true || controlTemplateWrapper.RunMergeData == true))
          {
            WebControl.MergeData(this, oTarget, oRecord, true, controlTemplateWrapper, recordWrapper);
          }  
          else
          {
            WebControl.SetIf(oTarget, controlTemplateWrapper, recordWrapper);
          }
        }  
      }
      
      if (oContainer.tagName == "THEAD")
      {
        if (oTarget.getAttribute("IsInfoLabel") == "true")
        {
          this.InfoLabel = oTarget;
        }
        else if (oTarget.getAttribute("IsToggle") == "true")
        {
          this.ToggleButton = oTarget;
        }
        else if (oTarget.getAttribute("IsNewButton") == "true")
        {
          this.NewButton = oTarget;

          var allowNew = this.AllowNew;
          if (this.oMasterRecord && allowNew == true) allowNew = WebControl.IsNewable(this.NewButton, this.oMasterRecord);
          if (allowNew == false) WebControl.SetDisabled(this.NewButton);
        }
      }
    }
    
    this.GetColumnHeaderRows();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_BindHeaderOrFooter", "Section1")
  }
};

function WebDataGrid_ProcessClick(sender)
{
  try
  {
    switch(sender.getAttribute("ControlType"))
    {
      case "CheckBox":
        switch(sender.getAttribute("CheckBoxType"))
        {
          case "ColumnHeader":
            var controlValue = WebControl.GetValue(sender);
            var oRecordList = WebData.GetChildRecords(this.oMasterRecord, this.TableDescriptorFqn);
            for (var i = 0, len = oRecordList.length; i < len; i++)
            {
              oRecord = oRecordList[i];
              WebData.SetFieldValue(oRecord, oRecord.nodeName + ".Selected", controlValue);
              WebData.UpdateFieldBinding(oRecord, oRecord.nodeName + ".Selected");
            }
            break;
        }
        break;
      case "Label":    
        switch(sender.getAttribute("LabelType"))
        {
          case "TabPageHeader":
            if (sender.disabled == true) alert(ids_NoActionPossible);
            else this.SetCurrentTabPage();
            Ilp.Event.Cancel(sender);
            break;
          default:    
            break;
        }
        break;
      case "DataLink":
        switch(sender.getAttribute("DataLinkType"))
        {
          case "Select":
            var selectionDescriptorFqn = sender.getAttribute("SelectionDescriptorFqn")
            if (selectionDescriptorFqn != null && selectionDescriptorFqn.length > 0) 
            {
              var iSelectDialog = new ISelectDialogClass(sender);
              iSelectDialog.SaveSelection = false;
              this.SelectRecordInDialog(sender, Verb_Select, iSelectDialog);
            }
            Ilp.Event.Cancel(sender);
            break;
          default:    
            break;
        }
        break;
      case "Button":
        switch(sender.getAttribute("ButtonType"))
        {
          case "Select":
            var selectionDescriptorFqn = sender.getAttribute("SelectionDescriptorFqn")
            if (selectionDescriptorFqn != null && selectionDescriptorFqn.length > 0) 
            {
              var iSelectDialog = new ISelectDialogClass(sender);
              iSelectDialog.SaveSelection = false;
              this.SelectRecordInDialog(sender, Verb_Select, iSelectDialog);
            }
            Ilp.Event.Cancel(sender);
            break;
          default:    
            break;
        }
        break;
      case "Image":
        switch(sender.getAttribute("ButtonType"))
        {
          case "NewButton":
            if (sender.disabled == true) alert(ids_NoActionPossible);
            else 
            {
              if (this.EditDialogUrl.length > 0)
              { 
                var iEditDialog = new IEditDialogClass(this);
                this.EditRecordInDialog(sender, Verb_New, new IGridDialogClass(iEditDialog));
              }
              else if (this.SelectionDescriptorFqn.length > 0)
              {
                var iSelectDialog = new ISelectDialogClass(this);
                iSelectDialog.SaveSelection = true;
                this.SelectRecordInDialog(sender, Verb_Select, iSelectDialog);
              }
              else this.NewRecord(sender);    
            }
            Ilp.Event.Cancel(sender);
            break;
          case "CopyButton":
            if (sender.disabled == true) alert(ids_NoActionPossible);
            else this.CopyRecord(sender);
            Ilp.Event.Cancel(sender);
            break;
          case "InsertButton":
            if (sender.disabled == true) alert(ids_NoActionPossible);
            else this.InsertRecord(sender);
            Ilp.Event.Cancel(sender);
            break;
          case "InsertCopyButton":
            if (sender.disabled == true) alert(ids_NoActionPossible);
            else this.InsertCopy(sender);
            Ilp.Event.Cancel(sender);
            break;
          case "DeleteButton":
            if (sender.disabled == true) alert(ids_NoActionPossible);
            else this.DeleteRecord(sender);
            Ilp.Event.Cancel(sender);
            break;
          case "PrintButton":
            if (sender.disabled == true) alert(ids_NoActionPossible);
            else this.PrintRecord(sender);
            Ilp.Event.Cancel(sender);
            break;
          case "GoToButton":
            if (sender.disabled == true) 
            {
              if (Ilp.HtmlDom.GetAttribute(sender, "SaveNotNecessary", "false") == "false") alert(ids_NoActionPossible);
              else this.GoToRecord(sender);
            }  
            else if(WebData.GetRowState(sender.oRecord) == RS_inserted) 
            {
              if (Ilp.HtmlDom.GetAttribute(sender, "SaveNotNecessary", "false") == "false") alert(ids_SaveFirst);
              else this.GoToRecord(sender);
            }
            else this.GoToRecord(sender);
            Ilp.Event.Cancel(sender);
            break;
          case "SpyButton":
            if (sender.disabled == true) alert(ids_NoActionPossible);
            else
            {
              if (Ilp.HtmlDom.HasAttribute(sender, "TrueUrl") == true) this.ToggleSearch(sender);
              else this.ShowSearch(sender);
            }  
            Ilp.Event.Cancel(sender);
            break;
          case "ToggleChapter":
            if (sender.disabled == true) alert(ids_NoActionPossible);
            else this.ToggleChapter(sender);
            Ilp.Event.Cancel(sender);
            break;
          case "ContextMenuButton":
            if (sender.disabled == true) alert(ids_NoActionPossible);
            else this.ShowContextMenu(sender);
            Ilp.Event.Cancel(sender);
            break;
          case "TopOfPageButton":
            if (sender.disabled == true) alert(ids_NoActionPossible);
            else this.GoToTopOfGrid(sender);
            Ilp.Event.Cancel(sender);
            break;
          case "ExcelMailButton":
            break; 
          case "PdfMailButton":
            break;
        }
        break;
    }    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_ProcessClick", "Section1")
  }
};

function WebDataGrid_ProcessContextClick(sender)
{
  try
  {
    if (this.ContextControl)
    {
      this.ContextControl.MenuItem = sender.MenuItem;
      
      var args = new EventArgs();
      args.oRecord = this.ContextControl.oRecord;
      args.MenuItem = sender.MenuItem;
      
      if (typeof(sender.MenuItem.OnClickHandler) == "function")
      {
        sender.MenuItem.OnClickHandler(this.ContextControl, args);
      }
      
      if (args.Cancel == false)
      {      
        switch(sender.getAttribute("NavigateTag"))
        {
          case "Delete":
            this.DeleteRecord(this.ContextControl);
            break;
          case "DeleteSelected":
            var continueProgram = true;
          
            if (WebData.AskDelete() == false)
            {
              continueProgram = false;
            }
          
            if (continueProgram == true)
            {
              var oRecordList = WebData.GetSelectedRecords(this.oMasterRecord, this.TableDescriptorFqn);
              for (var i = 0, len = oRecordList.length; i < len; i++)
              {
                oRecord = oRecordList[i];
                
                args.Deleted = true;
                if (WebData.Delete(oRecord) == true)
                {
                  args.Deleted = true;
                }
                if (args.Deleted == true)
                {
                  var senderTemp = {};
                  senderTemp.oRecord = oRecord;
                  senderTemp.oTBody = WebControl.GetTBody(oRecord);
                
                  this.RemoveTBody(senderTemp);
                }
              }
              this.ShowTotal();
            }
            break;
          case "Copy":
            if (this.CopyDialogUrl.length > 0)
            { 
              var iCopyDialog = new ICopyDialogClass(this);
              this.EditRecordInDialog(this.ContextControl, Verb_Copy, new IGridDialogClass(iCopyDialog));
            }
            else if (this.EditDialogUrl.length > 0) 
            {
              var iEditDialog = new IEditDialogClass(this);
              this.EditRecordInDialog(this.ContextControl, Verb_Copy, new IGridDialogClass(iEditDialog));
            }
            else this.CopyRecord(this.ContextControl);  
            break;  
          case "FollowUp":
            if (this.CopyDialogUrl.length > 0)
            { 
              var iCopyDialog = new ICopyDialogClass(this);
              this.EditRecordInDialog(this.ContextControl, Verb_FollowUp, new IGridDialogClass(iCopyDialog));
            }
            else if (this.EditDialogUrl.length > 0) 
            {
              var iEditDialog = new IEditDialogClass(this);
              this.EditRecordInDialog(this.ContextControl, Verb_FollowUp, new IGridDialogClass(iEditDialog));
            }
            break;  
          case "Edit":
            var iEditDialog = new IEditDialogClass(this);
            this.EditRecordInDialog(this.ContextControl, Verb_Edit, new IGridDialogClass(iEditDialog));
            break;
          case "Move":
            var iMoveDialog = new IMoveDialogClass(this);
            this.EditRecordInDialog(this.ContextControl, Verb_Move, new IGridDialogClass(iMoveDialog));
            break;
          case "CopyAndMove":
            var iCopyAndMoveDialog = new ICopyAndMoveDialogClass(this);
            this.EditRecordInDialog(this.ContextControl, Verb_CopyAndMove, new IGridDialogClass(iCopyAndMoveDialog));
            break;
          case "Save":
            WebData.Save();
            break;
          case "New":
            if (this.EditDialogUrl.length > 0) 
            {
              var iEditDialog = new IEditDialogClass(this);
              this.EditRecordInDialog(this.ContextControl, Verb_New, new IGridDialogClass(iEditDialog));
            }
            else this.NewRecord(this.ContextControl);
            break;
          case "Insert":
            this.InsertRecord(this.ContextControl);
            break;
          case "InsertCopy":
            this.InsertCopy(this.ContextControl);
            break;
          case "ShowWM":
            ShowWebMessage(this.ContextControl);
            break;
          case "ClipCopy":
            this.ClipCopy(this.ContextControl);
            break;
          case "ClipPaste":
            this.ClipPaste(this.ContextControl);
            break;
          case "RecordInfo":
            this.ShowRecordInfo(this.ContextControl);
            break;
          case "SelectionButton":
            var iSelectDialog = new ISelectDialogClass(this.ContextControl.MenuItem);
            WebControl.SelectComboItem(this.ContextControl, null, iSelectDialog);
            Ilp.Event.Cancel(this.ContextControl);
            break;
          case "Select":
           var selectionDescriptorFqn = this.ContextControl.MenuItem.SelectionDescriptorFqn;
            if (selectionDescriptorFqn != null && selectionDescriptorFqn.length > 0) 
            {
              var iSelectDialog = new ISelectDialogClass(this.ContextControl.MenuItem);
              iSelectDialog.SaveSelection = false;
              this.SelectRecordInDialog(this.ContextControl, Verb_Select, iSelectDialog);
            }
            Ilp.Event.Cancel(this.ContextControl);
            break;
        }
      }
    }  
    window.event.cancelBubble = true;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_ProcessContextClick", "")
  }
}

function WebDataGrid_Toggle(sender)
{
  try
  {
    WebControl.ToggleImage(sender);

    switch(sender.getAttribute("ButtonType"))
    {
      case "ToggleChapter":
        this.ToggleChapter(sender);
        break;
    }     
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_Toggle", "Section1")
  }
};

function WebDataGrid_ShowTotal()
{
  try
  {
    if (this.ShowTotalInStatusBar == true)
    {
      if (this.CurrentPagingLinkDescriptor)
      {
        this.Total = 0;
        if (this.PagingLinkDescriptorList.Count() > 0)
        {
          var oLastPagingLinkDescriptor = this.PagingLinkDescriptorList.Get(this.PagingLinkDescriptorList.Count() - 1);
          this.Total = Number(oLastPagingLinkDescriptor.oPagingInfoItem.getAttribute("CumulativeTotal"));
        }
        this.Total += WebData.CountInserted(this.TableDescriptorFqn, this.oMasterRecord);
      }
      else
      {
        var xPath = this.TableDescriptorFqn;
        if (this.oMasterRecord)
        {
          xPath = WebData.GetRecordSelector(this.oMasterRecord) + "/" + this.TableDescriptorFqn;
        }
        this.Total = WebData.Count(xPath);
      }
      if (this.oMasterRecord)
      {
        if (this.InfoLabel)
        {
          if (this.TotalCaption.length == 0)
          {
            if (CssVersion == "GTWeb2") this.TotalCaption = Ilp.HtmlDom.GetText(this.InfoLabel).replace(" 100","") + " ";
            else this.TotalCaption = "";
          }
            
          Ilp.HtmlDom.SetText(this.InfoLabel, this.TotalCaption + String(this.Total));
        }
      }
      else
      {
        WebStatusBar.SetStatusbarMessage("Total: " + String(this.Total), 3);
      }  
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_ShowTotal", "");
  }
};

function WebDataGrid_SetFocus(oRecord, oTBody)
{
  try
  {
    if (oRecord == null)
    {
      var xPath = this.TableDescriptorFqn;
      if (this.oMasterRecord != null)
      { 
        xPath = WebData.GetRecordSelectorB(this.oMasterRecord) + "/" + this.TableDescriptorFqn ;
      }  
      oRecord = WebData.GetRecord(xPath, 0);
    }
    if (oRecord != null)
    {
      oTBody = oTBody == null ? WebControl.GetTBody(oRecord): oTBody;
      if (this.FocusFqn.length > 0)
      {
        var oControl = WebControl.GetControl(this.FocusFqn, oRecord);
        if (DisplayOption == "InXhtmlFrame")
        {
          if (oControl == null) WebControl.ScrollToControl(oTBody, Graphic3DInstance.Bottom_Bottom, 100);
          else 
          { 
            WebControl.ScrollToControl(oControl, Graphic3DInstance.Bottom_Bottom, 100);
            WebControl.FireEvent(oControl, "onfocus");
          }  
        }
        else
        {
          if (oControl == null) WebControl.ScrollToControl(oTBody, Graphic3DInstance.Bottom_Bottom, 100);
          else 
          { 
            WebControl.ScrollToControl(oControl, Graphic3DInstance.Bottom_Bottom, 100);
            WebControl.FireEvent(oControl, "onfocus");
          }  
        }
      }
      else
      {
        if (DisplayOption == "InXhtmlFrame")
        {
          WebControl.ScrollToControl(oTBody, Graphic3DInstance.Bottom_Bottom, 100);
        }
        else
        {
          WebControl.ScrollToControl(oTBody, Graphic3DInstance.Bottom_Bottom, 100);
          WebControl.GetFirstInputElement(oTBody, oTBody);
          if (oTBody.FirstInputElement != null)
          {
            if(oTBody.FirstInputElement.type != "button" && Ilp.HtmlDom.CanHaveFocus(oTBody.FirstInputElement) == true)
            {
              oTBody.FirstInputElement.focus();
            }
          }
        } 
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_SetFocus", "");
  }
};

function WebDataGrid_SetTableDescriptorFqn(tableDescriptorFqn)
{
  try
  {
    this.Container.setAttribute("TableDescriptorFqn", tableDescriptorFqn);
    this.TableDescriptorFqn = tableDescriptorFqn;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_SetTableDescriptorFqn", "");
  }
};

function WebDataGrid_LoadData()
{
  try
  {
    if (WebData.AskDiscardChanges() == true)
    {
      WebStatusBar.SetStatusbarMessage(ids_LoadingData, 0);
      WebData.HasChanged = false;
    
      WebMessage.InitTableDescriptorFqnList();
      WebMessage.AddTableDescriptorFqn(this.TableDescriptorFqn);
      
      var qd = WebForm.CreateQueue();
      
      qd.AddQueueItem("window.WebDataGridCollection[\"" + this.ClientID + "\"].Hide();");
      qd.AddQueueItem("window.WebData.GetDataT();");
      qd.AddQueueItem("window.WebDataGridCollection[\"" + this.ClientID + "\"].FillWebControlsT();");
      qd.AddQueueItem("window.WebDataGridCollection[\"" + this.ClientID + "\"].ShowTotal();");
      
      qd.ExecuteQueue();
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_LoadData", "");
  }
};

function WebDataGrid_HideCurrentRows(useFilter)
{
  try
  {
    useFilter = useFilter == null ? true : useFilter;
    
    if (useFilter == true && this.UseFilter == true)
    {
      /*
      this.oTable.filters[0].enabled = 1;
      */
      Ilp.HtmlDom.SetStyle(this.oTable, "opacity", 0.15);
      //this.oTable.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=15, enabled=true)";
    }
    else
    {
      if (this.CurrentPagingLinkDescriptor)
      {
        this.CurrentPagingLinkDescriptor.Hide();
      }
      this.SetColumnHeaderRows("none");
    } 
    if (this.ToggleButton) WebControl.SetTrueImage(this.ToggleButton);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_HideCurrentRows", "");
  }
};

function WebDataGrid_ShowCurrentRows(useFilter)
{
  try
  {
    useFilter = useFilter == null ? true : useFilter;

    if (useFilter == true && this.UseFilter == true)
    {
      if (this.PreviousPagingLinkDescriptor)
      {
        this.PreviousPagingLinkDescriptor.Hide();
      }
      /*
      this.oTable.filters[0].enabled = 0;
      */
      Ilp.HtmlDom.SetStyle(this.oTable, "opacity", 1);
      //this.oTable.runtimeStyle.filter = "";
      if (this.CurrentPagingLinkDescriptor)
      {
        this.CurrentPagingLinkDescriptor.Show();
      }
    }
    else
    {
      if (this.CurrentPagingLinkDescriptor)
      {
        this.CurrentPagingLinkDescriptor.Show();    
      }
      this.SetColumnHeaderRows("block");
    } 
    if (WebData.PageLinkClicked == this.CurrentPagingLinkDescriptor.oControl2)
    {
      this.GoToTopOfGrid();
    }
    if (this.ToggleButton) WebControl.SetFalseImage(this.ToggleButton);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_ShowCurrentRows", "");
  }
};

function WebDataGrid_TogglePageLink()
{
  try
  {
    if (this.CurrentPagingLinkDescriptor) this.CurrentPagingLinkDescriptor.Deactivate();
    if (this.CurrentPagingLinkDescriptor) this.PreviousPagingLinkDescriptor = this.CurrentPagingLinkDescriptor;
    if (this.NextPagingLinkDescriptor) this.CurrentPagingLinkDescriptor = this.NextPagingLinkDescriptor;
    if (this.CurrentPagingLinkDescriptor) this.CurrentPagingLinkDescriptor.Activate();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_TogglePageLink", "");
  }
};

function WebDataGrid_GetColumnHeaderRows()
{
  try
  {
    this.ColumnHeaderRows = new Array();
    if (this.oTHead != null)
    {
      if (this.oTHead.rows.length > 0)
      {
        var oColumnHeaderRow = this.oTHead.rows[this.oTHead.rows.length-1];
        for (var i = this.oTHead.rows.length-1; i >=0; i--)
        {
          oColumnHeaderRow = this.oTHead.rows[i];
          if (oColumnHeaderRow.getAttribute("IsColumnHeaderRow") == "true")
          {
            this.ColumnHeaderRows[this.ColumnHeaderRows.length] = oColumnHeaderRow;
          }
        }
      }
    }        
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_GetColumnHeaderRows", "");
  }
};

function WebDataGrid_SetColumnHeader(display)
{
  try
  {
    for (var i = 0; i < this.ColumnHeaderRows.length; i++)
    {
      oColumnHeaderRow = this.ColumnHeaderRows[i];
      if (Ilp.HtmlDom.GetStyle(oColumnHeaderRow, "display") != display)
      {
        Ilp.HtmlDom.SetStyle(oColumnHeaderRow, "display", display);
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_SetColumnHeader", "");
  }
};

function WebDataGrid_ShowCounters()
{
  try
  { 
    statusMessage = "";
    if (WebControl.StatusMessage != null)
    {
      statusMessage = WebControl.StatusMessage;
    }
    statusMessage += WebControl.TimeDiffInSeconds(LoadApplicationStart, new Date()) 
    + " | " 
    + WebControl.TimeDiffInSeconds(this.StartTime, new Date())
    + " | " 
    + String(WebControl.NumberOfBinds);
    
    window.status = statusMessage;
    
    WebControl.AddKpiLogMessage(new Date(), "WebDataGrid_ShowCounters", "NumberOfBinds so far: " + String(WebControl.NumberOfBinds));
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_ShowCounters", "Section1")
  }
};

function WebDataGrid_HideTBodies()
{
  try
  { 
    for(var i = 0; i < this.oTable.tBodies.length; i++)
    {
      /*
      this.oTable.tBodies[i].runtimeStyle.display = "none";
      */
      Ilp.HtmlDom.SetStyle(this.oTable.tBodies[i], "display", "none");
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_HideTBodies", "Section1")
  }
};

function WebDataGrid_ToggleSearch(sender)
{
  try
  { 
    if (sender == null) return;
    
    var expanded = WebControl.IsExpanded(sender);
    if (expanded == false)
    {
      WebDataSearch.Show();
    }
    else
    {
      WebDataSearch.Hide();
    }
    WebControl.ToggleImage(sender);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_ToggleSearch", "Section1")
  }
}

function WebDataGrid_ShowSearch(sender)
{
  try
  { 
    WebControl.ShowSearch(sender);
    
    if (typeof(this.OnAfterToggleSearchContainerHandler) == "function")
    {
      var args = new EventArgs();
      this.OnAfterToggleSearchContainerHandler(sender, args);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_ShowSearch", "Section1")
  }
};

function WebDataGrid_CollapsePagingHeader()
{
  try
  {
    /* 
    if (this.oTHead != null)
    {
      this.FindHeaderTables();
    }
    */
    if (this.PagingContainerHeader)
    {
      Ilp.HtmlDom.SetStyle(this.PagingContainerHeader, "display", "none");
    }
    this.PagingHeaderCollapsed = true;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_CollapsePagingHeader", "Section1")
  }
};

function WebDataGrid_ExpandPagingHeader()
{
  try
  { 
    if (this.PagingContainerHeader)
    {
      Ilp.HtmlDom.SetStyle(this.PagingContainerHeader, "display", "block");
    }
    this.PagingHeaderCollapsed = false;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_ExpandPagingHeader", "Section1")
  }
};

function WebDataGrid_ExpandFooter()
{
  try
  { 
    if (this.oTFoot != null)
    {
      Ilp.HtmlDom.SetStyle(this.oTFoot, "display", "block");
    }
    this.FooterCollapsed = false;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_ExpandFooter", "Section1")
  }
};


function WebDataGrid_CollapseFooter()
{
  try
  { 
    if (this.oTFoot != null)
    {
      Ilp.HtmlDom.SetStyle(this.oTFoot, "display", "none");
    }
    this.FooterCollapsed = true;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_CollapseFooter", "Section1")
  }
};

function WebDataGrid_ReloadGrid()
{
  try
  { 
    WebData.ClearSelectionPerTableDescriptor(this.TableDescriptorFqn);
    WebMessage.InitTableDescriptorFqnList();
    WebMessage.InitDataTableRelationDescriptorFqnList();
    WebMessage.AddTableDescriptorFqn(this.TableDescriptorFqn);
      
    WebMessage.SetGeneralInfoAttribute("FunctionCall", "GetWebData");
    WebMessage.Exchange(false, false);
    WebData.Transfer();

    var oRecordList = WebData.Select(this.TableDescriptorFqn + "[@diffgr:id]");
    WebControl.RemoveTBodies(this.oTable);
    this.MergeRecordList(oRecordList);
    this.ShowCounters();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_ReloadGrid", "Section1")
  }
};

function WebDataGrid_GetChildGrids(oRecord)
{
  try
  { 
    var childGrids = new Array();
    for (var i = 0, len = this.ChildGridArray.length; i < len; i++)
    {
      if (this.ChildGridArray[i].oMasterRecord == oRecord)
      {
        childGrids[childGrids.length] = this.ChildGridArray[i];
      }  
    }
    
    return childGrids;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_GetChildGrids", "Section1")
  }
};

function WebDataGrid_ChildGridSetIf(oRecord)
{
  try
  { 
    var childGrids = this.GetChildGrids(oRecord);
    var recordWrapper = WebControl.Records.GetInstance(oRecord);
    
    for (var i = 0, len = childGrids.length; i < len; i++)
    {
      var oTarget = childGrids[i].Container;
      var controlTemplateWrapper = WebControl.Controls.GetInstance(oTarget);
    
      WebControl.SetIf(oTarget, controlTemplateWrapper, recordWrapper);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_ChildGridsSetIf", "Section1")
  }
};

function WebDataGrid_ReloadMasterRecord(oRecord, fqn, fqnValue)
{
  try
  {
    var recordWrapper = null;
    var controlTemplateWrapper = null;
  
    WebData.ReloadRecord(oRecord); 
    WebData.UpdateBinding(oRecord);
    this.ReloadChildGrid(oRecord);

    var oTBody = WebControl.GetTBody(oRecord);
    if (oTBody)
    {
      var localArray = oTBody.ClientBoundControlArray;
      for (var i = 0, len = localArray.length; i < len; i++)
      {
        var oTarget = localArray[i];
        
        controlTemplateWrapper = WebControl.Controls.GetInstance(oTarget);
        recordWrapper = WebControl.Records.GetInstance(oTarget.oRecord);
        
        if (controlTemplateWrapper.HasFqn == false)
        { 	      
          WebControl.SetIf(oTarget, controlTemplateWrapper, recordWrapper);
        }
      }
    }
    
    return 0;
    /*
    if (fqn == null)
    {
      var oFD = FormDescriptor.GetPrimaryKeyFieldDescriptor(oRecord.nodeName);
      fqn = oFD.getAttribute("Fqn");
    }
    if (fqnValue == null)
    {
      fqnValue =  WebData.GetFieldValue(oRecord, fqn);
    }
    
    var oSearchInfoSave = WebMessage.SearchInfoSave();
    
    var oTBody = WebControl.GetTBody(oRecord);
    if (oTBody)
    {
      // wegen Combos
      WebData.UpdateBinding(oRecord, true);
      
      var childGrids = this.GetChildGrids(oRecord);
      
      for (var i = 0, len = childGrids.length; i < len; i++)
      {
        childGrids[i].Clear();
      }
      
      WebData.RemoveBoundControlsA(oRecord);
      WebData.RemoveRecord(oRecord);
      
      var oMasterRecord = null;
      if (WebData.IsChildRecord(oRecord) == false) oMasterRecord = null;
      else oMasterRecord = oRecord.parentNode;
      
      WebMessage.InitTableDescriptorFqnList();
      WebMessage.InitDataTableRelationDescriptorFqnList();
      WebMessage.AddTableDescriptorFqn(this.TableDescriptorFqn);

      var oSearchInfoItem = null;
      var oRecordNew = null;
      
      if (oMasterRecord == null)
      {
        WebMessage.InitSearchInfo();
        oSearchInfoItem = WebMessage.AddSearchInfoItem(null, fqn, fqnValue, "Equal", false);
        
        WebMessage.SetGeneralInfoAttribute("FunctionCall", "GetWebData");
        WebMessage.Exchange(false, false);
        WebData.AutoClearOnTransfer = false;
        WebData.Transfer();
        
        oRecordNew = WebData.GetRecordByFieldValue(fqn, String(fqnValue));
      }
      else
      {
        WebMessage.InitSearchInfo(true);
        oSearchInfoItem = WebMessage.AddSearchInfoItem(null, fqn, fqnValue, "Equal", false, "DirectSearchInDetail");

        WebMessage.SetGeneralInfoAttribute("FunctionCall", "GetWebDataDetail");     
        WebMessage.Exchange(false, false);
        WebData.AutoClearOnTransfer = false;
        WebData.Transfer(oMasterRecord);

        oRecordNew = WebData.GetRecordByFieldValue(fqn, String(fqnValue), null, oMasterRecord);
      }
      
      if (oRecordNew)
      {
        this.UpdateControlBinding(oTBody, oRecordNew);
        WebData.UpdateBinding(oRecordNew);

        var recordWrapper = WebControl.Records.GetInstance(oRecordNew);
        var localArray = oTBody.ClientBoundControlArray;
        for (var i = 0, len = localArray.length; i < len; i++)
        {
          var oTarget = localArray[i];
          var controlTemplateWrapper = WebControl.Controls.GetInstance(oTarget);
          if (controlTemplateWrapper.HasFqn == false)
          {
            WebControl.SetIf(oTarget, controlTemplateWrapper, recordWrapper);
          }
        }
      }
         
      for (var i = 0, len = childGrids.length; i < len; i++)
      {
        var bindingHash = WebData.GetBindingHash(WebControl.GetTableDescriptorFqn(childGrids[i].Container), oRecordNew, true);
        this.ChildGridCollection[bindingHash] = childGrids[i];
      
        childGrids[i].oMasterRecord = oRecordNew;
        childGrids[i].Rebind();
      }
    }
    WebMessage.SearchInfoRestore(oSearchInfoSave);
    */
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_ReloadMasterRecord", "Section1")
  }
};


function WebDataGrid_ReloadChildGrid(oRecord, tableDescriptorFqn)
{
  try
  {
    tableDescriptorFqn = tableDescriptorFqn == null ? "" : tableDescriptorFqn;
    if (tableDescriptorFqn.length > 0)
    {
      WebData.RefreshChildData(oRecord, tableDescriptorFqn); 

      var bindingHash = WebData.GetBindingHash(tableDescriptorFqn, oRecord, true);
      var oWebDataGridChild = this.ChildGridCollection[bindingHash];
      if (oWebDataGridChild)
      {
        var oRecordList = oRecord.selectNodes(tableDescriptorFqn + "[@diffgr:id]");
        oWebDataGridChild.FillWebControlsR(oRecordList);
        /*
        if (oWebDataGridChild.oTHead != null)
        {
          oWebDataGridChild.CreatePagingLinks(oRecordList, oWebDataGridChild.PagingAreaHeader);
        }
        if (oWebDataGridChild.oTFoot != null)
        {
          oWebDataGridChild.CreatePagingLinks(oRecordList, oWebDataGridChild.PagingAreaFooter);
        }
        WebControl.RemoveTBodies(oWebDataGridChild.oTable);
        oWebDataGridChild.MergeRecordList(oRecordList);
        */
      }
    }
    else
    {
      for (var i = 0, len = this.ChildGridArray.length; i < len; i++)
      {
        this.ReloadChildGrid(oRecord, this.ChildGridArray[i].TableDescriptorFqn);
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_ReloadChildGrid", "Section1")
  }
};

function WebDataGrid_Rebind()
{
  try
  {
    var xPath = this.TableDescriptorFqn;
    if (this.oMasterRecord)
    {
      xPath = WebData.GetRecordSelector(this.oMasterRecord) + "/" + this.TableDescriptorFqn;
    }
  
    var oRecordList = WebData.Select(xPath);
    WebControl.RemoveTBodies(this.oTable);
    this.MergeRecordList(oRecordList);

    if (this.NewButton)
    {    
      var allowNew = this.AllowNew;
      if (this.oMasterRecord && allowNew == true) allowNew = WebControl.IsNewable(this.NewButton, this.oMasterRecord);
      if (allowNew == false) WebControl.SetDisabled(this.NewButton);
      else  WebControl.SetEnabled(this.NewButton);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_Rebind", "Section1")
  }
};

function WebDataGrid_RebindChildGrids(oRecord)
{
  try
  {
    for (var i = 0, len = this.ChildGridArray.length; i < len; i++)
    {
      this.ChildGridArray[i].Rebind();
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_RebindChildGrids", "Section1")
  }
};

function WebDataGrid_ShowContextMenu(sender)
{
  try
  {
    WebControl.GetContextMenu(this, sender);
    
    this.ContextControl = sender;
    this.DropDownMenu.Show(sender, 0);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_ShowContextMenu", "")
  }
};

function WebDataGrid_GoToTopOfPage(sender)
{
  try
  {
    WebControl.ShowSelection(sender);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_GoToTopOfPage", "")
  }
};

function WebDataGrid_GoToTopOfGrid()
{
  try
  {
    WebControl.ScrollToControl(this.Container, Graphic3DInstance.Top_Top, 0);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_GoToTopOfPage", "")
  }
};

function WebDataGrid_GetChildGrid(tdFqn)
{
  try
  {
    var childGrid = null;
    for (var i = 0, len = this.ChildGridArray.length; i < len; i++)
    {
      if (this.ChildGridArray[i].TableDescriptorFqn == tdFqn)
      {
        childGrid = this.ChildGridArray[i];
        break;
      }
    }
    return childGrid;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_GetChildGrid", "")
  }
};

function WebDataGrid_ClipCopy(sender)
{
  try
  {
    var args = new EventArgs();
    args.oRecord = sender.oRecord;
  
    var xPath = this.TableDescriptorFqn;
    if (this.oMasterRecord)
    {
      xPath = WebData.GetRecordSelector(this.oMasterRecord) + "/" + this.TableDescriptorFqn;
    }
    var oSelectedList = WebData.Select(xPath);
    var fdList = FormDescriptor.GetFieldDescriptorList(this.TableDescriptorFqn);
    var clipboardData = "";
    
    if (typeof(this.OnBeforeClipCopyHandler) == "function")
    {
      args.oMasterRecord = this.oMasterRecord;
      args.clipboardData = clipboardData;
      this.OnBeforeClipCopyHandler(this.ContextControl, args);
      clipboardData = args.clipboardData;
    }
    
    for (var i = 0, len = oSelectedList.length; i < len; i++)
    {
      var oSelected = oSelectedList[i];
      clipboardData += WebData.ConvertRecordToCsv(oSelected, fdList);
      clipboardData += "\n";
    }
    window.clipboardData.setData("Text", clipboardData);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_ClipCopy", "")
  }
};

function WebDataGrid_ClipPaste(sender)
{
  try
  {
    var args = new EventArgs();
    args.oRecord = sender.oRecord;

    var clipboardData = window.clipboardData.getData("Text");
    if (clipboardData != null)
    {
      if (typeof(this.OnBeforeClipPasteHandler) == "function")
      {
        args.oMasterRecord = this.oMasterRecord;
        args.clipboardData = clipboardData;
        this.OnBeforeClipPasteHandler(this.ContextControl, args);
        clipboardData = args.clipboardData;
      }
    
      var xPath = this.TableDescriptorFqn;
      if (this.oMasterRecord)
      {
        xPath = WebData.GetRecordSelector(this.oMasterRecord) + "/" + this.TableDescriptorFqn;
      }
      
      args.DoRowOrder = false;
      args.OffsetRecord = null;
      var oSelectedList = WebData.Select(xPath);
      if (oSelectedList.length > 0)
      {
        for (var i = 0, len = oSelectedList.length; i < len; i++)
        {
          var oSelected = oSelectedList[i];
          WebData.Delete(oSelected, false, args);
        }
      
        if (args.OffsetRecord != null)
        {
          WebData.ResetRowOrderA(args.OffsetRecord);
          WebData.SetRowOrderA(args.OffsetRecord);
        }
      }
    
      args.DoRowOrder = false;
      args.OffsetRecord = null;
      var fdList = FormDescriptor.GetFieldDescriptorList(this.TableDescriptorFqn);
      var lines = clipboardData.split("\n");
      if (lines.length > 0)
      {
        for (var i = 0, len = lines.length; i < len; i++)
        {
          var line = lines[i];
          if (line.length > 0)
          {
            var oRecord = WebData.NewRecord(this.TableDescriptorFqn)
            oRecord = WebData.AddRecord(oRecord, this.oMasterRecord);
            WebData.ConvertCsvToRecord(oRecord, fdList, line);
          }  
        }
        if (args.OffsetRecord != null)
        {
          WebData.ResetRowOrderA(args.OffsetRecord);
          WebData.SetRowOrderA(args.OffsetRecord);
        }
      }
      this.Rebind();
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_ClipPaste", "")
  }
};



function WebDataGrid_UpdateControlBinding(oTBody, oRecord)  
{
  try 
  {
    oTBody.id = WebControl.CreateTBodyID(oRecord);

    var recordWrapper = WebControl.Records.GetInstance(oRecord);
      
    var localArray = oTBody.ClientBoundControlArray;
    for (var i = 0, len = localArray.length; i < len; i++)
    {
      var controlTemplateWrapper = null;
      var oTarget = localArray[i];

      controlTemplateWrapper = WebControl.Controls.DeleteInstance(oTarget);
      
      if (controlTemplateWrapper)
      {
        if (controlTemplateWrapper.BindingFqn == "RefDat.GLRDFabrNo")
        {
          var x = 1;
        }
      }
      
      oTarget.oRecord = oRecord;
      oTarget.id = oTarget.ObjectID;
      oTarget.id = WebControl.CreateUniqueClientId(oRecord, oTarget.id);
      oTarget.name = oTarget.id;

      controlTemplateWrapper = WebControl.Controls.GetInstance(oTarget);
    
      if (controlTemplateWrapper.HasFqn == true)
      {
        WebControl.AddBoundControl(controlTemplateWrapper.BindingFqn, oTarget.oRecord, oTarget);
        WebControl.CheckChangeTracking(oTarget, oRecord);
      }
      
      if (controlTemplateWrapper.IsDeleteButton == true)
      {
        var allowDelete = ! ((this.AllowDelete == false) || !WebControl.IsDeletable(oTarget, oRecord, controlTemplateWrapper, recordWrapper));
        if (allowDelete == false) WebControl.SetDisabled(oTarget);
      }
      else if (controlTemplateWrapper.IsCopyButton == true)
      {
        var allowCopy = ! ((this.AllowCopy == false) || !WebControl.IsCopyable(oTarget, oRecord, controlTemplateWrapper, recordWrapper));
        if (allowCopy == false) WebControl.SetDisabled(oTarget);
      }
      else if (controlTemplateWrapper.IsInsertButton == true)
      {
        var allowInsert = ! ((this.AllowEdit == false) || !WebControl.IsEditable(oTarget, oRecord, controlTemplateWrapper, recordWrapper));
        if (allowInsert == false) WebControl.SetDisabled(oTarget);
      }
    }
    
    for (var i = 0, len = this.ChildGridArray.length; i < len; i++)
    {
      this.ChildGridArray[i].oMasterRecord = oRecord;
    }
      
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_UpdateControlBinding", "Section1")
  }
};

function WebDataGrid_SetCurrentTabPage()  
{
  try
  {
    if (this.TabControl != null)
    {
      var xPath = "";
      var oRecord = null;
      if (this.oMasterRecord)
      {
        xPath = WebData.GetRecordSelectorB(this.oMasterRecord) + "/";
      }
      xPath += this.TableDescriptorFqn;
      
      var oRecord = WebData.GetRecord(xPath, 0);

      if (this.ChildGridArray.length == 0 || Ilp.HtmlDom.GetAttribute(this.TabControl.Container, "TabControlPageSource", "Grids") == "Rows")
      {
        if (oRecord)
        {
          var oTBody = WebControl.GetTBody(oRecord);
          if (oTBody)
          {
            for (var i = 0, len = oTBody.rows.length; i < len; i++)
            {
              var row = oTBody.rows[i];
              if (Ilp.HtmlDom.GetAttributeInt(row, "TabPageIndex", -1) == this.TabControl.CurrentIndex)
              {
                WebControl.ShowControl(row);
              }
              else
              {
                WebControl.HideControl(row);
              }
            }
          }
        }
      }
      else
      {
        for (var i = 0; i <  this.ChildGridArray.length; i++)
        {
          WebControl.HideControl(this.ChildGridArray[i].Container);
        }
            
        for (var i = 0, len = this.TabControl.TabPageList.Count(); i < len; i++)
        {
          var oTabPage = this.TabControl.TabPageList.Get(i);
          if (oTabPage.Selected == true)
          {
            WebControl.ShowControl(this.ChildGridArray[oTabPage.Index].Container);
            if (oTabPage.Container.getAttribute("ReloadChildGrid") == "true")
            { 
              this.ReloadChildGrid(oRecord, this.ChildGridArray[oTabPage.Index].TableDescriptorFqn);
            }            
          }
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_SetCurrentTabPage", "Section1")
  }
};


function WebDataGrid_SetNextPagingLinkDescriptor(oPagingLinkDescriptor)  
{
  try
  {
    this.NextPagingLinkDescriptor = oPagingLinkDescriptor;   
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_SetNextPagingLinkDescriptor", "Section1")
  }
};

function WebDataGrid_SelectRecordInDialog(sender, verb, iSelectDialog)  
{
  try
  { 
    var oRecord = sender.oRecord;
    if (oRecord && WebControl.AskForSaveAndContinue(WebData.GetPkValue(oRecord)) == true)
    {
      WebControl.SelectRecordInDialog(sender, verb, iSelectDialog, this);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_SelectRecordInDialog", "Section1")
  }
};


function WebDataGrid_EditRecordInDialog(oControl, verb, iGridDialog)  
{
  try
  { 
    var result = null;
    if (WebData.HasChanged == true)
    {
      alert(ids_SaveFirst);
      return null;
    }
    var oRecord = oControl.oRecord;
    if (oRecord || verb == Verb_New)
    {    
      var urlPrep = iGridDialog.EditDialogUrl;
      if (oRecord) urlPrep = WebControl.PrepareXPathSelector(oRecord, urlPrep);
         
      url = WebControl.GetStandardUrl(urlPrep, verb, CallingMode_DialogDirect);
    
      var features = iGridDialog.EditDialogFeatures;
      
      var args = new EventArgs();
      args.Url = url;
      args.Features = features;
      args.Verb = verb;
      
      if (verb == Verb_New || verb == Verb_Edit || verb == Verb_Copy || verb == Verb_FollowUp || verb == Verb_Move || verb == Verb_CopyAndMove)
      {
        Ilp.DialogBag = {};
        Ilp.DialogBag.oRecord = oRecord;
        if (typeof(iGridDialog.OnBeforeEditRecordHandler) == "function")
        {
          iGridDialog.OnBeforeEditRecordHandler(oControl, args);
          if (args.Cancel == true) return null;
          url = args.Url;
          features = args.Features;
        }
      }
        
      if (iGridDialog.EditModal == "false")
      {                   
        var windowFeatures = WebControl.GetWindowFeatures();
        WebControl.Open(url, "_blank", "", false);
      }
      else
      {
        if (1==1)
        {
          result = WebControl.ShowModalDialog(url, features, null);
        }
        else
        {
          var windowFeatures = WebControl.GetWindowFeatures();
          WebControl.Open(url, "_blank", windowFeatures, false);
        }
        if (verb == Verb_New || verb == Verb_Copy || verb == Verb_CopyAndMove || verb == Verb_FollowUp)
        {
          if (WebControl.ReturnedRecordList.Count() > 0)
          {
            var oRecordReturnXml = WebControl.ReturnedRecordList.Get(0);
            var oRecordReturn = WebData.CreateRecordFromXml(oRecordReturnXml);
             
            var oPrimaryKeyFieldDescriptor = FormDescriptor.GetPrimaryKeyFieldDescriptor(this.TableDescriptorFqn);
            var primaryKeyFieldName = FormDescriptor.GetFieldnameEffective(oPrimaryKeyFieldDescriptor);
            var primaryKeyValue = WebData.GetFieldValueInt(oRecordReturn, oRecordReturn.nodeName + "." + primaryKeyFieldName);
            
            if (primaryKeyValue > 0)
            {
              var oRecordNew = this.NewRecordOnly(oControl);
              WebData.SetFieldValueOnly(oRecordNew, oRecordNew.nodeName + "." + primaryKeyFieldName, primaryKeyValue);
              WebData.AcceptChanges();
              WebData.ReloadRecord(oRecordNew);
              WebData.UpdateBinding(oRecordNew);
              
              WebControl.JumpToControl(WebControl.GetTBody(oRecordNew));
              args.oRecordNew = oRecordNew;
            }
          }
        }
        else if (verb == Verb_Edit || verb == Verb_Move)
        {
          WebData.ReloadRecord(oRecord);
          WebData.UpdateBinding(oRecord);   
        }
                  
        if (verb == Verb_New || verb == Verb_Edit || verb == Verb_Copy || verb == Verb_FollowUp || verb == Verb_Move || verb == Verb_CopyAndMove)
        {
          if (typeof(iGridDialog.OnAfterEditRecordHandler) == "function")
          {
            iGridDialog.OnAfterEditRecordHandler(oControl, args);
          }
        }
      }
      return args;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_EditRecordInDialog", "Section1")
  }
};


function WebDataGrid_ShowRecordInfo(sender)  
{
  try
  {
    WebControl.ShowRecordInfo(sender, this.RecordInfoSkin);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_ShowRecordInfo", "Section1")
  }
};

function WebDataGrid_ApplyResources(oTBody, oRecord)
{
  try
  {
    var localArray = new Array();
    var children    = null;
    var queue       = new WebQueue();
    var webDomItem  = new WebDomItem(oTBody, oTBody);
    var element     = null;
    queue.Enqueue(webDomItem);
    
    while(queue.Count() > 0)
    {   
      webDomItem  = queue.Dequeue();
      element = webDomItem.oDomElement;
      
      if (element.getAttribute("UseClientResource") == "true")
      {
        localArray[localArray.length] = element;
      }
      
      children = element.children;
      for (var i = 0, len = children.length; i < len; i++)
      {
        webDomItem = new WebDomItem(oTBody, children[i]);
        queue.Enqueue(webDomItem);
      }  
    } 
    for (var i = 0; i < localArray.length; i++)
    {
      element = localArray[i];
      var resourceKey = element.getAttribute("ResourceKey");
      if (resourceKey.length > 0)
      {
        var fqn = element.getAttribute("SegmentFqn");
        if (fqn.length > 0)
        {
          var segment = WebData.GetFieldValue(oRecord, fqn);
          if(WebControl.CheckString(segment) > 0)resourceKey = resourceKey + segment;
        }
        var resourceValue = WebControl.GetClientResource(resourceKey);
        if (WebControl.CheckString(resourceValue) > 0)
        {
          element.innerHTML = resourceValue;
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataGrid_ApplyResources", "Section1")
  }
}


/* ============================ GTWebColumnGrid.js ===========================*/
window.WebColumnGridCollection = new Object();
window.WebColumnGridArray = new Array();

function WebColumnGridClass(webColumnGridContainer, oMasterRecord)
{
  try
  {
    this.Container = webColumnGridContainer;
    this.Container.JsInstance = this;
    this.ObjectID = this.Container.id;
    this.ClientID = this.Container.id;
    this.ClassType = "WebColumnGridClass";
    
    this.TableDescriptorFqn = WebControl.GetTableDescriptorFqn(this.Container);
    this.oMasterRecord = oMasterRecord;

    this.PositionLeft = "Left";
    this.PositionMiddle = "Middle";
    this.PositionRight = "Right";
    
    this.FirstColumnCssClass = "ColumnFirst";
    this.MiddleColumnCssClass = "ColumnMiddle";
    this.LastColumnCssClass = "ColumnLast";

    this.ContextControl = null;
    
    this.MenuBar = this.Container.getAttribute("MenuBar");
    
    this.Columns = new WebHybrid();
    
    if (this.oMasterRecord == null)
    {
      window.WebColumnGridCollection[this.ClientID] = this;
      window.WebColumnGridArray[window.WebColumnGridArray.length] = this;
    }
    
    this.AllowEdit = Ilp.HtmlDom.GetAttributeBool(this.Container, "AllowEdit", "true"); 
    this.AllowNew = Ilp.HtmlDom.GetAttributeBool(this.Container, "AllowNew", "true"); 
    this.AllowDelete = Ilp.HtmlDom.GetAttributeBool(this.Container, "AllowDelete", "true"); 
    this.AllowCopy = Ilp.HtmlDom.GetAttributeBool(this.Container, "AllowCopy", "true"); 
    
    this.FocusFqn = Ilp.HtmlDom.GetAttribute(this.Container, "FocusFqn", ""); 
    this.ColumnWidth = Ilp.HtmlDom.GetAttribute(this.Container, "ColumnWidth", ""); 
    
    this.Hide = WebColumnGridClass_Hide;
    this.Show = WebColumnGridClass_Show;
    
    this.FillWebControlsR = WebColumnGridClass_FillWebControlsR;
    this.MergeRecordList = WebColumnGridClass_MergeRecordList;
    this.MergeRecord = WebColumnGridClass_MergeRecord;
    this.BindEdge = WebColumnGridClass_BindEdge;
    this.UpdateEdge = WebColumnGridClass_UpdateEdge;
    this.UpdateEdgeBinding = WebColumnGridClass_UpdateEdgeBinding;

    this.ProcessClick = WebColumnGridClass_ProcessClick;
    this.ProcessContextClick = WebColumnGridClass_ProcessContextClick;
    this.ShowContextMenu = WebColumnGridClass_ShowContextMenu;

    this.Clear = WebColumnGridClass_Clear;
    this.Rebind = WebColumnGridClass_Rebind;
    this.NewRecord = WebColumnGridClass_NewRecord;
    this.NewRecordOnly = WebColumnGridClass_NewRecordOnly;
    this.DeleteRecord = WebColumnGridClass_DeleteRecord;
    this.GetColumnIndex = WebColumnGridClass_GetColumnIndex;
    this.GetPosition = WebColumnGridClass_GetPosition;

    this.SetFocus = WebColumnGridClass_SetFocus;
    
    this.hLeft = Ilp.HtmlDom.GetFirstDescendantByClassName(this.Container, "Left");
    this.hMiddle = Ilp.HtmlDom.GetFirstDescendantByClassName(this.Container, "Middle");
    this.hRight = Ilp.HtmlDom.GetFirstDescendantByClassName(this.Container, "Right");
    
    if (this.hLeft)
    {
      this.hLeft.ClientBoundControlArray = new Array();
      WebControl.FindClientBoundControls(this.hLeft, this.hLeft);
      if (oMasterRecord) this.MergeRecord(oMasterRecord, this.hLeft);
    }
    if (this.hRight)
    {
      this.hRight.oRecord = oMasterRecord;
      this.hRight.ClientBoundControlArray = new Array();
      WebControl.FindClientBoundControls(this.hRight, this.hRight);
      if (oMasterRecord) this.MergeRecord(oMasterRecord, this.hRight);
    }
    
    if (this.hMiddle) this.oColumn = Ilp.HtmlDom.GetFirstDescendantByClassName(this.hMiddle, "Column");
    else this.oColumn = Ilp.HtmlDom.GetFirstDescendantByClassName(this.Container, "Column");
    
    this.oColumnClone = this.oColumn.cloneNode(true);
    if (this.ColumnWidth.length > 0)
    {
      Ilp.HtmlDom.SetStyle(this.oColumnClone, "width", this.ColumnWidth);
      for (var i = 0, len = this.oColumnClone.children.length; i < len; i++)
      {
        Ilp.HtmlDom.SetStyle(this.oColumnClone.children[i], "width", this.ColumnWidth);
      }  
    }
    WebControl.MergeAttributes(this.oColumn, this.oColumnClone);
    
    if (this.hMiddle) this.hMiddle.innerHTML = ""
    else this.Container.innerHTML = "";
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebColumnGridClass", "");
  }
}

function WebColumnGridClass_FillWebControlsR(oRecordList)
{
  try
  { 
    WebControl.AddKpiLogMessage(new Date(), "WebColumnGridClass_FillWebControlsR", "TableDescriptorFqn: " + this.TableDescriptorFqn);
    this.StartTime = new Date();

    if (oRecordList == null)
    {
      oRecordList = WebData.Select(this.TableDescriptorFqn);
    }
    
    if (this.hMiddle) this.hMiddle.innerHTML = ""
    else this.Container.innerHTML = "";

    this.MergeRecordList(oRecordList);
    
    this.Show();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebColumnGridClass_FillWebControlsR", "Section1")
  }
};

function WebColumnGridClass_MergeRecordList(recordList)
{
  try
  { 
    for (var i = 0, len = recordList.length; i < len; i++)
    {
      var newColumn = this.oColumnClone.cloneNode(true);
      WebControl.MergeAttributes(this.oColumn, this.oColumnClone);
      newColumn.oRecord = recordList[i]; 
       
      if (i == 0) Ilp.HtmlDom.AddClass(newColumn, this.FirstColumnCssClass)
      else if (i > 0 && i < len-1) Ilp.HtmlDom.AddClass(newColumn, this.MiddleColumnCssClass)
      else if (i == len-1) Ilp.HtmlDom.AddClass(newColumn, this.LastColumnCssClass)
      
      newColumn.id = WebControl.CreateTBodyID(recordList[i]);
      newColumn.ClientBoundControlArray = new Array();
      WebControl.FindClientBoundControls(newColumn, newColumn);
      
      if (this.hMiddle) this.hMiddle.appendChild(newColumn);
      else this.Container.appendChild(newColumn);
      
      this.Columns.Add(newColumn.id, newColumn);
      
      this.MergeRecord(recordList[i], newColumn);
    }
    
    if (this.hLeft) this.BindEdge(this.hLeft);
    if (this.hRight) this.BindEdge(this.hRight);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebColumnGridClass_MergeRecordList", "Section1")
  }
};

function WebColumnGridClass_UpdateEdge()
{
  try
  {
    if (this.hLeft) this.UpdateEdgeBinding(this.hLeft);
    if (this.hRight) this.UpdateEdgeBinding(this.hRight);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebColumnGridClass_UpdateEdge", "Section1")
  }
};

function WebColumnGridClass_UpdateEdgeBinding(oContainer)
{
  try
  {
    var recordWrapper = null;
    var controlTemplateWrapper = null;

    for (var i = 0; i < oContainer.ClientBoundControlArray.length; i++)
    {
      var oTarget = oContainer.ClientBoundControlArray[i];
      
      controlTemplateWrapper = WebControl.Controls.GetInstance(oTarget);
      recordWrapper = WebControl.Records.GetInstance(oTarget.oRecord)

      if ((controlTemplateWrapper.HasFqn == true || controlTemplateWrapper.RunMergeData == true))
      {
        WebData.UpdateFieldBinding(recordWrapper.oRecord, controlTemplateWrapper.Fqn);
      }  
      else
      {
        WebControl.SetIf(oTarget, controlTemplateWrapper, recordWrapper);
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebColumnGridClass_UpdateEdgeBinding", "Section1")
  }
};

function WebColumnGridClass_BindEdge(oContainer)
{
  try
  {
    var recordWrapper = null;
    var controlTemplateWrapper = null;
    var args = new EventArgs();

    for (var i = 0; i < oContainer.ClientBoundControlArray.length; i++)
    {
      var removed = false;
      var oTarget = oContainer.ClientBoundControlArray[i];
      var removeIf = oTarget.getAttribute("RemoveIf");
      if (typeof(removeIf) == "string")
      {
        if (removeIf.length > 0)
        {
          eval(removeIf);
          if (WebData.ReturnIf == true)
          {
            WebControl.RemoveControl(oTarget);
            WebData.ReturnIf = false;
            removed = true;
          }
        }
      }
      if (removed == false)
      {
        var oRecord = this.oMasterRecord;
        if (oRecord == null)
        {
          oRecord = WebData.GetRecord(this.TableDescriptorFqn, 0);
        }
        
        var oObject = new Object();
        oObject.oWebDataGrid = this;
        oObject.oContainer = this;
        oObject.oContainerInstance = this;
        oObject.oTable = this.oTable;
        oObject.ObjectID = oTarget.id;
        oObject.oMasterRecord = this.oMasterRecord;
        oObject.oRecord = oRecord;
        oObject.id = WebControl.CreateUniqueClientId(oRecord, oTarget.id);
        
        WebControl.MergeAttachedObjects(oObject, oTarget);
        WebControl.SetEventHandler(oTarget);
        
        if (oRecord != null)
        {
          controlTemplateWrapper = WebControl.Controls.GetInstance(oTarget);
          recordWrapper = WebControl.Records.GetInstance(oTarget.oRecord)
        
          if ((controlTemplateWrapper.HasFqn == true || controlTemplateWrapper.RunMergeData == true))
          {
            WebControl.MergeData(this, oTarget, oRecord, true, controlTemplateWrapper, recordWrapper);
          }  
          else
          {
            WebControl.SetIf(oTarget, controlTemplateWrapper, recordWrapper);
          }
        }  
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebColumnGridClass_BindEdge", "Section1")
  }
};

function WebColumnGridClass_MergeRecord(oRecord, oColumn, doMerge)
{
  try
  { 
    doMerge = doMerge == null ? true : false;
    
    var recordWrapper = null;
    var controlTemplateWrapper = null;
        
    var aRadioButtonList = new Array();    
    var radioButtonHash = new Object();    
    
    var localArray = oColumn.ClientBoundControlArray;
    for (var i = 0, len = localArray.length; i < len; i++)
    {
      var oTarget = localArray[i];
      
      var oObject = new Object();
      oObject.oColumn = oColumn;
      oObject.oRecord = oRecord;
      oObject.oWebColumnGrid = this;
      oObject.oContainer = this;
      oObject.oContainerInstance = this;
      oObject.ObjectID = oTarget.id;
      oObject.BindingIndex = i;
      oObject.id = WebControl.CreateUniqueClientId(oRecord, oTarget.id);
      
       // sort radiobuttonlist objects
      if (oTarget.getAttribute("ControlType") == "RadioButton")
      {
        var oRadioButtonList = radioButtonHash[oTarget.name];
        if ( oRadioButtonList == null )
        {
          oRadioButtonList = new Object();
          oRadioButtonList.Name = oTarget.name;
          oRadioButtonList.oRecord = oRecord;
          aRadioButtonList[aRadioButtonList.length] = oRadioButtonList;
          radioButtonHash[oTarget.name] = oRadioButtonList;
          oRadioButtonList.aRadioButtons = new Array();
        }
        oRadioButtonList.aRadioButtons[oRadioButtonList.aRadioButtons.length] = oTarget;
        oObject.name = oTarget.name;
      }
      else
      {
        oObject.name = oObject.id;
      }
      
      WebControl.MergeAttachedObjects(oObject, oTarget);
      
      controlTemplateWrapper = WebControl.Controls.GetInstance(oTarget);
      recordWrapper = WebControl.Records.GetInstance(oTarget.oRecord);
            
      WebControl.SetEventHandler(oTarget);
      if ((controlTemplateWrapper.HasFqn == true || controlTemplateWrapper.RunMergeData == true) && doMerge == true)
      {
        WebControl.MergeData(this, oTarget, oRecord, true, controlTemplateWrapper, recordWrapper);
      }
      else
      {
        WebControl.SetIf(oTarget, controlTemplateWrapper, recordWrapper);
      }
      if (controlTemplateWrapper.ControlType != "RadioButton")
      {
        WebControl.CheckChangeTracking(oTarget, oRecord);
      }  

      if (controlTemplateWrapper.IsDeleteButton == true)
      {
        if ( ! (WebData.GetRowState(oTarget.oRecord) == "inserted"))
        {
          var allowDelete = ! ((this.AllowDelete == false) || !WebControl.IsDeletable(oTarget, oRecord, controlTemplateWrapper, recordWrapper));
          if (allowDelete == false) WebControl.SetDisabled(oTarget);
        }
      }
      else if (controlTemplateWrapper.IsCopyButton == true)
      {
        var allowCopy = ! ((this.AllowCopy == false) || !WebControl.IsCopyable(oTarget, oRecord, controlTemplateWrapper, recordWrapper));
        if (allowCopy == false) WebControl.SetDisabled(oTarget);
      }
      else if (controlTemplateWrapper.IsInsertButton == true)
      {
        var allowInsert = ! ((this.AllowEdit == false) || !WebControl.IsEditable(oTarget, oRecord, controlTemplateWrapper, recordWrapper));
        if (allowInsert == false) WebControl.SetDisabled(oTarget);
      }
    }  
    
    // recreate radiobutton objects
    for (var i = 0; i < aRadioButtonList.length ; i++)
    {
      var oRadioButtonList = aRadioButtonList[i];
      var uniqueName = WebControl.CreateUniqueClientId(oRadioButtonList.oRecord, oRadioButtonList.Name);
      
      if (oRadioButtonList.aRadioButtons.length > 0)
      {
        var oFirstRadioButton = oRadioButtonList.aRadioButtons[0];
        var bindingHash = WebData.GetBindingHash(oFirstRadioButton.oFieldDescriptor.getAttribute("Fqn"), oFirstRadioButton.oRecord);
        if (WebControl.FieldToHtmlObject.Contains(bindingHash) == true) 
        {
          WebControl.FieldToHtmlObject.Set(bindingHash, null);
        }
      }
            
      for  (var j = 0; j < oRadioButtonList.aRadioButtons.length; j++)
      {
        var oOldRadioButton = oRadioButtonList.aRadioButtons[j];
        
        var outerHtml = new String("<INPUT type=\"radio\" name=\"" + uniqueName + "\"");
        outerHtml = oOldRadioButton.checked == true ? outerHtml.concat(" checked=\"checked\"") : outerHtml;
        outerHtml = outerHtml.concat(" value=\"" + oOldRadioButton.value + "\"");
        outerHtml = outerHtml.concat(">");
         
        var oNewRadioButton = document.createElement(outerHtml);

        oOldRadioButton.ObjectID = oOldRadioButton.id;
        oOldRadioButton.BindingIndex = oOldRadioButton.BindingIndex;
        oNewRadioButton.mergeAttributes(oOldRadioButton, true);
        WebControl.MergeAttachedObjects(oOldRadioButton, oNewRadioButton, false);
        WebControl.MergeAttachedEvents(oOldRadioButton, oNewRadioButton);

        var oParent = oOldRadioButton.parentElement;
        oNewRadioButton = oParent.insertBefore(oNewRadioButton, oOldRadioButton);
        oParent.removeChild(oOldRadioButton);
        oNewRadioButton.id = oOldRadioButton.id;
        
        WebControl.AddBoundControl(oNewRadioButton.oFieldDescriptor.getAttribute("Fqn"), oNewRadioButton.oRecord, oNewRadioButton);
        WebControl.CheckGalaxy(oNewRadioButton);
        oColumn.ClientBoundControlArray[oOldRadioButton.BindingIndex] = oNewRadioButton;
        if (j == 0)
        {
          WebControl.CheckChangeTracking(oNewRadioButton.oGalaxy, oRecord);
        }
      }
    }
    
    controlTemplateWrapper = WebControl.Controls.GetInstance(oColumn);
    recordWrapper = WebControl.Records.GetInstance(oRecord);
    WebControl.SetIf(oColumn, controlTemplateWrapper, recordWrapper);
    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebColumnGridClass_MergeRecord", "Section1")
  }
};

function WebColumnGridClass_Hide()
{
  try
  { 
    Ilp.HtmlDom.SetStyle(this.Container, "display", "none");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebColumnGridClass_Hide", "Section1")
  }
};

function WebColumnGridClass_Show()
{
  try
  { 
    Ilp.HtmlDom.SetStyle(this.Container, "display", "block");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebColumnGridClass_Show", "Section1")

  }
};

function WebColumnGridClass_DeleteRecord(oRecord, silent)
{
  try
  { 
    var key = WebControl.CreateTBodyID(oRecord);
    var oColumn = this.Columns.Get(key);

    var continueProgram = true;
    
    var args = new EventArgs();
    args.Deleted = false;
    
    if (silent == false)
    {
      if (WebData.AskDelete() == false)
      {
        continueProgram = false;
      }
    }
    
    if (continueProgram == true)
    {
      if (WebData.Delete(oRecord) == true)
      {
        this.Columns.Remove(key);
      
        args.Deleted = true;
        var oParent = oColumn.parentElement;
        oParent.removeChild(oColumn);
        
        if (this.Columns.Count() > 1)
        {
          var oColumn = this.Columns.GetLast();
          Ilp.HtmlDom.ReplaceClass(oColumn, this.MiddleColumnCssClass, this.LastColumnCssClass);
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebColumnGridClass_DeleteRecord", "");
  }
};

function WebColumnGridClass_Clear(oRecord, silent)
{
  try
  {
    for (var key in this.Columns.Hashtable) 
    {
      var oColumn = this.Columns.Get(key);
      var oParent = oColumn.parentElement;
      oParent.removeChild(oColumn);
    }
    
    this.Columns.Clear();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebColumnGridClass_Clear", "");
  }
};

function WebColumnGridClass_NewRecord(sender, mode)
{
  try
  { 
    var args = new EventArgs();
    args.WebColumnGrid = this;
    
    WebStatusBar.SetDataChangedMessage(ids_DataChanged, 1);

    var argsTemp = new EventArgs();
    var oRecordNew = this.NewRecordOnly(sender, mode, argsTemp);
    
    if (this.FocusFqn.length > 0) this.SetFocus(oRecordNew);
    
    return oRecordNew;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebColumnGridClass_NewRecord", "");
  }
};

function WebColumnGridClass_NewRecordOnly(sender, mode, argsTemp)
{
  try
  {
    mode = mode == null ? "append" : mode;
    argsTemp = argsTemp == null ? (new EventArgs()) : argsTemp;
  
    argsTemp.oRecordNew = WebData.NewRecord(this.TableDescriptorFqn);
    argsTemp.oRecordNew = WebData.AddRecord(argsTemp.oRecordNew, this.oMasterRecord, sender.oRecord);

    if (this.Columns.Count() > 1)
    {
      var oColumn = this.Columns.GetLast();
      Ilp.HtmlDom.ReplaceClass(oColumn, this.LastColumnCssClass, this.MiddleColumnCssClass);
    }

    var newColumn = this.oColumnClone.cloneNode(true);
    WebControl.MergeAttributes(newColumn, this.oColumnClone);
    newColumn.oRecord = argsTemp.oRecordNew; 
    
    if (this.Columns.Count() == 0)
    {
      Ilp.HtmlDom.AddClass(newColumn, this.FirstColumnCssClass);
    }
    else
    {
      Ilp.HtmlDom.AddClass(newColumn, this.LastColumnCssClass);
    }  

    newColumn.id = WebControl.CreateTBodyID(argsTemp.oRecordNew);
    newColumn.ClientBoundControlArray = new Array();
    WebControl.FindClientBoundControls(newColumn, newColumn);

    if (this.hMiddle) this.hMiddle.appendChild(newColumn);
    else this.Container.appendChild(newColumn);
    
    this.Columns.Add(newColumn.id, newColumn);

    this.MergeRecord(argsTemp.oRecordNew, newColumn);

    return argsTemp.oRecordNew;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebColumnGridClass_NewRecordOnly", "");
  }
};


function WebColumnGridClass_SetFocus(oRecord)
{
  try
  {
    if (this.FocusFqn.length > 0)
    {
      if (oRecord == null)
      {
        var xPath = this.TableDescriptorFqn;
        if (this.oMasterRecord != null)
        { 
          xPath = WebData.GetRecordSelectorB(this.oMasterRecord) + "/" + this.TableDescriptorFqn ;
        }  
        oRecord = WebData.GetRecord(xPath, 0);
      }
      if (oRecord != null)
      {
        var oControl = WebControl.GetControl(this.FocusFqn, oRecord);
        
        WebControl.ScrollToControl(oControl, Graphic3DInstance.Bottom_Bottom, 100);
        WebControl.FireEvent(oControl, "onfocus");
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebColumnGridClass_SetFocus", "");
  }
};

function WebColumnGridClass_Rebind()
{
  try
  {
    var xPath = this.TableDescriptorFqn;
    if (this.oMasterRecord)
    {
      xPath = WebData.GetRecordSelector(this.oMasterRecord) + "/" + this.TableDescriptorFqn;
    }
  
    var oRecordList = WebData.Select(xPath);
    this.Clear();
    this.MergeRecordList(oRecordList);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebColumnGridClass_Rebind", "Section1")
  }
};

function WebColumnGridClass_ShowContextMenu(sender)
{
  try
  {
    WebControl.GetContextMenu(this, sender);
    
    this.ContextControl = sender;
    this.DropDownMenu.Show(sender, 0);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebColumnGridClass_ShowContextMenu", "")
  }
};

function WebColumnGridClass_ProcessClick(sender)
{
  try
  {
    switch(sender.getAttribute("ControlType"))
    {
      case "Label":    
        break;
      case "Image":
        switch(sender.getAttribute("ButtonType"))
        {
          case "ContextMenuButton":
            if (sender.disabled == true) alert(ids_NoActionPossible);
            else this.ShowContextMenu(sender);
            window.event.cancelBubble = true;
            break;
        }
        break;
    }    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebColumnGridClass_ProcessClick", "Section1")
  }
};

function WebColumnGridClass_ProcessContextClick(sender)
{
  try
  {
    if (this.ContextControl)
    {
      this.ContextControl.MenuItem = sender.MenuItem;
      
      var args = new EventArgs();
      args.oRecord = this.ContextControl.oRecord;
      args.MenuItem = sender.MenuItem;
      
      if (typeof(sender.MenuItem.OnClickHandler) == "function")
      {
        sender.MenuItem.OnClickHandler(this.ContextControl, args);
      }
      
      if (args.Cancel == false)
      {  
        switch(sender.getAttribute("NavigateTag"))
        {
          case "RecordInfo":
            WebControl.ShowRecordInfo(this.ContextControl);
            break;
        }
      }
    }  
    window.event.cancelBubble = true;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebColumnGridClass_ProcessContextClick", "")
  }
}


function WebColumnGridClass_GetColumnIndex(oRecord)
{
  try
  {
    var index = -1;
    for (var i = 0; i < this.Columns.Count(); i++)
    {
      var oColumn = this.Columns.GetByIndex(i);
      if (oColumn.oRecord == oRecord)
      {
        index = i;
      }
    }
    return index;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebColumnGridClass_GetColumnIndex", "")
  }
};


function WebColumnGridClass_GetPosition(oRecord)
{
  try
  {
    var position = "";
    
    var index = this.GetColumnIndex(oRecord);
    if (index > -1)
    {
      if (index == 0)
      {
        position = this.PositionLeft;
      }
      else if (index == this.Columns.Count() - 1)
      {
        position = this.PositionRight;
      }
      else
      {
        position = this.PositionMiddle;
      }
    }
    
    return position;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebColumnGridClass_GetPosition", "")
  }
};


/* ============================ GTWebSpreadSheet.js ===========================*/
window.WebSpreadSheetCollection = new Object();
window.WebSpreadSheetArray = new Array();

function LoadSpreadSheets()
{
  try
  { 
    EnsureWebForm();
    EnsureWebControl();
    for (var i = 0; i < WebSpreadSheetObjects.length; i++)
    {
      var webSpreadSheetContainer = document.getElementById(WebSpreadSheetObjects[i])
      var webSpreadSheet = new WebSpreadSheetClass(webSpreadSheetContainer);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "LoadSpreadSheets", "");
  }
}

function WebSpreadSheetClass(webSpreadSheetContainer, oMasterRecord)
{
  try
  {
    this.Container = webSpreadSheetContainer;
    this.Container.JsInstance = this;
    this.ObjectID = this.Container.id;
    this.ClientID = this.Container.id;
    this.ClassType = "WebSpreadSheetClass";
    this.TableDescriptorFqn = WebControl.GetTableDescriptorFqn(this.Container);

    this.ControlLayoutMode = Ilp.HtmlDom.GetAttribute(this.Container, "ControlLayoutMode", "");
    this.MenuBar = Ilp.HtmlDom.GetAttribute(this.Container, "MenuBar", "");
    
    this.TableName = Ilp.HtmlDom.GetAttribute(this.Container, "TableName", "");
    this.PkFieldName = Ilp.HtmlDom.GetAttribute(this.Container, "PkFieldName", "");
    
    this.ShowTotalInStatusBar = Ilp.HtmlDom.GetAttributeBool(this.Container, "ShowTotalInStatusBar", "true");
    
    if (this.oMasterRecord == null)
    {
      window.WebSpreadSheetCollection[this.ClientID] = this;
      window.WebSpreadSheetArray[window.WebSpreadSheetArray.length] = this;
    }

    this.NewRecord = WebSpreadSheetClass_NewRecord;
    this.ShowContextMenu = WebSpreadSheetClass_ShowContextMenu;
    
    this.SetInnerHtml = WebSpreadSheetClass_SetInnerHtml;
    this.InitControls = WebSpreadSheetClass_InitControls;
    this.BindTBody = WebSpreadSheetClass_BindTBody;
    this.Hide = WebSpreadSheetClass_Hide;
    this.Show = WebSpreadSheetClass_Show;
    this.MergeTable = WebSpreadSheetClass_MergeTable;
    this.ShowTotal = WebSpreadSheetClass_ShowTotal;

    this.ProcessClick = WebSpreadSheetClass_ProcessClick;
    this.ProcessContextClick = WebSpreadSheetClass_ProcessContextClick;

    this.InitControls();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebSpreadSheetClass", "");
  }
}

function WebSpreadSheetClass_ProcessClick(sender, src)
{
  try
  {
    sender = Ilp.Event.GetSender(sender, src, this);
    src = Ilp.Event.GetSrc(sender, src);

    switch(src.getAttribute("CT")*1)
    {
      case enum_CT_WebDataHeader_SpyButton:
        this.Header.ProcessClick(sender, src);
        Ilp.Event.Cancel(sender);
        break;
      case enum_CT_HtmlTable_ContextMenuButton:
        if (sender.disabled == true) alert(ids_NoActionPossible);
        else this.ShowContextMenu(src);
        Ilp.Event.Cancel(sender);
        break;
      default:
        switch(src.getAttribute("ControlType"))
        {
          case "Image":
            switch(sender.getAttribute("ButtonType"))
            {
            }
          case "HyperLink":
            switch(src.getAttribute("NavigateTag"))
            {
              case "ColumnOrder":
                if (src.disabled == true) alert(ids_NoActionPossible);
                else WebControl.ShowColumnOrderDialog(sender, src);    
                Ilp.Event.Cancel(sender);
                break;
            }
          default:
            WebForm.OnClickHandler(sender, src);
            break;
        }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebSpreadSheetClass_ProcessClick", "Section1")
  }
}
function WebSpreadSheetClass_ProcessContextClick(sender)
{
  try
  {
    if (this.ContextControl)
    {
      this.ContextControl.MenuItem = sender.MenuItem;
      
      var args = new EventArgs();
      args.oRecord = this.ContextControl.oRecord;
      args.MenuItem = sender.MenuItem;
      
      if (typeof(sender.MenuItem.OnClickHandler) == "function")
      {
        sender.MenuItem.OnClickHandler(this.ContextControl, args);
      }
      
      if (args.Cancel == false)
      { 
        switch(sender.getAttribute("NavigateTag"))
        {
          case "RecordInfo":
            WebControl.ShowRecordInfo(this.ContextControl);
            break;
        }
      }
    }
         
    Ilp.Event.Cancel(this.ContextControl);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebSpreadSheetClass_ProcessContextClick", "Section1")
  }
}
function WebSpreadSheetClass_ShowContextMenu(sender)
{
  try
  {
    WebControl.GetContextMenu(this, this.Container);
    
    this.ContextControl = sender;
    this.DropDownMenu.Show(sender, 0);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebSpreadSheetClass_ShowContextMenu", "")
  }
};
function WebSpreadSheetClass_ShowTotal()
{
  try
  {
    if (this.ShowTotalInStatusBar == true && this.Header && this.Header.PagingManager)
    {
      if (this.Header.PagingManager.CurrentPagingLinkDescriptor)
      {
        this.Total = 0;
        if (this.Header.PagingManager.PagingLinkDescriptorList.Count() > 0)
        {
          var oLastPagingLinkDescriptor = this.Header.PagingManager.PagingLinkDescriptorList.Get(this.Header.PagingManager.PagingLinkDescriptorList.Count() - 1);
          this.Total = Number(oLastPagingLinkDescriptor.oPagingInfoItem.getAttribute("CumulativeTotal"));
        }
        this.Total += WebData.CountInserted(this.TableDescriptorFqn, this.oMasterRecord);
      }
      else
      {
        var xPath = this.TableDescriptorFqn;
        if (this.oMasterRecord)
        {
          xPath = WebData.GetRecordSelector(this.oMasterRecord) + "/" + this.TableDescriptorFqn;
        }
        this.Total = WebData.Count(xPath);
      }
      if (this.oMasterRecord)
      {
      }
      else
      {
        WebStatusBar.SetStatusbarMessage("Total: " + String(this.Total), 3);
      }  
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebSpreadSheetClass_ShowTotal", "");
  }
};
function WebSpreadSheetClass_NewRecord()
{
  try
  {
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebSpreadSheetClass_NewRecord", "Section1")
  }
};

function WebSpreadSheetClass_SetInnerHtml(markup)
{
  try
  {
    var oDiv = document.createElement("DIV");
    oDiv.innerHTML = markup;

    this.Container.innerHTML = oDiv.children[0].innerHTML;
    
    this.InitControls();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebSpreadSheetClass_SetInnerHtml", "Section1")
  }
};

function WebSpreadSheetClass_InitControls()
{
  try
  { 
    this.HeaderContainer = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_WebSpreadSheet_WebDataHeader);
    this.Header = new WebDataHeaderClass(this, this, this.HeaderContainer, this.oMasterRecord);
    
    this.TableContainer = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_WebSpreadSheet_Table);
    this.Table = new WebSpreadSheetTableClass(this, this, this.TableContainer, this.oMasterRecord);
    
    if (this.ControlLayoutMode == ControlLayoutModeEnum_Extended)
    {
      for (var i = 0; i < this.TableContainer.tBodies.length; i++)
      {
        var oTBody = this.TableContainer.tBodies[i];
        this.BindTBody(oTBody);
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebSpreadSheetClass_InitControls", "Section1")
  }
};

function WebSpreadSheetClass_BindTBody(oTBody)
{
  try
  { 
    var args = new EventArgs();
  
    for (var j = 0; j < oTBody.rows.length; j++)
    {
      var row = oTBody.rows[j];
      for (var k = 0; k < row.cells.length; k++)
      {
        var cell = row.cells[k];
        if (cell.children.length > 0)
        {
          var oControl = cell.children[0];
          
          var controlType = Ilp.HtmlDom.GetAttribute(oControl, "ControlType", "");
          if (controlType == "TextBoxExtended"
            || controlType == "DataLinkExtended"
            || controlType == "HyperLinkExtended"
            || controlType == "ImageExtended"
            || controlType == "CheckBoxExtended"
            || controlType == "ButtonExtended")
          {
            var oSun = WebControl.FindSun(oControl);
            if (oSun != null)
            {
              Ilp.Event.GetEventParams(oSun, oSun);
              
              var removed = false;
              var removeIf = Ilp.HtmlDom.GetAttribute(oSun, "RemoveIf", "");
              if (removeIf.length > 0)
              {
                var oTarget = oSun;
                eval(removeIf);
                if (WebData.ReturnIf == true)
                {
                  WebControl.RemoveControl(oControl);
                  WebData.ReturnIf = false;
                  removed = true;
                }
              }
              if (removed == false)
              {
                WebControl.SetIf(oSun);
              }
            }
          }
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebSpreadSheetClass_BindControls", "Section1")
  }
};

function WebSpreadSheetClass_Hide()
{
  try
  { 
    Ilp.HtmlDom.SetStyle(this.Container, "display", "none");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebSpreadSheetClass_Hide", "Section1")
  }
};

function WebSpreadSheetClass_Show()
{
  try
  { 
    Ilp.HtmlDom.SetStyle(this.Container, "display", "block");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebSpreadSheetClass_Show", "Section1")

  }
};

function WebSpreadSheetClass_MergeTable(markup)
{
  try
  {
    var oDiv = document.createElement("DIV");
    oDiv.innerHTML = markup;
    
    var oTable = Ilp.HtmlDom.GetFirstChildByTagName(oDiv, "TABLE");
    
    if (oTable)
    {
      var newTBody = document.createElement("TBODY");
      
      var firstTBody = oTable.tBodies[0]; 
      var rows = firstTBody.rows;
      
      for (var i = 0, len = rows.length; i < len; i++)
      {
        // 0 wird verwendet, da die rows umgehängt werden.
        newTBody.appendChild(rows[0]);
      }
      
      newTBody = this.Table.hTable.appendChild(newTBody);
      newTBody.oTBodyDescriptor = new TBodyDescriptor(this.Header.PagingManager, newTBody);
      if (this.ControlLayoutMode == ControlLayoutModeEnum_Extended)
      {
        this.BindTBody(newTBody);
      }
      
      this.Header.PagingManager.CurrentPagingLinkDescriptor.AddTBodyDescriptor(newTBody.oTBodyDescriptor);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebSpreadSheetClass_MergeTable", "");
  }
};


function WebDataHeaderClass(spreadSheetInstance, parentInstance, webDataHeaderContainer, oMasterRecord)
{
  try
  {
    this.Container = webDataHeaderContainer;
    this.Container.JsInstance = this;
    this.ObjectID = this.Container.id;
    this.ClientID = this.Container.id;
    this.ClassType = "WebDataHeaderClass";
    this.Parent = parentInstance;
    this.SpreadSheet = spreadSheetInstance;

    this.SpyButton = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_WebDataHeader_SpyButton);
    if (this.SpyButton) this.SpyButton.oWebDataHeader = this;
    
    this.ContextMenuButton = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_WebDataHeader_ContextMenuButton);
    this.NewButton = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_WebDataHeader_NewButton);
    this.ToggleButton = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_WebDataHeader_ToggleButton);
    this.InfoLabel = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_WebDataHeader_InfoLabel);
    this.CaptionLabel = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_WebDataHeader_CaptionLabel);
    
    this.PagingContainer = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_WebDataHeader_PagingContainer);

    this.MessageLabel = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_WebDataHeader_MessageLabel);
    
    if (this.PagingContainer) this.PagingManager = new PagingManagerClass(this.SpreadSheet, this, this.PagingContainer, oMasterRecord);

    this.ProcessClick = WebDataHeaderClass_ProcessClick;

    this.GetCaptionText = WebDataHeaderClass_GetCaptionText;
    this.SetCaptionText = WebDataHeaderClass_SetCaptionText;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataHeaderClass", "");
  }
}

function WebDataHeaderClass_GetCaptionText()
{
  try
  {
    return Ilp.HtmlDom.GetText(this.CaptionLabel);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataHeaderClass_GetCaptionText", "Section1")
  }
}
function WebDataHeaderClass_SetCaptionText(captionText)
{
  try
  {
    Ilp.HtmlDom.SetText(this.CaptionLabel, captionText);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataHeaderClass_SetCaptionText", "Section1")
  }
}

function WebDataHeaderClass_ProcessClick(sender, src)
{
  try
  {
    sender = Ilp.Event.GetSender(sender, src, this);
    src = Ilp.Event.GetSrc(sender, src);

    switch(src.getAttribute("CT")*1)
    {
      case enum_CT_WebDataHeader_SpyButton:
        if (src.disabled == true) alert(ids_NoActionPossible);
        else WebControl.ShowSearch(src);
        Ilp.Event.Cancel(event);
        break;
      default:
        break;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataHeaderClass_ProcessClick", "Section1")
  }
}

function PagingManagerClass(spreadSheetInstance, parentInstance, pagingContainer, oMasterRecord)
{
  try
  {
    this.Container = pagingContainer;
    this.Container.JsInstance = this;
    this.ObjectID = this.Container.id;
    this.ClientID = this.Container.id;
    this.ClassType = "PagingManagerClass";
    this.Parent = parentInstance;
    this.SpreadSheet = spreadSheetInstance;

    this.WebPaging = new WebPagingClass(pagingContainer);

    this.TogglePageLink = PagingManagerClass_TogglePageLink;
    this.SetNextPagingLinkDescriptor = PagingManagerClass_SetNextPagingLinkDescriptor;
    this.HideCurrentRows = PagingManagerClass_HideCurrentRows;
    this.ShowCurrentRows = PagingManagerClass_ShowCurrentRows;
    
    this.CurrentPagingLinkDescriptor = null;
    this.PreviousPagingLinkDescriptor = null;
    this.PagingLinkDescriptorList = new WebArray();
    
    var oLinkList = this.Container.getElementsByTagName("SPAN");

    var count = 0;
    for(var i = 0; i < oLinkList.length; i++)
    {
      var oLink = oLinkList[i];
      if (oLink.getAttribute("CT")*1 == enum_CT_PagingContainer_PagingLink)
      {
        var oPagingInfoItem = WebMessage.GetPagingInfoItemByFqn(oLink.getAttribute("PagingInfoItemFqn"));
        
        if (oPagingInfoItem != null)
        {
          oLink.oPagingLinkDescriptor = new PagingLinkDescriptor(this, oLink, oPagingInfoItem, (count == 0 ? true : false), (count == 0 ? true : false));
          this.PagingLinkDescriptorList.Add(oLink.oPagingLinkDescriptor);
          if (count == 0) this.CurrentPagingLinkDescriptor = oLink.oPagingLinkDescriptor;
          count++;  
        }
      }
    }
    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PagingManagerClass", "");
  }
}

function PagingManagerClass_TogglePageLink()
{
  try
  {
    if (this.CurrentPagingLinkDescriptor) this.CurrentPagingLinkDescriptor.Deactivate();
    if (this.CurrentPagingLinkDescriptor) this.PreviousPagingLinkDescriptor = this.CurrentPagingLinkDescriptor;
    if (this.NextPagingLinkDescriptor) this.CurrentPagingLinkDescriptor = this.NextPagingLinkDescriptor;
    if (this.CurrentPagingLinkDescriptor) this.CurrentPagingLinkDescriptor.Activate();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PagingManagerClass_TogglePageLink", "");
  }
};

function PagingManagerClass_SetNextPagingLinkDescriptor(oPagingLinkDescriptor)  
{
  try
  {
    this.NextPagingLinkDescriptor = oPagingLinkDescriptor;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PagingManagerClass_SetNextPagingLinkDescriptor", "Section1")
  }
};

function PagingManagerClass_HideCurrentRows()
{
  try
  {
    Ilp.HtmlDom.SetStyle(this.SpreadSheet.Table.Container, "opacity", 0.15);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PagingManagerClass_HideCurrentRows", "");
  }
};

function PagingManagerClass_ShowCurrentRows()
{
  try
  {
    if (this.PreviousPagingLinkDescriptor)
    {
      this.PreviousPagingLinkDescriptor.Hide();
    }
    Ilp.HtmlDom.SetStyle(this.SpreadSheet.Table.Container, "opacity", 1);
    if (this.CurrentPagingLinkDescriptor)
    {
      this.CurrentPagingLinkDescriptor.Show();
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PagingManagerClass_ShowCurrentRows", "");
  }
};
function WebSpreadSheetTableClass(spreadSheetInstance, parentInstance, table, oMasterRecord)
{
  try
  {
    this.Container = table;
    this.Container.JsInstance = this;
    this.ObjectID = this.Container.id;
    this.ClientID = this.Container.id;
    this.ClassType = "WebSpreadSheetTableClass";
    this.Parent = parentInstance;
    this.SpreadSheet = spreadSheetInstance;
    
    this.hTable = table;
    this.hTHead = this.hTable.tHead;
    this.hTBody = this.hTable.tBodies[0];
    this.hTFoot = this.hTable.tFoot;
    
    this.hTBody.oTBodyDescriptor = new TBodyDescriptor(this.SpreadSheet.Header.PagingManager, this.hTBody);
    
    if (this.SpreadSheet.Header
      && this.SpreadSheet.Header.PagingManager
      && this.SpreadSheet.Header.PagingManager.CurrentPagingLinkDescriptor)
    {
      this.SpreadSheet.Header.PagingManager.CurrentPagingLinkDescriptor.AddTBodyDescriptor(this.hTBody.oTBodyDescriptor);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebSpreadSheetTableClass", "");
  }
}


/* ============================ GTWebToc.js ===========================*/
var ids_LoadingTOC = "TOC wird geladen...";
var ids_ReadyTOC   = "Ready";

var imgNormal;
var imgClicked;  

var imgPinboardInaktiv = GlobalScriptsDirectoryVirtual + "GTImagesWebToc/PinboardInaktiv.gif";
var imgPinboardAktiv = GlobalScriptsDirectoryVirtual + "GTImagesWebToc/PinboardAktiv.gif";  
var imgPinboardNow = imgPinboardInaktiv;
var isTOC = false;

var normalBackgroundColor;
var normalColor;
var normalChildColor;
var normalSpacing;
   
function WebToc_Hilite(oObject)
{
  try
  {
    normalBackgroundColor  = oObject.currentStyle.backgroundColor;  
       
    if (oObject.className=="MenuItem" || oObject.className=="MenuItemLink")
    {
      /*
      oObject.runtimeStyle.backgroundColor = "cyan";
      */
      Ilp.HtmlDom.SetStyle(oObject, "backgroundColor", "cyan");
    }
    else
    {
      /*
      oObject.runtimeStyle.backgroundColor = "aquamarine";
      */
      Ilp.HtmlDom.SetStyle(oObject, "backgroundColor", "aquamarine");
    } 

    if (oObject.className == "MenuItem")
    {
      /*
      oObject.runtimeStyle.color = oObject.runtimeStyle.backgroundColor;
      */
      Ilp.HtmlDom.SetStyle(oObject, "color", Ilp.HtmlDom.GetStyle(oObject, "backgroundColor"));
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebToc_Hilite", "Section1")
  }
}

function WebToc_Restore(oObject)
{
  try
  {
    oObject.runtimeStyle.backgroundColor = normalBackgroundColor;
    if (oObject.className=="MenuItem")
    {
      /*
      oObject.runtimeStyle.color = oObject.runtimeStyle.backgroundColor;
      */
      Ilp.HtmlDom.SetStyle(oObject, "color", Ilp.HtmlDom.GetStyle(oObject, "backgroundColor"));
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebToc_Restore", "Section1")
  }
}

function WebToc_DoPinboard(eSrc){

  try{
	  var eSrc = window.event.srcElement;

    //alert(eSrc.src);
    if (eSrc.src.indexOf("PinboardInaktiv.gif")>-1){
      eSrc.src = imgPinboardAktiv;
      imgPinboardNow = imgPinboardAktiv;
    }
    else{
      eSrc.src = imgPinboardInaktiv;
      imgPinboardNow = imgPinboardInaktiv;
    }
    //alert(eSrc.src);
	  //alert("WebToc_DoPinboard ");
    //WebToc_Resize();
    window.setTimeout("WebToc_Resize();", 10);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebToc_DoPinboard", "Section1")
  }
}

function WebToc_LoadApp(sURL, IDProgram)
{
  try
  {
    if (imgPinboardNow==imgPinboardInaktiv)
    {
      WebToc_Hide();
    }
    parent.WebControl.LoadApp(sURL, IDProgram);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebToc_LoadApp", "Section1")
  }
}


function WebToc_Show(bForce){

  try{
    if (bForce==null){
      bForce=false;
    }  

    /*
    if (StatusbarIsAvailable()==true){
      SetStatusbarMessage(ids_LoadingTOC, 0);
    } 
    */ 
    if (parent.frames["MainFrame"]){
      var divTOC = parent.frames["MainFrame"].document.getElementById("divTOC");
    }
    else{
      var divTOC = document.getElementById("divTOC");
    }  
    if (divTOC!=null){
      if (divTOC.style.display=="block"){
      }
      else{
        divTOC.style.visibility = "visible";
        divTOC.style.display = "block";
        if (parent.frames["MainFrame"]){
          divTOC.style.top = parent.frames["MainFrame"].document.body.scrollTop + 100;
        }
        else{
          divTOC.style.top = document.body.scrollTop + 100;
        }  
      }  
    }  

    if (parent.frames["MainFrame"]){
      var oifrmTOC = parent.frames["MainFrame"].document.getElementById("ifrmTOC");
    }
    else{
      var oifrmTOC = document.getElementById("ifrmTOC");
    }  
    oifrmTOC.style.visibility = "visible";
    if (isTOC==false){
      WebToc_ResizeFirstTime();
      isTOC = true;
    }
    else{
      WebToc_ResizeFirstTime();
    }

    /*
    if (StatusbarIsAvailable()==true){
      SetStatusbarMessage(ids_ReadyTOC, 0);
    }
    */  
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebToc_Show", "Section1")
  }
}

function WebToc_Reset()
{
  try
  {
    isTOC = false;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebToc_Reset", "Section1")
  }
}

function WebToc_Hide()
{
  try
  {
    var divTOC = parent.document.getElementById("divTOC");
    if (divTOC!=null)
    {
      if (divTOC.style.display=="block")
      {
        divTOC.style.display = "none";
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebToc_Hide", "Section1")
  }
}

function WebToc_ResizeFirstTime()
{
	try
	{	
    if (parent.frames["MainFrame"])
    {
  	  var oifrm = parent.frames["MainFrame"].document.getElementById("ifrmTOC");
  	}
  	else
  	{
  	  var oifrm = document.getElementById("ifrmTOC");
  	}  
	  //var oifrm = parent.frames["MainFrame"].document.frames["ifrmTOC"];
    if (parent.frames["MainFrame"])
    {
  	  var oBody = parent.frames["MainFrame"].document.frames["ifrmTOC"].document.body;
  	}
  	else
  	{
  	  var oBody = document.frames["ifrmTOC"].document.body;
  	}  
	  oifrm.style.height = oBody.scrollHeight + (oBody.offsetHeight - oBody.clientHeight);
	  oifrm.style.width = oBody.scrollWidth + (oBody.offsetWidth - oBody.clientWidth);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebToc_ResizeFirstTime", "Section1")
  }
}

function WebToc_Resize()
{
  // Diese Art funktioniert nur, wenn keine absolut positionierten Elemente
  // innerhalb des Body sind (5.5)
  // Bei 6.0 macht dies kein Unterschied
	try
	{	
    if (parent.parent.frames["MainFrame"])
    {
  	  var oifrm = parent.parent.frames["MainFrame"].document.getElementById("ifrmTOC");
  	}
  	else
  	{
  	  var oifrm = top.document.getElementById("ifrmTOC");
  	}  
	  var oBody = document.body;
	  oifrm.style.height = oBody.scrollHeight + (oBody.offsetHeight - oBody.clientHeight);
	  oifrm.style.width = oBody.scrollWidth + (oBody.offsetWidth - oBody.clientWidth);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebToc_Resize", "Section1");
  }
}

function WebToc_OnClickHandler()
{
  try
  {
	  var eSrc = window.event.srcElement;
	  var oMenu = null;
	  var oImageNode = null;

    if (eSrc.className == "Menu" || eSrc.className == "MenuImage")
    {
      if (eSrc.className == "Menu")
      {
	      oImageNode = WebToc_GetPreviousSibling(eSrc);
        oMenuListContainer = eSrc.nextSibling;
        if (oMenuListContainer.children == null) oMenuListContainer = eSrc.nextSibling.nextSibling;
        oMenu = eSrc;
      }
      else if(eSrc.className == "MenuImage")
      {
        oImageNode = eSrc;
        oMenuListContainer = eSrc.nextSibling.nextSibling.nextSibling.nextSibling;
        if (oMenuListContainer == null) oMenuListContainer = eSrc.nextSibling.nextSibling.nextSibling;
        oMenu = eSrc.nextSibling;
      }

      var sImage = new String(oImageNode.src);
      if (sImage.indexOf("Plus.gif")>-1)
      {
        oImageNode.src = GlobalScriptsDirectoryVirtual + "GTImagesWebToc/Minus.gif";
      }
      else
      {
        if (oMenuListContainer!=null)
        {
          oImageNode.src = GlobalScriptsDirectoryVirtual + "GTImagesWebToc/Plus.gif";
        }  
      }
      
      if (oMenuListContainer==null)
      {
      }
      else
      {
        if (oMenuListContainer.children.length>0)
        {
          if (oMenuListContainer.style.display == "block")
          {
            oMenuListContainer.style.display = "none";
            window.setTimeout("WebToc_Resize();", 10);
          }
          else
          {
            oMenuListContainer.style.display = "block";
            window.setTimeout("WebToc_Resize();", 10);
          }
        }
      }  
    }

    if (eSrc.getAttribute("URL") != null && eSrc.getAttribute("URL").length > 0)
    {
      WebToc_LoadApp(eSrc.getAttribute("URL"), eSrc.getAttribute("IDProgram"));
    }

  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebToc_OnClickHandler", "Section1")
  }
}

function WebToc_GetPreviousSibling(oNode)
{
  var oParent = oNode.parentElement;
  var nLength = oParent.children.length;
  
  for(var i=0; i<nLength; i++)
  {
    if(oParent.children[i]==oNode)
    {
      return oParent.children[i - 1];
      break;
    }
  }
}


function WebToc_ShowAll()
{
  try{
	  var cElems = document.getElementsByTagName('DIV');
	  var iNumElems = cElems.length;
	  var oTempNode = null;
	  for (var i=0; i<iNumElems; i++) 
	  {
	    if (cElems[i].className=="MenuListContainer")
	    {
	      oTempNode = WebToc_GetPreviousSibling(cElems[i]);
	      // wegen </img>
	      oTempNode = WebToc_GetPreviousSibling(oTempNode);
	      if (oTempNode)
	      {
	        oTempNode.src = GlobalScriptsDirectoryVirtual + "GTImagesWebToc/Minus.gif";
	      }
	      cElems[i].style.display = "block";
	    }  
	  }  
    window.setTimeout("WebToc_Resize();", 10);
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebToc_ShowAll", "Section1")
  }
}
	
function WebToc_HideAll()
{
  try
  {
	  var cElems = document.getElementsByTagName('DIV');
	  var iNumElems = cElems.length;
	  var oTempNode = null;
	  for (var i=0; i<iNumElems; i++) 
	  {
	    if (cElems[i].className=="MenuListContainer")
	    {
	      oTempNode = WebToc_GetPreviousSibling(cElems[i]);
	      // wegen </img>
	      oTempNode = WebToc_GetPreviousSibling(oTempNode);
	      if (oTempNode)
	      {
	        oTempNode.src = GlobalScriptsDirectoryVirtual + "GTImagesWebToc/Plus.gif";
	      }
	      cElems[i].style.display = "none";
	    }  
	  }  
    window.setTimeout("WebToc_Resize();", 10);
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebToc_HideAll", "Section1")
  }
}

function ResetTOC()
{
  WebToc_Reset();
}

function ShowToc(bForce)
{
  WebToc_Show(bForce);
}

/* ============================ GTWebDataSheet.js ===========================*/
window.WebDataSheetCollection = new Object();
window.WebDataSheetArray = new Array();
function LoadSheets()
{
  try
  { 
    EnsureWebForm();
    EnsureWebControl();
    for (var i = 0; i < WebDataSheetObjects.length; i++)
    {
      if (WebDataSheetObjects[i] == "body")
      {
        webDataSheetContainer = document.body;
      }
      else
      {
        webDataSheetContainer = document.getElementById(WebDataSheetObjects[i]);
      }
      var webDataSheet = new WebDataSheet(webDataSheetContainer);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "LoadSheets", "");
  }
}

function WebDataSheet(webDataSheetContainer, oMasterRecord)
{
  try
  { 
    this.Container = webDataSheetContainer;
    this.Container.JsInstance = this;
    this.ObjectID = this.Container.id;
    this.ClientID = this.Container.id;
    this.ClassType = "WebDataSheet";

    this.TableDescriptorFqn = WebControl.GetTableDescriptorFqn(this.Container);

    this.AllowEdit = this.Container.getAttribute("AllowEdit") == "false" ? false : true; 
    this.AllowNew = this.Container.getAttribute("AllowNew") == "false" ? false : true; 
    this.AllowDelete = this.Container.getAttribute("AllowDelete") == "false" ? false : true; 
    this.AllowCopy = this.Container.getAttribute("AllowCopy") == "false" ? false : true; 
  
    this.ChildGridCollection = new Object();
    this.ChildGridArray = new Array();
    
    this.oChildSheetCollection = new Object();

    this.oTableTemplate = WebControl.GetDomElementByTagName(this.Container, "TABLE");
    if (this.oTableTemplate != null)
    {
      this.oTHead = this.oTableTemplate.tHead;
    }

    WebControl.SetRuntimeParameter(this.Container);

    this.GetData = WebDataSheet_GetData;
    this.Save = WebDataSheet_Save;
    this.FillWebControls = WebDataSheet_FillWebControls;
    this.FillWebControlsT = WebDataSheet_FillWebControlsT;

    this.Hide = WebDataSheet_Hide;
    this.LoadData = WebDataSheet_LoadData;
    this.LoadDataSync = WebDataSheet_LoadDataSync;
    
    this.ProcessClick = WebDataSheet_ProcessClick;
    
  	if (this.oMasterRecord == null)
  	{
      window.WebDataSheetCollection[this.ClientID] = this;
      window.WebDataSheetArray[window.WebDataSheetArray.length] = this;
    }
    
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebDataSheet", "")
  }
}

function WebDataSheet_GetData()
{
  try
  { 
    WebData.GetData();
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebDataSheet_GetData", "")
  }
}

function WebDataSheet_Save(oControl)
{
  try
  { 
    if (oControl!=null){
      oControl.disabled = true;
    }  

    WebStatusBar.SetDataChangedMessage(ids_DataSaving, 1);
  
    WebData.Save(oControl);

    var OnAfterSaveHandler = this.getAttribute("OnAfterSaveHandler")
    if (typeof(OnAfterSaveHandler) == "string")
    {
      var args = new EventArgs();
      eval(OnAfterSaveHandler + "(this, args);");
    }

    WebData.EnsureCurrentRecord(this.getAttribute("TableDescriptorFqn"));

    WebStatusBar.SetDataSavedMessage(ids_DataSaved, 1);

    if (oControl!=null){
      oControl.disabled = false;
    }  
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebDataSheet_Save", "")
  }
}

function WebDataSheet_ProcessClick(sender)
{
  try
  {
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSheet_ProcessClick", "Section1")
  }
}

function WebDataSheet_FillWebControls()
{
  try
  { 
    WebStatusBar.SetStatusbarMessage(ids_LoadingData, 0);

    this.Hide();
    window.setTimeout("window.WebDataSheetCollection[\"" + this.ClientID + "\"].FillWebControlsT();", 100);

  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSheet_FillWebControls", "Section1")
  }
}

function WebDataSheet_FillWebControlsT(oRecord)
{
  try
  { 
    WebControl.AddKpiLogMessage(new Date(), "WebDataSheet_FillWebControlsT", this.TableDescriptorFqn);
    this.StartTime = new Date();
  
    if (oRecord == null)
    {
      oRecord = WebData.GetFirstRecord(this.TableDescriptorFqn);
      if (oRecord == null){
        return;
      }
    }
  
    var oDataField = null;
    var oFieldDescriptor = null;
    var oFieldDescriptorList = null;
    var oTarget = null;
    var oTargetCollection = null;
    var tableDesriptorFqn = oRecord.nodeName;
    var fieldDescriptorFqn = "";
    var dataTableRelationFqnList = "";
    var htmlID = "";
    
    // Look for all objects to be bound
    this.Container.ClientBoundControlArray = new Array();
	  WebControl.FindClientBoundControls(this.Container, this.Container);
    
	  for (var i = 0; i < this.Container.ClientBoundControlArray.length; i++)
	  {
      var oTarget = this.Container.ClientBoundControlArray[i];
	  
      var oObject = new Object();
      oObject.oRecord = oRecord;
      oObject.oWebDataSheet = this;
      oObject.oContainer = this;
      oObject.ObjectID = oTarget.id;
      oObject.id = WebControl.CreateUniqueClientId(oRecord, oTarget.id);
      
      WebControl.MergeAttachedObjects(oObject, oTarget);
      WebControl.SetEventHandler(oTarget);
      WebControl.MergeData(this, oTarget, oRecord);
	  }
	  
    this.Container.style.display = "block";
    window.status = WebControl.TimeDiffInSeconds(this.StartTime, new Date());
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSheet_FillWebControlsT", "Section1")
  }
}

function WebDataSheet_Hide()
{
  try
  { 
    this.Container.style.display = "none";
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebDataSheet_Hide", "Section1")
  }
}

function WebDataSheet_LoadData()
{
  try
  {
    WebStatusBar.SetStatusbarMessage(ids_LoadingData, 0);
  
    var qd = WebForm.CreateQueue();
  
    qd.AddTableDescriptorFqn(this.getAttribute("TableDescriptorFqn"));
    qd.AddQueueItem("window.WebDataSheetCollection[\"" + this.ClientID + "\"].Hide();");
    qd.AddQueueItem("window.WebData.GetDataT();");
    qd.AddQueueItem("window.WebDataSheetCollection[\"" + this.ClientID + "\"].FillWebControlsT();");
    qd.AddQueueItem("window.WebDataSheetCollection[\"" + this.ClientID + "\"].ShowTotal();");

    qd.ExecuteQueue();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSheet_LoadData", "");
  }
}

function WebDataSheet_LoadDataSync()
{
  try
  {
    WebStatusBar.SetStatusbarMessage(ids_LoadingData, 0);
  
    WebMessage.AddTableDescriptorFqn(this.getAttribute("TableDescriptorFqn"));
    WebData.GetDataT();
    this.FillWebControlsT();
    this.ShowTotal();
    
    WebStatusBar.SetStatusbarMessage(ids_Ready, 0); 
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSheet_LoadDataSync", "");
  }
}


/* ============================ GTWebDataObject.js ===========================*/
window.WebDataObjectCollection = new Object();
window.WebDataObjectArray = new Array();
function LoadObjects()
{
  try
  { 
    EnsureWebForm();
    EnsureWebControl();
    for (var i = 0; i < WebDataObjects.length; i++)
    {
      webDataObjectContainer = document.getElementById(WebDataObjects[i]);
      var webDataObject = new WebDataObject(webDataObjectContainer);
    }
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "LoadObjects", "");
  }
}

function WebDataObject(webDataObjectContainer)
{
  try
  {
    this.Container = webDataObjectContainer;
    this.ObjectID = this.Container.id;
    this.ClientID = this.Container.id;
      
    this.FillWebControls = WebDataObject_FillWebControls;
    
    window.WebDataObjectCollection[this.ClientID] = this;
    window.WebDataObjectArray[window.WebDataObjectArray.length] = this;
    
    this.FillWebControls();
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebDataObject", "");
  }
}

function WebDataObject_FillWebControls()
{
  try
  {
    var oTarget = this.Container;

    WebControl.SetEventHandler(oTarget);
    
		// Determine oTarget Type and take action
		switch(oTarget.getAttribute("ControlType"))
		{
			case "DropDownList":
				WebControl.ReplaceFakeCombo(oTarget);
  			break;
			case "ListBox":
				WebControl.ReplaceFakeListBox(oTarget);
  			break;
		}
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataObject_FillWebControls", "");
  }
}




/* ============================ GTWebPrototype.js ===========================*/
/********** String **********/
String.prototype.trim = function()
{
    // Use a regular expression to replace leading and trailing 
    // spaces with the empty string
    return this.replace(/(^\s*)|(\s*$)/g, "");
}

/********** EnumDescriptor **********/
function EnumDescriptor(key, value, displayName)
{
  this.Key   = key;
  this.Value = value;
  this.DisplayName = displayName;
}


/********** 3D **********/
function Graphic3D()
{
  // für Positionierung
  this.UpperRight_UpperLeft = "1-0"; // rechts daneben
  this.BottomLeft_UpperLeft = "3-0"; // links drunter
  this.BottomRight_UpperLeft = "2-0"; // rechts drunter
  this.BottomRight_UpperRight = "2-1";
  this.BottomLeft_UpperRight = "3-1"; // links recht drüber
  this.UpperLeft_UpperRight = "0-1"; // links daneben
  this.BottomLeft_BottomRight = "3-2"; // links recht drüber
  this.UpperLeft_BottomRight = "3-2"; // links recht drüber
  this.UpperRight_BottomRight = "1-2";
  this.UpperLeft_BottomLeft = "0-3"; // rechts links drüber
  this.UpperRight_BottomLeft = "1-3";
  this.RightSide = "1-3a";

  // für scrollIntoView
  this.UpperLeft_UpperLeft = "0-0"; // links oben sollen zusammenfallen

  this.Top_Top = "k0-k0"; // beide oberen Kanten sollen zusammenfallen
  this.Bottom_Bottom = "k2-k2"; // beide unteren Kanten sollen zusammenfallen

  this.DrawingSurface = null;
  this.Shapes = new WebArray();
  
  this.eX = new Vector(1, 0, 0);
  this.eY = new Vector(0, 1, 0);
  this.eZ = new Vector(0, 0, 1);

}
Graphic3D.prototype.ProjectOnX = function(v)
{
  try
  {
    var x = 1*this.eX.Multiply(v)/Math.pow(this.eX.GetAbsoluteValue(), 2);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Graphic3D.prototype.ProjectOnX", "Section1");
  }
}
Graphic3D.prototype.GetStandardOrbit = function(mode)
{
  try
  {
    mode = mode == null ? "Standard" : mode;
    var orbit = new WebArray();

    if (mode == "WebPopUp")
    {
      orbit.Add(Graphic3DInstance.BottomLeft_UpperLeft);   // 2.
      orbit.Add(Graphic3DInstance.BottomRight_UpperLeft);  // 1.
      orbit.Add(Graphic3DInstance.UpperRight_UpperLeft);   // 0.
      orbit.Add(Graphic3DInstance.UpperRight_BottomLeft);  // 10.
      orbit.Add(Graphic3DInstance.UpperLeft_BottomLeft);   // 9.
      orbit.Add(Graphic3DInstance.UpperRight_BottomRight); // 8.
      orbit.Add(Graphic3DInstance.UpperLeft_BottomRight);  // 7.
      orbit.Add(Graphic3DInstance.BottomLeft_BottomRight); // 6.
      orbit.Add(Graphic3DInstance.UpperLeft_UpperRight);   // 5.
      orbit.Add(Graphic3DInstance.BottomLeft_UpperRight);  // 4.
      orbit.Add(Graphic3DInstance.BottomRight_UpperRight); // 3.
      orbit.Add(Graphic3DInstance.BottomRight_UpperLeft);  // 2.
      orbit.Add(Graphic3DInstance.RightSide);  // 11.
    }
    else
    {
      orbit.Add(Graphic3DInstance.UpperRight_UpperLeft);   // 0.
      orbit.Add(Graphic3DInstance.BottomRight_UpperLeft);  // 1.
      orbit.Add(Graphic3DInstance.BottomLeft_UpperLeft);   // 2.
      orbit.Add(Graphic3DInstance.BottomRight_UpperRight); // 3.
      orbit.Add(Graphic3DInstance.BottomLeft_UpperRight);  // 4.
      orbit.Add(Graphic3DInstance.UpperLeft_UpperRight);   // 5.
      orbit.Add(Graphic3DInstance.BottomLeft_BottomRight); // 6.
      orbit.Add(Graphic3DInstance.UpperLeft_BottomRight);  // 7.
      orbit.Add(Graphic3DInstance.UpperRight_BottomRight); // 8.
      orbit.Add(Graphic3DInstance.UpperLeft_BottomLeft);   // 9.
      orbit.Add(Graphic3DInstance.UpperRight_BottomLeft);  // 10.
      orbit.Add(Graphic3DInstance.UpperRight_UpperLeft);   // 0.
    }
    
    return orbit;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Graphic3D.prototype.GetStandardOrbit", "Section1");
  }
};
Graphic3D.prototype.Clear = function()
{
  try
  {
    for (var i = 0, len = this.Shapes.Count(); i < len; i++)
    {
      var shape = this.Shapes.Get(i);
      shape.Clear(this);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Graphic3D.prototype.Clear", "Section1");
  }
};
Graphic3D.prototype.Draw = function(drawingSurface)
{
  try
  {
    this.DrawingSurface = drawingSurface;

    for (var i = 0, len = this.Shapes.Count(); i < len; i++)
    {
      var shape = this.Shapes.Get(i);
      shape.Draw(this);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Graphic3D.prototype.Draw", "Section1");
  }
};
Graphic3D.prototype.IntersectScreenObject = function(shape1, shape2)
{
  try
  {
    var screenObject = null;
    var shape = new Shape();
    
    if (shape1.Contains(shape2) == true)
    {
      // oben links
      screenObject = new ScreenObject(
        null, 
        shape1.ScreenObject.Top, 
        shape1.ScreenObject.Left, 
        shape2.ScreenObject.Left - shape1.ScreenObject.Left, 
        shape2.ScreenObject.Top - shape1.ScreenObject.Top);
        
      shape = new Shape();  
      shape.ConvertScreenObjectToShape(screenObject);
      this.Shapes.Add(shape);

      // oben drueber
      screenObject = new ScreenObject(
        null, 
        shape1.ScreenObject.Top, 
        shape1.ScreenObject.Left, 
        shape2.ScreenObject.Width, 
        shape2.ScreenObject.Top - shape1.ScreenObject.Top);
        
      shape = new Shape();  
      shape.ConvertScreenObjectToShape(screenObject);
      this.Shapes.Add(shape);

      // oben rechts
      screenObject = new ScreenObject(
        null, 
        shape1.ScreenObject.Top, 
        shape2.ScreenObject.Right, 
        shape2.ScreenObject.Right - shape1.ScreenObject.Right, 
        shape2.ScreenObject.Top - shape1.ScreenObject.Top);
        
      shape = new Shape();  
      shape.ConvertScreenObjectToShape(screenObject);
      this.Shapes.Add(shape);

      // rechts daneben
      screenObject = new ScreenObject(
        null, 
        shape2.ScreenObject.Top, 
        shape2.ScreenObject.Right, 
        shape2.ScreenObject.Right - shape1.ScreenObject.Right, 
        shape2.ScreenObject.Height);
        
      shape = new Shape();  
      shape.ConvertScreenObjectToShape(screenObject);
      this.Shapes.Add(shape);

      // unten rechts
      screenObject = new ScreenObject(
        null, 
        shape2.ScreenObject.Bottom, 
        shape2.ScreenObject.Right, 
        shape2.ScreenObject.Right - shape1.ScreenObject.Right, 
        shape1.ScreenObject.Bottom);
        
      shape = new Shape();  
      shape.ConvertScreenObjectToShape(screenObject);
      this.Shapes.Add(shape);

      // unten drunter
      screenObject = new ScreenObject(
        null, 
        shape2.ScreenObject.Bottom, 
        shape2.ScreenObject.Left, 
        shape2.ScreenObject.Width, 
        shape2.ScreenObject.Bottom - shape1.ScreenObject.Bottom);
        
      shape = new Shape();  
      shape.ConvertScreenObjectToShape(screenObject);
      this.Shapes.Add(shape);

      // unten links
      screenObject = new ScreenObject(
        null, 
        shape2.ScreenObject.Bottom, 
        shape1.ScreenObject.Left, 
        shape2.ScreenObject.Left - shape1.ScreenObject.Left, 
        shape1.ScreenObject.Bottom - shape2.ScreenObject.Bottom);
        
      shape = new Shape();  
      shape.ConvertScreenObjectToShape(screenObject);
      this.Shapes.Add(shape);

      // links daneben
      screenObject = new ScreenObject(
        null, 
        shape2.ScreenObject.Top, 
        shape1.ScreenObject.Left, 
        shape2.ScreenObject.Left - shape1.ScreenObject.Left, 
        shape2.ScreenObject.Bottom);
        
      shape = new Shape();  
      shape.ConvertScreenObjectToShape(screenObject);
      this.Shapes.Add(shape);
        
    }  
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Graphic3D.prototype.IntersectScreenObject", "Section1");
  }
};


/********** Shape **********/

function Shape()
{
  this.OuterQuadrant = new WebArray();
  this.Vertices = new WebArray();
  this.ScreenObject = null;
  
  this.PositionVectorCG = null;
}
Shape.prototype.Clear = function(graphic3D)
{
  try
  {
    for (var i = 0, len = this.Vertices.Count(); i < len; i++)
    {
      var vertix = this.Vertices.Get(i);
      vertix.Clear(graphic3D);
    }
    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Shape.prototype.Clear", "Section1");
  }
};
Shape.prototype.Draw = function(graphic3D)
{
  try
  {
    for (var i = 0, len = this.Vertices.Count(); i < len; i++)
    {
      var vertix = this.Vertices.Get(i);
      vertix.Draw(graphic3D);
    }
    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Shape.prototype.Draw", "Section1");
  }
};
Shape.prototype.ConvertScreenObjectToShape = function(screenObject)
{
  try
  {
    this.ScreenObject = screenObject;
    
    var vectorUpperLeft = new Vector(this.ScreenObject.Left, this.ScreenObject.Top, 0); // oben links
    this.Vertices.Add(vectorUpperLeft);
    
    var vectorUpperRight = new Vector(this.ScreenObject.Right, this.ScreenObject.Top, 0); // oben rechts
    this.Vertices.Add(vectorUpperRight);
    
    var vectorBottomRight = new Vector(this.ScreenObject.Right, this.ScreenObject.Bottom, 0); // unten rechts
    this.Vertices.Add(vectorBottomRight);
    
    var vectorBottomLeft = new Vector(this.ScreenObject.Left, this.ScreenObject.Bottom, 0); // unten links
    this.Vertices.Add(vectorBottomLeft);
    
    var vector = vectorUpperRight.Add(vectorUpperLeft.Invert());
    var r1 = vector.GetAbsoluteValue();
    var vector = vectorBottomRight.Add(vectorUpperRight.Invert());
    var r2 = vector.GetAbsoluteValue();
    
    this.PositionVectorCG = new Vector(r1 / 2, r2 / 2, 0);
    var vector = this.Vertices.Get(0);
    
    var mTranslate = new Matrix();
    mTranslate.CreateTranslation(vector);
    
    this.PositionVectorCG = mTranslate.MultiplyByVector(this.PositionVectorCG);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Shape.prototype.ConvertScreenObjectToShape", "Section1");
  }
};
Shape.prototype.ToString = function()
{
  try
  {
    var stringExp = "";
    for (var i = 0, len = this.Vertices.Count(); i < len; i++)
    {
      var vector = this.Vertices.Get(i);
      stringExp += "(" + vector.v1[0] + "," + vector.v1[1] + "," + vector.v1[2] + "," + vector.v1[3] + "),"
    }
    stringExp = stringExp.substring(0, stringExp.length - 1);
    
    return stringExp;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "ScreenObject.prototype.ToString", "Section1");
  }
};
Shape.prototype.ApplyToScreenObject = function()
{
  try
  {
    var vector = null;
  
    if (this.ScreenObject != null)
    {
      vector = this.Vertices.Get(0);
      Ilp.HtmlDom.SetStyle(this.ScreenObject.oControl, "left", vector.v1[0].toString() + "px");
      Ilp.HtmlDom.SetStyle(this.ScreenObject.oControl, "top", vector.v1[1].toString() + "px");
    }  
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Shape.prototype.ApplyToScreenObject", "Section1");
  }
};
Shape.prototype.AddVertex = function(x, y, z)
{
  try
  {
    var vector = new Vector(x, y, z);
    this.Vertices.Add(vector);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Shape.prototype.AddVertex", "Section1");
  }
};
Shape.prototype.GetVertex = function(index)
{
  try
  {
    return this.Vertices.Get(index);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Shape.prototype.GetVertex", "Section1");
  }
};
Shape.prototype.MoveToOrigin = function()
{
  try
  {
    var vector = this.Vertices.Get(0);
    var shape = this.Translate(vector.Invert());
    
    this.CopyFrom(shape);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Shape.prototype.MoveToOrigin", "Section1");
  }
};

Shape.prototype.CopyFrom = function(shape)
{
  try
  {
    this.ScreenObject = shape.ScreenObject;
    
    this.Vertices.Clear();
    for (var i = 0, len = shape.Vertices.Count(); i < len; i++)
    {
      var vector = shape.Vertices.Get(i);
      this.Vertices.Add(vector.Clone());
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Shape.prototype.CopyFrom", "Section1");
  }
};
Shape.prototype.Contains = function(shape)
{
  try
  {
    this.CalculateBoundingBox();
    shape.CalculateBoundingBox();

    this.XContained = false;
    this.YContained = false;
    this.ZContained = false;
    
    this.XRight = false;
    this.XLeft = false;
    this.YRight = false;
    this.YLeft = false;
    this.ZRight = false;
    this.ZLeft = false;

    if (this.Xmax >= shape.Xmax && shape.Xmin >= this.Xmin)
    {
      this.XContained = true;
    }
    else
    {
      if (shape.Xmin > this.Xmax) this.XRight = true;
      if (shape.Xmax < this.Xmin) this.XLeft = true;
    }
    if (this.Ymax >= shape.Ymax && shape.Ymin >= this.Ymin)
    {
      this.YContained = true;
    }
    else
    {
      if (shape.Ymin > this.Ymax) this.YRight = true;
      if (shape.Ymax < this.Ymin) this.YLeft = true;
    }
    if (this.Zmax >= shape.Zmax && shape.Zmin >= this.Zmin)
    {
      this.ZContained = true;
    }
    else
    {
      if (shape.Zmin > this.Zmax) this.ZRight = true;
      if (shape.Zmax < this.Zmin) this.ZLeft = true;
    }
    
    return (this.XContained && this.YContained && this.ZContained)
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Shape.prototype.Contains", "Section1");
  }
};
Shape.prototype.ContainsPoint = function(vector)
{
  try
  {
    var xContained = false;
    var yContained = false;
    var zContained = false;

    if (vector.v1[0] <= this.Xmax && vector.v1[0] >= this.Xmin)
    {
      xContained = true;
    }
    if (vector.v1[1] <= this.Ymax && vector.v1[1] >= this.Ymin)
    {
      yContained = true;
    }
    if (vector.v1[2] <= this.Zmax && vector.v1[2] >= this.Zmin)
    {
      zContained = true;
    }
    
    return (xContained && yContained && zContained)
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Shape.prototype.Contains", "Section1");
  }
};
Shape.prototype.Intersect = function(shape)
{
  try
  {
    var intersetShape = new Shape();
    
    intersetShape.P = [false, false, false, false];
    
    intersetShape.Vertices.Add(new Vector(0, 0, 0));
    intersetShape.Vertices.Add(new Vector(0, 0, 0));
    intersetShape.Vertices.Add(new Vector(0, 0, 0));
    intersetShape.Vertices.Add(new Vector(0, 0, 0));

    var vector1 = null;
    
    for (var i = 0, len = this.Vertices.Count(); i < len; i++)
    {
      var vector = this.Vertices.Get(i);
  
      if (shape.ContainsPoint(vector) == true)
      {
        var vector1 = intersetShape.GetVertex(i);
        vector1.v1[0] = vector.v1[0];
        vector1.v1[1] = vector.v1[1];
        vector1.v1[2] = vector.v1[2];
        vector1.v1[3] = vector.v1[3];
        
        intersetShape.P[i] = true;
      }
    }  
    
    for (var i = 0, len = shape.Vertices.Count(); i < len; i++)
    {
      var vector = shape.Vertices.Get(i);
  
      if (this.ContainsPoint(vector) == true)
      {
        var vector1 = intersetShape.GetVertex(i);
        vector1.v1[0] = vector.v1[0];
        vector1.v1[1] = vector.v1[1];
        vector1.v1[2] = vector.v1[2];
        vector1.v1[3] = vector.v1[3];
        
        intersetShape.P[i] = true;
      }
    }
    
    var hasIntersection = true;
    for (var i = 0; i < 4; i++)
    {
      hasIntersection = hasIntersection && intersetShape.P[i];
    }
    
    if (hasIntersection) return intersetShape;    
    else return null;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Shape.prototype.Intersect", "Section1");
  }
};
Shape.prototype.BuildOuterQadrantList = function()
{
  try
  {
    var margin = 1000;
    var shape = null;
    var vector = null;
    var vector2 = null;
    
    this.OuterQuadrant.Clear();
    
    shape = new Shape();
    vector = this.GetVertex(0);
    shape.Vertices.Add(vector.Add(new Vector(-margin, -margin, 0)));
    shape.Vertices.Add(vector.Add(new Vector(0, -margin, 0)));
    shape.Vertices.Add(vector.Add(new Vector(0, 0, 0)));
    shape.Vertices.Add(vector.Add(new Vector(-margin, 0, 0)));
    shape.QuadrantIndex = 0;
    this.OuterQuadrant.Add(shape);

    shape = new Shape();
    vector = this.GetVertex(0);
    vector2 = this.GetVertex(0);
    shape.Vertices.Add(vector.Add(new Vector(0, -margin, 0)));
    shape.Vertices.Add(vector.Add(new Vector(margin, -margin, 0)));
    shape.Vertices.Add(vector.Add(new Vector(margin, 0, 0)));
    shape.Vertices.Add(vector.Add(new Vector(0, 0, 0)));
    shape.QuadrantIndex = 1;
    this.OuterQuadrant.Add(shape);

    shape = new Shape();
    vector = this.GetVertex(1);
    shape.Vertices.Add(vector.Add(new Vector(0, -margin, 0)));
    shape.Vertices.Add(vector.Add(new Vector(-margin, margin, 0)));
    shape.Vertices.Add(vector.Add(new Vector(-margin, 0, 0)));
    shape.Vertices.Add(vector.Add(new Vector(0, 0, 0)));
    shape.QuadrantIndex = 2;
    this.OuterQuadrant.Add(shape);

    shape = new Shape();
    vector = this.GetVertex(1);
    shape.Vertices.Add(vector.Add(new Vector(0, 0, 0)));
    shape.Vertices.Add(vector.Add(new Vector(margin, 0, 0)));
    shape.Vertices.Add(vector.Add(new Vector(margin, margin, 0)));
    shape.Vertices.Add(vector.Add(new Vector(0, margin, 0)));
    shape.QuadrantIndex = 3;
    this.OuterQuadrant.Add(shape);

    shape = new Shape();
    vector = this.GetVertex(2);
    shape.Vertices.Add(vector.Add(new Vector(0, 0, 0)));
    shape.Vertices.Add(vector.Add(new Vector(margin, 0, 0)));
    shape.Vertices.Add(vector.Add(new Vector(margin, margin, 0)));
    shape.Vertices.Add(vector.Add(new Vector(0, margin, 0)));
    shape.QuadrantIndex = 4;
    this.OuterQuadrant.Add(shape);

    shape = new Shape();
    vector = this.GetVertex(2);
    shape.Vertices.Add(vector.Add(new Vector(-margin, 0, 0)));
    shape.Vertices.Add(vector.Add(new Vector(0, 0, 0)));
    shape.Vertices.Add(vector.Add(new Vector(0, margin, 0)));
    shape.Vertices.Add(vector.Add(new Vector(-margin, margin, 0)));
    shape.QuadrantIndex = 5;
    this.OuterQuadrant.Add(shape);

    shape = new Shape();
    vector = this.GetVertex(3);
    shape.Vertices.Add(vector.Add(new Vector(-margin, 0, 0)));
    shape.Vertices.Add(vector.Add(new Vector(0, 0, 0)));
    shape.Vertices.Add(vector.Add(new Vector(0, -margin, 0)));
    shape.Vertices.Add(vector.Add(new Vector(-margin, -margin, 0)));
    shape.QuadrantIndex = 6;
    this.OuterQuadrant.Add(shape);

    shape = new Shape();
    vector = this.GetVertex(3);
    shape.Vertices.Add(vector.Add(new Vector(-margin, -margin, 0)));
    shape.Vertices.Add(vector.Add(new Vector(0, -margin, 0)));
    shape.Vertices.Add(vector.Add(new Vector(0, 0, 0)));
    shape.Vertices.Add(vector.Add(new Vector(-margin, 0, 0)));
    shape.QuadrantIndex = 7;
    this.OuterQuadrant.Add(shape);
    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Shape.prototype.BuildOuterQadrantList", "Section1");
  }
};
Shape.prototype.GetOverlappingQuadrant = function(shape)
{
  try
  {
    var intersectRect = null;
    
    shape.CalculateBoundingBox();
    this.BuildOuterQadrantList();
    
    for (var i = 0, len = this.OuterQuadrant.Count(); i < len; i++)
    {
      var quadrant = this.OuterQuadrant.Get(i);
      quadrant.CalculateBoundingBox();
      intersectRect = quadrant.Intersect(shape);
      if (intersectRect != null) break;
    }
    
    return intersectRect;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Shape.prototype.GetOverlappingQuadrant", "Section1");
  }
};
Shape.prototype.Overlaps = function(shape)
{
  try
  {
    this.CalculateBoundingBox();
    shape.CalculateBoundingBox();

    this.XOverlaped = true;
    this.YOverlaped = true;
    this.ZOverlaped = true;

    if (this.Xmax < shape.Xmin || shape.Xmax < this.Xmin)
    {
      this.XOverlaped = false;
    }
    else
    {
      if (this.Xmax >= shape.Xmin) this.XOverlapsRight = true;
      if (shape.Xmax >= this.Xmin) this.XOverlapsLeft = true;
    }
    if (this.Ymax < shape.Ymin || shape.Ymax < this.Ymin)
    {
      this.YOverlaped = false;
    }
    else
    {
      if (this.Ymax >= shape.Ymin) this.YOverlapsRight = true;
      if (shape.Ymax >= this.Ymin) this.YOverlapsLeft = true;
    }
    if (this.Zmax < shape.Zmin || shape.Zmax < this.Zmin)
    {
      this.ZOverlaped = false;
    }
    else
    {
      if (this.Zmax >= shape.Zmin) this.ZOverlapsRight = true;
      if (shape.Zmax >= this.Zmin) this.ZOverlapsLeft = true;
    }
    
    return (this.XOverlaped && this.YOverlaped && this.ZOverlaped)
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Shape.prototype.Overlaps", "Section1");
  }
};
Shape.prototype.CalculateBoundingBox = function()
{
  try
  {
    this.Xmin = 0;
    this.Xmax = 0;

    this.Ymin = 0;
    this.Ymax = 0;

    this.Zmin = 0;
    this.Zmax = 0;

    if (this.Vertices.Count() > 0)
    {
      var vector = this.Vertices.Get(0);
      
      this.Xmin = vector.v1[0];
      this.Xmax = vector.v1[0];

      this.Ymin = vector.v1[1];
      this.Ymax = vector.v1[1];

      this.Zmin = vector.v1[2];
      this.Zmax = vector.v1[2];

      for (var i = 1, len = this.Vertices.Count(); i < len; i++)
      {
        var vector = this.Vertices.Get(i);
        
        this.Xmin = Math.min(this.Xmin, vector.v1[0]);
        this.Xmax = Math.max(this.Xmax, vector.v1[0]);

        this.Ymin = Math.min(this.Ymin, vector.v1[1]);
        this.Ymax = Math.max(this.Ymax, vector.v1[1]);

        this.Zmin = Math.min(this.Zmin, vector.v1[2]);
        this.Zmax = Math.max(this.Zmax, vector.v1[2]);
      }
    }  
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Shape.prototype.CalculateBoundingBox", "Section1");
  }
};
Shape.prototype.Translate = function(v2)
{
  try
  {
    var shape = new Shape();
    
    shape.CopyFrom(this);
  
    var mTranslate = new Matrix();
    mTranslate.CreateTranslation(v2);
    
    for (var i = 0, len = shape.Vertices.Count(); i < len; i++)
    {
      shape.Vertices.Set(i, mTranslate.MultiplyByVector(shape.Vertices.Get(i))); 
    }
    
    return shape;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Shape.prototype.Translate", "Section1");
  }
};



/********** Matrix **********/

function Matrix()
{
  this.m1 = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];
}
Matrix.prototype.MultiplyByMatrix = function(m2)
{
  try
  {
    //Initialize the result matrix
    var result = new Matrix();
    
    // Perform the multiplication.
    for(var i = 0; i < 3; i++)
    {
      result.m1[i][0] = this.m1[i][0] * m2.m1[0][0] + this.m1[i][1] * m2.m1[1][0] + this.m1[i][2] * m2.m1[2][0] + this.m1[i][3] * m2.m1[3][0];
      result.m1[i][1] = this.m1[i][0] * m2.m1[0][1] + this.m1[i][1] * m2.m1[1][1] + this.m1[i][2] * m2.m1[2][1] + this.m1[i][3] * m2.m1[3][1];
      result.m1[i][2] = this.m1[i][0] * m2.m1[0][2] + this.m1[i][1] * m2.m1[1][2] + this.m1[i][2] * m2.m1[2][2] + this.m1[i][3] * m2.m1[3][2];
      result.m1[i][3] = this.m1[i][0] * m2.m1[0][3] + this.m1[i][1] * m2.m1[1][3] + this.m1[i][2] * m2.m1[2][3] + this.m1[i][3] * m2.m1[3][3];
    }
    
    return result;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Matrix.prototype.MultiplyByMatrix", "Section1");
  }
};
Matrix.prototype.MultiplyByVector = function(v2)
{
  try
  {
    // Initialize the result vector.
    var result = new Vector(0, 0, 0);
    
    // Perform the multiplication
    result.v1[0] = this.m1[0][0]*v2.v1[0] + this.m1[0][1]*v2.v1[1] + this.m1[0][2]*v2.v1[2] + this.m1[0][3]*v2.v1[3];
    result.v1[1] = this.m1[1][0]*v2.v1[0] + this.m1[1][1]*v2.v1[1] + this.m1[1][2]*v2.v1[2] + this.m1[1][3]*v2.v1[3];
    result.v1[2] = this.m1[2][0]*v2.v1[0] + this.m1[2][1]*v2.v1[1] + this.m1[2][2]*v2.v1[2] + this.m1[2][3]*v2.v1[3];
    result.v1[3] = this.m1[3][0]*v2.v1[0] + this.m1[3][1]*v2.v1[1] + this.m1[3][2]*v2.v1[2] + this.m1[3][3]*v2.v1[3];
  
    return result;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Matrix.prototype.MultiplyByVector", "Section1");
  }
};

Matrix.prototype.CreateTranslation = function(v2)
{
  try
  {
    this.m1 = [[1,0,0,v2.v1[0]],[0,1,0,v2.v1[1]],[0,0,1,v2.v1[2]],[0,0,0,1]];
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Matrix.prototype.CreateTranslation", "Section1");
  }
};

/********** Vector **********/
function Vector(x, y, z)
{
  this.v1 = [x, y, z, 1];
}
Vector.prototype.X = function()
{
  try
  {
    return this.v1[0];
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Vector.prototype.X", "Section1");
  }
};
Vector.prototype.Y = function()
{
  try
  {
    return this.v1[1];
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Vector.prototype.Y", "Section1");
  }
};
Vector.prototype.Clear = function(graphic3D)
{
  try
  {
    if (this.Div && this.Div.parentElement)
    {
      this.Div.parentElement.removeChild(this.Div);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Vector.prototype.Clear", "Section1");
  }
};
Vector.prototype.Draw = function(graphic3D)
{
  try
  {
    this.Div = document.createElement("div");
    this.Div.innerHTML = "*";
    this.Div.style.position = "absolute";
    this.Div.style.fontSize = "10px";
    this.Div.style.fontFamily = "verdana";
  
    this.Div.style.visibility = "visible";
    this.Div.style.color = "red";
    this.Div.style.left = this.v1[0].toString() + "px";
    this.Div.style.top = this.v1[1].toString() + "px";

    graphic3D.DrawingSurface.appendChild(this.Div);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Vector.prototype.Draw", "Section1");
  }
};
Vector.prototype.Clone = function()
{
  try
  {
    var vector = new Vector(this.v1[0], this.v1[1], this.v1[2]);
    return vector;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Vector.prototype.Clone", "Section1");
  }
};
Vector.prototype.Invert = function()
{
  try
  {
    var vector = this.Clone();
    
    vector.v1[0] = -this.v1[0];
    vector.v1[1] = -this.v1[1];
    vector.v1[2] = -this.v1[2];
    
    return vector;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Vector.prototype.Invert", "Section1");
  }
};
Vector.prototype.Add = function(v2)
{
  try
  {
    var vector = this.Clone();
    
    vector.v1[0] = this.v1[0] + v2.v1[0];
    vector.v1[1] = this.v1[1] + v2.v1[1];
    vector.v1[2] = this.v1[2] + v2.v1[2];
    
    return vector;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Vector.prototype.Add", "Section1");
  }
};
Vector.prototype.Multiply = function(v2)
{
  try
  {
    var scalar = this.v1[0] * v2.v1[0] + this.v1[1] * v2.v1[1] + this.v1[2] * v2.v1[2];
    
    return scalar;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Vector.prototype.Multiply", "Section1");
  }
};
Vector.prototype.GetAbsoluteValue = function()
{
  try
  {
    var scalar = Math.sqrt(this.Multiply(this));
    
    return scalar;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Vector.prototype.GetAbsoluteValue", "Section1");
  }
};
Vector.prototype.ToString = function()
{
  try
  {
    var stringExp = "(" + this.v1[0] + "," + this.v1[1] + "," + this.v1[2] + "," + this.v1[3] + ")";
    
    return stringExp;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Vector.prototype.GetAbsoluteValue", "Section1");
  }
};


/********** ScreenObject **********/

function ScreenObject(oControl, top, left, width, height)
{
  this.oControl = oControl;
  
  this.Top = top;
  this.Left = left;
  this.Width = width;
  this.Height = height;
  
  this.Right = this.Left + this.Width;
  this.Bottom = this.Top + this.Height;
}
ScreenObject.prototype.ToString = function()
{
  try
  {
    var stringExp = String(this.Top) + ";" + String(this.Right) + ";" + String(this.Bottom) + ";" + String(this.Left);
    
    return stringExp;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "ScreenObject.prototype.ToString", "Section1");
  }
};
ScreenObject.prototype.ToString2 = function()
{
  try
  {
    var stringExp = String(this.Top) + ";" + String(this.Left) + ";" + String(this.Width) + ";" + String(this.Height);
    
    return stringExp;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "ScreenObject.prototype.ToString2", "Section1");
  }
};

/********** ISelectDialogClass **********/
function ISelectDialogClass(sender)
{
  this.ClassType = "ISelectDialogClass";

  // Html-Control
  if (Ilp.HtmlDom.IsHtmlElement(sender) == true)
  {
    this.SelectionDescriptorFqn      = sender.getAttribute("SelectionDescriptorFqn");
    this.SelectDialogUrl             = sender.getAttribute("SelectDialogUrl");
    this.SelectDialogFeatures        = sender.getAttribute("SelectDialogFeatures");
    this.OnBeforeSelectRecordHandler = eval(sender.getAttribute("OnBeforeSelectRecordHandler"));
    this.OnAfterSelectRecordHandler  = eval(sender.getAttribute("OnAfterSelectRecordHandler"));
  }
  else
  {
    this.SelectionDescriptorFqn      = sender.SelectionDescriptorFqn;
    this.SelectDialogUrl             = sender.SelectDialogUrl ;
    this.SelectDialogFeatures        = sender.SelectDialogFeatures;
    this.OnBeforeSelectRecordHandler = eval(sender.OnBeforeSelectRecordHandler);
    this.OnAfterSelectRecordHandler  = eval(sender.OnAfterSelectRecordHandler);
  }
  
  this.SaveSelection = true;
}

/********** IEditDialogClass **********/
function IEditDialogClass(sender)
{
  this.ClassType = "IEditDialogClass";

  // Html-Control
  if (Ilp.HtmlDom.IsHtmlElement(sender) == true)
  {
    this.EditModal                 = Ilp.HtmlDom.GetAttribute(sender, "EditModal", "false");
    this.EditDialogUrl             = sender.getAttribute("EditDialogUrl");
    this.EditDialogFeatures        = sender.getAttribute("EditDialogFeatures");
    this.OnBeforeEditRecordHandler = eval(sender.getAttribute("OnBeforeEditRecordHandler"));
    this.OnAfterEditRecordHandler  = eval(sender.getAttribute("OnAfterEditRecordHandler"));
    this.EditFqn                   = sender.getAttribute("EditFqn");
    this.EditReturnFqn             = sender.getAttribute("EditReturnFqn");
  }
  else
  {
    this.EditModal                 = sender.EditModal;
    this.EditDialogUrl             = sender.EditDialogUrl;
    this.EditDialogFeatures        = sender.EditDialogFeatures;
    this.OnBeforeEditRecordHandler = eval(sender.OnBeforeEditRecordHandler);
    this.OnAfterEditRecordHandler  = eval(sender.OnAfterEditRecordHandler);
    this.EditFqn                   = sender.EditFqn ;
    this.EditReturnFqn             = sender.EditReturnFqn ;
  }
}

/********** ICopyDialogClass **********/
function ICopyDialogClass(sender)
{
  this.ClassType = "ICopyDialogClass";

  // Html-Control
  if (Ilp.HtmlDom.IsHtmlElement(sender) == true)
  {
    this.CopyModal                 = Ilp.HtmlDom.GetAttribute(sender, "CopyModal", "false");
    this.CopyDialogUrl             = sender.getAttribute("CopyDialogUrl");
    this.CopyDialogFeatures        = sender.getAttribute("CopyDialogFeatures");
    this.OnBeforeCopyRecordHandler = eval(sender.getAttribute("OnBeforeCopyRecordHandler"));
    this.OnAfterCopyRecordHandler  = eval(sender.getAttribute("OnAfterCopyRecordHandler"));
    this.CopyFqn                   = sender.getAttribute("CopyFqn");
    this.CopyReturnFqn             = sender.getAttribute("CopyReturnFqn");
  }
  else
  {
    this.CopyModal                 = sender.CopyModal ;
    this.CopyDialogUrl             = sender.CopyDialogUrl ;
    this.CopyDialogFeatures        = sender.CopyDialogFeatures;
    this.OnBeforeCopyRecordHandler = eval(sender.OnBeforeCopyRecordHandler);
    this.OnAfterCopyRecordHandler  = eval(sender.OnAfterCopyRecordHandler);
    this.CopyFqn                   = sender.CopyFqn ;
    this.CopyReturnFqn             = sender.CopyReturnFqn ;
  }
}

/********** IMoveDialogClass **********/
function IMoveDialogClass(sender)
{
  this.ClassType = "IMoveDialogClass";

  // Html-Control
  if (Ilp.HtmlDom.IsHtmlElement(sender) == true)
  {
    this.MoveModal                 = Ilp.HtmlDom.GetAttribute(sender, "MoveModal", "false");
    this.MoveDialogUrl             = sender.getAttribute("MoveDialogUrl");
    this.MoveDialogFeatures        = sender.getAttribute("MoveDialogFeatures");
    this.OnBeforeMoveRecordHandler = eval(sender.getAttribute("OnBeforeMoveRecordHandler"));
    this.OnAfterMoveRecordHandler  = eval(sender.getAttribute("OnAfterMoveRecordHandler"));
    this.MoveFqn                   = sender.getAttribute("MoveFqn");
    this.MoveReturnFqn             = sender.getAttribute("MoveReturnFqn");
  }
  else
  {
    this.MoveModal                 = sender.MoveModal ;
    this.MoveDialogUrl             = sender.MoveDialogUrl ;
    this.MoveDialogFeatures        = sender.MoveDialogFeatures;
    this.OnBeforeMoveRecordHandler = eval(sender.OnBeforeMoveRecordHandler);
    this.OnAfterMoveRecordHandler  = eval(sender.OnAfterMoveRecordHandler);
    this.MoveFqn                   = sender.MoveFqn ;
    this.MoveReturnFqn             = sender.MoveReturnFqn ;
  }
}

/********** ICopyAndMoveDialogClass **********/
function ICopyAndMoveDialogClass(sender)
{
  this.ClassType = "ICopyAndMoveDialogClass";

  // Html-Control
  if (Ilp.HtmlDom.IsHtmlElement(sender) == true)
  {
    this.CopyAndMoveModal                 = Ilp.HtmlDom.GetAttribute(sender, "CopyAndMoveModal", "false");
    this.CopyAndMoveDialogUrl             = sender.getAttribute("CopyAndMoveDialogUrl");
    this.CopyAndMoveDialogFeatures        = sender.getAttribute("CopyAndMoveDialogFeatures");
    this.OnBeforeCopyAndMoveRecordHandler = eval(sender.getAttribute("OnBeforeCopyAndMoveRecordHandler"));
    this.OnAfterCopyAndMoveRecordHandler  = eval(sender.getAttribute("OnAfterCopyAndMoveRecordHandler"));
    this.CopyAndMoveFqn                   = sender.getAttribute("CopyAndMoveFqn");
    this.CopyAndMoveReturnFqn             = sender.getAttribute("CopyAndMoveReturnFqn");
  }
  else
  {
    this.CopyAndMoveModal                 = sender.CopyAndMoveModal ;
    this.CopyAndMoveDialogUrl             = sender.CopyAndMoveDialogUrl ;
    this.CopyAndMoveDialogFeatures        = sender.CopyAndMoveDialogFeatures;
    this.OnBeforeCopyAndMoveRecordHandler = eval(sender.OnBeforeCopyAndMoveRecordHandler);
    this.OnAfterCopyAndMoveRecordHandler  = eval(sender.OnAfterCopyAndMoveRecordHandler);
    this.CopyAndMoveFqn                   = sender.CopyAndMoveFqn ;
    this.CopyAndMoveReturnFqn             = sender.CopyAndMoveReturnFqn ;
  }
}

/********** IEditDialogClass **********/
function IGridDialogClass(iDialog)
{
  this.ClassType = "IGridDialogClass";

  if (iDialog.ClassType == "IEditDialogClass")
  {
    this.EditModal                 = iDialog.EditModal;
    this.EditDialogUrl             = iDialog.EditDialogUrl;
    this.EditDialogFeatures        = iDialog.EditDialogFeatures;
    this.OnBeforeEditRecordHandler = iDialog.OnBeforeEditRecordHandler;
    this.OnAfterEditRecordHandler  = iDialog.OnAfterEditRecordHandler;
    this.EditFqn                   = iDialog.EditFqn;
    this.EditReturnFqn             = iDialog.EditReturnFqn;
  }
  else if (iDialog.ClassType == "ICopyDialogClass")
  {
    this.EditModal                 = iDialog.CopyModal;
    this.EditDialogUrl             = iDialog.CopyDialogUrl;
    this.EditDialogFeatures        = iDialog.CopyDialogFeatures;
    this.OnBeforeEditRecordHandler = iDialog.OnBeforeCopyRecordHandler;
    this.OnAfterEditRecordHandler  = iDialog.OnAfterCopyRecordHandler;
    this.EditFqn                   = iDialog.CopyFqn;
    this.EditReturnFqn             = iDialog.CopyReturnFqn;
  }
  else if (iDialog.ClassType == "IMoveDialogClass")
  {
    this.EditModal                 = iDialog.MoveModal;
    this.EditDialogUrl             = iDialog.MoveDialogUrl;
    this.EditDialogFeatures        = iDialog.MoveDialogFeatures;
    this.OnBeforeEditRecordHandler = iDialog.OnBeforeMoveRecordHandler;
    this.OnAfterEditRecordHandler  = iDialog.OnAfterMoveRecordHandler;
    this.EditFqn                   = iDialog.MoveFqn;
    this.EditReturnFqn             = iDialog.MoveReturnFqn;
  }
  else if (iDialog.ClassType == "ICopyAndMoveDialogClass")
  {
    this.EditModal                 = iDialog.CopyAndMoveModal;
    this.EditDialogUrl             = iDialog.CopyAndMoveDialogUrl;
    this.EditDialogFeatures        = iDialog.CopyAndMoveDialogFeatures;
    this.OnBeforeEditRecordHandler = iDialog.OnBeforeCopyAndMoveRecordHandler;
    this.OnAfterEditRecordHandler  = iDialog.OnAfterCopyAndMoveRecordHandler;
    this.EditFqn                   = iDialog.CopyAndMoveFqn;
    this.EditReturnFqn             = iDialog.CopyAndMoveReturnFqn;
  }
}

/********** IWebPopUpClass **********/
function IWebPopUpClass(sender)
{
  this.WebPopUpFqn = Ilp.HtmlDom.GetAttribute(sender, "WebPopUpFqn", "");

  this.WebPopUpWidth = Ilp.HtmlDom.GetAttribute(sender, "WebPopUpWidth", "350px");
  this.WebPopUpHeight = Ilp.HtmlDom.GetAttribute(sender, "WebPopUpHeight", "200px");
  this.WebPopUpBehavior = Ilp.HtmlDom.GetAttribute(sender, "WebPopUpBehavior", enum_WebPopUpBehavior_OnMouseOver);
  this.WebPopUpLayout = Ilp.HtmlDom.GetAttribute(sender, "WebPopUpLayout", "Div");
  this.WebPopUpCaption = Ilp.HtmlDom.GetAttribute(sender, "WebPopUpCaption", "");
}

/********** PageParamDescriptor **********/
function PageParamDescriptor(key, value)
{
  this.Key   = key;
  this.Value = value;
}


/********** WebRecordItem **********/
function WebRecordItem(oRecord, oMasterRecord)
{
  this.oRecord        = oRecord;
  this.oMasterRecord  = oMasterRecord;
}

/********** WebDomItem **********/
function WebDomItem(oDomRoot, oDomElement)
{
  this.oDomRoot     = oDomRoot;
  this.oDomElement  = oDomElement;
}

/********** WebQueue **********/
function WebQueue()
{
  try
  {
    this.Array = new Array();
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebQueue", "Section1")
  }
}

WebQueue.prototype.Enqueue = function(value)
{
  try
  {
    this.Array.push(value);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebQueue_Enqueue", "Section1")
  }
};

WebQueue.prototype.Dequeue = function()
{
  try
  {
    return this.Array.pop();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebQueue_Dequeue", "Section1")
  }
};

WebQueue.prototype.Count = function()
{
  try
  {
    return this.Array.length;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebQueue_Count", "Section1")
  }
};

/********** WebArray **********/
function WebArray()
{
  try
  {
    this.Array = new Array();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebArray", "Section1")
  }
}

WebArray.prototype.Add = function(value)
{
  try
  {
    this.Array[this.Array.length] = value;

    return this.Array.length - 1;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebArray_Add", "Section1")
  }
};

WebArray.prototype.Get = function(index)
{
  try
  {
    return this.Array[index];
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebArray_Get", "Section1")
  }
};

WebArray.prototype.Shift = function()
{
  try
  {
    return this.Array.shift();;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebArray_Shift", "Section1")
  }
};

WebArray.prototype.Set = function(index, value)
{
  try
  {
    this.Array[index] = value;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebArray_Set", "Section1")
  }
};

WebArray.prototype.GetIndex = function(value)
{
  try
  {
    var index = -1;
    for(var i = 0; i < this.Array.length; i++)
    {
      if (this.Array[i] == value)
      {
        index = i;
        break;
      }
    }
    return index;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebArray_GetIndex", "Section1")
  }
};

WebArray.prototype.Remove = function(index)
{
  try
  {
    var tempArray = new Array();
    for(var i = 0; i < this.Array.length; i++)
    {
      if (i != index)
      {
        tempArray[tempArray.length] = this.Array[i];
      }  
    }
    this.Array = tempArray;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebArray_Remove", "Section1")
  }
};

WebArray.prototype.Contains = function(value)
{
  try
  {
    var contains = false;
    for(var i = 0; i < this.Array.length; i++)
    {
      if (this.Array[i] == value)
      {
        contains = true;
        break;
      }
    }
    return contains;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebArray_Contains", "Section1")
  }
};

WebArray.prototype.Count = function()
{
  try
  {
    return this.Array.length;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebArray_Count", "Section1")
  }
};

WebArray.prototype.Clear = function()
{
  try
  {
    this.Array = new Array();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebArray_Count", "Section1")
  }
};

WebArray.prototype.Join = function(token)
{
  try
  {
    return this.Array.join(token);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebArray_Count", "Section1")
  }
};

/********** WebHashtable **********/
function WebHybrid()
{
  try
  {
    this.Array = new Array();
    this.Hashtable = new Object();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebHybrid", "Section1")
  }
}

WebHybrid.prototype.Add = function(key, value)
{
  try
  {
    if (this.Hashtable[key] == null)
    {
      this.Hashtable[key] = value;
      this.Array[this.Array.length] = value;
    }
    return this.Array.length - 1;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebHybrid.prototype.Add", "Section1")
  }
};

WebHybrid.prototype.Count = function()
{
  try
  {
    return this.Array.length;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebHybrid.prototype.Count", "Section1")
  }
};

WebHybrid.prototype.Get = function(key)
{
  try
  {
    return this.Hashtable[key];
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebHybrid.prototype.Get", "Section1")
  }
};

WebHybrid.prototype.GetByIndex = function(index)
{
  try
  {
    return this.Array[index];
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebHybrid.prototype.GetByIndex", "Section1")
  }
};

WebHybrid.prototype.GetIndex = function(value)
{
  try
  {
    var index = -1;
    for(var i = 0; i < this.Array.length; i++)
    {
      if (this.Array[i] == value)
      {
        index = i;
        break;
      }
    }
    return index;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebHybrid.prototype.GetIndex", "Section1")
  }
};

WebHybrid.prototype.Clear = function()
{
  try
  {
    this.Array = new Array();
    this.Hashtable = new Object();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebHybrid.prototype.Clear", "Section1")
  }
};

WebHybrid.prototype.Set = function(key, value)
{
  try
  {
    if (this.Hashtable[key] == null)
    {
      this.Add(key, value);
    }
    else
    {
      this.Hashtable[key] = value;
      this.Array[this.GetIndex(value)] = value;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebHybrid.prototype.Set", "Section1")
  }
};

WebHybrid.prototype.Remove = function(key)
{
  try
  {
    var index = this.GetIndex(this.Hashtable[key])
    var tempArray = new Array();
    for(var i = 0; i < this.Array.length; i++)
    {
      if (i != index)
      {
        tempArray[tempArray.length] = this.Array[i];
      }  
    }
    this.Array = tempArray;
  
    delete this.Hashtable[key];
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebHybrid.prototype.Remove", "Section1")
  }
};

WebHybrid.prototype.GetLast = function()
{
  try
  {
    if (this.Array.length > 0)
    {
      return this.Array[this.Array.length - 1];
    }
    else
    {
      return null;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebHybrid.prototype.GetLast", "Section1")
  }
};



/********** WebHashtable **********/
function WebHashtable()
{
  try
  {
    this.Hashtable = new Object();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebHashtable", "Section1")
  }
}

WebHashtable.prototype.Add = function(key, value)
{
  try
  {
    if (this.Hashtable[key] == null)
    {
      this.Hashtable[key] = value;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebHashtable_Add", "Section1")
  }
};

WebHashtable.prototype.Contains = function(key)
{
  try
  {
    return (this.Hashtable[key] != null);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebHashtable_Contains", "Section1")
  }
};

WebHashtable.prototype.Get = function(key)
{
  try
  {
    return this.Hashtable[key];
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebHashtable_Get", "Section1")
  }
};

WebHashtable.prototype.Set = function(key, value)
{
  try
  {
    this.Hashtable[key] = value;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebHashtable_Set", "Section1")
  }
};

WebHashtable.prototype.Clear = function()
{
  try
  {
    this.Hashtable = new Object();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebHashtable_Clear", "Section1")
  }
};

/********** TabControlClass **********/
function TabControlClass(navTreeContainer, parentClass)
{
  try
  {
    this.Container = navTreeContainer;
    this.Container.JsInstance = this;
    this.ObjectID = this.Container.id;
    this.ClientID = this.Container.id;
    this.ClassType = "TabControlClass";
    if (parentClass)
    {
      this.ParentContainer = parentClass.Container;
    }
  
    this.TabStrip = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_TabControl_TabStrip); 
    this.TabPageList = new WebArray();
  
    this.CurrentIndex = -1;
    
    this.Init();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "TabControlClass", "Section1")
  }
};
TabControlClass.prototype.Init = function()
{
  try
  {
    this.TabPageList.Clear();
    
    var oTabPage = null;
    var foundSelectedTab = false;
    
    var oControlList = this.Container.getElementsByTagName("li");
    for (var i = 0; i < oControlList.length; i++)
    {
      var oControl = oControlList[i];
      
      oTabPage = new TabPageClass(oControl, this);
      if (oTabPage.Selected == true)
      {
        this.SetSelected(oTabPage, true);
        foundSelectedTab = true;
      } 
      this.TabPageList.Add(oTabPage);
    }
    
    if (foundSelectedTab == false)
    {
      oTabPage = this.TabPageList.Get(0);
      this.SetSelected(oTabPage, true);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "TabControlClass.prototype.Init", "Section1")
  }
};
TabControlClass.prototype.AppendIFrame = function(oTabPage)
{
  try
  {
    var oTabPage = this.TabPageList.Get(oTabPage.Index);
    if (oTabPage.oIFrame == null)
    {
      oIFrame = Ilp.HtmlDom.CreateElement("<iframe id=F" + String(oTabPage.Index) + " frameborder='0' scrolling='on'></iframe>");
      oIFrame = oTabPage.oTabControl.Container.appendChild(oIFrame);
      oIFrame.className = "TabFrame";
      
      var header = document.getElementById("PageHeaderContainer");
      var headerHeight = Ilp.HtmlDom.GetRegion(header).Height;
      var footer = document.getElementById("PageFooterContainer");
      var footerHeight = Ilp.HtmlDom.GetRegion(footer).Height;
      var tabStripHeight = Ilp.HtmlDom.GetRegion(this.TabStrip).Height;
      
      //oIFrame.style.setExpression("height", "parseInt(Ilp.HtmlDom.GetViewportHeight() - " + String(headerHeight + footerHeight + tabStripHeight) + ") + \"px\"", "JScript");
      //oIFrame.style.setExpression("width", "parseInt(Ilp.HtmlDom.GetViewportWidth()) + \"px\"", "JScript");
      Ilp.HtmlDom.SetExpression(oIFrame, "height", "parseInt(Ilp.HtmlDom.GetViewportHeight() - " + String(headerHeight + footerHeight + tabStripHeight) + ") + \"px\"", "JScript");
      Ilp.HtmlDom.SetExpression(oIFrame, "width", "parseInt(Ilp.HtmlDom.GetViewportWidth()) + \"px\"", "JScript");
      
      oTabPage.oIFrame = oIFrame;
      oTabPage.oWebFrame = new WebFrame(oTabPage.Container, oIFrame);
      Ilp.HtmlDom.SetStyle(oTabPage.oWebFrame.Container, "display", "none");
    }
    return oTabPage.oIFrame;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "TabControlClass.prototype.AppendIFrame", "Section1")
  }
};
TabControlClass.prototype.LoadTab = function(index, url)
{
  try
  {
    var oTabPage = this.TabPageList.Get(index);
    var oIFrame = this.AppendIFrame(oTabPage);
    oTabPage.oWebFrame.SetSrc(url);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "TabControlClass.prototype.LoadTab", "Section1")
  }
};
TabControlClass.prototype.ProcessClick = function(sender, src)
{
  try
  {
    sender = Ilp.Event.GetSender(sender, src, this);
    src = Ilp.Event.GetSrc(sender, src);

    var args = new EventArgs();

    switch(src.getAttribute("CT")*1)
    {
      case enum_CT_TabMenu_TabPage:
        var oTabPage;
        if (src.tagName == "A") oTabPage = src.parentElement.JsInstance;
        else oTabPage = src.JsInstance;
        
        this.SetSelected(oTabPage, true);
        
        if (typeof(this.OnAfterSelectHandler) == "function")
        {
          args.oTabPage = oTabPage;
          this.OnAfterSelectHandler(sender, args);
        }
        
        Ilp.Event.Cancel(event);
        break;
      default:
        break;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "TabControlClass.prototype.ProcessClick", "Section1")
  }
}
TabControlClass.prototype.SetCurrentTabPage = function(oCurrentTabPage)
{
  try
  {
    if (oCurrentTabPage == null) return;
    
    for (var i = 0, len = this.TabPageList.Count(); i < len; i++)
    {
      var oTabPage = this.TabPageList.Get(i);
      if (oTabPage.Container == oCurrentTabPage)
      {
        this.SetSelected(oTabPage, true);
      }
      else
      {
        this.SetSelected(oTabPage, false);
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "TabControlClass.prototype.SetCurrentTabPage", "Section1")
  }
};
TabControlClass.prototype.SetSelected = function(oTabPage, selected)
{
  try
  {
    oTabPage.Selected = selected;
    if (selected == true)
    {
      if (this.CurrentIndex != oTabPage.Index)
      {
        if (this.CurrentIndex > -1)
        {
          this.SetSelected(this.TabPageList.Get(this.CurrentIndex), false);
        }
        var tabPageSet = false;
        if (oTabPage.oWebFrame) 
        {
          oTabPage.oWebFrame.Show();
          Ilp.HtmlDom.SetStyle(oTabPage.oWebFrame.Container, "display", "block");
          tabPageSet = true;
        }
        else
        {
          if (this.ParentContainer && this.ParentContainer.JsInstance.ClassType == "WebDataGrid")
          {
            this.ParentContainer.JsInstance.SetCurrentTabPage();
            tabPageSet = true;
          }
        }
        if (tabPageSet == true)
        {
          this.CurrentIndex = oTabPage.Index;
          Ilp.HtmlDom.AddClass(oTabPage.Container, "Selected");
        }
      }
    }
    else
    {
      Ilp.HtmlDom.RemoveClass(oTabPage.Container, "Selected");
      if (oTabPage.oWebFrame) 
      {
        oTabPage.oWebFrame.Hide();
        Ilp.HtmlDom.SetStyle(oTabPage.oWebFrame.Container, "display", "none");
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "TabControlClass.prototype.SetSelected", "Section1");
  }
};
/********** TabPageClass **********/
function TabPageClass(li, parentClass)
{
  try
  {
    this.Container = li;
    this.Container.JsInstance = this;
    this.ObjectID = this.Container.id;
    this.ClientID = this.Container.id;
    this.ClassType = "TabPageClass";
    this.ParentClass = parentClass;
    this.ParentContainer = parentClass.Container;
  
    this.oTabControl = parentClass;
    
    this.Index = Ilp.HtmlDom.GetAttribute(this.Container, "Index", -1)*1;
    this.Selected = Ilp.HtmlDom.GetAttribute(this.Container, "Selected", "false") == "true" ? true : false;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "TabPageClass", "Section1");
  }
};

/********** MenuStripClass **********/
function MenuStripClass(navTreeContainer, parentClass)
{
  try
  {
    this.Container = navTreeContainer;
    this.Container.JsInstance = this;
    this.ObjectID = this.Container.id;
    this.ClientID = this.Container.id;
    this.ClassType = "MenuStripClass";
    if (parentClass)
    {
      this.ParentClass = parentClass;
      this.ParentContainer = parentClass.Container;
    }
  
    this.MenuStrip = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_MenuStrip); 
    this.MenuStripItemList = new WebArray();
  
    this.MenuBarBehaviour = Ilp.HtmlDom.GetAttribute(this.Container, "MenuBarBehaviour", "");
    this.CurrentIndex = -1;
    this.CurrentSubMenu = null;
    
    this.Init();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MenuStripClass", "Section1")
  }
};
MenuStripClass.prototype.Init = function()
{
  try
  {
    this.MenuStripItemList.Clear();
    
    var oControlList;
    oControlList = this.Container.getElementsByTagName("li");
    for (var i = 0; i < oControlList.length; i++)
    {
      var oControl = oControlList[i];
      
      oMenuStripItem = new MenuStripItemClass(oControl, this);
      this.MenuStripItemList.Add(oMenuStripItem);
    }
    
    if (this.ParentClass == null || this.ParentClass.ClassType != "MenuStripClass")
    {
      WebForm.AddDocumentHandler("OnClick", "MenuStripClass.prototype.CloseAll()");
      WebForm.AddDocumentHandler("OnMouseOver", "MenuStripClass.prototype.CloseAll()");
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MenuStripClass.prototype.Init", "Section1")
  }
};
MenuStripClass.prototype.ProcessClick = function(sender, src)
{
  try
  {
    sender = Ilp.Event.GetSender(sender, src, this);
    src = Ilp.Event.GetSrc(sender, src);

    var args = new EventArgs();
    args.Src = src;

    if (src.getAttribute("CT"))
    {
      switch(src.getAttribute("CT")*1)
      {
        case enum_CT_MenuStrip_MenuItem:
          var oMenuStripItem;
          if (src.tagName == "A") oMenuStripItem = src.parentElement.JsInstance;
          else if (src.tagName == "IMG") oMenuStripItem = src.parentElement.parentElement.JsInstance;
          else oMenuStripItem = src.JsInstance;
          
          var onClickHandler = Ilp.HtmlDom.GetAttribute(oMenuStripItem.Container, "OnClickHandler", "")
          if (onClickHandler.length > 0)
          {
            onClickHandler = Ilp.Util.PrepareHandler(onClickHandler);
            eval(onClickHandler + "(sender, args);");
            Ilp.Event.Cancel(sender);
          }
          break;
        default:
          break;
      }
    }
    else
    {
      if (Ilp.HtmlDom.GetAttribute(src, "MenuStripItemType", "").length > 0)
      {
        var oMenuStripItem;
        
        if (src.tagName == "A") oMenuStripItem = src.parentElement.JsInstance;
        else if (src.tagName == "DIV") oMenuStripItem = src.parentElement.parentElement.JsInstance;
        else oMenuStripItem = src.JsInstance;
        
        if (oMenuStripItem && oMenuStripItem.ClassType == "MenuStripItemClass")
        {
          if (oMenuStripItem.MenuStripSub)
          {
            if (this.MenuBarBehaviour == enum_MenuBarBehaviour_Click)
            {
              this.Open(oMenuStripItem.ContainerSub, src);
            }
          }
          else
          {
            if (oMenuStripItem.ProgramUrl.length > 0)
            {
              var features = "";
              var useWindowOpen = false;
              var url = location.protocol + "//" + location.hostname + RootPath + oMenuStripItem.ProgramUrl;
              
              if(RootID == RootID_Chemiehandbuch)
              {
                if (oMenuStripItem.ProgramUrl.indexOf("Search.aspx")>-1)
                {
                  features = features + "height=650px,";
                  features = features + "width=500px,";
                  features = features + "resizable=yes,";
                  features = features + "status=no,";
                  features = features + "toolbar=no,";
                  features = features + "menubar=no,";
                  features = features + "location=no,";
                  features = features + "scrollbars=yes,";
                  features = features + "directories=no";
                  
                  useWindowOpen = true;
                  url += "?Language=" + Language;
                }
              }  
              
              if(useWindowOpen == true) 
              {
                WebControl.Open(url, oMenuStripItem.Target, features, false);
              }
              else 
              {
                WebControl.Submit(null, url, oMenuStripItem.Target, "post", "frmAction");
              }
            }
          }
        }
        Ilp.Event.Cancel(sender);
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MenuStripClass.prototype.ProcessClick", "Section1")
  }
};
MenuStripClass.prototype.ProcessOnMouseOver = function(sender, src)
{
  try
  {
    sender = Ilp.Event.GetSender(sender, src, this);
    src = Ilp.Event.GetSrc(sender, src);
    
    if (Ilp.HtmlDom.GetAttribute(src, "MenuStripItemType", "").length > 0)
    {
      if (this.MenuBarBehaviour == enum_MenuBarBehaviour_MouseOver)
      {
        var oMenuStripItem;
        var liItem = null;
        var ulItem;
        
        if (src.tagName == "A") 
        {
          oMenuStripItem = src.parentElement.JsInstance;
          liItem = src.parentElement;
          ulItem = src.parentElement.parentElement;
        }
        else if (src.tagName == "DIV") 
        {
          oMenuStripItem = src.parentElement.parentElement.JsInstance;
          liItem = src.parentElement.parentElement;
          ulItem = src.parentElement.parentElement.parentElement;
        }
        else 
        {
          oMenuStripItem = src.JsInstance;
          liItem = src;
          ulItem = src.parentElement;
        }
        
        if (oMenuStripItem && oMenuStripItem.ClassType == "MenuStripItemClass")
        {
          if (oMenuStripItem.MenuStripSub)
          {
            Ilp.HtmlDom.SetStyle(src, "color", "white");
            this.Open(oMenuStripItem.ContainerSub, ulItem, liItem);
          }
          else
          {
            Ilp.HtmlDom.SetStyle(src, "color", "white");
            Ilp.HtmlDom.SetStyle(liItem, "backgroundColor", "#4c4c4c");
          }
        }
        Ilp.Event.Cancel(sender);
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MenuStripClass.prototype.ProcessOnMouseOver", "Section1")
  }
}
MenuStripClass.prototype.ProcessOnMouseOut = function(sender, src)
{
  try
  {
    sender = Ilp.Event.GetSender(sender, src, this);
    src = Ilp.Event.GetSrc(sender, src);
    
    if (Ilp.HtmlDom.GetAttribute(src, "MenuStripItemType", "").length > 0)
    {
      if (this.MenuBarBehaviour == enum_MenuBarBehaviour_MouseOver)
      {
        var oMenuStripItem;
        var liItem;
        
        if (src.tagName == "A")
        {
          oMenuStripItem = src.parentElement.JsInstance;
          liItem = src.parentElement;
        }
        else if (src.tagName == "DIV") 
        {
          oMenuStripItem = src.parentElement.parentElement.JsInstance;
          liItem = src.parentElement.parentElement;
        }
        else 
        {
          oMenuStripItem = src.JsInstance;
          liItem = src;
        }
        
        if (oMenuStripItem && oMenuStripItem.ClassType == "MenuStripItemClass")
        {
          if (oMenuStripItem.CurrentSubMenu) 
          {
            this.Close(oMenuStripItem.CurrentSubMenu);
          }
          else if(oMenuStripItem.MenuStripSub)
          {
            Ilp.HtmlDom.SetStyle(src, "color", "#bebebe");
          }
          else
          {
            Ilp.HtmlDom.SetStyle(src, "color", "black");
            Ilp.HtmlDom.SetStyle(liItem, "backgroundColor", "#CBCED0");
          }
        }
        
        Ilp.Event.Cancel(sender);
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MenuStripClass.prototype.ProcessOnMouseOut", "Section1")
  }
}
MenuStripClass.prototype.Open = function(subMenu, ulItem, liItem)
{
  try
  {
    if (this.CurrentSubMenu) this.Close(this.CurrentSubMenu);
    
    if(ulItem && liItem)
    {
      var regionUl = Ilp.HtmlDom.GetRegion(ulItem);
      var regionLi = Ilp.HtmlDom.GetRegion(liItem);
      
      Ilp.HtmlDom.SetStyle(subMenu, "position", "absolute");
      Ilp.HtmlDom.SetStyle(subMenu, "top", regionUl.Height - 1);
      Ilp.HtmlDom.SetStyle(subMenu, "left", regionLi.Left - 5);
      Ilp.HtmlDom.SetStyle(subMenu, "display", "block");
          
      this.CurrentSubMenu = subMenu;
      
      if (Ilp.MenuStripCollection == null)
      {
        Ilp.MenuStripCollection = new Object();
      }
      
      Ilp.MenuStripCollection[subMenu.id] = subMenu;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MenuStripClass.prototype.Open", "");
  }
};
MenuStripClass.prototype.Close = function(subMenu)
{
  try
  {
    Ilp.HtmlDom.SetStyle(subMenu, "display", "none");
    this.CurrentSubMenu = null;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MenuStripClass.prototype.Close", "");
  }
};
MenuStripClass.prototype.CloseAll = function()
{
  try
  {
    for (key in Ilp.MenuStripCollection)
    {
      this.Close(Ilp.MenuStripCollection[key]);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MenuStripClass.prototype.Close", "");
  }
};
MenuStripClass.prototype.GetMenuItemByName = function(name)
{
  try
  {
    var menuItem = null;

    for (var i = 0; i < this.MenuStripItemList.Count(); i++)
    {
      var menuStripItem = this.MenuStripItemList.Get(i);
      if (menuStripItem.ItemName == name)
      {
        menuItem = menuStripItem;
        break;
      }
      if (menuItem != null)
      {
        break;
      }
    }
    return menuItem;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MenuStripClass.prototype.GetMenuItemByName", "");
  }
};
MenuStripClass.prototype.SetVisible = function(name, visible)
{
  try
  {
    var menuStripItem = this.GetMenuItemByName(name);
    
    if (menuStripItem != null)
    {
      if (visible == true)
      {
        Ilp.HtmlDom.SetStyle(menuStripItem.Container, "display", "block");
      }
      else
      {
        Ilp.HtmlDom.SetStyle(menuStripItem.Container, "display", "none");
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MenuStripClass.prototype.SetVisible", "");
  }
};


/********** MenuStripItemClass **********/
function MenuStripItemClass(li, parentClass)
{
  try
  {
    this.Container = li;
    this.Container.JsInstance = this;
    this.ObjectID = this.Container.id;
    this.ClientID = this.Container.id;
    this.ClassType = "MenuStripItemClass";
    this.ParentClass = parentClass;
    this.ParentContainer = parentClass.Container;
  
    this.NodeID = Ilp.HtmlDom.GetAttributeInt(this.Container, "NodeID");
    this.oMenuStrip = parentClass;

    this.ItemName = Ilp.HtmlDom.GetAttribute(this.Container, "ItemName", "");
    this.ProgramUrl = Ilp.HtmlDom.GetAttribute(this.Container, "ProgramUrl", "");
    this.Target = Ilp.HtmlDom.GetAttribute(this.Container, "Target", "_blank");
    
    this.MenuStripSub = null;
    this.ContainerSub = document.getElementById("NavTree_BelongsTo_" + String(this.NodeID));
    if (this.ContainerSub)
    {
      this.MenuStripSub = new MenuStripClass(this.ContainerSub, this);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MenuStripItemClass", "Section1");
  }
};

/********** PagingLinkDescriptor **********/
function PagingLinkDescriptor(oContainerInstance, oControl, oPagingInfoItem, isLoaded, isActive)
{
  try
  {
    this.oContainerInstance = oContainerInstance;
    this.oControl = oControl;
    this.oControl2 = null;

    this.oPagingInfoItem = oPagingInfoItem;
    this.TBodyDescriptorList = new WebArray();
    
    this.IsLoaded = isLoaded;
    this.IsActive = isActive;
    this.Hidden = true;
    
    this.SetPageLinkStyle();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PagingLinkDescriptor", "Section1")
  }
};
PagingLinkDescriptor.prototype.AddTBodyDescriptor = function(oTBodyDescriptor)
{
  try
  {
    oTBodyDescriptor.oPagingLinkDescriptor = this;
    this.TBodyDescriptorList.Add(oTBodyDescriptor);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PagingLinkDescriptor.prototype.AddTBodyDescriptor", "Section1")
  }
};
PagingLinkDescriptor.prototype.RemoveTBodyDescriptor = function(oTBodyDescriptor)
{
  try
  {
    this.TBodyDescriptorList.Remove(this.TBodyDescriptorList.GetIndex(oTBodyDescriptor));
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PagingLinkDescriptor.prototype.AddTBodyDescriptor", "Section1")
  }
};
PagingLinkDescriptor.prototype.GetTBodyCount = function()
{
  try
  {
    return this.TBodyDescriptorList.Count();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PagingLinkDescriptor.prototype.GetTBodyCount", "Section1")
  }
};
PagingLinkDescriptor.prototype.Hide = function()
{
  try
  {
    this.Hidden = true;  
    for (var i = 0, len = this.TBodyDescriptorList.Count(); i < len; i++)
    {
      var tbodyDescriptor = this.TBodyDescriptorList.Get(i);
      tbodyDescriptor.Hide();
    } 
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PagingLinkDescriptor.prototype.Hide", "Section1")
  }
};
PagingLinkDescriptor.prototype.Show = function()
{
  try
  {
    this.Hidden = false;  
    for (var i = 0, len = this.TBodyDescriptorList.Count(); i < len; i++)
    {
      var tbodyDescriptor = this.TBodyDescriptorList.Get(i);
      tbodyDescriptor.Show();
    }    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PagingLinkDescriptor.prototype.Show", "Section1")
  }
};
PagingLinkDescriptor.prototype.SetPageLinkStyle = function()
{
  try
  {
    this.oControl.className = this.IsActive == true ? "PagingLinkCurrent" : "PagingLink";
    if (this.oControl2 != null) this.oControl2.className = this.IsActive == true ? "PagingLinkCurrent" : "PagingLink";
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PagingLinkDescriptor.prototype.SetPageLinkStyle", "Section1")
  }
}
PagingLinkDescriptor.prototype.Activate = function()
{
  try
  {
    this.IsActive = true;
    this.SetPageLinkStyle();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PagingLinkDescriptor.prototype.Activate", "Section1")
  }
}
PagingLinkDescriptor.prototype.Deactivate = function()
{
  try
  {
    this.IsActive = false;
    this.SetPageLinkStyle();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PagingLinkDescriptor.prototype.Deactivate", "Section1")
  }
}


/********** TBodyDescriptor **********/
function TBodyDescriptor(oContainerInstance, oControl)
{
  this.oContainerInstance = oContainerInstance;
  this.oControl = oControl;
  
  this.oPagingLinkDescriptor = null;
};
TBodyDescriptor.prototype.Hide = function()
{
  try
  {
    /*
    this.oControl.runtimeStyle.display = "none";
    */
    Ilp.HtmlDom.SetStyle(this.oControl, "display", "none");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "TBodyDescriptor_Hide", "Section1")
  }
};
TBodyDescriptor.prototype.Show = function()
{
  try
  {
    if (this.oPagingLinkDescriptor && this.oContainerInstance.CurrentPagingLinkDescriptor)
    {
      if (this.oPagingLinkDescriptor != this.oContainerInstance.CurrentPagingLinkDescriptor)
      {
        if (this.oContainerInstance.ClassType == "WebDataGrid")
        {
          this.oContainerInstance.SetNextPagingLinkDescriptor(this.oPagingLinkDescriptor);
          this.oContainerInstance.HideCurrentRows();
          this.oContainerInstance.TogglePageLink();
          this.oContainerInstance.ShowCurrentRows();
        }
        else if (this.oContainerInstance.ClassType == "PagingManagerClass")
        {
          this.oContainerInstance.SetNextPagingLinkDescriptor(this.oPagingLinkDescriptor);
          this.oContainerInstance.HideCurrentRows();
          this.oContainerInstance.TogglePageLink();
          this.oContainerInstance.ShowCurrentRows();
        }
      }
    }
    /*
    this.oControl.runtimeStyle.display = "block";
    */
    Ilp.HtmlDom.SetStyle(this.oControl, "display", "block");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "TBodyDescriptor_Show", "Section1")
  }
};

/********** WebMessage **********/
function WebMessageDescriptor(oContainerInstance, oControl, oFieldDescriptor, message, valid)
{
  this.oContainerInstance = oContainerInstance;
  this.oControl = oControl;
  this.oFieldDescriptor = oFieldDescriptor;
  this.Message = (message == null ? "" : message);
  this.Valid = (valid == null ? true : valid);
  
  this.ID = (this.oControl == null ? "" : this.oControl.id);
};
WebMessageDescriptor.prototype.BuildMessage = function()
{
  try
  {
    var dbGridCaption = "";
    if (this.oControl.oFieldDescriptor != null)
    {
      dbGridCaption = Ilp.HtmlDom.GetAttribute(this.oControl.oFieldDescriptor, "DbGridCaption", "");
    }
    var linkText = "";
    if (dbGridCaption.length > 0)
    {
      linkText = dbGridCaption;
    }
    else
    {
      var attachedLable = WebControl.GetAttachedLable(this.oControl);
      linkText = (attachedLable == null ? "" : String(WebControl.GetValue(attachedLable)));
    }
    linkText = linkText.length == 0 ? "Error" : linkText;
    var headerText = "";
    if (this.oContainerInstance != null && this.oContainerInstance.ClassType == "WebDataGrid")
    {
      if (this.oContainerInstance.WebDataHeader != null && this.oContainerInstance.WebDataHeader.oGalaxy != null)
      {
        headerText = String(WebControl.GetValue(this.oContainerInstance.WebDataHeader.oGalaxy.oSun)).trim() + " / ";
      }
    }
    var markup = "";
    
    if (linkText.length > 0)
    {
      markup = "<span id=\"-id-\" onclick=\"-onclick-\" ObjectId=\"-ObjectId-\" class=\"-class-\">-innerText-</span>";
      markup = markup.replace("-onclick-", "window.parent.WebControl.JumpToValidatedControl(this);");
      markup = markup.replace("-ObjectId-", this.oControl.id);
      markup = markup.replace("-id-", this.ID);
      markup = markup.replace("-class-", "LabelSimple_ValidationLink");
      markup = markup.replace("-innerText-", headerText.trim() + linkText.trim());
    }
    
    var effectiveMessage = this.Message;

    if (markup.length > 0) effectiveMessage += " (" + markup + ")"
    
    return effectiveMessage;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebMessageDescriptor_BuildMessage", "Section1")
  }
};

/********** EventArgs **********/
function EventArgs()
{
  this.ClassType = "EventArgs";
  this.Cancel = false;
  this.DoRowOrder = true;
  this.ShowMessage = true;
}

/********** LogEntry **********/
function LogEntry(date, originator, oRecord, oTBody, message)
{
  this.NodeName = "";
  this.NumberOfClientBoundControls = 0;
  
  this.LogDate = date;
  this.ClientID = originator.ClientID == null ? originator.id : originator.ClientID;
  if (oRecord) this.NodeName = oRecord.nodeName;
  if (oTBody) this.NumberOfClientBoundControls = oTBody.ClientBoundControlArray.length;
  this.Message = message;
}

LogEntry.prototype.GetMessage = function()
{
  try
  {
    var logMessage = "";
    
    logMessage += WebControl.ConvertDateToString(this.LogDate, true, true) + " | ";
    logMessage += this.NodeName + " | ";
    logMessage += String(this.NumberOfClientBoundControls) + " | ";
    logMessage += this.Message + " | ";
    logMessage += this.ClientID + " | ";
    
    return logMessage;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "LogEntry_GetMessage", "Section1")
  }
};

/********** KpiLogEntry **********/
function KpiLogEntry(date, originator, message)
{
  this.LogDate = date;
  this.Originator = originator;
  this.Message = message;
}

KpiLogEntry.prototype.GetMessage = function()
{
  try
  {
    var logMessage = "";
    
    logMessage += WebControl.FillWith(this.Originator, 150, " ") + " | ";
    logMessage += WebControl.FillWith(this.Message, 100, " ");

    return logMessage;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "KpiLogEntry_GetMessage", "Section1")
  }
};

/********** QueueDescriptor **********/
function QueueDescriptor(date, webForm)
{
  this.Parent = webForm;
  this.StartDate = date;
  
  this.Queue = null;
};

QueueDescriptor.prototype.AddQueueItem = function(expression)
{
  try
  {
    if (this.Queue == null) this.Queue = new Array();
    this.Queue[this.Queue.length] = expression;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "QueueDescriptor_AddQueueItem", "Section1")
  }
};

QueueDescriptor.prototype.ExecuteQueue = function()
{
  try
  {
    window.setTimeout("WebForm.QueueArray.Get(" + String(this.Index) + ").ExecuteQueueT()", 10);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "QueueDescriptor_ExecuteQueue", "Section1")
  }
}

QueueDescriptor.prototype.ExecuteQueueT = function(queueDescriptor, index)
{
  try
  {
    queueDescriptor = queueDescriptor == null ? this : queueDescriptor;
    index = index == null ? 0 : index;
    
    if (index < queueDescriptor.Queue.length)
    {
      eval(queueDescriptor.Queue[index]);
      arguments.callee(queueDescriptor, index+1);
    }
    else
    {
      queueDescriptor.Queue = new Array();
      queueDescriptor.Parent.RemoveQueue(queueDescriptor);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "QueueDescriptor_ExecuteQueueT", "Section1")
  }
}


/********** RecordWrappers **********/
function RecordWrappers()
{
  this.Wrappers = new Array();
}

RecordWrappers.prototype.GetInstance = function(oRecord) 
{
  if (oRecord == null) return null;
  
  var recordID = WebData.GetIlpId(oRecord);
  var x = this.Wrappers[recordID];
  if(x == null) x = this.Wrappers[recordID] = new RecordWrapper(oRecord);
  return x;
};

RecordWrapper = function(oRecord) 
{
  this.oErrorRow = null;
  this.oRecord = oRecord;
  this.oParentRecord = null;
  
  if (oRecord.parentNode != null && oRecord.parentNode.nodeName != "NewDataSet")
  {
    this.oParentRecord = oRecord.parentNode;
  }
  
  var temp = "";
  
  this.AllowEdit = true;
  this.AllowCopy = true;
  this.AllowDelete = true;
  this.AllowNew = true;

  var temp = WebData.GetFieldValue(this.oRecord, this.oRecord.nodeName + ".AC_AllowEdit");
  if (temp != null)
  {
    this.AllowEdit = temp == "false" ? false : true;
  }

  this.AllowCopy = this.AllowEdit;
  var temp = WebData.GetFieldValue(this.oRecord, this.oRecord.nodeName + ".AC_AllowCopy");
  if (temp != null)
  {
    this.AllowCopy = temp == "true" ? true : false;
  }
  

  var temp = WebData.GetFieldValue(this.oRecord, this.oRecord.nodeName + ".AC_AllowDelete");
  if (temp != null)
  {
    this.AllowDelete = temp == "true" ? true : false;
  }
  
  var temp = WebData.GetFieldValue(this.oRecord, this.oRecord.nodeName + ".AC_AllowNew");
  if (temp != null)
  {
    this.AllowNew = temp == "false" ? false : true;
  }
  
};

function FieldDescriptorWrappers()
{
  this.Wrappers = new Object();
}

FieldDescriptorWrappers.prototype.GetInstance = function(oFieldDescriptor) 
{
  var fqn = oFieldDescriptor.getAttribute("Fqn");
  var x = this.Wrappers[fqn];
  if(x == null) x = this.Wrappers[fqn] = new FieldDescriptorWrapper(oFieldDescriptor);
  return x;
};

FieldDescriptorWrapper = function(oFieldDescriptor) 
{
  this.oFieldDescriptor = oFieldDescriptor;
  this.Fqn = oFieldDescriptor.getAttribute("Fqn");
  
  this.FormatClass = oFieldDescriptor.getAttribute("FormatClass");
  if (this.FormatClass == null) this.FormatClass = ""; 

  this.FieldType = oFieldDescriptor.getAttribute("FieldType");
  if (this.FieldType == null) this.FieldType = ""; 

  this.DecimalPlaces = oFieldDescriptor.getAttribute("DecimalPlaces");
  if (this.DecimalPlaces == null) this.DecimalPlaces = ""; 
  
  this.Visible = oFieldDescriptor.getAttribute("Visible") == "false" ? false : true;
  if (this.Visible == null) this.Visible = true;   
  
  this.ExcelAllowExport = oFieldDescriptor.getAttribute("ExcelAllowExport") == "false" ? false : true;
  if (this.ExcelAllowExport == null) this.ExcelAllowExport = true;   
  
  this.ZeroText = oFieldDescriptor.getAttribute("ZeroText");
  if (this.ZeroText == null) this.ZeroText = ""; 
}

function HtmlControlWrappers()
{
  this.Wrappers = new Array();
}
HtmlControlWrappers.prototype.GetInstance = function(oControl) 
{
  if (oControl.id && oControl.id.length == 0) return null;
  var x = this.Wrappers[oControl.id];
  if(x == null) x = this.Wrappers[oControl.ObjectID] = new ControlTemplateWrapper(oControl);
  return x;
};
HtmlControlWrapper = function(oControl) 
{
  this.oControl   = oControl;
}

function ControlTemplateWrappers()
{
  this.Wrappers = new Array();
}

ControlTemplateWrappers.prototype.GetInstance = function(oControl) 
{
  var x = this.Wrappers[oControl.ObjectID];
  if(x == null) x = this.Wrappers[oControl.ObjectID] = new ControlTemplateWrapper(oControl);
  return x;
};

ControlTemplateWrappers.prototype.DeleteInstance = function(oControl) 
{
  var x = this.Wrappers[oControl.ObjectID];
  if(x != null) this.Wrappers[oControl.ObjectID] = null;
  return x;
};

ControlTemplateWrapper = function(oControl) 
{
  this.oControl   = oControl;
  this.ObjectID   = oControl.ObjectID;
  this.oContainer = oControl.oContainer;
 
  this.IsSearchControl == oControl.IsSearchControl == null ? false : oControl.IsSearchControl;

  this.ControlType      = oControl.getAttribute("ControlType");
  this.IsDeleteButton   = (oControl.getAttribute("IsDeleteButton") == "true");
  this.IsCopyButton     = (oControl.getAttribute("IsCopyButton") == "true");
  this.IsInsertButton   = (oControl.getAttribute("IsInsertButton") == "true");
  this.IfProtected      = (oControl.getAttribute("IfProtected") == "true");
  this.AcAllowProtected = (oControl.getAttribute("AcAllowProtected") == "true");
  this.IsValidator      = (oControl.getAttribute("IsValidator") == "true");

  // Bindung

  this.RunMergeData = (this.ControlType == "IFrame"
    || this.ControlType == "NavTree"
    || this.ControlType == "WebSplitterContainer"
    || this.ControlType == "WebTreeViewContainer2"
    || this.ControlType == "ListBox"
    || this.ControlType == "WebDataGridContainer"
    || this.ControlType == "WebColumnGridContainer");
    
  this.HasFqn = (oControl.getAttribute("HasFqn") == null ? true : oControl.getAttribute("HasFqn") == "true");
  
  if (this.HasFqn == true) this.BindingFqn = WebControl.GetFqn(oControl);
  if (this.BindingFqn == null) this.BindingFqn = "";
  
  this.InnerTextFqn = oControl.getAttribute("InnerTextFqn");
  if (this.InnerTextFqn == null) this.InnerTextFqn = "";

  this.InnerHTMLFqn = oControl.getAttribute("InnerHTMLFqn");
  if (this.InnerHTMLFqn == null) this.InnerHTMLFqn = ""; 

  this.ListFqn = oControl.getAttribute("ListFqn");
  if (this.ListFqn == null) this.ListFqn = "";

  this.PlaceHolderFqn = oControl.getAttribute("PlaceHolderFqn");
  if (this.PlaceHolderFqn == null) this.PlaceHolderFqn = ""; 

  this.ClassNameFqn = oControl.getAttribute("ClassNameFqn");
  if (this.ClassNameFqn == null) this.ClassNameFqn = ""; 

  this.BackgroundColorFqn = oControl.getAttribute("BackgroundColorFqn");
  if (this.BackgroundColorFqn == null) this.BackgroundColorFqn = ""; 

  this.ColorFqn = oControl.getAttribute("ColorFqn");
  if (this.ColorFqn == null) this.ColorFqn = ""; 

  this.TitleFqn = oControl.getAttribute("TitleFqn");
  if (this.TitleFqn == null) this.TitleFqn = ""; 

  this.ActionFqn = oControl.getAttribute("ActionFqn");
  if (this.ActionFqn == null) this.ActionFqn = ""; 

  this.CheckedFqn = oControl.getAttribute("CheckedFqn");
  if (this.CheckedFqn == null) this.CheckedFqn = ""; 
  
  this.ColumnUpdatedFqn = oControl.getAttribute("ColumnUpdatedFqn");
  if (this.ColumnUpdatedFqn == null) this.ColumnUpdatedFqn = ""; 

  this.SrcFqn = oControl.getAttribute("SrcFqn");
  if (this.SrcFqn == null) this.SrcFqn = ""; 

  this.TrueFalseFqn = oControl.getAttribute("TrueFalseFqn");
  if (this.TrueFalseFqn == null) this.TrueFalseFqn = ""; 
   
  // Eigenschaften
  
  this.FalseUrl = oControl.getAttribute("FalseUrl");
  if (this.FalseUrl == null) this.FalseUrl = ""; 
  
  this.TrueUrl = oControl.getAttribute("TrueUrl");
  if (this.TrueUrl == null) this.TrueUrl = ""; 

  this.TrueText = oControl.getAttribute("TrueText");
  if (this.TrueText == null) this.TrueText = ""; 

  this.FalseText = oControl.getAttribute("FalseText");
  if (this.FalseText == null) this.FalseText = ""; 

  this.NullText = oControl.getAttribute("NullText");
  if (this.NullText == null) this.NullText = ""; 

  this.XMLSourceID = oControl.getAttribute("XMLSourceID");
  if (this.XMLSourceID == null) this.XMLSourceID = "";

  // SetIf
  
  this.VisibleIf = oControl.getAttribute("VisibleIf");
  if (this.VisibleIf == null) this.VisibleIf = ""; 
  
  this.DisplayIf = oControl.getAttribute("DisplayIf");
  if (this.DisplayIf == null) this.DisplayIf = "";
  
  this.DisabledIf = oControl.getAttribute("DisabledIf");
  if (this.DisabledIf == null) this.DisabledIf = "";
  
};

ControlTemplateWrapper.prototype.GetBoundProperty = function(fqn) 
{
  var boundProperty = BoundProperty_None;
  if (fqn == this.InnerTextFqn)
  {
    boundProperty = BoundProperty_InnerText;
  }
  else if (fqn == this.InnerHTMLFqn)
  {
    boundProperty = BoundProperty_InnerHtml;
  }
  else if (fqn == this.TitleFqn)
  {
    boundProperty = BoundProperty_Title;
  }
  else if (fqn == this.ListFqn)
  {
    boundProperty = BoundProperty_SelectedIndex;
  }
  else if (fqn == this.CheckedFqn)
  {
    boundProperty = BoundProperty_Checked;
  }
  else if (fqn == this.SrcFqn)
  {
    boundProperty = BoundProperty_Src;
  }
  else if (fqn == this.TrueFalseFqn)
  {
    boundProperty = BoundProperty_Src;
  }
  
  if (boundProperty == BoundProperty_None)
  {
    if (fqn.split(".").length == 2)
    {
      var fieldName = fqn.split(".")[1];   
      if (fieldName == this.InnerTextFqn.split(".")[1])
      {
        boundProperty = BoundProperty_InnerText;
      }
      else if (fieldName == this.InnerHTMLFqn.split(".")[1])
      {
        boundProperty = BoundProperty_InnerHtml;
      }
      else if (fieldName == this.TitleFqn.split(".")[1])
      {
        boundProperty = BoundProperty_Title;
      }
      else if (fieldName == this.ListFqn.split(".")[1])
      {
        boundProperty = BoundProperty_SelectedIndex;
      }
      else if (fieldName == this.CheckedFqn.split(".")[1])
      {
        boundProperty = BoundProperty_Checked;
      }
      else if (fieldName == this.SrcFqn.split(".")[1])
      {
        boundProperty = BoundProperty_Src;
      }
      else if (fieldName == this.TrueFalseFqn.split(".")[1])
      {
        boundProperty = BoundProperty_Src;
      }
    } 
  }  
  return boundProperty;
};

function ComboTemplateWrappers()
{
  this.Wrappers = new Array();
}

ComboTemplateWrappers.prototype.GetInstance = function(key) 
{
  var x = this.Wrappers[key];
  if(x == null) x = this.Wrappers[key] = new ComboTemplateWrapper(key);
  return x;
};

ComboTemplateWrapper = function(key) 
{
  this.Key            = key;
  this.oComboTemplate = null;
};

function XmlHttpObject(ilp) 
{
  this.Ilp = ilp;
  this.XmlDom = this.Ilp.XmlDom;
  this.XmlVersion = window.XmlVersion;
  this.ClassType = "XmlHttpObject";

  this.oXMLHTTP = null;
  
  this.async = false;
  this.responseXML = null;
  this.responseText = "";

  if (this.XmlVersion == enum_XmlVersion_V1)
  {
    this.oXMLHTTP = new ActiveXObject("Microsoft.XMLHTTP"); // v 2.x
    return this.oXMLHTTP;
  }
  else if (this.XmlVersion == enum_XmlVersion_V3)
  {
    if (this.XmlDom.IsIEDom() == true)
    {
      this.oXMLHTTP = new XMLHttpRequest();
    }
    else
    {
      this.oXMLHTTP = new XMLHttpRequest();
    }
  }
};
XmlHttpObject.prototype.open = function(method, url, async, user, password)
{
  try
  {
    this.async = async;
    this.responseXML = null;
    this.responseText = "";
    
    if (this.XmlDom.IsIEDom() == true)
    {
      this.oXMLHTTP.open(method, url, async, user, password);
    }
    else
    {
      this.oXMLHTTP.open(method, url, async);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlHttpObject.prototype.open", "");
  }
}
XmlHttpObject.prototype.send = function(body)
{
  try
  {
    this.oXMLHTTP.send(body);
    
    if (this.async == false)
    {
      this.responseXML = this.oXMLHTTP.responseXML;
      this.responseText = this.oXMLHTTP.responseText;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlHttpObject.prototype.send", "");
  }
}
XmlHttpObject.prototype.setRequestHeader = function(header, value)
{
  try
  {
    return this.oXMLHTTP.setRequestHeader(header, value);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlHttpObject.prototype.setRequestHeader", "");
  }
}

function XsltProcessorObject(ilp, xmlDom) 
{
  try
  {
    this.Ilp = ilp;
    this.XmlDom = this.Ilp.XmlDom;
    this.XmlVersion = window.XmlVersion;
    this.ClassType = "XsltProcessorObject";

    this.Template = null;
    this.Processor = null;
    
    if (this.XmlVersion == enum_XmlVersion_V1)
    {
      this.Template = new ActiveXObject("MSXML2.FreeThreadedDOMDocument.3.0"); // v 3.x
      return this.Template;
    }
    else if (this.XmlVersion == enum_XmlVersion_V3)
    {
      if (this.XmlDom.IsIEDom() == true)
      {
        if (this.XmlDom.XslTemplate_ProgID == null)
        {
          this.XmlDom.XslTemplate_ProgID = this.XmlDom.FindProgID(this.XmlDom.XslTemplate_ProgIDList);
        }
        this.Template = new ActiveXObject(this.XmlDom.XslTemplate_ProgID);
      }
      else
      {
        this.Template = new XSLTProcessor();
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XsltProcessorObject", "");
  }
};
XsltProcessorObject.prototype.load = function(urlXslt)
{
  try
  {
    var oDomObject = Ilp.XmlDom.CreateXmlDom(false);
    oDomObject.SourceID = urlXslt;
    oDomObject.DomType = "XsltTransformation";
    oDomObject.load(urlXslt);
    
    this.importStylesheet(oDomObject);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XsltProcessorObject.prototype.load", "");
  }
};
XsltProcessorObject.prototype.importStylesheet = function(oDomObject)
{
  try
  {
    if (this.XmlVersion == enum_XmlVersion_V1)
    {
      this.Template.stylesheet = oDomObject;
      this.Processor = this.Template.createProcessor();
    }
    else
    {
      if (this.XmlDom.IsIEDom() == true)
      {
        this.Template.stylesheet = oDomObject.GetDom();
        this.Processor = this.Template.createProcessor();
      }
      else
      {
        this.Template.importStylesheet(oDomObject.GetDom());
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XsltProcessorObject.prototype.importStylesheet", "")
  }
}
XsltProcessorObject.prototype.addParameter = function(parameterName, parameterValue, namespaceURI)
{
  try
  {
  
    if (this.XmlVersion == enum_XmlVersion_V1)
    {
      this.Processor.addParameter(parameterName, parameterValue, namespaceURI);
    }
    else
    {
      if (this.XmlDom.IsIEDom() == true)
      {
        this.Processor.addParameter(parameterName, parameterValue, namespaceURI);
      }
      else
      {
        this.Template.addParameter(namespaceURI, parameterName, parameterValue);
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XsltProcessorObject.prototype.addParameter", "")
  }
}
XsltProcessorObject.prototype.transform = function(oXmlDom, oDomOutput)
{
  try
  {
    if (this.XmlVersion == enum_XmlVersion_V1)
    {
      if (oDomOutput == null)
      {
        oDomOutput = Ilp.XmlDom.CreateXmlDom(false);
      }

      this.Processor.input = oXmlDom;
      this.Processor.output = oDomOutput;
      this.Processor.transform();
      var output = this.Processor.output;
    }
    else
    {
      if (oDomOutput == null)
      {
        oDomOutput = Ilp.XmlDom.CreateXmlDom(false);
      }
      if (this.XmlDom.IsIEDom() == true)
      {
        this.Processor.input = oXmlDom.GetDom();
        this.Processor.output = oDomOutput.GetDom();
        this.Processor.transform();
      }
      else
      {
        oDomOutput = this.Template.transformToDocument(oXmlDom.GetDom());
      }
    }
    oDomOutput.SetDocumentElement();
    return oDomOutput;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XsltProcessorObject.prototype.transform", "")
  }
}

function XmlDomObject(ilp, setDefaultNamespaces, domType) 
{
  try
  {
    setDefaultNamespaces = setDefaultNamespaces == null ? true : setDefaultNamespaces;
    domType = domType == null ? "XmlDom" : domType;
    
    this.Ilp = ilp;
    this.XmlDom = this.Ilp.XmlDom;
    this.XmlVersion = window.XmlVersion;
    this.ClassType = "XmlDomObject";
    this.DomType = domType;
    
    this.SourceID = "";
    this.SrcUrl = "";
    this.Html = "";
    
    this.oXMLDOM = null;

    if (this.XmlVersion == enum_XmlVersion_V1)
    {
      this.oXMLDOM = new ActiveXObject("Microsoft.XMLDOM"); // v 2.x
      this.XmlDom.SetSelectionLanguageDefault(this.oXMLDOM);
      if (setDefaultNamespaces) this.XmlDom.SetSelectionNamespacesDefault(this.oXMLDOM);
      return this.oXMLDOM
    }
    else if (this.XmlVersion == enum_XmlVersion_V3)
    {
      if (this.DomType == "XsltTransformation")
      {
        if (this.XmlDom.IsIEDom() == true)
        {
          if (this.XmlDom.FreeThreadedDom_ProgID == null)
          {
            this.XmlDom.FreeThreadedDom_ProgID = this.XmlDom.FindProgID(this.XmlDom.FreeThreadedDom_ProgIDList);
          }
          this.oXMLDOM = new ActiveXObject(this.XmlDom.FreeThreadedDom_ProgID);
          this.XmlDom.SetSelectionLanguageDefault(this);
          this.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'");
          
          try
          {
            this.oXMLDOM.resolveExternals = true; 
            this.oXMLDOM.setProperty("AllowDocumentFunction", true); 
          }
          catch(exception)
          {
              // Ignore. "AllowDocumentFunction" is only supported in MSXML 3.0 SP4 and later.
          } 
        }
        else
        {
          this.oXMLDOM = Sarissa.getDomDocument();
          this.XmlDom.SetSelectionLanguageDefault(this);
        }
      }
      else
      {
        this.oXMLDOM = Sarissa.getDomDocument();
        this.XmlDom.SetSelectionLanguageDefault(this);
        if (setDefaultNamespaces) this.XmlDom.SetSelectionNamespacesDefault(this);
      }
    }
    
    this.SetDocumentElement();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomObject", "");
  }
};
XmlDomObject.prototype.GetDom = function()
{
  try
  {
    return this.oXMLDOM;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomObject.prototype.GetDom", "");
  }
}
XmlDomObject.prototype.SetDocumentElement = function()
{
  try
  {
    if (this.XmlDom.IsIEDom() == true)
    {
      this.documentElement = this.oXMLDOM.documentElement;
    }
    else
    {
      if (this.oXMLDOM.childNodes.length > 0)
      {
        this.documentElement = this.oXMLDOM.childNodes[0];
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomObject.prototype.GetDom", "");
  }
}
XmlDomObject.prototype.transformNode = function(oXslDom)
{
  try
  {
    this.Html = "";
    
    if (this.XmlDom.IsIEDom() == true)
    {
      this.Html = this.oXMLDOM.transformNode(oXslDom);
    }
    else
    {
      // create an instance of XSLTProcessor   
      var processor = new XSLTProcessor();   
        
      // make the stylesheet reusable by importing it in the    
      // XSLTProcessor   
      processor.importStylesheet(oXslt);
      // transform the document    
      var newDocument = processor.transformToDocument(this.oXMLDOM); 
      // show transformation results   
      this.Html = new XMLSerializer().serializeToString(newDocument);   
    }
    
    return this.Html;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomObject.prototype.transformNode", "")
  }
}
XmlDomObject.prototype.createNode = function(type, name, namespaceURI)
{
  try
  {
    var oNode = null;
    
    if (this.XmlDom.IsIEDom() == true)
    {
      if (namespaceURI && namespaceURI.length > 0)
      {
        oNode = this.oXMLDOM.createNode(type, name, namespaceURI);
      }
      else
      {
        oNode = this.oXMLDOM.createNode(type, name, namespaceURI);
      }
    }
    else
    {
      if (type == this.XmlDom.NodeTypeEnum.ATTRIBUTE_NODE)
      {
        oNode = this.oXMLDOM.createAttributeNS(namespaceURI, name);
      }
      else if (type == this.XmlDom.NodeTypeEnum.ELEMENT_NODE)
      {
        oNode = this.oXMLDOM.createElementNS(namespaceURI, name);
      }
    }
    
    return oNode;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomObject.prototype.createNode", "");
  }
}
XmlDomObject.prototype.setProperty = function(name, value)
{
  try
  {
    if (this.XmlDom.IsIEDom() == true)
    {
      this.oXMLDOM.setProperty(name, value);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomObject.prototype.setProperty", "");
  }
}
XmlDomObject.prototype.load = function(xmlSource)
{
  try
  {
    this.SrcUrl = xmlSource;
    if (this.XmlDom.IsIEDom() == true)
    {
      this.oXMLDOM.async= false;
      this.oXMLDOM.load(xmlSource);
    }
    else
    {
      var xmlhttp = this.XmlDom.CreateXmlHttp();
      
      xmlhttp.open("GET", xmlSource, false);   
      // if needed set header information    
      // using the setRequestHeader method   
      xmlhttp.send('');   
      //alert(new XMLSerializer().serializeToString(xmlhttp.responseXML));
      this.oXMLDOM = xmlhttp.responseXML;
    }
    this.SetDocumentElement();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomObject.prototype.load", "");
  }
}
XmlDomObject.prototype.loadXML = function(xmlString)
{
  try
  {
    if (this.XmlDom.IsIEDom() == true)
    {
      this.oXMLDOM.validateOnParse = true;
      this.oXMLDOM.loadXML(xmlString);
      if (this.XmlDom.HasParseError(this) == true)
      {
        var errorText = Ilp.XmlDom.GetParseErrorText(this.oXMLDOM);
        WebMessage.SendClientLog(null, "XmlDomObject.prototype.loadXML:ParseError.1", errorText, null);
      }
    }
    else
    {
      //make sure to remove all nodes from the document
      while (this.oXMLDOM.hasChildNodes()) this.oXMLDOM.removeChild(this.oXMLDOM.lastChild);

      var oDomDoc = (new DOMParser()).parseFromString(xmlString, "text/xml");
      if (Sarissa.getParseErrorText(oDomDoc) == Sarissa.PARSED_OK)
      {   
        //add the nodes from the new document
        for (var i = 0; i < oDomDoc.childNodes.length; i++) 
        {
          //import the node
          var objImportedNode = this.oXMLDOM.importNode(oDomDoc.childNodes[i], true);
                    
          //append the child to the current document
          this.oXMLDOM.appendChild(objImportedNode);

        } //End: for
      }    
      else
      {   
        var errorText = Sarissa.getParseErrorText(oDomDoc);
        WebMessage.SendClientLog(null, "XmlDomObject.prototype.loadXML:ParseError.2", errorText, null);
      };
    }
    this.SetDocumentElement();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomObject.prototype.loadXML", "");
  }
}
XmlDomObject.prototype.selectSingleNode = function(queryString)
{
  try
  {
    if (this.XmlDom.IsIEDom() == true)
    {
      return this.documentElement.selectSingleNode(queryString);
    }
    else
    {
      return this.documentElement.selectSingleNode(queryString);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomObject.prototype.selectSingleNode", "");
  }
}
XmlDomObject.prototype.selectNodes = function(queryString)
{
  try
  {
    if (this.XmlDom.IsIEDom() == true)
    {
      return this.documentElement.selectNodes(queryString);
    }
    else
    {
      return this.documentElement.selectNodes(queryString);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomObject.prototype.selectNodes", "");
  }
}
XmlDomObject.prototype.getAttribute = function(attributeName)
{
  try
  {
    if (this.documentElement) return this.documentElement.getAttribute(attributeName);
    else "";
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomObject.prototype.getAttribute", "");
  }
}

function XslTemplate() 
{
  this.oXSLTemplate = null;

  if (window.ActiveXObject) 
  {
    this.oXSLTemplate = new ActiveXObject("Msxml2.XSLTemplate"); // v 3.0
  }
  else if (document.implementation && document.implementation.createDocument)
  {
  }

  return this.oXSLTemplate
};


/********** UrlDescriptor **********/
function UrlDescriptor(url)
{
  this.Url = url;
  this.ParseUrl(this.Url);
}

UrlDescriptor.prototype.ParseUrl = function(url)
{
  try
  {
    var regex = new RegExp("((http[s]?|ftp):\\/)?\\/?([^:\\/\\s]+)((\\/\\w+)*\\/)([\\w\\-\\.]+[^#?\\s]+)(.*)", "i");
    regex.exec(unescape(url));
    
    this.Protocol = RegExp.$2;
    this.Host = RegExp.$3;
    this.Path = RegExp.$4;
    this.File = RegExp.$6;
    this.Query = RegExp.$7;
    
    this.ParametersKeys = new WebArray();
    this.ParametersValues = new WebArray();
    
    regex = /\?[\d\D]*?(?=\=)|\&[\d\D]*?(?=\=)/g;
    var matches = url.match(regex);
    if (matches != null)
    {
      for(var i = 0; i < matches.length; i++)
      {
        if (matches[i].length > 1)
        { 
          var parameterKey = matches[i].substring(1, matches[i].length);
          var parameterValue = WebControl.GetQueryParameter(url, parameterKey, "");
          
          this.ParametersKeys.Add(parameterKey);
          this.ParametersValues.Add(parameterValue);
        }
      }
    }    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "UrlDescriptor_ParseUrl", "Section1")
  }
};


UrlDescriptor.prototype.GetQueryParameter = function(parameterKey)
{
  try
  {
    return WebControl.GetQueryParameter(this.Url, parameterKey, null)
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "UrlDescriptor_GetQueryParameter", "Section1")
  }
};

/********** WebDataErrorDescriptor **********/
function WebDataErrorDescriptor(diffgramId, ilpId, errorTest, errorType)
{
  this.DiffgramId = diffgramId;
  this.IlpId = ilpId;
  this.ErrorText = errorTest;
  this.Type = errorType;
}

/********** RecordInfo **********/
function RecordInfo(recordInfoContainer)
{
  try
  {
    EnsureWebForm();
    this.Loaded = false;
    this.Container = recordInfoContainer;  
    this.Show = RecordInfo_Show;
    this.Hide = RecordInfo_Hide;   
    this.MaxWidth = 350;   

    document.body.insertAdjacentElement("beforeEnd", this.Container);
    
    this.oPrimaryKey = document.getElementById("RecordInfo_PrimaryKey_Label");
    
    this.oEmployeeNameCreatedBy = document.getElementById("RecordInfo_EmployeeNameCreatedBy_Label");
    this.oCreationDate = document.getElementById("RecordInfo_CreationDate_Label");

    this.oEmployeeNameChangedBy = document.getElementById("RecordInfo_EmployeeNameLastChanged_Label");
    this.oLastChange = document.getElementById("RecordInfo_LastChange_Label");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "RecordInfo", "");
  }
}

function RecordInfo_Show(sender, recordInfoSkin) 
{
  try
  {
    WebForm.RecordInfo = this;
  
    var args = new EventArgs();
    args.RecordInfo = this;
    if (typeof(this.OnBeforeRecordInfoShow) == "function")
    {
      this.OnBeforeRecordInfoShow(sender, args);
    }
    
    if (args.Cancel == true)
    {
      return;
    }

    if (this.Container)
    {     
      /*
      this.Container.runtimeStyle.position = "absolute";
      this.Container.runtimeStyle.zIndex =  1000;
      */
      Ilp.HtmlDom.SetStyle(this.Container, "position", "absolute");
      Ilp.HtmlDom.SetStyle(this.Container, "zIndex", 1000);

      var fqn = "";
      var fdWrapper = null;
      var oDataField = null;
   
      if (recordInfoSkin == "Extended")
      {        
        fqn = sender.oRecord.nodeName + ".ID" + sender.oRecord.nodeName;
        var fd = FormDescriptor.GetFieldDescriptor(fqn);
        
        if (fd == null) 
        {
          fqn = sender.oRecord.nodeName + ".NodeID";
          fd = FormDescriptor.GetFieldDescriptor(fqn);
        }
        
        fdWrapper = WebControl.FieldDescriptors.GetInstance(fd);
        oDataField = WebData.GetField(sender.oRecord, fqn);
     
        Ilp.HtmlDom.SetText(this.oPrimaryKey, WebControl.ConvertWebDataToControlData(this.oPrimaryKey, fdWrapper.oFieldDescriptor, oDataField));
      }

      fqn = sender.oRecord.nodeName + ".EmployeeNameCreatedBy";
      fdWrapper = WebControl.FieldDescriptors.GetInstance(FormDescriptor.GetFieldDescriptor(fqn));
      oDataField = WebData.GetField(sender.oRecord, fqn);
   
      Ilp.HtmlDom.SetText(this.oEmployeeNameCreatedBy, WebControl.ConvertWebDataToControlData(this.oEmployeeNameCreatedBy, fdWrapper.oFieldDescriptor, oDataField));

      fqn = sender.oRecord.nodeName + ".CreationDate";
      fdWrapper = WebControl.FieldDescriptors.GetInstance(FormDescriptor.GetFieldDescriptor(fqn));
      oDataField = WebData.GetField(sender.oRecord, fqn);
      
      Ilp.HtmlDom.SetText(this.oCreationDate, WebControl.ConvertWebDataToControlData(this.oCreationDate, fdWrapper.oFieldDescriptor, oDataField));

      fqn = sender.oRecord.nodeName + ".EmployeeNameChangedBy";
      fdWrapper = WebControl.FieldDescriptors.GetInstance(FormDescriptor.GetFieldDescriptor(fqn));
      oDataField = WebData.GetField(sender.oRecord, fqn);
      
      Ilp.HtmlDom.SetText(this.oEmployeeNameChangedBy, WebControl.ConvertWebDataToControlData(this.oEmployeeNameChangedBy, fdWrapper.oFieldDescriptor, oDataField));

      fqn = sender.oRecord.nodeName + ".LastChange";
      fdWrapper = WebControl.FieldDescriptors.GetInstance(FormDescriptor.GetFieldDescriptor(fqn));
      oDataField = WebData.GetField(sender.oRecord, fqn);
      
      Ilp.HtmlDom.SetText(this.oLastChange, WebControl.ConvertWebDataToControlData(this.oLastChange, fdWrapper.oFieldDescriptor, oDataField));
      
      this.Container.style.display = "block";

      WebControl.PositionControl2(this.Container, sender, 5);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "RecordInfo_Show", "");
  }
}

function RecordInfo_Hide() 
{
  try
  {
    if (this.Container && window.event.srcElement != this.Container)
    {   
      this.Container.style.display = "none";
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "RecordInfo_Hide", "");
  }
}

/********** IlpClass **********/
function IlpClass()
{
  try
  {
    this.Navigator = new NavigatorClass(this);
    this.XmlCache = new XmlCacheClass(this);
    this.XmlDom = new XmlDomClass(this);
    this.HtmlDom = new HtmlDomClass(this);
    this.Binder = new BinderClass(this);
    this.Event = new EventClass(this);
    this.Application = new ApplicationClass(this);
    this.Util = new UtilClass(this);
    this.Interface = new InterfaceClass(this);
    this.AutoComplete = new AutoCompleteClass(this);
    this.CookieManager = new CookieManagerClass(this);
    this.LoginManager = new LoginManagerClass(this);
    this.FeatureManager = new FeatureManagerClass(this);

    this.XsltManager = new XsltManagerClass(this);
    this.ComboManager = new ComboManagerClass(this);
    this.ScriptList = new WebHashtable();

    this.Table = new TableClass(this);
    this.Cube = new CubeClass(this);
    
    this.Page = new PageClass(this);
    
    this.Show = Ilp_Show;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "IlpClass", "");
  }
}
function Ilp_Show(ilpSource, windowSource)
{
  try
  {
    if (Ilp.Application.PageTitle && Ilp.Application.PageTitle.length > 0)
    {
      if (Ilp.Application.PageHeadline && Ilp.Application.PageHeadline.length > 0)
      {
        Ilp.Application.SetTitle(Ilp.Application.PageTitle + "-" + Ilp.Application.PageHeadline);
      }
      else
      {
        if (windowSource) Ilp.Application.SetTitle(Ilp.Application.PageTitle + "-" + windowSource.PageTitle);
      }
    }
    else
    {
      Ilp.Application.SetTitle(windowSource.PageTitle);
    }
    if (Ilp.Application.PageHeadline && Ilp.Application.PageHeadline.length > 0)
    {
      if (windowSource)
      {
        Ilp.Application.SetText(Ilp.Application.PageHeadline, windowSource.PageUser);
      }
      else
      {
        Ilp.Application.SetText(Ilp.Application.PageHeadline, null);
      }
    }
    else
    {
      if (windowSource) Ilp.Application.SetText(windowSource.PageHeadline, windowSource.PageUser);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Ilp_Show", "");
  }
}

function FeatureManagerClass(ilp)
{
  try
  {
    this.Ilp = ilp;

    this.IsHostMethod = FeatureManagerClass_IsHostMethod;
    this.IsHostCollection = FeatureManagerClass_IsHostCollection;
    this.IsHostObject = FeatureManagerClass_IsHostObject;
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "FeatureManagerClass", "");
  }
}
function FeatureManagerClass_IsHostMethod(object, property)
{
  try
  {
    var t = typeof object[property];
    return t == 'function' ||
         (!!(t == 'object' && object[property])) ||
         t == 'unknown';
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "FeatureManagerClass_IsHostMethod", "");
  }
}

function FeatureManagerClass_IsHostCollection(object, property)
{
  try
  {
    var t = typeof object[property];
    return (!!(t == 'object' && object[property])) ||
         t == 'function';
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "FeatureManagerClass_IsHostCollection", "");
  }
}

function FeatureManagerClass_IsHostObject(object, property)
{
  try
  {
    return !!(typeof (object[property]) == 'object' && object[property]);
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "FeatureManagerClass_IsHostObject", "");
  }
}
function NavigatorClass()
{
  try
  {
    this.AppCodeName = window.navigator.appCodeName;
    this.AppMinorVersion = window.navigator.appMinorVersion;
    this.AppName = window.navigator.appName;
    this.AppVersion = window.navigator.appVersion;
    this.BrowserLanguage = window.navigator.browserLanguage;
    this.CookieEnabled = window.navigator.cookieEnabled;
    this.CpuClass = window.navigator.cpuClass;
    this.OnLine = window.navigator.onLine;
    this.Plattform = window.navigator.plattform;
    this.SystemLanguage = window.navigator.systemLanguage;
    this.UserAgent = window.navigator.userAgent;
    this.UserLanguage = window.navigator.userLanguage;
    this.JavaEnabled = window.navigator.javaEnabled();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "NavigatorClass", "");
  }
}

function PageClass(ilp)
{
  try
  {
    this.Ilp = ilp;
    this.WebDataGridMain = null;
    this.WebSpreadSheetMain = null;

    if (document.body)
    {
      document.body.Page = this;
      this.Body = document.body;
    }

    this.PageMenuBar = window.PageMenuBar;
    this.PageFooter = new PageFooterClass(this.Ilp);
    this.MenuBarManager = new MenuBarManagerClass(this.Ilp, this);

    this.Resize = PageClass_Resize;

    this.LoadFrame = PageClass_LoadFrame;
    this.LoadPage = PageClass_LoadPage;
    this.LoadSelection = PageClass_LoadSelection;
    this.New = PageClass_New;
    
    this.LoadVariableDeclaration = PageClass_LoadVariableDeclaration;
    this.LoadArrayDeclaration = PageClass_LoadArrayDeclaration;
    this.LoadScriptFile = PageClass_LoadScriptFile;
    
    this.LoadWebData = PageClass_LoadWebData;
    this.LoadFormDescriptor = PageClass_LoadFormDescriptor;
    
    this.ViewList = PageClass_ViewList;
    this.ViewDetail = PageClass_ViewDetail;

    this.ShowMenu = PageClass_ShowMenu;
    this.ClearMenu = PageClass_ClearMenu;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PageClass", "")
  }
}

function PageClass_Resize()
{
  try
  {
    if (this.WopHostWindow == null)
    {
      var mainHeight = Ilp.HtmlDom.GetViewportHeight() - this.HeaderHeight - this.FooterHeight;
      Ilp.HtmlDom.SetStyle(this.Main, "height", mainHeight);
    }
    if (typeof (HorizontalColumnGroup) == "object")
    {
      var initialHeight = 0;
      for (var i = 0, len = HorizontalColumnGroup.Columns.length; i < len; i++)
      {
        var el = HorizontalColumnGroup.Columns[i];
        if (el != HorizontalColumnGroup.PrimeElement)
        {
          var region = Ilp.HtmlDom.GetRegion(HorizontalColumnGroup.Columns[i]);
          initialHeight += region.Height;
        }
      }
      var region = Ilp.HtmlDom.GetRegion(HorizontalColumnGroup.Container);
      Ilp.HtmlDom.SetStyle(HorizontalColumnGroup.PrimeElement, "height", region.Height - initialHeight);
    }
  }
  catch (exception)
  {
  }
}

function PageClass_LoadFrame(url, oIFrame, pp)
{
  try
  {
    pp = pp == null ? PPShowAsXhtml : pp;
    window.WebStatusBar.SetStatusbarMessage(ids_FormIsLoading, 0);
    
    if (oIFrame.tagName == "IFRAME")
    {
      var href = "";
      if (url.indexOf(location.protocol) == -1)
      {
        href = location.protocol + "//" + location.hostname;
      }
      if (url.indexOf("?") == -1) href += url +"?PP=" + PPShowAsXhtml;
      else href += url + "&PP=" + pp;
    
      if (oIFrame.contentWindow.location.href != href)
      {
        oIFrame.src = href;
      }  
      else
      {
        window.WebStatusBar.SetStatusbarMessage(ids_Ready, 0);
      }
    }
    
    this.PageFooter.Init();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PageClass_LoadFrame", "")
  }
}

function PageClass_LoadPage(url, htmlTargetContainer)
{
  try
  {
    var showInContainer = (url != null) && (htmlTargetContainer != null);
    
    if (showInContainer == false)
    {
      this.Ilp.Application.Init();
    }
    this.Ilp.Application.SetTitle();
    this.Ilp.Application.SetText();
    
    if (showInContainer == false)
    {
      if (window.top.frames["TopFrame"] == null && DisplayOption == DisplayOption_InFrameset)
      {
        WebFrameGoToLogin(null);
      }
    
      EnsureWebMessage();
      EnsureWebForm();
      EnsureWebControl();
      
      window.WebFrameHost = null;
      if (window.frameElement != null)
      {
        if (window.frameElement.tagName == "IFRAME")
        {
          window.WebFrameHost = new WebFrameHostClass();
        }
      }

      window.WebStatusBar = Ilp.Util.GetWebStatusBar();
      window.WebStatusBar.SetStatusbarMessage(ids_Ready, 0);
    }
    
    window.WebDataGridCollection = new Object();
    window.WebDataGridArray = new Array();
    
    window.WebDataGridMain = null;
    window.WebSpreadSheetMain = null;
    
    window.WebDataObjects = null;
    window.WebDataSheetObjects = null;
    window.WebDataGridObjects = null;
    window.WebSpreadSheetObjects = null;
    window.WebTreeViewObjects = null;
    window.WebDataSearchObjects = null;
  
    if (showInContainer == true)
    {
      var xmlHttpObject = this.Ilp.XmlDom.CreateXmlHttp();
      xmlHttpObject.Open("GET", url, false);
      xmlHttpObject.Send();
      htmlTargetContainer.innerHTML = xmlHttpObject.responseText;
    }
    
    // Variable declarations
    this.LoadVariableDeclaration();
    
    // Array declarations
    this.LoadArrayDeclaration();
    
    // WebMessage (WebData)
    this.LoadWebData();
    
    // FormDescriptor
    this.LoadFormDescriptor();
    
    // ClientXmlCache
    this.Ilp.XmlCache.LoadClientXmlCache();
    
    // JScript File
    this.LoadScriptFile();

    if (showInContainer == true)
    {
      WebControl.ApplyDisplayOption();
    }
  
    this.PageFooter.Init();
    this.MenuBarManager.Init();
    
    LoadWebForm();  
    LoadWebSelSearch();
    if (Ilp.Util.IsArray(window.WebDataObjects) == true)
    {
      LoadObjects();
    }  
    if (Ilp.Util.IsArray(window.WebDataSheetObjects) == true)
    {
      LoadSheets();
    }  
    if (Ilp.Util.IsArray(window.WebDataGridObjects) == true)
    {
      LoadGrids();
    }  
    if (Ilp.Util.IsArray(window.WebSpreadSheetObjects) == true)
    {
      LoadSpreadSheets();
    }  
    if (Ilp.Util.IsArray(window.WebTreeViewObjects) == true)
    {
      LoadTrees();
    }
    
    if (Ilp.Util.IsArray(window.WebDataSearchObjects) == true)
    {
      for (var i = 0; i < WebDataSearchObjects.length; i++)
      {
        if (WebDataSearchObjects[i] == "body")
        {
          WebDataSearchObjects[i] = document.body;
        } 
        else 
        {
          WebDataSearchObjects[i] = document.getElementById(WebDataSearchObjects[i]);
        }  
      }
    }
    LoadWebDataSearch();

    this.Header = document.getElementById("PageHeaderContainer");
    this.HeaderHeight = 0;
    if (this.Header)
    {
      var region = Ilp.HtmlDom.GetRegion(this.Header);
      this.HeaderHeight = region.Height;
    }
    this.Main = document.getElementById("PageMainContainer");
    this.Footer = document.getElementById("PageFooterContainer");
    this.FooterHeight = 0;
    if (this.Footer)
    {
      var region = Ilp.HtmlDom.GetRegion(this.Footer);
      this.FooterHeight = region.Height;
    }

    this.WopHostWindow = Ilp.HtmlDom.GetWopHostWindow();

    this.CurrentDataMain = null;
    this.WebDataGridMain = WebControl.GetWebDataGridMain(true);
    this.WebSpreadSheetMain = WebControl.GetWebSpreadSheetMain(true);
  
    if (this.WebSpreadSheetMain == null)
    {
      this.CurrentDataMain = this.WebDataGridMain;
      if (showInContainer == true)
      {
        WebDataSearch.LoadInitialData();
      }
      if (this.MenuBarManager.Exists(this.PageMenuBar) == true)
      {
        this.ShowMenu(this.PageMenuBar);
      }
      else
      {
        if (this.WebDataGridMain != null)
        {
          if (this.MenuBarManager.Exists(this.WebDataGridMain.PageMenuBar) == true)
          {
            this.ShowMenu(this.WebDataGridMain.MenuBar);
          }
        }
      }
    }
    else
    {
      this.CurrentDataMain = this.WebSpreadSheetMain;
      this.ShowMenu(this.WebSpreadSheetMain.MenuBar);
    }
    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PageClass_LoadPage", "")
  }
}

function PageClass_LoadSelection()
{
  try
  {
    if (this.WebSpreadSheetMain == null)
    {
      WebDataLoadSelection(this, "WebDataGrid");  
    }
    else
    {
      WebDataLoadSelection(this, "WebSpreadSheetClass");  
      this.ViewList();
    }  
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PageClass_LoadSelection", "")
  }
}

function PageClass_New()
{
  try
  {
    if (this.WebSpreadSheetMain == null)
    {
      WebDataNew(this);
    }
    else
    {
      this.WebDataGridMain.Show();
      this.CurrentDataMain = this.WebDataGridMain;
      this.WebSpreadSheetMain.Hide();
      this.WebDataGridMain.Clear();
    
      this.ShowMenu(this.WebDataGridMain.MenuBar);
    
      WebDataNew(this);
    }  
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PageClass_New", "")
  }
}


function PageClass_LoadVariableDeclaration()
{
  try
  {
    var variableContainer = document.getElementById("$VARIABLES$");
    if (variableContainer != null)
    {
      var variableDivs = variableContainer.getElementsByTagName("DIV");
      for(var i = 0; i < variableDivs.length; i++)
      {
        var variableDeclaration = "window." + variableDivs[i].getAttribute("VariableName") + " = " +  variableDivs[i].getAttribute("VariableValue") + ";";
        eval(variableDeclaration);
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PageClass_LoadVariableDeclaration", "")
  }
}

function PageClass_LoadArrayDeclaration()
{
  try
  {
    var arraysContainer = document.getElementById("$ARRAYS$");
    if (arraysContainer != null)
    {
      var arrayDivs = arraysContainer.getElementsByTagName("DIV");
      for(var i = 0; i < arrayDivs.length; i++)
      {
        var arrayEntries = "";
        var arraySpans = arrayDivs[i].getElementsByTagName("SPAN");
        for(var j = 0; j < arraySpans.length; j++)
        {
          arrayEntries += arraySpans[j].getAttribute("ArrayValue") + ",";
        }
        arrayEntries = arrayEntries.substring(0, arrayEntries.length - 1);
        var arrayDeclaration = "window." + arrayDivs[i].getAttribute("ArrayName") + " = new Array(" +  arrayEntries + ");";
        eval(arrayDeclaration);
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PageClass_LoadArrayDeclaration", "")
  }
}


function PageClass_LoadScriptFile()
{
  try
  {
    var scriptFileContainer = document.getElementById("$SCRIPTFILE$");
    if (scriptFileContainer != null)
    {
      if (this.Ilp.ScriptList.Contains(Ilp.HtmlDom.GetText(scriptFileContainer)) == false)
      {
        var head = document.getElementsByTagName("head")[0];
        var script = document.createElement("script");
        script.type = "text/javascript";
        script.src = Ilp.HtmlDom.GetText(scriptFileContainer);
        head.appendChild(script);
        
        this.Ilp.ScriptList.Add(Ilp.HtmlDom.GetText(scriptFileContainer), Ilp.HtmlDom.GetText(scriptFileContainer));
      }  
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PageClass_LoadScriptFile", "")
  }
}


function PageClass_LoadWebData()
{
  try
  {
    var webMessageContainer = document.getElementById("$WEBMESSAGE$");
    if (webMessageContainer != null)
    {
      var xmlDomObject = Ilp.XmlDom.CreateXmlDom(); 
      xmlDomObject.async = false;
      xmlDomObject.loadXML(unescape(Ilp.HtmlDom.GetText(webMessageContainer)));
      LoadWebData(xmlDomObject)
    }
    else
    {
      var wm = document.getElementById("$TEXTWEBMESSAGE$");

      var oXmlDom = Ilp.XmlDom.CreateXmlDom();
      oXmlDom.loadXML(this.Ilp.Util.GetValue(wm));
    
      WebData = new WebDataClass(oXmlDom);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PageClass_LoadWebData", "")
  }
}

function PageClass_LoadFormDescriptor()
{
  try
  {
    var formDescriptorContainer = document.getElementById("$FORMDESCRIPTOR$");
    if (formDescriptorContainer != null)
    {
      var oXmlDom = Ilp.XmlDom.CreateXmlDom(false);
      oXmlDom.load(Ilp.HtmlDom.GetText(formDescriptorContainer));
      
      FormDescriptor = new FormDescriptorClass(oXmlDom);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PageClass_LoadFormDescriptor", "")
  }
}

function PageClass_ViewDetail(sender, src)
{
  try
  {
    var oRecordList = this.Ilp.Binder.GetRecordList(sender, src);
    
    this.WebDataGridMain.FillWebControlsR(oRecordList);
    this.WebDataGridMain.HideHeader();
    this.WebDataGridMain.Show();
    this.CurrentDataMain = this.WebDataGridMain;
    this.WebSpreadSheetMain.Hide();
    
    this.ShowMenu(this.WebDataGridMain.MenuBar);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PageClass_ViewDetail", "")
  }
}

function PageClass_ViewList(sender, src)
{
  try
  {
    this.WebDataGridMain.Hide();
    this.WebSpreadSheetMain.Show();
    this.CurrentDataMain = this.WebSpreadSheetMain;
    
    this.ShowMenu(this.WebSpreadSheetMain.MenuBar);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PageClass_ViewList", "")
  }
}

function PageClass_ShowMenu(menuBarName)
{
  try
  {
    if (this.PageFooter.Container)
    {
      var markup = this.MenuBarManager.GetMenuBarMarkup(menuBarName);
      if (markup) this.PageFooter.Container.innerHTML = markup;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PageClass_ShowMenu", "")
  }
}

function PageClass_ClearMenu(menuBarName)
{
  try
  {
    if (this.PageFooter.Container) this.PageFooter.Container.innerHTML = "";
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PageClass_ClearMenu", "")
  }
}

function MenuBarManagerClass(ilp, page)
{
  try
  {
    this.Ilp = ilp;
    this.Page = page;
    
    this.MenuBarList = new WebHashtable();
    
    this.Init = MenuBarManagerClass_Init;
    this.AddMenuBarMarkup = MenuBarManagerClass_AddMenuBarMarkup;
    this.GetMenuBarMarkup = MenuBarManagerClass_GetMenuBarMarkup;
    this.Exists = MenuBarManagerClass_Exists;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MenuBarManagerClass", "")
  }
}
function MenuBarManagerClass_Init()
{
  try
  {
    var menuBarContainer = document.getElementById("$MENUBARS$");
    if (menuBarContainer != null)
    {
      var arrayDivs = menuBarContainer.getElementsByTagName("DIV");
      for(var i = 0; i < arrayDivs.length; i++)
      {
        var arrayDiv = arrayDivs[i];
        this.AddMenuBarMarkup(arrayDiv.getAttribute("MenuBarName"), unescape(arrayDiv.innerHTML));
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MenuBarManagerClass_Init", "")
  }
}
function MenuBarManagerClass_AddMenuBarMarkup(menuBarName, menuBarMarkup)
{
  try
  {
    if (menuBarMarkup) this.MenuBarList.Set(menuBarName, menuBarMarkup);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MenuBarManagerClass_AddMenuBarMarkup", "")
  }
}
function MenuBarManagerClass_GetMenuBarMarkup(menuBarName)
{
  try
  {
    return this.MenuBarList.Get(menuBarName);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MenuBarManagerClass_GetMenuBarMarkup", "")
  }
}
function MenuBarManagerClass_Exists(menuBarName)
{
  try
  {
    return this.MenuBarList.Get(menuBarName) != null;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MenuBarManagerClass_Exists", "")
  }
}


function ApplicationClass(ilp)
{
  try
  {
    this.Ilp = ilp;
    
    this.Init = ApplicationClass_Init;
    this.SetTitle = ApplicationClass_SetTitle;
    this.SetText = ApplicationClass_SetText;
    
    this.PageTitle = window.PageTitle;
    this.PageHeadline = "";
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "ApplicationClass", "")
  }
}

function ApplicationClass_Init()
{
  try
  {
    if (parent.frames["TopFrame"])
    {
      this.PageHeaderContainer = parent.frames["TopFrame"].document.getElementById("PageHeader");
    }
    else
    {  
      this.PageHeaderContainer = document.getElementById("PageHeader");
    }
    if (this.PageHeaderContainer) this.PageHeader = new PageHeaderClass(this.Ilp, this.PageHeaderContainer);
  
    if (this.PageHeader && this.PageHeader.WebStatusBar) window.WebStatusBar = this.PageHeader.WebStatusBar;
    window.WebStatusBar = Ilp.Util.GetWebStatusBar();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "ApplicationClass_Init", "")
  }
}

function ApplicationClass_SetTitle(pageTitle)
{
  try
  {
    document.title = pageTitle == null ? window.PageTitle : pageTitle;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "ApplicationClass_SetTitle", "")
  }
}

function ApplicationClass_SetText(pageHeadline, pageUser, pageLogo)
{
  try
  {
    if (this.PageHeader)
    {
      this.PageHeader.SetText(pageHeadline, pageUser, pageLogo);
    
      if (parent.frames["TopFrame"] && Ilp.Util.IsFunction(parent.frames["TopFrame"].WebToc_Reset) == true)
      {
        parent.frames["TopFrame"].WebToc_Reset();
      }
      
      if (window.FormID != "LoginMain")
      {
        if (RootID == "ProductCatalog")
        {
          //parent.MainFrameset.rows = "0, *, 25";
        }
        else
        {
          if (parent.MainFrameset)
          {
            var region = Ilp.HtmlDom.GetRegion(this.PageHeader.Container);
            parent.MainFrameset.rows = String(region.Height) + ", *, 50";
          }
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "ApplicationClass_SetText", "")
  }
}


function PageHeaderClass(ilp, pageHeaderContainer)
{
  try
  {
    this.Ilp = ilp;
    
    this.Container = pageHeaderContainer;
    this.Container.JsInstance = this;
    this.ObjectID = this.Container.id;
    this.ClientID = this.Container.id;
    this.ClassType = "PageHeaderClass";
    this.Parent = null;
    
    this.AppLogo = this.Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_PageHeader_AppLogo);
    this.AppIllustration = this.Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_PageHeader_AppIllustration);
    this.PageHeadline = this.Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_PageHeader_PageHeadline);

    this.LoggedOnUser = this.Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_PageHeader_LoggedOnUser);
    if (this.LoggedOnUser == null) this.LoggedOnUser = this.Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_Statusbar_Panel3);
    
    this.WebStatusBarContainer = this.Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_PageHeader_StatusbarContainer);
    if (this.WebStatusBarContainer) this.WebStatusBar = new WebStatusBarClass(this.WebStatusBarContainer);
    
    this.SetText = PageHeaderClass_SetText;
    this.OnClick = PageHeaderClass_OnClick;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PageHeaderClass", "")
  }
}

function PageHeaderClass_SetText(pageHeadline, pageUser, pageLogo)
{
  try
  {
    if (window.parent && window.parent.frames["TopFrame"])
    {
      if (this.AppLogo) this.AppLogo.src = pageLogo == null ? window.PageLogo : pageLogo;
    }
    if (this.PageHeadline != null) this.PageHeadline.innerHTML = pageHeadline == null ? window.PageHeadline : pageHeadline;
    if (this.LoggedOnUser != null) this.LoggedOnUser.innerHTML = pageUser == null ? window.PageUser : pageUser;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PageHeaderClass_SetText", "")
  }
}

function PageHeaderClass_OnClick(sender, src) 
{
  try
  {
    sender = Ilp.Event.GetSender(sender, src, this);
    src = Ilp.Event.GetSrc(sender, src);
   
    var onClickHandler = src.getAttribute("OnClickHandler");
    if (onClickHandler && onClickHandler.length > 0)
    {
      onClickHandler = this.Ilp.Util.PrepareHandler(onClickHandler);
      src.setAttribute("OnClickHandler", onClickHandler);
    }
    
    switch(src.getAttribute("CT")*1)
    {
      case enum_CT_PageHeader_AppLogo:
        window.open(window.location.href, "_blank");
        this.Ilp.Event.Cancel(sender);
        break;
      default:
        this.Ilp.Event.OnClick(src, src);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PageHeaderClass_OnClick", "");
  }
}

function XmlCacheClass(ilp)
{
  try
  {
    this.Ilp = ilp;
    this.XmlCacheList = new WebHashtable();
    this.LoadClientXmlCache = XmlCacheClass_LoadClientXmlCache;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlCacheClass", "")
  }
}

function XmlCacheClass_LoadClientXmlCache()
{
  try
  {
    var clientXmlCacheContainer = document.getElementById("$CLIENTXMLCACHE$");
    if (clientXmlCacheContainer != null)
    {
      var xmlDivs = clientXmlCacheContainer.getElementsByTagName("DIV");
      for(var i = 0; i < xmlDivs.length; i++)
      {
        var xmlDiv = xmlDivs[i];
        var xmlDivs2 = xmlDiv.getElementsByTagName("SPAN");
        
        var comboObject = null;
        var htmlTargetID = xmlDiv.getAttribute("HTMLTargetID");
        if (this.Ilp.ComboManager.ComboList.Contains(htmlTargetID) == true)
        {
          comboObject = this.Ilp.ComboManager.ComboList.Get(htmlTargetID);
        }
        else
        {
          var oXmlSource = null;
          var xmlSourceID = xmlDiv.getAttribute("XMLSourceID");
          if (this.XmlCacheList.Contains(xmlSourceID) == true)
          {
            oXmlSource = this.XmlCacheList.Get(xmlSourceID);
          }
          else
          {
            oXmlSource = Ilp.XmlDom.CreateXmlDom(false);
            oXmlSource.SourceID = xmlSourceID;
            oXmlSource.DomType = "XmlDom";
            oXmlSource.load(Ilp.HtmlDom.GetText(xmlDivs2[0]));
            this.XmlCacheList.Add(xmlSourceID, oXmlSource);
          }

          var oXslt = null;
          var oTemplate = null;
          var xslSourceID = xmlDiv.getAttribute("XSLSourceID");
          if (this.Ilp.XsltManager.XsltTemplateList.Contains(xslSourceID) == true)
          {
            oXslt = this.Ilp.XsltManager.XsltTemplateList.Get(xslSourceID);
          }
          else
          {
            oXslt = Ilp.XmlDom.CreateXsltStylesheet(Ilp.HtmlDom.GetText(xmlDivs2[1]));
            oTemplate = Ilp.XmlDom.CreateXsltTemplate();
            oTemplate.importStylesheet(oXslt);
            this.Ilp.XsltManager.XsltTemplateList.Add(xslSourceID, oTemplate);
          }
          
          var oXmlDomObject = oTemplate.transform(oXmlSource);
          
          comboObject = new ComboClass(this.Ilp, oXmlDomObject);
          this.Ilp.ComboManager.AddComboInstance(htmlTargetID, comboObject);
        }
        
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlCacheClass_LoadClientXmlCache", "")
  }
}

function ComboManagerClass(ilp)
{
  try
  {
    this.Ilp = ilp;
    
    this.ComboList = new WebHashtable();
    this.AddComboInstance = ComboManagerClass_AddComboInstance;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "ComboManagerClass", "")
  }
}

function ComboManagerClass_AddComboInstance(htmlTargetID, comboObject)
{
  try
  {
    this.ComboList.Set(htmlTargetID, comboObject);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "ComboManagerClass_AddCombo", "")
  }
}


function ComboClass(ilp, xmlDomObject)
{
  try
  {
    this.Ilp = ilp;
    this.XmlDomObject = xmlDomObject;
    this.Div = document.createElement("DIV");
    this.Div.innerHTML = this.Ilp.XmlDom.GetXml(this.XmlDomObject);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "ComboClass", "")
  }
}


function XsltManagerClass(ilp)
{
  try
  {
    this.Ilp = ilp;
    this.XsltTemplateList = new WebHashtable();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XsltManagerClass", "")
  }
}

function Region(t, r, b, l) 
{
  try
  {
    this.Top = t;
    this.Y = t;
    this[1] = t;
    this.Right = r;
    this.Bottom = b;
    this.Left = l;
    this.X = l;
    this[0] = l;
    this.Width = this.Right - this.Left;
    this.Height = this.Bottom - this.Top;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "Region", "")
  }
}

function InterfaceClass(ilp)
{
  try
  {
    this.Ilp = ilp;
    
    this.List = { 
      "IBindableContainerWebControl" :
      {
        "TableDescriptorFqn" : { "Name" : "TableDescriptorFqn", "Default" : "" }, 
        "DataTableRelationDescriptorFqn" : { "Name" : "DataTableRelationDescriptorFqn", "Default" : "" }
      },
      "ICompositeEditControl" :
      {
        "Caption" : { "Name" : "Caption", "Default" : "" }, 
        "CaptionOnClick" : { "Name" : "CaptionOnClick", "Default" : "" },
        "CaptionOnClickHandler" : { "Name" : "CaptionOnClickHandler", "Default" : "" },
        "Footer" : { "Name" : "Footer", "Default" : "" },
        "ShowCaption" : { "Name" : "ShowCaption", "Default" : "false" },
        "UseCaptionHighlighting" : { "Name" : "UseCaptionHighlighting", "Default" : "false" },
        "CaptionIsStar" : { "Name" : "CaptionIsStar", "Default" : "true" },
        "CaptionPosition" : { "Name" : "CaptionPosition", "Default" : "Top" },
        "ShowFooter" : { "Name" : "ShowFooter", "Default" : "false" },
        "FooterIsStar" : { "Name" : "FooterIsStar", "Default" : "true" },
        "UseCaptionHighlighting" : { "Name" : "UseCaptionHighlighting", "Default" : "false" }
      },
      "ICssVersion" :
      {
        "CssVersion" : { "Name" : "CssVersion", "Default" : "GTWeb2" },
        "RenderMode" : { "Name" : "RenderMode", "Default" : "Client" }
      },
      "IContextMenu" :
      {
        "DropDownMenu" : { "Name" : "DropDownMenu", "Default" : "" },
        "OnBeforeContextMenuPopUp" : { "Name" : "OnBeforeContextMenuPopUp", "Default" : "" },
        "IsRegistered" : { "Name" : "IsRegistered", "Default" : "false" },
        "OpenMenuBehaviour" : { "Name" : "OpenMenuBehaviour", "Default" : "Click" }
      },
      "IHtmlTable" :
      {
        "ControlLayoutMode" : { "Name" : "ControlLayoutMode", "Default" : "Standard" },
        "LockedColumns" : { "Name" : "LockedColumns", "Default" : "0" },
        "IsHeaderFixed" : { "Name" : "IsHeaderFixed", "Default" : "false" },
        "UseEvenOddForRows" : { "Name" : "UseEvenOddForRows", "Default" : "false" },
        "UseEvenOddForColumns" : { "Name" : "UseEvenOddForColumns", "Default" : "false" },
        "UseVisibleInSpreadSheet" : { "Name" : "UseVisibleInSpreadSheet", "Default" : "false" },
        "UseColumnWidth" : { "Name" : "UseColumnWidth", "Default" : "true" },
        "Include100PercentColumn" : { "Name" : "Include100PercentColumn", "Default" : "true" }
      },
      "ILayout" :
      {
        "LayoutID" : { "Name" : "LayoutID", "Default" : "" }
      },
      "ILogoImageContainer" :
      {
        "LogoImageUrlSource" : { "Name" : "LogoImageUrlSource", "Default" : "Globale" },
        "UseLogoImage" : { "Name" : "UseLogoImage", "Default" : "true" },
        "LogoImageImageUrl" : { "Name" : "LogoImageImageUrl", "Default" : "" },
        "LogoImageToolTip" : { "Name" : "LogoImageToolTip", "Default" : "" },
        "LogoImageOnClick" : { "Name" : "LogoImageOnClick", "Default" : "" },
        "LogoImageOnClickHandler" : { "Name" : "LogoImageOnClickHandler", "Default" : "" },
        "LogoImageDisabledIf" : { "Name" : "LogoImageDisabledIf", "Default" : "" },
        "BeforeLogoHandler" : { "Name" : "BeforeLogoHandler", "Default" : "" },
        "AfterLogoHandler" : { "Name" : "AfterLogoHandler", "Default" : "" },
        "LogoImageIsStar" : { "Name" : "LogoImageIsStar", "Default" : "true" }
      },
      "IMouseClick" :
      {
        "OnClick" : { "Name" : "OnClick", "Default" : "" },
        "OnClickHandler" : { "Name" : "OnClickHandler", "Default" : "" },
        "AfterOnClickHandler" : { "Name" : "AfterOnClickHandler", "Default" : "" },
        "OnDblClick" : { "Name" : "OnDblClick", "Default" : "" },
        "OnDblClickHandler" : { "Name" : "OnDblClickHandler", "Default" : "" },
        "OnFocus" : { "Name" : "OnFocus", "Default" : "" },
        "OnFocusHandler" : { "Name" : "OnFocusHandler", "Default" : "" },
        "AfterOnFocusHandler" : { "Name" : "AfterOnFocusHandler", "Default" : "" },
        "OnFocusIn" : { "Name" : "OnFocusIn", "Default" : "" },
        "OnFocusInHandler" : { "Name" : "OnFocusInHandler", "Default" : "" },
        "OnFocusOut" : { "Name" : "OnFocusOut", "Default" : "" },
        "OnFocusOutHandler" : { "Name" : "OnFocusOutHandler", "Default" : "" },
        "OnMouseDown" : { "Name" : "OnMouseDown", "Default" : "" },
        "OnMouseDownHandler" : { "Name" : "OnMouseDownHandler", "Default" : "" },
        "OnMouseEnter" : { "Name" : "OnMouseEnter", "Default" : "" },
        "OnMouseEnterHandler" : { "Name" : "OnMouseEnterHandler", "Default" : "" },
        "OnMouseLeave" : { "Name" : "OnMouseLeave", "Default" : "" },
        "OnMouseLeaveHandler" : { "Name" : "OnMouseLeaveHandler", "Default" : "" },
        "OnMouseMove" : { "Name" : "OnMouseMove", "Default" : "" },
        "OnMouseMoveHandler" : { "Name" : "OnMouseMoveHandler", "Default" : "" },
        "OnMouseOut" : { "Name" : "OnMouseOut", "Default" : "" },
        "OnMouseOutHandler" : { "Name" : "OnMouseOutHandler", "Default" : "" },
        "OnMouseOver" : { "Name" : "OnMouseOver", "Default" : "" },
        "BeforeOnMouseOverHandler" : { "Name" : "BeforeOnMouseOverHandler", "Default" : "" },
        "OnMouseOverHandler" : { "Name" : "OnMouseOverHandler", "Default" : "" },
        "OnMouseUp" : { "Name" : "OnMouseUp", "Default" : "" },
        "OnMouseUpHandler" : { "Name" : "OnMouseUpHandler", "Default" : "" },
        "OnMouseWheel" : { "Name" : "OnMouseWheel", "Default" : "" },
        "OnMouseWheelHandler" : { "Name" : "OnMouseWheelHandler", "Default" : "" }
      },
      "IMenuBar" :
      {
        "MenuBar" : { "Name" : "MenuBar", "Default" : "" },
        "MenuBarBehaviour" : { "Name" : "MenuBarBehaviour", "Default" : "Click" },
        "MenuBarType" : { "Name" : "MenuBarType", "Default" : "MenuStrip" }
      },
      "IMessageLabelContainer" : 
      {
        "UseMessageLabel" : { "Name" : "UseMessageLabel", "Default" : "true" },
        "Message" : { "Name" : "Message", "Default" : "" },
        "MessageLabelIsStar" : { "Name" : "MessageLabelIsStar", "Default" : "true" }
      },
      "IPagingLinkControl" :
      {
        "ShowPaging" : { "Name" : "ShowPaging", "Default" : "false" },
        "PagedFqn" : { "Name" : "PagedFqn", "Default" : "" },
        "PagingDesign" : { "Name" : "PagingDesign", "Default" : "RecordNumber" }
      },
      "ISpyButtonContainer" : 
      {
        "SpyButtonUrlSource" : { "Name" : "SpyButtonUrlSource", "Default" : "Globale" },
        "UseSpyButton" : { "Name" : "UseSpyButton", "Default" : "true" },
        "SpyButtonImageUrl" : { "Name" : "SpyButtonImageUrl", "Default" : "" },
        "SpyButtonToolTip" : { "Name" : "SpyButtonToolTip", "Default" : "" },
        "SpyButtonOnClick" : { "Name" : "SpyButtonOnClick", "Default" : "" },
        "SpyButtonOnClickHandler" : { "Name" : "SpyButtonOnClickHandler", "Default" : "" },
        "SpyButtonDisabledIf" : { "Name" : "SpyButtonDisabledIf", "Default" : "" },
        "BeforeSpyHandler" : { "Name" : "BeforeSpyHandler", "Default" : "" },
        "AfterSpyHandler" : { "Name" : "AfterSpyHandler", "Default" : "" },
        "SpyButtonIsStar" : { "Name" : "SpyButtonIsStar", "Default" : "true" }
      },
      "IStyledWebControl" :
      {
        "CssClassAdditive" : { "Name" : "CssClassAdditive", "Default" : "" }
      },
      "IToggleButtonContainer" : 
      {
        "ToggleButtonUrlSource" : { "Name" : "ToggleButtonUrlSource", "Default" : "Globale" },
        "UseToggleButton" : { "Name" : "UseToggleButton", "Default" : "true" },
        "ToggleButtonImageUrl" : { "Name" : "ToggleButtonImageUrl", "Default" : "" },
        "ToggleButtonToolTip" : { "Name" : "ToggleButtonToolTip", "Default" : "" },
        "ToggleButtonOnClick" : { "Name" : "ToggleButtonOnClick", "Default" : "" },
        "ToggleButtonOnClickHandler" : { "Name" : "ToggleButtonOnClickHandler", "Default" : "" },
        "ToggleButtonDisabledIf" : { "Name" : "ToggleButtonDisabledIf", "Default" : "" },
        "BeforeToggleHandler" : { "Name" : "BeforeToggleHandler", "Default" : "" },
        "AfterToggleHandler" : { "Name" : "AfterToggleHandler", "Default" : "" },
        "ToggleButtonIsStar" : { "Name" : "ToggleButtonIsStar", "Default" : "true" }
      },
      "IToolStrip" :
      {
        "ToolStrip" : { "Name" : "ToolStrip", "Default" : "" }
      },
      "IWebSpreadSheet" :
      {
        "ShowWebDataHeader" : { "Name" : "ShowWebDataHeader", "Default" : "true" },
        "ShowTotalInStatusBar" : { "Name" : "ShowTotalInStatusBar", "Default" : "true" }
      },
      "IWebSpreadSheetToolbar" :
      {
        "UseEditPropertyImage" : { "Name" : "UseEditPropertyImage", "Default" : "false" },
        "EditPropertyImageToolTip" : { "Name" : "EditPropertyImageToolTip", "Default" : "" }
      }
    };
    
    this.Move = InterfaceClass_Move;
    this.MoveSkin = InterfaceClass_MoveSkin;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "InterfaceClass", "")
  }
}
function InterfaceClass_Move(oSource, oTarget, interfaceName) 
{
  try
  {
    for (propertyName in this.List[interfaceName])
    {
      var property = this.List[interfaceName][propertyName];
      oTarget.setAttribute(property.Name, this.Ilp.HtmlDom.GetAttribute(oSource, property.Name, property.Default));
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "InterfaceClass_Move", "")
  }
}
function InterfaceClass_MoveSkin(oSource, oTarget) 
{
  try
  {
    oTarget.setAttribute("Skin", this.Ilp.HtmlDom.GetAttribute(oSource, "Skin", ""));
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "InterfaceClass_MoveSkin", "")
  }
}

function HtmlDomClass(ilp)
{
  try
  {
    this.Ilp = ilp;
    
    this.RegExClassNameCache = new Object();

    this.GetParentWindow = HtmlDomClass_GetParentWindow;
    this.IsTabControl = HtmlDomClass_IsTabControl;
    this.IsTabPage = HtmlDomClass_IsTabPage;

    this.GetTreeviewHostWindow = HtmlDomClass_GetTreeviewHostWindow;
    this.HasTreeviewHostWindow = HtmlDomClass_HasTreeviewHostWindow;
    this.IsTreeviewHostWindow = HtmlDomClass_IsTreeviewHostWindow;

    this.GetHostWindow = HtmlDomClass_GetHostWindow;
    this.HasHostWindow = HtmlDomClass_HasHostWindow;
    this.IsHostWindow = HtmlDomClass_IsHostWindow;

    this.GetWopHostWindow = HtmlDomClass_GetWopHostWindow;

    this.IsCss1Compat = HtmlDomClass_IsCss1Compat
    this.IsHtmlElement = HtmlDomClass_IsHtmlElement;

    this.GetStyleObject = HtmlDomClass_GetStyleObject;
    this.GetStyle = HtmlDomClass_GetStyle;
    this.SetStyle = HtmlDomClass_SetStyle;

    this.SetExpression = HtmlDomClass_SetExpression;

    this.CanHaveFocus = HtmlDomClass_CanHaveFocus;

    this.GetViewport = HtmlDomClass_GetViewport;
    this.GetViewportWidth = HtmlDomClass_GetViewportWidth;
    this.GetViewportHeight = HtmlDomClass_GetViewportHeight;

    this.GetScrollWidth = HtmlDomClass_GetScrollWidth;
    this.GetScrollHeight = HtmlDomClass_GetScrollHeight;
    this.GetDocumentWidth = HtmlDomClass_GetDocumentWidth;
    this.GetDocumentHeight = HtmlDomClass_GetDocumentHeight;

    this.GetElementWidth = HtmlDomClass_GetElementWidth;
    this.GetElementHeight = HtmlDomClass_GetElementHeight;
    
    this.TestElement = HtmlDomClass_TestElement;
    this.HasClass = HtmlDomClass_HasClass;
    this.AddClass = HtmlDomClass_AddClass;
    this.RemoveClass = HtmlDomClass_RemoveClass;
    this.ReplaceClass = HtmlDomClass_ReplaceClass;
    
    this.Batch = HtmlDomClass_Batch;
    this.GetClassRegEx = HtmlDomClass_GetClassRegEx;

    this.HasChildNodes = HtmlDomClass_HasChildNodes;
    this.HasAttribute = HtmlDomClass_HasAttribute;

    this.GetAttribute = HtmlDomClass_GetAttribute;
    this.GetAttributeBool = HtmlDomClass_GetAttributeBool;
    this.GetAttributeInt = HtmlDomClass_GetAttributeInt;
    this.SetAttribute = HtmlDomClass_SetAttribute;
    this.GetOpener = HtmlDomClass_GetOpener;

    this.GetWidth = HtmlDomClass_GetWidth;

    this.GetPreviousSibling = HtmlDomClass_GetPreviousSibling;
    this.GetPreviousSiblingBy = HtmlDomClass_GetPreviousSiblingBy;

    this.GetNextSibling = HtmlDomClass_GetNextSibling;
    this.GetNextSiblingBy = HtmlDomClass_GetNextSiblingBy;
    
    this.GetFirstChild = HtmlDomClass_GetFirstChild;
    this.GetFirstChildBy = HtmlDomClass_GetFirstChildBy;
    this.GetFirstChildByTagName = HtmlDomClass_GetFirstChildByTagName;
    this.GetFirstChildByAttribute = HtmlDomClass_GetFirstChildByAttribute;

    this.GetFirstDescendantBy = HtmlDomClass_GetFirstDescendantBy;
    this.GetFirstDescendantByAttribute = HtmlDomClass_GetFirstDescendantByAttribute;
    this.GetFirstDescendantByClassName = HtmlDomClass_GetFirstDescendantByClassName;
    
    this.GetAncestorBy = HtmlDomClass_GetAncestorBy;
    this.GetAncestorByClassName = HtmlDomClass_GetAncestorByClassName;
    this.GetAncestorByTagName = HtmlDomClass_GetAncestorByTagName;

    this.GetRegion = HtmlDomClass_GetRegion;
    
    this.GetXY = HtmlDomClass_GetXY;
    this.GetDocumentScrollLeft = HtmlDomClass_GetDocumentScrollLeft;
    this.GetDocumentScrollTop = HtmlDomClass_GetDocumentScrollTop;
    
    this.GetMeasure = HtmlDomClass_GetMeasure;
    this.IsVisible = HtmlDomClass_IsVisible;
    
    this.GetText = HtmlDomClass_GetText;
    this.SetText = HtmlDomClass_SetText;

    this.CreateElement = HtmlDomClass_CreateElement;
    this.RemoveElement = HtmlDomClass_RemoveElement;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass", "")
  }
}
function HtmlDomClass_SetExpression(el, property, value)
{
  try
  {
    if (window.XmlVersion == enum_XmlVersion_V1)
    {
      el.style.setExpression(property, value, "JScript");
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_SetExpression", "")
  }
}
function HtmlDomClass_CreateElement(tagName)
{
  try
  {
    return document.createElement(tagName);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_CreateElement", "")
  }
}
function HtmlDomClass_GetText(element)
{
  try
  {
    var ret = "";
    if (element)
    {
      if (document.documentElement.textContent) 
      {
        ret = element.textContent;
      }
      else
      {
        ret = element.innerText;
      }
    }
    return ret || "";
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_GetText", "")
  }
}
function HtmlDomClass_SetText(element, text)
{
  try
  {
    if (element)
    {
      if (document.documentElement.textContent) 
      {
        element.textContent = text;
      }
      else
      {
        element.innerText = text;
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_SetText", "")
  }
}
function HtmlDomClass_IsVisible(el) 
{
  try
  {
    var isVisible = true;
    isVisible = isVisible && this.GetStyle(el, "display") != "none";
    isVisible = isVisible && this.GetStyle(el, "visibility") != "hidden";
    return isVisible;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_IsVisible", "")
  }
}

function HtmlDomClass_GetRegion(el) 
{
  try
  {
    var p = this.GetXY(el);
    
    var t = p[1];
    var r = p[0] + el.offsetWidth;
    var b = p[1] + el.offsetHeight;
    var l = p[0];
  
    return new Region(t, r, b, l);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_GetRegion", "")
  }
}

function HtmlDomClass_GetXY(el) 
{
  try
  {
    var box = el.getBoundingClientRect();
    var doc = el.ownerDocument;
    
    var scrollLeft = this.GetDocumentScrollLeft(doc);
    var scrollTop = this.GetDocumentScrollTop(doc);
    
    var xy = [Math.floor(box.left), Math.floor(box.top)];
    
    if ((scrollTop || scrollLeft)) 
    {
      xy[0] += scrollLeft;
      xy[1] += scrollTop;
    }

    // gecko may return sub-pixel (non-int) values
    xy[0] = Math.floor(xy[0]);
    xy[1] = Math.floor(xy[1]);

    return xy;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_GetXY", "")
  }
}

function HtmlDomClass_GetDocumentScrollLeft(doc) 
{
  try
  {
    doc = doc || document;
    return Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_GetDocumentScrollLeft", "")
  }
}

function HtmlDomClass_GetDocumentScrollTop(doc) 
{
  try
  {
    doc = doc || document;
    return Math.max(doc.documentElement.scrollTop, doc.body.scrollTop);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_GetDocumentScrollTop", "")
  }
}
function HtmlDomClass_GetStyleObject(el) 
{
  try
  {
    return el.currentStyle || el.style;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_GetStyleObject", "")
  }
}
function HtmlDomClass_GetStyle(el, property) 
{
  try
  {
    var value;
    if (property == "opacity")
    {
      if (document.documentElement.style["opacity"] === undefined && document.documentElement["filters"]) 
      {
        var value = 100;
        try 
        { 
          // will error if no DXImageTransform
          value = el["filters"]['DXImageTransform.Microsoft.Alpha']["opacity"];
        } 
        catch(e) 
        {
          try 
          { // make sure its in the document
            value = el["filters"]('alpha')["opacity"];
          } 
          catch(exception) {}
        }
        return value / 100;
      }
      else
      {
        value = el.currentStyle ? el.currentStyle[property] : null;
        return ( el.style[property] || value );
      }
    }
    else
    {
      value = el.currentStyle ? el.currentStyle[property] : null;
      return ( el.style[property] || value );
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_GetStyle", "")
  }
}
function HtmlDomClass_SetStyle(el, property, value) 
{
  try
  {
    if (property == "opacity")
    {
      if (value === "") 
      { 
        // normalize inline style behavior
        var styleObject = this.GetStyleObject(el);
        var currentValue = ("opacity" in styleObject) ? styleObject["opacity"] : 1; // revert to original opacity
        value = currentValue;
      }
    
      if (document.documentElement.style["opacity"] === undefined && document.documentElement["filters"]) 
      {
        el.style["filter"] = "alpha(opacity=" + value*100 + ")";
        if (!el.currentStyle || !el.currentStyle["hasLayout"]) 
        {
          el.style.zoom = 1; // needs layout 
        }
      }
      else
      {
        el.style[property] = value;
      }
    }
    else
    {
      el.style[property] = value;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_SetStyle", "")
  }
}
function HtmlDomClass_CanHaveFocus(node) 
{
  try
  {
    var canHaveFocus = false;
    if (this.IsHtmlElement(node) == true)
    {
      if (node.disabled && node.disabled == false)
      {
        canHaveFocus = true;
      }
    }
    return canHaveFocus;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_CanHaveFocus", "")
  }
}

function HtmlDomClass_GetMeasure(el, property) 
{
  try
  {
    var measure = 0;
    
    if (el.runtimeStyle) measure = parseInt(el.runtimeStyle[property]);
    if (isNaN(measure) || measure == 0) measure = parseInt(el.style[property]);
    if (isNaN(measure)) measure = 0;
    
    return measure;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_GetMeasure", "")
  }
}
function HtmlDomClass_GetWidth(sender) 
{
  try
  {
    var width = 0;
    
    if (sender.runtimeStyle) width = parseInt(sender.runtimeStyle.width);
    if (isNaN(width) || width == 0) width = parseInt(sender.style.width);
    
    return width;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_GetWidth", "")
  }
}

function HtmlDomClass_IsTabControl() 
{
  try
  {
    return typeof(TabControl) != "undefined";
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_IsTabControl", "")
  }
}

function HtmlDomClass_IsTabPage() 
{
  try
  {
    return window.frameElement != null && window.frameElement.document.parentWindow.TabControl != null;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_IsTabPage", "")
  }
}

function HtmlDomClass_GetParentWindow() 
{
  try
  {
    var hostWindow = Ilp.HtmlDom.GetHostWindow();
    if (hostWindow)
    {
      return hostWindow;
    }
    if (this.HasTreeviewHostWindow() == true)
    {
      return window.frameElement.document.parentWindow;
    }
    return window.parentWindow;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_GetParentWindow", "")
  }
}

function HtmlDomClass_GetHostWindow() 
{
  try
  {
    var hostWindow = null;
    var currentFrameElement = window.frameElement;
    while(currentFrameElement && currentFrameElement.tagName == "IFRAME")
    {
      if (currentFrameElement.document.parentWindow.Host)
      {
        hostWindow = currentFrameElement.document.parentWindow;
        break;
      }
      else
      {
        currentFrameElement = currentFrameElement.document.parentWindow.frameElement
      }
    }
    return hostWindow;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_GetHostWindow", "")
  }
}

function HtmlDomClass_HasHostWindow() 
{
  try
  {
    return this.GetHostWindow() != null;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_HasHostWindow", "")
  }
}


function HtmlDomClass_IsHostWindow() 
{
  try
  {
    return typeof(Host) == "object" && Host.IFrameContainer.contentWindow != null;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_IsHostWindow", "")
  }
}

function HtmlDomClass_GetWopHostWindow()
{
  try
  {
    var hostWindow = null;
    var currentFrameElement = window.frameElement;
    while (currentFrameElement && currentFrameElement.tagName == "IFRAME")
    {
      if (currentFrameElement.document.parentWindow.WopHost)
      {
        hostWindow = currentFrameElement.document.parentWindow;
        break;
      }
      else
      {
        currentFrameElement = currentFrameElement.document.parentWindow.frameElement
      }
    }
    return hostWindow;
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_GetWopHostWindow", "")
  }
}

function HtmlDomClass_GetTreeviewHostWindow() 
{
  try
  {
    var hostWindow = null;
    var currentFrameElement = window.frameElement;
    while(currentFrameElement && currentFrameElement.tagName == "IFRAME")
    {
      if (currentFrameElement.document.parentWindow.TreeviewHost)
      {
        hostWindow = currentFrameElement.document.parentWindow;
        break;
      }
      else
      {
        currentFrameElement = currentFrameElement.document.parentWindow.frameElement
      }
    }
    return hostWindow;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_GetTreeviewHostWindow", "")
  }
}
function HtmlDomClass_HasTreeviewHostWindow() 
{
  try
  {
    return (this.GetTreeviewHostWindow() != null);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_HasTreeviewHostWindow", "")
  }
}
function HtmlDomClass_IsTreeviewHostWindow() 
{
  try
  {
    return typeof(TreeviewHost) == "object";
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_IsTreeviewHostWindow", "")
  }
}

function HtmlDomClass_IsHtmlElement(sender) 
{
  try
  {
    if (sender && sender.getAttribute) return true;
    return false;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_IsHtmlElement", "")
  }
}

function HtmlDomClass_GetOpener() 
{
  try
  {
    var oOpener = null;
    if (window.dialogArguments)
    {
      oOpener = window.dialogArguments;
      if (this.HasHostWindow() == true || this.HasTreeviewHostWindow() == true) oOpener = this.GetParentWindow().dialogArguments;
    }
    else
    {
      oOpener = window.opener;
      if (this.HasHostWindow() == true || this.HasTreeviewHostWindow() == true) oOpener = this.GetParentWindow().opener;
    }
    return oOpener;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_GetOpener", "")
  }
}

function HtmlDomClass_IsCss1Compat() 
{
  try
  {
    var mode = document.compatMode;
    return mode == "CSS1Compat"; 
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_IsCss1Compat", "")
  }
}

function HtmlDomClass_GetViewport() 
{
  try
  {
    var viewport = null;
    if (this.IsCss1Compat() && document.documentElement) 
    {
      // Hier ist des das HTML-Element
      viewport = document.documentElement;
    }
    else 
    {
      if (document.body) 
      {
        viewport = document.body;
      }
    }
    return viewport;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_GetViewport", "")
  }
}

function HtmlDomClass_GetViewportWidth() 
{
  var viewportWidth = 0;
  if (typeof(window.innerWidth)=='number') 
  {
    viewportWidth = window.innerWidth;
  }
  else 
  {
    if (this.IsCss1Compat() && document.documentElement && document.documentElement.clientWidth) 
    {
      viewportWidth = document.documentElement.clientWidth;
    }
    else 
    {
      if (document.body && document.body.clientWidth) 
      {
        viewportWidth = document.body.clientWidth;
      }
    }
  }
  return viewportWidth;
}

function HtmlDomClass_GetViewportHeight() 
{
  var viewportHeight = 0;
  if (typeof(window.innerHeight)=='number') 
  {
    viewportHeight = window.innerHeight;
  }
  else 
  {
    if (this.IsCss1Compat() && document.documentElement && document.documentElement.clientHeight) 
    {
      viewportHeight = document.documentElement.clientHeight;
    }
    else 
    {
      if (document.body && document.body.clientHeight) 
      {
        viewportHeight = document.body.clientHeight;
      }
    }
  }
  return viewportHeight;
}

function HtmlDomClass_GetElementWidth(el) 
{
  return this.GetRegion(el).Width;
}

function HtmlDomClass_GetElementHeight(el) 
{
  return this.GetRegion(el).Height;
}

function HtmlDomClass_GetScrollWidth() 
{
  var scrollWidth = (document.compatMode != 'CSS1Compat') ? document.body.scrollWidth : document.documentElement.scrollWidth;
  return scrollWidth;
}

function HtmlDomClass_GetScrollHeight() 
{
  var scrollHeight = (document.compatMode != 'CSS1Compat') ? document.body.scrollHeight : document.documentElement.scrollHeight;
  return scrollHeight;
}

function HtmlDomClass_GetDocumentWidth() 
{
  var documentWidth = Math.max(this.GetScrollWidth(), this.GetViewportWidth());
  return documentWidth;
}

function HtmlDomClass_GetDocumentHeight() 
{
  var documentHeight = Math.max(this.GetScrollHeight(), this.GetViewportHeight());
  return documentHeight;
}

function HtmlDomClass_HasChildNodes(node)
{
  try
  {
    return node == null ? false : node.hasChildNodes();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_HasChildNodes", "")
  }
}

function HtmlDomClass_HasAttribute(node, attribute, attributeValue)
{
  try
  {
    if (attributeValue)
    {
      return node.getAttribute(attribute) == attributeValue;
    }
    else
    {
      return node.getAttribute(attribute) != null;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_HasAttribute", "")
  }
}

function HtmlDomClass_GetAttribute(node, attributeName, defaultValue)
{
  try
  {
    var attributeValue = node.getAttribute(attributeName);
    if (attributeValue == null) attributeValue = defaultValue;
    return attributeValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_GetAttribute", "")
  }
}
function HtmlDomClass_GetAttributeBool(node, attributeName, defaultValue)
{
  try
  {
    var attributeValue = node.getAttribute(attributeName);
    if (attributeValue == null) attributeValue = defaultValue;
    return (attributeValue == false || attributeValue == "false") ? false : true;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_GetAttributeBool", "")
  }
}
function HtmlDomClass_GetAttributeInt(node, attributeName, defaultValue)
{
  try
  {
    var attributeValue = node.getAttribute(attributeName);
    if (attributeValue == null) attributeValue = defaultValue;
    return parseInt(attributeValue);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_GetAttributeInt", "")
  }
}
function HtmlDomClass_SetAttribute(node, attribute, attributeValue)
{
  try
  {
    node.setAttribute(attribute, attributeValue);
    return attributeValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_SetAttribute", "")
  }
}

function HtmlDomClass_GetPreviousSibling(node)
{
  try
  {
    return this.GetPreviousSiblingBy(node);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_GetPreviousSibling", "")
  }
}

function HtmlDomClass_GetPreviousSiblingBy(node, method)
{
  try
  {
    while (node) 
    {
      node = node.previousSibling;
      if ( this.TestElement(node, method) ) return node;
    }
    return null;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_GetPreviousSiblingBy", "")
  }
}

function HtmlDomClass_GetNextSibling(node)
{
  try
  {
    return this.GetNextSiblingBy(node);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_GetNextSibling", "")
  }
}

function HtmlDomClass_GetNextSiblingBy(node, method)
{
  try
  {
    while (node) 
    {
      node = node.nextSibling;
      if ( this.TestElement(node, method) ) return node;
    }
    return null;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_GetNextSiblingBy", "")
  }
}

function HtmlDomClass_GetFirstChild(node)
{
  try
  {
    return this.GetFirstChildBy(node);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_GetFirstChild", "")
  }
}

function HtmlDomClass_GetFirstChildBy(node, method)
{
  try
  {
    var child = ( this.TestElement(node.firstChild, method) ) ? node.firstChild : null;
    return child || this.GetNextSiblingBy(node.firstChild, method);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_GetFirstChildBy", "")
  }
}

function HtmlDomClass_GetFirstChildByTagName(node, tagName)
{
  try
  {
    var method = function(el) 
    { 
      return el.tagName && el.tagName.toUpperCase() == tagName.toUpperCase(); 
    };

    return this.GetFirstChildBy(node, method);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_GetAncestorByTagName", "")
  }
}

function HtmlDomClass_GetFirstChildByAttribute(node, attributeName, attributeValue)
{
  try
  {
    var method = function(el)
    {
      return el.getAttribute(attributeName) == attributeValue;
    };
  
    return this.GetFirstChildBy(node, method);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_GetFirstChild", "")
  }
}

function HtmlDomClass_GetFirstDescendantBy(node, method)
{
  try
  {
    var children     = null;
    var queue        = new WebQueue();
    var webDomItem   = new WebDomItem(node, node);
    var element      = null;
    var elementFound = null;
    queue.Enqueue(webDomItem);
    
    while(queue.Count() > 0)
    {   
      webDomItem  = queue.Dequeue();
      element     = webDomItem.oDomElement;
      
      if (this.TestElement(element, method))
      {
        elementFound = element;
        break;
      }
      
      children = element.children;
      for (var i = 0, len = children.length; i < len; i++)
      {
        webDomItem = new WebDomItem(node, children[i]);
        queue.Enqueue(webDomItem);
      }  
    }    

    return elementFound;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_GetFirstDescendantBy", "")
  }
}

function HtmlDomClass_GetFirstDescendantByAttribute(node, attributeName, attributeValue)
{
  try
  {
    var method = function(el)
    {
      return el.getAttribute(attributeName) == attributeValue;
    };
  
    return this.GetFirstDescendantBy(node, method);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_GetFirstChild", "")
  }
}

function HtmlDomClass_GetFirstDescendantByClassName(node, className)
{
  try
  {
    var thisClass = this;
    var method = function(el) { return thisClass.HasClass(el, className); };
    return this.GetFirstDescendantBy(node, method);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_GetFirstDescendantByClassName", "")
  }
}



function HtmlDomClass_Batch(el, method, o, override)
{
  try
  {
    if (!el || !method) return false;
    
    var scope = (override) ? o : window;
    
    if (el.tagName || el.length === undefined) 
    { // element or not array-like 
      return method.call(scope, el, o);
    } 

    var collection = [];
    
    for (var i = 0, len = el.length; i < len; ++i) 
    {
      collection[collection.length] = method.call(scope, el[i], o);
    }
    
    return collection;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_Batch", "")
  }
}

function HtmlDomClass_GetClassRegEx(className)
{
  try
  {
    var re = this.RegExClassNameCache[className];
    if (!re) 
    {
      re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)');
      this.RegExClassNameCache[className] = re;
    }
    return re;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_GetClassRegEx", "")
  }
}

function HtmlDomClass_HasClass(el, className)
{
  try
  {
    var re = this.GetClassRegEx(className);

    var f = function(el) 
    {
      return re.test(el.className);
    };
    
    return this.Batch(el, f, this, true);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_HasClass", "")
  }
}

function HtmlDomClass_RemoveElement(el)
{
  try
  {
    var elParent = el.parentElement;
    return elParent.removeChild(el);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_RemoveElement", "")
  }
}

function HtmlDomClass_AddClass(el, className)
{
  try
  {
    var f = function(el) 
    {
      if (this.HasClass(el, className)) 
      {
        return false; // already present
      }
    };
    
    el.className = String([el.className, className].join(' ')).trim();
    return true;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_AddClass", "")
  }
}

function HtmlDomClass_RemoveClass(el, className)
{
  try
  {
    var re = this.GetClassRegEx(className);
    
    var f = function(el) 
    {
      var ret = false,
          current = el.className;

      if (className && current && this.HasClass(el, className)) {
          
          el.className = current.replace(re, ' ');
          if ( this.HasClass(el, className) ) { // in case of multiple adjacent
              this.RemoveClass(el, className);
          }

          el.className = String(el.className).trim(); // remove any trailing spaces
          if (el.className === '') { // remove class attribute if empty
              var attr = (el.hasAttribute) ? 'class' : 'className';
              el.removeAttribute(attr);
          }
          ret = true;
      }                 
      return ret;
    };
    
    return this.Batch(el, f, Ilp.HtmlDom, true);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_RemoveClass", "")
  }
}

function HtmlDomClass_ReplaceClass(el, oldClassName, newClassName)
{
  try
  {
    if (!newClassName || oldClassName === newClassName) 
    { // avoid infinite loop
      return false;
    }
            
    var re = this.GetClassRegEx(oldClassName);

    var f = function(el) 
    {
      if ( !this.HasClass(el, oldClassName) ) {
          this.AddClass(el, newClassName); // just add it if nothing to replace
          return true; // NOTE: return
      }
  
      el.className = el.className.replace(re, ' ' + newClassName + ' ');

      if ( this.HasClass(el, oldClassName) ) 
      { // in case of multiple adjacent
          this.RemoveClass(el, oldClassName);
      }

      el.className = String(el.className).trim(); // remove any trailing spaces
      return true;
    };
            
    return this.Batch(el, f, Ilp.HtmlDom, true);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_ReplaceClass", "")
  }
}


function HtmlDomClass_TestElement(node, method)
{
  try
  {
    return node && node.nodeType == NODE_ELEMENT && ( !method || method(node) );
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_TestElement", "")
  }
}

function HtmlDomClass_GetAncestorBy(node, method)
{
  try
  {
    // NOTE: assignment
    while ( (node = node.parentNode) ) 
    { 
      if ( this.TestElement(node, method) ) return node;
    } 

    return null;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_GetAncestorBy", "")
  }
}

function HtmlDomClass_GetAncestorByClassName(node, className)
{
  try
  {
    var method = function(el) { return this.HasClass(el, className); };
    return this.GetAncestorBy(node, method);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_GetAncestorByClassName", "")
  }
}

function HtmlDomClass_GetAncestorByTagName(node, tagName)
{
  try
  {
    var method = function(el) { return el.tagName && el.tagName.toUpperCase() == tagName.toUpperCase(); };

    return this.GetAncestorBy(node, method);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HtmlDomClass_GetAncestorByTagName", "")
  }
}


function XmlDomClass(ilp)
{
  try
  {
    this.Ilp = ilp;

    this.XslTemplate_ProgID = null;
    this.XslTemplate_ProgIDList = ["Msxml2.XSLTemplate.6.0", "MSXML2.XSLTemplate.3.0"];

    this.FreeThreadedDom_ProgID = null;
    this.FreeThreadedDom_ProgIDList = ["MSXML2.FreeThreadedDOMDocument.6.0", "MSXML2.FreeThreadedDOMDocument.3.0"];
    
    this.XmlVersion = window.XmlVersion;
    this.NodeTypeEnum = {ELEMENT_NODE: 1, ATTRIBUTE_NODE: 2, TEXT_NODE: 3, CDATA_SECTION_NODE: 4, ENTITY_REFERENCE_NODE: 5,  ENTITY_NODE: 6, PROCESSING_INSTRUCTION_NODE: 7, COMMENT_NODE: 8, DOCUMENT_NODE: 9, DOCUMENT_TYPE_NODE: 10, DOCUMENT_FRAGMENT_NODE: 11, NOTATION_NODE: 12};

    this.FindProgID = XmlDomClass_FindProgID;
    this.IsIEDom = XmlDomClass_IsIEDom;

    this.SetSelectionLanguageDefault = XmlDomClass_SetSelectionLanguageDefault;
    this.SetSelectionNamespaces = XmlDomClass_SetSelectionNamespaces;
    this.SetSelectionNamespacesDefault = XmlDomClass_SetSelectionNamespacesDefault;
    this.CreateXmlDom = XmlDomClass_CreateXmlDom;
    this.CreateXmlHttp = XmlDomClass_CreateXmlHttp;
    this.CreateXsltStylesheet = XmlDomClass_CreateXsltStylesheet;
    this.CreateXsltTemplate = XmlDomClass_CreateXsltTemplate;
    
    this.IsDocument = XmlDomClass_IsDocument;
    this.IsRecord = XmlDomClass_IsRecord;
    this.ToArray = XmlDomClass_ToArray;

    this.GetXml = XmlDomClass_GetXml;
    
    this.CreateElement = XmlDomClass_CreateElement;
    this.CreateAttribute = XmlDomClass_CreateAttribute;
    this.GetAttribute = XmlDomClass_GetAttribute;
    this.GetAttributeValue = XmlDomClass_GetAttributeValue;
    this.RemoveAttribute = XmlDomClass_RemoveAttribute;
    this.SetValue = XmlDomClass_SetValue;
    this.GetValue = XmlDomClass_GetValue;
    
    this.SetOnReadyStateChange = XmlDomClass_SetOnReadyStateChange;
    this.GetReadyState = XmlDomClass_GetReadyState;
    this.GetResponseText = XmlDomClass_GetResponseText;
    this.GetResponseTextLength = XmlDomClass_GetResponseTextLength;

    this.HasParseError = XmlDomClass_HasParseError;
    this.GetParseError = XmlDomClass_GetParseError;
    this.GetParseErrorText = XmlDomClass_GetParseErrorText;

  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomClass", "")
  }
}
function XmlDomClass_HasParseError(xmlDocument)
{
  try
  {
    if (!xmlDocument.XmlVersion || xmlDocument.XmlVersion == enum_XmlVersion_V1)
    {
      return (xmlDocument && xmlDocument.parseError && xmlDocument.parseError.errorCode && xmlDocument.parseError.errorCode != 0);
    }
    else
    {
      var parseErrorText = Sarissa.getParseErrorText(xmlDocument.GetDom());
      return (parseErrorText != Sarissa.PARSED_OK);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomClass_HasParseError", "")
  }
}

function XmlDomClass_GetParseErrorText(xmlDocument)
{
  try
  {
    var parseErrorText = "";
    if (!xmlDocument.XmlVersion || xmlDocument.XmlVersion == enum_XmlVersion_V1)
    {
      if(xmlDocument && xmlDocument.parseError && xmlDocument.parseError.errorCode && xmlDocument.parseError.errorCode != 0)
      {
        parseErrorText = "XML Parsing Error: " + xmlDocument.parseError.reason + 
            "\nLocation: " + xmlDocument.parseError.url + 
            "\nLine Number " + xmlDocument.parseError.line + ", Column " + 
            xmlDocument.parseError.linepos + 
            ":\n" + xmlDocument.parseError.srcText +
            "\n";
        for(var i = 0;  i < xmlDocument.parseError.linepos;i++)
        {
          parseErrorText += "-";
        }
        parseErrorText +=  "^\n";
      }
      else
      {
        parseErrorText = Sarissa.getParseErrorText(xmlDocument.GetDom());
      }
    }
    return parseErrorText;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomClass", "")
  }
}

function XmlDomClass_GetParseError(xmlDocument)
{
  try
  {
    if (xmlDocument.GetDom()) return xmlDocument.GetDom().parseError;
    else return xmlDocument.parseError;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomClass_CreateAttribute", "")
  }
}
function XmlDomClass_FindProgID(progIDList)
{
  try
  {
    // found progID flag
    var found = false
    var e;
    var progID;
    for( var i = 0; i < progIDList.length && !found; i++)
    {
      try
      {
        var oDoc = new ActiveXObject(progIDList[i]);
        progID = progIDList[i];
        found = true;
      }
      catch (objException)
      {
        // trap; try next progID
        e = objException;
      }
    }
    if (!found) 
    {
      throw "Could not retrieve a valid progID of Class: " + progIDList[progIDList.length - 1]+". (original exception: " + e + ")";
    }
    return progID;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomClass_FindProgID", "");
  }
}
function XmlDomClass_SetOnReadyStateChange(xmlDocument, handler)
{
  try
  {
    if (xmlDocument.ClassType && xmlDocument.ClassType == "XmlHttpObject") xmlDocument.oXMLHTTP.onreadystatechange = handler;
    else xmlDocument.onreadystatechange = handler;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomClass_SetOnReadyStateChange", "");
  }
}
function XmlDomClass_GetReadyState(xmlDocument)
{
  try
  {
    if (xmlDocument.ClassType && xmlDocument.ClassType == "XmlHttpObject") return xmlDocument.oXMLHTTP.readyState;
    else return xmlDocument.readyState;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomClass_GetReadyState", "");
  }
}
function XmlDomClass_GetResponseText(xmlDocument)
{
  try
  {
    if (xmlDocument.ClassType && xmlDocument.ClassType == "XmlHttpObject")
    {
      if (this.IsIEDom() == true) return xmlDocument.oXMLHTTP.responseText;
      else
      {
        var xmlString = new XMLSerializer().serializeToString(xmlDocument.responseXML);   
        return xmlString;
      }
    }
    else return xmlDocument.responseText;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomClass_GetResponseText", "");
  }
}
function XmlDomClass_GetResponseTextLength(xmlDocument)
{
  try
  {
    if (xmlDocument.ClassType && xmlDocument.ClassType == "XmlHttpObject") 
    {
      return this.GetResponseText(xmlDocument).length;
    }
    else return xmlDocument.responseText.length;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomClass_GetResponseTextLength", "");
  }
}
function XmlDomClass_IsDocument(xmlDocument)
{
  try
  {
    return xmlDocument && xmlDocument.nodeType && xmlDocument.nodeType == this.NodeTypeEnum.DOCUMENT_NODE;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomClass_IsDocument", "");
  }
}
function XmlDomClass_GetXml(xmlDocument) 
{
  try
  {
    if (xmlDocument == null) return "";
    
    if (this.IsIEDom() == true)
    {
      if (!xmlDocument.XmlVersion || xmlDocument.XmlVersion == enum_XmlVersion_V1)
      {
        if (this.IsDocument(xmlDocument) == true)
        {
          return xmlDocument.documentElement.xml;
        }
        else
        {
          return xmlDocument.xml;
        }
      }
      else
      {
        if (xmlDocument.documentElement)
        {
          return xmlDocument.documentElement.xml;
        }
        else
        {
          return xmlDocument.xml;
        }
      }
    }
    else
    {
      //create a new XMLSerializer
      var xmlSerializer = new XMLSerializer;

      if (xmlDocument.ClassType && xmlDocument.ClassType == "XmlDomObject")
      {
        //get the XML string
        return xmlSerializer.serializeToString(xmlDocument.oXMLDOM);
      }
      else
      {
        //get the XML string
        return xmlSerializer.serializeToString(xmlDocument);
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomClass_GetXml", "")
  }
}
function XmlDomClass_IsIEDom() 
{
  try
  {
    return document.all && window.ActiveXObject && navigator.userAgent.toLowerCase().indexOf("msie") > -1  && navigator.userAgent.toLowerCase().indexOf("opera") == -1;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomClass_IsIEDom", "")
  }
}
function XmlDomClass_IsRecord(oRecord) 
{
  try
  {
    return (oRecord && oRecord.nodeType && oRecord.nodeType == this.NodeTypeEnum.NODE_ELEMENT);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomClass_IsRecord", "")
  }
}
function XmlDomClass_ToArray(oNodeList)
{
  try
  {
    var returnArray = new WebArray();
    
    for (var i = 0; i < oNodeList.length; i++)
    {
      if (oNodeList[i].text && oNodeList[i].text.length > 0)
      {
        returnArray.Add(oNodeList[i].text);
      }
    }
    
    return returnArray;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomClass_ToArray", "")
  }
}
function XmlDomClass_CreateXmlDom(setDefaultNamespaces)
{
  try
  {
    return new XmlDomObject(this.Ilp, setDefaultNamespaces);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomClass_CreateXmlDom", "")
  }
}
function XmlDomClass_CreateXsltStylesheet(url)
{
  try
  {
    var xmlDomObject = new XmlDomObject(this.Ilp, false, "XsltTransformation");
    xmlDomObject.load(url);
    
    return xmlDomObject;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomClass_CreateXsltStylesheet", "")
  }
}
function XmlDomClass_CreateXmlHttp()
{
  try
  {
    return new XmlHttpObject(this.Ilp);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomClass_CreateXmlHttp", "")
  }
}
function XmlDomClass_CreateXsltTemplate()
{
  try
  {
    return new XsltProcessorObject(this.Ilp);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomClass_CreateXsltTemplate", "")
  }
}
function XmlDomClass_SetSelectionLanguageDefault(xmlDocument)
{
  try
  {
    if (this.IsIEDom() == true)
    {
      xmlDocument.setProperty("SelectionLanguage", "XPath");
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomClass_SetSelectionLanguageDefault", "")
  }
}
function XmlDomClass_SetSelectionNamespaces(xmlDocument, namespaces)
{
  try
  {
    if (this.IsIEDom() == true)
    {
      xmlDocument.setProperty("SelectionNamespaces", namespaces);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomClass_SetSelectionNamespaces", "")
  }
}
function XmlDomClass_SetSelectionNamespacesDefault(xmlDocument)
{
  try
  {
    if (this.IsIEDom() == true)
    {
      xmlDocument.setProperty("SelectionNamespaces", "xmlns:ilp='http://ilp.de/webservices/' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata' xmlns:diffgr='urn:schemas-microsoft-com:xml-diffgram-v1'");
    }
    else
    {
      Sarissa.setXpathNamespaces(xmlDocument.oXMLDOM, "xmlns:ilp='http://ilp.de/webservices/' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata' xmlns:diffgr='urn:schemas-microsoft-com:xml-diffgram-v1'");
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomClass_SetSelectionNamespacesDefault", "")
  }
}
function XmlDomClass_CreateElement(xmlDocument, nodeName, namespaceURI)
{
  try
  {
    return xmlDocument.createNode(this.NodeTypeEnum.ELEMENT_NODE, nodeName, namespaceURI);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomClass_CreateElement", "")
  }
}
function XmlDomClass_CreateAttribute(xmlDocument, xmlNode, attributeName, namespaceURI)
{
  try
  {
    var namedNodeMap = xmlNode.attributes;
    var oAttribute = xmlDocument.createNode(this.NodeTypeEnum.ATTRIBUTE_NODE, attributeName, namespaceURI);
    if (this.IsIEDom() == true)
    {
      namedNodeMap.setNamedItem(oAttribute);
    }
    else
    {
      namedNodeMap.setNamedItemNS(oAttribute);
    }
    
    return oAttribute;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomClass_CreateAttribute", "")
  }
}
function XmlDomClass_GetAttribute(xmlNode, attributeName, createIfNotExists, xmlDocument, namespaceURI)
{
  try
  {
    createIfNotExists = createIfNotExists == null ? false : createIfNotExists;
    xmlDocument = xmlDocument == null ? xmlNode : xmlDocument;
    namespaceURI = namespaceURI == null ? "" : namespaceURI;
    
    var namedNodeMap;
    if (xmlNode.ClassType && xmlNode.ClassType == "XmlDomObject")
    {
      namedNodeMap = xmlNode.documentElement.attributes;
    }
    else
    {
      if (xmlNode.nodeType == this.NodeTypeEnum.DOCUMENT_NODE) namedNodeMap = xmlNode.documentElement.attributes;
      else namedNodeMap = xmlNode.attributes;
    }
    
    var oAttribute = namedNodeMap.getNamedItem(attributeName);
    if (oAttribute == null && createIfNotExists == true)
    {
      oAttribute = this.CreateAttribute(xmlDocument, xmlNode, attributeName, namespaceURI);
    }
    
    return oAttribute;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomClass_GetAttribute", "")
  }
}
function XmlDomClass_RemoveAttribute(xmlNode, attributeName)
{
  try
  {
    var namedNodeMap = xmlNode.attributes;
  
    if (this.IsIEDom() == true)
    {
      namedNodeMap.removeNamedItem(attributeName);
    }
    else
    {
      namedNodeMap.removeNamedItemNS(attributeName);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomClass_GetAttribute", "")
  }
}
function XmlDomClass_GetValue(xmlAttribute)
{
  try
  {
    return xmlAttribute.value;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomClass_GetValue", "")
  }
}
function XmlDomClass_SetValue(xmlAttribute, attributeValue, override)
{
  try
  {
    override = override == null ? true : override;
    
    if (override == true || this.GetValue(xmlAttribute).length == 0)
    {
      xmlAttribute.value = attributeValue;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomClass_SetValue", "")
  }
}
function XmlDomClass_GetAttributeValue(xmlNode, attributeName, defaultValue)
{
  try
  {
    defaultValue = defaultValue == null ? "" : defaultValue;
    
    var oAttribute = this.GetAttribute(xmlNode, attributeName);
    if (oAttribute) return this.GetValue(oAttribute);
    else return defaultValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "XmlDomClass_GetAttributeValue", "")
  }
}

function BinderClass(ilp)
{
  try
  {
    this.Ilp = ilp;

    this.BindingInfoRegEx = /!.*!/;
    this.RecordCounterRegEx = /\d*/;
    this.CreateControlId = BinderClass_CreateControlId;
    this.GetBindingInfo = BinderClass_GetBindingInfo;
    this.GetRecordList = BinderClass_GetRecordList;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "BinderClass", "");
  }
}

function BinderClass_CreateControlId(refSrc, oRecord, fieldName)
{
  try
  { 
    var naming = "";
    if (/_T[TRUHDCOBL\d]*/.test(refSrc.id) == true) naming = refSrc.id.replace(/_T[TRUHDCOBL\d]*/, "") + "_";
    else if (/!.*!/.test(refSrc.id) == true) naming = refSrc.id.replace(/!.*!/, "");
    var cellId = naming + "!" + oRecord.nodeName + "." + fieldName + "_" + WebData.GetPkValue(oRecord) + "!";
    
    return cellId + "_Prime";
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "BinderClass_CreateControlId", "");
  }
}

function BinderClass_GetBindingInfo(sender, src)
{
  try
  {
    var bindingObject = new Object();
    
    if (sender.JsInstance && typeof(sender.JsInstance.SpreadSheet) == "object")
    {
      bindingObject.TableName = sender.JsInstance.SpreadSheet.TableName;
      bindingObject.FieldName = "";
      bindingObject.PkFieldName = sender.JsInstance.SpreadSheet.PkFieldName;
      bindingObject.PkFieldValue = "";
      
      var id = src.id;
      var match = id.match(this.BindingInfoRegEx);
      if (match)
      {
        var str1 = match[0].substring(1, match[0].length - 1);
        var aStr = str1.split("_");
        bindingObject.PkFieldValue = aStr[1];
        bindingObject.FieldName = aStr[0].split(".")[1];
      }
    }
    
    return bindingObject;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "BinderClass_GetBindingInfo", "");
  }
}

function BinderClass_GetRecordList(sender, src)
{
  try
  {
    var oBindingInfo = this.GetBindingInfo(sender, src);
    var oRecordList = WebData.GetRecordListByFieldValue(oBindingInfo.TableName + "." + oBindingInfo.PkFieldName, oBindingInfo.PkFieldValue);
    
    return oRecordList;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "BinderClass_GetRecordList", "");
  }
}

function TableClass(ilp)
{
  try
  {
    this.Ilp = ilp;
    
    this.OnClick = TableClass_OnClick;   
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "TableClass", "");
  }
}

function TableClass_OnClick(sender)
{
  try
  { 
    var src = window.event.srcElement;

    var tableName = src.getAttribute("TableName");
    if (tableName && tableName.length > 0)
    {
      var xPath = "";
      var masterIdFieldValue = src.getAttribute("MasterIdFieldValue");
      var masterIdFqn = src.getAttribute("MasterIdFqn");
      if (masterIdFqn && masterIdFqn.length > 0)
      {
        var alMasterIdFqn = masterIdFqn.split(".");
        xPath = "//" + tableName + "[" + alMasterIdFqn[1] + "='" + masterIdFieldValue + "']";        
      }
      else
      {
        xPath = "//" + tableName + "[@msdata:rowOrder]";
      }

      var oRecordList = WebData.Select(xPath);
      for (var i = 0, len1 = oRecordList.length; i < len1; i++)
      {
        var oRecord = oRecordList[i];
        var controlValue = WebControl.GetValue(src);
        WebData.SetFieldValue(oRecord, oRecord.nodeName + ".Selected", controlValue);
        var oControl = document.getElementById(Ilp.Binder.CreateControlId(src, oRecord, "Selected"));
        if (oControl != null) WebControl.SetValue(oControl, controlValue, false);
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "TableClass_OnClick", "");
  }
}

function PageFooterClass(ilp)
{
  try
  {
    this.Ilp = ilp;

    this.Init = PageFooterClass_Init;

    this.OnClick = PageFooterClass_OnClick;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PageFooterClass", "");
  }
}

function PageFooterClass_Init(sender) 
{
  try
  { 
    if (parent.frames["NavFrame"])
    {
      this.Container = parent.frames["NavFrame"].document.body;
    }
    else
    {
      this.Container = document.getElementById("PageFooter");
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PageFooterClass_Init", "");
  }
}

function PageFooterClass_OnClick(sender, src) 
{
  try
  {
    sender = Ilp.Event.GetSender(sender, src, this);
    src = Ilp.Event.GetSrc(sender, src);
   
    var onClickHandler = src.getAttribute("OnClickHandler");
    if (onClickHandler && onClickHandler.length > 0)
    {
      onClickHandler = this.Ilp.Util.PrepareHandler(onClickHandler);
      src.setAttribute("OnClickHandler", onClickHandler);
    }
    
    switch(src.getAttribute("CT")*1)
    {
      case enum_CT_PageFooter_Link:
        if (Ilp.HtmlDom.IsHostWindow() == true) 
        {
          if (Host.IFrameContainer.contentWindow.TabControl)
          {
            var oTabControl = Host.IFrameContainer.contentWindow.TabControl;
            var oTabPage = oTabControl.TabPageList.Get(oTabControl.CurrentIndex);
            oTabPage.oWebFrame.GetContentWindow().Ilp.Event.OnClick(src, src);
          }
          else
          {
            Host.IFrameContainer.contentWindow.Ilp.Event.OnClick(src, src);
          }
        }
        else this.Ilp.Event.OnClick(src, src);
        this.Ilp.Event.Cancel(sender);
        break;
      default:
        this.Ilp.Event.OnClick(src, src);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "PageFooterClass_OnClick", "");
  }
}

function CubeClass(ilp)
{
  try
  {
    this.Ilp = ilp;
    
    this.OnClick = CubeClass_OnClick;   
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "CubeClass", "");
  }
}

function CubeClass_OnClick(sender)
{
  try
  { 
    var src = window.event.srcElement;

    var columnIndex = src.getAttribute("ColumnIndex");
    var columnCoordinateFieldValue = src.getAttribute("ColumnCoordinateFieldValue");
    if (columnCoordinateFieldValue && columnCoordinateFieldValue.length > 0)
    {
      var cubeIdFieldValue = src.getAttribute("CubeIdFieldValue");
      var cubeIdFqn = src.getAttribute("CubeIdFqn");
      var alCubeIdFqn = cubeIdFqn.split(".");

      fqn = src.getAttribute("ColumnCoordinateFqn");
      alFqn = fqn.split(".");
    
      var xPath = "//" + alFqn[0] + "[" + alFqn[1] + "='" + columnCoordinateFieldValue + "' and " + alCubeIdFqn[1] + "='" + cubeIdFieldValue + "']";

      var oRecordList = WebData.Select(xPath);
      for (var i = 0, len1 = oRecordList.length; i < len1; i++)
      {
        var oRecord = oRecordList[i];
        var controlValue = WebControl.GetValue(src);
        WebData.SetFieldValue(oRecord, oRecord.nodeName + ".Selected", controlValue);
        var oControl = document.getElementById(Ilp.Binder.CreateControlId(src, oRecord, "Selected"));
        if (oControl != null) WebControl.SetValue(oControl, controlValue, false);
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "CubeClass_OnClick", "");
  }
}

function UtilClass(ilp)
{
  try
  {
    this.Ilp = ilp;
    
    this.IsArray = UtilClass_IsArray;
    this.IsFunction = UtilClass_IsFunction;
    this.ToObject = UtilClass_ToObject;
    this.PrepareHandler = UtilClass_PrepareHandler;
    this.AdjustTextArea = UtilClass_AdjustTextArea;
    this.StripSpecialCharacters = UtilClass_StripSpecialCharacters;
    this.ConvertToJavaScriptLineFeed = UtilClass_ConvertToJavaScriptLineFeed;
    this.GetValue = UtilClass_GetValue;
    this.GetWebStatusBar = UtilClass_GetWebStatusBar;
    this.AdjustIFramHeightToContent = UtilClass_AdjustIFramHeightToContent;
    this.GetInternetExplorerVersion = UtilClass_GetInternetExplorerVersion;
    this.AddQueryParameter = UtilClass_AddQueryParameter;

    this.GetClipboardData = UtilClass_GetClipboardData;
    this.SetClipboardData = UtilClass_SetClipboardData;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "UtilClass", "");
  }
}
function UtilClass_AddQueryParameter(url, query)
{
  try
  {
    var delimiter = "?";
    if (url.indexOf(delimiter) > -1) delimiter = "&";
    return url + delimiter + query;
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "UtilClass", "");
  }
}

function UtilClass_GetInternetExplorerVersion()
{
  try
  {
    // Returns the version of Internet Explorer or a -1
    // (indicating the use of another browser).
    var rv = -1; // Return value assumes failure.
    if (navigator.appName == 'Microsoft Internet Explorer')
    {
      var ua = navigator.userAgent;
      var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
      if (re.exec(ua) != null)
        rv = parseFloat(RegExp.$1);
    }
    return rv;
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "UtilClass", "");
  }
}

function UtilClass_AdjustIFramHeightToContent(iFrame)
{
  try
  {
    /*
    var page = iFrame.contentWindow.document.body.Page;
    var region = Ilp.HtmlDom.GetRegion(page.Main);
    page.MainHeight = region.Height;
    var newHeight = page.HeaderHeight + page.MainHeight + page.FooterHeight;
    */

    var newHeight = iFrame.contentWindow.document.body.scrollHeight + 20;
    this.Ilp.HtmlDom.SetStyle(iFrame, "height", String(newHeight) + 'px');
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "UtilClass_AdjustIFramHeightToContent", "");
  }
}
function UtilClass_GetWebStatusBar()
{
  try
  {
    var webStatusBar;
    var hostWindow = Ilp.HtmlDom.GetHostWindow();
    if (hostWindow)
    {
      webStatusBar = hostWindow.WebStatusBar;
    }
    if(webStatusBar == null)
    {
      hostWindow = Ilp.HtmlDom.GetTreeviewHostWindow();
      if (hostWindow)
      {
        webStatusBar = hostWindow.WebStatusBar;
      }
    }
    if(webStatusBar == null)
    {
      webStatusBar = new WebStatusBarClass();
    }
    return webStatusBar;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "UtilClass_GetWebStatusBar", "");
  }
}
function UtilClass_GetClipboardData()
{
  try
  {
    var textValue = new String(window.clipboardData.getData("Text")).trim();
    return textValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "UtilClass_GetClipboardData", "");
  }
}
function UtilClass_SetClipboardData(text)
{
  try
  {
    window.clipboardData.setData("Text", text);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "UtilClass_SetClipboardData", "");
  }
}
function UtilClass_IsArray(arrayInstance)
{
  try
  {
    return Object.prototype.toString.call(arrayInstance) === "[object Array]";
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "UtilClass_IsArray", "");
  }
}
function UtilClass_IsFunction(functionInstance)
{
  try
  {
    return Object.prototype.toString.call(arrayInstance) === "[object Function]";
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "UtilClass_IsFunction", "");
  }
}
function UtilClass_GetValue(oControl, index, property)
{
  try
  {
    var controlValue = "";
    switch(oControl.getAttribute("ControlType"))
    {
      case "Label":
        controlValue = Ilp.HtmlDom.GetText(oControl);
        break;

      case "TextBox":
        controlValue = oControl.value;
        break;

      case "Panel":
        controlValue = oControl.innerHTML;
        break;

      case "CheckBox":
        controlValue = oControl.checked;
        break;

      case "RadioButton":
        controlValue = oControl.value;
        break;

      case "ListBox":
      case "DropDownList":
      
        if (typeof(property) != "string") property = "value";
        
        if (typeof(index) == "number")
        {
          if (index > -1 && index < oControl.options.length)
          {
            if (property == "text")
            {
              controlValue = oControl.options(index).text;
            }
            else
            {
              controlValue = oControl.options(index).value;
            }
          }  
        }
        else
        {
          if (oControl.selectedIndex > -1)
          {
            if (property == "text")
            {
              controlValue = oControl.options(oControl.selectedIndex).text;
            }
            else
            {
              controlValue = oControl.options(oControl.selectedIndex).value;
            }  
          }
        }  
        break;

      default:
        controlValue = oControl.value;
        break;
    }
    
    return controlValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "UtilClass_GetValue", "");
  }
}
function UtilClass_StripSpecialCharacters(stringValue)
{
  try
  {
    /*
    >\b  Backspace
    >\f  Form feed
    >\n  New line
    >\r  Carriage return
    >\t  Tab
    >\'  Single Quote
    >\"  Double Quote
    >\\  Backslash
    */
    return String(stringValue).replace(/[\n\r\t]/g,"");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "UtilClass_StripSpecialCharacters", "");
  }
}
function UtilClass_ConvertToJavaScriptLineFeed(stringValue)
{
  try
  {
    /*
    >\n  New line
    >\r  Carriage return
    */
    return String(stringValue).replace(/\r\n/g,"\n");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "UtilClass_ConvertToJavaScriptLineFeed", "");
  }
}
function UtilClass_PrepareHandler(handler)
{
  try
  {
    if (/[(].*?this.*?[)];/.test(handler) == true) handler = handler.replace(/[(].*?this.*?[)];/, "");
    if (/[(].*?this.*?[)]/.test(handler) == true) handler = handler.replace(/[(].*?this.*?[)]/, "");
    return handler;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "UtilClass_PrepareHandler", "");
  }
}

function UtilClass_ToObject(array)
{
  try
  {
    var returnValue = new Object();
    
    for (var i = 0; i < array.length; i++)
    {
      returnValue[array[i]] = i;
    }
    
    return returnValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "UtilClass_ToObject", "");
  }
}

function UtilClass_AdjustTextArea(oTextArea)
{
  var width = 30;
  var height = 10;
  
  var lines = oTextArea.value.split("\n");
  for (var i = 0; i < lines.length; i++)
  {
    if (lines[i].length > width) width = lines[i].length;
  }
  if (lines.length > height) height = lines.length;
  
  oTextArea.cols = width + 20;
  oTextArea.rows = height + 1;
}

function HostClass()
{
  try
  {
    this.FormID = "";
    this.IFrameContainer = null;
    
    this.Init = HostClass_Init;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HostClass", "");
  }
}
function HostClass_Init(window)
{
  try
  {
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HostClass_Init", "");
  }
}

function WopHostClass()
{
  try
  {
    this.FormID = "";
    this.IFrameContainer = null;

    this.AutoResizeContentWindow = true;

    this.Init = WopHostClass_Init;
    this.ResizeContentFrame = WopHostClass_ResizeContentFrame;
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WopHostClass", "");
  }
}
function WopHostClass_Init(window)
{
  try
  {
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WopHostClass_Init", "");
  }
}
function WopHostClass_ResizeContentFrame()
{
  try
  {
    Ilp.Util.AdjustIFramHeightToContent(this.IFrameContainer);
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WopHostClass_ResizeContentFrame", "");
  }
}

function TreeviewHostClass()
{
  try
  {
    this.FormID = "";
    this.IFrameContainer = null;
    
    this.Init = TreeviewHostClass_Init;
    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "TreeviewHostClass", "");
  }
}
function TreeviewHostClass_Init(window)
{
  try
  {
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "TreeviewHostClass_Init", "");
  }
}

function EventClass(ilp)
{
  try
  {
    this.Ilp = ilp;

    this.Bag = new Object();
    
    this.Cancel = EventClass_Cancel;
    this.CancelBubble = EventClass_CancelBubble;

    this.GetSender = EventClass_GetSender;
    this.GetSrc = EventClass_GetSrc;

    this.GetDataPath = EventClass_GetDataPath;
    this.GetFieldPath = EventClass_GetFieldPath;
    this.GetEventParams = EventClass_GetEventParams;
    
    this.OnBlur = EventClass_OnBlur;   
    this.OnClick = EventClass_OnClick;   
    this.OnMouseOut = EventClass_OnMouseOut;
    this.OnMouseOver = EventClass_OnMouseOver;
    this.OnKeyUp = EventClass_OnKeyUp;
    this.OnKeyPress = EventClass_OnKeyPress;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "EventClass", "");
  }
}
function EventClass_GetSender(sender, src, context)
{
  try
  {
    sender = sender == null ? (context.tagName ? context : window.event.srcElement) : sender;
    return sender;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "EventClass_GetSender", "");
  }
}
function EventClass_GetSrc(sender, src)
{
  try
  {
    src = src == null ? ((window.event && window.event.srcElement) ? window.event.srcElement : sender) : src;
    return src;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "EventClass_GetSrc", "");
  }
}
function EventClass_CancelBubble(sender)
{
  try
  {
    var eventObject = window.event;
    
    if (eventObject && eventObject.srcElement) 
    {
      eventObject.cancelBubble = true;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "EventClass_CancelBubble", "");
  }
}
function EventClass_Cancel(sender)
{
  try
  {
    var eventObject = window.event;
    
    if (eventObject && eventObject.srcElement) 
    {
      switch (eventObject.srcElement.getAttribute("ControlType"))
      {
        case "CheckBox":
        case "RadioButton":
          eventObject.cancelBubble = true;
          break;
        default:  
          eventObject.cancelBubble = true;
          eventObject.returnValue = false;
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "EventClass_Cancel", "");
  }
}
function EventClass_GetDataPath(sender, src)
{
  try
  { 
    var xPath = "";
    var tableName = ""
    var fieldName = "";
    var pkFieldName = "";
    
    var pkFieldValue = "";
    
    var fqn = "";
    var alFqn = null;

    var pkFieldValue = src.getAttribute("CubeSourcePkFieldValue");
    if (pkFieldValue && pkFieldValue.length > 0)
    {
      fqn = src.getAttribute("CubeSourcePkFqn");
      alFqn = fqn.split(".");
    
      xPath = "//" + alFqn[0] + "[" + alFqn[1] + "='" + pkFieldValue + "']";
    }
    else
    {
      pkFieldValue = src.getAttribute("PkFieldValue");
      if (pkFieldValue && pkFieldValue.length > 0)
      {
        fqn = src.getAttribute("PkFieldFqn");
        alFqn = fqn.split(".");
      
        xPath = "//" + alFqn[0] + "[" + alFqn[1] + "='" + pkFieldValue + "']";
      }  
    }
        
    return xPath;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "EventClass_GetDataPath", "");
  }
}

function EventClass_GetFieldPath(sender, src)
{
  try
  { 
    var fqnReturn = "";
    
    var fqn = src.getAttribute("CubeSourceFieldFqn");
    if (fqn && fqn.length > 0)
    {
      fqnReturn = fqn;
    }
    else
    {
      fqn = src.getAttribute("FieldFqn");
      if (fqn && fqn.length > 0)
      {
        fqnReturn = fqn;
      }
    }
    
    return fqnReturn;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "EventClass_GetFieldPath", "");
  }
}
function EventClass_GetEventParams(sender, src)
{
  try
  {
    var tableName = "";
    var fieldName = "";

    if (src.oRecord == null)
    {
      var xPath = this.GetDataPath(sender, src);
      if (xPath.length > 0)
      { 
        src.oRecord = WebData.Select(xPath, null, 0);
      }
    }
    if (src.oFieldDescriptor == null)
    {
      var fqn = this.GetFieldPath(sender, src);
      if (fqn.length > 0)
      { 
        src.oFieldDescriptor = FormDescriptor.GetFieldDescriptor(fqn);
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "EventClass_GetEventParams", "");
  }
}
function EventClass_OnBlur(sender, src)
{
  try
  { 
    sender = Ilp.Event.GetSender(sender, src, this);
    src = Ilp.Event.GetSrc(sender, src);

    var args = new EventArgs();
    args.Cancel = false;
    args.Sender = sender;
    args.Src = src;

    this.GetEventParams(sender, src);

    switch (Ilp.HtmlDom.GetAttribute(src, "ControlType", ""))
    {
      case "Table":
        Ilp.AutoComplete.OnBlur();
        Ilp.Event.Cancel(sender);
        break;
      default:
        WebForm.OnKeyPress(sender, src);
    }

  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "EventClass_OnBlur", "");
  }
}
function EventClass_OnClick(sender, src)
{
  try
  { 
    sender = Ilp.Event.GetSender(sender, src, this);
    src = Ilp.Event.GetSrc(sender, src);

    var args = new EventArgs();
    args.Cancel = false;
    args.Sender = sender;
    args.Src = src;

    this.GetEventParams(sender, src);
    
    if (Ilp.HtmlDom.GetAttribute(sender, "ControlType", "") == "WebSpreadSheet")
    {
      if (Ilp.HtmlDom.GetAttribute(src, "ControlType", "") == "Image")
      {
        var onClickHandler = Ilp.HtmlDom.GetAttribute(sender, "OnClickHandler", "")
        if (onClickHandler.length > 0)
        {
          onClickHandler = Ilp.Util.PrepareHandler(onClickHandler);
          eval(onClickHandler + "(sender, args);");
          if (args.Cancel == true) this.Cancel(sender);
        }
      }
    }
        
    if (args.Cancel == false)
    {
      if (sender.JsInstance && sender.JsInstance.ClassType == "WebSpreadSheetClass")
      {
        sender.JsInstance.ProcessClick(sender, src);
      }
      else if (sender.JsInstance && sender.JsInstance.ClassType == "MoverListBox2Class")
      {
        sender.JsInstance.ProcessClick(sender, src);
      }
      else if (sender.JsInstance && sender.JsInstance.ClassType == "TabControlClass")
      {
        sender.JsInstance.ProcessClick(sender, src);
      }
      else if (sender.JsInstance && sender.JsInstance.ClassType == "MenuStripClass")
      {
        sender.JsInstance.ProcessClick(sender, src);
      }
      else if (sender.JsInstance && sender.JsInstance.ClassType == "MarginalNavigationClass")
      {
        sender.JsInstance.ProcessClick(sender, src);
      }
      else
      {
        switch(src.getAttribute("CT")*1)
        {
          case enum_CT_SpreadSheet_ViewDetail:
            Ilp.Page.ViewDetail(sender, src);
            this.Cancel(event);
            break;
          default:
            WebForm.OnClickHandler(sender, src);
        }
      }
    }  
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "EventClass_OnClick", "");
  }
}
function EventClass_OnKeyPress(sender, src)
{
  try
  { 
    sender = Ilp.Event.GetSender(sender, src, this);
    src = Ilp.Event.GetSrc(sender, src);

    var args = new EventArgs();
    args.Cancel = false;
    args.Sender = sender;
    args.Src = src;

    this.GetEventParams(sender, src);

    if(window.event.keyCode >= 32 )
    {
      switch (Ilp.HtmlDom.GetAttribute(sender, "ControlType", ""))
      {
        case "Table":
          Ilp.AutoComplete.OnKeyPress();
          Ilp.Event.Cancel(window.event);
          break;
        default:
          WebForm.OnKeyPressHandler(sender, src);
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "EventClass_OnKeyPress", "");
  }
}
function EventClass_OnKeyUp(sender)
{
  try
  { 
    var src = window.event.srcElement;
    
    this.GetEventParams(sender, src);
    if (src.oRecord != null && src.oFieldDescriptor != null)
    {
      WebForm.OnKeyUpHandler(src);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "EventClass_OnKeyUp", "");
  }
}
function EventClass_OnMouseOut(sender, src)
{
  try
  {
    sender = Ilp.Event.GetSender(sender, src, this);
    src = Ilp.Event.GetSrc(sender, src);

    if (src == null) return;

    var args = new EventArgs();
    args.Cancel = false;
    args.Sender = sender;
    args.Src = src;
  
    if (args.Cancel == false)
    {
      if (sender.JsInstance && sender.JsInstance.ClassType == "MenuStripClass")
      {
        sender.JsInstance.ProcessOnMouseOut(sender, src);
      }
      else
      {
        WebForm.OnMouseOutHandler();
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "EventClass_OnMouseOut", "");
  }
}
function EventClass_OnMouseOver(sender, src)
{
  try
  {
    sender = Ilp.Event.GetSender(sender, src, this);
    src = Ilp.Event.GetSrc(sender, src);

    if (src == null) return;

    var args = new EventArgs();
    args.Cancel = false;
    args.Sender = sender;
    args.Src = src;
  
    if (args.Cancel == false)
    {
      if (sender.JsInstance && sender.JsInstance.ClassType == "MenuStripClass")
      {
        sender.JsInstance.ProcessOnMouseOver(sender, src);
      }
      else
      {
        WebForm.OnMouseOutHandler();
      }
    }
  
    WebForm.OnMouseOverHandler();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "EventClass_OnMouseOver", "");
  }
}

function EnsureIlp()
{
  try
  { 
    if (typeof(window.Ilp) == "undefined") 
    {
      window.Ilp = new IlpClass();
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "EnsureIlp", "")
  }
}

function MoverListBox2Class(moverListBoxContainer)
{
  try
  {
    this.Container = moverListBoxContainer;
    this.Container.JsInstance = this;
    this.ObjectID = this.Container.id;
    this.ClientID = this.Container.id;
    this.ClassType = "MoverListBox2Class";

    this.CssHightLight = "HightLight";
    var margin = 0;
    
    this.LeftItem = null;
    this.RightItem = null;
    
    this.CaptionDiv = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_MoverListBox2_CaptionLabelDiv);
    
    this.LeftDiv = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_MoverListBox2_ListLeftDiv);
    this.LeftCaptionDiv = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_MoverListBox2_ListLeftCaptionDiv);
    this.LeftMoveUpDownDiv = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_MoverListBox2_ListLeftMoveUpDownDiv);
    this.LeftCheckBox = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_MoverListBox2_ListLeftCheckBox);

    this.MiddleDiv = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_MoverListBox2_ListMiddleDiv);

    this.RightDiv = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_MoverListBox2_ListRightDiv);
    this.RightCaptionDiv = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_MoverListBox2_ListRightCaptionDiv);
    this.RightMoveUpDownDiv = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_MoverListBox2_ListRightMoveUpDownDiv);
    this.RightCheckBox = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_MoverListBox2_ListRightCheckBox);

    this.LeftList = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_MoverListBox2_ListLeft);
    this.RightList = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_MoverListBox2_ListRight);
    
    margin = parseInt(Ilp.HtmlDom.GetStyle(this.CaptionDiv, "height"));
    
    //this.LeftDiv.style.setExpression("height", "parseInt(parentNode.clientHeight - " + String(margin) + ") + \"px\"", "JScript");
    //this.MiddleDiv.style.setExpression("height", "parseInt(parentNode.clientHeight - " + String(margin) + ") + \"px\"", "JScript");
    //this.RightDiv.style.setExpression("height", "parseInt(parentNode.clientHeight - " + String(margin) + ") + \"px\"", "JScript");
    Ilp.HtmlDom.SetExpression(this.LeftDiv, "height", "parseInt(parentNode.clientHeight - " + String(margin) + ") + \"px\"", "JScript");
    Ilp.HtmlDom.SetExpression(this.MiddleDiv, "height", "parseInt(parentNode.clientHeight - " + String(margin) + ") + \"px\"", "JScript");
    Ilp.HtmlDom.SetExpression(this.RightDiv, "height", "parseInt(parentNode.clientHeight - " + String(margin) + ") + \"px\"", "JScript");

    margin = 0;
    margin += parseInt(Ilp.HtmlDom.GetStyle(this.LeftCaptionDiv, "height"));
    margin += parseInt(Ilp.HtmlDom.GetStyle(this.LeftMoveUpDownDiv, "height"));
    
    //this.LeftList.style.setExpression("height", "parseInt(parentNode.parentNode.clientHeight - " + String(margin) + ") + \"px\"", "JScript");
    //this.RightList.style.setExpression("height", "parseInt(parentNode.parentNode.clientHeight - " + String(margin) + ") + \"px\"", "JScript");
    Ilp.HtmlDom.SetExpression(this.LeftList, "height", "parseInt(parentNode.parentNode.clientHeight - " + String(margin) + ") + \"px\"", "JScript");
    Ilp.HtmlDom.SetExpression(this.RightList, "height", "parseInt(parentNode.parentNode.clientHeight - " + String(margin) + ") + \"px\"", "JScript");
    
    this.HighLight = MoverListBox2Class_HighLight;
    this.MoveUp = MoverListBox2Class_MoveUp;
    this.MoveDown = MoverListBox2Class_MoveDown;
    this.Select = MoverListBox2Class_Select;
    this.SelectItems = MoverListBox2Class_SelectItems;
    this.GetSelectedItems = MoverListBox2Class_GetSelectedItems;
    this.IsItemSelected = MoverListBox2Class_IsItemSelected;

    this.GetLI = MoverListBox2Class_GetLI;
    this.GetUL = MoverListBox2Class_GetUL;
    this.GetA = MoverListBox2Class_GetA;
    this.GetCheckBox = MoverListBox2Class_GetCheckBox;

    this.Clear = MoverListBox2Class_Clear;
    this.Reset = MoverListBox2Class_Reset;
    this.Comparer = MoverListBox2Class_Comparer;
    
    this.ProcessClick = MoverListBox2Class_ProcessClick;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MoverListBox2Class", "");
  }
}
function MoverListBox2Class_Reset()
{
  try
  {
    var aSort = this.Clear();
    aSort.sort(this.Comparer);

    for (var i = 0, len = aSort.length; i < len; i++)
    {
      var helper = aSort[i];
      if (helper.Visible == true)
      {
        this.LeftList.appendChild(helper.Item);
      }
      else
      {
        this.RightList.appendChild(helper.Item);
      }
    }
    WebControl.SetValue(this.LeftCheckBox, false);
    this.SelectItems(this.LeftCheckBox, "SelectLeft");
    if (this.LeftItem) Ilp.HtmlDom.RemoveClass(this.LeftItem.LI, this.CssHightLight);

    WebControl.SetValue(this.RightCheckBox, false);
    this.SelectItems(this.RightCheckBox, "SelectLeft");
    if (this.RightItem) Ilp.HtmlDom.RemoveClass(this.RightItem.LI, this.CssHightLight);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MoverListBox2Class_Reset", "");
  }
}
function MoverListBox2Class_Comparer(item1, item2)
{
  if (item1.Position < item2.Position)
  {
    return -1;
  }
  else if (item1.Position > item2.Position)
  {
    return 1;
  }
  return 0;
}
function MoverListBox2Class_Clear()
{
  try
  {
    var aSort = new Array();
    for (var i = this.LeftList.childNodes.length - 1; i >= 0; i--)
    {
      var item = this.LeftList.childNodes[i];
      
      var helper = {};
      helper.Item = item;
      helper.Position = Ilp.HtmlDom.GetAttributeInt(item, "Position", 0);
      helper.Visible = Ilp.HtmlDom.GetAttributeBool(item, "Visible", true);
      aSort[aSort.length] = helper;

      Ilp.HtmlDom.RemoveElement(item);
    }
    for (var i = this.RightList.childNodes.length - 1; i >= 0; i--)
    {
      var item = this.RightList.childNodes[i];
      
      var helper = {};
      helper.Item = item;
      helper.Position = Ilp.HtmlDom.GetAttributeInt(item, "Position", 0);
      helper.Visible = Ilp.HtmlDom.GetAttributeBool(item, "Visible", true);
      aSort[aSort.length] = helper;
      
      Ilp.HtmlDom.RemoveElement(item);
    }
    
    return aSort;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MoverListBox2Class_Clear", "");
  }
}
function MoverListBox2Class_ProcessClick(sender, src)
{
  try
  {
    sender = Ilp.Event.GetSender(sender, src, this);
    src = Ilp.Event.GetSrc(sender, src);

    switch(src.getAttribute("CT")*1)
    {
      case enum_CT_MoverListBox2_LeftItem:
        this.HighLight(src);
        Ilp.Event.Cancel(event);
        break;
      case enum_CT_MoverListBox2_RightItem:
        this.HighLight(src);
        Ilp.Event.Cancel(event);
        break;
      case enum_CT_MoverListBox2_ListLeftMoveUpImage:
        this.MoveUp(src);
        Ilp.Event.Cancel(event);
        break;
      case enum_CT_MoverListBox2_ListLeftMoveDownImage:
        this.MoveDown(src);
        Ilp.Event.Cancel(event);
        break;
      case enum_CT_MoverListBox2_ListRightMoveUpImage:
        this.MoveUp(src);
        Ilp.Event.Cancel(event);
        break;
      case enum_CT_MoverListBox2_ListRightMoveDownImage:
        this.MoveDown(src);
        Ilp.Event.Cancel(event);
        break;
      case enum_CT_MoverListBox2_ListSelectImage:
      case enum_CT_MoverListBox2_ListSelectImageDiv:
        this.Select(src, "Select");
        Ilp.Event.Cancel(event);
        break;
      case enum_CT_MoverListBox2_ListSelectAllImage:
      case enum_CT_MoverListBox2_ListSelectAllImageDiv:
        this.Select(src, "SelectAll");
        Ilp.Event.Cancel(event);
        break;
      case enum_CT_MoverListBox2_ListDeselectAllImage:
      case enum_CT_MoverListBox2_ListDeselectAllImageDiv:
        this.Select(src, "DeselectAll");
        Ilp.Event.Cancel(event);
        break;
      case enum_CT_MoverListBox2_ListDeselectImage:
      case enum_CT_MoverListBox2_ListDeselectImageDiv:
        this.Select(src, "Deselect");
        Ilp.Event.Cancel(event);
        break;
      case enum_CT_MoverListBox2_ListLeftCheckBox:
        this.SelectItems(src, "SelectLeft");
        Ilp.Event.Cancel(event);
        break;
      case enum_CT_MoverListBox2_ListRightCheckBox:
        this.SelectItems(src, "SelectRight");
        Ilp.Event.Cancel(event);
        break;
      default:
        break;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MoverListBox2Class_ProcessClick", "Section1")
  }
}
function MoverListBox2Class_GetUL(src)
{
  try
  {
    var ul = src;
    if (src.tagName == "A") ul = src.parentNode.parentNode;
    else if (src.tagName == "LI") ul = src.parentNode;
    return ul;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MoverListBox2Class_GetUL", "Section1")
  }
}
function MoverListBox2Class_GetLI(src)
{
  try
  {
    var li = src;
    if (src.tagName == "A") li = src.parentNode;
    else if (src.tagName == "INPUT") li = src.parentNode.parentNode;
    return li;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MoverListBox2Class_GetLI", "Section1")
  }
}
function MoverListBox2Class_GetA(src)
{
  try
  {
    var a = src;
    if (src.tagName == "LI") a = src.firstChild;
    else if (src.tagName == "INPUT") a = src.parentNode;
    return a;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MoverListBox2Class_GetA", "Section1")
  }
}
function MoverListBox2Class_GetCheckBox(src)
{
  try
  {
    var checkBox = src;
    if (src.tagName == "LI") checkBox = this.GetA(src).firstChild;
    if (src.tagName == "A") checkBox = src.firstChild;
    return checkBox;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MoverListBox2Class_GetCheckBox", "Section1")
  }
}
function MoverListBox2Class_SelectItems(src, mode)
{
  try
  {
    switch(mode)
    {
      case "SelectLeft":
        var controlValue = WebControl.GetValue(src);
        for (var i = 0, len = this.LeftList.childNodes.length; i < len; i++)
        {
          var checkBox = this.GetCheckBox(this.LeftList.childNodes[i]);
          WebControl.SetValue(checkBox, controlValue);
        }
        break;
      case "SelectRight":
        var controlValue = WebControl.GetValue(src);
        for (var i = 0, len = this.RightList.childNodes.length; i < len; i++)
        {
          var checkBox = this.GetCheckBox(this.RightList.childNodes[i]);
          WebControl.SetValue(checkBox, controlValue);
        }
        break;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MoverListBox2Class_SelectItems", "Section1")
  }
}
function MoverListBox2Class_IsItemSelected(item)
{
  try
  {
    var checkBox = this.GetCheckBox(item);
    return WebControl.GetValue(checkBox);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MoverListBox2Class_IsItemSelected", "Section1")
  }
}
function MoverListBox2Class_GetSelectedItems(mode)
{
  try
  {
    var selectedItems = new WebArray();
    switch(mode)
    {
      case "Left":
        for (var i = 0, len = this.LeftList.childNodes.length; i < len; i++)
        {
          if (this.IsItemSelected(this.LeftList.childNodes[i]) == true)
          {
            selectedItems.Add(this.LeftList.childNodes[i]);
          }
        }
        break;
      case "Right":
        for (var i = 0, len = this.RightList.childNodes.length; i < len; i++)
        {
          if (this.IsItemSelected(this.RightList.childNodes[i]) == true)
          {
            selectedItems.Add(this.RightList.childNodes[i]);
          }
        }
        break;
    }
    return selectedItems;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MoverListBox2Class_GetSelectedItems", "Section1")
  }
}
function MoverListBox2Class_Select(src, mode)
{
  try
  {
    switch(mode)
    {
      case "Select":
        var selectedItems = this.GetSelectedItems("Left");
        if (selectedItems.Count() > 0)
        {
          if (this.LeftItem) Ilp.HtmlDom.RemoveClass(this.LeftItem.LI, this.CssHightLight);
          if (this.RightItem) Ilp.HtmlDom.RemoveClass(this.RightItem.LI, this.CssHightLight);
          for (var i = 0, len = selectedItems.Count(); i < len; i++)
          {
            var item = selectedItems.Get(i);
            this.RightList.appendChild(item);
            Ilp.HtmlDom.SetAttribute(this.GetLI(item), "CT", String(enum_CT_MoverListBox2_RightItem));
            Ilp.HtmlDom.SetAttribute(this.GetA(item), "CT", String(enum_CT_MoverListBox2_RightItem));
          }
        }
        else alert(ids_SelectAnItemFist);
        /*
        if (this.LeftItem) 
        {
          if (this.RightItem) Ilp.HtmlDom.RemoveClass(this.RightItem.LI, this.CssHightLight);
          this.RightList.appendChild(this.LeftItem.LI);
          this.RightItem = this.LeftItem;
          Ilp.HtmlDom.SetAttribute(this.RightItem.LI, "CT", String(enum_CT_MoverListBox2_RightItem));
          Ilp.HtmlDom.SetAttribute(this.RightItem.A, "CT", String(enum_CT_MoverListBox2_RightItem));
          this.LeftItem = null;
        }
        else alert(ids_SelectAnItemFist);
        */
        break;
      case "SelectAll":
        for (var i = 0, len = this.LeftList.childNodes.length; i < len; i++)
        {
          var item = this.RightList.appendChild(this.LeftList.childNodes[0]);
          Ilp.HtmlDom.SetAttribute(item, "CT", String(enum_CT_MoverListBox2_RightItem));
          Ilp.HtmlDom.SetAttribute(this.GetA(item), "CT", String(enum_CT_MoverListBox2_RightItem));
        }
        if (this.LeftItem) Ilp.HtmlDom.RemoveClass(this.LeftItem.LI, this.CssHightLight);
        this.LeftItem = null;
        break;
      case "DeselectAll":
        for (var i = 0, len = this.RightList.childNodes.length; i < len; i++)
        {
          var item = this.LeftList.appendChild(this.RightList.childNodes[0]);
          Ilp.HtmlDom.SetAttribute(item, "CT", String(enum_CT_MoverListBox2_LeftItem));
          Ilp.HtmlDom.SetAttribute(this.GetA(item), "CT", String(enum_CT_MoverListBox2_LeftItem));
        }
        if (this.RightItem) Ilp.HtmlDom.RemoveClass(this.RightItem.LI, this.CssHightLight);
        this.RightItem = null;
        break;
      case "Deselect":
        var selectedItems = this.GetSelectedItems("Right");
        if (selectedItems.Count() > 0)
        {
          if (this.LeftItem) Ilp.HtmlDom.RemoveClass(this.LeftItem.LI, this.CssHightLight);
          if (this.RightItem) Ilp.HtmlDom.RemoveClass(this.RightItem.LI, this.CssHightLight);
          for (var i = 0, len = selectedItems.Count(); i < len; i++)
          {
            var item = selectedItems.Get(i);
            this.LeftList.appendChild(item);
            Ilp.HtmlDom.SetAttribute(this.GetLI(item), "CT", String(enum_CT_MoverListBox2_RightItem));
            Ilp.HtmlDom.SetAttribute(this.GetA(item), "CT", String(enum_CT_MoverListBox2_RightItem));
          }
        }
        else alert(ids_SelectAnItemFist);
        /*
        if (this.RightItem) 
        {
          if (this.LeftItem) Ilp.HtmlDom.RemoveClass(this.LeftItem.LI, this.CssHightLight);
          this.LeftList.appendChild(this.RightItem.LI);
          this.LeftItem = this.RightItem;
          Ilp.HtmlDom.SetAttribute(this.LeftItem.LI, "CT", String(enum_CT_MoverListBox2_LeftItem));
          Ilp.HtmlDom.SetAttribute(this.LeftItem.A, "CT", String(enum_CT_MoverListBox2_LeftItem));
          this.RightItem = null;
        }
        else alert(ids_SelectAnItemFist);
        */
        break;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MoverListBox2Class_HighLight", "Section1")
  }
}
function MoverListBox2Class_HighLight(src)
{
  try
  {
    switch(src.getAttribute("CT")*1)
    {
      case enum_CT_MoverListBox2_LeftItem:
        if (this.LeftItem) Ilp.HtmlDom.RemoveClass(this.LeftItem.LI, this.CssHightLight);
        this.LeftItem = new Object();
        this.LeftItem.A = this.GetA(src);
        this.LeftItem.LI = this.GetLI(src);
        if (this.LeftItem) Ilp.HtmlDom.AddClass(this.LeftItem.LI, this.CssHightLight);
        break;
      case enum_CT_MoverListBox2_RightItem:
        if (this.RightItem) Ilp.HtmlDom.RemoveClass(this.RightItem.LI, this.CssHightLight);
        this.RightItem = new Object();
        this.RightItem.A = this.GetA(src);
        this.RightItem.LI = this.GetLI(src);
        if (this.RightItem) Ilp.HtmlDom.AddClass(this.RightItem.LI, this.CssHightLight);
        break;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MoverListBox2Class_HighLight", "Section1")
  }
}
function MoverListBox2Class_MoveUp(src)
{
  try
  {
    switch(src.getAttribute("CT")*1)
    {
      case enum_CT_MoverListBox2_ListLeftMoveUpImage:
        if (this.LeftItem)
        {
          var previousSibling = this.LeftItem.LI.previousSibling;
          if (previousSibling && (previousSibling.getAttribute("CT")*1 == enum_CT_MoverListBox2_LeftItem))
          {
            this.LeftList.insertBefore(this.LeftItem.LI, previousSibling);
          }
        }
        else alert(ids_SelectAnItemFist);
        break;
      case enum_CT_MoverListBox2_ListRightMoveUpImage:
        if (this.RightItem)
        {
          var previousSibling = this.RightItem.LI.previousSibling;
          if (previousSibling && (previousSibling.getAttribute("CT")*1 == enum_CT_MoverListBox2_RightItem))
          {
            this.RightList.insertBefore(this.RightItem.LI, previousSibling);
          }
        }
        else alert(ids_SelectAnItemFist);
        break;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MoverListBox2Class_MoveUp", "Section1")
  }
}
function MoverListBox2Class_MoveDown(src)
{
  try
  {
    switch(src.getAttribute("CT")*1)
    {
      case enum_CT_MoverListBox2_ListLeftMoveDownImage:
        if (this.LeftItem)
        {
          var nextSibling = this.LeftItem.LI.nextSibling;
          if (nextSibling && (nextSibling.getAttribute("CT")*1 == enum_CT_MoverListBox2_LeftItem))
          {
            nextSibling = nextSibling.nextSibling;
            if (nextSibling && (nextSibling.getAttribute("CT")*1 == enum_CT_MoverListBox2_LeftItem))
            {
              this.LeftList.insertBefore(this.LeftItem.LI, nextSibling);
            }
            else
            {
              this.LeftList.appendChild(this.LeftItem.LI);
            }
          }
        }
        else alert(ids_SelectAnItemFist);
        break;
      case enum_CT_MoverListBox2_ListRightMoveDownImage:
        if (this.RightItem)
        {
          var nextSibling = this.RightItem.LI.nextSibling;
          if (nextSibling && (nextSibling.getAttribute("CT")*1 == enum_CT_MoverListBox2_RightItem))
          {
            nextSibling = nextSibling.nextSibling;
            if (nextSibling && (nextSibling.getAttribute("CT")*1 == enum_CT_MoverListBox2_RightItem))
            {
              this.RightList.insertBefore(this.RightItem.LI, nextSibling);
            }
            else
            {
              this.RightList.appendChild(this.RightItem.LI);
            }
          }
        }
        else alert(ids_SelectAnItemFist);
        break;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MoverListBox2Class_MoveDown", "Section1")
  }
}
function MarginalNavigationClass(marginalNavigationContainer)
{
  try
  {
    this.Container = marginalNavigationContainer;
    this.Container.JsInstance = this;
    this.ObjectID = this.Container.id;
    this.ClientID = this.Container.id;
    this.ClassType = "MarginalNavigationClass";
    
    this.ImageContainerDiv = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_NavTree_ImageContainerDiv);
    this.ExpandButton = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_NavTree_ExpandButton);
    this.CollapseButton = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_NavTree_CollapseButton);

    this.ToggleVisualDiv = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_NavTree_ToggleVisualDiv);
    this.ToggleVisual = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_NavTree_ToggleVisual);

    this.NavigationDiv = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_NavTree_NavigationDiv);
    
    this.ActiveMenuItem = null;
    
    this.Col1 = document.getElementById("col1");
    this.Col1_Content = document.getElementById("col1_content");

    this.Col3 = document.getElementById("col3");
    this.Col3_Content = document.getElementById("col3_content");

    this.Collapse = MarginalNavigationClass_Collapse;
    this.Expand = MarginalNavigationClass_Expand;

    this.Expand = MarginalNavigationClass_Expand;

    this.CompleteUrl = MarginalNavigationClass_CompleteUrl;
    this.Load = MarginalNavigationClass_Load;
    this.LoadFromUrl = MarginalNavigationClass_LoadFromUrl;
    this.ActivateMenuByContentID = MarginalNavigationClass_ActivateMenuByContentID;
    this.ActivateMenuByContentText = MarginalNavigationClass_ActivateMenuByContentText;
    this.ProcessClick = MarginalNavigationClass_ProcessClick;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MarginalNavigationClass", "Section1")
  }
}
function MarginalNavigationClass_CompleteUrl(url)
{
  try
  {
    if (url.indexOf(RootPath) == -1)
    {
      return RootPath + url;
    }
    return url;
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "MarginalNavigationClass_CompleteUrl", "Section1")
  }
}

function MarginalNavigationClass_LoadFromUrl(url, query)
{
  try
  {
    var ancor = this.ActivateMenuByContentText(this.CompleteUrl(url));
    if (ancor) this.Load(ancor, query);
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "MarginalNavigationClass_Load", "Section1")
  }
}
function MarginalNavigationClass_Load(sender, query)
{
  try
  {
    query = query == null ? "" : query;
    if (this.ActiveMenuItem)
    {
      Ilp.HtmlDom.SetStyle(this.ActiveMenuItem, "backgroundColor", "");
    }
    this.ActiveMenuItem = sender;

    var externalLink = false;
    var url = this.ActiveMenuItem.getAttribute("ContentText");
    var urlDescriptor = new UrlDescriptor(url);
    if (WebControl.CheckString(url))
    {
      if (externalLink == true)
      {
        window.open(url);
      }
      else if (urlDescriptor.File == "Login.aspx")
      {
        WebControl.Submit(null, url);
      }
      else
      {
        if (WebControl.GetExtension(url) == "aspx")
        {
          url = Ilp.Util.AddQueryParameter(url, "IDNode=" + sender.getAttribute("NodeID"));
          if (query.length > 0)
          {
            url = Ilp.Util.AddQueryParameter(url, query);
          }
        }

        Ilp.Application.PageHeadline = sender.getAttribute("DisplayName");
        Ilp.Page.LoadFrame(url, Wop_GetContentContainer(), PPShowAsXhtml2);
      }
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "MarginalNavigationClass_Load", "Section1")
  }
}
function MarginalNavigationClass_ActivateMenuByContentText(url)
{
  try
  {
    var ancor = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "ContentText", this.CompleteUrl(url));
    if (ancor)
    {
      WebControl.ScrollToControl(ancor, Graphic3DInstance.Bottom_Bottom, 0);
      this.ActiveMenuItem = ancor;
      Ilp.HtmlDom.SetStyle(this.ActiveMenuItem, "backgroundColor", "#dde5eb");
    }
    return ancor;
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "MarginalNavigationClass_ActivateMenuByContentID", "Section1")
  }
}
function MarginalNavigationClass_ActivateMenuByContentID(contentID)
{
  try
  {
    var ancor = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "ContentID", contentID);
    if (ancor)
    {
      WebControl.ScrollToControl(ancor, Graphic3DInstance.Bottom_Bottom, 0);
      this.ActiveMenuItem = ancor;
      Ilp.HtmlDom.SetStyle(this.ActiveMenuItem, "backgroundColor", "#dde5eb");
    }
    return ancor;
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "MarginalNavigationClass_ActivateMenuByContentID", "Section1")
  }
}
function MarginalNavigationClass_ProcessClick(sender, src)
{
  try
  {
    sender = Ilp.Event.GetSender(sender, src, this);
    src = Ilp.Event.GetSrc(sender, src);

    switch(src.getAttribute("CT")*1)
    {
      case enum_CT_NavTree_CollapseButton:
        this.Collapse(src);
        Ilp.Event.Cancel(event);
        break;
      case enum_CT_NavTree_ExpandButton:
        this.Expand(src);
        Ilp.Event.Cancel(event);
        break;
      default:
        break;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MarginalNavigationClass_ProcessClick", "Section1")
  }
}
function MarginalNavigationClass_Expand(src)
{
  try
  {
    Ilp.HtmlDom.SetStyle(this.ToggleVisualDiv, "display", "none");
    Ilp.HtmlDom.SetStyle(this.CollapseButton, "display", "block");
    Ilp.HtmlDom.SetStyle(this.ExpandButton, "display", "none");
    Ilp.HtmlDom.SetStyle(this.NavigationDiv, "display", "block");
    
    //Ilp.HtmlDom.SetStyle(this.ImageContainerDiv, "width", "100%");
    Ilp.HtmlDom.SetStyle(this.Col1, "width", "160px");
    Ilp.HtmlDom.SetStyle(this.Col1_Content, "width", "158px");

    Ilp.HtmlDom.SetStyle(this.Col3, "margin-left", "160px");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MarginalNavigationClass_Expand", "Section1")
  }
}
function MarginalNavigationClass_Collapse(src)
{
  try
  {
    Ilp.HtmlDom.SetStyle(this.ToggleVisualDiv, "display", "block");
    Ilp.HtmlDom.SetStyle(this.CollapseButton, "display", "none");
    Ilp.HtmlDom.SetStyle(this.ExpandButton, "display", "block");
    Ilp.HtmlDom.SetStyle(this.NavigationDiv, "display", "none");
    
    Ilp.HtmlDom.SetStyle(this.Col1, "width", "16px");
    Ilp.HtmlDom.SetStyle(this.Col1_Content, "width", "16px");
    
    Ilp.HtmlDom.SetStyle(this.Col3, "margin", "0 0 0 18px");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MarginalNavigationClass_Collapse", "Section1")
  }
}


if (window.XmlVersion == enum_XmlVersion_V3)
{
}
else
{
  EnsureIlp();
}
function AutoCompleteClass(ilp)
{
  this.Ilp = ilp;

  // This script and the listbox on this page illustrates one 
  // way to create an "auto-complete" listbox, where the

  this.ToFind = "";             // Variable that acts as keyboard buffer
  this.TimeoutID = "";          // Process id for timer (used when stopping 
                                // the timeout)
  this.TimeoutInterval = 350;   // Milliseconds. Shorten to cause keyboard 
                                // buffer to be cleared faster
  this.TimeoutCtr = 0;          // Initialization of timer count down
  this.TimeoutCtrLimit = 3 ;    // Number of times to allow timer to count 
                                // down
  this.oControl = null;         // Maintains a global reference to the 
                                // control that the user is working with.
  
  this.IsTableSearch = false;
  this.oTable = null;
  
  this.AllOptions = new Array();
  
  this.OnKeyPress = AutoCompleteClass_OnKeyPress;
  this.OnBlur = AutoCompleteClass_OnBlur;
  
  this.Find = AutoCompleteClass_Find;
  this.ResetToFind = AutoCompleteClass_ResetToFind;
  this.Idle = AutoCompleteClass_Idle;
  this.ReplaceUmlaute = AutoCompleteClass_ReplaceUmlaute;
}
function AutoCompleteClass_OnKeyPress()
{
  try
  {

    // This function is called when the user presses a key while focus is in 
    // the listbox. It maintains the keyboard buffer.
    // Each time the user presses a key, the timer is restarted. 
    // First, stop the previous timer; this function will restart it.
    window.clearInterval(this.TimeoutID)

    // Which control raised the event? We'll need to know which control to 
    // set the selection in.
    var oControlTemp = window.event.srcElement;
    
    var tagName = oControlTemp.tagName;
    this.IsTableSearch = ("TABLE,TR,TD,".indexOf(tagName + ",") > -1);
    if (this.IsTableSearch == true)
    {
      var oTableTemp;
      if (tagName == "TD") 
      {
        oTableTemp = oControlTemp.parentElement.parentElement;
      }
      else if (tagName == "TR") 
      {
        oTableTemp = oControlTemp.parentElement;
      }
      else if (tagName == "TABLE") 
      {
        oTableTemp = oControlTemp;
      }
      
      if (this.oTable != oTableTemp)
      {
        this.oTable = oTableTemp;
        this.oControl = oTableTemp;
        for (var i = 0; i < this.oTable.rows.length; i++)
        {
          this.AllOptions[this.AllOptions.length] = this.oTable.rows[i].cells[1];
        }
      }
    }
    else
    {
      this.oControl = oControlTemp;
      this.AllOptions = document.all.item(this.oControl.id);
    }

    var keycode = window.event.keyCode;

    if (keycode >= 32)
    {
      // What character did the user type?
      var c = String.fromCharCode(keycode);
      c = c.toUpperCase(); 
      // Convert it to uppercase so that comparisons don't fail
      this.ToFind += c ; // Add to the keyboard buffer
      this.Find();    // Search the listbox
      this.TimeoutID = window.setInterval("Ilp.AutoComplete.Idle()", this.TimeoutInterval);  
      // Restart the timer
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "AutoCompleteClass_OnKeyPress", "Section1")
  }
}
function AutoCompleteClass_OnBlur()
{
  try
  {
    // This function is called when the user leaves the listbox.
    window.clearInterval(this.TimeoutID);
    this.ResetToFind();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "AutoCompleteClass_OnBlur", "Section1")
  }
}
function AutoCompleteClass_Find()
{
  try
  {
    var indexHasChanged = false;
    // Walk through the select list looking for a match

    for (i = 0; i < this.AllOptions.length; i++)
    {
      // Gets the next item from the listbox
      nextOptionText = Ilp.HtmlDom.GetText(this.AllOptions[i]).toUpperCase();

      // By default, the values in the listbox and as entered by the  
      // user are strings. This causes a string comparison to be made, 
      // which is not correct for numbers (1 < 11 < 2).
      // The following lines coerce numbers into an (internal) number 
      // format so that the subsequent comparison is done as a 
      // number (1 < 2 < 11).

      /*
      if (isNaN(nextOptionText) == false && isNaN(this.ToFind) == false)
      {
        nextOptionText *= 1;        // coerce into number
        this.ToFind *= 1;
      }
      else
      {
      */
        // Umlaute berücksichtigen
        this.ToFind = this.ReplaceUmlaute(this.ToFind);
        if (nextOptionText.length >= this.ToFind.length)
        {
          nextOptionText = nextOptionText.substring(0, this.ToFind.length);
        }
        nextOptionText = this.ReplaceUmlaute(nextOptionText);
      //}

      // Does the next item match exactly what the user typed?
      if (this.ToFind == nextOptionText)
      {
        if (this.ToFind.length > 2)
        {
          var x = 0;
        }
        // OK, we can stop at this option. Set focus here
        if (this.IsTableSearch == true)
        {
          WebControl.ScrollToControl(this.AllOptions[i], Graphic3DInstance.Top_Top, 0);
        }
        else
        {
          this.oControl.selectedIndex = i;
        }
        indexHasChanged = true;
        Ilp.Event.Cancel(this.oControl);
        break;
      }

      // If the string does not match exactly, find which two entries 
      // it should be between.
      if (i < this.AllOptions.length - 1)
      {
        // If we are not yet at the last listbox item, see if the 
        // search string comes between the current entry and the next 
        // one. If so, place the selection there.
        lookAheadOptionText = Ilp.HtmlDom.GetText(this.AllOptions[i + 1]).toUpperCase() ;
        if (lookAheadOptionText.length >= this.ToFind.length)
        {
          lookAheadOptionText = lookAheadOptionText.substring(0, this.ToFind.length);
        }
        lookAheadOptionText = this.ReplaceUmlaute(lookAheadOptionText);
        
        if(   (this.ToFind >= nextOptionText) 
           && (this.ToFind <= lookAheadOptionText))
        {
          if (this.ToFind.length > 1)
          {
            var x = 0;
          }
          if (this.IsTableSearch == true)
          {
            if (this.ToFind > nextOptionText && this.ToFind < lookAheadOptionText)
            {
              WebControl.ScrollToControl(this.AllOptions[i].parentElement, Graphic3DInstance.Top_Top, 0);
            }
            else
            {
              WebControl.ScrollToControl(this.AllOptions[i + 1].parentElement, Graphic3DInstance.Top_Top, 0);
            }
          }
          else
          {
            if (this.ToFind > nextOptionText && this.ToFind < lookAheadOptionText)
            {
              this.oControl.selectedIndex = i;
            }
            else
            {
              this.oControl.selectedIndex = i + 1;
            }
          }
          indexHasChanged = true;
          Ilp.Event.Cancel(this.oControl);
          break;
        }
      }
      else
      {
        // If we are at the end of the entries and the search string 
        // is still higher than the entries, select the last entry
        if (this.ToFind > nextOptionText)
        {
          // stick it at the end
          if (this.IsTableSearch == true)
          {
            WebControl.ScrollToControl(this.AllOptions[this.AllOptions.length - 1].parentElement, Graphic3DInstance.Top_Top, 0);
          }
          else
          {
            this.oControl.selectedIndex = this.AllOptions.length - 1;
          }
          indexHasChanged = true;
          Ilp.Event.Cancel(this.oControl);
          break;
        }
      }
    }
    
    if (indexHasChanged == true)
    {
      if (this.IsTableSearch == false)
      {
        if (this.oControl.getAttribute("ControlType") == "DropDownList")
        {
          var eventObj = document.createEventObject();
          eventObj.srcElement = this.oControl;
          // Set an expando property on the event object. This will be used by the 
          // event handler to determine what element was clicked on.
          eventObj.expando = this.oControl.id;
          this.oControl.fireEvent("onchange", eventObj);
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "AutoCompleteClass_Find", "Section1")
  }
} // function
function AutoCompleteClass_Idle()
{
  try
  {
    // This function is called if the timeout expires. If this is the 
    // third (by default) time that the idle function has been called, 
    // it stops the timer and clears the keyboard buffer
    this.TimeoutCtr += 1
    if (this.TimeoutCtr > this.TimeoutCtrLimit)
    {
      this.ResetToFind();
      this.TimeoutCtr = 0;
      window.clearInterval(this.TimeoutID);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "AutoCompleteClass_Idle", "Section1")
  }
}
function AutoCompleteClass_ResetToFind()
{
  try
  {
    this.ToFind = ""
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "AutoCompleteClass_ResetToFind", "Section1")
  }
}
function AutoCompleteClass_ReplaceUmlaute(stringValue)
{
  try
  {
    var umlaute = {196: "A", 228: "a", 214: "O", 246: "o", 220: "U", 252: "U"};
    var returnString = "";
    
    if (stringValue != null)
    {
      for(var i = 0; i < stringValue.length; i++) 
      { 
        var c = stringValue.charCodeAt(i); 
        if(typeof umlaute[c] != 'undefined') 
        { 
          returnString += umlaute[c]; 
        } 
        else 
        { 
          returnString += String.fromCharCode(c); 
        }
      } 
    }
    
    return returnString;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "AutoCompleteClass_ReplaceUmlaute", "Section1")
  }
}
function CookieManagerClass(ilp)
{
  try
  {
    this.Ilp = ilp;

    this.SetCookie = CookieManagerClass_SetCookie;
    this.GetCookie = CookieManagerClass_GetCookie;
    this.DeleteCookie = CookieManagerClass_DeleteCookie;
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "CookieManagerClass", "Section1")
  }
}
function CookieManagerClass_SetCookie(name, value, expires, path, domain, secure)
{
  try
  {
    var curCookie = name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
    document.cookie = curCookie;
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "AutoCompleteClass_ReplaceUmlaute", "Section1")
  }
}
function CookieManagerClass_GetCookie(name)
{
  try
  {
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
      begin = dc.indexOf(prefix);
      if (begin != 0) return null;
    } else
      begin += 2;
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
      end = dc.length;
    return unescape(dc.substring(begin + prefix.length, end));
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "CookieManagerClass_GetCookie", "Section1")
  }
}
function CookieManagerClass_DeleteCookie(name, path, domain)
{
  try
  {
    if (this.GetCookie(name))
    {
      document.cookie = name + "=" +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "CookieManagerClass_DeleteCookie", "Section1")
  }
}
function LoginManagerClass(ilp)
{
  try
  {
    this.Ilp = ilp;

    this.GetLogin = LoginManagerClass_GetLogin;
    this.SaveLogin = LoginManagerClass_SaveLogin;
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "LoginManagerClass", "Section1")
  }
}
function LoginManagerClass_GetLogin(date)
{
  try
  {
    var rememberMe = Ilp.CookieManager.GetCookie("RememberMe");
    if (rememberMe == 1)
    {
      WebControl.SetValue(document.getElementById("login_RememberCheckBox"), true);
      var username = Ilp.CookieManager.GetCookie("Username");
      if (username) WebControl.SetValue(document.getElementById("login_UserNameTextBox"), username);
      var password = Ilp.CookieManager.GetCookie("Password");
      if (password) WebControl.SetValue(document.getElementById("login_PasswordTextBox"), password);
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "LoginManagerClass_GetLogin", "Section1")
  }
}
function LoginManagerClass_SaveLogin(date)
{
  try
  {
    if (WebControl.GetValue(document.getElementById("login_RememberCheckBox")) == true)
    {
      var now = new Date();
      now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);

      Ilp.CookieManager.SetCookie("RememberMe", 1, now);
      Ilp.CookieManager.SetCookie("Username", WebControl.GetValue(document.getElementById("login_UserNameTextBox")), now);
      Ilp.CookieManager.SetCookie("Password", WebControl.GetValue(document.getElementById("login_PasswordTextBox")), now);
    }
    else
    {
      Ilp.CookieManager.DeleteCookie("RememberMe");
      Ilp.CookieManager.DeleteCookie("Username");
      Ilp.CookieManager.DeleteCookie("Password");
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "LoginManagerClass_SaveLogin", "Section1")
  }
}

function HorizontalColumnGroupClass(container, columns, primeElement)
{
  try
  {
    this.Container = container;
    this.Columns = columns;
    this.PrimeElement = primeElement;
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "HorizontalColumnGroupClass", "Section1")
  }
}


/* ============================ GTWebDataSearch.js ===========================*/
function LoadWebDataSearch()
{
  try
  { 
    WebDataSearch = new WebDataSearchClass();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "LoadWebDataSearch", "");
  }
}

function WebDataSearchClass()
{
  try
  { 
    EnsureWebForm();
    EnsureWebControl();
  
    this.Container = null;
    this.ClientID = "";
    if (typeof(WebDataSearchObjects) != "undefined" && WebDataSearchObjects != null && WebDataSearchObjects.length > 0)
    {
      this.Container = WebDataSearchObjects[0];
      this.ClientID = WebDataSearchObjects[0].id;
    }
    
    if (this.Container != null)
    {
      this.Container.SearchControlArray = new Array();
      this.Container.ExpertSearchArray = new Array();
    }
    
    window.LastSender = null;
    
    this.FieldToHtmlObject = new WebHashtable();
    this.ClassType = "WebDataSearch";
    
    this.ExistsSelection = false;
    this.BuildSearchInfo = WebDataSearch_BuildSearchInfo;
    this.PrepareFullTextSearch = WebDataSearch_PrepareFullTextSearch;
    this.FillWebControls = WebDataSearch_FillWebControls;
    this.ApplySearchInfo = WebDataSearch_ApplySearchInfo;
    this.GetValue = WebDataSearch_GetValue;
    this.SetValue = WebDataSearch_SetValue;
    this.ProcessChange = WebDataSearch_ProcessChange;
    this.ProcessPaste = WebDataSearch_ProcessPaste;
    this.ProcessClick = WebDataSearch_ProcessClick;
    this.ProcessKeyUp = WebDataSearch_ProcessKeyUp;
    this.LoadingDone = WebDataSearch_LoadingDone;
    
    this.ToggleSearch = WebDataSearch_ToggleSearch;
    this.ExpandSearch = WebDataSearch_ExpandSearch;
    this.CollapseSearch = WebDataSearch_CollapseSearch;
    
    this.IsVisible = WebDataSearch_IsVisible;
    this.Hide = WebDataSearch_Hide;
    this.Show = WebDataSearch_Show;

    this.ListBoxOnDblClick = WebDataSearch_ListBoxOnDblClick;
    this.AddItem = WebDataSearch_AddItem;
    this.RemoveItem = WebDataSearch_RemoveItem;
    this.Clear = WebDataSearch_Clear;
    this.AddBoundSearchControl = WebDataSearch_AddBoundSearchControl;
    this.GetCommaSeperatedList = WebDataSearch_GetCommaSeperatedList;
    this.OpenSearchDialog = WebDataSearch_OpenSearchDialog;
    this.OpenComboSelectionDialog = WebDataSearch_OpenComboSelectionDialog;
    this.OpenListBoxSelectionDialog = WebDataSearch_OpenListBoxSelectionDialog;
    this.OpenGridSelectionDialog = WebDataSearch_OpenGridSelectionDialog;

    this.CriteriaManage = WebDataSearch_CriteriaManage;
    
    this.SelectComboItem = WebDataSearch_SelectComboItem;
    
    this.GetSelectionRecordValue = WebDataSearch_GetSelectionRecordValue;
    
    this.ExpertSearchVisible = false;
    this.ShowExpertSearch = WebDataSearch_ShowExpertSearch;
    this.HideExpertSearch = WebDataSearch_HideExpertSearch;
    this.ToggleExpertSearch = WebDataSearch_ToggleExpertSearch;
    
    this.IsSearchChecked = WebDataSearch_IsSearchChecked;
    this.Check = WebDataSearch_Check;
    this.Uncheck = WebDataSearch_Uncheck;
    
    this.LoadInitialData = WebDataSearch_LoadInitialData;
    this.LoadSelection = WebDataSearch_LoadSelection;
    this.LoadData = WebDataSearch_LoadData;
    this.LoadDataCompleted = WebDataSearch_LoadDataCompleted
    this.AfterLoadDataCompleted = null;
    this.RefreshConstrainedSearchControls = WebDataSearch_RefreshConstrainedSearchControls;
    this.ResetSearchControlsBackColor = WebDataSearch_ResetSearchControlsBackColor;
    this.MarkConstrainer = WebDataSearch_MarkConstrainer;
    
    this.BuildConstrainedSelectionSearchInfo = WebDataSearch_BuildConstrainedSelectionSearchInfo;
   
    this.TagNames = new Array("INPUT", "SELECT", "TEXTAREA");

    if (this.Container)
    {
      this.HideOnStart = this.Container.getAttribute("HideOnStart") == "false" ? false : true;
      if (this.HideOnStart == true)
      {
        this.Hide();
      }

      this.ExpandOnStart = this.Container.getAttribute("ExpandOnStart") == "false" ? false : true;
      if (CssVersion == "GTWeb2") 
      {
        this.Container.style.height = "1px";
        this.Message = WebControl.GetDomElementByAttributeValue(this.Container, "IsMessage", "true");
        this.ToggleButton = WebControl.GetDomElementByAttributeValue(this.Container, "IsToggle", "true");
        if (this.ToggleButton)
        {
          WebControl.SetToggleState(this.ToggleButton, "1", 2);
          WebControl.SetFalseImage(this.ToggleButton);
          if (this.ExpandOnStart == false)
          {
            this.ToggleSearch(this.ToggleButton);
          }
        }
      }
      else
      {
        this.ToggleButton = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_WebSearchHeader_ToggleButton);
        this.CaptionLabel = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_WebSearchHeader_CaptionLable);
        this.Message = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_WebSearchHeader_MessageLabel);
        
        if (this.ExpandOnStart == false)
        {
           this.CollapseSearch(sender);
         }
        
      }
    }    
    
    if (this.Container != null)
    {
      this.FillWebControls();
      this.ApplySearchInfo();
    }  
    
    this.ComboSelectionValue = "";
    this.ComboSelectionText = "";
    this.ComboSelectionReturnText = "";
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearchClass", "");
  }
}

function WebDataSearch_FillWebControls()
{
  try
  { 
    var oFieldDescriptor = null;
    var oFieldDescriptorList = null;
    var oTarget = null;
    var oTargetCollection = null;
    var fieldDescriptorFqn = "";
    var htmlID = "";

    this.Container.SearchControlArray = new Array();
    this.Container.ExpertSearchArray = new Array();
    WebControl.FindSearchControls(this.Container, this.Container);
    for (var i = 0; i < this.Container.SearchControlArray.length; i++)
    {
      oTarget = this.Container.SearchControlArray[i];
      oTarget.oContainer = this.Container;
      oTarget.oWebDataSearch = this;
      oTarget.oContainerInstance = this;
      
      if (typeof(oTarget.getAttribute("SearchFqn")) == "string")
      {
        oTarget.oFieldDescriptor = FormDescriptor.GetFieldDescriptor(oTarget.getAttribute("SearchFqn"));
      }

      if (typeof(oTarget.getAttribute("Search2Fqn")) == "string")
      {
        oTarget.oFieldDescriptor2 = FormDescriptor.GetFieldDescriptor(oTarget.getAttribute("Search2Fqn"));
      }
      
      this.AddBoundSearchControl(oTarget);
      
      var infoButtonClientID = oTarget.getAttribute("InfoButtonClientID");
      if (infoButtonClientID && infoButtonClientID.length > 0)
      {
        var oImage = document.getElementById(infoButtonClientID);
        if (oImage)
        {
          WebControl.SetDisabled(oImage);
          oImage.TitleSave = oImage.title;
          oImage.title = "";
        }
      } 
    }    
    
    this.HideExpertSearch();
    
    this.Container.ClientBoundControlArray = new Array();
    WebControl.FindClientBoundControls(this.Container, this.Container);
    for (var i = 0; i < this.Container.ClientBoundControlArray.length; i++)
    {
      oTarget = this.Container.ClientBoundControlArray[i];
      oTarget.oContainer = this.Container;
      oTarget.oWebDataSearch = this;
      
      var fqn = WebControl.GetFqn(oTarget);
      if (typeof(fqn) == "string")
      {
        oTarget.oFieldDescriptor = FormDescriptor.GetFieldDescriptor(fqn);
      }

      if (typeof(oTarget.getAttribute("Search2Fqn")) == "string")
      {
        oTarget.oFieldDescriptor2 = FormDescriptor.GetFieldDescriptor(oTarget.getAttribute("Search2Fqn"));
      }

      if (oTarget.getAttribute("DefaultValueClass") == "FirstDayOfMonth")
      {
        this.SetValue(oTarget, WebControl.ConvertDateToString(WebControl.FirstDayOfMonth()))
      }
      else if (oTarget.getAttribute("DefaultValueClass") == "LastDayOfMonth")
      {
        this.SetValue(oTarget, WebControl.ConvertDateToString(WebControl.LastDayOfMonth()))
      }
      
      
      switch(oTarget.getAttribute("ControlType"))
      {
        case "DropDownList":
          if (oTarget.getAttribute("State") == "Fake")
          {
            oTarget.IsSearchControl = true;
            WebControl.MergeData(this, oTarget, null);
            oTarget = WebControl.ReplaceFakeCombo(oTarget);
            this.Container.ClientBoundControlArray[i] = oTarget;
            
            var unitType = oTarget.getAttribute("UnitType");
            if (typeof(unitType) == "string" && unitType.length > 0)
            {
              WebControl.SetComboValue(oTarget, WebMessage.GetDefaultValue(unitType), true);
            }            
            else
            {
              oTarget.selectedIndex = 0;            
            }  
          }
          break;
      }
      WebControl.SetEventHandler(oTarget);
    }
    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_FillWebControls", "Section1", this.FillWebControls)
  }
}

function WebDataSearchClear(oControl)
{
  try
  {
    WebDataSearch.Clear();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearchClear", "Section1")
  }
}

function WebDataSearch_Clear()
{
  try
  {
    for (var i = 0; i < this.Container.SearchControlArray.length; i++)
    {
      oTarget = this.Container.SearchControlArray[i];
      this.Uncheck(oTarget)
      switch(oTarget.getAttribute("ControlType"))
      {
        case "TxtSearch":
          var oTextBox = document.getElementById(oTarget.getAttribute("TextBoxClientID"));
          oTextBox.value = "";
          break;

        case "LstSearch":
          var oTextBox = document.getElementById(oTarget.getAttribute("TextBoxClientID"));
          oTextBox.value = "";
          break;

        case "ChkSearch":
          var oCheckBox = document.getElementById(oTarget.getAttribute("CheckBoxSearchClientID"));
          oCheckBox.checked = false;
          break;

        case "ComboSearch":
          break;

        case "FromToSearch":
          var oTextBoxFrom = document.getElementById(oTarget.getAttribute("TextBoxFromClientID"));
          oTextBoxFrom.value = "";
          var oTextBoxTo = document.getElementById(oTarget.getAttribute("TextBoxToClientID"));
          oTextBoxTo.value = "";
          break;

        case "SelSearch":
          var oSelect = document.getElementById(oTarget.getAttribute("ListBoxClientID"));
          var count = oSelect.options.length;
          for (var j = 0; j < count; j++)
          {
            //IE 6 oSelect.removeChild(oSelect.options(j));
            oSelect.options.remove(0);
          }
          break;

        default:
          break;
      }      
    }  
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebDataSearch_Clear", "Section1")
  }
}

function WebDataSearchApplySearchInfo(oControl)
{
  try
  {
    WebDataSearch.ApplySearchInfo();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearchApplySearchInfo", "Section1")
  }
}


function WebDataSearch_ApplySearchInfo()
{
  try
  {
    var oSearchInfoItemList = WebMessage.GetSearchInfoItemList();
    var oSearchInfoItem = null;
    for (var i = 0; i < oSearchInfoItemList.length; i++)
    {
      oSearchInfoItem = oSearchInfoItemList[i];
      var fqn = "";
      fqn = oSearchInfoItem.getAttribute("AttachedFqn");
      if (fqn == null)
      {
        fqn = oSearchInfoItem.getAttribute("FieldDescriptorFqn");
      }  
      var binder = this.FieldToHtmlObject.Get(fqn);
      if (binder != null)
      {
        for (var j = 0;  j < binder.HtmlObjects.Count(); j++)
        {
          var oTarget = binder.HtmlObjects.Get(j);
          if (oSearchInfoItem.getAttribute("IsSearchChecked") == "true")
          {
            this.Check(oTarget);
          }  
          switch(oTarget.getAttribute("ControlType"))
          {
            case "TxtSearch":
              var oTextBox = document.getElementById(oTarget.getAttribute("TextBoxClientID"));
              oTextBox.value = oSearchInfoItem.getAttribute("FieldValue");
              if (oSearchInfoItem.getAttribute("SearchOption") == "FullTextSearch")
              {
                var oFullTextOption = document.getElementById(oTarget.getAttribute("FullTextOptionClientID"));
                if (oFullTextOption) oFullTextOption.checked = true;
              }
              else if (oSearchInfoItem.getAttribute("SearchOption") == "ExactSearch")
              {
                var oExactOption = document.getElementById(oTarget.getAttribute("ExactOptionClientID"));
                if (oExactOption) oExactOption.checked = true;
              }
              break;

            case "LstSearch":
              var oTextBox = document.getElementById(oTarget.getAttribute("TextBoxClientID"));
              oTextBox.value += oSearchInfoItem.getAttribute("FieldValue") + "\n";
              break;

            case "ChkSearch":
              var oCheckBox = document.getElementById(oTarget.getAttribute("CheckBoxSearchClientID"));
              var oDataField = new Object()
              oDataField.text = oSearchInfoItem.getAttribute("FieldValue");
              oCheckBox.checked = WebControl.ConvertWebDataToControlData(oCheckBox, oTarget.oFieldDescriptor, oDataField)
              break;

            case "ComboSearch":
              var oSelect = document.getElementById(oTarget.getAttribute("DropDownListClientID"));
              WebControl.SetComboValue(oSelect, oSearchInfoItem.getAttribute("FieldValue"), false);
              
              break;

            case "FromToSearch":
              if (oSearchInfoItem.getAttribute("OperatorType") == "GreaterThenOrEqual")
              {
                var oTextBoxFrom = document.getElementById(oTarget.getAttribute("TextBoxFromClientID"));
                var oDataField = new Object()
                oDataField.text = oSearchInfoItem.getAttribute("FieldValue");
                oTextBoxFrom.value = WebControl.ConvertWebDataToControlData(oTextBoxFrom, oTarget.oFieldDescriptor, oDataField)
                
                var unitFd = FormDescriptor.GetUnitField(oTarget.oFieldDescriptor)
                if (unitFd != null)
                {
                  var oUnitComboFrom = document.getElementById(oTarget.getAttribute("UnitComboFromClientID"));
                  WebControl.SetComboValue(oUnitComboFrom, oSearchInfoItem.getAttribute("IDUnit"), true);
                }
              }
              else
              {
                var oTextBoxTo = document.getElementById(oTarget.getAttribute("TextBoxToClientID"));
                var oDataField = new Object()
                oDataField.text = oSearchInfoItem.getAttribute("FieldValue");
                oTextBoxTo.value = WebControl.ConvertWebDataToControlData(oTextBoxTo, oTarget.oFieldDescriptor, oDataField)
                
                var unitFd = FormDescriptor.GetUnitField(oTarget.oFieldDescriptor)
                if (unitFd != null)
                {
                  var oUnitComboTo = document.getElementById(oTarget.getAttribute("UnitComboToClientID"));
                  WebControl.SetComboValue(oUnitComboTo, oSearchInfoItem.getAttribute("IDUnit"), true);
                }
              }
              
              break;

            case "SelSearch":
              var oSelect = document.getElementById(oTarget.getAttribute("ListBoxClientID"));
              var oOption = document.createElement("OPTION");
              //IE6 oSelect.appendChild(oOption);
              oSelect.options.add(oOption);
              var srdFqn = oTarget.oFieldDescriptor.getAttribute("SearchRelationDescriptorFqn");
              var oSrd = FormDescriptor.GetSearchRelationDescriptor(srdFqn);

              var oDataField = new Object()
              var oFd = FormDescriptor.GetFieldDescriptor(oSrd.getAttribute("FieldDescriptorIDFqn"));
              oDataField.text = oSearchInfoItem.getAttribute("FieldValue");
              oOption.value = WebControl.ConvertWebDataToControlData(oSelect, oFd, oDataField);
              if (oOption.value == "-1") oOption.value = oDataField.text;
              var oFd = FormDescriptor.GetFieldDescriptor(oSrd.getAttribute("FieldDescriptorTextFqn"));
              oDataField.text = oSearchInfoItem.getAttribute("Text");
              oOption.text = WebControl.ConvertWebDataToControlData(oSelect, oFd, oDataField);
              if (oOption.text == "0" || oOption.text == "-1") oOption.text = oDataField.text;
              
              this.RefreshConstrainedSearchControls(oSelect);
              break;

            default:
              break;
          }      
        }
      }
    }
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebDataSearch_ApplySearchInfo", "Section1")
  }
}


function WebDataSearch_BuildSearchInfo()
{
  try
  {
    var fqn = "";
    var srdFqn = "";
    var fieldDescriptor = null;
    var searchBehavior = "";
    var search2Behavior = "";
    var oTarget = null;
    var oSearchInfo = WebMessage.GetSearchInfo();
    var oSearchInfoItem = null;
    var webDataValue = "";
    var webDataText = "";
    var valid = true;
    var webMessageDescriptor = null;
    
    this.ExistsSelection = true;
    if (this.Container != null)
    {
      if (this.Container.SearchControlArray.length > 0)
      {
        WebMessage.InitSearchInfo();
        this.ExistsSelection = (WebMessage.GetSearchInfoItemList().length > 0);
      }
      
      for (var i = 0; i < this.Container.SearchControlArray.length; i++)
      {
        oTarget = this.Container.SearchControlArray[i];
        searchBehavior = oTarget.getAttribute("SearchBehavior");
        search2Behavior = oTarget.getAttribute("Search2Behavior");
        if (search2Behavior == "None") search2Behavior = searchBehavior;
          
        switch(oTarget.getAttribute("ControlType"))
        {
          case "TxtSearch":
            if (this.IsSearchChecked(oTarget) == true)
            {
              var oTextBox = document.getElementById(oTarget.getAttribute("TextBoxClientID"));
              webMessageDescriptor = WebControl.ValidateInput(oTextBox, oTextBox.oFieldDescriptor, true);
              if(webMessageDescriptor.Valid == true)
              {
                fqn = oTarget.oFieldDescriptor.getAttribute("Fqn");
                webDataValue = WebControl.ConvertControlDataToWebData(oTextBox, oTarget.oFieldDescriptor);
                
                if (webDataValue.length > 0)
                {
                  if (String("nText$text").indexOf(oTextBox.oFieldDescriptor.getAttribute("FieldType")) > -1)
                  {
                    webDataValue = this.PrepareFullTextSearch(webDataValue);
                  }
            
                  var oSearchInfoItem = WebMessage.AddSearchInfoItem("S_" + String(oSearchInfo.childNodes.length), fqn, webDataValue, oTarget.getAttribute("OperatorType"), "false", searchBehavior);
                  
                  var oFullTextOption = document.getElementById(oTarget.getAttribute("FullTextOptionClientID"));
                  if (oFullTextOption && oFullTextOption.checked == true)
                  {
                    oSearchInfoItem.setAttribute("SearchOption", "FullTextSearch");
                  }
                  
                  this.ExistsSelection = true;
                }  

                if (oTarget.oFieldDescriptor2 != null)
                {
                  fqn = oTarget.oFieldDescriptor2.getAttribute("Fqn");
                  if (webDataValue.length > 0)
                  {
                    var oSearchInfoItem = WebMessage.AddSearchInfoItem("S_" + String(oSearchInfo.childNodes.length), fqn, webDataValue, oTarget.getAttribute("OperatorType"), "false", search2Behavior );
                    
                    var oFullTextOption = document.getElementById(oTarget.getAttribute("FullTextOptionClientID"));
                    if (oFullTextOption && oFullTextOption.checked == true)
                    {
                      oSearchInfoItem.setAttribute("SearchOption", "FullTextSearch");
                    }
                  }  
                }
              }
              else
              {
                 WebControl.WebMessageDescriptorList.Add(webMessageDescriptor);
              }
            }
            break;

          case "LstSearch":
            if (this.IsSearchChecked(oTarget) == true)
            {
              var oTextBox = document.getElementById(oTarget.getAttribute("TextBoxClientID"));
              //webMessageDescriptor = WebControl.ValidateInput(oTextBox, oTextBox.oFieldDescriptor, true);
              //if(webMessageDescriptor.Message.length == 0)
              //{
                fqn = oTarget.oFieldDescriptor.getAttribute("Fqn");
                webDataValue = WebControl.ConvertControlDataToWebData(oTextBox, oTarget.oFieldDescriptor);
                
                if (webDataValue.length > 0)
                {
                  var webDataValues = webDataValue.split("\n", 100);
                  for (var j = 0; j < webDataValues.length; j++)
                  {
                    var webDataValueTemp = String(webDataValues[j]).trim();
                    if (String("nText$text").indexOf(oTextBox.oFieldDescriptor.getAttribute("FieldType")) > -1)
                    {
                      webDataValueTemp = this.PrepareFullTextSearch(webDataValueTemp);
                    }
                    
                    var oSearchInfoItem = WebMessage.AddSearchInfoItem("S_" + String(oSearchInfo.childNodes.length), fqn, webDataValueTemp, oTarget.getAttribute("OperatorType"), "false", searchBehavior);
                    
                    var oFullTextOption = document.getElementById(oTarget.getAttribute("FullTextOptionClientID"));
                    if (oFullTextOption && oFullTextOption.checked == true)
                    {
                      oSearchInfoItem.setAttribute("SearchOption", "FullTextSearch");
                    }
                    
                  }
                  this.ExistsSelection = true;
                }  

                if (oTarget.oFieldDescriptor2 != null)
                {
                  fqn = oTarget.oFieldDescriptor2.getAttribute("Fqn");
                  if (webDataValue.length > 0)
                  {
                    var webDataValues = webDataValue.split("\n", 100);
                    for (var j = 0; j < webDataValues.length; j++)
                    {
                      var webDataValueTemp = String(webDataValues[j]).trim();
                      if (String("nText$text").indexOf(oTextBox.oFieldDescriptor.getAttribute("FieldType")) > -1)
                      {
                        webDataValueTemp = this.PrepareFullTextSearch(webDataValueTemp);
                      }
                      
                      var oSearchInfoItem = WebMessage.AddSearchInfoItem("S_" + String(oSearchInfo.childNodes.length), fqn, webDataValueTemp, oTarget.getAttribute("OperatorType"), "false", searchBehavior);
                      
                      var oFullTextOption = document.getElementById(oTarget.getAttribute("FullTextOptionClientID"));
                      if (oFullTextOption && oFullTextOption.checked == true)
                      {
                        oSearchInfoItem.setAttribute("SearchOption", "FullTextSearch");
                      }
                    }  
                  }  
                }
              //}
              //else
              //{
               //  WebControl.WebMessageDescriptorList.Add(webMessageDescriptor);
              //}
            }
            break;

          case "ChkSearch":
            if (this.IsSearchChecked(oTarget) == true)
            {
              var oCheckBox = document.getElementById(oTarget.getAttribute("CheckBoxSearchClientID"));
              webMessageDescriptor = WebControl.ValidateInput(oCheckBox, oCheckBox.oFieldDescriptor, true);
              if(webMessageDescriptor.Valid == true)
              {
                fqn = oTarget.oFieldDescriptor.getAttribute("Fqn");
                webDataValue = WebControl.ConvertControlDataToWebData(oCheckBox, oTarget.oFieldDescriptor);
                if (webDataValue == "true")
                {
                  WebMessage.AddSearchInfoItem("S_" + String(oSearchInfo.childNodes.length), fqn, "1", oTarget.getAttribute("OperatorType"), "false", searchBehavior);
                  this.ExistsSelection = true;
                }  
                else
                {
                  WebMessage.AddSearchInfoItem("S_" + String(oSearchInfo.childNodes.length), fqn, "0", oTarget.getAttribute("OperatorType"), "false", searchBehavior);
                  this.ExistsSelection = true;
                }

                if (oTarget.oFieldDescriptor2 != null)
                {
                  fqn = oTarget.oFieldDescriptor2.getAttribute("Fqn");
                  if (webDataValue == "true")
                  {
                    WebMessage.AddSearchInfoItem("S_" + String(oSearchInfo.childNodes.length), fqn, "1", oTarget.getAttribute("OperatorType"), "false", searchBehavior);
                  }  
                  else
                  {
                    WebMessage.AddSearchInfoItem("S_" + String(oSearchInfo.childNodes.length), fqn, "0", oTarget.getAttribute("OperatorType"), "false", searchBehavior);
                  }
                }
              }
              else
              {
                 WebControl.WebMessageDescriptorList.Add(webMessageDescriptor);
              }
            }
            break;

          case "ComboSearch":
            if (this.IsSearchChecked(oTarget) == true)
            {
              var fieldType = oTarget.oFieldDescriptor.getAttribute("FieldType");
              var oSelect = document.getElementById(oTarget.getAttribute("DropDownListClientID"));
              webMessageDescriptor = WebControl.ValidateInput(oSelect, oSelect.oFieldDescriptor, false);
              if(webMessageDescriptor.Valid == true)
              {
                fqn = oTarget.oFieldDescriptor.getAttribute("Fqn");
                webDataValue = WebControl.ConvertControlDataToWebData(oSelect, oTarget.oFieldDescriptor);
                if (   (String("integer").indexOf(fieldType) > -1 && WebControl.CheckID(webDataValue) > 0)
                    || (String("string$nString").indexOf(fieldType) > -1 && webDataValue && webDataValue.length > 0))
                {
                  oSearchInfoItem = WebMessage.AddSearchInfoItem("S_" + String(oSearchInfo.childNodes.length), fqn, webDataValue, oTarget.getAttribute("OperatorType"), "false", searchBehavior);

                  webDataText = WebControl.GetValue(oSelect, oSelect.selectedIndex, "text");
                  oSearchInfoItem.setAttribute("Text", webDataText);
                  this.ExistsSelection = true;
                }

                if (oTarget.oFieldDescriptor2 != null)
                {
                  fqn = oTarget.oFieldDescriptor2.getAttribute("Fqn");
                  if (   (String("integer").indexOf(fieldType) > -1 && WebControl.CheckID(webDataValue) > 0)
                      || (String("string$nString").indexOf(fieldType) > -1 && webDataValue && webDataValue.length > 0))
                  {
                    WebMessage.AddSearchInfoItem("S_" + String(oSearchInfo.childNodes.length), fqn, webDataValue, oTarget.getAttribute("OperatorType"), "false", searchBehavior);
                    
                    webDataText = WebControl.GetValue(oSelect, oSelect.selectedIndex, "text");
                    oSearchInfoItem.setAttribute("Text", webDataText);
                  }  
                }
              }
              else
              {
                 WebControl.WebMessageDescriptorList.Add(webMessageDescriptor);
              }
            }
            break;

          case "FromToSearch":
            if (this.IsSearchChecked(oTarget) == true)
            {
              var wmdComboFrom = new WebMessageDescriptor();
              var wmdComboTo = new WebMessageDescriptor();
              var controlValue = "";
              var oTextBoxFrom = document.getElementById(oTarget.getAttribute("TextBoxFromClientID"));
              var wmdFrom = WebControl.ValidateInput(oTextBoxFrom, oTextBoxFrom.oFieldDescriptor, true);
              var oTextBoxTo = document.getElementById(oTarget.getAttribute("TextBoxToClientID"));
              var wmdTo = WebControl.ValidateInput(oTextBoxTo, oTextBoxTo.oFieldDescriptor, true);
              
              var oUnitComboFrom = null;
              var oUnitComboTo = null;
              var unitFd = FormDescriptor.GetUnitField(oTarget.oFieldDescriptor)
              if (unitFd != null)
              {
                oUnitComboFrom = document.getElementById(oTarget.getAttribute("UnitComboFromClientID"));
                wmdComboFrom = WebControl.ValidateInput(oUnitComboFrom, null);
                
                oUnitComboTo = document.getElementById(oTarget.getAttribute("UnitComboToClientID"));
                wmdComboTo = WebControl.ValidateInput(oUnitComboTo, null);
              }
                          
              if(wmdFrom.Valid == true && wmdTo.Valid == true && wmdComboFrom.Valid == true && wmdComboTo.Valid == true)
              {
                var webDataValueFrom = null;
                var webDataValueTo = null;
                fqn = oTarget.oFieldDescriptor.getAttribute("Fqn");
                controlValue = WebControl.GetValue(oTextBoxFrom);
                if (controlValue.length > 0)
                {
                  webDataValueFrom = WebControl.ConvertControlDataToWebData(oTextBoxFrom, oTarget.oFieldDescriptor);
                  if (webDataValueFrom && webDataValueFrom.length > 0)
                  {
                    oSearchInfoItem = WebMessage.AddSearchInfoItem("S_" + String(oSearchInfo.childNodes.length), fqn, webDataValueFrom, oTarget.getAttribute("OperatorTypeFrom"), "false", searchBehavior);
                    var parameterField = oTarget.oFieldDescriptor.getAttribute("ParameterFieldFrom");
                    if (parameterField != null)
                    {
                      oSearchInfoItem.setAttribute("ParameterField", parameterField);
                    }
                    if (unitFd != null)
                    {
                      var idUnit = WebControl.ConvertControlDataToWebData(oUnitComboFrom, unitFd);
                      oSearchInfoItem.setAttribute("IDUnit", idUnit);
                    }                
                    this.ExistsSelection = true;
                  }
                }  

                controlValue = WebControl.GetValue(oTextBoxTo);
                if (controlValue.length > 0)
                {
                  webDataValueTo = WebControl.ConvertControlDataToWebData(oTextBoxTo, oTarget.oFieldDescriptor);
                  if (webDataValueTo && webDataValueTo.length > 0)
                  {
                    oSearchInfoItem = WebMessage.AddSearchInfoItem("S_" + String(oSearchInfo.childNodes.length), fqn, webDataValueTo, oTarget.getAttribute("OperatorTypeTo"), "false", searchBehavior);
                    var parameterField = oTarget.oFieldDescriptor.getAttribute("ParameterFieldTo");
                    if (parameterField != null)
                    {
                      oSearchInfoItem.setAttribute("ParameterField", parameterField);
                    }
                    if (unitFd != null)
                    {
                      var idUnit = WebControl.ConvertControlDataToWebData(oUnitComboTo, unitFd);
                      oSearchInfoItem.setAttribute("IDUnit", idUnit);
                    }                
                    this.ExistsSelection = true;
                  }  
                }
                
                if (oTarget.oFieldDescriptor2 != null)
                {
                  fqn = oTarget.oFieldDescriptor2.getAttribute("Fqn");
                  if (webDataValueFrom && webDataValueFrom.length > 0)
                  {
                    WebMessage.AddSearchInfoItem("S_" + String(oSearchInfo.childNodes.length), fqn, webDataValueFrom, oTarget.getAttribute("OperatorTypeFrom"), "false", searchBehavior);
                  }  
                  if (webDataValueTo && webDataValueTo.length > 0)
                  {
                    WebMessage.AddSearchInfoItem("S_" + String(oSearchInfo.childNodes.length), fqn, webDataValueTo, oTarget.getAttribute("OperatorTypeTo"), "false", searchBehavior);
                  }  
                }
              }
              else
              {
                 if (wmdFrom.Valid == false) WebControl.WebMessageDescriptorList.Add(wmdFrom);
                 if (wmdTo.Valid == false) WebControl.WebMessageDescriptorList.Add(wmdTo);
                 if (wmdComboFrom.Valid == false) WebControl.WebMessageDescriptorList.Add(wmdComboFrom);
                 if (wmdComboTo.Valid == false) WebControl.WebMessageDescriptorList.Add(wmdComboTo);
              }
            }
            break;

          case "SelSearch":
            if (this.IsSearchChecked(oTarget) == true)
            {
              var operatorType = oTarget.getAttribute("OperatorType");
              var oSelect = document.getElementById(oTarget.getAttribute("ListBoxClientID"));
              srdFqn = oTarget.oFieldDescriptor.getAttribute("SearchRelationDescriptorFqn");
              var fieldDescriptor = FormDescriptor.GetSearchedFieldDescriptor(srdFqn);
              fqn = fieldDescriptor.getAttribute("Fqn");
              for (var j = 0; j < oSelect.options.length; j++)
              {
                webDataValue = WebControl.ConvertControlDataToWebData(oSelect, oSelect.oFieldDescriptor, j)
                var oSearchInfoItem = WebMessage.AddSearchInfoItem("S_" + String(oSearchInfo.childNodes.length), fqn, webDataValue, operatorType, "false", searchBehavior);

                webDataText = WebControl.GetValue(oSelect, j, "text");
                oSearchInfoItem.setAttribute("Text", webDataText);
                
                this.ExistsSelection = true;
              }

              if (oTarget.oFieldDescriptor2 != null)
              {
                fqn = oTarget.oFieldDescriptor2.getAttribute("Fqn");
                for (var j = 0; j < oSelect.options.length; j++)
                {
                  webDataValue = WebControl.ConvertControlDataToWebData(oSelect, oSelect.oFieldDescriptor, j)
                  var oSearchInfoItem = WebMessage.AddSearchInfoItem("S_" + String(oSearchInfo.childNodes.length), fqn, webDataValue, operatorType, "false", searchBehavior);

                  webDataText = WebControl.GetValue(oSelect, j, "text");
                  oSearchInfoItem.setAttribute("Text", webDataText);
                }
              }
              
            }  
            break;

          default:
            break;
        }      
      }
      
      this.ExistsSelection = (WebMessage.GetSearchInfoItemList().length > 0);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_BuildSearchInfo", "Section1")
  }
}

function WebDataSearch_PrepareFullTextSearch(webDataValue)
{
  try
  {
    var webDataValueReturn = webDataValue;
    
    if (webDataValueReturn.substring(0,1) != "%" 
      && webDataValueReturn.substring(0,1) != "*")
    {
      webDataValueReturn = "%" + webDataValueReturn;
    }
    if (webDataValueReturn.substring(webDataValueReturn.length-1, webDataValueReturn.length) != "%"
      && webDataValueReturn.substring(webDataValueReturn.length-1, webDataValueReturn.length) != "*")
    {
      webDataValueReturn = webDataValueReturn + "%";
    }
    
    return webDataValueReturn;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_BuildSearchInfo", "Section1")
  }
}

function WebDataSearch_GetValue(oControl)
{
  try
  {
    var controlValue = "";
    switch(oControl.getAttribute("ControlType"))
    {
      case "TextBoxExtended":
        var oTextBox = document.getElementById(oControl.getAttribute("TextBoxID"));
        if (oTextBox != null)
        {
          controlValue = oTextBox.value;
        }
        break;

      default:
        controlValue = oControl.value;
        break;
    }
    
    return controlValue;
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebDataSearch_GetValue", "");
  }
}

function WebDataSearch_SetValue(oControl, controlValue)
{
  try
  {
    switch(oControl.getAttribute("ControlType"))
    {
      case "TextBoxExtended":
        var oTextBox = document.getElementById(oControl.getAttribute("TextBoxID"));
        if (oTextBox != null)
        {
          oTextBox.value = controlValue;
        }
        break;

      default:
        oControl.value = controlValue;
        break;
    }
    
    return controlValue;
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebDataSearch_SetValue", "");
  }
}

function WebDataSearch_ProcessPaste(sender)
{
  try
  {
    var textValue = new String(window.clipboardData.getData("Text")).trim();
    window.clipboardData.setData("Text", textValue);
  
    var oCheckBox = document.getElementById(sender.getAttribute("CheckBoxClientID"));
    if (oCheckBox != null)
    {
      oCheckBox.checked = true;
    }

    switch(sender.getAttribute("ControlType"))
    {
      default:
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_ProcessPaste", "Section1")
  }
}

function WebDataSearch_ProcessChange(sender)
{
  try
  {
    WebControl.CheckGalaxy(sender);
    if (sender.oGalaxy == null)
    {
      switch(sender.getAttribute("ControlType"))
      {
        case "DropDownList":
          if(window.event.keyCode == 13)
          {
            WebDataLoadSelection();
          }
          break;
      }    
    }
    else
    {
      switch(sender.oGalaxy.getAttribute("ControlType"))
      {
        case "ComboSearch":
          if (sender.oGalaxy && sender.oGalaxy.oSun)
          {
            var controlValue = WebControl.GetValue(sender.oGalaxy.oSun);
            var oCheckBox = document.getElementById(sender.oGalaxy.getAttribute("CheckBoxClientID"));
            if (oCheckBox != null)
            {
              var fieldType = sender.oGalaxy.oFieldDescriptor.getAttribute("FieldType");
              if (String("integer").indexOf(fieldType) > -1)
              {
                if (WebControl.CheckID(controlValue) > 0) oCheckBox.checked = true;
                else oCheckBox.checked = false;
              }
              else if (String("string$nString").indexOf(fieldType) > -1)
              {
                if (controlValue && controlValue.length > 0) oCheckBox.checked = true;
                else oCheckBox.checked = false;
              }
            }
            if(window.event.keyCode == 13 && controlValue.length > 0)
            {
              WebDataLoadSelection();
            }
          }  
          break;
      }
    }    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_ProcessChange", "Section1")
  }
}

function WebDataSearch_ProcessClick(sender, src)
{
  try
  {
    switch(src.getAttribute("ControlType"))
    {
      case "Image":
        switch(src.getAttribute("ButtonType"))
        {
          case "ToggleSearch":
            if (src.disabled == true) alert(ids_NoActionPossible);
            else this.ToggleSearch(src);
            Ilp.Event.Cancel(sender);
            break;
          case "SelSearchInfoButton":
            if (src.disabled == true) alert(ids_NoActionPossible);
            else this.MarkConstrainer(src);
            Ilp.Event.Cancel(sender);
            break;
          case "TrayIn":
            if (src.disabled == true) alert(ids_NoActionPossible);
            else this.AddItem(src);
            Ilp.Event.Cancel(sender);
            break;
          case "TrayOut":
            if (src.disabled == true) alert(ids_NoActionPossible);
            else this.RemoveItem(src);
            Ilp.Event.Cancel(sender);
            break;
          case "CriteriaLoadButton":
            if (src.disabled == true) alert(ids_NoActionPossible);
            else this.CriteriaManage(src, Verb_Select);
            Ilp.Event.Cancel(sender);
            break;
          case "CriteriaSaveButton":
            if (src.disabled == true) alert(ids_NoActionPossible);
            else this.CriteriaManage(src, Verb_Save);
            Ilp.Event.Cancel(sender);
            break;
        }    
        break;
      default:
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_ProcessClick", "Section1")
  }
}

function WebDataSearch_ToggleSearch(sender)
{
  try
  { 
    if (sender == null) return;
    
    var expanded = WebControl.IsExpanded(sender);
    if (expanded == false)
    {
      this.ExpandSearch(sender);
    }
    else
    {
      this.CollapseSearch(sender);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_ToggleSearch", "Section1")
  }
}

function WebDataSearch_ExpandSearch(sender)
{
  try
  {
    if (this.Message) 
    {
      /*
      this.Message.runtimeStyle.display = "block";
      */
      Ilp.HtmlDom.SetStyle(this.Message, "display", "block");
    }
    WebControl.ToggleRows(sender, 2, "1");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_ExpandSearch", "Section1")
  }
}

function WebDataSearch_CollapseSearch(sender)
{
  try
  { 
    if (this.Message) 
    {
      /*
      this.Message.runtimeStyle.display = "none";
      */
      Ilp.HtmlDom.SetStyle(this.Message, "display", "none");
    }
    WebControl.ToggleRows(sender, 2, "0");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_CollapseSearch", "Section1")
  }
}

function WebDataSearch_ProcessKeyUp(sender)
{
  try
  {
    WebControl.CheckGalaxy(sender);
    if (sender.oGalaxy == null)
    {
      switch(sender.getAttribute("ControlType"))
      {
        case "RadioButton":
        case "CheckBox":
          if(window.event && window.event.keyCode == 13) WebDataLoadSelection();
          break;
      }    
    }
    else
    {
      switch(sender.oGalaxy.getAttribute("ControlType"))
      {
        case "ComboSearch":
          if(window.event && window.event.keyCode == 13) WebDataLoadSelection();
          break;
        case "RadioButton":
          if(window.event && window.event.keyCode == 13) WebDataLoadSelection();
          break;
        case "TxtSearch":
          if (sender.oGalaxy && sender.oGalaxy.oSun)
          {
            var controlValue = WebControl.GetValue(sender.oGalaxy.oSun);
            var oCheckBox = document.getElementById(sender.oGalaxy.getAttribute("CheckBoxClientID"));
            if (oCheckBox != null)
            {
              if (WebControl.CheckString(controlValue) > 0) oCheckBox.checked = true;
              else oCheckBox.checked = false;
            }
            if(window.event && window.event.keyCode == 13 && controlValue.length > 0)
            {
              WebDataLoadSelection();
            }
          }  
          break;
        case "LstSearch":
          if (sender.oGalaxy && sender.oGalaxy.oSun)
          {
            var controlValue = WebControl.GetValue(sender.oGalaxy.oSun);
            var oCheckBox = document.getElementById(sender.oGalaxy.getAttribute("CheckBoxClientID"));
            if (oCheckBox != null)
            {
              if (WebControl.CheckString(controlValue) > 0) oCheckBox.checked = true;
              else oCheckBox.checked = false;
            }
          }  
          break;
        case "FromToSearch":
          if (sender.oGalaxy && sender.oGalaxy.oSun && sender.oGalaxy.oSun2)
          {
            var controlValue1 = WebControl.GetValue(sender.oGalaxy.oSun);
            var controlValue2 = WebControl.GetValue(sender.oGalaxy.oSun2);
            var hasInput = WebControl.CheckString(controlValue1) > 0 || WebControl.CheckString(controlValue2) > 0;
            
            var oCheckBox = document.getElementById(sender.oGalaxy.getAttribute("CheckBoxClientID"));
            if (oCheckBox != null)
            {
              if (hasInput == true) oCheckBox.checked = true;
              else oCheckBox.checked = false;
            }
            if(window.event && window.event.keyCode == 13 && hasInput == true)
            {
              WebDataLoadSelection();
            }
          }  
          break;
      }   
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_ProcessKeyUp", "Section1")
  }
}

function WebDataSearch_AddBoundSearchControl(oTarget)  
{
  try 
  {
    if (oTarget.oFieldDescriptor != null)
    {
      var fqn = oTarget.oFieldDescriptor.getAttribute("Fqn");
      var binder = this.FieldToHtmlObject.Get(fqn);
      if (binder == null)
      {
        binder = new Object();
        binder.HtmlObjects = new WebArray()
        this.FieldToHtmlObject.Add(fqn, binder);
      }
      if (binder.HtmlObjects.Contains(oTarget) == false)
      {
        binder.HtmlObjects.Add(oTarget);
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_AddBoundSearchControl", "Section1")
  }
}



function WebDataSearch_AddItem(sender)
{
  try
  {
    var xmlData = "";
    var bContinue = true;
    var retValue = "";
    
    var oSelect = document.getElementById(sender.getAttribute("ListBoxClientID"));
    var oCheckBox = document.getElementById(sender.getAttribute("CheckBoxClientID"));

    xmlData += "<Root>";
    for (var i=0; i<oSelect.options.length; i++)
    {
      // 4096 ist Maximum
      if (xmlData.length<4000)
      {
        xmlData += "<Record ";
        xmlData += " OV=\"" + oSelect.options(i).value + "\"";
        xmlData += "></Record>";
      }  
    }  
    xmlData += "</Root>";

    var oContainer = document.getElementById(sender.getAttribute("ContainerClientID"));
    
    var srdFqn = oContainer.getAttribute("SearchRelationDescriptorFqn");
    var srd = FormDescriptor.GetSearchRelationDescriptor(srdFqn);
    var constrainerFqn = srd.getAttribute("ConstrainerFqn");
    var tableDescriptorFqnSearch = srd.getAttribute("TableDescriptorFqnSearch");
    var td = FormDescriptor.GetTableDescriptor(tableDescriptorFqnSearch);
    
    this.BuildSearchInfo();
    WebMessage.AddSelSearchInfo("SL1", WebControl.GetSearchFqn(oContainer), srdFqn);
    WebMessage.SaveWebMessageTransfer();
    
    var IDWebMessageTransfer = WebMessage.GetGeneralInfoAttribute("IDWebMessageTransfer");
    var IDSessionInfo = WebMessage.GetGeneralInfoAttribute("IDSessionInfo");
    
    retValue = this.OpenSearchDialog(xmlData, IDWebMessageTransfer, IDSessionInfo);
    
    if (retValue && retValue != "")
    {    
      this.oBackwardXMLDoc = Ilp.XmlDom.CreateXmlDom();
      this.oBackwardXMLDoc.async = false;
      this.oBackwardXMLDoc.validateOnParse = true;
      this.oBackwardXMLDoc.loadXML(retValue);

      var xPath = "//Record";
      var oRecordList = this.oBackwardXMLDoc.selectNodes(xPath);
      for (var i = 0; i < oRecordList.length; i++)
      {
        oRecord = oRecordList[i];

        oOption = document.createElement("OPTION");
        //IE6 oSelect.appendChild(oOption);
        oSelect.options.add(oOption);
        oOption.value = unescape(oRecord.getAttribute("OptionValue"));
        oOption.text = unescape(oRecord.getAttribute("OptionText"));
        oOption.setAttribute("ReturnText", unescape(oRecord.getAttribute("ReturnText")));
      }
      
      oCheckBox.checked = true;
      this.RefreshConstrainedSearchControls(sender);
    }    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_AddItem", "Section1")
  }
}

function WebDataSearch_OpenSearchDialog(xmlFound, IDWebMessageTransfer, IDSessionInfo)
{
  try
  {
    var dialogFeatures = WebControl.GetDialogFeatures();
    var windowFeatures = WebControl.GetWindowFeatures();
  
    var url = WebControl.GetStandardUrl("GlobalScripts/GTCommon/SelSearch.aspx", Verb_Show, CallingMode_SelSearch);
    url += "&WM=" + String(IDWebMessageTransfer);
    url += "&IDSessionInfo=" + String(IDSessionInfo);
  
    var result = "";
    if (1==1)
    {
      window.XmlFound = xmlFound;
      result = WebControl.ShowModalDialog(url, dialogFeatures);
    }
    else
    {
      var oWindow = WebControl.OpenWindow("SelSearch", url, "SelSearch", windowFeatures, true);
    }
    
    return result;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_OpenSearchDialog", "Section1")
  }
}


function WebDataSearch_OpenComboSelectionDialog(IDWebMessageTransfer, IDSessionInfo)
{
  try
  {
    var dialogFeatures = WebControl.GetDialogFeatures(520, 150);
    var windowFeatures = WebControl.GetWindowFeatures(520, 150);
  
    var url = WebControl.GetStandardUrl("GlobalScripts/GTCommon/ComboSelection.aspx", Verb_Show, CallingMode_ComboSelection);
    url += "&WM=" + String(IDWebMessageTransfer);
    url += "&IDSessionInfo=" + String(IDSessionInfo);
  
    var result = "";
    if (1==1)
    {
      result = WebControl.ShowModalDialog(url, dialogFeatures);
    }
    else
    {
      var oWindow = WebControl.OpenWindow("ComboSelection", url, "ComboSelection", windowFeatures, true);
    }
    
    return result;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_OpenComboSelectionDialog", "Section1")
  }
}


function WebDataSearch_OpenListBoxSelectionDialog(IDWebMessageTransfer, IDSessionInfo)
{
  try
  {
    var dialogFeatures = WebControl.GetDialogFeatures();
    var windowFeatures = WebControl.GetWindowFeatures();
  
    var url = WebControl.GetStandardUrl("GlobalScripts/GTCommon/ListBoxSelection.aspx", Verb_Show, CallingMode_ListBoxSelection);
    url += "&WM=" + String(IDWebMessageTransfer);
    url += "&IDSessionInfo=" + String(IDSessionInfo);
  
    var result = "";
    if (1==1)
    {
      result = WebControl.ShowModalDialog(url, dialogFeatures);
    }
    else
    {
      var oWindow = WebControl.OpenWindow("ListBoxSelection", url, "ListBoxSelection", windowFeatures, true);
    }
    
    return result;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_OpenListBoxSelectionDialog", "Section1")
  }
}

function WebDataSearch_OpenGridSelectionDialog(IDWebMessageTransfer, IDSessionInfo)
{
  try
  {
    var dialogFeatures = WebControl.GetDialogFeatures(740, 450);
    var windowFeatures = WebControl.GetWindowFeatures();

    var url = WebControl.GetStandardUrl("GlobalScripts/GTCommon/GridSelection.aspx", Verb_Show, CallingMode_GridSelection);
    url += "&WM=" + String(IDWebMessageTransfer);
    url += "&IDSessionInfo=" + String(IDSessionInfo);
    
    var result = "";
    if (1==1)
    {
      result = WebControl.ShowModalDialog(url, dialogFeatures);
    }
    else
    {
      var oWindow = WebControl.OpenWindow("GridSelection", url, "GridSelection", windowFeatures, true);
    }
   
    return result;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_OpenGridSelectionDialog", "Section1")
  }
}

function WebDataSearch_RemoveItem(sender)
{
  try
  {
    var oSelect = null;
    var oCheckBox = null;
    var nCount = 0;
    
    if (sender.tagName == "SELECT")
    {
      oSelect = sender;
      oCheckBox = document.getElementById(sender.getAttribute("CheckBoxClientID"));
    }
    else if (sender.tagName == "IMG")
    {
      oSelect = document.getElementById(sender.getAttribute("ListBoxClientID"));
      oCheckBox = document.getElementById(sender.getAttribute("CheckBoxClientID"));
    }
    
    if (oSelect != null)
    {
      for (var i = oSelect.options.length-1; i >= 0; i--)
      {
        if (oSelect.options(i).selected==true)
        {
          nCount++;
          //IE 6 oSelect.removeChild(oSelect.options(i));
          oSelect.options.remove(i);
        }
      }
      if (nCount==0)
      {
        alert(ids_RemoveSearchItemWarning);
      }     
      if (oSelect.options.length == 0)
      {
        oCheckBox.checked = false;
      }
      this.RefreshConstrainedSearchControls(sender);   
    }  
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_RemoveItem", "Section1")
  }
}

function WebDataSearch_ListBoxOnDblClick(sender) 
{
  try
  {
    this.RemoveItem(sender);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_ListBoxOnDblClick", "Section1")
  } 
}

function WebDataSearch_LoadSelection(sender, silent, classType) 
{
  try
  {
    silent = silent == null ? false : silent;
    classType = classType == null ? "WebDataGrid" : classType;
  
    WebControl.AddDisabledControl(sender);  
    WebControl.HideValidationSummary();
  
    this.BuildSearchInfo();
    
    if (WebControl.WebMessageDescriptorList.Count() > 0)
    {
      WebControl.ShowValidationSummary();
      WebControl.EnableControls();
    }
    else
    {   
      if (this.ExistsSelection == false)
      {
        if (silent == false)
        {
          alert(ids_SelectRecordFirst);
        }
        WebControl.EnableControls();
      }
      else
      {
        WebData.ClearSelection();
    
        var args = new EventArgs();

        if (this.Container != null)
        {
          var BeforeLoadSelectionHandler = this.Container.getAttribute("BeforeLoadSelectionHandler")
          if (typeof(BeforeLoadSelectionHandler) == "string")
          {
            eval(BeforeLoadSelectionHandler + "(sender, args);");
          }
        }
        
        if (args.Cancel == false)
        {
          this.LoadData(null, null, classType);
        }
      }  
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_LoadSelection", "Section1")
  } 
}

function WebDataSearch_LoadInitialData(doShowSelection) 
{
  try
  {
    doShowSelection = doShowSelection == null ? true : doShowSelection;
    
    WebStatusBar.SetStatusbarMessage(ids_ShowingData, 0);

    WebControl.InitGlobalList();
    WebControl.InitKpiLogging();
    WebControl.AddKpiLogMessage(new Date(), "WebDataSearch_LoadInitialData", "");
    WebData.SetInitialBindingHash();
    
    var qd = WebForm.CreateQueue();

    window.WebStatusBar.SetDataInitMessage("", 1);
    window.WebStatusBar.SetDataInitMessage("", 2);
    
    if (typeof(window.WebDataSheetArray) == "object")
    { 
      for (var i = 0; i < window.WebDataSheetArray.length; i++)
      {
        WebControl.AddKpiLogMessage(new Date(), "WebDataSearch_LoadInitialData.2", "WebDataSheet[" + String(i) + "]");
        qd.AddQueueItem("window.WebDataSheetArray[" + String(i) + "].FillWebControlsT();");
      }
    }
             
    if (typeof(window.WebDataGridArray) == "object")
    { 
      for (var i = 0; i < window.WebDataGridArray.length; i++)
      {
        window.WebDataGridArray[i].Hide();
        WebControl.AddKpiLogMessage(new Date(), "WebDataSearch_LoadInitialData.2", "WebDataGrid[" + String(i) + "]");
        
        qd.AddQueueItem("window.WebDataGridArray[" + String(i) + "].FillWebControlsT();");
        qd.AddQueueItem("window.WebDataGridArray[" + String(i) + "].ShowTotal();");
        qd.AddQueueItem("window.WebDataGridArray[" + String(i) + "].SetFocus();");
      }
    }

    if (typeof(window.WebTreeViewArray) == "object")
    {
      for (var i = 0; i < window.WebTreeViewArray.length; i++)
      {
        WebControl.AddKpiLogMessage(new Date(), "WebDataSearch_LoadInitialData.2", "WebTreeView[" + String(i) + "]");

        qd.AddQueueItem("window.WebTreeViewArray[" + String(i) + "].FillWebControls();");
        qd.AddQueueItem("window.WebTreeViewArray[" + String(i) + "].AppendBottom();");
      }
    }

    qd.AddQueueItem("WebStatusBar.SetStatusbarMessage(ids_Ready, 0);");
    if (doShowSelection == true)
    {
      var oWebDataGrid = WebControl.GetWebDataGridMain(true);
      if (oWebDataGrid)
      {
        var oRecordList = WebData.Select(oWebDataGrid.TableDescriptorFqn);
        if (oRecordList.length > 0)
        {
          qd.AddQueueItem("WebControl.ShowSelection()");
        }
      }
    }
    qd.AddQueueItem("WebDataSearch.LoadingDone();");
    qd.ExecuteQueue();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_LoadInitialData", "Section1")
  } 
}

function WebDataSearch_LoadingDone() 
{
  try
  {
    var args = new EventArgs();

    var wopHostWindow = Ilp.HtmlDom.GetWopHostWindow();
    if (wopHostWindow && wopHostWindow.WopHost.AutoResizeContentWindow == true)
    {
      wopHostWindow.WopHost.ResizeContentFrame();
    }

    if (typeof(this.AfterLoadInitialData) == "function") this.AfterLoadInitialData(this, args);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_LoadingDone", "Section1")
  } 
}

function WebDataSearch_LoadData(oWebDataGrid, oWebSpreadSheet, classType) 
{
  try
  {
    classType = classType == null ? "WebDataGrid" : classType;
    
    var oWebDataView = null;
    
    if (classType == "WebSpreadSheetClass")
    {
      if (oWebSpreadSheet == null)
      {
        oWebDataView = WebControl.GetWebSpreadSheetMain();
      }
    }
    else
    {
      if (oWebDataGrid == null)
      {
        oWebDataView = WebControl.GetWebDataGridMain();
      }
    }  
  
    if (oWebDataView != null)
    {
      WebMessage.InitTableDescriptorFqnList();
      WebMessage.AddTableDescriptorFqn(oWebDataView.TableDescriptorFqn);
      var mandatoryTableList = FormDescriptor.GetMandatoryTables();
      for (var i = 0; i < mandatoryTableList.length; i++)
      {
        tableDescriptor = mandatoryTableList[i];
        WebMessage.AddTableDescriptorFqn(tableDescriptor.getAttribute("Fqn"));
      }   
      
 
      var args = new EventArgs();
      var sender = oWebDataView;
      
      if (this.Container)
      {
        var BeforeLoadDataHandler = this.Container.getAttribute("BeforeLoadDataHandler");
        if (typeof(BeforeLoadDataHandler) == "string")
        {
          eval(BeforeLoadDataHandler + "(sender, args);");
        }
      }

      
      if (args.Cancel == false)
      { 
        if (classType == "WebSpreadSheetClass")
        {
          WebStatusBar.SetStatusbarMessage(ids_LoadingData, 0);

          WebStatusBar.SetDataInitMessage("", 1);
          WebStatusBar.SetDataInitMessage("", 2);

          var qd = WebForm.CreateQueue();

          WebMessage.SetWebSpreadSheetInfo(oWebDataView);
          
          window.WebData.GetDataT(classType);
          var oResult = WebMessage.oMessageResponseDoc.selectSingleNode("//ilp:WebMessage/ilp:Result");
          window.WebSpreadSheetCollection[oWebDataView.ClientID].SetInnerHtml(unescape(oResult.text));
          window.WebStatusBar.SetStatusbarMessage(ids_Ready, 0);
          WebControl.EnableControls();
        }
        else
        {
          WebStatusBar.SetStatusbarMessage(ids_LoadingData, 0);
          
          WebStatusBar.SetDataInitMessage("", 1);
          WebStatusBar.SetDataInitMessage("", 2);
          WebDataGridCollection[oWebDataView.ClientID].Hide();
          
          var qd = WebForm.CreateQueue();
          
          qd.AddQueueItem("window.WebData.GetDataT();");
          qd.AddQueueItem("window.WebDataGridCollection[\"" + oWebDataView.ClientID + "\"].FillWebControlsT();");
          qd.AddQueueItem("window.WebDataGridCollection[\"" + oWebDataView.ClientID + "\"].ShowTotal();");
          qd.AddQueueItem("window.WebStatusBar.SetStatusbarMessage(ids_Ready, 0);");
          qd.AddQueueItem("window.WebControl.ShowSelection();");
          qd.AddQueueItem("window.WebDataSearch.LoadDataCompleted();");

          qd.ExecuteQueue();
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_LoadData", "Section1")
  } 
}

function WebDataSearch_LoadDataCompleted()
{
  try
  {
    var args = new EventArgs();
    if (typeof(this.AfterLoadDataCompleted) == "function") this.AfterLoadDataCompleted(this, args);
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebDataSearch_LoadDataCompleted", "Section1")
  } 
}

function WebDataSearch_Uncheck(oTarget) 
{
  try
  {
    var oCheckBox = null;
    oCheckBox = document.getElementById(oTarget.getAttribute("CheckBoxClientID"));
    if (oCheckBox != null)
    {
      oCheckBox.checked = false;
    }
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebDataSearch_Uncheck", "Section1")
  } 
}

function WebDataSearch_Check(oTarget) 
{
  try
  {
    var oCheckBox = null;
    oCheckBox = document.getElementById(oTarget.getAttribute("CheckBoxClientID"));
    if (oCheckBox != null)
    {
      oCheckBox.checked = true;
    }
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebDataSearch_Check", "Section1")
  } 
}

function WebDataSearch_IsSearchChecked(oTarget) 
{
  try
  {
    var oCheckBox = null;
    var isSearchChecked = false;
    switch(oTarget.getAttribute("ControlType"))
    {
      case "ComboSearch":
        oCheckBox = document.getElementById(oTarget.getAttribute("CheckBoxClientID"));
        if (oCheckBox != null)
        {
          isSearchChecked = oCheckBox.checked;
        }
        else
        {
          isSearchChecked = true;
        }
        break;
      case "SelSearch":
        oCheckBox = document.getElementById(oTarget.getAttribute("CheckBoxClientID"));
        if (oCheckBox != null)
        {
          isSearchChecked = oCheckBox.checked;
        }
        else
        {
          isSearchChecked = true;
        }
        break;
      case "TxtSearch":
        oCheckBox = document.getElementById(oTarget.getAttribute("CheckBoxClientID"));
        if (oCheckBox != null)
        {
          isSearchChecked = oCheckBox.checked;
        }
        else
        {
          isSearchChecked = true;
        }
        break;
      case "LstSearch":
        oCheckBox = document.getElementById(oTarget.getAttribute("CheckBoxClientID"));
        if (oCheckBox != null)
        {
          isSearchChecked = oCheckBox.checked;
        }
        else
        {
          isSearchChecked = true;
        }
        break;
      case "ChkSearch":
        oCheckBox = document.getElementById(oTarget.getAttribute("CheckBoxClientID"));
        if (oCheckBox != null)
        {
          isSearchChecked = oCheckBox.checked;
        }
        else
        {
          isSearchChecked = true;
        }
        break;
      case "FromToSearch":
        oCheckBox = document.getElementById(oTarget.getAttribute("CheckBoxClientID"));
        if (oCheckBox != null)
        {
          isSearchChecked = oCheckBox.checked;
        }
        else
        {
          isSearchChecked = true;
        }
        break;
      default:
        break;
    }    
    
    return isSearchChecked;
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebDataSearch_IsSearchChecked", "Section1")
  } 
}

function EnsureWebDataSearch()
{
  try
  { 
    if (typeof(window.WebDataSearch) == "undefined") 
    {
      LoadWebDataSearch();
    }
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "EnsureWebDataSearch", "")
  }
}

function WebDataSearch_GetCommaSeperatedList(oSrcElement){
  try
  {

    var retValue = "";
    var commaList = "";
    
    WebData.RefreshServerSearchCache(WebControl.GetSearchFqn(oSrcElement), oSrcElement.getAttribute("SearchRelationDescriptorFqn"));

    var IDWebMessageTransfer = WebMessage.GetGeneralInfoAttribute("IDWebMessageTransfer");
    var IDSessionInfo = WebMessage.GetGeneralInfoAttribute("IDSessionInfo");
    
    var xmlData = "<Root></Root>";
    retValue = this.OpenSearchDialog(xmlData, IDWebMessageTransfer, IDSessionInfo);
    
    if (retValue && retValue.length > 0)
    {
      this.oBackwardXMLDoc = Ilp.XmlDom.CreateXmlDom();
      this.oBackwardXMLDoc.async = false;
      this.oBackwardXMLDoc.validateOnParse = true;
      this.oBackwardXMLDoc.loadXML(retValue);

      var xPath = "//Record";
      var oRecordList = this.oBackwardXMLDoc.selectNodes(xPath);
      for (var i = 0; i < oRecordList.length; i++)
      {
        oRecord = oRecordList[i];
        commaList += oRecord.getAttribute("ReturnText") + "; ";
      }
      if (i > 0)
      {
        commaList = commaList.substring(0, commaList.length - 2);
      }
    }
    
    return commaList;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_GetCommaSeperatedList", "Section1");
  }
}

function WebDataSearch_HideExpertSearch()
{
  try
  {
    for (var i = 0; i < this.Container.ExpertSearchArray.length; i++)
    {
      oTarget = this.Container.ExpertSearchArray[i];
      /*
      oTarget.runtimeStyle.display = "none";
      */
      Ilp.HtmlDom.SetStyle(oTarget, "display", "none");
    }    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_HideExpertSearch", "Section1");
  }
}

function WebDataSearch_ShowExpertSearch()
{
  try
  {
    for (var i = 0; i < this.Container.ExpertSearchArray.length; i++)
    {
      oTarget = this.Container.ExpertSearchArray[i];
      /*
      oTarget.runtimeStyle.display = "block";
      */
      Ilp.HtmlDom.SetStyle(oTarget, "display", "block");
    }    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_ShowExpertSearch", "Section1");
  }
}

function WebDataSearch_ToggleExpertSearch(sender)
{
  try
  {
    if (this.ExpertSearchVisible == true)
    {
      this.ExpertSearchVisible = false;
      this.HideExpertSearch();
      WebControl.ToggleText(sender);
    }
    else
    {
      this.ExpertSearchVisible = true;
      this.ShowExpertSearch();
      WebControl.ToggleText(sender);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_ToggleExpertSearch", "Section1");
  }
}

function WebDataSearch_IsVisible(sender)
{
  try
  {
    return (this.Container.style.display == "block" || this.Container.style.display == "");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_IsVisible", "Section1");
  }
}

function WebDataSearch_Hide(sender)
{
  try
  {
    this.Container.style.display = "none";
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_Hide", "Section1");
  }
}

function WebDataSearch_Show(sender)
{
  try
  {
    var expanded = false;
    if (CssVersion == "GTWeb2") 
    {
      expanded = WebControl.IsExpanded(this.ToggleButton);
      if (expanded == false) this.ExpandSearch(this.ToggleButton);
    }
    else
    {
      expanded = WebControl.IsExpanded(this.ToggleButton);
      if (expanded == false) this.ExpandSearch(this.ToggleButton);
    }
    this.Container.style.display = "block";
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_Show", "Section1");
  }
}



function WebDataSearch_SelectComboItem(selectionDescriptorFqn)
{
  try
  {    
    var retValue = false;
    WebMessage.SetGeneralInfoAttribute("TransferFqn", selectionDescriptorFqn);
    WebMessage.SaveWebMessageTransfer();
    
    var IDWebMessageTransfer = WebMessage.GetGeneralInfoAttribute("IDWebMessageTransfer");
    var IDSessionInfo = WebMessage.GetGeneralInfoAttribute("IDSessionInfo");
    
    this.ComboSelectionValue = "";
    this.ComboSelectionText = "";
    this.ComboSelectionReturn = "";
    this.SelectionRecord = null;
    
    var oSelectionDescriptor = FormDescriptor.GetSelectionDescriptor(selectionDescriptorFqn);
    
    var xml = null;
    
    if (oSelectionDescriptor.getAttribute("SelectionDialogMode") == "ListBox")
    {     
      xml = this.OpenListBoxSelectionDialog(IDWebMessageTransfer, IDSessionInfo);  
    }
    else if (oSelectionDescriptor.getAttribute("SelectionDialogMode") == "DataGrid")
    {     
      xml = this.OpenGridSelectionDialog(IDWebMessageTransfer, IDSessionInfo);  
    }
    else
    {   
      xml = this.OpenComboSelectionDialog(IDWebMessageTransfer, IDSessionInfo);  
    }
    if (xml && typeof(xml) == "string")
    {
      var oDoc = Ilp.XmlDom.CreateXmlDom();
      oDoc.async = false;
      oDoc.validateOnParse = false;
      oDoc.loadXML(xml);
        
      this.ComboSelectionValue = unescape(oDoc.documentElement.selectSingleNode("Record").getAttribute("OptionValue"));
      this.ComboSelectionText = unescape(oDoc.documentElement.selectSingleNode("Record").getAttribute("OptionText"));
      this.ComboSelectionReturn = unescape(oDoc.documentElement.selectSingleNode("Record").getAttribute("ReturnText"));
      this.SelectionRecord = oDoc;
      
      retValue = true;
    }
    return retValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_SelectComboItem", "Section1")
  }
}


function WebDataSearch_RefreshConstrainedSearchControls(sender, counter)
{
  try
  {
    var fqn = "";
    var srdFqn = "";
    var srd = "";
    var oTarget = null;
    var oSelect = null;
    var oContainer = null;
    var optionsCount = 0;
 
    // Wegen möglicher Rekursion
    if (counter == null)	counter = 1;
    if (counter > 50) return;
    
    if (this.Container != null)
    {
      oContainer = document.getElementById(sender.getAttribute("ContainerClientID"));
      oSelect = document.getElementById(oContainer.getAttribute("ListBoxClientID"));
      optionsCount = oSelect.options.length;
      
      fqn = WebControl.GetFqn(oContainer);
      for (var i = 0; i < this.Container.SearchControlArray.length; i++)
      {
        oTarget = this.Container.SearchControlArray[i];   
        if (oTarget != oContainer && oTarget.oFieldDescriptor)
        {
          srdFqn = oTarget.oFieldDescriptor.getAttribute("SearchRelationDescriptorFqn");
          if (srdFqn != null)
          {
            srd = FormDescriptor.GetSearchRelationDescriptor(srdFqn);
            var doRefresh = false;
            if (srd != null)
            {
              if (srd.getAttribute("ConstrainerFqnList") != null)
              {
                var constrainerFqnList = srd.getAttribute("ConstrainerFqnList").split(" ");
                
                for (var j = 0; j < constrainerFqnList.length; j++)
                {
                  if (constrainerFqnList[j] == fqn)
                  {
                    doRefresh = true;
                    break;
                  }
                }
              }
              else
              {
                if (srd.getAttribute("ConstrainerFqn") == fqn)
                {
                  doRefresh = true;
                }
              }
              
              if (doRefresh == true)
              {  
                var listBoxClientID = oTarget.getAttribute("ListBoxClientID");
                if (listBoxClientID != null)
                {
                  var oCheckBox = document.getElementById(oTarget.getAttribute("CheckBoxClientID"));
                  oCheckBox.checked = false;
                  
                  oSelect = document.getElementById(oTarget.getAttribute("ListBoxClientID"));
                  oSelect.options.length = 0;
                  var infoButtonClientID = oTarget.getAttribute("InfoButtonClientID");
                  if (infoButtonClientID && infoButtonClientID.length > 0)
                  {
                    var oImage = document.getElementById(infoButtonClientID);
                    if (oImage)
                    {
                      if (optionsCount > 0)
                      {
                        WebControl.SetEnabled(oImage);
                        oImage.title = oImage.TitleSave;
                      }
                      else
                      {
                        var doDisable = true;					
                        if (srd.getAttribute("ConstrainerFqnList") != null)
                        {	
						              var constrainerFqnList = srd.getAttribute("ConstrainerFqnList").split(" ");
                          for (var j = 0; j < constrainerFqnList.length; j++)
                          {
                            for (var k = 0; k < this.Container.SearchControlArray.length; k++)
                            {
                              var oTarget2 = this.Container.SearchControlArray[k];   
                              if (oTarget2 != oTarget && oTarget2.oFieldDescriptor)
                              {
                                var fqn2 = WebControl.GetFqn(oTarget2);
                                if (fqn2 == constrainerFqnList[j])
                                {
                                  var listBoxClientID = oTarget2.getAttribute("ListBoxClientID");
                                  if (listBoxClientID != null)
                                  {
                                    var oSelect2 = document.getElementById(oTarget2.getAttribute("ListBoxClientID"));
                                    if (oSelect2.options.length > 0)
                                    {
                                      doDisable = false;
                                      break;
                                    }
                                  }
                                }
                              }
                            }
                            if (doDisable == false)
                            {
                              break;
                            }
                          }
                        }
                      
                        if (doDisable == true)
                        {
                          WebControl.SetDisabled(oImage);
                          oImage.title = "";
                        }
                      }
                    }
                  } 
                  this.RefreshConstrainedSearchControls(oSelect, counter+1);
                }
              }
            }
          }
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_RefreshConstrainedSearchControls", "Section1")
  }
}


function WebDataSearch_MarkConstrainer(sender)
{
  try
  {
    var oTarget = null;
    var oContainer = null;
    var srdFqn = null;
    var srd = null;
    var constrainerFqn = null;
    if (this.Container != null)
    { 
      oContainer = document.getElementById(sender.getAttribute("ContainerClientID"));
      srdFqn = oContainer.oFieldDescriptor.getAttribute("SearchRelationDescriptorFqn");
      if (srdFqn != null)
      {
        srd = FormDescriptor.GetSearchRelationDescriptor(srdFqn);
        if (srd != null)
        {
          if (srd.getAttribute("ConstrainerFqnList") != null)
          {						
						var constrainerFqnList = srd.getAttribute("ConstrainerFqnList").split(" ");
                
            for (var j = 0; j < constrainerFqnList.length; j++)
            {
							for (var k = 0; k < this.Container.SearchControlArray.length; k++)
							{
								oTarget = this.Container.SearchControlArray[k];  
								if (WebControl.GetFqn(oTarget) ==  constrainerFqnList[j])
								{
									oTarget.style.backgroundColor = "#6B9977";
									window.setTimeout("WebDataSearch.ResetSearchControlsBackColor();",1500);
									break;
								}
							}
						}
          }
          else if (srd.getAttribute("ConstrainerFqn") != null)
          {
						constrainerFqn = srd.getAttribute("ConstrainerFqn");
            for (var i = 0; i < this.Container.SearchControlArray.length; i++)
            {
              oTarget = this.Container.SearchControlArray[i];  
              if (WebControl.GetFqn(oTarget) ==  constrainerFqn)
              {
                oTarget.style.backgroundColor = "#6B9977";
                window.setTimeout("WebDataSearch.ResetSearchControlsBackColor();",1500);
                break;
              }
            }
          }
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_MarkConstrainer", "Section1")
  }
}

function WebDataSearch_ResetSearchControlsBackColor()
{
  try
  {
    var oTarget = null;
    var oContainer = null;
    if (this.Container != null)
    { 
      for (var i = 0; i < this.Container.SearchControlArray.length; i++)
      {
        oTarget = this.Container.SearchControlArray[i];   
        oTarget.style.backgroundColor = "";
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_ResetSearchControlsBackColor", "Section1")
  }
}


function WebDataSearch_BuildConstrainedSelectionSearchInfo(oRecord, oSelectionDescriptor)
{
  try
  {
    var oSearchInfo = WebMessage.GetSearchInfo();
    var constrainerFqn = oSelectionDescriptor.getAttribute("ConstrainerFqn");
    
    if (typeof(constrainerFqn) == "string")
    {
      // Der ConstrainerFqn ist veraltet und wird nur noch aus Kompatibilitätsgründen unterstützt.
      // Verwenden Sie ersatzweise die Eigenschaften 
      // 'ConstrainerSourceFqn' (FD im TDMaster des Wertes mit dem eingschränkt werden soll) 
      // und 
      // 'ConstrainerTargetFqn' (FD im TDSelection, der eingeschränkt werden soll) b.
      
      WebMessage.InitSearchInfo();
      var loop = true;
      while(loop)
      {
        var fqn = "";
        var oSelectionDescriptorConstrainer = null;
        var oFieldDescriptor = FormDescriptor.GetFieldDescriptor(constrainerFqn);
        
       
        fqn = constrainerFqn;
        if (typeof(oFieldDescriptor.getAttribute("SelectionDescriptorFqn")) == "string")
        {
          oSelectionDescriptorConstrainer = FormDescriptor.GetSelectionDescriptor(oFieldDescriptor.getAttribute("SelectionDescriptorFqn"));
          if (typeof(oSelectionDescriptorConstrainer.getAttribute("ValueFqn")) == "string")
          {
            fqn = oSelectionDescriptorConstrainer.getAttribute("ValueFqn");
          }
        }
        
        var oValue = WebData.GetFieldValue(oRecord, fqn);      
        if (oValue)
        {
          var searchInfoItemId = "S_" + String(oSearchInfo.childNodes.length);
          oFieldDescriptor = FormDescriptor.GetFieldDescriptor(fqn); 
          
          fqn = oSelectionDescriptor.getAttribute("TableDescriptorFqn") + "." + oFieldDescriptor.getAttribute("FieldName");
          WebMessage.AddSearchInfoItem(searchInfoItemId, fqn, String(oValue), "Equal", "false", "RelatedSearch");
        }
                
        if (oSelectionDescriptorConstrainer && typeof(oSelectionDescriptorConstrainer.getAttribute("ConstrainerFqn")) == "string")
        {
          constrainerFqn = oSelectionDescriptorConstrainer.getAttribute("ConstrainerFqn");
        }
        else
        {
          loop = false;
        }
      }
    }
    else
    {   
      // Aktuelle Version mit ConstrainerSourceFqn und ConstrainerTargetFqn. b.
      var counter = 0;
      var constrainerSourceFqn = oSelectionDescriptor.getAttribute("ConstrainerSourceFqn");
      var constrainerTargetFqn = oSelectionDescriptor.getAttribute("ConstrainerTargetFqn");   
      if (typeof(constrainerSourceFqn) == "string" && typeof(constrainerTargetFqn) == "string")
      {   
        WebMessage.InitSearchInfo();
        var loop = true;
        while(loop)
        {
          // zur sicherheit 
          counter++;
          if (counter == 100) break;
          
          var oFieldDescriptor = FormDescriptor.GetFieldDescriptor(constrainerSourceFqn);
          var oSelectionDescriptorConstrainer = null; 
          var oSelectionDescriptorConstrainerFqn = oFieldDescriptor.getAttribute("SelectionDescriptorFqn");
          if (typeof(oSelectionDescriptorConstrainerFqn) == "string") oSelectionDescriptorConstrainer = FormDescriptor.GetSelectionDescriptor(oSelectionDescriptorConstrainerFqn);
 
          var oValue = WebData.GetFieldValue(oRecord, constrainerSourceFqn);      
          if (oValue) WebMessage.AddSearchInfoItem("S_" + String(oSearchInfo.childNodes.length), constrainerTargetFqn, String(oValue), "Equal", "false", "RelatedSearch");                   
          if (oSelectionDescriptorConstrainer 
            && typeof(oSelectionDescriptorConstrainer.getAttribute("ConstrainerSourceFqn")) == "string"
            && typeof(oSelectionDescriptorConstrainer.getAttribute("ConstrainerTargetFqn")) == "string")
          {
            constrainerSourceFqn = oSelectionDescriptorConstrainer.getAttribute("ConstrainerSourceFqn");
            constrainerTargetFqn = oSelectionDescriptorConstrainer.getAttribute("ConstrainerTargetFqn");
          }
          else
          {
            loop = false;
          }
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_BuildConstrainedSelectionSearchInfo", "Section1")
  }
}

function WebDataSearch_GetSelectionRecordValue(fqn)
{
  try
  {
    var returnValue = "";
    if(this.SelectionRecord && this.SelectionRecord.documentElement)
    {
      var oRecord = this.SelectionRecord.documentElement.selectSingleNode("Record");
      if(oRecord)
      {
        returnValue = oRecord.getAttribute(fqn);
      }
    }
    return returnValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_GetSelectionRecordValue", "Section1")
  }
}

function WebDataSearch_CriteriaManage(sender, verb)
{
  try
  {
    if (verb == Verb_Save)
    {
      this.BuildSearchInfo();
      if (WebControl.WebMessageDescriptorList.Count() > 0)
      {
        WebControl.ShowValidationSummary();
        WebControl.EnableControls();
        return;
      }
      else
      {   
        if (this.ExistsSelection == false)
        {
          alert(ids_SelectRecordFirst);
          WebControl.EnableControls();
          return;
        }
      }  
    }
  
		var windowFeatures = WebControl.GetWindowFeatures(800, 400);
    var dialogFeatures = WebControl.GetDialogFeatures(800, 400);
  
    var url = WebControl.GetStandardUrl("GlobalScripts/GTCommon/SearchCriteria.aspx", verb, CallingMode_Dialog);
    url += "&IDWebPage=" + IDWebPage;  
    url += "&IDAppUser=" + IDAppUser;  
  
    if (1==2)
    {
      result = WebControl.ShowModalDialog(url, dialogFeatures, null);
      if (result)
      {
      }
    }
    else
    {
      var oWindow = WebControl.OpenWindow("SearchCriteria", url, "SearchCriteria", windowFeatures, true);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSearch_CriteriaManage", "Section1")
  }
}


/* ============================ GTWebForm.js ===========================*/
function LoadWebForm()
{
  try
  {
    EnsureWebMessage();

    window.WebForm = new Object();

    window.WebForm.Queue = new Array();

    window.WebForm.UnloadPageMenu = WebForm_UnloadPageMenu;

    window.WebForm.CreateQueue = WebForm_CreateQueue;
    window.WebForm.RemoveQueue = WebForm_RemoveQueue;

    window.WebForm.OnClickHandler = WebForm_OnClickHandler;
    window.WebForm.OnDblClickHandler = WebForm_OnDblClickHandler;
    window.WebForm.OnFocusHandler = WebForm_OnFocusHandler;
    window.WebForm.OnKeyDownHandler = WebForm_OnKeyDownHandler;
    window.WebForm.OnKeyUpHandler = WebForm_OnKeyUpHandler;
    window.WebForm.OnKeyPressHandler = WebForm_OnKeyPressHandler;
    window.WebForm.OnChangeHandler = WebForm_OnChangeHandler;
    window.WebForm.OnBlurHandler = WebForm_OnBlurHandler;
    window.WebForm.OnMouseDownHandler = WebForm_OnMouseDownHandler;
    window.WebForm.OnMouseOverHandler = WebForm_OnMouseOverHandler;
    window.WebForm.OnMouseUpHandler = WebForm_OnMouseUpHandler;
    window.WebForm.OnMouseOutHandler = WebForm_OnMouseOutHandler;
    window.WebForm.OnPasteHandler = WebForm_OnPasteHandler;
    window.WebForm.OnPropertyChagedHandler = WebForm_OnPropertyChagedHandler;
    window.WebForm.OnScrollHandler = WebForm_OnScrollHandler;

    window.WebForm.PseudoCall = WebForm_PseudoCall;
    window.WebForm.AddDocumentHandler = WebForm_AddDocumentHandler;
    window.WebForm.AddBodyHandler = WebForm_AddBodyHandler;

    window.WebForm.DocumentHandlerNames = new Object();
    window.WebForm.BodyHandlerNames = new Object();

    window.WebForm.ContextMenu = null;
    window.WebForm.WebPopUp = null;

    if (document.body)
    {
      document.body.onresize = WebForm_OnResize;
      document.body.onscroll = WebForm_OnScroll;
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "LoadWebForm", "")
  }
}

function WebForm_OnBlurHandler(sender, src)
{
  try
  {
    sender = Ilp.Event.GetSender(sender, src, this);
    src = Ilp.Event.GetSrc(sender, src);

    var args = new EventArgs();
    args.Cancel = false;
    args.Sender = sender;
    args.Src = src;

    if (args.Cancel == false)
    {
      switch (src.getAttribute("ControlType"))
      {
        case "CheckBox":
        case "TextBox":
          if (Ilp.HtmlDom.GetStyle(src, "backgroundColor") == WebControl.BackgroundColorOnFocus)
          {
            Ilp.HtmlDom.SetStyle(src, "backgroundColor", WebControl.BackgroundColorNoChange);
          }
          Ilp.Event.Cancel(sender);
          break;
        case "DropDownList":
        case "ListBox":
          Ilp.AutoComplete.OnBlur();
          Ilp.Event.Cancel(sender);
          break;
      }
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebForm_OnBlurHandler", "Section1");
  }
}

function WebForm_OnChangeHandler(sender, src)
{
  try
  {
    sender = Ilp.Event.GetSender(sender, src, this);
    src = Ilp.Event.GetSrc(sender, src);
    if (src == null && window.event && window.event.expando)
    {
      src = document.getElementById(window.event.expando);
      sender = src;
    }

    var args = new EventArgs();
    args.Cancel = false;

    var OnChangeHandler = sender.getAttribute("OnChangeHandler")
    if (typeof (OnChangeHandler) == "string")
    {
      eval(OnChangeHandler + "(sender, args);");
    }

    if (args.Cancel == false)
    {
      switch (src.getAttribute("ControlType"))
      {
        case "DropDownList":
          if (typeof (src.oWebDataSearch) == "object")
          {
            src.oWebDataSearch.ProcessChange(sender);
          }
          else
          {
            WebControl.WriteToWebData(sender);
            var constrainedFqn = src.getAttribute("ConstrainedFqn");
            if (typeof (constrainedFqn) == "string") WebControl.FillConstrainedCombo(src);
          }
          Ilp.Event.CancelBubble(sender);
          break;
        case "TextBox":
          WebControl.WriteToWebData(src);
          Ilp.Event.CancelBubble(sender);
          break;
      }
    }

    var AfterOnChangeHandler = sender.getAttribute("AfterOnChangeHandler")
    if (typeof (AfterOnChangeHandler) == "string")
    {
      args.oRecord = sender.oRecord;
      eval(AfterOnChangeHandler + "(sender, args);");
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebForm_OnChangeHandler", "Section1");
  }
}

function WebForm_OnClickHandler(sender, src)
{
  try
  {
    if (window.WebForm.ContextMenu != null)
    {
      window.WebForm.ContextMenu.Hide();
      window.WebForm.ContextMenu = null;
    }

    // Der Event wird vom sender "behandelt", sprich der fÃ¤ngt ihn ab
    // Der Event wird von src ausgelÃ¶st, z.B. durch einen click.
    sender = Ilp.Event.GetSender(sender, src, this);
    src = Ilp.Event.GetSrc(sender, src);

    var args = new EventArgs();
    args.Cancel = false;
    args.Sender = sender;
    args.Src = src;


    var onClickHandler = sender.getAttribute("OnClickHandler")
    if (typeof (onClickHandler) == "string")
    {
      onClickHandler = Ilp.Util.PrepareHandler(onClickHandler);
      eval(onClickHandler + "(sender, args);");
      Ilp.Event.Cancel(sender);
    }

    if (args.Cancel == false)
    {
      switch (src.getAttribute("ControlType"))
      {
        case "TreeFolder":
          var oContainer = WebControl.GetContainer(src, "NavTree");
          oContainer.NavTree.Toggle(src);
          Ilp.Event.Cancel(sender);
          break;
        case "TreeLeaf":
          var oContainer = WebControl.GetContainer(src, "NavTree");
          oContainer.NavTree.SelectLeaf(src);
          Ilp.Event.Cancel(sender);
          break;
        case "Button":
        case "Image":
          switch (src.getAttribute("ButtonType"))
          {
            case "Calendar":
              if (src.disabled == true) alert(ids_NoActionPossible);
              else ShowCalendarStart(src);
              args.Cancel = true;
              Ilp.Event.Cancel(sender);
              break;
            case "Navigate":
              if (src.disabled == true) alert(ids_NoActionPossible);
              else WebControl.Post(src);
              args.Cancel = true;
              Ilp.Event.Cancel(sender);
              break;
            case "ConvertToMasterdata":
              if (src.disabled == true) alert(ids_NoActionPossible);
              else WebData.ConvertToMasterdata(src);
              args.Cancel = true;
              Ilp.Event.Cancel(sender);
              break;
            case "ExpandButton":
              if (src.disabled == true) alert(ids_NoActionPossible);
              else WebControl.ToggleRows(src);
              Ilp.Event.Cancel(sender);
              break;
            case "SelectionButton":
              if (src.disabled == true) alert(ids_NoActionPossible);
              else WebControl.SelectComboItem(src);
              Ilp.Event.Cancel(sender);
              break;
            case "InfoButton":
              if (src.disabled == true) alert(ids_NoActionPossible);
              else WebControl.ShowInfoInDialog(src);
              Ilp.Event.Cancel(sender);
              break;
            case "SelectionDeleteButton":
              if (src.disabled == true) alert(ids_NoActionPossible);
              else WebControl.DeleteComboItem(src);
              Ilp.Event.Cancel(sender);
              break;
            case "ChangeTracking":
              WebControl.ShowChangeHistory(src);
              args.Cancel = true;
              Ilp.Event.Cancel(sender);
              break;
            case "EditRecordButton":
              if (src.disabled == true) alert(ids_NoActionPossible);
              else WebControl.EditRecordInDialog(src);
              args.Cancel = true;
              Ilp.Event.Cancel(sender);
              break;
            case "PopUpButton":
              WebControl.ShowWebPopUp(sender, src, "OnClick");
              args.Cancel = true;
              Ilp.Event.Cancel(sender);
              break;
            case "ContextHelpButton":
              WebControl.ShowContextHelpDialog(sender, src);
              args.Cancel = true;
              Ilp.Event.Cancel(sender);
              break;
            case "ClipboardCopyButton":
              WebControl.CopyToClipboard(sender);
              args.Cancel = true;
              Ilp.Event.Cancel(sender);
              break;
            case "MappingButton":
              if (src.disabled == true) alert(ids_NoActionPossible);
              else WebData.UpdateMapping(src);
              Ilp.Event.Cancel(sender);
              break;
            default:
              break
          }
          break;
        case "Label":
          switch (src.getAttribute("LabelType"))
          {
            case "LongTextDialog":
              if (src.disabled == true) alert(ids_NoActionPossible);
              else WebControl.EditInLongTextDialog(src, args);
              args.Cancel = true;
              Ilp.Event.Cancel(sender);
              break;
          }
          break;
        case "DataLink":
          if (src.getAttribute("DataLinkType") == "HyperLink")
          {
            WebControl.SetLinkStyle(src, "Active");
          }
          switch (src.getAttribute("DataLinkType"))
          {
            case "Download":
              if (src.disabled == true) alert(ids_NoActionPossible);
              else WebControl.Download(src);
              Ilp.Event.Cancel(sender);
              break;
            case "Upload":
              if (src.disabled == true) alert(ids_NoActionPossible);
              else WebControl.Upload(src);
              Ilp.Event.Cancel(sender);
              break;
            case "DeleteUpload":
              if (src.disabled == true) alert(ids_NoActionPossible);
              else WebControl.DeleteUpload(src);
              Ilp.Event.Cancel(sender);
              break;
            case "EditUpload":
              if (src.disabled == true) alert(ids_NoActionPossible);
              else WebControl.EditUpload(src);
              Ilp.Event.Cancel(sender);
              break;
            case "Paging":
              if (src.disabled == true) alert(ids_NoActionPossible);
              else WebData.Page(src);
              Ilp.Event.Cancel(sender);
              break;
            case "ScrollLeft":
              if (src.disabled == true) alert(ids_NoActionPossible);
              else WebControl.PagingScrollLeft(src);
              args.Cancel = true;
              Ilp.Event.Cancel(sender);
              break;
            case "ExpertSearch":
              args.Cancel = true;
              Ilp.Event.Cancel(sender);
              break;
            case "QuickSearch":
              if (typeof (WebDataSearch) == "object") WebDataSearch.Hide();
              args.Cancel = true;
              Ilp.Event.Cancel(sender);
              break;
            case "ChangeTracking":
              WebControl.ShowChangeHistory(src);
              args.Cancel = true;
              Ilp.Event.Cancel(sender);
            case "HyperLink":
              break;
            case "Select":
            case "Custom":
              break;
            case "HyperLink":
              break;
            case "Action":
              if (src.disabled == true) alert(ids_NoActionPossible);
              else
              {
                var beforePostHandler = src.getAttribute("BeforePostHandler")
                if (typeof (beforePostHandler) == "string")
                {
                  eval(beforePostHandler + "(src, args);");
                }
                if (args.Cancel != true) WebControl.Post(src);
              }
              args.Cancel = true;
              Ilp.Event.Cancel(sender);
              break;
            case "WebPopUp":
              WebControl.ShowWebPopUp(sender, src, "OnClick");
              args.Cancel = true;
              Ilp.Event.Cancel(sender);
              break;
            default:
              if (src.disabled == true) alert(ids_NoActionPossible);
              else
              {
                var beforePostHandler = src.getAttribute("BeforePostHandler")
                if (typeof (beforePostHandler) == "string")
                {
                  eval(beforePostHandler + "(src, args);");
                }
                if (args.Cancel != true) WebControl.Post(src);
              }
              args.Cancel = true;
              Ilp.Event.Cancel(sender);
              break;
          }
          break;
        case "ListBox":
          WebControl.WriteToWebData(sender);
          break;
      }
    }

    if (args.Cancel == false)
    {
      if (typeof (sender.oWebDataGrid) == "object")
      {
        sender.oWebDataGrid.ProcessClick(src);
      }
      else if (typeof (sender.oWebDataSheet) == "object")
      {
        sender.oWebDataSheet.ProcessClick(src);
      }
      else if (typeof (sender.oWebDataSearch) == "object")
      {
        sender.oWebDataSearch.ProcessClick(sender, src);
      }
      else if (typeof (sender.oWebTreeView) == "object")
      {
        sender.oWebTreeView.ProcessClick(src);
      }
      else if (typeof (sender.oWebDataHeader) == "object")
      {
        sender.oWebDataHeader.ProcessClick(src);
      }
      else if (typeof (sender.oWebColumnGrid) == "object")
      {
        sender.oWebColumnGrid.ProcessClick(src);
      }

      if (src.getAttribute("ControlType") == "CheckBox")
      {
        WebControl.WriteToWebData(src);
        Ilp.Event.Cancel(sender);
      }
      else if (src.getAttribute("ControlType") == "RadioButton")
      {
        WebControl.WriteToWebData(src);
        Ilp.Event.Cancel(sender);
      }
    }

    var afterOnClickHandler = sender.getAttribute("AfterOnClickHandler")
    if (typeof (afterOnClickHandler) == "string")
    {
      args.Cancel = true;
      eval(afterOnClickHandler + "(sender, args);");
      Ilp.Event.Cancel(sender);
    }

    if (Ilp.HtmlDom.HasAttribute(sender, "CT") == true)
    {
      if (Ilp.HtmlDom.GetAttribute(sender, "CT") == enum_CT_PageFooter_Link)
      {
        return false;
      }
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebForm_OnClickHandler", "Section1", this.OnClickHandler)
  }
}

function WebForm_OnDblClickHandler(sender, src)
{
  try
  {
    sender = Ilp.Event.GetSender(sender, src, this);
    src = Ilp.Event.GetSrc(sender, src);

    if (Ilp.HtmlDom.IsHtmlElement(sender) == true)
    {
      var OnDblClickHandler = sender.getAttribute("OnDblClickHandler")
      if (typeof (OnDblClickHandler) == "string")
      {
        var args = new EventArgs();
        eval(OnDblClickHandler + "(sender, args);");
      }
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebForm_OnDblClickHandler", "Section1")
  }
}

function WebForm_OnFocusHandler(sender, src)
{
  try
  {
    sender = Ilp.Event.GetSender(sender, src, this);
    src = Ilp.Event.GetSrc(sender, src);

    var args = new EventArgs();
    args.Cancel = false;
    args.Sender = sender;
    args.Src = src;

    if (src == null) return;
    if (src.readOnly == true) return;

    if (args.Cancel == false)
    {
      switch (src.getAttribute("ControlType"))
      {
        case "CheckBox":
        case "TextBox":
          /*
          if (   src.runtimeStyle.backgroundColor == WebControl.BackgroundColorNoChange
          || src.runtimeStyle.backgroundColor == WebControl.BackgroundColorWrongInput
          || src.runtimeStyle.backgroundColor == ""){

          src.runtimeStyle.backgroundColor = WebControl.BackgroundColorOnFocus;
          }
          */
          if (Ilp.HtmlDom.GetStyle(src, "backgroundColor") == WebControl.BackgroundColorNoChange
              || Ilp.HtmlDom.GetStyle(src, "backgroundColor") == WebControl.BackgroundColorWrongInput
              || src.runtimeStyle.backgroundColor == "")
          {
            Ilp.HtmlDom.SetStyle(src, "backgroundColor", WebControl.BackgroundColorOnFocus);
          }
          Ilp.Event.Cancel(sender);
          break;
        case "DropDownList":
          if (src.getAttribute("State") == "Fake")
          {
            var oCombo = WebControl.ReplaceFakeCombo(src);

            var oRecord = sender.oRecord;
            var fieldDescriptorFqn = WebControl.GetFqn(src);

            var fieldValue = WebData.GetFieldValue(oRecord, fieldDescriptorFqn);
            WebControl.SetComboValue(oCombo, fieldValue, false);

            if (src.style.display == "block")
            {
              oCombo.focus();
            }
          }
          Ilp.Event.Cancel(sender);
          break;
      }
    }

    var afterOnFocusHandler = sender.getAttribute("AfterOnFocusHandler")
    if (typeof (afterOnFocusHandler) == "string")
    {
      var args = new EventArgs();
      eval(afterOnFocusHandler + "(sender, args);");
    }

  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebForm_OnFocusHandler", "Section1")
  }
}

function WebForm_OnKeyDownHandler(sender, src)
{
  try
  {
    sender = Ilp.Event.GetSender(sender, src, this);
    src = Ilp.Event.GetSrc(sender, src);

    //Event Key ist die "ESC-Taste". Die PrÃ¼fung ist nur dann true wenn die Esc-Taste mehrmals
    //gedrÃ¼ckt wird und damit soll verhindert werden,
    //dass die Inhalte der Controls einer Maske gelÃ¶scht werden.
    if (window.event.keyCode == 27)
    {
      Ilp.Event.Cancel(sender);
      return false;
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebForm_OnKeyDownHandler", "Section1")
  }
}

function WebForm_OnKeyPressHandler(sender, src)
{
  try
  {
    sender = Ilp.Event.GetSender(sender, src, this);
    src = Ilp.Event.GetSrc(sender, src);

    if (window.event.keyCode >= 32)
    {
      switch (src.getAttribute("ControlType"))
      {
        case "DropDownList":
        case "ListBox":
          Ilp.AutoComplete.OnKeyPress();
          Ilp.Event.Cancel(window.event);
          break;
      }
    }
    else if (window.event.keyCode == 13)
    {
      var OnKeyCode13Handler = sender.getAttribute("OnKeyCode13Handler")
      if (typeof (OnKeyCode13Handler) == "string")
      {
        var args = new EventArgs();
        eval(OnKeyCode13Handler + "(sender, args);");
      }
      if (src.tagName == "INPUT" && src.type == "text")
      {
        // Verhindert das Submit in einer Form beim drÃ¼cken der Return-Taste
        // in einer TextBox
        Ilp.Event.Cancel(window.event);
        return false;
      }
    }
    else if (window.event.keyCode == 27)
    {
      var OnKeyCode27Handler = sender.getAttribute("OnKeyCode27Handler")
      if (typeof (OnKeyCode27Handler) == "string")
      {
        var args = new EventArgs();
        eval(OnKeyCode27Handler + "(sender, args);");
      }
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebForm_OnKeyPressHandler", "Section1")
  }
}

function WebForm_OnKeyUpHandler(sender, src)
{
  try
  {
    sender = Ilp.Event.GetSender(sender, src, this);
    src = Ilp.Event.GetSrc(sender, src);

    var args = new EventArgs();
    args.Cancel = false;

    if (window.event.keyCode != 9)
    {
      switch (src.getAttribute("ControlType"))
      {
        case "DropDownList":
          if (typeof (src.oWebDataSearch) == "object") src.oWebDataSearch.ProcessKeyUp(sender);
          break;
        case "RadioButton":
          if (typeof (src.oWebDataSearch) == "object") src.oWebDataSearch.ProcessKeyUp(sender);
          break;
        case "TextBox":
          if (typeof (src.oWebDataSearch) == "object") src.oWebDataSearch.ProcessKeyUp(sender);
          else WebControl.WriteToWebData(src);

          var afterOnKeyUpHandler = sender.getAttribute("AfterOnKeyUpHandler")
          if (typeof (afterOnKeyUpHandler) == "string")
          {
            eval(afterOnKeyUpHandler + "(sender, args);");
          }
          Ilp.Event.Cancel(sender);
          break;
        case "CheckBox":
          Ilp.Event.Cancel(sender);
          break;
        case "Panel":
          if (src.isContentEditable == true)
          {
            WebControl.WriteToWebData(src);
          }
          Ilp.Event.Cancel(sender);
          break;
      }
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebForm_OnKeyUpHandler", "Section1")
  }
}

function WebForm_OnMouseDownHandler(sender, src)
{
  try
  {
    sender = Ilp.Event.GetSender(sender, src, this);
    src = Ilp.Event.GetSrc(sender, src);

    if (Ilp.HtmlDom.IsHtmlElement(src) == true)
    {
      switch (src.getAttribute("ControlType"))
      {
        case "SplitterDivider":
          var oContainer = WebControl.GetContainer(src, "WebSplitterContainer");
          oContainer.WebSplitter.OnMouseDown();
          Ilp.Event.Cancel(sender);
          break;
      }
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebForm_OnMouseDownHandler", "Section1")
  }
}

function WebForm_OnMouseOutHandler(sender, src)
{
  try
  {
    sender = Ilp.Event.GetSender(sender, src, this);
    src = Ilp.Event.GetSrc(sender, src);

    var args = new EventArgs();
    args.Cancel = false;

    if (src == null) return;

    switch (src.getAttribute("ControlType"))
    {
      case "Image":
        if (src.getAttribute("IsOutset") == "true")
        {
          if (src.getAttribute("SaveClassName") != null)
          {
            src.className = src.getAttribute("SaveClassName");
          }
        }
        break;

      case "DataLink":
        if (src.getAttribute("DataLinkType") == "HyperLink")
        {
          WebControl.RestoreLinkStyle(src);
        }
        break;
    }

    var webPopUpBehavior = sender.getAttribute("WebPopUpBehavior");
    if (webPopUpBehavior == null)
    {
      if (WebControl.WebPopUp && WebControl.WebPopUp.Behavior == enum_WebPopUpBehavior_OnMouseOver) WebControl.WebPopUp.Hide();
    }

    var onMouseOutHandler = sender.getAttribute("OnMouseOutHandler")
    if (typeof (onMouseOutHandler) == "string")
    {
      eval(onMouseOutHandler + "(sender, args);");
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebForm_OnMouseOutHandler", "Section1")
  }
}

function WebForm_OnMouseOverHandler(sender, src)
{
  try
  {
    sender = Ilp.Event.GetSender(sender, src, this);
    src = Ilp.Event.GetSrc(sender, src);

    var args = new EventArgs();
    args.Cancel = false;

    if (sender == null) return;

    var beforeOnMouseOverHandler = sender.getAttribute("BeforeOnMouseOverHandler")
    if (typeof (beforeOnMouseOverHandler) == "string")
    {
      eval(beforeOnMouseOverHandler + "(sender, args);");
    }

    if (args.Cancel == false)
    {
      switch (sender.getAttribute("ControlType"))
      {
        case "DropDownList":
          if (src.getAttribute("State") == "Fake")
          {
            var oCombo = WebControl.ReplaceFakeCombo(src);

            var oRecord = oCombo.oRecord;
            var fieldDescriptorFqn = WebControl.GetFqn(oCombo);

            if (fieldDescriptorFqn != null)
            {
              var fieldValue = WebData.GetFieldValue(oRecord, fieldDescriptorFqn);
              WebControl.SetComboValue(oCombo, fieldValue, false);
            }
            else
            {
              oCombo.selectedIndex = 0;
            }
          }
          break;

        case "Image":
          if (src.getAttribute("IsOutset") == "true")
          {
            if (src.getAttribute("SaveClassName") == null)
            {
              src.setAttribute("SaveClassName", sender.className);
            }
            if (src.className == src.getAttribute("SaveClassName"))
            {
              src.className = src.className + "Selected";
            }
          }
          break;

        case "DataLink":
          if (src.getAttribute("DataLinkType") == "HyperLink")
          {
            WebControl.SetLinkStyle(src, "Hover");
          }
          break;

      }

      WebControl.ShowWebPopUp(sender, src, "OnMouseOver");
    }

    var onMouseOverHandler = sender.getAttribute("OnMouseOverHandler")
    if (typeof (onMouseOverHandler) == "string")
    {
      eval(onMouseOverHandler + "(sender, args);");
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebForm_OnMouseOverHandler", "Section1")
  }
}

function WebForm_OnMouseUpHandler(sender, src)
{
  try
  {
    sender = Ilp.Event.GetSender(sender, src, this);
    src = Ilp.Event.GetSrc(sender, src);
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebForm_OnMouseUpHandler", "Section1")
  }
}

function WebForm_OnPasteHandler(sender, src)
{
  try
  {
    sender = Ilp.Event.GetSender(sender, src, this);
    src = Ilp.Event.GetSrc(sender, src);
    if (src == null) src = document.getElementById(window.event.expando);

    var args = new EventArgs();
    args.Cancel = false;
    args.Sender = sender;
    args.Src = src;

    var onPasteHandler = sender.getAttribute("OnPasteHandler")
    if (typeof (onPasteHandler) == "string")
    {
      onPasteHandler = Ilp.Util.PrepareHandler(onPasteHandler);
      eval(onPasteHandler + "(src, args);");
    }

    if (args.Cancel == false)
    {
      switch (sender.getAttribute("ControlType"))
      {
        case "TextBox":
          if (typeof (src.oWebDataSearch) == "object")
          {
            sender.oWebDataSearch.ProcessPaste(src);
          }
          else
          {
            if (window.event && window.event.ctrlKey == false && window.event.ctrlLeft == false)
            {
              Ilp.Event.Bag = new Object();
              Ilp.Event.Bag.CtrlKey = window.event.ctrlKey;
              Ilp.Event.Bag.CtrlLeft = window.event.ctrlLeft;
              Ilp.Event.Bag.Src = src;
              Ilp.Event.Bag.Args = args;
              window.setTimeout("WebForm_OnPasteHandlerT();", 50);
            }
          }
          break;
      }
    }

  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebForm_OnPasteHandler", "Section1")
  }
}

function WebForm_OnPasteHandlerT()
{
  try
  {
    if (Ilp.Event.Bag.CtrlKey == false && Ilp.Event.Bag.CtrlLeft == false)
    {
      WebControl.WriteToWebData(Ilp.Event.Bag.Src, true);
    }

    var afterOnPasteHandler = Ilp.Event.Bag.Src.getAttribute("AfterOnPasteHandler")
    if (typeof (afterOnPasteHandler) == "string")
    {
      eval(afterOnPasteHandler + "(Ilp.Event.Bag.Src, Ilp.Event.Bag.Args);");
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebForm_OnPasteHandlerT", "Section1")
  }
}

function WebForm_OnPropertyChagedHandler(sender, src)
{
  try
  {
    sender = Ilp.Event.GetSender(sender, src, this);
    src = Ilp.Event.GetSrc(sender, src);
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebForm_OnPropertyChagedHandler", "Section1")
  }
}

function WebForm_OnScrollHandler(sender, src)
{
  try
  {
    sender = Ilp.Event.GetSender(sender, src, this);
    src = Ilp.Event.GetSrc(sender, src);

    var args = new EventArgs();
    args.Cancel = false;

    var onScrollHandler = sender.getAttribute("OnScrollHandler")
    if (typeof (onScrollHandler) == "string")
    {
      eval(onScrollHandler + "(sender, args);");
    }
    else
    {
      if (sender.WebTreeView && sender.WebTreeView.OnScrollHandler)
      {
        sender.WebTreeView.OnScrollHandler(sender, args);
      }
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebForm_OnScrollHandler", "Section1")
  }
}


function WebForm_AddBodyHandler(handlerName, handlerCall)
{
  try
  {
    var bodyHandlerName = this.BodyHandlerNames[handlerName];
    var handlerCalls = null;
    if (bodyHandlerName == null)
    {
      this.BodyHandlerNames[handlerName] = new Object();
      this.BodyHandlerNames[handlerName].HandlerCalls = new Array();
      bodyHandlerName = this.BodyHandlerNames[handlerName];
    }
    handlerCalls = bodyHandlerName.HandlerCalls;
    handlerCalls[handlerCalls.length] = handlerCall;
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebForm_AddBodyHandler", "Section1")
  }
}

function WebForm_AddDocumentHandler(handlerName, handlerCall)
{
  try
  {
    var documentHandlerName = this.DocumentHandlerNames[handlerName];
    var handlerCalls = null;
    if (documentHandlerName == null)
    {
      this.DocumentHandlerNames[handlerName] = new Object();
      this.DocumentHandlerNames[handlerName].HandlerCalls = new Array();
      documentHandlerName = this.DocumentHandlerNames[handlerName];
    }
    handlerCalls = documentHandlerName.HandlerCalls;
    handlerCalls[handlerCalls.length] = handlerCall;
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebForm_AddDocumentHandler", "Section1")
  }
}

function WebForm_OnResize()
{
  try
  {
    if (typeof (WebControl) == "object")
    {
      var bodyHandlerName = WebForm.BodyHandlerNames["OnResize"];
      if (bodyHandlerName != null)
      {
        for (var i = 0; i < bodyHandlerName.HandlerCalls.length; i++)
        {
          var handlerCall = bodyHandlerName.HandlerCalls[i];
          eval(handlerCall);
        }
      }
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebForm_OnResize", "Section1")
  }
}

function WebForm_OnScroll()
{
  try
  {
    if (typeof (WebControl) == "object")
    {
      var bodyHandlerName = WebForm.BodyHandlerNames["OnScroll"];
      if (bodyHandlerName != null)
      {
        for (var i = 0; i < bodyHandlerName.HandlerCalls.length; i++)
        {
          var handlerCall = bodyHandlerName.HandlerCalls[i];
          eval(handlerCall);
        }
      }
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebForm_OnScroll", "Section1")
  }
}

function WebForm_PseudoCall(sender)
{
  try
  {
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebForm_PseudoCall", "Section1")
  }
}


function WebForm_CreateQueue()
{
  try
  {
    if (WebForm.QueueArray == null)
    {
      WebForm.QueueArray = new WebArray();
    }

    var qd = new QueueDescriptor(new Date(), WebForm);
    qd.Index = WebForm.QueueArray.Add(qd);

    return qd;
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebForm_CreateQueue", "Section1")
  }
}

function WebForm_RemoveQueue(queueDescriptor)
{
  try
  {
    WebForm.QueueArray.Remove(queueDescriptor.Index);
    if (WebForm.QueueArray.Count() == 0)
    {
      WebControl.EnableControls();
      WebMessage.SaveKpiDescriptor();
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebForm_RemoveQueue", "Section1")
  }
}

function WebForm_UnloadPageMenu(oFrame)
{
  try
  {
    var oBody = null;

    if (oFrame == null)
    {
      oFrame = parent.frames["NavFrame"]
    }

    if (oFrame)
    {
      if (oFrame.document != null)
      {
        oBody = oFrame.document.body;
        if (oBody != null)
        {
          oBody.innerHTML = "";
        }
        else
        {
          WebMessage.SendClientLog(exception, "UnloadFormMenu", "No Body")
        }
      }
      else
      {
        WebMessage.SendClientLog(exception, "UnloadFormMenu", "No Document")
      }
    }
    else
    {
      var hostWindow = Ilp.HtmlDom.GetHostWindow();
      if (hostWindow)
      {
        hostWindow.Ilp.Page.ClearMenu();
      }
      else
      {
        Ilp.Page.ClearMenu();
      }
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebForm_UnloadPageMenu", "Section1")
  }
}

function EnsureWebForm()
{
  try
  {
    if (typeof (window.WebForm) == "undefined")
    {
      LoadWebForm();
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "EnsureWebForm", "")
  }
}

function body_OnClick()
{
  try
  {
    HideCalendar();
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "body_OnClick", "Section1")
  }
}

function body_OnKeyDown()
{
  try
  {
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "body_OnKeyDown", "Section1")
  }
}

function body_OnKeyUp()
{
  try
  {
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "body_OnKeyUp", "Section1")
  }
}

function body_OnResize()
{
  try
  {
    if (document.body.Page)
    {
      document.body.Page.Resize();
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "body_OnResize", "Section1")
  }
}

function body_OnUnload()
{
  try
  {
    WebForm.UnloadPageMenu();

    if (typeof (WebControl) == "object")
    {
      WebControl.BodyOnUnload();
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "body_OnUnload", "Section1")
  }
}

function body_OnBeforeUnloadHandler()
{
  try
  {
    if (typeof (WebData) == "object")
    {
      WebData.OnBeforeUnload();
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "body_OnBeforeUnloadHandler", "Section1")
  }
}

function document_onmouseover()
{
  try
  {
    if (typeof (WebControl) == "object")
    {
      var documentHandlerName = WebForm.DocumentHandlerNames["OnMouseOver"];
      if (documentHandlerName != null)
      {
        for (var i = 0; i < documentHandlerName.HandlerCalls.length; i++)
        {
          var handlerCall = documentHandlerName.HandlerCalls[i];
          eval(handlerCall);
        }
      }
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "document_onmouseover", "Section1")
  }
}
document.onmouseover = document_onmouseover;

function document_onclick()
{
  try
  {
    if (typeof (WebControl) == "object")
    {
      var documentHandlerName = WebForm.DocumentHandlerNames["OnClick"];
      if (documentHandlerName != null)
      {
        for (var i = 0; i < documentHandlerName.HandlerCalls.length; i++)
        {
          var handlerCall = documentHandlerName.HandlerCalls[i];
          eval(handlerCall);
        }
      }
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "document_onclick", "Section1")
  }
}
document.onclick = document_onclick;

/* ============================ GTWebMessage.js ===========================*/
function LoadWebMessage()
{
  try
  {
    window.WebMessage = new WebMessageClass();
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "LoadWebMessage", "")
  }
}

function EnsureWebMessage()
{
  try
  {
    if (typeof(window.WebMessage) == "undefined")
    {
      LoadWebMessage();
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "EnsureWebMessage", "")
  }
}

function WebMessageClass()
{
  try
  {
    EnsureIlp();
    
    this.oMessageResponseDoc = Ilp.XmlDom.CreateXmlDom();
    this.oMessageResponseDoc2 = Ilp.XmlDom.CreateXmlDom();

    Ilp.XmlDom.SetSelectionNamespacesDefault(this.oMessageResponseDoc);
    Ilp.XmlDom.SetSelectionNamespacesDefault(this.oMessageResponseDoc2);

    this.WebDataErrorList = new WebArray();
    this.WebDataUnsavedList = new WebArray();
    this.IsWebApplication = true;
    this.IsAlertEnabled = false;
    this.ExchangeTransferDataSet = false;

    this.ClientStartOfProcessing = new Date();

    this.oWM_XMLHTTP = null;
    this.oXsltScaleMessage = null;

    this.EnsureXMLHTTP = WebMessage_EnsureXMLHTTP;
    this.GetSoapEnvelope = WebMessage_GetSoapEnvelope;
    this.ExitsErrors = WebMessage_ExitsErrors;

    this.GetClipboard = WebMessage_GetClipboard;
    this.ClearClipboard = WebMessage_ClearClipboard;
    this.GetClipboardRecords = WebMessage_GetClipboardRecords;
    this.GetClipboardData = WebMessage_GetClipboardData;
    this.SetClipboardData = WebMessage_SetClipboardData;
    
    this.Exchange = WebMessage_Exchange;
    this.PageData = WebMessage_PageData;
    this.SaveData = WebMessage_SaveData;
    this.DeleteReferentialData = WebMessage_DeleteReferentialData;
    this.CallWebService = WebMessage_CallWebService;
    this.CallWebMethod = WebMessage_CallWebMethod;
    this.CallWebMethod2 = WebMessage_CallWebMethod2;
    this.CallWebMethod3 = WebMessage_CallWebMethod3;
    this.CallWebMethod4 = WebMessage_CallWebMethod4;
    this.CallWebMethod5 = WebMessage_CallWebMethod5;
    this.CheckAuthentication = WebMessage_CheckAuthentication;
    this.GetRecord = WebMessage_GetRecord;
    this.GetServiceUrl = WebMessage_GetServiceUrl;

    this.GetDefaultInfoItem = WebMessage_GetDefaultInfoItem;
    this.HasDefaultInfoItem = WebMessage_HasDefaultInfoItem;
    this.GetDefaultValue = WebMessage_GetDefaultValue;

    this.GetKpiDescriptor = WebMessage_GetKpiDescriptor;
    this.InitKpiDescriptor = WebMessage_InitKpiDescriptor;
    this.SetKpiDescriptor = WebMessage_SetKpiDescriptor;
    this.SaveKpiDescriptor = WebMessage_SaveKpiDescriptor;
    this.AddKpiLogEntry = WebMessage_AddKpiLogEntry;

    this.GetWebSpreadSheetInfo = WebMessage_GetWebSpreadSheetInfo;
    this.SetWebSpreadSheetInfo = WebMessage_SetWebSpreadSheetInfo;
    this.GetWebSpreadSheetDescriptor = WebMessage_GetWebSpreadSheetDescriptor;
    this.SetWebSpreadSheetDescriptor = WebMessage_SetWebSpreadSheetDescriptor;
    this.GetWebTableExportDescriptor = WebMessage_GetWebTableExportDescriptor;
    this.SetWebTableExportDescriptor = WebMessage_SetWebTableExportDescriptor;

    this.GetSearchInfo = WebMessage_GetSearchInfo;
    this.GetSearchInfoXml = WebMessage_GetSearchInfoXml;
    this.SetSearchInfo = WebMessage_SetSearchInfo;
    this.GetReportDescriptor = WebMessage_GetReportDescriptor;
    this.GetUploadParam = WebMessage_GetUploadParam;
    this.GetSearchInfoItemList = WebMessage_GetSearchInfoItemList;
    this.ExiststSearchInfoItem = WebMessage_ExiststSearchInfoItem;
    this.GetPagingInfoItemList = WebMessage_GetPagingInfoItemList;
    this.GetPagingInfoItemByFqn = WebMessage_GetPagingInfoItemByFqn;
    this.GetReportParam = WebMessage_GetReportParam;
    this.InitSearchInfo = WebMessage_InitSearchInfo;
    this.InitReportDescriptor = WebMessage_InitReportDescriptor;
    this.AddSearchInfoItem = WebMessage_AddSearchInfoItem;
    this.AddSearchInfoTable = WebMessage_AddSearchInfoTable;
    this.RemoveSearchInfoItem = WebMessage_RemoveSearchInfoItem;
    this.AddCopyInfo = WebMessage_AddCopyInfo;
    this.AddSendMailInfo = WebMessage_AddSendMailInfo;
    this.AddReportDescriptor = WebMessage_AddReportDescriptor;
    this.AddReportParam = WebMessage_AddReportParam;
    this.SetMasterdataInfo = WebMessage_SetMasterdataInfo;
    this.GetMasterdataInfo = WebMessage_GetMasterdataInfo;
    this.AddSelSearchInfo = WebMessage_AddSelSearchInfo;
    this.AddDeleteInfo = WebMessage_AddDeleteInfo;
    this.MergeReportDescriptor = WebMessage_MergeReportDescriptor;
    this.MergeMasterdataInfo = WebMessage_MergeMasterdataInfo;

    this.AddPagingInfoItemToGeneralInfo = WebMessage_AddPagingInfoItemToGeneralInfo;
    this.AddPagingInfoItem = WebMessage_AddPagingInfoItem;
    this.MergePagingInfo = WebMessage_MergePagingInfo;
    this.AddPagingInfo = WebMessage_AddPagingInfo;
    this.InitPagingInfo = WebMessage_InitPagingInfo;
    this.DeletePagingInfoByTdFqn = WebMessage_DeletePagingInfoByTdFqn;

    this.SetReportDescriptor = WebMessage_SetReportDescriptor;
    this.ExportReport = WebMessage_ExportReport;
    this.ShowDownloadFile = WebMessage_ShowDownloadFile;
    this.MailFile = WebMessage_MailFile;
    this.ExportToExcel = WebMessage_ExportToExcel;
    this.LaunchReport = WebMessage_LaunchReport;
    this.ShowReport = WebMessage_ShowReport;
    this.MailReport = WebMessage_MailReport;

    this.GetXml = WebMessage_GetXml;
    this.Tidy = WebMessage_Tidy;
    this.GetXmlSmall = WebMessage_GetXmlSmall;

    this.SetGeneralInfoAttribute = WebMessage_SetGeneralInfoAttribute;
    this.GetGeneralInfoAttribute = WebMessage_GetGeneralInfoAttribute;
    this.GetRecordByRowOrder = WebMessage_GetRecordByRowOrder;
    this.GetRecordByDiffgramId = WebMessage_GetRecordByDiffgramId;
    this.GetRecordByIlpId = WebMessage_GetRecordByIlpId;
    this.GetTableDescriptorFqnList = WebMessage_GetTableDescriptorFqnList;
    this.AddTableDescriptorFqn = WebMessage_AddTableDescriptorFqn;
    this.InitTableDescriptorFqnList = WebMessage_InitTableDescriptorFqnList;
    this.AddDataTableRelationDescriptorFqn = WebMessage_AddDataTableRelationDescriptorFqn;
    this.InitDataTableRelationDescriptorFqnList = WebMessage_InitDataTableRelationDescriptorFqnList;

    this.SendMail = WebMessage_SendMail;
    this.ClientLogSend = false;
    this.SendingClientLog = false;
    this.SendClientLog = WebMessage_SendClientLog;
    this.SaveWebMessageSmall = WebMessage_SaveWebMessageSmall;
    this.SaveWebMessageTransfer = WebMessage_SaveWebMessageTransfer;
    this.StoreWebMessageTransfer = WebMessage_StoreWebMessageTransfer;

    this.ReplaceToken = WebMessage_ReplaceToken;

    this.SearchInfoSave = WebMessage_SearchInfoSave;
    this.SearchInfoRestore = WebMessage_SearchInfoRestore;
    this.ShowChangeHistory = WebMessage_ShowChangeHistory;
    this.AddAttachmentItem = WebMessage_AddAttachmentItem;
    this.GetSendMailInfo = WebMessage_GetSendMailInfo;
    this.InitSendMailInfo = WebMessage_InitSendMailInfo;
    this.GetLoaderDescriptor = WebMessage_GetLoaderDescriptor;
    this.GetResponseLoaderDescriptor = WebMessage_GetResponseLoaderDescriptor;


    this.ShowXmlDoc = WebMessage_ShowXmlDoc;
    this.GetXmlDoc = WebMessage_GetXmlDoc;

    this.SoapMessageSend = "";

    this.ExistsWebServiceError = false;

    this.RootID = this.GetGeneralInfoAttribute("RootID");
    this.RemoveNoUpdatables = true;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "LoadWebMessage", "")
  }
}


function WebMessage_SaveWebMessageSmall()
{
  try
  {
    var webMessage = "";
    var webEnvelope = "";
    var webServiceUrl = "";

    WebMessage.EnsureXMLHTTP();

    this.SetGeneralInfoAttribute("FunctionCall", "SaveWebMessageSmall");

    webServiceUrl = this.GetServiceUrl();
    webMessage = this.GetXmlSmall();
    webEnvelope = this.GetSoapEnvelope(webMessage);

    this.oWM_XMLHTTP.open("POST", webServiceUrl, false);
    this.oWM_XMLHTTP.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
    this.oWM_XMLHTTP.setRequestHeader("Content-Length", webEnvelope.length);
    this.oWM_XMLHTTP.setRequestHeader("SOAPAction", "http://ilp.de/webservices/ApplyRequestBroker");

    this.oWM_XMLHTTP.send(webEnvelope);

    this.oMessageResponseDoc.loadXML(Ilp.XmlDom.GetResponseText(this.oWM_XMLHTTP));

    var oGeneralInfo = null;
    var IDSessionInfo = 0;
    var oSoapError = WebMessage.oMessageResponseDoc.documentElement.selectSingleNode("//soap:Fault");
    if (oSoapError != null)
    {
      var oFaultstring = WebMessage.oMessageResponseDoc.documentElement.selectSingleNode("//soap:Fault/faultstring");
      if (WebMessage) WebMessage.SendClientLog(null, "WebMessage_SaveWebMessageSmall", oFaultstring.text);
    }
    else
    {
      var oGeneralInfo = this.oMessageResponseDoc.documentElement.selectSingleNode("//ilp:GeneralInfo");
      var IDSessionInfo = Number(oGeneralInfo.getAttribute("IDSessionInfo"));
    }

    this.SetGeneralInfoAttribute("IDSessionInfo", IDSessionInfo);
    return IDSessionInfo;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_SaveWebMessageSmall", "")
  }
}

function WebMessage_SaveWebMessageTransfer()
{
  try
  {
    var webMessage = "";
    var webEnvelope = "";
    var webServiceUrl = "";

    WebMessage.EnsureXMLHTTP();

    this.SetGeneralInfoAttribute("FunctionCall", "SaveWebMessageTransfer");

    webServiceUrl = this.GetServiceUrl();
    webMessage = this.GetXmlSmall();
    webEnvelope = this.GetSoapEnvelope(webMessage);

    this.oWM_XMLHTTP.open("POST", webServiceUrl, false);
    this.oWM_XMLHTTP.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
    this.oWM_XMLHTTP.setRequestHeader("Content-Length", webEnvelope.length);
    this.oWM_XMLHTTP.setRequestHeader("SOAPAction", "http://ilp.de/webservices/ApplyRequestBroker");

    this.oWM_XMLHTTP.send(webEnvelope);

    this.oMessageResponseDoc.loadXML(Ilp.XmlDom.GetResponseText(this.oWM_XMLHTTP));

    var oGeneralInfo = null;

    this.SetGeneralInfoAttribute("IDSessionInfo", 0);
    this.SetGeneralInfoAttribute("IDWebMessageTransfer", 0);

    var oSoapError = WebMessage.oMessageResponseDoc.documentElement.selectSingleNode("//soap:Fault");
    if (oSoapError != null)
    {
      var oFaultstring = WebMessage.oMessageResponseDoc.documentElement.selectSingleNode("//soap:Fault/faultstring");
      if (WebMessage) WebMessage.SendClientLog(null, "WebMessage_SaveWebMessageTransfer", oFaultstring.text);
    }
    else
    {
      this.StoreWebMessageTransfer();
    }

    return this.GetGeneralInfoAttribute("IDWebMessageTransfer");
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_SaveWebMessageTransfer", "")
  }
}

function WebMessage_StoreWebMessageTransfer()
{
  try
  {
    var oGeneralInfo = this.oMessageResponseDoc.documentElement.selectSingleNode("//ilp:GeneralInfo");
    var IDWebMessageTransfer = Number(oGeneralInfo.getAttribute("IDWebMessageTransfer"));
    var IDSessionInfo = Number(oGeneralInfo.getAttribute("IDSessionInfo"));

    this.SetGeneralInfoAttribute("IDSessionInfo", IDSessionInfo);
    this.SetGeneralInfoAttribute("IDWebMessageTransfer", IDWebMessageTransfer);
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_StoreWebMessageTransfer", this)
  }
}

function WebMessage_EnsureXMLHTTP()
{
  try
  {
    if(this.oWM_XMLHTTP == null)
    {
      this.oWM_XMLHTTP = Ilp.XmlDom.CreateXmlHttp();
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_EnsureXMLHTTP", "")
  }
}

function WebMessage_GetSoapEnvelope(webMessage, webMethode)
{
  try
  {
    var webEnvelope = "";

    webMethode = webMethode == null ? "ApplyRequestBroker" : webMethode;

    webEnvelope += "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
    webEnvelope += "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"
    webEnvelope += "  <soap:Body>"
    webEnvelope += "    <" + webMethode + " xmlns=\"http://ilp.de/webservices/\">"
    webEnvelope += webMessage;
    webEnvelope += "    </" + webMethode + ">";
    webEnvelope += "  </soap:Body>";
    webEnvelope += "</soap:Envelope>";

    return webEnvelope;
  }
  catch(exception){
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_GetSoapEnvelope", "")
  }
}

function WebMessage_ExitsErrors(xmlDocument)
{
  try
  {
    var exitsErrors = false;
    var errorText = "";

    if (Ilp.XmlDom.HasParseError(xmlDocument) == true)
    {
      errorText = Ilp.XmlDom.GetParseErrorText(xmlDocument);
      if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_ExitsErrors:ParseError", errorText, null);
      exitsErrors = true;
    }
    else
    {
      var oSoapError = xmlDocument.documentElement.selectSingleNode("//soap:Fault");
      if (oSoapError != null)
      {
        var oFaultstring = xmlDocument.documentElement.selectSingleNode("//soap:Fault/faultstring");
        errorText = Ilp.XmlDom.GetXml(xmlDocument);

        if (WebMessage) WebMessage.SendClientLog(null, "WebMessage_ExitsErrors:SoapError", errorText, null);
        exitsErrors = true;
      }

      this.WebDataErrorList.Clear();
      var oDiffGramError = xmlDocument.documentElement.selectSingleNode("//diffgr:errors");
      if (oDiffGramError != null)
      {
        var errorText = "";
        for (var i = 0; i < oDiffGramError.childNodes.length; i++)
        {
          var oNode = oDiffGramError.childNodes[i];

          var oRecord = this.oMessageResponseDoc.selectSingleNode("//*[@diffgr:hasErrors and @diffgr:id='" + WebData.GetDiffgramId(oNode) + "']");

          var webDataErrorDescriptor = new WebDataErrorDescriptor(WebData.GetDiffgramId(oRecord), WebData.GetIlpId(oRecord), oNode.getAttribute("diffgr:Error"), "SqlError");
          this.WebDataErrorList.Add(webDataErrorDescriptor);

          errorText += "\n" + webDataErrorDescriptor.DiffgramId + ": " + webDataErrorDescriptor.ErrorText;
        }
        var oSelectedList = this.oMessageResponseDoc.selectNodes("//*[@diffgr:hasChanges and not(@diffgr:hasErrors)]");
        for (var i = 0, len = oSelectedList.length; i < len; i++)
        {
          var oNode = oSelectedList[i];
          var webDataErrorDescriptor = new WebDataErrorDescriptor(WebData.GetDiffgramId(oNode), WebData.GetIlpId(oNode), "The record was not saved.", "NotSaved");
          this.WebDataErrorList.Add(webDataErrorDescriptor);
        }
        exitsErrors = true;
      }

      if (exitsErrors == false)
      {
        var oGeneralInfo = this.oMessageResponseDoc.documentElement.selectSingleNode("//ilp:WebMessage/ilp:GeneralInfo");
        if (oGeneralInfo != null)
        {
          var authenticationStatus = oGeneralInfo.getAttribute("AuthenticationStatus");
          authenticationStatus = authenticationStatus == null ? "None" : authenticationStatus;
          if (authenticationStatus != "None")
          {
            if (authenticationStatus == "MaintenanceLogin")
            {
              var maintenanceLoginUrl = oGeneralInfo.getAttribute("MaintenanceLoginUrl");
              if (window.top.location.href.indexOf(maintenanceLoginUrl) == -1)
              {
                if (WebData) WebData.HasChanged = false;
                WebFrameGoToLogin(null, maintenanceLoginUrl);
                return true;
              }
            }

            if (WebMessage.EvalAuthenticationStatus == false)
            {
              WebMessage.EvalAuthenticationStatus = true;
            }
            else
            {
              exitsErrors = true;
              WebFrameGoToLogin();
            }
          }
        }
      }
    }

    return exitsErrors;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_ExitsErrors", "")
  }
}

function WebMessage_Exchange(sendData, exchangeData, async, removePagingInfoItems, useResponseDoc2)
{
  try
  {
    var webMessage = "";
    var webEnvelope = "";
    var webServiceUrl = "";

    WebMessage.EnsureXMLHTTP();

    sendData = sendData == null ? true : sendData;
    exchangeData = exchangeData == null ? true : exchangeData;
    async = async == null ? false : async;
    removePagingInfoItems = removePagingInfoItems == null ? false : removePagingInfoItems;
    useResponseDoc2 = useResponseDoc2 == null ? false : useResponseDoc2;

    if (sendData == true)
    {
      webMessage = this.GetXml(true);
    }
    else
    {
      webMessage = this.GetXmlSmall(removePagingInfoItems);
    }
    webServiceUrl = this.GetServiceUrl();
    webEnvelope = this.GetSoapEnvelope(webMessage);

    if (async == true)
    {
      Ilp.XmlDom.SetOnReadyStateChange(this.oWM_XMLHTTP, WebMessage_OnReadyStateChangeHandler);
    }

    WebControl.AddKpiLogMessage(new Date(), "WebMessage_Exchange.1", "Size of request: " + String(webEnvelope.length));

    this.oWM_XMLHTTP.open("POST", webServiceUrl, async);
    this.oWM_XMLHTTP.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
    this.oWM_XMLHTTP.setRequestHeader("Content-Length", webEnvelope.length);
    this.oWM_XMLHTTP.setRequestHeader("SOAPAction", "http://ilp.de/webservices/ApplyRequestBroker");

    this.oWM_XMLHTTP.send(webEnvelope);

    if (async == false)
    {
      var oResponseDoc = this.oMessageResponseDoc;
      if (useResponseDoc2 == true) oResponseDoc = this.oMessageResponseDoc2;
      
      oResponseDoc.loadXML(Ilp.XmlDom.GetResponseText(this.oWM_XMLHTTP));
      var exitsError = this.ExitsErrors(oResponseDoc);

      WebControl.AddKpiLogMessage(new Date(), "WebMessage_Exchange.2", "Size of returned data: " + String(Ilp.XmlDom.GetResponseTextLength(this.oWM_XMLHTTP)));

      exchangeData = exchangeData && (exitsError == false);
      if (sendData == true)
      {
        if (exchangeData == true)
        {
          if (this.ExchangeTransferDataSet == true)
          {
            var oNew = oResponseDoc.documentElement.selectSingleNode("//ilp:TransferDataSet");
            var oWeb = WebData.oMessageDoc.selectSingleNode("//ilp:WebMessage");
            var oOld = WebData.oMessageDoc.selectSingleNode("//ilp:TransferDataSet");
            oWeb.insertBefore(oNew.cloneNode(true), oOld);
            oWeb.removeChild(oOld);
            WebData.Refresh();
          }
          else
          {
            WebData.Transfer();
          }
        }
      }

      if (exitsError == false)
      {
        var oNewReportDescriptor = oResponseDoc.documentElement.selectSingleNode("//ilp:ReportDescriptor");
        this.MergeReportDescriptor(oNewReportDescriptor);

        var oNewPagingInfo = oResponseDoc.documentElement.selectSingleNode("//ilp:WebMessage/ilp:PagingInfo");
        this.MergePagingInfo(oNewPagingInfo);
      }

      this.InitTableDescriptorFqnList();
      this.ExchangeTransferDataSet = false;
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_Exchange", "Section1")
  }
}

function WebMessage_OnReadyStateChangeHandler()
{
  try
  {
    if (Ilp.XmlDom.GetReadyState(WebMessage.oWM_XMLHTTP) == 4)
    {
      this.oMessageResponseDoc.loadXML(Ilp.XmlDom.GetResponseText(this.oWM_XMLHTTP));
      var hasError = this.ExitsErrors(WebMessage.oMessageResponseDoc);
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_OnReadyStateChangeHandler", "Section1")
  }
}

function WebMessage_PageData()
{
  try
  {
    var webMessage = "";
    var webEnvelope = "";
    var webServiceUrl = "";

    WebMessage.EnsureXMLHTTP();

    this.SetGeneralInfoAttribute("FunctionCall", "PageWebData");
    webServiceUrl = this.GetServiceUrl();
    webMessage = this.GetXmlSmall(false);
    webEnvelope = this.GetSoapEnvelope(webMessage);

    this.oWM_XMLHTTP.open("POST", webServiceUrl, false);
    this.oWM_XMLHTTP.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
    this.oWM_XMLHTTP.setRequestHeader("Content-Length", webEnvelope.length);
    this.oWM_XMLHTTP.setRequestHeader("SOAPAction", "http://ilp.de/webservices/ApplyRequestBroker");

    this.oWM_XMLHTTP.send(webEnvelope);

    this.oMessageResponseDoc.loadXML(Ilp.XmlDom.GetResponseText(this.oWM_XMLHTTP));
    var exitsErrors = this.ExitsErrors(WebMessage.oMessageResponseDoc);
    if (exitsErrors == false)
    {
      this.AddPagingInfo();
      WebData.TransferPage();
    }

    return exitsErrors;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_PageData", "")
  }
}

function WebMessage_SaveData()
  {
  try
  {
    var webMessage = "";
    var webEnvelope = "";
    var webServiceUrl = "";

    WebMessage.EnsureXMLHTTP();

    this.SetGeneralInfoAttribute("FunctionCall", "SaveWebData");
    webServiceUrl = this.GetServiceUrl();
    webMessage = this.GetXml(true, "Save");
    webEnvelope = this.GetSoapEnvelope(webMessage);

    this.SoapMessageSend = webEnvelope;
    this.oWM_XMLHTTP.open("POST", webServiceUrl, false);
    this.oWM_XMLHTTP.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
    this.oWM_XMLHTTP.setRequestHeader("Content-Length", webEnvelope.length);
    this.oWM_XMLHTTP.setRequestHeader("SOAPAction", "http://ilp.de/webservices/ApplyRequestBroker");

    this.oWM_XMLHTTP.send(webEnvelope);

    this.oMessageResponseDoc.loadXML(Ilp.XmlDom.GetResponseText(this.oWM_XMLHTTP));
    var exitsErrors = this.ExitsErrors(WebMessage.oMessageResponseDoc);

    return exitsErrors;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_SaveData", "Section1")
  }
}

function WebMessage_DeleteReferentialData()
{
  try
  {
    var webMessage = "";
    var webEnvelope = "";
    var webServiceUrl = "";
    var deleteInfoReturn = "";

    WebMessage.EnsureXMLHTTP();

    this.SetGeneralInfoAttribute("FunctionCall", "DeleteReferentialData");
    webServiceUrl = this.GetServiceUrl();
    webMessage = this.GetXml();
    webEnvelope = this.GetSoapEnvelope(webMessage);

    this.oWM_XMLHTTP.open("POST", webServiceUrl, false);
    this.oWM_XMLHTTP.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
    this.oWM_XMLHTTP.setRequestHeader("Content-Length", webEnvelope.length);
    this.oWM_XMLHTTP.setRequestHeader("SOAPAction", "http://ilp.de/webservices/ApplyRequestBroker");

    this.oWM_XMLHTTP.send(webEnvelope);

    this.oMessageResponseDoc.loadXML(Ilp.XmlDom.GetResponseText(this.oWM_XMLHTTP));

    var exitsErrors = this.ExitsErrors(WebMessage.oMessageResponseDoc);
    if (exitsErrors == false)
    {
      var oDeleteInfo = this.oMessageResponseDoc.documentElement.selectSingleNode("//ilp:WebMessage/ilp:DeleteInfo");
      deleteInfoReturn = oDeleteInfo.getAttribute("DeleteInfoReturn");
      deleteInfoReturn = deleteInfoReturn == null ? "" : deleteInfoReturn;
      if (deleteInfoReturn == "Error")
      {
        var deleteInfoMessage = oDeleteInfo.getAttribute("DeleteInfoMessage");
        if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_DeleteReferentialData", deleteInfoMessage == null ? "" : deleteInfoMessage);
        exitsErrors = true;
      }
    }

    return deleteInfoReturn;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_DeleteReferentialData", "Section1")
  }
}


function WebMessage_ExportToExcel(version)
{
  try
  {
    var webMessage = "";
    var webEnvelope = "";
    var webServiceUrl = "";
    var webMethod = "";

    WebMessage.EnsureXMLHTTP();

    if (version == "2") webMethod = "ExportToExcel2";
    else if (version == "3") webMethod = "ExportToExcel3";
    else webMethod = "ExportToExcel";
    
    this.SetGeneralInfoAttribute("FunctionCall", webMethod);
    webServiceUrl = this.GetServiceUrl();
    webMessage = this.GetXml();
    webEnvelope = this.GetSoapEnvelope(webMessage);

    this.oWM_XMLHTTP.open("POST", webServiceUrl, false);
    this.oWM_XMLHTTP.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
    this.oWM_XMLHTTP.setRequestHeader("Content-Length", webEnvelope.length);
    this.oWM_XMLHTTP.setRequestHeader("SOAPAction", "http://ilp.de/webservices/ApplyRequestBroker");

    this.oWM_XMLHTTP.send(webEnvelope);

    this.oMessageResponseDoc.loadXML(Ilp.XmlDom.GetResponseText(this.oWM_XMLHTTP));
    var exitsErrors = this.ExitsErrors(WebMessage.oMessageResponseDoc);

    return exitsErrors;
  }
  catch(exception){
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_ExportToExcel", "Section1")
  }
}

function WebMessage_FormatParseError(error, message)
{
  try{
    var s = "";
    for (var i=1; i<error.linepos; i++) {
      s += " ";
    }
    r = "<font face=Verdana size=2><font size=4>XML Error loading (" + message + ") '" +
        error.url + "'</font>" +
        "<P><B>" + error.reason +
        "</B></P></font>";
    if (error.line > 0)
      r += "<font size=3><XMP>" +
      "at line " + error.line + ", character " + error.linepos +
      "\n" + error.srcText +
      "\n" + s + "^" +
      "</XMP></font>";
    return r;
  }
  catch (exception){
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_FormatParseError", "Section1")
  }
}

function WebMessage_CallWebService(webMethode, webArgument, webServiceUrl, async)
{
  try
  {
    var webMessage = "";
    var webEnvelope = "";

    this.EnsureXMLHTTP();

    async = async == null ? false : async;
    webServiceUrl = webServiceUrl == null ? this.GetServiceUrl() : webServiceUrl;

    webEnvelope += "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
    webEnvelope += "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"
    webEnvelope += "  <soap:Body>"
    webEnvelope += "    <" + webMethode + " xmlns=\"http://ilp.de/webservices/\">"
    webEnvelope += webArgument;
    webEnvelope += "    </" + webMethode + ">";
    webEnvelope += "  </soap:Body>";
    webEnvelope += "</soap:Envelope>";

    this.SoapMessageSend = webEnvelope;

    if (async == true)
    {
      Ilp.XmlDom.SetOnReadyStateChange(this.oWM_XMLHTTP, WebMessage_CallWebServiceORSCHandler);
    }

    this.oWM_XMLHTTP.open("POST", webServiceUrl, false);
    this.oWM_XMLHTTP.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
    this.oWM_XMLHTTP.setRequestHeader("Content-Length", webEnvelope.length);
    this.oWM_XMLHTTP.setRequestHeader("SOAPAction", "http://ilp.de/webservices/" + webMethode);

    this.oWM_XMLHTTP.send(webEnvelope);

    if (async == false)
    {
      this.oMessageResponseDoc.loadXML(Ilp.XmlDom.GetResponseText(this.oWM_XMLHTTP));

      this.ExistsWebServiceError = this.ExitsErrors(WebMessage.oMessageResponseDoc);

      if (this.ExistsWebServiceError == true)
      {
        return null;
      }
      else
      {
        return this.oMessageResponseDoc;
      }
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_CallWebService", "Section1")
  }
}

function WebMessage_CallWebServiceORSCHandler()
{
  try
  {
    if (Ilp.XmlDom.GetReadyState(WebMessage.oWM_XMLHTTP1) == 4)
    {
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_CallWebServiceORSCHandler", "Section1")
  }
}

function WebMessage_CallWebMethod(webMethode, parameterName, parameterValue, mode)
{
  try
  {
    mode = mode == null ? "CallWebMethod" : mode;
    
    var result = null;
    var webArgument = WebMessage.GetXml(true, mode);
    if (parameterName != null)
    {
      webArgument += "<" + parameterName + ">";
      webArgument += parameterValue;
      webArgument += "</" + parameterName + ">";
    }

    var webMethodReponse =  WebMessage.CallWebService(webMethode, webArgument);
    if (webMethodReponse)
    {
      var xPath = "/soap:Envelope/soap:Body/ilp:" + webMethode + "Response/ilp:WebMessage/ilp:Result";
      var oResult = webMethodReponse.selectSingleNode(xPath);
      if (oResult)
      {
        result = oResult.text;
      }
      else
      {
        var xPath = "/soap:Envelope/soap:Body/ilp:" + webMethode + "Response/ilp:WebMessage/ilp:GeneralInfo";
        var oGeneralInfo = webMethodReponse.selectSingleNode(xPath);
        if (oGeneralInfo) result = oGeneralInfo.getAttribute("Result");
      }
    }

    return result;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_CallWebMethod", webMethode)
  }
}

function WebMessage_CallWebMethod2(webMethode, webArgument, webServiceUrl, async, mode)
{
  try
  {
    mode = mode == null ? "CallWebMethod2" : mode;

    var result = null;
    webArgument = WebMessage.GetXml(true, mode) + webArgument;

    async = async == null ? false : async;
    webServiceUrl = webServiceUrl == null ? this.GetServiceUrl() : webServiceUrl;

    var webMethodReponse =  WebMessage.CallWebService(webMethode, webArgument, webServiceUrl, async);

    if (async == false)
    {
      if (webMethodReponse)
      {
        var xPath = "/soap:Envelope/soap:Body/ilp:" + webMethode + "Response/ilp:WebMessage/ilp:Result";
        var oResult = webMethodReponse.selectSingleNode(xPath);
        if (oResult)
        {
          result = oResult.text;
        }
        else
        {
          var xPath = "/soap:Envelope/soap:Body/ilp:" + webMethode + "Response/ilp:WebMessage/ilp:GeneralInfo";
          var oGeneralInfo = webMethodReponse.selectSingleNode(xPath);
          if (oGeneralInfo) result = oGeneralInfo.getAttribute("Result");
        }
      }
    }

    return result;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_CallWebMethod2", webMethode)
  }
}

function WebMessage_CallWebMethod3(webMethode, webArgument, async)
{
  try
  {
    var result = null;
    webArgument = WebMessage.GetXml(true, "CallWebMethod3") + webArgument;

    var webMethodReponse =  WebMessage.CallWebService(webMethode, webArgument, null, async);
    if (webMethodReponse)
    {
      var xPath = "/soap:Envelope/soap:Body/ilp:" + webMethode + "Response/ilp:WebMessage/ilp:Result";
      var oResult = webMethodReponse.selectSingleNode(xPath);
      if (oResult)
      {
        result = oResult.text;
      }
      else
      {
        var xPath = "/soap:Envelope/soap:Body/ilp:" + webMethode + "Response/ilp:WebMessage/ilp:GeneralInfo";
        var oGeneralInfo = webMethodReponse.selectSingleNode(xPath);
        if (oGeneralInfo) result = oGeneralInfo.getAttribute("Result");
      }
    }

    return result;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_CallWebMethod3", webMethode)
  }
}


function WebMessage_CallWebMethod4(webMethode, webArgument, webServiceUrl, async)
{
  try
  {
    var result = null;

    async = async == null ? false : async;
    webServiceUrl = webServiceUrl == null ? this.GetServiceUrl() : webServiceUrl;

    var webMethodReponse =  WebMessage.CallWebService(webMethode, webArgument, webServiceUrl, async);
    if (async == false)
    {
      if (webMethodReponse)
      {
        var xPath = "/soap:Envelope/soap:Body/ilp:" + webMethode + "Response/ilp:WebMessage/ilp:Result";
        var oResult = webMethodReponse.selectSingleNode(xPath);
        if (oResult)
        {
          result = oResult.text;
        }
        else
        {
          var xPath = "/soap:Envelope/soap:Body/ilp:" + webMethode + "Response/ilp:WebMessage/ilp:GeneralInfo";
          var oGeneralInfo = webMethodReponse.selectSingleNode(xPath);
          if (oGeneralInfo) result = oGeneralInfo.getAttribute("Result");
        }
      }
    }
    return result;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_CallWebMethod2", webMethode)
  }
}

//Zum Aufruf von TomCom WebServices, da diese keine WebMessage als Rückgabe haben
//sondern nur einen einfachen Envelope.
function WebMessage_CallWebMethod5(webMethode, webArgument, webServiceUrl, async)
{
  try
  {
    var result = null;

    async = async == null ? false : async;
    webServiceUrl = webServiceUrl == null ? this.GetServiceUrl() : webServiceUrl;

    var webMethodReponse =  WebMessage.CallWebService(webMethode, webArgument, webServiceUrl, async);
    if (async == false)
    {
      if (webMethodReponse)
      {
        result = webMethodReponse.text;
      }
    }
    return result;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_CallWebMethod5", webMethode)
  }
}


function WebMessage_CheckAuthentication()
{
  try
  {
    var xPath = "//ilp:GeneralInfo";
    var oGeneralInfo = WebMessage.oMessageResponseDoc.documentElement.selectSingleNode(xPath);
    return oGeneralInfo.getAttribute("AuthenticationStatus") == null;
  }
  catch(exception){
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_CheckAuthentication", "Section1")
  }
}

function WebMessage_GetRecord(tableDescriptorFqn)
{
  try
  {
    var xPath = "//ilp:" + tableDescriptorFqn;

    return WebMessage.oMessageResponseDoc.documentElement.selectSingleNode(xPath);
  }
  catch(exception){
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_GetRecord", "Section1")
  }
}

function WebMessage_GetRecordByRowOrder(tableDescriptorFqn, rowOrder)
{
  try
  {
    // Wird von WebData genutzt...
    var oWebMessage = this.oMessageResponseDoc.documentElement.selectSingleNode("//ilp:WebMessage");
    var xPath = "//" + tableDescriptorFqn + "[@msdata:rowOrder='" + rowOrder + "']";

    return oWebMessage.selectSingleNode(xPath);
  }
  catch(exception){
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_GetRecordByRowOrder", "Section1")
  }
}

function WebMessage_GetRecordByDiffgramId(tableDescriptorFqn, diffgramId)
{
  try
  {
    // Wird von WebData genutzt...
    var oWebMessage = this.oMessageResponseDoc.documentElement.selectSingleNode("//ilp:WebMessage");
    var xPath = "//" + tableDescriptorFqn + "[@diffgr:id='" + diffgramId + "']";

    return oWebMessage.selectSingleNode(xPath);
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_GetRecordByDiffgramId", "Section1")
  }
}

function WebMessage_GetRecordByIlpId(tableDescriptorFqn, ilpId)
{
  try
  {
    var oWebMessage = this.oMessageResponseDoc.documentElement.selectSingleNode("//ilp:WebMessage");
    var xPath = "//" + tableDescriptorFqn + "[@" + ATT_IlpId + "='" + ilpId + "']";

    return oWebMessage.selectSingleNode(xPath);
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_GetRecordByIlpId", "Section1")
  }
}

function WebMessage_AddPagingInfoItemToGeneralInfo(pagingInfoItem)
{
  try
  {
    var newPagingInfoItem = null;
    if (WebData.oMessageDoc != null)
    {
      var oGeneralInfo = WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:GeneralInfo");
      var oldPagingInfoItem = WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:GeneralInfo/ilp:PagingInfoItem");
      var newPagingInfoItem = pagingInfoItem.cloneNode(true);
      oGeneralInfo.appendChild(newPagingInfoItem);
      oGeneralInfo.removeChild(oldPagingInfoItem);
    }
    return newPagingInfoItem;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_AddPagingInfoItemToGeneralInfo", "")
  }
}

function WebMessage_InitPagingInfo()
{
  try
  {
    var oPagingInfo = WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:PagingInfo");
    if (oPagingInfo != null)
    {
      var oPagingInfoItemList = oPagingInfo.selectNodes("ilp:PagingInfoItem");
      var count = oPagingInfoItemList.length;
      for (var i = 0; i < count; i++)
      {
        oPagingInfo.removeChild(oPagingInfoItemList[i]);
      }
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_InitPagingInfo", "Section1")
  }
}

function WebMessage_AddPagingInfoItem(pagingInfoItem)
{
  try
  {
    if (WebData.oMessageDoc != null)
    {
      var oPagingInfo = WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:PagingInfo");
      var oPagingInfoItemList = WebData.oMessageDoc.selectNodes("/ilp:WebMessage/ilp:PagingInfo/ilp:PagingInfoItem");
      var newPagingInfoItem = pagingInfoItem.cloneNode(true);
      newPagingInfoItem.setAttribute("ID", "P" + String(oPagingInfoItemList.length));
      oPagingInfo.appendChild(newPagingInfoItem);
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_AddPagingInfoItem", "")
  }
}

function WebMessage_DeletePagingInfoByTdFqn(tableDescriptorFqn)
{
  try
  {
    if (WebData.oMessageDoc != null)
    {
      var oPagingInfo = WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:PagingInfo");
      var oPagingInfoItemList = WebData.oMessageDoc.selectNodes("/ilp:WebMessage/ilp:PagingInfo/ilp:PagingInfoItem[@TableDescriptorFqn='" + tableDescriptorFqn + "']");
      var count = oPagingInfoItemList.length;
      for (var i = 0; i < count; i++)
      {
        oPagingInfo.removeChild(oPagingInfoItemList[i]);
      }      
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_DeletePagingInfoByTdFqn", "")
  }
}

function WebMessage_SetGeneralInfoAttribute(attributeName, value)
{
  try
  {
    var attributeValue = "";
    if (typeof(WebData) == "object" && WebData.oMessageDoc != null)
    {
      value = value == null ? "" : value;
      var oGeneralInfo = WebData.oMessageDoc.selectSingleNode("//ilp:GeneralInfo");
      if (oGeneralInfo != null)
      {
        oGeneralInfo.setAttribute(attributeName, value);
        attributeValue = oGeneralInfo.getAttribute(attributeName);
      }
    }

    return attributeValue;
  }
  catch(exception){
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_SetGeneralInfoAttribute", "")
  }
}

function WebMessage_GetGeneralInfoAttribute(attributeName)
{
  try
  {
    var attributeValue = "";
    if (typeof(WebData) == "object" && WebData.oMessageDoc != null)
    {
      var oGeneralInfo = WebData.oMessageDoc.selectSingleNode("//ilp:GeneralInfo");
      attributeValue = oGeneralInfo.getAttribute(attributeName);
    }

    return attributeValue;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_GetGeneralInfoAttribute", "")
  }
}

function WebMessage_GetServiceUrl()
{
  try
  {
    var webServiceUrl = "";
    if (typeof(WebData) == "object" && WebData.oMessageDoc != null)
    {
      if (WebData.oMessageDoc != null)
      {
        /*
        webServiceUrl = WebData.oMessageDoc.getAttribute("WebServiceUrl");
        */
        webServiceUrl = Ilp.XmlDom.GetAttributeValue(WebData.oMessageDoc, "WebServiceUrl");
      }
    }

    return webServiceUrl;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_GetServiceUrl", "")
  }
}

function WebMessage_InitSearchInfo(clearSearchInfo)
{
  try
  {
    clearSearchInfo = clearSearchInfo == null ? false : clearSearchInfo;
    if (WebData.oMessageDoc != null)
    {
      var oSearchInfoDoc = this.GetSearchInfo();
      if (oSearchInfoDoc)
      {
        var oSearchInfoItemList = oSearchInfoDoc.selectNodes("ilp:SearchInfoItem");
        if (oSearchInfoItemList != null)
        {
          var count = oSearchInfoItemList.length;
          for (var i = 0; i < count; i++)
          {
            var oSearchInfoItem = oSearchInfoItemList[i];
            if (oSearchInfoItem.getAttribute("IsMandatory") == "true" && clearSearchInfo == false)
            {
            }
            else
            {
              oSearchInfoDoc.removeChild(oSearchInfoItem);
            }
          }
        }
      }
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_InitSearchInfo", "")
  }
}

function WebMessage_RemoveSearchInfoItem(fieldDescriptorFqn)
{
  try
  {
    if (WebData.oMessageDoc != null)
    {
      var oSearchInfo = WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:SearchInfo");
      var oSearchInfoItemList = oSearchInfo.selectNodes("ilp:SearchInfoItem[@FieldDescriptorFqn='" + fieldDescriptorFqn + "']");
      if (oSearchInfoItemList != null)
      {
        var count = oSearchInfoItemList.length;
        for (var i = 0; i < count; i++)
        {
          var oSearchInfoItem = oSearchInfoItemList[i];
          oSearchInfo.removeChild(oSearchInfoItem);
        }
      }
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_RemoveSearchInfoItem", "")
  }
}

function WebMessage_AddSearchInfoTable(searchInfoItemID, tableDescriptorFqn)
{
  try
  {
    if (WebData.oMessageDoc != null)
    {
      var oSearchInfoItem = Ilp.XmlDom.CreateElement(WebData.oMessageDoc, "SearchInfoItem", NS_ilp);
      oSearchInfoItem.setAttribute("SearchInfoItemID", searchInfoItemID);
      oSearchInfoItem.setAttribute("TableDescriptorFqn", tableDescriptorFqn);
      oSearchInfoItem.setAttribute("IsSearchChecked", "true");

      var oSearchInfo = WebData.oMessageDoc.selectSingleNode("//ilp:SearchInfo");
      oSearchInfoItem = oSearchInfo.appendChild(oSearchInfoItem);
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_AddSearchInfoTable", "")
  }
}

function WebMessage_AddSearchInfoItem(ID, fieldDescriptorFqn, fieldValue, operatorType, isMandatory, searchBehavior, text)
{
  try
  {
    var oSearchInfoItem = null;
    if (WebData.oMessageDoc != null)
    {
      if (ID == null)
      {
        var searchInfoItemList = this.GetSearchInfoItemList();
        var searchInfoItemCount = (searchInfoItemList) ? searchInfoItemList.length : 0;
        ID = "S" + String(searchInfoItemCount)
      }

      operatorType = operatorType == null ? "Unknown" : operatorType;
      if (operatorType.length == 0) operatorType = "Unknown";

      isMandatory = isMandatory == null ? false : isMandatory;

      searchBehavior = searchBehavior == null ? "RelatedSearch" : searchBehavior;

      text = text == null ? "" : text;

      oSearchInfoItem = Ilp.XmlDom.CreateElement(WebData.oMessageDoc, "SearchInfoItem", NS_ilp);
      oSearchInfoItem.setAttribute("ID", ID);
      oSearchInfoItem.setAttribute("FieldDescriptorFqn", fieldDescriptorFqn);
      oSearchInfoItem.setAttribute("FieldValue", fieldValue);
      oSearchInfoItem.setAttribute("Text", text);
      oSearchInfoItem.setAttribute("OperatorType", operatorType);
      oSearchInfoItem.setAttribute("IsSearchChecked", "true");
      oSearchInfoItem.setAttribute("IsMandatory", isMandatory);
      oSearchInfoItem.setAttribute("SearchBehavior", searchBehavior);

      var oSearchInfo = this.GetSearchInfo();
      oSearchInfoItem = oSearchInfo.appendChild(oSearchInfoItem);
    }

    return oSearchInfoItem;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_AddSearchInfoItem", "", this.AddSearchInfoItem)
  }
}

function WebMessage_SetSearchInfo(searchInfoXml)
{
  try
  {
    var oSearchInfoNew = Ilp.XmlDom.CreateXmlDom();
    Ilp.XmlDom.SetSelectionNamespacesDefault(oSearchInfoNew);
    oSearchInfoNew.async = false;
    oSearchInfoNew.validateOnParse = false;
    oSearchInfoNew.loadXML(searchInfoXml);
  
    var oSearchInfoItemList = oSearchInfoNew.selectNodes("ilp:SearchInfo/ilp:SearchInfoItem");
    if (oSearchInfoItemList != null)
    {
      this.InitSearchInfo();
      var oSearchInfo = this.GetSearchInfo();
    
      var count = oSearchInfoItemList.length;
      for (var i = 0; i < count; i++)
      {
        var oSearchInfoItem = oSearchInfoItemList[i];
        var fdFqn = Ilp.XmlDom.GetAttributeValue(oSearchInfoItem, "FieldDescriptorFqn", "");
        var tdFqn = Ilp.XmlDom.GetAttributeValue(oSearchInfoItem, "TableDescriptorFqn", "");
        
        if (this.ExiststSearchInfoItem(fdFqn, tdFqn) == false)
        {
          oSearchInfo.appendChild(oSearchInfoItem.cloneNode(true));
        }
      }
      
      WebDataSearch.Clear();
      WebDataSearch.ApplySearchInfo();
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_SetSearchInfo", "")
  }
}

function WebMessage_GetSearchInfo()
{
  try
  {
    var oSearchInfo = null;
    if (WebData.oMessageDoc != null)
    {
      oSearchInfo = WebData.oMessageDoc.selectSingleNode("//ilp:SearchInfo");
    }
    return oSearchInfo;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_GetSearchInfo", "")
  }
}

function WebMessage_GetSearchInfoXml()
{
  try
  {
    var searchInfoXml = "";
    if (WebData.oMessageDoc != null)
    {
      var oSearchInfo = WebData.oMessageDoc.selectSingleNode("//ilp:SearchInfo");
      /*
      searchInfoXml = oSearchInfo.xml;
      */
      searchInfoXml = Ilp.XmlDom.GetXml(oSearchInfo);
    }
    return searchInfoXml;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_GetSearchInfoXml", "")
  }
}

function WebMessage_GetPagingInfoItemList(tableDescriptorFqn, parentValueList)
{
  try
  {
    var oPagingInfoItemList = null;
    var xPath = "";
    if (parentValueList == null || parentValueList.length == 0)
    {
      xPath = "//ilp:PagingInfo/ilp:PagingInfoItem[@TableDescriptorFqn='" + tableDescriptorFqn + "']";
    }
    else
    {
      xPath = "//ilp:PagingInfo/ilp:PagingInfoItem[@TableDescriptorFqn='" + tableDescriptorFqn + "' and @ParentValueList='" + parentValueList + "']";
    }
    oPagingInfoItemList = WebData.oMessageDoc.selectNodes(xPath);

    return oPagingInfoItemList;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_GetPagingInfoItemList", "");
  }
}

function WebMessage_GetPagingInfoItemByFqn(fqn)
{
  try
  {
    var oPagingInfoItemList = null;
    var xPath = "//ilp:PagingInfo/ilp:PagingInfoItem[@Fqn='" + fqn + "']";
    oPagingInfoItemList = WebData.oMessageDoc.selectSingleNode(xPath);

    return oPagingInfoItemList;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_GetPagingInfoItemByFqn", "");
  }
}

function WebMessage_ExiststSearchInfoItem(fieldDescriptorFqn, tableDescriptorFqn)
{
  try
  {
    var oSearchInfoItemList;
    var doesExist = false;
    if (typeof(fieldDescriptorFqn) == "string" && fieldDescriptorFqn.length > 0)
    {
      oSearchInfoItemList = this.GetSearchInfoItemList(fieldDescriptorFqn, tableDescriptorFqn);
      doesExist = (oSearchInfoItemList.length > 0);
    }
    else if (typeof(tableDescriptorFqn) == "string" && tableDescriptorFqn.length > 0)
    {
      oSearchInfoItemList = this.GetSearchInfoItemList(fieldDescriptorFqn, tableDescriptorFqn);
      doesExist = (oSearchInfoItemList.length > 0);
    }
    return doesExist;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_ExiststSearchInfoItem", "")
  }
}

function WebMessage_GetSearchInfoItemList(fieldDescriptorFqn, tableDescriptorFqn)
{
  try
  {
    var oSearchInfoItemList = null;
    if (WebData.oMessageDoc != null)
    {
      var xPath = "";
      if (typeof(fieldDescriptorFqn) == "string" && fieldDescriptorFqn.length > 0)
      {
        xPath = "//ilp:SearchInfo/ilp:SearchInfoItem[@FieldDescriptorFqn='" + fieldDescriptorFqn + "']";
      }
      else if (typeof(tableDescriptorFqn) == "string" && tableDescriptorFqn.length > 0)
      {
        xPath = "//ilp:SearchInfo/ilp:SearchInfoItem[@TableDescriptorFqn='" + tableDescriptorFqn + "']";
      }
      else
      {
        xPath = "//ilp:SearchInfo/ilp:SearchInfoItem";
      }
      oSearchInfoItemList = WebData.oMessageDoc.selectNodes(xPath);
    }
    return oSearchInfoItemList;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_GetSearchInfoItemList", "")
  }
}

function WebMessage_GetDefaultInfoItem(key)
{
  try
  {
    var oDefaultInfoItem = null;
    if (WebData.oMessageDoc != null)
    {
      var xPath = "";
      xPath = "//ilp:DefaultInfo/ilp:DefaultInfoItem[@Key='" + key + "']";
      oDefaultInfoItem = WebData.oMessageDoc.selectSingleNode(xPath);
    }
    return oDefaultInfoItem;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_GetDefaultInfoItem", "")
  }
}

function WebMessage_GetWebSpreadSheetInfo()
{
  try
  {
    var oWebSpreadSheetInfo = null;
    if (WebData.oMessageDoc != null)
    {
      oWebSpreadSheetInfo = WebData.oMessageDoc.selectSingleNode("//ilp:WebSpreadSheetInfo");
    }
    return oWebSpreadSheetInfo;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_GetWebSpreadSheetInfo", "")
  }
}

function WebMessage_SetWebSpreadSheetInfo(webSpreadSheet)
{
  try
  {
    var oWebSpreadSheetInfo = this.GetWebSpreadSheetInfo();
    
    var webSpreadSheetContainer = null;
    // Html-Control
    if (Ilp.HtmlDom.IsHtmlElement(webSpreadSheet) == true)
    {
      webSpreadSheetContainer = webSpreadSheet;
    }
    else
    {
      webSpreadSheetContainer = webSpreadSheet.Container;
    }
    
    
    Ilp.Interface.Move(webSpreadSheetContainer, oWebSpreadSheetInfo, "IBindableContainerWebControl");
    Ilp.Interface.Move(webSpreadSheetContainer, oWebSpreadSheetInfo, "ICompositeEditControl");
    Ilp.Interface.Move(webSpreadSheetContainer, oWebSpreadSheetInfo, "IMenuBar");
    Ilp.Interface.Move(webSpreadSheetContainer, oWebSpreadSheetInfo, "IStyledWebControl");
    Ilp.Interface.Move(webSpreadSheetContainer, oWebSpreadSheetInfo, "ICssVersion");
    Ilp.Interface.Move(webSpreadSheetContainer, oWebSpreadSheetInfo, "IPagingLinkControl");
    Ilp.Interface.Move(webSpreadSheetContainer, oWebSpreadSheetInfo, "IHtmlTable");
    Ilp.Interface.Move(webSpreadSheetContainer, oWebSpreadSheetInfo, "IWebSpreadSheet");
    Ilp.Interface.Move(webSpreadSheetContainer, oWebSpreadSheetInfo, "IMouseClick");
    Ilp.Interface.Move(webSpreadSheetContainer, oWebSpreadSheetInfo, "ILogoImageContainer");
    Ilp.Interface.Move(webSpreadSheetContainer, oWebSpreadSheetInfo, "IToggleButtonContainer");
    Ilp.Interface.Move(webSpreadSheetContainer, oWebSpreadSheetInfo, "ISpyButtonContainer");
    Ilp.Interface.Move(webSpreadSheetContainer, oWebSpreadSheetInfo, "IMessageLabelContainer");
    Ilp.Interface.Move(webSpreadSheetContainer, oWebSpreadSheetInfo, "IWebSpreadSheetToolbar");
    Ilp.Interface.Move(webSpreadSheetContainer, oWebSpreadSheetInfo, "ILayout");
    Ilp.Interface.Move(webSpreadSheetContainer, oWebSpreadSheetInfo, "IContextMenu");
    Ilp.Interface.Move(webSpreadSheetContainer, oWebSpreadSheetInfo, "IToolStrip");

    Ilp.Interface.MoveSkin(webSpreadSheetContainer, oWebSpreadSheetInfo);
    
    return oWebSpreadSheetInfo;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_SetWebSpreadSheetInfo", "")
  }
}

function WebMessage_HasDefaultInfoItem(key)
{
  try
  {
    var oDefaultInfoItem = null;
    if (WebData.oMessageDoc != null)
    {
      var xPath = "";
      xPath = "//ilp:DefaultInfo/ilp:DefaultInfoItem[@Key='" + key + "']";
      oDefaultInfoItem = WebData.oMessageDoc.selectSingleNode(xPath);
    }
    return (oDefaultInfoItem != null) ? true : false;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_HasDefaultInfoItem", "")
  }
}

function WebMessage_GetDefaultValue(unitType)
{
  try
  {
    var oDefaultInfoItem = this.GetDefaultInfoItem(unitType);
    return oDefaultInfoItem != null ? oDefaultInfoItem.getAttribute("DefaultValue") : null;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_GetDefaultValue", "")
  }
}


function WebMessage_AddSelSearchInfo(ID, FieldDescriptorFqn, SearchRelationDescriptorFqn)
{
  try
  {
    if (WebData.oMessageDoc != null)
    {
      var oSelSearchInfo = WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:SelSearchInfo");
      oSelSearchInfo.setAttribute("ID", ID);
      oSelSearchInfo.setAttribute("FieldDescriptorFqn", FieldDescriptorFqn);
      oSelSearchInfo.setAttribute("SearchRelationDescriptorFqn", SearchRelationDescriptorFqn);
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_AddSelSearchInfo", "")
  }
}

function WebMessage_GetSelSearchInfo()
{
  try
  {
    var oSelSearchInfo = null;
    if (WebData.oMessageDoc != null)
    {
      oSelSearchInfo = WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:SelSearchInfo");
    }

    return oSelSearchInfo;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_AddSelSearchInfo", "")
  }
}

function WebMessage_AddDeleteInfo(ID, deleteDescriptorFqn, IDValue, Text, tableDescriptorFqn)
{
  try
  {
    var oDeleteInfo = null;

    if (WebData.oMessageDoc != null)
    {
      tableDescriptorFqn = tableDescriptorFqn == null ? "" : tableDescriptorFqn;
      Text = Text == null ? "" : Text;
      oDeleteInfo = WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:DeleteInfo");
      oDeleteInfo.setAttribute("ID", ID);
      oDeleteInfo.setAttribute("DeleteDescriptorFqn", deleteDescriptorFqn);
      oDeleteInfo.setAttribute("IDValue", IDValue);
      oDeleteInfo.setAttribute("TextValue", Text);
      oDeleteInfo.setAttribute("TableDescriptorFqn", tableDescriptorFqn);
    }

    return oDeleteInfo;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_AddDeleteInfo", "")
  }
}

function WebMessage_AddReportDescriptor(ID, IDReportList, TableDescriptorFqn, ReportName, ReportNumber, ReportFileName, SelectionFormula, UseSelectionFormula, ExcelExportClassName, ExcelExportMethodName)
{
  try
  {
    var oReportDescriptor = null;
    if (WebData.oMessageDoc != null)
    {
      UseSelectionFormula = UseSelectionFormula == null ? "true" : UseSelectionFormula;

      oReportDescriptor = WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:ReportDescriptor");
      oReportDescriptor.setAttribute("ID", ID);
      oReportDescriptor.setAttribute("IDReportList", IDReportList);
      oReportDescriptor.setAttribute("TableDescriptorFqn", TableDescriptorFqn);
      oReportDescriptor.setAttribute("ReportName", ReportName);
      oReportDescriptor.setAttribute("ReportNumber", ReportNumber);
      oReportDescriptor.setAttribute("ReportFileName", ReportFileName);
      oReportDescriptor.setAttribute("SelectionFormula", SelectionFormula);
      oReportDescriptor.setAttribute("UseSelectionFormula", UseSelectionFormula);
      if (ExcelExportClassName) oReportDescriptor.setAttribute("ExcelExportClassName", ExcelExportClassName);
      if (ExcelExportMethodName) oReportDescriptor.setAttribute("ExcelExportMethodName", ExcelExportMethodName);
    }

    return oReportDescriptor;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_AddReportDescriptor", "")
  }
}

function WebMessage_InitReportDescriptor()
{
  try
  {
    if (WebData.oMessageDoc != null)
    {
      var reportDescriptor = WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:ReportDescriptor");
      if (reportDescriptor != null)
      {
        var ReportParamList = reportDescriptor.selectNodes("ilp:ReportParam");
        var count = ReportParamList.length;
        for (var i = 0; i < count; i++)
        {
          var oReportParam = ReportParamList[i];
          reportDescriptor.removeChild(oReportParam);
        }
      }
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_InitReportDescriptor", "")
  }
}

function WebMessage_SetMasterdataInfo(MasterdataInfoID, FieldDescriptorFqn, MasterValue, IDExchangejournal, ExchangeTableFqn, JournalTableFqn, OriginalTableFqn, OriginalTablePK)
{
  try
  {
    if (WebData.oMessageDoc != null)
    {
      var oMasterdataInfo = WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:MasterdataInfo");
      oMasterdataInfo.setAttribute("MasterdataInfoID", MasterdataInfoID);
      oMasterdataInfo.setAttribute("FieldDescriptorFqn", FieldDescriptorFqn);
      oMasterdataInfo.setAttribute("MasterValue", MasterValue == null ? "" : MasterValue);
      oMasterdataInfo.setAttribute("IDExchangejournal", IDExchangejournal == null ? 0 : IDExchangejournal);
      oMasterdataInfo.setAttribute("ExchangeTableFqn", ExchangeTableFqn == null ? "" : ExchangeTableFqn);
      oMasterdataInfo.setAttribute("JournalTableFqn", JournalTableFqn == null ? "" : JournalTableFqn);
      oMasterdataInfo.setAttribute("OriginalTableFqn", OriginalTableFqn == null ? "" : OriginalTableFqn);
      oMasterdataInfo.setAttribute("OriginalTablePK", OriginalTablePK == null ? "" : OriginalTablePK);
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_SetMasterdataInfo", "")
  }
}

function WebMessage_MergePagingInfo(pagingInfo)
{
  try
  {
    if (WebData.oMessageDoc != null && pagingInfo != null)
    {
      var oWebMessage = WebData.oMessageDoc.selectSingleNode("//ilp:WebMessage");
      var oldPagingInfo = WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:PagingInfo");
      var newPagingInfo = pagingInfo.cloneNode(true);
      oWebMessage.insertBefore(newPagingInfo, oldPagingInfo);
      oWebMessage.removeChild(oldPagingInfo);
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_MergePagingInfo", "")
  }
}

function WebMessage_AddPagingInfo(pagingInfo)
{
  try
  {
    if (WebData.oMessageDoc != null)
    {
      var oPagingInfoItem = null;
      var oPagingInfoItemList = this.oMessageResponseDoc.documentElement.selectNodes("//ilp:WebMessage/ilp:PagingInfo/ilp:PagingInfoItem");
      var oldPagingInfo = WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:PagingInfo");
      var count = WebData.oMessageDoc.selectNodes("/ilp:WebMessage/ilp:PagingInfo/ilp:PagingInfoItem").length;
      for (var i = 0; i < oPagingInfoItemList.length; i++)
      {
        oPagingInfoItem = oPagingInfoItemList[i].cloneNode(true);
        oPagingInfoItem.setAttribute("ID", "PI_" + String(count++));
        oldPagingInfo.appendChild(oPagingInfoItem);
      }
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_AddPagingInfo", "")
  }
}

function WebMessage_MergeReportDescriptor(reportDescriptor)
{
  try
  {
    if (WebData.oMessageDoc != null && reportDescriptor != null)
    {
      var oWebMessage = WebData.oMessageDoc.selectSingleNode("//ilp:WebMessage");
      var oldReportDescriptor = WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:ReportDescriptor");
      var newReportDescriptor = reportDescriptor.cloneNode(true);
      oWebMessage.insertBefore(newReportDescriptor, oldReportDescriptor);
      oWebMessage.removeChild(oldReportDescriptor);
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_MergeReportDescriptor", "")
  }
}

function WebMessage_AddReportParam(ID, parameterField, parameterValue)
{
  try
  {
    ID = ID == null ? parameterField : ID;
  
    if (WebData.oMessageDoc != null)
    {
      var oReportParam = this.GetReportParam(parameterField);
      if (oReportParam == null)
      {
        oReportParam = Ilp.XmlDom.CreateElement(WebData.oMessageDoc, "ReportParam", NS_ilp);
        oReportParam.setAttribute("ID", ID);
      }
      oReportParam.setAttribute("ParameterField", parameterField);
      oReportParam.setAttribute("ParameterValue", parameterValue);

      var oReportDescriptor = WebData.oMessageDoc.selectSingleNode("//ilp:ReportDescriptor");
      oReportParam = oReportDescriptor.appendChild(oReportParam);
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_AddReportParam", "")
  }
}

function WebMessage_GetReportParam(parameterField)
{
  try
  {
    var oReportParam = null;
    if (WebData.oMessageDoc != null)
    {
      var xPath = "//ilp:ReportDescriptor/ilp:ReportParam[@ParameterField='" + parameterField + "']";
      oReportParam = WebData.oMessageDoc.selectSingleNode(xPath);
    }
    return oReportParam;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_GetReportParam", "")
  }
}

function WebMessage_MergeMasterdataInfo(NewMasterdataInfo)
{
  try
  {
    if (WebData.oMessageDoc != null)
    {
      var oMasterdataInfo = WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:MasterdataInfo");
      if (NewMasterdataInfo.getAttribute("MasterdataInfoID") != null)
      {
        oMasterdataInfo.setAttribute("MasterdataInfoID", NewMasterdataInfo.getAttribute("MasterdataInfoID"));
      }
      if (NewMasterdataInfo.getAttribute("FieldDescriptorFqn") != null)
      {
        oMasterdataInfo.setAttribute("FieldDescriptorFqn", NewMasterdataInfo.getAttribute("FieldDescriptorFqn"));
      }
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_MergeMasterdataInfo", "")
  }
}

function WebMessage_GetReportDescriptor()
{
  try
  {
    if (WebData.oMessageDoc != null)
    {
      return WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:ReportDescriptor");
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_GetReportDescriptor", "")
  }
}

function WebMessage_GetUploadParam()
{
  try
  {
    if (WebData.oMessageDoc != null)
    {
      return WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:UploadParam");
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_GetUploadParam", "")
  }
}

function WebMessage_GetMasterdataInfo()
{
  try
  {
    if (WebData.oMessageDoc != null)
    {
      return WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:MasterdataInfo");
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_MasterdataInfo", "")
  }
}

function WebMessage_AddCopyInfo(frdUsedByCopyTask, tdFqnUsedByCopyTask, fdFqnUsedByCopyTask, tdFqnUsedByReturnTask, fdFqnUsedByReturnTask)
{
  try
  {
    if (WebData.oMessageDoc != null)
    {
      var oCopyInfo = WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:CopyInfo");
      oCopyInfo.setAttribute("FrdUsedByCopyTask", frdUsedByCopyTask);
      oCopyInfo.setAttribute("TdFqnUsedByCopyTask", tdFqnUsedByCopyTask);
      oCopyInfo.setAttribute("FdFqnUsedByCopyTask", fdFqnUsedByCopyTask);
      oCopyInfo.setAttribute("TdFqnUsedByReturnTask", tdFqnUsedByReturnTask);
      oCopyInfo.setAttribute("FdFqnUsedByReturnTask", fdFqnUsedByReturnTask);
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_AddCopyInfo", "")
  }
}

function WebMessage_AddSendMailInfo(MailTo, MailCc, MailBcc, MailSubject, MailBody, MailAttachement, MailCopy, IDMailDocument)
{
  try
  {
    var oSendMailInfo = null;
    if (WebData.oMessageDoc != null)
    {
      oSendMailInfo = this.GetSendMailInfo();
      oSendMailInfo.setAttribute("To", MailTo == null ? "" : MailTo);
      oSendMailInfo.setAttribute("To", MailTo == null ? "" : MailTo);
      oSendMailInfo.setAttribute("Cc", MailCc == null ? "" : MailCc);
      oSendMailInfo.setAttribute("Bcc", MailBcc == null ? "" : MailBcc);
      oSendMailInfo.setAttribute("Subject", MailSubject == null ? "" : MailSubject);
      oSendMailInfo.setAttribute("Body", MailBody == null ? "" : MailBody);
      oSendMailInfo.setAttribute("Attachement", MailAttachement == null ? "" : MailAttachement);
      oSendMailInfo.setAttribute("Copy", MailCopy == null ? "false" : MailCopy);
      oSendMailInfo.setAttribute("IDMailDocument", IDMailDocument == null ? "0" : IDMailDocument);
    }

    return oSendMailInfo;
  }
  catch(exception){
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_AddSendMailInfo", "")
  }
}

function WebMessage_GetXml(removeKpiDescriptor, mode)
{
  try
  {
    removeKpiDescriptor = removeKpiDescriptor == null ? true : removeKpiDescriptor;

    var webMessageXml = "";
    if (WebData.oMessageDoc != null)
    {
      if (( (mode == "Save" || mode == "CallWebMethod2" || mode == "CallWebMethod3") && this.RemoveNoUpdatables == true)
        || mode == "SendClientLog")
      {
        this.SetGeneralInfoAttribute("Mode", mode);

        var oMessageTemp = WebData.oMessageDoc

        if (window.XmlVersion == "V1")
        {
          var oXslt = Ilp.XmlDom.CreateXmlDom();
          Ilp.XmlDom.SetSelectionNamespacesDefault(oXslt, "Transform");
          oXslt.async = false;
          oXslt.load(RootPath + "GlobalScripts/GTTransformation/GTUpdatables.xslt");

          var oWebMessageTrans = Ilp.XmlDom.CreateXmlDom();
          Ilp.XmlDom.SetSelectionNamespacesDefault(oWebMessageTrans, "Transform");
          oWebMessageTrans.async = false;

          var xmlString = oMessageTemp.transformNode(oXslt);
          xmlString = xmlString.replace("<xs:schema ", "<xs:schema xmlns='' ");
          oWebMessageTrans.loadXML(xmlString);
        }
        else
        {
          var oXslProc;
          var xslSource = RootPath + "GlobalScripts/GTTransformation/GTUpdatables.xslt";
          if (Ilp.XsltManager.XsltTemplateList.Contains(xslSource) == true)
          {
            oXslProc = Ilp.XsltManager.XsltTemplateList.Get(xslSource);
          }
          else
          {
            var oXslt = Ilp.XmlDom.CreateXsltStylesheet(xslSource);
            oXslProc = Ilp.XmlDom.CreateXsltTemplate();
            oXslProc.importStylesheet(oXslt);
            Ilp.XsltManager.XsltTemplateList.Add(xslSource, oXslProc);
          }

          var oWebMessageTrans = Ilp.XmlDom.CreateXmlDom();

          oXslProc.addParameter("mode", mode);
          oXslProc.transform(oMessageTemp, oWebMessageTrans);

          /*
          var xmlString = oWebMessageTrans.documentElement.xml;
          var xmlString = Ilp.XmlDom.GetXml(oWebMessageTrans);
          xmlString = xmlString.replace("<xs:schema ", "<xs:schema xmlns='' ");
          oWebMessageTrans.loadXML(xmlString);
          */
        }

        oMessageTemp = oWebMessageTrans;

        var oDiffGram = oMessageTemp.selectSingleNode("//diffgr:diffgram");

        if (oDiffGram != null)
        {
          WebData.ResetRowOrderA(oDiffGram, oWebMessageTrans);
          WebData.SetRowOrderA(oDiffGram, oWebMessageTrans);

          var oFdList = FormDescriptor.GetNoUpdatableFields();
          for (var i = 0, len = oFdList.length; i < len; i++)
          {
            var oFd = oFdList[i];
            var fieldName = oFd.getAttribute("FieldName");
            if ("ColumnUpdated$ColumnTracked".indexOf(fieldName) == -1)
            {
              var fqn = oFd.getAttribute("Fqn");
              // DiagramParameter[@msdata:rowOrder]/Action[not(@msdata:rowOrder)]
              var xPath = "//" + fqn.split(".").join("[@msdata:rowOrder]/");
              xPath += "[not(@msdata:rowOrder)]";

              var oFieldList = oMessageTemp.selectNodes(xPath);
              for (var j = 0, len2 = oFieldList.length; j < len2; j++)
              {
                var oField = oFieldList[j];
                if (oField && oField.parentNode)
                {
                  oField.parentNode.removeChild(oField);
                }
              }
            }
          }
        }
      }
      else
      {
        var oMessageTemp = Ilp.XmlDom.CreateXmlDom();
        Ilp.XmlDom.SetSelectionNamespacesDefault(oMessageTemp);
        oMessageTemp.loadXML(Ilp.XmlDom.GetXml(WebData.oMessageDoc))

        this.Tidy(oMessageTemp, removeKpiDescriptor, true);
      }

      /*
      webMessageXml = oMessageTemp.documentElement.xml;
      */
      webMessageXml = Ilp.XmlDom.GetXml(oMessageTemp);
    }
    webMessageXml = webMessageXml.replace("<NewDataSet xmlns=\"\"/>", "<NewDataSet xmlns=\"\"></NewDataSet>");
    return webMessageXml;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_GetXml", "")
  }
}

function WebMessage_GetXmlSmall(removePagingInfoItems)
{
  try
  {
    var webMessageXml = "";
    if (WebData.oMessageDoc != null)
    {
      oMessageTemp = Ilp.XmlDom.CreateXmlDom();
      Ilp.XmlDom.SetSelectionNamespacesDefault(oMessageTemp);
      oMessageTemp.loadXML(Ilp.XmlDom.GetXml(WebData.oMessageDoc))

      this.Tidy(oMessageTemp, null, removePagingInfoItems);

      var oWebMessage = oMessageTemp.selectSingleNode("/ilp:WebMessage");
      var oTransfer = oMessageTemp.selectSingleNode("/ilp:WebMessage/ilp:TransferDataSet");
      if (oTransfer != null)
      {
        oWebMessage.removeChild(oTransfer);
      }
      var oKpiDescriptor = oMessageTemp.selectSingleNode("/ilp:WebMessage/ilp:KpiDescriptor");
      if (oKpiDescriptor != null)
      {
        oWebMessage.removeChild(oKpiDescriptor);
      }

      /*
      webMessageXml = oMessageTemp.documentElement.xml;
      */
      webMessageXml = Ilp.XmlDom.GetXml(oMessageTemp);
    }
    return webMessageXml;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_GetXmlSmall", "")
  }
}

function WebMessage_Tidy(oMessageTemp, removeKpiDescriptor, removePagingInfoItems)
{
  try
  {
    removeKpiDescriptor = removeKpiDescriptor == null ? true : removeKpiDescriptor;
    removePagingInfoItems = removePagingInfoItems == null ? true : removePagingInfoItems;

    var oPart = null;
    var oWebMessage = oMessageTemp.selectSingleNode("/ilp:WebMessage");
    var oGeneralInfo = oMessageTemp.selectSingleNode("/ilp:WebMessage/ilp:GeneralInfo");

    oPart = oMessageTemp.selectSingleNode("/ilp:WebMessage/ilp:TokenInfo");
    if (oPart != null)
    {
      oWebMessage.removeChild(oPart);
    }
    oPart = oMessageTemp.selectSingleNode("/ilp:WebMessage/ilp:DefaultInfo");
    if (oPart != null)
    {
      oWebMessage.removeChild(oPart);
    }
    oPart = oMessageTemp.selectSingleNode("/ilp:WebMessage/ilp:Result");
    if (oPart != null)
    {
      oWebMessage.removeChild(oPart);
    }
    oPart = oMessageTemp.selectSingleNode("/ilp:WebMessage/ilp:ClientLogDescriptor");
    if (oPart != null)
    {
      oWebMessage.removeChild(oPart);
    }
    oPart = oMessageTemp.selectSingleNode("/ilp:WebMessage/ilp:SqlStatementList");
    if (oPart != null)
    {
      oWebMessage.removeChild(oPart);
    }
    oPart = oMessageTemp.selectSingleNode("/ilp:WebMessage/ilp:MasterdataInfo");
    if (oPart != null)
    {
      oWebMessage.removeChild(oPart);
    }
    if (removePagingInfoItems == true)
    {
      oPart = oMessageTemp.selectSingleNode("/ilp:WebMessage/ilp:GeneralInfo/ilp:PagingInfoItem");
      if (oPart != null)
      {
        oGeneralInfo.removeChild(oPart);
      }
    }
    if (removeKpiDescriptor == true)
    {
      oPart = oMessageTemp.selectSingleNode("/ilp:WebMessage/ilp:KpiDescriptor");
      if (oPart != null)
      {
        oWebMessage.removeChild(oPart);
      }
    }
    oPart = oMessageTemp.selectSingleNode("/ilp:WebMessage/ilp:TokenInfo");
    if (oPart != null)
    {
      oWebMessage.removeChild(oPart);
    }
    oPart = oMessageTemp.selectSingleNode("/ilp:WebMessage/ilp:DefaultInfo");
    if (oPart != null)
    {
      oWebMessage.removeChild(oPart);
    }
    oPart = oMessageTemp.selectSingleNode("/ilp:WebMessage/ilp:PagingInfo");
    if (oPart != null)
    {
      oWebMessage.removeChild(oPart);
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_Tidy", "")
  }
}

function WebMessage_GetTableDescriptorFqnList()
{
  try
  {
    var oTableDescriptorFqnList = null;
    if (WebData.oMessageDoc != null)
    {
      oTableDescriptorFqnList = WebData.oMessageDoc.selectNodes("/ilp:WebMessage/ilp:GeneralInfo/ilp:TableDescriptorFqnList/ilp:string");
    }
    return oTableDescriptorFqnList;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_GetTableDescriptorFqnList", "")
  }
}

function WebMessage_AddTableDescriptorFqn(tableDescriptorFqn)
{
  try
  {
    var oTableDescriptorFqnList = null;
    var oTableDescriptorFqn = null;
    if (WebData.oMessageDoc != null)
    {
      oTableDescriptorFqnList = WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:GeneralInfo/ilp:TableDescriptorFqnList");
      if (oTableDescriptorFqnList == null)
      {
        var oGeneralInfo = WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:GeneralInfo");
        oTableDescriptorFqnList = Ilp.XmlDom.CreateElement(WebData.oMessageDoc, "TableDescriptorFqnList", NS_ilp);
        oGeneralInfo.appendChild(oTableDescriptorFqnList);
      }

      oTableDescriptorFqn = WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:GeneralInfo/ilp:TableDescriptorFqnList/ilp:string[.='" + tableDescriptorFqn + "']");
      if (oTableDescriptorFqn == null)
      {
        oTableDescriptorFqn = Ilp.XmlDom.CreateElement(WebData.oMessageDoc, "string", NS_ilp);
        oTableDescriptorFqn.text = tableDescriptorFqn;
        oTableDescriptorFqnList.appendChild(oTableDescriptorFqn);
      }
    }
    return oTableDescriptorFqn;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_AddTableDescriptorFqn", "")
  }
}

function WebMessage_InitTableDescriptorFqnList()
{
  try
  {
    if (WebData.oMessageDoc != null)
    {
      var oTableDescriptorFqnList = WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:GeneralInfo/ilp:TableDescriptorFqnList");
      var stringList = oTableDescriptorFqnList.selectNodes("string");
      if (stringList != null)
      {
        stringList.removeAll();
      }
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_InitTableDescriptorFqnList", "")
  }
}

function WebMessage_AddDataTableRelationDescriptorFqn(dataTableRelationDescriptorFqn)
{
  try{
    var oDataTableRelationDescriptorFqnList = null;
    var oDataTableRelationDescriptorFqn = null;
    if (WebData.oMessageDoc != null)
    {
      oDataTableRelationDescriptorFqnList = WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:GeneralInfo/ilp:DataTableRelationDescriptorFqnList");
      if (oDataTableRelationDescriptorFqnList == null)
      {
        var oGeneralInfo = WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:GeneralInfo");
        oDataTableRelationDescriptorFqnList = Ilp.XmlDom.CreateElement(WebData.oMessageDoc, "DataTableRelationDescriptorFqnList", NS_ilp);
        oGeneralInfo.appendChild(oDataTableRelationDescriptorFqnList);
      }

      oDataTableRelationDescriptorFqn = WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:GeneralInfo/ilp:DataTableRelationDescriptorFqnList/ilp:string[.='" + dataTableRelationDescriptorFqn + "']");
      if (oDataTableRelationDescriptorFqn == null)
      {
        oDataTableRelationDescriptorFqn = Ilp.XmlDom.CreateElement(WebData.oMessageDoc, "string", NS_ilp);
        oDataTableRelationDescriptorFqn.text = dataTableRelationDescriptorFqn;
        oDataTableRelationDescriptorFqnList.appendChild(oDataTableRelationDescriptorFqn);
      }
    }
    return oDataTableRelationDescriptorFqn;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_AddDataTableRelationDescriptorFqn", "")
  }
}

function WebMessage_InitDataTableRelationDescriptorFqnList()
{
  try
  {
    if (WebData.oMessageDoc != null)
    {
      var oDataTableRelationDescriptorFqnList = WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:GeneralInfo/ilp:DataTableRelationDescriptorFqnList");
      var stringList = oDataTableRelationDescriptorFqnList.selectNodes("ilp:string");
      if (stringList != null)
      {
        stringList.removeAll();
      }
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_InitDataTableRelationDescriptorFqnList", "")
  }
}

function WebMessage_SetReportDescriptor(oRecord)
{
  try
  {
    var oReportDescriptor = null;

    var reportFileName = WebData.GetFieldValue(oRecord, "ReportList.ReportFile");
    if (reportFileName == null)
    {
      reportFileName = WebData.GetFieldValue(oRecord, "ReportList.ReportFilename");
    }
    reportFileName = reportFileName == null ? "" : reportFileName;

    var currentSelectionFormula = "";
    var oElement = document.getElementById("CurrentSelectionFormula");
    if (oElement == null)
    {
      oElement = document.getElementById("AppUser_CurrentSelectionFormula");
    }
    if (oElement == null)
    {
      oElement = document.getElementById("SpirPrintout_CurrentSelectionFormula");
    }
    if (oElement != null)
    {
      currentSelectionFormula = oElement.value;
    }

    //ReportDescriptorID, IDReportList, TableDescriptorFqn, ReportName, ReportNumber, ReportFileName, SelectionFormula, UseSelectionFormula, ExcelExportClassName, ExcelExportMethodName){
    oReportDescriptor = this.AddReportDescriptor(
      "R1",
      WebData.GetFieldValue(oRecord, "ReportList.IDReportList"),
      "",
      "",
      WebData.GetFieldValue(oRecord, "ReportList.ReportNumber"),
      reportFileName,
      currentSelectionFormula,
      WebData.GetFieldValue(oRecord, "ReportList.UseSelectionFormula"),
      WebData.GetFieldValue(oRecord, "ReportList.ExcelExportClassName"),
      WebData.GetFieldValue(oRecord, "ReportList.ExcelExportMethodName"));

    return oReportDescriptor;
  }
  catch (exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_SetReportDescriptor", "")
  }
}

function WebMessage_ShowReport(tableDescriptorFqn, reportFilename, reportName, selectionFormula, IDLanguage, internalName)
{
  try
  {
    if (typeof(reportFilename) == "string")
    {
      this.InitReportDescriptor();

      reportName = reportName == null ? "" : reportName;
      selectionFormula = selectionFormula == null ? "" : selectionFormula;
      IDLanguage = IDLanguage == null ? 0 : IDLanguage;
      internalName = internalName == null ? "" : internalName;

      // ReportDescriptorID, IDReportList, TableDescriptorFqn, ReportName, ReportNumber, ReportFileName, SelectionFormula
      var oReportDescriptor = this.AddReportDescriptor("R1", "0", tableDescriptorFqn, reportName, "", reportFilename, selectionFormula);
      oReportDescriptor.setAttribute("IDLanguage", IDLanguage);
      oReportDescriptor.setAttribute("InternalName", internalName);

      oReportDescriptor.setAttribute("ReportReferrer", window.location.href);
      oReportDescriptor.setAttribute("PageHeadline", PageHeadline);
      oReportDescriptor.setAttribute("PageTitle", PageTitle);

      this.SetGeneralInfoAttribute("PageLogo", PageLogo);

      document.frmAction.WebMessage.value = this.GetXmlSmall();
      document.frmAction.action = GlobalScriptsDirectoryVirtual + "GTCommon/ExportReport.aspx?ExportType=Pdf";
      document.frmAction.method = "POST";
      document.frmAction.target = "_blank";
      document.frmAction.submit();
      document.frmAction.WebMessage.value = "";
    }
  }
  catch (exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_ShowReport", "")
  }
}

function WebMessage_MailReport(tableDescriptorFqn, reportFilename)
{
  try
  {
    if (typeof(reportFilename) == "string")
    {
      this.InitReportDescriptor();
      // ReportDescriptorID, IDReportList, TableDescriptorFqn, ReportName, ReportNumber, ReportFileName, SelectionFormula
      var oReportDescriptor = this.AddReportDescriptor("R1", "0", tableDescriptorFqn, "", "", reportFilename, "");

      oReportDescriptor.setAttribute("ReportReferrer", window.location.href);
      oReportDescriptor.setAttribute("PageHeadline", PageHeadline);
      oReportDescriptor.setAttribute("PageTitle", PageTitle);

      this.SetGeneralInfoAttribute("PageLogo", PageLogo);

      document.frmAction.WebMessage.value = this.GetXmlSmall();
      document.frmAction.action = GlobalScriptsDirectoryVirtual + "GTCommon/ExportReport.aspx?ExportType=PdfMail";
      document.frmAction.method = "POST";
      document.frmAction.target = "_blank";
      document.frmAction.submit();
      document.frmAction.WebMessage.value = "";
    }
  }
  catch (exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_MailReport", "")
  }
}

function WebMessage_ExportReport(oRecord, exportType, includeSearchInfo)
{
  try
  {
    includeSearchInfo = includeSearchInfo == null ? true : includeSearchInfo;

    var oReportDescriptor = this.SetReportDescriptor(oRecord);

    oReportDescriptor.setAttribute("ReportReferrer", window.location.href);
    oReportDescriptor.setAttribute("PageHeadline", PageHeadline);
    oReportDescriptor.setAttribute("PageTitle", PageTitle);

    this.SetGeneralInfoAttribute("PageLogo", PageLogo);

    document.frmAction.ReportDescriptor.value = Ilp.XmlDom.GetXml(oReportDescriptor);
    if (includeSearchInfo == true)
    {
      var oSearchInfo = this.GetSearchInfo(oRecord);
      document.frmAction.SearchInfo.value = Ilp.XmlDom.GetXml(oSearchInfo);
    }
    document.frmAction.action = GlobalScriptsDirectoryVirtual
      + "GTCommon/ExportReport.aspx?ExportType=" + exportType
      + "&WM=" + String(WebMessage.GetGeneralInfoAttribute("IDWebMessageTransfer"));
    document.frmAction.method = "POST";
    document.frmAction.target = "_blank";
    document.frmAction.submit();
    document.frmAction.ReportDescriptor.value = "";
    document.frmAction.SearchInfo.value = "";
  }
  catch (exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_ExportReport", "")
  }
}


function WebMessage_ShowDownloadFile(IDMailDocument)
{
  try
  {
    this.InitReportDescriptor();
    // ReportDescriptorID, IDReportList, TableDescriptorFqn, ReportName, ReportNumber, ReportFileName, SelectionFormula
    var oReportDescriptor = this.AddReportDescriptor("R1", "0", "MailDocument", "", "", "", "");

    oReportDescriptor.setAttribute("ReportReferrer", window.location.href);
    oReportDescriptor.setAttribute("PageHeadline", PageHeadline);
    oReportDescriptor.setAttribute("PageTitle", PageTitle);

    this.SetGeneralInfoAttribute("PageLogo", PageLogo);

    document.frmAction.WebMessage.value = this.GetXmlSmall();
    document.frmAction.action = GlobalScriptsDirectoryVirtual + "GTCommon/ExportReport.aspx?ExportType=FileDownload&IDMailDocument=" + IDMailDocument;
    document.frmAction.method = "POST";
    document.frmAction.target = "_blank";
    document.frmAction.submit();
    document.frmAction.WebMessage.value = "";

  }
  catch (exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_ShowDownloadFile", "")
  }
}

function WebMessage_MailFile(IDMailDocument, showPdfPreview)
{
  try
  {
    showPdfPreview = showPdfPreview == null ? false : showPdfPreview;
    
    this.InitReportDescriptor();
    // ReportDescriptorID, IDReportList, TableDescriptorFqn, ReportName, ReportNumber, ReportFileName, SelectionFormula
    var oReportDescriptor = this.AddReportDescriptor("R1", "0", "MailDocument", "", "", "", "");

    oReportDescriptor.setAttribute("ReportReferrer", window.location.href);
    oReportDescriptor.setAttribute("PageHeadline", PageHeadline);
    oReportDescriptor.setAttribute("PageTitle", PageTitle);
    oReportDescriptor.setAttribute("ShowPdfPreview", showPdfPreview == true ? "true" : "false");

    this.SetGeneralInfoAttribute("PageLogo", PageLogo);

    document.frmAction.WebMessage.value = this.GetXmlSmall();
    document.frmAction.action = GlobalScriptsDirectoryVirtual + "GTCommon/ExportReport.aspx?ExportType=FileMail&IDMailDocument=" + IDMailDocument;
    document.frmAction.method = "POST";
    document.frmAction.target = "_blank";
    document.frmAction.submit();
    document.frmAction.WebMessage.value = "";
  }
  catch (exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_MailFile", "")
  }
}


function WebMessage_LaunchReport(oRecord)
{
  try{
    var oReportDescriptor = this.SetReportDescriptor(oRecord);

    oHidden = document.getElementById("ReportParam_SelectionFormula");
    oHidden.value = oReportDescriptor.getAttribute("SelectionFormula");
    oHidden.value = (oHidden.value == "null" ? "" : oHidden.value)

    oHidden = document.getElementById("ReportParam_ReportName");
    oHidden.value = oReportDescriptor.getAttribute("ReportFileName");
    oHidden.value = (oHidden.value == "null" ? "" : oHidden.value)

    oHidden = document.getElementById("ReportParam_ReportNumber");
    oHidden.value = oReportDescriptor.getAttribute("ReportNumber");
    oHidden.value = (oHidden.value == "null" ? "" : oHidden.value)

    oHidden = document.getElementById("ReportParam_UseSelectionFormula");
    oHidden.value = oReportDescriptor.getAttribute("UseSelectionFormula");
    oHidden.value = (oHidden.value == "null" ? "true" : oHidden.value)

    var oReportParam = null;
    oReportParam = this.GetReportParam("FromDate");
    if (oReportParam != null)
    {
      oHidden = document.getElementById("ReportParam_FromDate");
      oHidden.value = oReportParam.getAttribute("ParameterValue");
      oHidden.value = (oHidden.value == "null" ? "" : oHidden.value)
    }

    oReportParam = this.GetReportParam("ToDate");
    if (oReportParam != null)
    {
      oHidden = document.getElementById("ReportParam_ToDate");
      oHidden.value = oReportParam.getAttribute("ParameterValue");
      oHidden.value = (oHidden.value == "null" ? "" : oHidden.value)
    }

    document.frmAction.WebMessage.value = "";
    document.frmAction.method = "POST";
    document.frmAction.target = "_blank";
    document.frmAction.action = ReportRoot + "ReportMasterData.asp";
    document.frmAction.submit();
  }
  catch (exception){
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_LaunchReport", "Section1")
  }
}

function WebMessage_ShowXmlDoc(oControl, xmlDocType, stringMessage)
{
  var returnValue = true;
  try
  {
    if (xmlDocType == "StringMessage")
    {
      document.frmAction.StringMessage.value = stringMessage;
    }
    else if (xmlDocType == "OuterHTML")
    {
      document.frmAction.StringMessage.value = oControl.outerHTML;
    }
    else if (xmlDocType == "InnerHTML")
    {
      document.frmAction.StringMessage.value = oControl.innerHTML;
    }
    else if (xmlDocType == "SoapMessageSend")
    {
      document.frmAction.StringMessage.value = WebMessage.SoapMessageSend;
    }
    else if (xmlDocType == "WebMessage")
    {
      document.frmAction.StringMessage.value = Ilp.XmlDom.GetXml(WebData.oMessageDoc);
    }
    else if (xmlDocType == "WebMessageTransfer")
    {
      var webMethode = "GetWebMessageTransfer";
      var IDWebMessageTransfer = this.GetGeneralInfoAttribute("IDWebMessageTransfer");
      if (IDWebMessageTransfer == null || IDWebMessageTransfer.length == 0)
      {
        alert("Es gibt keinen Transfer einer WebMessage");
        return;
      }
      else
      {
        var webArgument = "<IDWebMessageTransfer>" + IDWebMessageTransfer+ "</IDWebMessageTransfer>";
        this.CallWebService(webMethode, webArgument);
        var oWebMessage = WebData.oMessageDoc.selectSingleNode("//ilp:WebMessage");

        /*
        document.frmAction.StringMessage.value = this.oMessageResponseDoc.documentElement.xml;
        */
        document.frmAction.StringMessage.value = Ilp.XmlDom.GetXml(this.oMessageResponseDoc);
      }
    }
    else if (xmlDocType == "ResponseText")
    {
      if (this.oMessageResponseDoc != null && this.oMessageResponseDoc.documentElement != null)
      {
        /*
        document.frmAction.StringMessage.value = this.oMessageResponseDoc.documentElement.xml;
        */
        document.frmAction.StringMessage.value = Ilp.XmlDom.GetXml(this.oMessageResponseDoc);
      }
      else
      {
        if (this.oWM_XMLHTTP != null && Ilp.XmlDom.GetResponseTextLength(this.oWM_XMLHTTP) > 0)
        {
          document.frmAction.StringMessage.value = Ilp.XmlDom.GetResponseText(this.oWM_XMLHTTP);
        }
        else
        {
          alert("Es gibt noch keinen Response Text");
          return;
        }
      }
    }
    else if (xmlDocType == "ResponseText2")
    {
      if (this.oMessageResponseDoc2 != null && this.oMessageResponseDoc2.documentElement != null)
      {
        /*
        document.frmAction.StringMessage.value = this.oMessageResponseDoc2.documentElement.xml;
        */
        document.frmAction.StringMessage.value = Ilp.XmlDom.GetXml(this.oMessageResponseDoc2);
      }
      else
      {
        if (this.oWM_XMLHTTP != null && Ilp.XmlDom.GetResponseTextLength(this.oWM_XMLHTTP) > 0)
        {
          document.frmAction.StringMessage.value = Ilp.XmlDom.GetResponseText(this.oWM_XMLHTTP);
        }
        else
        {
          alert("Es gibt noch keinen Response2 Text");
          return;
        }
      }
    }
    else if (xmlDocType == "FormDescriptor")
    {
      /*
      document.frmAction.StringMessage.value = FormDescriptor.FormDescriptorDoc.documentElement.xml;
      */
      document.frmAction.StringMessage.value = Ilp.XmlDom.GetXml(FormDescriptor.FormDescriptorDoc);
    }
    
    WebControl.AddPostParameter("FormDescriptorFileName", this.GetGeneralInfoAttribute("FormDescriptorFileName"));
    WebControl.AddPostParameter("FormID", FormID);
    
    document.frmAction.XmlDocType.value = xmlDocType;
    document.frmAction.action = GlobalScriptsDirectoryVirtual + "GTCommon/ShowXmlDoc.aspx";
    document.frmAction.method = "post";
    document.frmAction.target = "_blank";
    document.frmAction.submit();
    document.frmAction.XmlDocType.value = "";
    document.frmAction.StringMessage.value = "";
  }
  catch(exception)
  {
    returnValue = false;
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_ShowXmlDoc", "Section1")
  }
  
  return returnValue;
}

function ShowWebMessage(oControl)
{
  try
  {
    if (oControl!=null){
      oControl.disabled = true;
    }

    WebMessage.ShowXmlDoc(oControl, "WebMessage");

    if (oControl!=null){
      oControl.disabled = false;
    }
  }
  catch(exception){
    if (WebMessage) WebMessage.SendClientLog(exception, "ShowWebMessage", "Section1")
  }
}

function ShowSoapMessageSend(oControl)
{
  try
  {
    if (oControl!=null){
      oControl.disabled = true;
    }

    WebMessage.ShowXmlDoc(oControl, "SoapMessageSend");

    if (oControl!=null){
      oControl.disabled = false;
    }
  }
  catch(exception){
    if (WebMessage) WebMessage.SendClientLog(exception, "ShowSoapMessageSend", "Section1")
  }
}

function ShowFrameWebMessage(sender)
{
  try
  {
    if (sender != null) sender.disabled = true;

    if (window.WebFrameArray.length > 0)
    {
      for (var i = 0; i < window.WebFrameArray.length; i++)
      {
        window.WebFrameArray[i].ShowWebMessage();
      }
    }

    if (sender != null) sender.disabled = false;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "CertificateRev_ShowFrameWebMessage", "");
  }
}



function ShowWebMessageTransfer(oControl)
{
  try
  {
    if (oControl!=null){
      oControl.disabled = true;
    }

    WebMessage.ShowXmlDoc(oControl, "WebMessageTransfer");

    if (oControl!=null){
      oControl.disabled = false;
    }
  }
  catch(exception){
    if (WebMessage) WebMessage.SendClientLog(exception, "ShowSessionInfo", "Section1")
  }
}

function ShowResponseText(oControl)
{
  try
  {
    if (oControl!=null){
      oControl.disabled = true;
    }

    WebMessage.ShowXmlDoc(oControl, "ResponseText");
    WebMessage.ShowXmlDoc(oControl, "ResponseText2");

    if (oControl!=null){
      oControl.disabled = false;
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "ShowResponseText", "Section1")
  }
}

function WebMessage_SendMail()
{
  try
  {
    WebMessage.SetGeneralInfoAttribute("FunctionCall", "SendMail");
    WebMessage.Exchange();
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_SendMail", "Section1")
  }
}

function WebMessage_SendClientLog(exception, originator, message, originatorFunction)
{
  try
  {
    if (originatorFunction != null)
    {
      var i = 0;
      var s = "";
      var re = new RegExp("function.*?(?:\r)?(?:\n)?{","i");
      var match = "";

      var callerFunc = originatorFunction;

      while (callerFunc != null && i++ < 5)
      {
        s += "\n";
        s += "The function signatur is: ";
        match = callerFunc.toString().match(re);
        if (match != null)
        {
          s += match[0];
        }

        s += "\n";
        s += "The number of defined arguments is: " + String(callerFunc.arguments.length);

        s += "\n";
        s += "The passed arguments are: ";
        for (var n = 0; n < callerFunc.arguments.length; n++)
        {
          s += callerFunc.arguments[n];
          s += " ";
        }

        s += "\n";
        s += "-----------------------";

        callerFunc = callerFunc.caller;
      }
      message = s;
    }


    if (this.SendingClientLog == true || this.ClientLogSend == true) return;

    WebMessage.SendingClientLog = true;
    var webClientLogDescriptor = null;
    var oOriginalWebMessage = null;
    var oExtraMessage = null;
    if (typeof(window.WebData) == "object")
    {
      webClientLogDescriptor = WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:ClientLogDescriptor");
    }

    if (webClientLogDescriptor != null)
    {
      webClientLogDescriptor.setAttribute("Navigator_userAgent", window.navigator.userAgent);
      webClientLogDescriptor.setAttribute("Navigator_appName", window.navigator.appName);
      webClientLogDescriptor.setAttribute("Navigator_appVersion", window.navigator.appVersion);
      webClientLogDescriptor.setAttribute("Location_href", escape(window.location.href));
      webClientLogDescriptor.setAttribute("Location_host", window.location.host);
      webClientLogDescriptor.setAttribute("Exception_description", "");
      webClientLogDescriptor.setAttribute("Exception_number", "");
      if (exception != null)
      {
        webClientLogDescriptor.setAttribute("Exception_description", exception.description);
        webClientLogDescriptor.setAttribute("Exception_number", exception.number);
      }
      webClientLogDescriptor.setAttribute("Originator", originator);

      oExtraMessage = webClientLogDescriptor.selectSingleNode("ilp:ExtraMessage");
      if (oExtraMessage == null)
      {
        oExtraMessage = Ilp.XmlDom.CreateElement(WebData.oMessageDoc, "ExtraMessage", NS_ilp);
        webClientLogDescriptor.appendChild(oExtraMessage);
      }
      oExtraMessage.text = message;

      var originalWebMessage = this.GetXml();
      if (originalWebMessage != null)
      {
        oOriginalWebMessage = webClientLogDescriptor.selectSingleNode("ilp:OriginalWebMessage");
        if (oOriginalWebMessage == null)
        {
          oOriginalWebMessage = Ilp.XmlDom.CreateElement(WebData.oMessageDoc, "OriginalWebMessage", NS_ilp);
          webClientLogDescriptor.appendChild(oOriginalWebMessage);
        }
        if (location.hostname=="localhost" || location.hostname=="localhost.")
        {
          oOriginalWebMessage.text = originalWebMessage;
        }
        else
        {
          oOriginalWebMessage.text = escape(originalWebMessage);
        }  
      }
      var soapMessageSend = this.SoapMessageSend;
      if (soapMessageSend != null)
      {
        oSoapMessageSend = webClientLogDescriptor.selectSingleNode("ilp:SoapMessageSend");
        if (oSoapMessageSend == null)
        {
          oSoapMessageSend = Ilp.XmlDom.CreateElement(WebData.oMessageDoc, "SoapMessageSend", NS_ilp);
          webClientLogDescriptor.appendChild(oSoapMessageSend);
        }
        if (location.hostname=="localhost" || location.hostname=="localhost.")
        {
          oSoapMessageSend.text = soapMessageSend;
        }
        else
        {
          oSoapMessageSend.text = escape(soapMessageSend);
        }  
      }
    }

    if (this.IsWebApplication == true)
    {
      if (location.hostname=="localhost" || location.hostname=="localhost.")
      {
        if (this.ShowXmlDoc(null, "WebMessage") == true) this.ClientLogSend = true;
      }
      else
      {
        var webMessage = "";
        var webEnvelope = "";
        var webServiceUrl = "";

        WebMessage.EnsureXMLHTTP();

        this.SetGeneralInfoAttribute("FunctionCall", "SendClientLog");
        webServiceUrl = this.GetServiceUrl();
        webMessage = this.GetXml(true, "SendClientLog");
        webEnvelope = this.GetSoapEnvelope(webMessage);

        this.oWM_XMLHTTP.open("POST", webServiceUrl, false);
        this.oWM_XMLHTTP.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
        this.oWM_XMLHTTP.setRequestHeader("Content-Length", webEnvelope.length);
        this.oWM_XMLHTTP.setRequestHeader("SOAPAction", "http://ilp.de/webservices/ApplyRequestBroker");

        this.oWM_XMLHTTP.send(webEnvelope);
      }
    }
    else
    {
      if (this.IsAlertEnabled == true)
      {
        alert(originator + " " + exception.description);
      }
    }

    if (webClientLogDescriptor != null)
    {
      webClientLogDescriptor.setAttribute("Navigator_userAgent", "");
      webClientLogDescriptor.setAttribute("Navigator_appName", "");
      webClientLogDescriptor.setAttribute("Navigator_appVersion", "");
      webClientLogDescriptor.setAttribute("Location_href", "");
      webClientLogDescriptor.setAttribute("Location_host", "");
      webClientLogDescriptor.setAttribute("Exception_description", "");
      webClientLogDescriptor.setAttribute("Exception_number", "");
      webClientLogDescriptor.setAttribute("Exception_description", "");
      webClientLogDescriptor.setAttribute("Exception_number", "");
      webClientLogDescriptor.setAttribute("Originator", "");
      if (oExtraMessage) oExtraMessage.text = "";
      if (oOriginalWebMessage) oOriginalWebMessage.text = "";
      if (oSoapMessageSend) oSoapMessageSend.text = "";
    }

    this.SendingClientLog = false;
  }
  catch(exception)
  {
    if (location.hostname=="localhost")
    {
      alert(exception.description);
    }
  }
}

function ShowHtml(sender)
{
  try
  {
    if (sender!=null){
      sender.disabled = true;
    }

    oWebDataGrid = WebControl.GetWebDataGridMain();
    WebMessage.ShowXmlDoc(oWebDataGrid.Container, "OuterHTML");

    if (sender!=null){
      sender.disabled = false;
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "ShowHtml", "Section1")
  }
}

function WebMessage_ReplaceToken(tokenizedString)
{
  try
  {
    var detokenizedString = tokenizedString;
    if (tokenizedString.length > 0)
    {
      var oTokenInfoItemList = WebData.oMessageDoc.selectNodes("/ilp:WebMessage/ilp:TokenInfo/ilp:TokenInfoItem");
      for (var i = 0; i < oTokenInfoItemList.length; i++)
      {
        var key = oTokenInfoItemList[i].getAttribute("Key");
        var tokenValue = "";
        if (key == "-Protocol-")
        {
          tokenValue = location.protocol + "//";
        }
        else if (key == "-Hostname-")
        {
          tokenValue = location.hostname;
        }
        else
        {
          tokenValue = oTokenInfoItemList[i].getAttribute("TokenValue");
        }
        detokenizedString = detokenizedString.replace(key, tokenValue);
      }
    }
    return detokenizedString;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_ReplaceToken", "Section1")
  }
}


function WebMessage_SearchInfoSave()
{
  try
  {
    var oSearchInfoBuffer = null;
    var oSearchInfoDoc = this.GetSearchInfo();
    if (oSearchInfoDoc != null)
    {
      oSearchInfoBuffer = oSearchInfoDoc.cloneNode(true);
    }
    
    return oSearchInfoBuffer;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_SearchInfoSave", "Section1")
  }
}

function WebMessage_SearchInfoRestore(oSearchInfoBuffer)
{
  try
  {
    if (oSearchInfoBuffer)
    {
      var oSearchInfoDoc = this.GetSearchInfo();
      if (oSearchInfoDoc)
      {
        var oParent = oSearchInfoDoc.parentNode;
        oParent.insertBefore(oSearchInfoBuffer, oSearchInfoDoc);
        oParent.removeChild(oSearchInfoDoc);
        this.SearchInfoBuffer = null;
      }
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_SearchInfoRestore", "Section1")
  }
}

function WebMessage_GetClipboard()
{
  try
  {
    var oClipboardData = null;
    if (WebData.oMessageDoc != null)
    {
      oClipboardData = WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:ClipboardData");

      if (oClipboardData == null)
      {
        var oClipboardData = Ilp.XmlDom.CreateElement(WebData.oMessageDoc, "ClipboardData", NS_ilp);
        var oWebMessage = WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage");
        oWebMessage.appendChild(oClipboardData);
      }
    }
    return oClipboardData;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_GetClipboard", "Section1")
  }
}

function WebMessage_ClearClipboard()
{
  try
  {
    WebData
    var oWebMessage = WebData.oMessageDoc.selectSingleNode("//ilp:WebMessage");
    var selectedNode = oWebMessage.selectSingleNode("/ilp:WebMessage/ilp:ClipboardData");
    if (selectedNode != null)
    {
      oWebMessage.removeChild(selectedNode);
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_ClearClipboard", "Section1")
  }
}

function WebMessage_GetClipboardRecords()
{
  try
  {
    var oClipboardData = this.GetClipboard();
    var oRecords = WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:ClipboardData/ilp:Records"); ;
    if (oRecords == null)
    {
      var oRecords = Ilp.XmlDom.CreateElement(WebData.oMessageDoc, "Records", NS_ilp);
      oClipboardData.appendChild(oRecords);
    }

    return oRecords;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_GetClipboardRecords", "Section1")
  }
}

function WebMessage_SetClipboardData(oRecord, type, mode)
{
  try
  {
    if (type == "Records")
    {
      var selectedList = null;
      oRecords = this.GetClipboardRecords();
      selectedList = oRecords.selectNodes(oRecord.nodeName);
      for (var i = 0; i < selectedList.length; i++)
      {
        oRecords.removeChild(selectedList[i]);
      }
      var oRecordClipped = oRecord.cloneNode(true);
      oRecordClipped.setAttribute("Mode", mode);
      oRecords.appendChild(oRecordClipped);
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_SetClipboardData", "Section1")
  }
}

function WebMessage_GetClipboardData(type, nodeName)
{
  try
  {
    var oClipboardData = this.GetClipboard();
    var selectedList = null;
    var oRecords = null;

    if (oClipboardData != null)
    {
      if (type == "Records")
      {
        oRecords = this.GetClipboardRecords();
        selectedList = oRecords.selectNodes(nodeName);
      }
    }

    return selectedList;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_GetClipboardData", "Section1")
  }
}

function WebMessage_GetKpiDescriptor(attributeName, attributeValue)
{
  try
  {
    var kpiDescriptor = null;
    if (typeof(window.WebData) == "object")
    {
      kpiDescriptor = WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:KpiDescriptor");
    }

    return kpiDescriptor;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_GetKpiDescriptor", "Section1")
  }
}

function WebMessage_SetKpiDescriptor(attributeName, attributeValue)
{
  try
  {
    var kpiDescriptor = this.GetKpiDescriptor();

    if(kpiDescriptor)
    {
      kpiDescriptor.setAttribute(attributeName, attributeValue);
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_SetKpiDescriptor", "Section1")
  }
}

function WebMessage_InitKpiDescriptor()
{
  try
  {
    var oKpiDescriptor = this.GetKpiDescriptor();
    if (oKpiDescriptor != null)
    {
      var oKpiLogEntryList = oKpiDescriptor.selectNodes("ilp:KpiLogEntry");
      var count = oKpiLogEntryList.length;
      for (var i = 0; i < count; i++)
      {
        oKpiDescriptor.removeChild(oKpiLogEntryList[i]);
      }

    }
    var oKpiClientInformation = oKpiDescriptor.selectSingleNode("ilp:KpiClientInformation");
    oKpiClientInformation.setAttribute("AppCodeName", Ilp.Navigator.AppCodeName);
    oKpiClientInformation.setAttribute("AppMinorVersion", Ilp.Navigator.AppMinorVersion);
    oKpiClientInformation.setAttribute("AppName", Ilp.Navigator.AppName);
    oKpiClientInformation.setAttribute("AppVersion", Ilp.Navigator.AppVersion);
    oKpiClientInformation.setAttribute("BrowserLanguage", Ilp.Navigator.BrowserLanguage);
    oKpiClientInformation.setAttribute("CookieEnabled", Ilp.Navigator.CookieEnabled);
    oKpiClientInformation.setAttribute("CpuClass", Ilp.Navigator.CpuClass);
    oKpiClientInformation.setAttribute("OnLine", Ilp.Navigator.OnLine);
    oKpiClientInformation.setAttribute("Plattform", Ilp.Navigator.Plattform);
    oKpiClientInformation.setAttribute("SystemLanguage", Ilp.Navigator.SystemLanguage);
    oKpiClientInformation.setAttribute("UserAgent", Ilp.Navigator.UserAgent);
    oKpiClientInformation.setAttribute("UserLanguage", Ilp.Navigator.UserLanguage);
    oKpiClientInformation.setAttribute("JavaEnabled", Ilp.Navigator.JavaEnabled);

    var oKpiLocation = oKpiDescriptor.selectSingleNode("ilp:KpiLocation");
    oKpiLocation.setAttribute("Hash", window.location.hash);
    oKpiLocation.setAttribute("Host", window.location.host);
    oKpiLocation.setAttribute("Hostname", window.location.hostname);
    oKpiLocation.setAttribute("Href", window.location.href);
    oKpiLocation.setAttribute("Pathname", window.location.pathname);
    oKpiLocation.setAttribute("Port", window.location.port);
    oKpiLocation.setAttribute("Protokoll", window.location.protokoll);
    oKpiLocation.setAttribute("Search", window.location.search);

  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_InitKpiDescriptor", "Section1")
  }
}

function WebMessage_AddKpiLogEntry(ID)
{
  try
  {
    var oKpiDescriptor = this.GetKpiDescriptor();
    if (oKpiDescriptor != null)
    {
      oKpiLogEntry = Ilp.XmlDom.CreateElement(WebData.oMessageDoc, "KpiLogEntry", NS_ilp);
      oKpiLogEntry.setAttribute("ID", ID);
      oKpiLogEntry = oKpiDescriptor.appendChild(oKpiLogEntry);
    }

    return oKpiLogEntry;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_AddKpiLogEntry", "")
  }
}

function WebMessage_SaveKpiDescriptor()
{
  try
  {
    if (window.KpiTrackingEnabled == true)
    {
      this.InitKpiDescriptor();
      this.SetKpiDescriptor("UrlReferer", window.location.href);
      this.SetKpiDescriptor("LogStart", WebControl.ConvertDateToXmlDate(WebControl.KpiLogStart, true));
      this.SetKpiDescriptor("LogEnd", WebControl.ConvertDateToXmlDate(WebControl.KpiLogEnd, true));
      this.SetKpiDescriptor("NumberOfBinds", WebControl.NumberOfBinds);
      WebControl.KpiLogbookTransfer(this.GetKpiDescriptor());
      WebControl.InitKpiLogging();


      if (this.KpiSend == true || this.KpiSend == null)
      {
        this.oWM_XMLHTTP1 = Ilp.XmlDom.CreateXmlHttp();

        var webMethode = "SaveKpiDescriptor";
        var webMessage = this.GetXml(false);
        var webEnvelope = this.GetSoapEnvelope(webMessage, webMethode);
        var webServiceUrl = this.GetServiceUrl();

        Ilp.XmlDom.SetOnReadyStateChange(this.oWM_XMLHTTP1, WebMessage_SaveKpiDescriptorORSCHandler);

        this.oWM_XMLHTTP1.open("POST", webServiceUrl, true);
        this.oWM_XMLHTTP1.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
        this.oWM_XMLHTTP1.setRequestHeader("Content-Length", webEnvelope.length);
        this.oWM_XMLHTTP1.setRequestHeader("SOAPAction", "http://ilp.de/webservices/" + webMethode);

        this.oWM_XMLHTTP1.send(webEnvelope);

      }
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_SaveKpiDescriptor", "Section1")
  }
}

function WebMessage_SaveKpiDescriptorORSCHandler()
{
  try
  {
    if (Ilp.XmlDom.GetReadyState(WebMessage.oWM_XMLHTTP1) == 4)
    {
      WebMessage.KpiSend = true;
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_SaveKpiDescriptorORSCHandler", "Section1")
  }
}

function WebMessage_ShowChangeHistory(tablename, columname, IDValue, hideComittedColumn)
{
  try
  {

    var features = "";
    if (hideComittedColumn == true)
    {
      features += "dialogWidth:700px;";
    }
    else
    {
       features += "dialogWidth:930px;";
    }
    features += "dialogHeight:600px;";
    features += "scroll:Yes;";
    features += "status:No;";
    features += "resizable:Yes;";

    var url = GlobalScriptsDirectoryVirtual + "GTCommon/ChangeHistory.aspx?TableName=" + tablename + "&ColumnName=" + columname + "&IDValue=" + IDValue + "&Language=" + Language + "&PP=" + PPInDialogWithManyRecords;
    if (hideComittedColumn == true) url += "&HCC=1";
    return WebControl.ShowModalDialog(url, features);
  }
  catch (exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_ShowChangeHistory", "")
  }
}

function WebMessage_AddAttachmentItem(ID, Filename, FilenameTemp)
{
  try
  {
    var oSendMailInfoAttachmentItem = null;
    if (WebData.oMessageDoc != null)
    {
      var oSendMailInfo = this.GetSendMailInfo();

      oSendMailInfoAttachmentItem = Ilp.XmlDom.CreateElement(WebData.oMessageDoc, "AttachmentItem", NS_ilp);
      oSendMailInfoAttachmentItem.setAttribute("ID", ID);
      oSendMailInfoAttachmentItem.setAttribute("Filename", Filename);
      oSendMailInfoAttachmentItem.setAttribute("FilenameTemp", FilenameTemp);

      oSendMailInfoAttachmentItem = oSendMailInfo.appendChild(oSendMailInfoAttachmentItem);
    }

    return oSendMailInfoAttachmentItem;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_AddAttachmentItem", "")
  }
}

function WebMessage_GetSendMailInfo()
{
  try
  {
    oSendMailInfo = WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:SendMailInfo");
    return oSendMailInfo;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_GetSendMailInfo", "")
  }
}

function WebMessage_InitSendMailInfo()
{
  try
  {
    var oSendMailInfo = this.GetSendMailInfo();
    if (oSendMailInfo != null)
    {
      var oAttachmentItemList = oSendMailInfo.selectNodes("ilp:AttachmentItem");
      var count = oAttachmentItemList.length;
      for (var i = 0; i < count; i++)
      {
        var oAttachmentItem = oAttachmentItemList[i];
        oSendMailInfo.removeChild(oAttachmentItem);
      }
    }
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_InitSendMailInfo", "Section1")
  }
}



function WebMessage_GetLoaderDescriptor()
{
  try
  {
    var oLoaderDescriptor = WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:GeneralInfo/ilp:LoaderDescriptor");
    return oLoaderDescriptor;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_GetLoaderDescriptor", "Section1")
  }
}

function WebMessage_GetResponseLoaderDescriptor()
{
  try
  {
    var xPath = "/soap:Envelope/soap:Body/ilp:GetLoaderDescriptorResponse/ilp:WebMessage/ilp:GeneralInfo/ilp:LoaderDescriptor";
    var oLoaderDescriptor = this.oMessageResponseDoc.selectSingleNode(xPath);
    if (oLoaderDescriptor == null)
    {
      xPath = "/soap:Envelope/soap:Body/ilp:GetWinLoaderDescriptorResponse/ilp:WebMessage/ilp:GeneralInfo/ilp:LoaderDescriptor";
      oLoaderDescriptor = this.oMessageResponseDoc.selectSingleNode(xPath);
    }
    return oLoaderDescriptor;
  }
  catch(exception){
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_GetResponseLoaderDescriptor", "Section1")
  }
}

function WebMessage_GetXmlDoc(xmlString)
{
  try
  {
    var oDoc = Ilp.XmlDom.CreateXmlDom();
    oDoc.async = false;
    oDoc.validateOnParse = false;
    oDoc.loadXML(xmlString);
    return oDoc.documentElement;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "GetXmlDoc", "Section1")
  }
}

function WebMessage_GetWebSpreadSheetDescriptor()
{
  try
  {
    var oWebSpreadSheetDescriptor = null;
    if (WebData.oMessageDoc != null)
    {
      oWebSpreadSheetDescriptor = WebData.oMessageDoc.selectSingleNode("//ilp:WebSpreadSheetDescriptor");
    }
    return oWebSpreadSheetDescriptor;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_GetWebSpreadSheetDescriptor", "")
  }
}

function WebMessage_SetWebSpreadSheetDescriptor(moverListBox2, mode)
{
  try
  {
    mode = mode == null ? "Standard" : mode;
    
    var oGetWebSpreadSheetDescriptor = this.GetWebSpreadSheetDescriptor();
    var moverListBox2Instance = null;
    // Html-Control
    if (Ilp.HtmlDom.IsHtmlElement(moverListBox2) == true)
    {
      moverListBox2Instance = moverListBox2.JsInstance;
    }
    else
    {
      moverListBox2Instance = moverListBox2;
    }
    
    for (var i = 0, len = moverListBox2Instance.LeftList.childNodes.length; i < len; i++)
    {
      var item = moverListBox2Instance.LeftList.childNodes[i];
      var xPath = "ilp:WebSpreadSheetColumnDescriptor[@ID='" + Ilp.HtmlDom.GetAttribute(item, "IDRef", "") + "']";
      var oWebSpreadSheetColumn = oGetWebSpreadSheetDescriptor.selectSingleNode(xPath);
      if (oWebSpreadSheetColumn)
      {
        Ilp.HtmlDom.SetAttribute(oWebSpreadSheetColumn, "VisibleInSpreadSheet", "true");
        Ilp.HtmlDom.SetAttribute(oWebSpreadSheetColumn, "ColumnPosition", String(i+1));
      }
    }
    for (var i = 0, len = moverListBox2Instance.RightList.childNodes.length; i < len; i++)
    {
      var item = moverListBox2Instance.RightList.childNodes[i];
      var xPath = "ilp:WebSpreadSheetColumnDescriptor[@ID='" + Ilp.HtmlDom.GetAttribute(item, "IDRef", "") + "']";
      var oWebSpreadSheetColumn = oGetWebSpreadSheetDescriptor.selectSingleNode(xPath);
      if (oWebSpreadSheetColumn)
      {
        Ilp.HtmlDom.SetAttribute(oWebSpreadSheetColumn, "VisibleInSpreadSheet", "false");
        Ilp.HtmlDom.SetAttribute(oWebSpreadSheetColumn, "ColumnPosition", String(i+1));
      }  
    }
    
    return oGetWebSpreadSheetDescriptor;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_SetWebSpreadSheetDescriptor", "")
  }
}

function WebMessage_GetWebTableExportDescriptor()
{
  try
  {
    var oWebTableExportDescriptor = null;
    if (WebData.oMessageDoc != null)
    {
      oWebTableExportDescriptor = WebData.oMessageDoc.selectSingleNode("//ilp:WebTableExportDescriptor");
    }
    return oWebTableExportDescriptor;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_GetWebTableExportDescriptor", "")
  }
}

function WebMessage_SetWebTableExportDescriptor(moverListBox2, mode)
{
  try
  {
    mode = mode == null ? "Standard" : mode;
    
    var oGetWebTableExportDescriptor = this.GetWebTableExportDescriptor();
    var moverListBox2Instance = null;
    // Html-Control
    if (Ilp.HtmlDom.IsHtmlElement(moverListBox2) == true)
    {
      moverListBox2Instance = moverListBox2.JsInstance;
    }
    else
    {
      moverListBox2Instance = moverListBox2;
    }
    
    for (var i = 0, len = moverListBox2Instance.LeftList.childNodes.length; i < len; i++)
    {
      var item = moverListBox2Instance.LeftList.childNodes[i];
      var xPath = "ilp:WebTableExportColumnDescriptor[@ID='" + Ilp.HtmlDom.GetAttribute(item, "IDRef", "") + "']";
      var oWebTableExportColumn = oGetWebTableExportDescriptor.selectSingleNode(xPath);
      if (oWebTableExportColumn)
      {
        Ilp.HtmlDom.SetAttribute(oWebTableExportColumn, "VisibleInExportEffective", "false");
        Ilp.HtmlDom.SetAttribute(oWebTableExportColumn, "ColumnPositionEffective", String(i));
      }
    }
    for (var i = 0, len = moverListBox2Instance.RightList.childNodes.length; i < len; i++)
    {
      var item = moverListBox2Instance.RightList.childNodes[i];
      var xPath = "ilp:WebTableExportColumnDescriptor[@ID='" + Ilp.HtmlDom.GetAttribute(item, "IDRef", "") + "']";
      var oWebTableExportColumn = oGetWebTableExportDescriptor.selectSingleNode(xPath);
      if (oWebTableExportColumn)
      {
        Ilp.HtmlDom.SetAttribute(oWebTableExportColumn, "VisibleInExportEffective", "true");
        Ilp.HtmlDom.SetAttribute(oWebTableExportColumn, "ColumnPositionEffective", String(i));
      }  
    }
    
    return oGetWebTableExportDescriptor;
  }
  catch(exception)
  {
    if (WebMessage) WebMessage.SendClientLog(exception, "WebMessage_SetWebTableExportDescriptor", "")
  }
}


/* ============================ GTWebData.js ===========================*/
var NS_diffgr = "urn:schemas-microsoft-com:xml-diffgram-v1";
var NS_msdata = "urn:schemas-microsoft-com:xml-msdata";
var NS_ilp = "http://ilp.de/webservices/";

var ATT_IlpId = "msdata:hiddenIlpId";
var ATT_IlpHash = "ilp:hash";

var PF_diffgr = "diffgr";
var PF_msdata = "msdata";
var PF_ilp = "ilp";

var RS_empty = "";
var RS_detached = "detached";
var RS_attached = "attached";
var RS_modified = "modified";
var RS_inserted = "inserted";
var RS_deleted = "deleted";
var RS_transferred = "transferred";

function LoadWebData(xmlDomObject)
{
  try
  {
    if (window.XmlVersion == enum_XmlVersion_V1)
    {
      var oXMLObject = window.event.srcElement;    
      // Null-Prüfung hinzugefügt, Boris 06.02.2010  
      if (oXMLObject && oXMLObject.readyState == 'complete')
      {
        EnsureWebMessage();
        EnsureWebForm();
        EnsureWebControl();
      
        WebData = new WebDataClass(oXMLObject.XMLDocument);
      }
    }
    else if (window.XmlVersion == enum_XmlVersion_V3)
    {
      EnsureWebMessage();
      EnsureWebForm();
      EnsureWebControl();

      Ilp.Page.LoadWebData();
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "LoadWebData", "")
  }
}

function WebDataClass(xmlDomObject)
{
  try
  {
    this.oMessageDoc = xmlDomObject;
    Ilp.XmlDom.SetSelectionLanguageDefault(this.oMessageDoc);
    Ilp.XmlDom.SetSelectionNamespacesDefault(this.oMessageDoc);
  
    this.AskBeforeUnload = true;
    this.CurrentWindow = window;

    this.SetNamespaces = WebData_SetNamespaces;
  
    this.BeforeValidate = null;

    this.RowUpdating = null;
    this.RowSaved = null;
    this.RowUpdated = null;
    this.AfterSave = null;

    this.PagedWebDataGrid = null;

    this.CreateRecordFromXml = WebData_CreateRecordFromXml;

    this.oWebMessage = null;
    this.oWebData = null;
    this.oWebDataSave = null;
    this.oCurrentRecord = new Object();
    this.ValidationOK = true;

    this.OnAfterAddRecord = null;
    this.OnRowListChanged = null;
    this.AutoClearOnTransfer = false;

    this.ReturnIf = false;
    this.HasChanged = false;

    this.Base64CharacterSet = null;
    this.Base64CharacterPosition = null;

    this.Base64Encode = WebData_Base64Encode;
    this.Base64Decode = WebData_Base64Decode;
    this.Base64InitCharacterSet = WebData_Base64InitCharacterSet;
    this.GetBitValue = WebData_GetBitValue;

    this.UpdateMapping = WebData_UpdateMapping;

    this.MergeWebServiceReturnDataSet = WebData_MergeWebServiceReturnDataSet;
    this.MergeWebServiceReturnRecord = WebData_MergeWebServiceReturnRecord;
    this.ConvertToNewDataSet = WebData_ConvertToNewDataSet;
    this.PrepareLikeParameter = WebData_PrepareLikeParameter;
    this.StripFields = WebData_StripFields;

    this.ForceUpdate = WebData_ForceUpdate;
    this.GetPkValueList = WebData_GetPkValueList;

    this.ExistsChanges = WebData_ExistsChanges;

    this.SetColumnValue = WebData_SetColumnValue;

    this.ValidateOnSave = true;
    this.Refresh = WebData_Refresh;
    this.ReloadRecord = WebData_ReloadRecord;

    this.Validate = WebData_Validate;
    this.GetSibling = WebData_GetSibling;
    this.RefreshServerSearchCache = WebData_RefreshServerSearchCache;
    this.RefreshServerLookUpCache = WebData_RefreshServerLookUpCache;
    this.RefreshClientCache = WebData_RefreshClientCache;
    this.RefreshChildData = WebData_RefreshChildData;
    this.UpdateCacheBinding = WebData_UpdateCacheBinding;
    this.UpdateCache = WebData_UpdateCache;
    this.SwapFieldValue = WebData_SwapFieldValue;

    this.ClipCut = WebData_ClipCut;
    this.ClipCopy = WebData_ClipCopy;
    this.ClipPaste = WebData_ClipPaste;
    this.GetClipboard = WebData_GetClipboard;
    this.SetClipboardData = WebData_SetClipboardData;
    this.GetClipboardData = WebData_GetClipboardData;
    this.GetClipboardValue = WebData_GetClipboardValue;
    this.ClearClipboard = WebData_ClearClipboard;

    this.IsCsv = WebData_IsCsv;
    this.ConvertCsvCellsToPlaceholder = WebData_ConvertCsvCellsToPlaceholder;
    this.ConvertCsvToHtml = WebData_ConvertCsvToHtml;
    this.ConvertRecordToCsv = WebData_ConvertRecordToCsv;
    this.ConvertCsvToRecord = WebData_ConvertCsvToRecord;

    this.SetAllowEdit = WebData_SetAllowEdit;

    this.GetNextRecord = WebData_GetNextRecord;
    this.ReplaceBinding = WebData_ReplaceBinding;
    this.NewRecord = WebData_NewRecord;
    this.ConvertToMasterdata = WebData_ConvertToMasterdata;
    this.AssignMasterdata = WebData_AssignMasterdata;
    this.ImportExchangeData = WebData_ImportExchangeData;
    this.AddRecord = WebData_AddRecord;
    this.CopyRecord = WebData_CopyRecord;
    this.CopyFieldTo = WebData_CopyFieldTo;
    this.CopyFieldFromTo = WebData_CopyFieldFromTo;
    this.CopyRecordTo = WebData_CopyRecordTo;
    this.CopyTo = WebData_CopyTo;
    this.MoveRecord = WebData_MoveRecord;
    this.EmptyRecord = WebData_EmptyRecord;
    this.Page = WebData_Page;
    this.Save = WebData_Save;
    this.SaveRecord = WebData_SaveRecord;
    this.UpdatePrimaryKeyValues = WebData_UpdatePrimaryKeyValues;

    this.GetRecordSelector = WebData_GetRecordSelector;
    this.GetRecordSelectorA = WebData_GetRecordSelectorA;
    this.GetRecordSelectorB = WebData_GetRecordSelectorB;
    this.GetNextRowOrder = WebData_GetNextRowOrder;

    this.Transform = WebData_Transform;
    this.TransformAsync = WebData_TransformAsync;
    this.IsValueDifferent = WebData_IsValueDifferent;
    this.Compare = WebData_Compare;
    this.SetFieldValue = WebData_SetFieldValue;
    this.SetFieldValueOnly = WebData_SetFieldValueOnly;
    this.GetRecordByRowOrder = WebData_GetRecordByRowOrder;
    this.GetRecordListByFieldValue = WebData_GetRecordListByFieldValue;
    this.GetRecordByFieldValue = WebData_GetRecordByFieldValue;
    this.GetRecordByDiffgramId = WebData_GetRecordByDiffgramId;
    this.GetRecordByIlpId = WebData_GetRecordByIlpId;
    this.HasChildRecords = WebData_HasChildRecords;
    this.GetChildRecords = WebData_GetChildRecords;
    this.GetChildRecordByFieldValue = WebData_GetChildRecordByFieldValue;
    this.GetFields = WebData_GetFields;
    this.GetChildFields = WebData_GetChildFields;
    this.ExtractFieldName = WebData_ExtractFieldName;
    this.GetFieldValue = WebData_GetFieldValue;
    this.GetFieldValueInt = WebData_GetFieldValueInt;
    this.GetFieldValueBool = WebData_GetFieldValueBool;
    this.GetPkValue = WebData_GetPkValue;
    this.IsNull = WebData_IsNull;

    this.NumberChildRecords = WebData_NumberChildRecords;

    this.IsChildRecord = WebData_IsChildRecord;
    this.IsFirstRecord = WebData_IsFirstRecord;

    this.SetToDefault = WebData_SetToDefault;
    this.GetRowOrder = WebData_GetRowOrder;
    this.SetRowOrder = WebData_SetRowOrder;
    this.SetRowOrderA = WebData_SetRowOrderA;
    this.ResetRowOrderA = WebData_ResetRowOrderA;
    this.RefreshRowOrder = WebData_RefreshRowOrder;

    this.SetOriginalRecordRowOrder = WebData_SetOriginalRecordRowOrder;

    this.UpdateChildRows = WebData_UpdateChildRows;
    this.UpdateCascade = WebData_UpdateCascade;

    this.GetNewDataSet = WebData_GetNewDataSet;
    this.GetDiffgram = WebData_GetDiffgram;
    this.GetDiffgramBefore = WebData_GetDiffgramBefore;

    this.RemoveBoundControls = WebData_RemoveBoundControls;
    this.RemoveBoundControlsA = WebData_RemoveBoundControlsA;

    this.DeleteReferentialData = WebData_DeleteReferentialData;
    this.OpenDeleteDialog = WebData_OpenDeleteDialog;
    this.DeleteLogicalData = WebData_DeleteLogicalData;

    this.SetDiffgramId = WebData_SetDiffgramId;
    this.SetDiffgramIdA = WebData_SetDiffgramIdA;
    this.GetDiffgramId = WebData_GetDiffgramId;
    this.SetDiffgramParentId = WebData_SetDiffgramParentId;
    this.SetDiffgramParentIdA = WebData_SetDiffgramParentIdA;

    this.SetOriginalRecordDiffgramId = WebData_SetOriginalRecordDiffgramId;
    this.SetOriginalRecordDiffgramParentId = WebData_SetOriginalRecordDiffgramParentId;

    this.GetIlpId = WebData_GetIlpId;
    this.SetIlpId = WebData_SetIlpId;
    this.RemoveIlpId = WebData_RemoveIlpId;

    this.GetRecordHash = WebData_GetRecordHash;
    this.SetRecordHash = WebData_SetRecordHash;
    this.SetRecordHashA = WebData_SetRecordHashA;
    this.SetInitialBindingHash = WebData_SetInitialBindingHash;

    this.AcceptChanges = WebData_AcceptChanges;
    this.DeleteChildRecords = WebData_DeleteChildRecords;
    this.Delete = WebData_Delete;
    this.DeleteSelection = WebData_DeleteSelection;
    this.DeleteChild = WebData_DeleteChild;
    this.GetRecord = WebData_GetRecord;
    this.GetMasterRecord = WebData_GetMasterRecord;
    this.GetFirstRecord = WebData_GetFirstRecord;
    this.GetRow = WebData_GetRow;
    this.GetAllRecords = WebData_GetAllRecords;
    this.RemoveRecord = WebData_RemoveRecord;

    this.GetField = WebData_GetField;
    this.RemoveField = WebData_RemoveField;

    this.GetRowState = WebData_GetRowState;
    this.SetRowState = WebData_SetRowState;
    this.SetRowStateA = WebData_SetRowStateA;
    this.RemoveRowState = WebData_RemoveRowState
    this.RemoveRowStateA = WebData_RemoveRowStateA;

    this.GetFqnAndRowOrder = WebData_GetFqnAndRowOrder;
    this.GetBindingHash = WebData_GetBindingHash;

    this.SetWebData = WebData_SetWebData;
    this.RestoreWebData = WebData_RestoreWebData;

    this.EnsureCurrentRecord = WebData_EnsureCurrentRecord;
    this.GetCurrentRecord = WebData_GetCurrentRecord;
    this.SetCurrentRecord = WebData_SetCurrentRecord;

    this.ClearSelection = WebData_ClearSelection;
    this.ClearSelectionPerTableDescriptor = WebData_ClearSelectionPerTableDescriptor;
    this.ClearChildren = WebData_ClearChildren;

    this.ApplyDefaults = WebData_ApplyDefaults;
    this.ApplyFieldDefault = WebData_ApplyFieldDefault;
    this.ApplyUpdateDefaults = WebData_ApplyUpdateDefaults;
    this.SetUnitDefaults = WebData_SetUnitDefaults;
    this.SaveOriginalRecord = WebData_SaveOriginalRecord;
    this.SaveOriginalRecordA = WebData_SaveOriginalRecordA;
    this.MoveOriginalRecord = WebData_MoveOriginalRecord;
    this.SetAutoIncrementValue = WebData_SetAutoIncrementValue;
    this.SetAutoIncrementValueA = WebData_SetAutoIncrementValueA;
    this.GetNextAutoIncrementValue = WebData_GetNextAutoIncrementValue;

    this.GetSelectedRecords = WebData_GetSelectedRecords;
    this.Select = WebData_Select;
    this.SelectModified = WebData_SelectModified;
    this.GetDataDirect = WebData_GetDataDirect;
    this.GetData = WebData_GetData;
    this.GetDataT = WebData_GetDataT;
    this.Count = WebData_Count;
    this.CountDetail = WebData_CountDetail;
    this.CountInserted = WebData_CountInserted;
    this.UpdateTracking = WebData_UpdateTracking;
    this.UpdateBinding = WebData_UpdateBinding;
    this.UpdateFieldBinding = WebData_UpdateFieldBinding;
    this.UpdateIf = WebData_UpdateIf;

    this.AskDiscardChanges = WebData_AskDiscardChanges;
    this.AskDelete = WebData_AskDelete;
    this.AskDeleteIrrevocably = WebData_AskDeleteIrrevocably;
    this.OnBeforeUnload = WebData_OnBeforeUnload;
    this.SetNull = WebData_SetNull;
    this.SetNullOnly = WebData_SetNullOnly;

    this.Transfer = WebData_Transfer;
    this.TransferChildTable = WebData_TransferChildTable;
    this.TransferSibling = WebData_TransferSibling;
    this.TransferPage = WebData_TransferPage;

    this.MoveTo = WebData_MoveTo;

    this.GetOriginalRecord = WebData_GetOriginalRecord;
    this.GetRecordFromOriginalRecord = WebData_GetRecordFromOriginalRecord;

    this.GetOriginalValue = WebData_GetOriginalValue;
    this.IsColumnOriginal = WebData_IsColumnOriginal;

    this.DeleteInfoReturn == DeleteInfoReturn_Unknown;
    
    this.Refresh();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataClass", "")
  }
}

function WebDataSave(oControl)
{
  try
  {
    if (oControl!=null){
      oControl.disabled = true;
    }

    if (typeof(WebData) == "object") WebData.Save(oControl);

    if (oControl!=null){
      oControl.disabled = false;
    }

  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataSave", "")
  }
}

function WebDataNew(oControl)
{
  try
  {
    if (oControl!=null){
      oControl.disabled = true;
    }

    var oWebSpreadSheet = WebControl.GetWebSpreadSheetMain(true);
    if (oWebSpreadSheet != null)
    {
      oWebSpreadSheet.NewRecord(oControl);
    }

    var oWebDataGrid = WebControl.GetWebDataGridMain();
    if (oWebDataGrid != null)
    {
      oWebDataGrid.NewRecord(oControl);
    }

    if (oControl!=null){
      oControl.disabled = false;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataNew", "")
  }
}

function WebDataNewRoot(oControl)
{
  try
  {
    if (oControl!=null){
      oControl.disabled = true;
    }

    var oWebTreeView = WebControl.GetWebTreeViewMain();
    if (oWebTreeView != null)
    {
      oWebTreeView.NewRoot(oControl);
    }

    if (oControl!=null){
      oControl.disabled = false;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataNewRoot", "")
  }
}

function WebDataCopy(oControl, IDMaster){
  try
  {
    if (oControl!=null)
    {
      oControl.disabled = true;
    }

    var oWebDataGrid = WebControl.GetWebDataGridMain();
    if (oWebDataGrid != null)
    {
      var oFD = FormDescriptor.GetPrimaryKeyFieldDescriptor(oWebDataGrid.TableDescriptorFqn);
      var oFakeControl = new Object();
      oFakeControl.oRecord = WebData.GetRecordByFieldValue(oFD.getAttribute("Fqn"), IDMaster);
      if (oFakeControl.oRecord != null)
      {
        oWebDataGrid.CopyRecord(oFakeControl);
      }
    }

    if (oControl!=null)
    {
      oControl.disabled = false;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataCopy", "")
  }
}

function WebDataLoadSelection(oControl, classType)
{
  try
  {
    if (classType == null || (classType.ClassType && classType.ClassType == "EventArgs"))
    {
      var oWebDataView = WebControl.GetWebDataGridMain(true);
      if (oWebDataView != null) classType = "WebDataGrid"
      else
      {
        oWebDataView = WebControl.GetWebSpreadSheetMain(true);
        if (oWebDataView != null) classType = "WebSpreadSheetClass"
      }
    }
    classType = classType == null ? "WebDataGrid" : classType;

    if (WebData.AskDiscardChanges() == true)
    {
      LoadApplicationStart = new Date();
      WebMessage.ClientStartOfProcessing = new Date();
      WebControl.InitGlobalList();
      WebControl.InitKpiLogging();
      WebControl.AddKpiLogMessage(new Date(), "WebDataLoadSelection", "");
      WebControl.DisableNavMenu();
      WebDataSearch.LoadSelection(oControl, false, classType);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataLoadSelection", "")
  }
}

function WebDataPrintSelection(sender)
{
  try
  {
    if (sender != null)
    {
      sender.disabled = true;
    }

    var oWebDataGrid = WebControl.GetWebDataGridMain(true);
    if (oWebDataGrid != null)
    {
      oWebDataGrid.PrintRecord(sender);
    }

    var oWebTreeView = WebControl.GetWebTreeViewMain(true);
    if (oWebTreeView != null)
    {
      oWebTreeView.PrintRecord(sender);
    }

    if (sender != null){
      sender.disabled = false;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataPrintSelection", "")
  }
}


function WebDataShowReportList(sender, param)
{
  try
  {
    WebControl.AddDisabledControl(sender);

    if (WebControl.CheckSelection() == true)
    {
      WebMessage.InitReportDescriptor();
      var tableDescriptorFqn = "";
      var oWebDataGrid = WebControl.GetWebDataGridMain(true);
      if (oWebDataGrid != null)
      {
        tableDescriptorFqn = oWebDataGrid.TableDescriptorFqn;
      }

      if (tableDescriptorFqn.length > 0)
      {
        // ReportDescriptorID, IDReportList, TableDescriptorFqn, ReportName, ReportNumber, ReportFileName, SelectionFormula
        WebMessage.AddReportDescriptor("R1", "0", tableDescriptorFqn, "", "", "", "");
      }

      WebMessage.SetGeneralInfoAttribute("PageHeadline", PageHeadline);
      WebMessage.SetGeneralInfoAttribute("PageLogo", PageLogo);
      WebMessage.SetGeneralInfoAttribute("IDProgram", IDProgram);
      document.forms["frmAction"].TargetShowURL.value = ReportsPath + "?IDProgram=" + String(IDProgram);
      if (typeof(param) == "string") document.forms["frmAction"].TargetShowURL.value += "&" + param;
      document.forms["frmAction"].WebMessage.value = WebMessage.GetXmlSmall();
      document.forms["frmAction"].action = RootPath + "LoginFrame.aspx";
      document.forms["frmAction"].target = '_blank';
      document.forms["frmAction"].submit();
      document.forms["frmAction"].IDSessionInfo.value = 0;
      document.forms["frmAction"].WebMessage.value = "";
    }

    WebControl.EnableControls();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataShowReportList", "")
  }
}

function WebDataExportToExcel(oControl, excelExportDescriptorFqn)
{
  try
  {
    if (oControl!=null) oControl.disabled = false;
    WebStatusBar.SetStatusbarMessage(ids_ExportingData, 0);
    
    var version = null;
    var oExportDescriptor = null;
    var oExportDescriptorList = FormDescriptor.GetExcelExportDescriptorList();
    if(oExportDescriptorList.length > 0 && excelExportDescriptorFqn == null)
    {
      oExportDescriptor = oExportDescriptorList[0];
      version = oExportDescriptor.getAttribute("Version");
    }
    else if(WebControl.CheckString(excelExportDescriptorFqn) > 0)
    {
      oExportDescriptor = FormDescriptor.GetExcelExportDescriptor(excelExportDescriptorFqn);
      version = oExportDescriptor.getAttribute("Version");
      WebMessage.SetGeneralInfoAttribute("ExcelExportDescriptorFqn", excelExportDescriptorFqn);
    }
    if(oExportDescriptor)
    {
      WebMessage.ExportToExcel(version);
      WebStatusBar.SetStatusbarMessage(ids_DataExported, 0);
      WebControl.OpenExcelDownload();
    }
    if (oControl!=null) oControl.disabled = false;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDataExportToExcel", "")
  }
}


function WebData_SetNamespaces(xmlDocument, mode)
{
  try
  {
    mode = mode == null ? "Standard" : "Transform";

    if (mode == "Transform")
    {
      xmlDocument.setProperty("SelectionLanguage", "XPath");
      xmlDocument.setProperty("SelectionNamespaces", "xmlns:ilp='http://ilp.de/webservices/' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata' xmlns:diffgr='urn:schemas-microsoft-com:xml-diffgram-v1'");
    }
    else
    {
      xmlDocument.setProperty("SelectionLanguage", "XPath");
      xmlDocument.setProperty("SelectionNamespaces", "xmlns:ilp='http://ilp.de/webservices/' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata' xmlns:diffgr='urn:schemas-microsoft-com:xml-diffgram-v1'");
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SetNamespaces", "")
  }
}

function WebData_SetWebData(xmlSourceID)
{
  try
  {
    WebData.oWebDataSave = WebData.oWebData;

    var oXml = null
    if (XmlVersion == enum_XmlVersion_V1) oXml = document.getElementById(xmlSourceID);
    else oXml = Ilp.XmlCache.XmlCacheList.Get(xmlSourceID);

    WebData.oWebData = oXml.documentElement.selectSingleNode("//NewDataSet");
    /*
    var namedNodeMap = WebData.oWebData.attributes;
    oAttribute = WebData.oMessageDoc.createNode(NODE_ATTRIBUTE, "xmlns", "");
    namedNodeMap.setNamedItem(oAttribute);
    */
    var oAttribute = Ilp.XmlDom.GetAttribute(WebData.oWebData, "xmlns", true, WebData.oWebData, "");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SetWebData", "")
  }
}

function WebData_RestoreWebData()
{
  try
  {
    if (WebData.oWebDataSave != null)
    {
      WebData.oWebData = WebData.oWebDataSave;
    }
    WebData.oWebDataSave = null;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_RestoreWebData", "")
  }
}

function WebData_Save(oControl)
{
  try
  {
    if (oControl!=null) oControl.disabled = true;

    if (typeof(WebMessage) == "object")
    {
      WebControl.ValidationOK = true;
      WebControl.WebMessageDescriptorList.Clear();
      if (this.HasChanged == true)
      {
        if (this.ValidateOnSave == true)
        {
          var args = new EventArgs();
          if (this.BeforeValidate != null)
          {
            this.BeforeValidate(oControl, args);
          }
          if (args.Cancel == false)
          {
            this.Validate();
          }
        }

        if (WebControl.ValidationOK == true)
        {
          WebStatusBar.SetDataSavedMessage(ids_SavingData, 1);

          var aChangedRecord = new Array();

          var oSelectedList = null;
          
          args.RowsModified = this.SelectModified();
          for (var i = 0, len = args.RowsModified.length; i < len; i++)
          {
            aChangedRecord[aChangedRecord.length] = args.RowsModified[i];
            if (this.RowUpdating != null)
            {
              this.RowUpdating(args.RowsModified[i]);
            }
          }
          args.RowsDeleted = this.Select("//*[parent::node()[name()='diffgr:before'] and @diffgr:hasChanges='deleted']");
          for (var i = 0, len = args.RowsDeleted.length; i < len; i++)
          {
            aChangedRecord[aChangedRecord.length] = args.RowsDeleted[i];
            if (this.RowUpdating != null)
            {
              this.RowUpdating(args.RowsDeleted[i]);
            }
          }

          WebMessage.SaveData();

          for (var i = 0, len = aChangedRecord.length; i < len; i++)
          {
            WebControl.ClearErrorRow(aChangedRecord[i]);
          }

          this.BadIdList = "";
          if (WebMessage.WebDataErrorList.Count() > 0)
          {
            for (var i = 0, len = WebMessage.WebDataErrorList.Count(); i < len; i++)
            {
              var webDataErrorDescriptor = WebMessage.WebDataErrorList.Get(i);
              this.BadIdList += webDataErrorDescriptor.IlpId + "_";
              var oRecord = this.GetRecordByIlpId(webDataErrorDescriptor.IlpId);
              if (oRecord)
              {
                WebControl.CreateErrorRow(oRecord, webDataErrorDescriptor);
              }
            }
          }

          for (var i = 0, len = aChangedRecord.length; i < len; i++)
          {
            if (this.RowSaved != null)
            {
              var ilpId = this.GetIlpId(aChangedRecord[i]);
              if (this.BadIdList.indexOf(ilpId + "_") == -1)
              {
                this.RowSaved(aChangedRecord[i]);
              }
            }
          }

          this.UpdatePrimaryKeyValues(this.BadIdList);
          this.AcceptChanges(null, this.BadIdList);

          for (var i = 0, len = aChangedRecord.length; i < len; i++)
          {
            var ilpId = this.GetIlpId(aChangedRecord[i]);
            if (this.BadIdList.indexOf(ilpId + "_") == -1)
            {
              this.UpdateIf(aChangedRecord[i]);
              if (this.RowUpdated != null)
              {
                this.RowUpdated(aChangedRecord[i]);
              }
            }
          }

          if (this.AfterSave != null)
          {
            this.AfterSave(oControl, args);
          }

          if (WebMessage.WebDataErrorList.Count() == 0)
          {
            WebStatusBar.SetDataSavedMessage(ids_DataSaved, 1);
          }
          else
          {
            WebStatusBar.SetDataChangedMessage(ids_DataHasError, 1);
          }

        }
        this.ValidateOnSave = true;
      }
    }

    for (var i = 0; i < window.WebFrameArray.length; i++)
    {
      window.WebFrameArray[i].Save();
    }

    if (WebMessage.WebDataErrorList.Count() > 0)
    {
      var oRow = null;
      var webDataErrorDescriptor = WebMessage.WebDataErrorList.Get(0);
      var oRecord = this.GetRecordByDiffgramId(webDataErrorDescriptor.DiffgramId);

      if (oRecord) oRow = WebControl.GetErrorRow(oRecord);
      if (oRow)  WebControl.JumpToControl(oRow);
    }


    if (oControl != null) oControl.disabled = false;
    
    return WebControl.ValidationOK;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_Save", "")
  }
}

function WebData_StripFields(oRecord, oFdList)
{
  try
  {
    for (var i = 0, len = oFdList.length; i < len; i++)
    {
      var oFd = oFdList[i];
      var fqn = oFd.getAttribute("Fqn");
      var xPath = "";
      var xPath = "//" + fqn.split(".").join("[@msdata:rowOrder]/");  // //DiagramParameter[@msdata:rowOrder]/Action[not(@msdata:rowOrder)]
      xPath += "[not(@msdata:rowOrder)]";

      var oFieldList = oRecord.selectNodes(xPath);
      for (var j = 0, len2 = oFieldList.length; j < len2; j++)
      {
        var oField = oFieldList[j];
        if (oField && oField.parentNode)
        {
          oField.parentNode.removeChild(oField);
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_StripFields", "")
  }
}

function WebData_SaveRecord(oRecord)
{
  try
  {
    oRecordTemp = Ilp.XmlDom.CreateXmlDom();
    Ilp.XmlDom.SetSelectionNamespacesDefault(oRecordTemp);
    oRecordTemp.loadXML(Ilp.XmlDom.GetXml(oRecord));

    var oFdList = FormDescriptor.GetNoUpdatableFields(oRecord.nodeName);
    WebData.StripFields(oRecordTemp, oFdList);

    var webMethode  = "SaveRecord";
    var webArgument = "";
    webArgument += "<formDescriptorFileName>" + WebMessage.GetGeneralInfoAttribute("FormDescriptorFileName") + "</formDescriptorFileName>";
    webArgument += "<tableDescriptorFqn>" + oRecord.nodeName + "</tableDescriptorFqn>";
    webArgument += "<xmlData>" + escape(Ilp.XmlDom.GetXml(oRecordTemp)) + "</xmlData>";
    
    var IDPk = WebMessage.CallWebMethod2(webMethode, webArgument);

    if (WebData.GetRowState(oRecord) == RS_inserted)
    {
      var oPrimaryKeyFieldDescriptor = FormDescriptor.GetPrimaryKeyFieldDescriptor(oRecord.nodeName);
      var primaryKeyFieldName = FormDescriptor.GetFieldnameEffective(oPrimaryKeyFieldDescriptor);

      this.SetFieldValueOnly(oRecord, oRecord.nodeName + "." + primaryKeyFieldName, IDPk);
    }
    this.AcceptChanges(oRecord);
    
    if (this.ExistsChanges() == false)
    {
      WebStatusBar.SetDataSavedMessage(ids_DataSaved, 1);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SaveRecord", "")
  }
}

function WebData_Validate()
{
  try
  {
    var done = false;
    var oWebDataGrid = WebControl.GetWebDataGridMain(true);
    if (oWebDataGrid != null)
    {
      done = true;
      WebControl.ValidateForm(oWebDataGrid.Container);
    }
    var oWebSpreadSheet = WebControl.GetWebSpreadSheetMain(true);
    if (oWebSpreadSheet != null)
    {
      done = true;
      WebControl.ValidateForm(oWebSpreadSheet.Container);
    }
    
    if (done == false)
    {
      WebControl.ValidateForm(document);
    }
    return (WebControl.WebMessageDescriptorList.Count() == 0);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_Validate", "")
  }
}

function WebData_SwapFieldValue(oRecord, fdFqn)
{
  try
  {
    var ilpId = this.GetIlpId(oRecord);
    var oRecordSaved = WebMessage.GetRecordByIlpId(oRecord.nodeName, ilpId);
    
    var savedValue = this.GetFieldValue(oRecordSaved, fdFqn);
    
    if (savedValue == null) this.SetNullOnly(oRecord, fdFqn);
    else this.SetFieldValueOnly(oRecord, fdFqn, savedValue);
    
    this.UpdateFieldBinding(oRecord, fdFqn);
    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SwapFieldValue", "")
  }
}

function WebData_UpdatePrimaryKeyValues(badIdList)
{
  try
  {
    badIdList = badIdList == null ? "" : badIdList;

    var IDPrimary = null;
    var IDForeign = null;
    var oRecordSaved = null;
    var diffgramId = "";
    var oRecord = null;
    var oRecordList = this.oWebData.selectNodes("//*[@diffgr:hasChanges='" + RS_inserted + "']");
    for (var i = 0, len = oRecordList.length; i < len; i++)
    {
      oRecord = oRecordList[i];
      var ilpId = this.GetIlpId(oRecord);
      if (badIdList.indexOf(ilpId + "_") == -1)
      {
        oRecordSaved = WebMessage.GetRecordByIlpId(oRecord.nodeName, ilpId);
        oFieldDescriptor = FormDescriptor.GetPrimaryKeyFieldDescriptor(oRecord.nodeName);
        IDPrimary = this.GetFieldValue(oRecordSaved, oFieldDescriptor.getAttribute("Fqn"));
        this.SetFieldValueOnly(oRecord, oFieldDescriptor.getAttribute("Fqn"), IDPrimary);
        this.UpdateFieldBinding(oRecord, oFieldDescriptor.getAttribute("Fqn"));
        var dtrdList = FormDescriptor.GetRelationByDetail(oRecord.nodeName);
        for (var k = 0, len1 = dtrdList.length; k < len1; k++)
        {
          var dtrd = dtrdList[k];
          var foreignKeyFieldFqn = oRecord.nodeName + "." + dtrd.getAttribute("FieldDescriptorFqnListDetail");
          IDForeign = this.GetFieldValue(oRecordSaved, foreignKeyFieldFqn);
          this.SetFieldValueOnly(oRecord, foreignKeyFieldFqn, IDForeign);
          this.UpdateFieldBinding(oRecord, foreignKeyFieldFqn);
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_UpdatePrimaryKeyValues", "")
  }
}

function WebData_GetCurrentRecord(tableDescriptorFqn)
{
  try
  {
    if (typeof(this.oCurrentRecord[tableDescriptorFqn]) == "undefined")
    {
      this.oCurrentRecord[tableDescriptorFqn] = new Object();
      this.oCurrentRecord[tableDescriptorFqn].oRecord = null;
    }
    return this.oCurrentRecord[tableDescriptorFqn].oRecord;
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebData_GetCurrentRecord", "")
  }
}

function WebData_SetCurrentRecord(oRecord)
{
  try
  {
    if (typeof(this.oCurrentRecord[oRecord.nodeName]) == "undefined")
    {
      this.oCurrentRecord[oRecord.nodeName] = new Object();
    }
    this.oCurrentRecord[oRecord.nodeName].oRecord = oRecord;
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebData_SetCurrentRecord", "")
  }
}

function WebData_GetDiffgram(oWebMessage)
{
  try
  {
    oWebMessage = oWebMessage == null ? this.oMessageDoc : oWebMessage
    return oWebMessage.documentElement.selectSingleNode("/ilp:WebMessage/ilp:TransferDataSet/diffgr:diffgram");
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebData_GetDiffgram", "")
  }
}

function WebData_GetDiffgramBefore(create, oWebMessage)
{
  try
  {
    create = create == null ? false : create;
    oWebMessage = oWebMessage == null ? this.oMessageDoc : oWebMessage;

    var oBefore = null;
    if (oWebMessage != null)
    {
      oBefore = oWebMessage.selectSingleNode("/ilp:WebMessage/ilp:TransferDataSet/diffgr:diffgram/diffgr:before");
      if (oBefore == null && create)
      {
        var oDiffgram = oWebMessage.selectSingleNode("/ilp:WebMessage/ilp:TransferDataSet/diffgr:diffgram");
        /*
        oBefore = oWebMessage.createNode(NODE_ELEMENT, "diffgr:before", NS_diffgr);
        */
        oBefore = Ilp.XmlDom.CreateElement(oWebMessage, "diffgr:before", NS_diffgr);
        oDiffgram.appendChild(oBefore);
      }
    }

    return oBefore;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetDiffgramBefore", "")
  }
}

function WebData_GetNewDataSet(oXmlDocument)
{
  try
  {
    oXmlDocument = oXmlDocument == null ? WebData.oMessageDoc : oXmlDocument;
    return oXmlDocument.documentElement.selectSingleNode("//NewDataSet");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetNewDataSet", "")
  }
}

function WebData_ClearSelection()
{
  try
  {
    var oDiffgram = this.GetDiffgram();
    var oDiffgramBefore = this.GetDiffgramBefore();

    if (oDiffgramBefore != null)
    {
      oDiffgram.removeChild(oDiffgramBefore);
    }

    var oNewDataSet = this.GetNewDataSet();
    oDiffgram.removeChild(oNewDataSet);
    
    /*
    var oNewDataSet = this.oMessageDoc.createElement("NewDataSet");
    */
    var oNewDataSet = Ilp.XmlDom.CreateElement(this.oMessageDoc, "NewDataSet", "")
    this.oWebData = oDiffgram.appendChild(oNewDataSet);

    WebControl.ResetBindingList();

    FormDescriptor.Counter = new Object();

    this.HasChanged = false;

  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_ClearSelection", "")
  }
}

function WebData_ClearSelectionPerTableDescriptor(tableDescriptorFqn)
{
  try
  {
    var oDiffgram = WebData.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:TransferDataSet/diffgr:diffgram");

    var oRecordList = oDiffgram.selectNodes("//" + tableDescriptorFqn);
    var oFieldDescriptorList = FormDescriptor.GetFieldDescriptorList(tableDescriptorFqn);

    for (var i = 0, len = oRecordList.length; i < len; i++)
    {
      var oRecord = oRecordList[i];
      WebControl.RemoveBoundControls(oRecord, oFieldDescriptorList);
    }

    oRecordList.removeAll();

  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_ClearSelectionPerTableDescriptor", "")
  }
}

function WebData_ClearChildren(oRecordMaster, tableDescriptorFqn)
{
  try
  {
    var oRecordList = oRecordMaster.selectNodes(tableDescriptorFqn);
    var oFieldDescriptorList = FormDescriptor.GetFieldDescriptorList(tableDescriptorFqn);

    for (var i = 0, len = oRecordList.length; i < len; i++)
    {
      var oRecord = oRecordList[i];
      WebControl.RemoveBoundControls(oRecord, oFieldDescriptorList);
    }

    oRecordList.removeAll();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_ClearChildren", "")
  }
}

function WebData_EnsureCurrentRecord(tableDescriptorFqn)
{
  try
  {
    var oRecord = WebData.GetFirstRecord(tableDescriptorFqn);
    if (oRecord == null)
    {
      oRecord = WebData.NewRecord(tableDescriptorFqn);
      oRecord = WebData.AddRecord(oRecord);
    }

    WebData.SetCurrentRecord(oRecord);
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebData_EnsureCurrentRecord", "")
  }
}


function WebData_CopyRecord(oRecordToBeCopied)
{
  try
  {
    var oRecord = oRecordToBeCopied.cloneNode(true);
    this.SetRowStateA(oRecord, RS_detached);
    this.RemoveIlpId(oRecord, true);

    var oRecordTemp = null;
    var oRecordList = null;
    var oNameList = new WebArray();

    oRecordList = oRecord.selectNodes("descendant::*[@ilp:hash]");
    for (var i = 0, len = oRecordList.length; i < len; i++)
    {
      oRecordTemp = oRecordList[i];
      if (oNameList.Contains(oRecordTemp.nodeName) == false)
      {
        oNameList.Add(oRecordTemp.nodeName);
      }
    }

    for (var i = 0, len = oNameList.Count(); i < len; i++)
    {
      var td = FormDescriptor.GetTableDescriptor(oNameList.Get(i));
      if (td.getAttribute("AllowNew") == "false")
      {
        oRecordList = oRecord.selectNodes("//" + oNameList.Get(i) + "[@ilp:hash]");
        for (var i = 0, len = oRecordList.length; i < len; i++)
        {
          oRecordTemp = oRecordList[i];
          var oRecordParent = oRecordTemp.parentNode;
          oRecordParent.removeChild(oRecordTemp);
        }
      }
    }

    var oFieldDescriptorList = FormDescriptor.GetFieldDescriptorList(oRecord.nodeName);

    for (var i = 0, len = oFieldDescriptorList.length; i < len; i++)
    {
      var oFD = oFieldDescriptorList[i];
      var fqn = oFD.getAttribute("Fqn");
      if (oFD.getAttribute("CopyClass") == "NoCopy")
      {
        this.SetNullOnly(oRecord, fqn);
      }
    }

    this.ApplyDefaults(oRecord, "copy")

    this.HasChanged = true;

    return oRecord;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_CopyRecord", "Section1")
  }
}

function WebData_CopyFieldFromTo(oRecordSource, sourceFqn, oRecordTarget, targetFqn)
{
  try
  {
    this.SetFieldValue(oRecordTarget, targetFqn, this.GetFieldValue(oRecordSource, sourceFqn));
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_CopyFieldFromTo", "Section1")
  }
}

function WebData_CopyFieldTo(oRecord, sourceFqn, targetFqn)
{
  try
  {
    this.SetFieldValue(oRecord, targetFqn, this.GetFieldValue(oRecord, sourceFqn));
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_CopyFieldTo", "Section1")
  }
}

function WebData_CopyRecordTo(oRecordSource, oRecordTarget)
{
  try
  {
    var oFieldDescriptorList = FormDescriptor.GetFieldDescriptorList(oRecordTarget.nodeName);

    for(var i = 0, len1 = oFieldDescriptorList.length; i < len1; i++)
    {
      var oFieldDescripor = oFieldDescriptorList[i];
      var fdFqn = oFieldDescripor.getAttribute("Fqn");

      var savedValue = this.GetFieldValue(oRecordSource, fdFqn);
      this.SetFieldValueOnly(oRecordTarget, fdFqn, savedValue);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_CopyRecordTo", "Section1")
  }
}

function WebData_CopyTo(oRecordSource, oRecordTarget, includePrimaryKeys)
{
  try
  {
    includePrimaryKeys = includePrimaryKeys == null ? true : includePrimaryKeys;

    var oFieldDescriptorListSource = FormDescriptor.GetFieldDescriptorList(oRecordSource.nodeName);

    for (var i = 0, len = oFieldDescriptorListSource.length; i < len; i++)
    {
      var oFieldDescriptorSource = oFieldDescriptorListSource[i];
      var sourceFieldFqn = oFieldDescriptorSource.getAttribute("Fqn");
      var targetFieldFqn = oRecordTarget.nodeName + "." + oFieldDescriptorSource.getAttribute("ID");
      var oFieldDescriptorTarget =  FormDescriptor.GetFieldDescriptor(targetFieldFqn);
      if (oFieldDescriptorTarget)
      {
        if (oFieldDescriptorTarget.getAttribute("CopyClass") != "NoCopy")
        {
          if (oFieldDescriptorTarget.getAttribute("IsPrimaryKey") == null || includePrimaryKeys)
          {
            WebData.SetFieldValueOnly(oRecordTarget, targetFieldFqn, WebData.GetFieldValue(oRecordSource, sourceFieldFqn));
          }
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_CopyTo", "Section1")
  }
}

function WebData_MoveRecord(oRecordSource, tableDescriptorFqnTarget, oMasterRecord)
{
  var oMovedRecord = null;
  try
  {
    oMovedRecord = this.NewRecord(tableDescriptorFqnTarget);

    this.AddRecord(oMovedRecord, oMasterRecord);
    this.RemoveRowState(oMovedRecord);
    this.SetRowState(oMovedRecord, this.GetRowState(oRecordSource));
    this.MoveOriginalRecord(oRecordSource, oMovedRecord);
    this.CopyTo(oRecordSource, oMovedRecord);

    var siblingSource = this.GetSibling(oRecordSource);
    this.RemoveRecord(oRecordSource);
    if (siblingSource != null)
    {
      this.ResetRowOrderA(siblingSource);
      this.SetRowOrderA(siblingSource);
    }
    this.ResetRowOrderA(oMovedRecord);
    this.SetRowOrderA(oMovedRecord);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_MoveRecord", "Section1")
  }
  return oMovedRecord;
}

function WebData_EmptyRecord(oRecord)
{
  try
  {
    var isPrimaryKey = "";
    var fullQualifiedName = "";
    var oFieldDescriptor = null;
    var oFieldDescriptorList = FormDescriptor.GetFieldDescriptorList(oRecord.nodeName);
    for (var i = 0, len = oFieldDescriptorList.length; i < len; i++)
    {
      oFieldDescriptor = oFieldDescriptorList[i];
      isPrimaryKey = oFieldDescriptor.getAttribute("IsPrimaryKey");
      if (isPrimaryKey == "true")
      {
      }
      else
      {
        fullQualifiedName = oFieldDescriptor.getAttribute("Fqn");
        WebData.RemoveField(oRecord, fullQualifiedName);
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_EmptyRecord", "")
  }
}

function WebData_DeleteSelection(xPath)
{
  try
  {
    var oRecord = null;
    var oSelectedList = this.Select(xPath);
    for (var i = 0, len = oSelectedList.length; i < len; i++)
    {
      oRecord = oSelectedList[i];
      this.Delete(oRecord, false);
    }

  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_DeleteSelection", "Section1")
  }
}

function WebData_GetSibling(oRecord)
{
  try
  {
    var sibling = oRecord.selectSingleNode("preceding-sibling::*[@diffgr:id]");
    sibling = sibling == null ? oRecord.selectSingleNode("following-sibling::*[@diffgr:id]") : sibling;

    return sibling;
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebData_GetSibling", "Section1")
  }
}

function WebData_DeleteChildRecords(oRecord, fqn)
{
  try
  {
    var oRecordList;
    if (fqn != null && fqn.length > 0)
    {
      oRecordList = this.GetChildRecords(oRecord, fqn);
      for (var i = 0, len1 = oRecordList.length; i < len1; i++)
      {
        var oChildRecord = oRecordList[i];
        this.Delete(oChildRecord)
      }
    }
    else
    {
      oRecordList = oRecord.selectNodes("*[@msdata:rowOrder]");
      for (var i = 0, len1 = oRecordList.length; i < len1; i++)
      {
        oRecord.removeChild(oRecordList[i]);
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_DeleteChildRecords", "Section1")
  }
}

function WebData_Delete(oRecord, checkDeleteDescriptor, args)
{
  try
  {
    checkDeleteDescriptor = checkDeleteDescriptor == null ? true : checkDeleteDescriptor;

    var returnValue = true;
    var deleteDescriptor = null;
    var tableDescriptor = null;
    var handled = false;

    var oOriginalRecord = null;

    this.DeleteInfoReturn = DeleteInfoReturn_Unknown;

    args = args == null ? new EventArgs() : args;
    args.oRecord = oRecord;
    args.ParentNode = oRecord.parentNode;
    args.Action = "Delete";
    args.CheckDeleteDescriptor = checkDeleteDescriptor;

    args.OffsetRecord = this.GetSibling(oRecord);

    if (typeof(this.BeforeDelete) == "function")
    {
      this.BeforeDelete(sender, args);
      checkDeleteDescriptor = args.CheckDeleteDescriptor;
    }

    tableDescriptor = FormDescriptor.GetTableDescriptor(oRecord.nodeName);
    if (tableDescriptor.getAttribute("DeleteClass") == "PagedDetailDelete")
    {
      handled = true;
      if (typeof(this.OnPagedDetailDelete) == "function")
      {
        this.OnPagedDetailDelete(sender, args);
        this.DeleteInfoReturn = args.DeleteInfoReturn;
        returnValue = true;
      }
    }
    else if (tableDescriptor.getAttribute("DeleteClass") == "LogicalDelete")
    {
      handled = true;
      this.DeleteInfoReturn = this.DeleteLogicalData(oRecord);
      if (this.DeleteInfoReturn == DeleteInfoReturn_Deleted)
      {
        returnValue = true;
      }
    }

    if (handled == false)
    {
      if (checkDeleteDescriptor == true)
      {
        deleteDescriptor = FormDescriptor.GetDeleteDescriptor(oRecord.nodeName);
      }

      if (deleteDescriptor != null)
      {
        handled = true;
        returnValue = false;

        var rowState = this.GetRowState(oRecord);
        if (rowState != RS_inserted && rowState != RS_detached)
        {
          this.DeleteInfoReturn = this.DeleteReferentialData(oRecord);
          if (this.DeleteInfoReturn == DeleteInfoReturn_Deleted)
          {
            returnValue = true;
          }
        }
        else
        {
          returnValue = true;
        }
      }
    }

    if (handled == false)
    {
      handled = true;
      WebStatusBar.SetDataChangedMessage(ids_DataChanged, 1);

      // wegen des cascade delete rule, muss hier nur der Master
      // gelöscht werden.
      var rowState = this.GetRowState(oRecord);
      if (rowState != RS_inserted && rowState != RS_detached)
      {
        this.SetRowState(oRecord, RS_deleted);
        oOriginalRecord = this.SaveOriginalRecord(oRecord);
      }
      returnValue = true;
      this.HasChanged = true;
    }

    if (returnValue == true)
    {
      this.RemoveBoundControlsA(oRecord);

      if (typeof(this.OnRowListChanged) == "function")
      {
        this.OnRowListChanged(oRecord, args);
      }

      this.RemoveRecord(oRecord);

      if (args.OffsetRecord == null)
      {
        args.OffsetRecord = oOriginalRecord;
      }

      if (args.OffsetRecord != null && args.DoRowOrder == true)
      {
        this.ResetRowOrderA(args.OffsetRecord);
        this.SetRowOrderA(args.OffsetRecord);
      }
    }

    return returnValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_Delete", "Section1")
  }
}

function WebData_DeleteChild(oMasterRecord, oRecord){
  try
  {
    this.Delete(oRecord);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_DeleteChild", "Section1")
  }
}

function WebData_DeleteLogicalData(oRecord)
{
  try
  {
    var xmlData = "";
    var bContinue = true;
    var retValue = "";

    WebMessage.SetGeneralInfoAttribute("PageLogo", PageLogo);

    var oDeleteInfo = WebMessage.AddDeleteInfo("D1", "", this.GetPkValue(oRecord), "", oRecord.nodeName);
    oDeleteInfo.setAttribute("PageHeadline", PageHeadline);
    oDeleteInfo.setAttribute("PageTitle", PageTitle);

    var webMethode = "DeleteLogicalData";
    var webArgument = "";
    retValue = WebMessage.CallWebMethod2(webMethode, webArgument, null, null, "DeleteLogicalData");

    return retValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_DeleteLogicalData", "Section1")
  }
}

function WebData_RemoveBoundControls(oRecord)
{
  try
  {
    var oFieldDescriptorList = FormDescriptor.GetFieldDescriptorList(oRecord.nodeName);
    WebControl.RemoveBoundControls(oRecord, oFieldDescriptorList)
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_RemoveBoundControls", "Section1")
  }
}

function WebData_RemoveBoundControlsA(oRecord)
{
  try
  {
    this.RemoveBoundControls(oRecord);

    var xPath = ".//*[@diffgr:id]";
    var oSelectedList = oRecord.selectNodes(xPath);
    for (var i = 0, len = oSelectedList.length; i < len; i++)
    {
      var oSelected = oSelectedList[i];
      this.RemoveBoundControls(oSelected);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_RemoveBoundControlsA", "Section1")
  }
}

function WebData_RemoveRecord(oRecord)
{
  try
  {
    if (oRecord.parentNode)
    {
      var oParent = oRecord.parentNode;
      oParent.removeChild(oRecord);
    }
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebData_RemoveRecord", "Section1")
  }
}

function WebData_GetSelectedRecords(oMasterRecord, tdFqn)
{
  try
  {
    return this.GetChildRecords(oMasterRecord, tdFqn + "[Selected='true']");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetSelectedRecords", "Section1")
  }
}

function WebData_Select(xPath, oXmlDocument, index)
{
  try
  {
    oXmlDocument = oXmlDocument == null ? WebData.oWebData : oXmlDocument;
    index = index == null ? -1 : index;

    var oRecordList = oXmlDocument.selectNodes(xPath);
    if (index > -1)
    {
      return oRecordList[index];
    }
    else
    {
      return oRecordList;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_Select", "Section1")
  }
}

function WebData_SelectModified(oXmlDocument, index)
{
  try
  {
    oXmlDocument = oXmlDocument == null ? WebData.oWebData : oXmlDocument;
    index = index == null ? -1 : index;

    if (oXmlDocument != null)
    {
      var oRecordList = this.Select("//*[parent::node()[name()!='diffgr:before'] and @diffgr:hasChanges]");
      if (index > -1)
      {
        return oRecordList[index];
      }
      else
      {
        return oRecordList;
      }
    }
    return null;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SelectModified", "Section1")
  }
}

function WebData_Count(tableDescriptorFqn)
{
  try
  {
    var oRecordList = WebData.oWebData.selectNodes(tableDescriptorFqn);
    return oRecordList.length;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_Count", "Section1")
  }
}

function WebData_CountDetail(oRecord, tableDescriptorFqn)
{
  try
  {
    var oRecordList = oRecord.selectNodes(tableDescriptorFqn);
    return oRecordList.length;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_CountDetail", "Section1")
  }
}

function WebData_CountInserted(tableDescriptorFqn, oMasterRecord)
{
  try
  {
    var oRecordList = null;
    if (oMasterRecord)
    {
      oRecordList = oMasterRecord.selectNodes(tableDescriptorFqn + "[@msdata:rowOrder and @diffgr:hasChanges='" + RS_inserted + "']");
    }
    else
    {
      oRecordList = WebData.oWebData.selectNodes(tableDescriptorFqn + "[@msdata:rowOrder and @diffgr:hasChanges='" + RS_inserted + "']");
    }
    return oRecordList.length;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_CountInserted", "Section1")
  }
}

function WebData_AcceptChanges(oRecord, badIdList)
{
  try
  {
    badIdList = badIdList == null ? "" : badIdList;

    var oDiffgram = this.GetDiffgram();

    var oDiffgramBefore = this.GetDiffgramBefore();
    if (oDiffgramBefore != null)
    {
      for (var i = oDiffgramBefore.childNodes.length - 1; i >= 0; i--)
      {
        var oNode = oDiffgramBefore.childNodes[i];
        var ilpId = this.GetIlpId(oNode);
        if (badIdList.indexOf(ilpId + "_") == -1)
        {
          oDiffgramBefore.removeChild(oNode);
        }
      }
      if (oDiffgramBefore.childNodes.length == 0)
      {
        oDiffgram.removeChild(oDiffgramBefore);
      }
    }

    var oNodeList = null;
    var oNode = null;
    var oAttribute = null;

    if (oRecord != null)
    {
      oNodeList = oRecord.selectNodes("//*[@diffgr:hasChanges]");
    }
    else
    {
      oNodeList = this.oMessageDoc.selectNodes("//*[@diffgr:hasChanges]");
    }

    for (var i = 0, len = oNodeList.length; i < len; i++)
    {
      oNode = oNodeList[i];
      var ilpId = this.GetIlpId(oNode);
      if (badIdList.indexOf(ilpId + "_") == -1)
      {
        oAttribute = oNode.removeAttribute("diffgr:hasChanges");
      }
    }

    if (badIdList.length == 0) this.HasChanged = false
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_AcceptChanges", "Section1")
  }
}


function WebData_GetField(oRecord, fieldDescriptorFqn)
{
  try
  {
    var aFqn = fieldDescriptorFqn.split(".");
    var oField = null;

    if (oRecord != null)
    {
      if (aFqn.length == 2)
      {
        oField = oRecord.selectSingleNode(aFqn[1]);
      }
    }

    return oField;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetField", "Section1")
  }
}

function WebData_RemoveField(oRecord, fieldDescriptorFqn)
{
  try
  {
    var aFqn = fieldDescriptorFqn.split(".");
    var oField = null;

    if (oRecord != null)
    {
      oField = oRecord.selectSingleNode(aFqn[1]);
      if (oField != null)
      {
        oRecord.removeChild(oField);
      }
    }

    return oField;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_RemoveField", "Section1")
  }
}

function WebData_GetFieldValue(oRecord, fieldDescriptorFqn)
{
  try
  {
    var returnValue = "";
    var aFqn = fieldDescriptorFqn.split(".");
    var oField = null;

    if (oRecord != null)
    {
      var oField = null;

      if (aFqn.length == 2) oField = oRecord.selectSingleNode(aFqn[1]);
      else if (aFqn.length == 1) oField = oRecord.selectSingleNode(aFqn[0]);

      if (oField != null) returnValue = oField.text;
      else returnValue = null;
    }

    return returnValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetFieldValue", "Section1", this.GetFieldValue);
  }
}

function WebData_IsNull(oRecord, fieldDescriptorFqn)
{
  try
  {
    return (this.GetFieldValue(oRecord, fieldDescriptorFqn) == null);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_IsNull", "Section1");
  }
}

function WebData_ExtractFieldName(fieldDescriptorFqn)
{
  try
  {
    var aFqn = fieldDescriptorFqn.split(".");
    var filedName = "";
    
    if (aFqn.length == 2) filedName = aFqn[1];
    else filedName = aFqn[0];

    return filedName;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_ExtractFieldName", "Section1")
  }
}

function WebData_GetFieldValueInt(oRecord, fieldDescriptorFqn)
{
  try
  {
    var returnValue = WebData.GetFieldValue(oRecord, fieldDescriptorFqn);
    returnValue = returnValue * 1;
    return returnValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetFieldValueInt", "Section1", this.GetFieldValueInt);
  }
}

function WebData_GetFieldValueBool(oRecord, fieldDescriptorFqn)
{
  try
  {
    var returnValue = WebData.GetFieldValue(oRecord, fieldDescriptorFqn);

    if (returnValue == "true" || returnValue == "True") returnValue = true;
    else returnValue = false;

    return returnValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetFieldValueBool", "Section1", this.GetFieldValueInt);
  }
}

function WebData_GetPkValue(oRecord)
{
  try
  {
    var pkValue = "";
    var fdPk = FormDescriptor.GetPrimaryKeyFieldDescriptor(oRecord.nodeName);
    pkValue = WebData.GetFieldValue(oRecord, fdPk.getAttribute("Fqn"));

    return pkValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetPkValue", "Section1")
  }
}


function WebData_GetRecordByRowOrder(xPath, rowOrder)
{
  try
  {
    xPath += "[@msdata:rowOrder='" + rowOrder + "']";

    return WebData.oWebData.selectSingleNode(xPath);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetRecordByRowOrder", "Section1")
  }
}

function WebData_GetRecordListByFieldValue(fieldDescriptorFqn, value, oXmlDocument, oMasterRecord)
{
  try
  {
    var aFqn = fieldDescriptorFqn.split(".");
    var oRecordList = null;
    var xPath = "";

    oXmlDocument = oXmlDocument == null ? WebData.oWebData : oXmlDocument;
    if (typeof(value) == "string")
    {
      if (oMasterRecord)
      {
        xPath = this.GetRecordSelectorB(oMasterRecord) + "/";
      }
      xPath = xPath + aFqn[0] + "[" + aFqn[1] + "='" + value + "']";
      oRecordList = oXmlDocument.selectNodes(xPath);
    }
    else
    {
      if (value == null)
      {
        if (oMasterRecord)
        {
          xPath = this.GetRecordSelectorB(oMasterRecord) + "/";
        }
        xPath = xPath + aFqn[0] + "[not (" + aFqn[1] + ")]";
        oRecordList = oXmlDocument.selectNodes(xPath);
      }
    }

    return oRecordList;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetRecordListByFieldValue", "Section1")
  }
}

function WebData_GetRecordByFieldValue(fieldDescriptorFqn, value, oXmlDocument, oMasterRecord)
{
  try
  {
    var aFqn = fieldDescriptorFqn.split(".");
    var oRecord = null;
    var xPath = "";
    if (typeof(value) == "number") value = String(value);

    oXmlDocument = oXmlDocument == null ? WebData.oWebData : oXmlDocument;
    if (typeof(value) == "string")
    {
      if (oMasterRecord)
      {
        xPath = this.GetRecordSelectorB(oMasterRecord) + "/";
      }
      xPath = xPath + aFqn[0] + "[" + aFqn[1] + "='" + value + "']";
      oRecord = oXmlDocument.selectSingleNode(xPath);
    }
    else
    {
      if (value == null)
      {
        if (oMasterRecord)
        {
          xPath = this.GetRecordSelectorB(oMasterRecord) + "/";
        }
        xPath = xPath + aFqn[0] + "[not (" + aFqn[1] + ")]";
        oRecord = oXmlDocument.selectSingleNode(xPath);
      }
    }

    return oRecord;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetRecordByFieldValue", "Section1")
  }
}

function WebData_GetRecordByDiffgramId(diffgramId)
{
  try
  {
    var xPath = "//*[@diffgr:id='" + diffgramId + "']";

    return WebData.oWebData.selectSingleNode(xPath);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetRecordByDiffgramId", "Section1")
  }
}

function WebData_GetRecordByIlpId(ilpId)
{
  try
  {
    var xPath = "//*[@" + ATT_IlpId + "='" + ilpId + "']";

    return this.oWebData.selectSingleNode(xPath);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetRecordByIlpId", "Section1")
  }
}

function WebData_GetChildRecordByFieldValue(oMasterRecord, fieldDescriptorFqn, value)
{
  try
  {
    var aFqn = fieldDescriptorFqn.split(".");
    var oRecord = null;
    var xPath = "";

    if (typeof(value) == "string")
    {
      xPath = aFqn[0] + "[" + aFqn[1] + "='" + value + "']";
      oRecord = oMasterRecord.selectSingleNode(xPath);
    }
    else
    {
      if (value == null)
      {
        xPath = aFqn[0] + "[not (" + aFqn[1] + ")]";
        oRecord = oMasterRecord.selectSingleNode(xPath);
      }
    }

    return oRecord;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetChildRecordByFieldValue", "Section1")
  }
}

function WebData_GetChildRecords(oMasterRecord, fqn)
{
  try
  {
    var aFqn = fqn.split(".");
    var oRecordList = null;
    var xPath = "";

    xPath = aFqn[0] + "[@msdata:rowOrder]";
    
    if (oMasterRecord == null)
    {
      oRecordList = this.oWebData.selectNodes(xPath);
    }
    else
    {
      oRecordList = oMasterRecord.selectNodes(xPath);
    }

    return oRecordList;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetChildRecords", "Section1")
  }
}

function WebData_GetFields(oRecord)
{
  try
  {
    var oFieldList = oRecord.selectNodes("*[not(@msdata:rowOrder)]");
    return oFieldList;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetFields", "Section1")
  }
}

function WebData_GetChildFields(oMasterRecord, fqn)
{
  try
  {
    var aFqn = fqn.split(".");
    var oFieldList = null;
    var xPath = "";

    xPath = aFqn[0] + "[@msdata:rowOrder]/" + aFqn[1];
    
    if (oMasterRecord == null)
    {
      oFieldList = this.oWebData.selectNodes(xPath);
    }
    else
    {
      oFieldList = oMasterRecord.selectNodes(xPath);
    }

    return oFieldList;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetChildFields", "Section1")
  }
}

function WebData_NumberChildRecords(oMasterRecord, tableDescriptorFqn, positionFqn)
{
  try
  {
    var aFqn = tableDescriptorFqn.split(".");
    var oRecordList = null;
    var xPath = "";

    xPath = aFqn[0] + "[@msdata:rowOrder]";
    
    if (oMasterRecord == null)
    {
      oRecordList = WebData.oWebData.selectNodes(xPath);
    }
    else
    {
      oRecordList = oMasterRecord.selectNodes(xPath);
    }
    for (var i = 0, len = oRecordList.length; i < len; i++)
    {
      this.SetFieldValue(oRecordList[i], positionFqn, String(i+1));
    }

    return oRecordList.length;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_NumberChildRecords", "Section1")
  }
}

function WebData_HasChildRecords(oMasterRecord)
{
  try
  {
    var oRecordList = null;
    var xPath = "";

    xPath = "./*[@msdata:rowOrder]";
    oRecordList = oMasterRecord.selectNodes(xPath);

    return oRecordList.length > 0;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_HasChildRecords", "Section1")
  }
}

function WebData_SetNull(oRecord, fieldDescriptorFqn)
{
  try
  {
    var aFqn = fieldDescriptorFqn.split(".");

    if (aFqn.length == 2) oField = oRecord.selectSingleNode(aFqn[1]);
    else if (aFqn.length == 1) oField = oRecord.selectSingleNode(aFqn[0]);
      
    if (oRecord.nodeName != aFqn[0])
    {
      return;
    }

    WebStatusBar.SetDataChangedMessage(ids_DataChanged, 1);

    WebData.SaveOriginalRecord(oRecord);
    WebData.SetRowState(oRecord, RS_modified);

    if (oField != null){
      oRecord.removeChild(oField);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SetNull", "Section1")
  }
}

function WebData_SetNullOnly(oRecord, fieldDescriptorFqn)
{
  try
  {
    var aFqn = fieldDescriptorFqn.split(".");
    var oField = oRecord.selectSingleNode(aFqn[1]);

    if (oRecord.nodeName != aFqn[0])
    {
      return;
    }

    if (oField != null){
      oRecord.removeChild(oField);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SetNullOnly", "Section1")
  }
}

function WebData_SetFieldValue(oRecord, fieldDescriptorFqn, value, checkDifference)
{
  try
  {
    checkDifference = checkDifference == null ? false : true;
    var writeEmptyString = true;
    var aFqn = fieldDescriptorFqn.split(".");
    var fieldName = "";
    var oField = null;
    if (aFqn.length == 2) fieldName = aFqn[1];
    else if (aFqn.length == 1) fieldName = aFqn[0];

    oField = oRecord.selectSingleNode(fieldName);
    if (aFqn.length == 2 && oRecord.nodeName != aFqn[0])
    {
      return value;
    }

    if (checkDifference == true)
    {
      if (this.IsValueDifferent(oRecord, fieldDescriptorFqn, value) == false)
      {
        return value;
      }
    }

    WebStatusBar.SetDataChangedMessage(ids_DataChanged, 1);

    var rowState = this.GetRowState(oRecord);
    if (rowState != RS_inserted && rowState != RS_detached)
    {
      this.SetRowState(oRecord, RS_modified);
    }
    this.SaveOriginalRecord(oRecord);
    this.ApplyUpdateDefaults(oRecord);

    if (value != null)
    {
      value = String(value);
      if (value == "")
      {
        var oFieldDescriptor = FormDescriptor.GetFieldDescriptor(fieldDescriptorFqn);
        if (String("stringnStringtextnText").indexOf(oFieldDescriptor.getAttribute("FieldType")) == -1 ) writeEmptyString = false;
      }

      if (writeEmptyString == true)
      {
        if (oField == null)
        {
          /*
          oField = this.oMessageDoc.createElement(fieldName);
          */
          oField = Ilp.XmlDom.CreateElement(this.oMessageDoc, fieldName, "")
          oRecord.appendChild(oField);
        }
        oField.text = value;
      }
    }
    else
    {
      this.SetNull(oRecord, fieldDescriptorFqn);
    }
    return oField == null ? value : oField.text;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SetFieldValue", "Section1", this.SetFieldValue)
  }
}

function WebData_SetFieldValueOnly(oRecord, fieldDescriptorFqn, value)
{
  try
  {
    var returnText = "";
    var aFqn = fieldDescriptorFqn.split(".");
    var oField = null;
    if (aFqn.length == 2) oField = oRecord.selectSingleNode(aFqn[1]);
    else oField = oRecord.selectSingleNode(aFqn[0]);

    if (value == null)
    {
      if (oField != null)
      {
        oRecord.removeChild(oField);
      }
    }
    else
    {
      if (oField == null)
      {
        /*
        oField = this.oMessageDoc.createElement(aFqn[1])
        */
        oField = Ilp.XmlDom.CreateElement(this.oMessageDoc, aFqn[1], "")
        oRecord.appendChild(oField);
      }
      if (typeof(value) == "number")
      {
        value = String(value);
      }
      oField.text = value;
      returnText = oField.text;
    }

    return returnText;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SetFieldValueOnly", "Section1", this.SetFieldValueOnly);
  }
}

function WebData_NewRecord(tableDescriptorFqn)
{
  try
  {
    var oAttribute = null;
    /*
    var oRecord = this.oMessageDoc.createElement(tableDescriptorFqn);
    */
    var oRecord = Ilp.XmlDom.CreateElement(this.oMessageDoc, tableDescriptorFqn, "")

    /*
    var namedNodeMap = oRecord.attributes;
    oAttribute = this.oMessageDoc.createNode(NODE_ATTRIBUTE, "diffgr:id", NS_diffgr);
    namedNodeMap.setNamedItem(oAttribute);
    oAttribute = this.oMessageDoc.createNode(NODE_ATTRIBUTE, "msdata:rowOrder", NS_msdata);
    namedNodeMap.setNamedItem(oAttribute);
    */

    oAttribute = Ilp.XmlDom.GetAttribute(oRecord, "diffgr:id", true, this.oMessageDoc, NS_diffgr);
    oAttribute = Ilp.XmlDom.GetAttribute(oRecord, "msdata:rowOrder", true, this.oMessageDoc, NS_msdata);

    this.SetRowState(oRecord, RS_detached);
    this.ApplyDefaults(oRecord)
    this.HasChanged = true;

    return oRecord;

  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_NewRecord", "Section1")
  }
}


function WebData_ConvertToMasterdata(sender)
{
  try
  {
    var askYesNo = true;
    askYesNo = window.confirm(ids_AskConvertToMasterdata);

    if (askYesNo == true)
    {
      var labelClientID = sender.getAttribute("LabelClientID")
      var uniqueID = WebControl.CreateUniqueClientId(sender.oRecord, labelClientID);
      var oLabel = document.getElementById(uniqueID);

      var fqn = WebControl.GetFqn(oLabel);
      var masterValue = WebControl.GetBoundValue(oLabel);
      WebMessage.SetMasterdataInfo("M1", fqn, masterValue);
      WebMessage.SetGeneralInfoAttribute("FunctionCall", "ConvertToMasterdata");
      WebMessage.Exchange(false);

      var dropDownListClientID = sender.getAttribute("DropDownListClientID")
      var uniqueID = WebControl.CreateUniqueClientId(sender.oRecord, dropDownListClientID);
      var oCombo = document.getElementById(uniqueID);

      this.RefreshClientCache(oCombo);
      this.UpdateCacheBinding(oCombo, masterValue);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_ConvertToMasterdata","Section1");
  }
}


function WebData_RefreshServerLookUpCache(oCombo, refreshClientCache)
{
  try
  {
    refreshClientCache = refreshClientCache ==null ? false : true;

    var fqn = WebControl.GetFqn(oCombo);
    WebMessage.SetGeneralInfoAttribute("TransferFqn", fqn);
    WebMessage.SetGeneralInfoAttribute("TableDescriptorFqn", oCombo.getAttribute("TableDescriptorFqn"));
    WebMessage.SetGeneralInfoAttribute("ConstrainedFqn", oCombo.getAttribute("ConstrainedFqn"));
    var xmlRootSource = oCombo.getAttribute("XmlRootSource")
    WebMessage.SetGeneralInfoAttribute("XmlRootSource", xmlRootSource == null ? "" : xmlRootSource);
    WebMessage.SetGeneralInfoAttribute("FunctionCall", "RefreshLookUpCache");
    WebMessage.Exchange(false);

    if (refreshClientCache == true)
    {
      this.RefreshClientCache(oCombo);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_RefreshServerLookUpCache","Section1");
  }
}

function WebData_RefreshServerSearchCache(fdFqn, srdFqn)
{
  try
  {
    WebMessage.AddSelSearchInfo("SL1", fdFqn, srdFqn);
    WebMessage.SetGeneralInfoAttribute("FunctionCall", "RefreshSearchCache");
    WebMessage.Exchange(false, true, false, true);

    WebMessage.StoreWebMessageTransfer();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_RefreshServerSearchCache","Section1");
  }
}

function WebData_RefreshChildData(oRecord, tableDescriptorFqn)
{
  try
  {
    var oDtrdList = FormDescriptor.GetRelationByMaster(oRecord.nodeName);
    for (var i = 0; i < oDtrdList.length; i++)
    {
      var oDtrd = oDtrdList[i];

      var detailTableDescriptorFqn = oDtrd.getAttribute("TableDescriptorFqnDetail");

      if (detailTableDescriptorFqn == tableDescriptorFqn)
      {
        WebData.ClearSelectionPerTableDescriptor(tableDescriptorFqn);

        var masterFieldList = oDtrd.getAttribute("FieldDescriptorFqnListMaster").split(" ");
        var detailFieldList = oDtrd.getAttribute("FieldDescriptorFqnListDetail").split(" ");

        WebMessage.InitTableDescriptorFqnList();
        WebMessage.InitDataTableRelationDescriptorFqnList();
        WebMessage.AddDataTableRelationDescriptorFqn(oDtrd.getAttribute("Fqn"));

        var IDMaster = 0;
        var fqnMaster = "";
        var fqnDetail = "";
        WebMessage.InitSearchInfo();
        for (var j = 0; j < masterFieldList.length; j++)
        {
          fqnMaster = oRecord.nodeName + "." + masterFieldList[j];
          IDMaster = WebData.GetFieldValue(oRecord, fqnMaster);
          fqnDetail = detailTableDescriptorFqn + "." + detailFieldList[j];
          WebMessage.AddSearchInfoItem("SI" + String(j), fqnDetail, IDMaster, "Equal", false, "DirectSearchInDetail");
        }

        WebMessage.SetGeneralInfoAttribute("FunctionCall", "GetWebDataDetail");
        WebMessage.Exchange(false, false, false, false, true);
        WebData.TransferChildTable(oRecord, detailTableDescriptorFqn, WebMessage.oMessageResponseDoc2);
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_RefreshChildData","Section1");
  }
}

function WebData_RefreshClientCache(oCombo)
{
  try
  {
    var oXml = null
    var XMLSourceID = oCombo.getAttribute("XMLSourceID");
    var HTMLTargetID = oCombo.getAttribute("HTMLTargetID");
    
    if (XmlVersion == enum_XmlVersion_V1)
    {
      var xmlSource = document.getElementById(XMLSourceID);

      var xslTransformation = document.getElementById(XSLSourceID);

      xmlSource.async = false;
      xmlSource.XMLDocument.load(xmlSource.src);

      var result = WebData.Transform(xmlSource, xslTransformation);

      var htmlIsland = document.getElementById(HTMLTargetID);
      htmlIsland.innerHTML = result;
    }
    else
    {
      var cacheItem = Ilp.XmlCache.XmlCacheList.Get(xmlSourceID);
      cacheItem.Load();
      cacheItem.Transform();
      
      comboObject = this.Ilp.ComboManager.ComboList.Get(HTMLTargetID);
      comboObject.InnerHtml = cacheItem.InnerHtml;
    }  
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_RefreshClientCache","Section1");
  }
}

function WebData_UpdateCacheBinding(oCombo, masterValue)
{
  try
  {
    var oXml = null
    if (XmlVersion == enum_XmlVersion_V1) oXml = document.getElementById(oCombo.getAttribute("XMLSourceID"));
    else oXml = Ilp.XmlCache.XmlCacheList.Get(oCombo.getAttribute("XMLSourceID"));
  
    var xPath = "/NewDataSet/DropDownListSource[OptionText='" + masterValue + "']/OptionValue";
    var masterID = oXml.selectSingleNode(xPath).text;
    WebData.SetFieldValue(oCombo.oRecord, WebControl.GetFqn(oCombo), masterID);

    oCombo.setAttribute("State", "Fake");
    oCombo = WebControl.ReplaceFakeCombo(oCombo);
    WebControl.SetComboValue(oCombo, masterID, false);

    WebControl.HideInputValidator(oCombo);
    WebControl.SetBackgroundColor(oCombo, WebControl.BackgroundColorChanged);
    WebStatusBar.SetDataChangedMessage(ids_DataChanged, 1);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_UpdateCacheBinding", "Section1")
  }
}

function WebData_UpdateCache(oRecord, fqn, masterValue)
{
  try
  {
    var oTarget = null;
    var controlValue = null;
    var xPath = "*[count(*)=0]";
    var oDataField = this.GetField(oRecord, fqn);

    masterValue = masterValue == null ? "" : masterValue;

    var bindingHash = this.GetBindingHash(fqn, oRecord);
    var binder = WebControl.FieldToHtmlObject.Get(bindingHash);
    if (binder != null)
    {
      for(var j = 0; j < binder.HtmlObjects.Count(); j++)
      {
        oTarget = binder.HtmlObjects.Get(j);
        if (oTarget.getAttribute("ControlType") == "DropDownList")
        {
          oTarget = WebControl.ReplaceFakeCombo(oTarget);
          this.RefreshServerLookUpCache(oTarget, true);
          if (masterValue.length > 0)
          {
            this.UpdateCacheBinding(oTarget, masterValue)
          }
        }
      }
    }
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebData_UpdateCache", "Section1")
  }
}

function WebData_TransformAsync()
{
  try
  {
    var xmlSource = window.event.srcElement;
    if (xmlSource.readyState == 'complete')
    {
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_TransformAsync","Section1");
  }
}

function WebData_Transform(xmlSource, xslTransformation)
{
  try
  {
    var result = "";
    if (Ilp.XmlDom.HasParseError(xmlSource) == true)
    {
      result = Ilp.XmlDom.GetParseErrorText(xmlSource);
      WebMessage.SendClientLog(null, "WebData_Transform1", result);
    }
    else
    {
      if (Ilp.XmlDom.HasParseError(xslTransformation) == true)
      {
        result = Ilp.XmlDom.GetParseErrorText(xslTransformation);
        WebMessage.SendClientLog(null, "WebData_Transform2", result);
      }
      else
      {
        try
        {
          result = xmlSource.XMLDocument.transformNode(xslTransformation.XMLDocument);
        }
        catch (exception)
        {
          WebMessage.SendClientLog(exception, "WebData_Transform3", "Section3");
        }
      }
    }

    return result;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_Transform","Section1");
  }
}

function WebData_AssignMasterdata(fieldDescriptorFqn, idExchangejournal, exchangeTableFqn)
{
  try
  {
    WebMessage.SetMasterdataInfo("M1", fieldDescriptorFqn, "", idExchangejournal, exchangeTableFqn);
    WebMessage.SetGeneralInfoAttribute("FunctionCall", "AssignMasterdata");
    WebMessage.Exchange(false);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_AssignMasterdata","Section1")
  }
}

function WebData_ImportExchangeData(fieldDescriptorFqn, idExchangejournal, exchangeTableFqn, journalTableFqn, originalTableFqn, originalTablePK)
{
  try
  {
    WebMessage.SetMasterdataInfo("M1", fieldDescriptorFqn, "", idExchangejournal, exchangeTableFqn, journalTableFqn, originalTableFqn, originalTablePK);
    WebMessage.SetGeneralInfoAttribute("FunctionCall", "ImportExchangeData");
    WebMessage.Exchange(false);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_ImportExchangeData", "Section1")
  }
}

function WebData_GetNextRecord(oRecord)
{
  try
  {
    var rowOrder = this.GetRowOrder(oRecord);
    
    var oNextRecord = oRecord.parentNode.selectSingleNode(oRecord.nodeName + "[@msdata:rowOrder='" + String(rowOrder*1 + 1) + "']");
    
    return oNextRecord;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetNextRecord", "Section1")
  }
}

function WebData_AddRecord(oRecord, oMasterRecord, oRefRecord, args)
{
  try
  {
    if (WebData.GetRowState(oRecord) != RS_transferred) this.ResetRowOrderA(oRecord);
    this.SetRecordHashA(oRecord);

    args = args == null ? new EventArgs() : args;
    if (oRefRecord) args.oRefRecord = oRefRecord;
    args.Action = "Add";

    if (oMasterRecord == null)
    {
      if (oRefRecord != null  && oRefRecord.nextSibling != null && oRefRecord != oMasterRecord)
      {
        this.oWebData.insertBefore(oRecord, oRefRecord.nextSibling);
      }
      else
      {
        this.oWebData.appendChild(oRecord);
      }
    }
    else
    {
      if (oRefRecord != null && oRefRecord.nextSibling != null && oRefRecord != oMasterRecord)
      {
        oMasterRecord.insertBefore(oRecord, oRefRecord.nextSibling);
      }
      else
      {
        oMasterRecord.appendChild(oRecord);
      }
    }

    var inserted = false;
    if (this.GetRowState(oRecord) == RS_detached)
    {
      if (oMasterRecord != null)
      {
        var dtrd = FormDescriptor.GetRelationByMasterDetail(oMasterRecord.nodeName, oRecord.nodeName);
        this.UpdateCascade(oRecord, oMasterRecord, dtrd);
      }
      this.SetRowStateA(oRecord, RS_attached);
      inserted = true;
    }

    args.OffsetRecord = oRecord;
    if (args.DoRowOrder == true && WebData.GetRowState(oRecord) != RS_transferred)
    {
      this.ResetRowOrderA(oRecord);
      this.SetRowOrderA(oRecord);
    }

    if (this.GetRowState(oRecord) == RS_attached)
    {
      this.SetAutoIncrementValueA(oRecord);
      this.SetRowStateA(oRecord, RS_inserted);
    }
    else if (this.GetRowState(oRecord) == RS_transferred)
    {
      this.RemoveRowStateA(oRecord);
    }

    if (inserted == true)
    {
      this.UpdateChildRows(oRecord);
    }

    if (typeof(this.OnAfterAddRecord) == "function")
    {
      this.OnAfterAddRecord(oRecord);
    }

    if (typeof(this.OnRowListChanged) == "function")
    {
      args.ParentNode = oRecord.parentNode;
      this.OnRowListChanged(oRecord, args);
    }
    return oRecord;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_AddRecord", "Section1")
  }
}

function WebData_UpdateCascade(oRecord, oMasterRecord, dtrd, useSetFieldValue)
{
  try
  {
    var useSetFieldValue = useSetFieldValue == null ? false : useSetFieldValue;
    
    var pkFqnList = dtrd.getAttribute("FieldDescriptorFqnListMaster").split(" ");
    var fkFqnList = dtrd.getAttribute("FieldDescriptorFqnListDetail").split(" ");
    for (var j = 0, len = pkFqnList.length; j < len; j++)
    {
      var pkValue = this.GetFieldValue(oMasterRecord, oMasterRecord.nodeName + "." + pkFqnList[j]);
      if (useSetFieldValue == true) this.SetFieldValue(oRecord, oRecord.nodeName + "." + fkFqnList[j], pkValue);
      this.SetFieldValueOnly(oRecord, oRecord.nodeName + "." + fkFqnList[j], pkValue);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_UpdateCascade", "Section1")
  }
}

function WebData_UpdateChildRows(oRecord)
{
  try
  {
    var xPath = ".//*[@diffgr:id]";
    var oSelectedList = oRecord.selectNodes(xPath);
    for (var i = 0, len = oSelectedList.length; i < len; i++)
    {
      var oSelected = oSelectedList[i];
      var dtrd = FormDescriptor.GetRelationByMasterDetail(oSelected.parentNode.nodeName, oSelected.nodeName);
      this.UpdateCascade(oSelected, oSelected.parentNode, dtrd);
    }

    return;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_UpdateChildRows", "Section1")
  }
}


function WebData_GetNextAutoIncrementValue(oRecord){
  try
  {
    var fd = FormDescriptor.GetPrimaryKeyFieldDescriptor(oRecord.nodeName);
    var fqn = fd.getAttribute("Fqn");
    //Änderung wegen rekursiven DT's var recordSelector = this.GetRecordSelectorB(oRecord);
    var recordSelector = "descendant-or-self::" + oRecord.nodeName;
    var xPath = recordSelector + "/" + FormDescriptor.GetFieldnameEffective(fd);

    var oSelectedList = this.oWebData.selectNodes(xPath);

    var minString = "0";
    for (var i = 0, len = oSelectedList.length; i < len; i++)
    {
      var oSelected = oSelectedList[i];
      var numText = oSelected.text;
      if (numText.length > 0 && isNaN(numText*1) == false)
      {
        minString += "," + numText;
      }
    }
    var minFunc = "Math.min(" + minString + ")";
    var autoIncrementValue = eval(minFunc);
    autoIncrementValue--;

    return autoIncrementValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetNextAutoIncrementValue", "Section1")
  }
}

function WebData_GetNextRowOrder(oRecord, oWebMessage)
{
  try
  {
    oWebMessage = oWebMessage == null ? this.oMessageDoc : oWebMessage;

    var oSelectedList = null;
    var oSelected = null;
    // Änderung wegen rekursiven DT's: var recordSelector = this.GetRecordSelectorB(oRecord);
    var recordSelector = oRecord.nodeName;
    var xPath = "//NewDataSet/descendant-or-self::" + recordSelector + "/@msdata:rowOrder";

    oSelectedList = oWebMessage.selectNodes(xPath);

    var maxString = "-1";
    for (var i = 0, len = oSelectedList.length; i < len; i++)
    {
      var oSelected = oSelectedList[i];
      var numText = oSelected.text;
      if (numText.length > 0 && isNaN(numText*1) == false)
      {
        maxString += "," + numText;
      }
    }
    var oBefore = this.GetDiffgramBefore(false, oWebMessage);
    if (oBefore != null)
    {
      var xPath = oRecord.nodeName + "[@diffgr:hasChanges='" + RS_deleted + "']/@msdata:rowOrder";
      oSelectedList = oBefore.selectNodes(xPath);
      for (var i = 0, len = oSelectedList.length; i < len; i++)
      {
        var oSelected = oSelectedList[i];
        var numText = oSelected.text;
        if (numText.length > 0 && isNaN(numText*1) == false)
        {
          maxString += "," + numText;
        }
      }
    }

    var maxFunc = "Math.max(" + maxString + ")";
    var rowOrder = eval(maxFunc);
    rowOrder++;

    return rowOrder;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetNextRowOrder", "Section1")
  }
}

function WebData_SetDiffgramId(oRecord, diffgramId, oWebMessage)
{
  try
  {
    oWebMessage = oWebMessage == null ? this.oMessageDoc : oWebMessage;

    var isDiffgrBefore = false;
    var isModifiedOriginalRecord = false;
    if (oRecord.parentNode && oRecord.parentNode.nodeName == "diffgr:before")
    {
      isDiffgrBefore = true;
      var oRecordModified = this.GetRecordFromOriginalRecord(oRecord, oWebMessage);
      if (oRecordModified != null)
      {
        isModifiedOriginalRecord = true;
      }
    }

    if (isModifiedOriginalRecord == false)
    {
      /*
      var namedNodeMap = oRecord.attributes;
      var oAttribute = namedNodeMap.getNamedItem("diffgr:id");
      if (oAttribute == null)
      {
        oAttribute = this.oMessageDoc.createNode(NODE_ATTRIBUTE, "diffgr:id", NS_diffgr);
        namedNodeMap.setNamedItem(oAttribute);
      }
      oAttribute.value = diffgramId;
      */
      var oAttribute = Ilp.XmlDom.GetAttribute(oRecord, "diffgr:id", true, this.oMessageDoc, NS_diffgr);
      Ilp.XmlDom.SetValue(oAttribute, diffgramId);
      
      if (isDiffgrBefore == false)
      {
        this.SetOriginalRecordDiffgramId(oRecord, oWebMessage);
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SetDiffgramId", "Section1")
  }
}

function WebData_SetDiffgramIdA(oRecord)
{
  try
  {
    var row = FormDescriptor.GetNextCount(oRecord.nodeName);
    this.SetDiffgramId(oRecord, oRecord.nodeName + String(count))

    var xPath = ".//*[@diffgr:id]";
    var oSelectedList = oRecord.selectNodes(xPath);
    for (var i = 0, len = oSelectedList.length; i < len; i++)
    {
      var oSelected = oSelectedList[i];
      var count = FormDescriptor.GetNextCount(oSelected.nodeName);
      this.SetDiffgramId(oSelected, oSelected.nodeName + String(count))
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SetDiffgramIdA", "Section1")
  }
}

function WebData_GetDiffgramId(oRecord)
{
  try
  {
    return oRecord.getAttribute("diffgr:id");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetDiffgramId", "Section1")
  }
}

function WebData_GetIlpId(oRecord)
{
  try
  {
    return oRecord.getAttribute(ATT_IlpId);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetIlpId", "")
  }
}

function WebData_SetIlpId(oRecord, bindingID)
{
  try
  {
    /*
    var namedNodeMap = oRecord.attributes;
    var oAttribute = namedNodeMap.getNamedItem(ATT_IlpId);
    if (oAttribute == null)
    {
      oAttribute = this.oMessageDoc.createNode(NODE_ATTRIBUTE, ATT_IlpId, NS_msdata);
      namedNodeMap.setNamedItem(oAttribute);
    }
    if (oAttribute.value.length == 0) oAttribute.value = bindingID;
    */
    var oAttribute = Ilp.XmlDom.GetAttribute(oRecord, ATT_IlpId, true, this.oMessageDoc, NS_msdata);
    Ilp.XmlDom.SetValue(oAttribute, bindingID, false);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SetIlpId", "Section1")
  }
}

function WebData_RemoveIlpId(oRecord, deep)
{
  try
  {
    var oRecordList = null;
    var oRecordTemp = null;

    Ilp.XmlDom.RemoveAttribute(oRecord, ATT_IlpId);
    if (deep == true)
    {
      var oRecordList = oRecord.selectNodes("*[@" + ATT_IlpId + "]");
      for (var i = 0, len = oRecordList.length; i < len; i++)
      {
        oRecordTemp = oRecordList[i];
        Ilp.XmlDom.RemoveAttribute(oRecordTemp, ATT_IlpId);
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_RemoveIlpId", "Section1");
  }
}

function WebData_GetRecordHash(oRecord)
{
  try
  {
    return oRecord.getAttribute("ilp:hash");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetRecordHash", "")
  }
}

function WebData_SetRecordHash(oRecord, bindingHash)
{
  try
  {
    /*
    var namedNodeMap = oRecord.attributes;
    var oAttribute = namedNodeMap.getNamedItem("ilp:hash");
    if (oAttribute == null)
    {
      oAttribute = this.oMessageDoc.createNode(NODE_ATTRIBUTE, "ilp:hash", NS_ilp);
      namedNodeMap.setNamedItem(oAttribute);
    }
    oAttribute.value = bindingHash;
    */
    oAttribute = Ilp.XmlDom.GetAttribute(oRecord, ATT_IlpHash, true, this.oMessageDoc, NS_ilp);
    Ilp.XmlDom.SetValue(oAttribute, bindingHash);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SetRecordHash", "Section1")
  }
}

function WebData_SetInitialBindingHash(oRecord)
{
  try
  {
    var oSelectedList = this.Select("*[@msdata:rowOrder]");
    for (var i = 0, len = oSelectedList.length; i < len; i++)
    {
      var oSelected = oSelectedList[i];
      this.SetRecordHashA(oSelected);
      this.SetDiffgramParentIdA(oSelected);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SetInitialBindingHash", "Section1")
  }
}


function WebData_SetRecordHashA(oRecord)
{
  try
  {
    if (oRecord == null) return;

    var count = FormDescriptor.GetNextCount(oRecord.nodeName);
    this.SetRecordHash(oRecord, oRecord.nodeName + String(count))
    this.SetIlpId(oRecord, FormDescriptor.GetNextIlpId())

    var xPath = ".//*[@msdata:rowOrder]";
    var oNodeList = oRecord.selectNodes(xPath);
    for (var i = 0, len = oNodeList.length; i < len; i++)
    {
      var oNode = oNodeList[i];
      var count = FormDescriptor.GetNextCount(oNode.nodeName);
      this.SetRecordHash(oNode, oNode.nodeName + String(count))
      this.SetIlpId(oNode, FormDescriptor.GetNextIlpId())
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SetRecordHashA", "Section1")
  }
}


function WebData_GetBindingHash(fqn, oRecord, isTdFqn)
{
  try
  {
    isTdFqn = isTdFqn == null ? false : isTdFqn;
    
    var aFqn = fqn.split(".");
    var bindingHash = oRecord.getAttribute("ilp:hash");
    if (isTdFqn == true)
    {
      return aFqn[0] + "_" + bindingHash;
    }
    else
    {
      if (aFqn.length == 2)
      {
        if (bindingHash == null) return oRecord.nodeName + "." + aFqn[1];
        else return oRecord.nodeName + "." + aFqn[1] + "_" + bindingHash;
      }
      else
      {
        if (bindingHash == null) return oRecord.nodeName + "." + aFqn[0];
        else return oRecord.nodeName + "." + aFqn[0] + "_" + bindingHash;
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetBindingHash", "", this.GetBindingHash)
  }
}

function WebData_SetDiffgramParentId(oRecord, diffgramParentId, oWebMessage)
{
  try
  {
    oWebMessage = oWebMessage == null ? this.oMessageDoc : oWebMessage;
    var oAttribute = Ilp.XmlDom.GetAttribute(oRecord, "diffgr:parentId", true, oWebMessage, NS_diffgr);
    Ilp.XmlDom.SetValue(oAttribute, diffgramParentId);
    
    this.SetOriginalRecordDiffgramParentId(oRecord, diffgramParentId, oWebMessage);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SetDiffgramParentId", "Section1")
  }
}

function WebData_SetDiffgramParentIdA(oRecord)
{
  try
  {
    if (oRecord.nodeName != "NewDataSet")
    {
      var xPath = ".//*[@diffgr:id]";
      var oSelectedList = oRecord.selectNodes(xPath);
      for (var i = 0, len = oSelectedList.length; i < len; i++)
      {
        var oSelected = oSelectedList[i];
        this.SetDiffgramParentId(oSelected, this.GetDiffgramId(oSelected.parentNode));
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SetDiffgramParentIdA", "Section1")
  }
}


function WebData_SetRowOrder(oRecord, rowOrder, oWebMessage)
{
  try
  {
    oWebMessage = oWebMessage == null ? this.oMessageDoc : oWebMessage;
    
    var oAttribute = Ilp.XmlDom.GetAttribute(oRecord, "msdata:rowOrder", true, oWebMessage, NS_msdata);
    Ilp.XmlDom.SetValue(oAttribute, rowOrder);
    
    this.SetOriginalRecordRowOrder(oRecord, oWebMessage);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SetRowOrder", "Section1")
  }
}



function WebData_ResetRowOrderA(oRecord, includeSelf)
{
  try
  {
    includeSelf = includeSelf == null ? true : includeSelf;
    
    if (oRecord.parentNode == null)
    {
      var oSelectedList = oRecord.selectNodes("./descendant-or-self::*/@msdata:rowOrder");
      for (var i = 0, len = oSelectedList.length;  i < len; i++)
      {
        oSelectedList[i].text = "-1";
      }
    }
    else
    {
      if (oRecord.nodeName == "diffgr:diffgram")
      {
        oSelectedList = oRecord.parentNode.selectNodes("./descendant-or-self::*[parent::node()[name()!='diffgr:before']]/@msdata:rowOrder");
        for (var i = 0, len = oSelectedList.length;  i < len; i++) oSelectedList[i].text = "-1";

        oSelectedList = oRecord.parentNode.selectNodes("./descendant-or-self::*[parent::node()[name()='diffgr:before'] and (not(@diffgr:hasChanges) or @diffgr:hasChanges!='modified')]/@msdata:rowOrder");
        for (var i = 0, len = oSelectedList.length;  i < len; i++) oSelectedList[i].text = "-1";
      }
      else
      {
        while(oRecord && oRecord.parentNode.nodeName == oRecord.nodeName)
        {
          oRecord = oRecord.parentNode;
        }

        var oRecordList = null;
        var oRecordTemp = null;
        var nodeNames = new WebArray();
        
        nodeNames = FormDescriptor.GetRelatedNames(oRecord.nodeName, includeSelf);
        
        var oSelectedList = null;
        for (var i = 0, len = nodeNames.Count();  i < len; i++) 
        {
          oSelectedList = this.Select("//" + nodeNames.Get(i) + "[parent::node()[name()!='diffgr:before']]/@msdata:rowOrder");
          for (var j = 0, len1 = oSelectedList.length;  j < len1; j++) oSelectedList[j].text = "-1";
        }

        //./*[not(@diffgr:hasChanges) or @diffgr:hasChanges!='deleted']/@msdata:rowOrder
        var oDiffgramBefore = this.GetDiffgramBefore();
        if (oDiffgramBefore)
        {
          oSelectedList = oDiffgramBefore.selectNodes("./*[not(@diffgr:hasChanges) or @diffgr:hasChanges!='modified']/@msdata:rowOrder");
          for (var i = 0, len = oSelectedList.length;  i < len; i++)
          {
            oSelectedList[i].text = "-1";
          }
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_ResetRowOrderA", "Section1")
  }
}


function WebData_SetRowOrderA(oRecord, oWebMessage)
{
  try
  {
    oWebMessage = oWebMessage == null ? this.oMessageDoc : oWebMessage;
    var oDiffGram = this.GetDiffgram(oWebMessage);

    if (oRecord.parentNode != null)
    {
      var counterList = new Object();
      var counterArray = new Array();

      var oSelected = null;
      var oSelectedList = null;

      oSelectedList = this.Select("./descendant-or-self::*[@msdata:rowOrder='-1']", oDiffGram);
      for (var i = 0, len = oSelectedList.length;  i < len; i++)
      {
        oSelected = oSelectedList[i];
        var counter = counterList[oSelected.nodeName];
        if (counter == null)
        {
          counter = new Object();
          counter.RowOrder = this.GetNextRowOrder(oSelected, oWebMessage);
          counterList[oSelected.nodeName] = counter
          counterArray[counterArray.length] = oSelected.nodeName;
        }
        else
        {
          counter.RowOrder++;
        }

        this.SetRowOrder(oSelected, counter.RowOrder, oWebMessage);
        this.SetDiffgramId(oSelected, oSelected.nodeName + String(counter.RowOrder + 1), oWebMessage);
      }
      oSelectedList = this.Select("./descendant-or-self::*[@diffgr:parentId and parent::node()[name()!='diffgr:before']]", oDiffGram);
      for (var i = 0, len = oSelectedList.length; i < len; i++)
      {
        var oSelected = oSelectedList[i];
        this.SetDiffgramParentId(oSelected, this.GetDiffgramId(oSelected.parentNode), oWebMessage);
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SetRowOrderA", "Section1")
  }
}


function WebData_SetOriginalRecordDiffgramId(oRecord, oWebMessage)
{
  try
  {
    oWebMessage = oWebMessage == null ? this.oMessageDoc : oWebMessage;

    var ilpHash = oRecord.getAttribute("ilp:hash");
    var oRecordOriginal = oWebMessage.selectSingleNode("//diffgr:before/" + oRecord.nodeName + "[@ilp:hash='" + ilpHash + "']");
    if (oRecordOriginal)
    {
      var oAttribute = oRecordOriginal.attributes.getNamedItem("diffgr:id");
      oAttribute.value = this.GetDiffgramId(oRecord);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SetOriginalRecordDiffgramId", "Section1")
  }
}

function WebData_SetOriginalRecordRowOrder(oRecord, oWebMessage)
{
  try
  {
    oWebMessage = oWebMessage == null ? this.oMessageDoc : oWebMessage;

    var rowOrder = oRecord.getAttribute("msdata:rowOrder");
    var ilpHash = oRecord.getAttribute("ilp:hash");
    var oRecordOriginal = oWebMessage.selectSingleNode("//diffgr:before/" + oRecord.nodeName + "[@ilp:hash='" + ilpHash + "']");
    if (oRecordOriginal)
    {
      /*
      var oAttribute = oRecordOriginal.attributes.getNamedItem("msdata:rowOrder");
      oAttribute.value = rowOrder;
      */
      var oAttribute = Ilp.XmlDom.GetAttribute(oRecord, "msdata:rowOrder", false, oWebMessage, NS_msdata);
      Ilp.XmlDom.SetValue(oAttribute, rowOrder);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SetOriginalRecordRowOrder", "Section1")
  }
}

function WebData_SetOriginalRecordDiffgramParentId(oRecord, diffgramParentId, oWebMessage)
{
  try
  {
    oWebMessage = oWebMessage == null ? this.oMessageDoc : oWebMessage;

    var ilpHash = oRecord.getAttribute("ilp:hash");
    var oRecordOriginal = oWebMessage.selectSingleNode("//diffgr:before/" + oRecord.nodeName + "[@ilp:hash='" + ilpHash + "']");
    if (oRecordOriginal)
    {
      /*
      var oAttribute = oRecordOriginal.attributes.getNamedItem("diffgr:parentId");
      oAttribute.value = diffgramParentId;
      */
      var oAttribute = Ilp.XmlDom.GetAttribute(oRecord, "diffgr:parentId", false, oWebMessage, NS_diffgr);
      Ilp.XmlDom.SetValue(oAttribute, diffgramParentId);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SetOriginalRecordDiffgramParentId", "Section1")
  }
}


function WebData_GetRowOrder(oRecord)
{
  try
  {
    return oRecord.getAttribute("msdata:rowOrder");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetRowOrder", "Section1")
  }
}

function WebData_Refresh()
{
  try
  {
    this.oWebMessage = this.oMessageDoc.selectSingleNode("/ilp:WebMessage");
    
    var oTransferDataSet = this.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:TransferDataSet");

    // Passiert, wenn es kein DataSetParam in der Form gibt.
    if (oTransferDataSet == null)
    {
      return;
    }

    this.oWebData = this.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:TransferDataSet/diffgr:diffgram/NewDataSet");

    if (this.oWebData == null)
    {
      var oAttribute = null;
      var namedNodeMap = null;

      oDiffgram = this.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:TransferDataSet/diffgr:diffgram");

      if (oDiffgram == null)
      {
        /*
        oDiffgram = this.oMessageDoc.createNode(NODE_ELEMENT, "diffgr:diffgram", NS_diffgr);
        */
        oDiffgram = Ilp.XmlDom.CreateElement(this.oMessageDoc, "diffgr:before", NS_diffgr);
        oTransferDataSet.appendChild(oDiffgram);
      }

      this.oWebData = this.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:TransferDataSet/diffgr:diffgram/NewDataSet");
      if (this.oWebData == null)
      {
        /*
        var oNewDataSet = this.oMessageDoc.createElement("NewDataSet");
        */
        var oNewDataSet = Ilp.XmlDom.CreateElement(this.oMessageDoc, "NewDataSet", "")
        oDiffgram.appendChild(oNewDataSet);
      }

      this.oWebData = this.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:TransferDataSet/diffgr:diffgram/NewDataSet");

    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_Refresh", "Section1")
  }
}

function WebData_GetFirstRecord(select)
{
  try
  {
    if (select == null)
    {
      var oWebDataGrid = WebControl.GetWebDataGridMain();
      if (oWebDataGrid != null)
      {
        select = oWebDataGrid.TableDescriptorFqn;
      }
    }

    var xPath = select + "[1]";
    return this.oWebData.selectSingleNode(xPath);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetFirstRecord", "Section1")
  }
}

function WebData_GetRow(select, rowNumber)
{
  try
  {
    var xPath = select + "[" + String(rowNumber) + "]";

    return this.oWebData.selectSingleNode(xPath);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetRow", "Section1")
  }
}

function WebData_GetRecord(tableDescriptorFqn, rowNum, oXmlDocument)
{
  try
  {
    oXmlDocument = oXmlDocument == null ? this.oWebData : oXmlDocument;
    var xPath = tableDescriptorFqn + "[" + String(rowNum*1 + 1) + "]";

    return oXmlDocument.selectSingleNode(xPath);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetRecord", "Section1")
  }
}

function WebData_GetAllRecords(tableDescriptorFqn)
{
  try
  {
    var xPath = tableDescriptorFqn;

    return this.oWebData.selectNodes(xPath);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetAllRecords", "Section1")
  }
}

function WebData_SetAutoIncrementValue(oRecord, autoIncrementValue)
{
  try
  {
    var fd = FormDescriptor.GetPrimaryKeyFieldDescriptor(oRecord.nodeName);
    var fqn = fd.getAttribute("Fqn");

    this.SetFieldValueOnly(oRecord, fqn, String(autoIncrementValue));
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SetAutoIncrementValue", "Section1")
  }
}

function WebData_SetAutoIncrementValueA(oRecord)
{
  try
  {
    var counterList = new Object();

    counterList[oRecord.nodeName] = new Object();
    counterList[oRecord.nodeName].AutoIncrementValue = this.GetNextAutoIncrementValue(oRecord);
    this.SetAutoIncrementValue(oRecord, counterList[oRecord.nodeName].AutoIncrementValue);

    var xPath = ".//*[@diffgr:hasChanges='" + RS_attached + "']";
    var oSelectedList = oRecord.selectNodes(xPath);
    for (var i = 0, len = oSelectedList.length; i < len; i++)
    {
      var oSelected = oSelectedList[i];
      if (counterList[oSelected.nodeName] == null)
      {
        counterList[oSelected.nodeName] = new Object();
        counterList[oSelected.nodeName].AutoIncrementValue = this.GetNextAutoIncrementValue(oSelected);
      }
      else
      {
        counterList[oSelected.nodeName].AutoIncrementValue--;
      }
      this.SetAutoIncrementValue(oSelected, counterList[oSelected.nodeName].AutoIncrementValue);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SetAutoIncrementValueA", "Section1")
  }
}


function WebData_ApplyDefaults(oRecord, mode)
{
  try
  {
    mode = mode == null ? "new" : mode;
    var fd = null;
    var fdList = FormDescriptor.GetFieldDescriptorList(oRecord.nodeName, "[@DefaultValueClass or @DefaultValue or @UnitType or @UseForMasterDataDefault]");
    for (var i = 0, len = fdList.length; i < len; i++)
    {
      fd = fdList[i];
      this.ApplyFieldDefault(oRecord, fd, mode);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_ApplyDefaults", "Section1")
  }
}

function WebData_ApplyFieldDefault(oRecord, fd, mode)
{
  try
  {
    var defaultValueClass = fd.getAttribute("DefaultValueClass");
    if (typeof(defaultValueClass) == "string")
    {
      if (defaultValueClass == "LoggedOnUser")
      {
        if (!(mode == "new" && fd.getAttribute("Fqn").split(".")[1] == "IDChangedBy"))
        {
          this.SetFieldValueOnly(oRecord, fd.getAttribute("Fqn"), IDAppUser);
        }
      }
      else if (defaultValueClass == "LoggedOnUsername")
      {
        if (!(mode == "new" && fd.getAttribute("Fqn").split(".")[1] == "EmployeeNameChangedBy"))
        {
          this.SetFieldValueOnly(oRecord, fd.getAttribute("Fqn"), PageUser);
        }
      }
      else if (defaultValueClass == "Program")
      {
        this.SetFieldValueOnly(oRecord, fd.getAttribute("Fqn"), IDProgram);
      }
      else if (defaultValueClass == "Today")
      {
        this.SetFieldValueOnly(oRecord, fd.getAttribute("Fqn"), WebControl.ConvertDateToXmlDate(new Date(), true));
      }
      else if (defaultValueClass == "Year")
      {
        var date = new Date();
        this.SetFieldValueOnly(oRecord, fd.getAttribute("Fqn"), date.getFullYear());
      }
      else if (defaultValueClass == "EmptyString")
      {
        if (mode == "copy" && typeof(WebData.GetFieldValue(oRecord, fd.getAttribute("Fqn"))) == "string")
        {
        }
        else
        {
          this.SetFieldValueOnly(oRecord, fd.getAttribute("Fqn"), "");
        }
      }
      else if (defaultValueClass == "CreationDate")
      {
        var formatClass = fd.getAttribute("FormatClass");
        if (formatClass == "ShortDate" || formatClass == "Time")
        {
          this.SetFieldValueOnly(oRecord, fd.getAttribute("Fqn"), WebControl.ConvertDateToXmlDate(new Date(), true));
        }
        else
        {
          this.SetNullOnly(oRecord, fd.getAttribute("Fqn"));
        }
      }
      else if (defaultValueClass == "LastChange")
      {
        if (!(mode == "new" && fd.getAttribute("Fqn").split(".")[1] == "LastChange"))
        {
          var formatClass = fd.getAttribute("FormatClass");
          if (formatClass == "ShortDate")
          {
            this.SetFieldValueOnly(oRecord, fd.getAttribute("Fqn"), WebControl.ConvertDateToXmlDate(new Date(), true));
          }
          else
          {
            this.SetNullOnly(oRecord, fd.getAttribute("Fqn"));
          }
        }
      }
    }

    if (mode == "new")
    {
      var defaultValue = fd.getAttribute("DefaultValue");
      if (typeof(defaultValue) == "string")
      {
        this.SetFieldValueOnly(oRecord, fd.getAttribute("Fqn"), FormDescriptor.ConvertDefaultValueToWebData( fd ));
      }
      if (fd.getAttribute("UseForMasterDataDefault") == "true")
      {
        var oDefaultInfoItem = WebMessage.GetDefaultInfoItem(fd.getAttribute("FieldName"));
        if (oDefaultInfoItem != null)
        {
          if (oDefaultInfoItem.getAttribute("DefaultValue") != null)
          {
            this.SetFieldValueOnly(oRecord, fd.getAttribute("Fqn"), FormDescriptor.ConvertDefaultValueToWebData( fd, oDefaultInfoItem.getAttribute("DefaultValue") ));
          }
        }
      }
      this.SetUnitDefaults(oRecord, fd);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_ApplyFieldDefault", "Section1")
  }
}

function WebData_SetUnitDefaults(oRecord, fd)
{
  try
  {
    var unitType = fd.getAttribute("UnitType");
    if (typeof(unitType) == "string" && unitType.length > 0)
    {
      var currencyFieldName = fd.getAttribute("CurrencyFieldName");
      if (typeof(currencyFieldName) == "string" && currencyFieldName.length > 0)
      {
        var fdUnit = FormDescriptor.GetFieldDescriptor(currencyFieldName);
        this.SetFieldValueOnly(oRecord, fdUnit.getAttribute("Fqn"), WebMessage.GetDefaultValue(unitType));
      }
      var unitFieldName = fd.getAttribute("UnitFieldName");
      if (typeof(unitFieldName) == "string" && unitFieldName.length > 0)
      {
        var fdUnit = FormDescriptor.GetFieldDescriptor(unitFieldName);
        this.SetFieldValueOnly(oRecord, fdUnit.getAttribute("Fqn"), WebMessage.GetDefaultValue(unitType));
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SetUnitDefaults", "Section1")
  }
}

function WebData_ApplyUpdateDefaults(oRecord)
{
  try
  {
    var rowState = this.GetRowState(oRecord);
    var fd = null;
    var fdList = FormDescriptor.GetFieldDescriptorList(oRecord.nodeName, "[@UpdateValueClass]");
    for (var i = 0, len = fdList.length; i < len; i++)
    {
      fd = fdList[i];
      var updateValueClass = fd.getAttribute("UpdateValueClass");

      if (typeof(updateValueClass) == "string")
      {
        if (updateValueClass == "LoggedOnUser")
        {
          if ( !(rowState == RS_inserted) )
          {
            this.SetFieldValueOnly(oRecord, fd.getAttribute("Fqn"), IDAppUser);
          }
        }
        else if (updateValueClass == "LoggedOnUsername")
        {
          if ( !(rowState == RS_inserted) )
          {
            this.SetFieldValueOnly(oRecord, fd.getAttribute("Fqn"), PageUser);
            this.UpdateFieldBinding(oRecord, fd.getAttribute("Fqn"));
          }
        }
        else if (updateValueClass == "CurrentDate")
        {
          this.SetFieldValueOnly(oRecord, fd.getAttribute("Fqn"), WebControl.ConvertDateToXmlDate(new Date(), true));
          this.UpdateFieldBinding(oRecord, fd.getAttribute("Fqn"));
        }
        else if (updateValueClass == "LastChange")
        {
          if ( !(rowState == RS_inserted) )
          {
            var formatClass = fd.getAttribute("FormatClass");
            if (formatClass == "ShortDate")
            {
              this.SetFieldValueOnly(oRecord, fd.getAttribute("Fqn"), WebControl.ConvertDateToXmlDate(new Date(), true));
            }
            else
            {
              this.SetNullOnly(oRecord, fd.getAttribute("Fqn"));
            }
            this.UpdateFieldBinding(oRecord, fd.getAttribute("Fqn"));
          }
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_ApplyUpdateDefaults", "Section1")
  }
}

function WebData_SaveOriginalRecord(oRecord)
{
  try
  {
    this.HasChanged = true;

    var rowState = this.GetRowState(oRecord);
    if (rowState == RS_inserted || rowState == RS_detached)
    {
      return null;
    }

    var rowOrder = oRecord.getAttribute("msdata:rowOrder");
    var oRecordOriginal = this.oMessageDoc.selectSingleNode("//diffgr:before/" + oRecord.nodeName + "[@msdata:rowOrder='" + rowOrder + "']");
    if (oRecordOriginal == null)
    {
      var oBefore = this.oMessageDoc.selectSingleNode("//diffgr:before");
      if (oBefore == null)
      {
        var oDiffgram = this.oMessageDoc.selectSingleNode("//diffgr:diffgram");
        /*
        oBefore = this.oMessageDoc.createNode(NODE_ELEMENT, "diffgr:before", NS_diffgr);
        */
        oBefore = Ilp.XmlDom.CreateElement(this.oMessageDoc, "diffgr:before", NS_diffgr);
        oDiffgram.appendChild(oBefore);
      }
      oRecordOriginal = oRecord.cloneNode(true);
      if (rowState == RS_deleted)
      {
        oChildren = oRecordOriginal.selectNodes("descendant::*[@msdata:rowOrder]");
        var numberOfChildren = oChildren.length;
        for (var i = 0; i < numberOfChildren; i++)
        {
          var oChildRecord = oChildren[numberOfChildren - i - 1];
          if (this.GetRowState(oChildRecord) == RS_inserted)
          {
            oRecordOriginal.removeChild(oChildRecord);
          }
          else
          {
            oBefore.appendChild(oChildRecord);
          }
        }
      }
      else
      {
        oChildren = oRecordOriginal.selectNodes("*[@msdata:rowOrder]");
        for (var i = 0, len = oChildren.length; i < len; i++)
        {
          oRecordOriginal.removeChild(oChildren[i]);
        }
      }
      oBefore.appendChild(oRecordOriginal);
    }
    else
    {
      this.SetRowState(oRecordOriginal, this.GetRowState(oRecord));
    }
    return oRecordOriginal;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SaveOriginalRecord", "Section1");
  }
}

function WebData_MoveOriginalRecord(oRecordSource, oRecordTarget)
{
  try
  {
    var rowState = this.GetRowState(oRecordSource);
    if (rowState == RS_inserted || rowState == RS_detached)
    {
      return;
    }
    var rowOrder = oRecordSource.getAttribute("msdata:rowOrder");
    var oRecordOriginal = this.oMessageDoc.selectSingleNode("//diffgr:before/" + oRecordSource.nodeName + "[@msdata:rowOrder='" + rowOrder + "']");

    if (oRecordOriginal)
    {
      var oRecordOriginalMoved = oRecordTarget.cloneNode(true);
      this.CopyTo(oRecordOriginal, oRecordOriginalMoved);
      oRecordOriginal.parentNode.insertBefore(oRecordOriginalMoved, oRecordOriginal);
      oRecordOriginal.parentNode.removeChild(oRecordOriginal);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_MoveOriginalRecord", "Section1");
  }
}

function WebData_SaveOriginalRecordA(oRecord)
{
  try
  {
    this.HasChanged = true;

    var rowState = this.GetRowState(oRecord);
    if (rowState == RS_inserted || rowState == RS_detached)
    {
      return;
    }

    var diffgramId = this.GetDiffgramId(oRecord);
    var oBefore = this.GetDiffgramBefore(true);
    var oRecordOriginal = oBefore.selectSingleNode(oRecord.nodeName + "[@diffgr:id='" + diffgramId + "']");
    if (oRecordOriginal == null)
    {
      oRecordOriginal = oRecord.cloneNode(false);
      var oChildren = oRecord.selectNodes("./*[not(@diffgr:id)]");
      for (var i = 0, len = oChildren.length; i < len; i++)
      {
        var oChild = oChildren[i];
        oRecordOriginal.appendChild(oChild.cloneNode(false));
      }
      oBefore.appendChild(oRecordOriginal);

      var xPath = ".//*[@diffgr:id]";
      var oSelectedList = oRecord.selectNodes(xPath);
      for (var i = 0, len = oSelectedList.length; i < len; i++)
      {
        var oSelected = oSelectedList[i];
        oRecordOriginal = oSelected.cloneNode(false);
        var oChildren = oSelected.selectNodes("./*[not(@diffgr:id)]");
        for (var j = 0, len = oChildren.lengt; j < len; j++)
        {
          var oChild = oChildren[j];
          oRecordOriginal.appendChild(oChild.cloneNode(false));
        }
        oBefore.appendChild(oRecordOriginal);
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SaveOriginalRecordA", "Section1");
  }
}

function WebData_GetRowState(oRecord)
{
  try
  {
    var currentRowState = oRecord.getAttribute("diffgr:hasChanges");

    return currentRowState;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetRowState", "Section1");
  }
}

function WebData_SetRowState(oRecord, rowState)
{
  try
  {
    if (rowState == null)
    {
      this.RemoveRowState(oRecord);
    }
    else
    {
      var oAttribute = Ilp.XmlDom.GetAttribute(oRecord, "diffgr:hasChanges", true, this.oMessageDoc, NS_diffgr);
      
      if (Ilp.XmlDom.GetValue(oAttribute) == RS_inserted && rowState == RS_modified)
      {
        return;
      }
      else
      {
        Ilp.XmlDom.SetValue(oAttribute, rowState);
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SetRowState", "Section1");
  }
}

function WebData_SetRowStateA(oRecord, rowState)
{
  try
  {
    this.SetRowState(oRecord, rowState);

    var xPath = ".//*[@diffgr:id]";  // alle Knoten mit diffgr:id
    var oSelectedList = oRecord.selectNodes(xPath);
    for (var i = 0, len = oSelectedList.length; i < len; i++)
    {
      var oSelected = oSelectedList[i];
      this.SetRowState(oSelected, rowState);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SetRowStateA", "Section1");
  }
}

function WebData_RemoveRowStateA(oRecord)
{
  try
  {
    this.RemoveRowState(oRecord);

    var xPath = ".//*[@diffgr:id]";  // alle Knoten mit diffgr:id
    var oSelectedList = oRecord.selectNodes(xPath);
    for (var i = 0, len = oSelectedList.length; i < len; i++)
    {
      var oSelected = oSelectedList[i];
      this.RemoveRowState(oSelected);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_RemoveRowStateA", "Section1");
  }
}

function WebData_RemoveRowState(oRecord)
{
  try
  {
    var namedNodeMap = oRecord.attributes;
    var oAttribute = namedNodeMap.removeNamedItem("diffgr:hasChanges");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_RemoveRowState", "Section1");
  }
}

function WebData_Transfer(oMasterRecord)
{
  try
  {
    var recordsAdded = new Array();
    var tableDescriptorFqnList = WebMessage.GetTableDescriptorFqnList();
    var tableDescriptorFqn = "";
    if (tableDescriptorFqnList != null)
    {
      for (var k = 0, len = tableDescriptorFqnList.length; k < len; k++)
      {
        tableDescriptorFqn = tableDescriptorFqnList[k].text;
        if (this.AutoClearOnTransfer == true)
        {
          this.ClearSelectionPerTableDescriptor(tableDescriptorFqn);
        }
        var oRecordList = WebMessage.oMessageResponseDoc.documentElement.selectNodes("//NewDataSet/" + tableDescriptorFqn);
        for (var i = 0, len1 = oRecordList.length; i < len1; i++)
        {
          var oRecord = oRecordList[i];
          var oRecordNew = oRecord.cloneNode(true);
          this.SetRowState(oRecordNew, RS_transferred);
          oRecordAdded = this.AddRecord(oRecordNew, oMasterRecord);
          recordsAdded[recordsAdded.length] = oRecordAdded;
        }
      }
      this.RefreshRowOrder();
    }

    this.AutoClearOnTransfer = false;

    return recordsAdded;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_Transfer", "Section1");
  }
}

function WebData_TransferChildTable(oMasterRecord, tableDescriptorFqn, oResponseDoc)
{
  try
  {
    oResponseDoc = oResponseDoc == null ? WebMessage.oMessageResponseDoc : oResponseDoc;
    
    if (this.AutoClearOnTransfer == true)
    {
      this.ClearSelectionPerTableDescriptor(tableDescriptorFqn);
    }

    //var xPath = "//" + tableDescriptorFqn + "[@msdata:rowOrder]";
    // //NewDataSet//ProjectItem/ProjectOwner
    //var oRecordList = oResponseDoc.documentElement.selectNodes(xPath);
    
    var oNewDataSet = WebData.GetNewDataSet(oResponseDoc);
    var xPath = tableDescriptorFqn + "[@msdata:rowOrder]";
    var oRecordList = oNewDataSet.selectNodes(xPath);
    for (var i = 0; i < oRecordList.length; i++)
    {
      var oRecord = oRecordList[i];
      var oRecordNew = oRecord.cloneNode(true);
      if (oRecordNew.nodeName != oMasterRecord.nodeName)
      {
        this.SetRowState(oRecordNew, RS_transferred);
      }
      var oRecordAdded = this.AddRecord(oRecordNew, oMasterRecord);
    }


    this.ResetRowOrderA(oMasterRecord, false);
    this.SetRowOrderA(oMasterRecord);

    this.AutoClearOnTransfer = false;
    
    WebMessage.DeletePagingInfoByTdFqn(tableDescriptorFqn);
    var oPagingInfoItemList = oResponseDoc.documentElement.selectNodes("//ilp:WebMessage/ilp:PagingInfo/ilp:PagingInfoItem[@TableDescriptorFqn='" + tableDescriptorFqn + "']");
    var count = oPagingInfoItemList.length;
    for (var i = 0; i < count; i++)
    {
      WebMessage.AddPagingInfoItem(oPagingInfoItemList[i]);
    }      
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_TransferChildTable", "Section1");
  }
}

function WebData_TransferSibling(oRecord, tableFqn)
{
  try
  {
    var oRecordArray = new Array();
    var xPath = "";
    if (oRecord == null)
    {
      xPath = "//NewDataSet/" + tableFqn;
    }
    else
    {
      xPath = "//NewDataSet/" + oRecord.nodeName;
    }
    var oRecordList = WebMessage.oMessageResponseDoc.documentElement.selectNodes(xPath);
    for (var i = 0; i < oRecordList.length; i++)
    {
      var oRecordSibling = oRecordList[i];
      if (oRecord != null)
      {
        var oRecordNew = oRecordSibling.cloneNode(true);
        this.SetRowState(oRecordNew, RS_transferred);
        if (this.IsChildRecord(oRecord) == false)
        {
          oRecordAdded = this.AddRecord(oRecordNew, null);
        }
        else
        {
          oRecordAdded = this.AddRecord(oRecordNew, oRecord.parentNode);
        }
        oRecordArray[oRecordArray.length] = oRecordAdded;
      }
      else
      {
        oRecordArray[oRecordArray.length] = oRecordSibling;
      }
    }
    return oRecordArray;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_TransferSibling", "Section1");
  }
}

function WebData_TransferPage(oMasterRecord)
{
  try
  {
    WebMessage.InitTableDescriptorFqnList();
    var oPagingInfoItem = this.oMessageDoc.selectSingleNode("/ilp:WebMessage/ilp:GeneralInfo/ilp:PagingInfoItem");
    WebMessage.AddTableDescriptorFqn(oPagingInfoItem.getAttribute("TableDescriptorFqn"));
    var recordsAdded = this.Transfer(this.PagedWebDataGrid.oMasterRecord);

    WebControl.AddKpiLogMessage(new Date(), "WebData_TransferPage", "");
    if (this.PagedWebDataGrid.ClassType == "WebDataGrid")
    {
      this.PagedWebDataGrid.StartTime = new Date();
      this.PagedWebDataGrid.SetColumnHeaderRows("block");
      this.PagedWebDataGrid.MergeRecordList(recordsAdded);
      this.PagedWebDataGrid.ShowCurrentRows();
    }  
    else if (this.PagedWebDataGrid.ClassType == "PagingManagerClass")
    {
      var oResult = WebMessage.oMessageResponseDoc.selectSingleNode("//ilp:WebMessage/ilp:Result");
      this.PagedWebDataGrid.SpreadSheet.MergeTable(unescape(oResult.text));
      this.PagedWebDataGrid.ShowCurrentRows();
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_TransferPage", "Section1");
  }
}

function WebData_Page(oControl)
{
  try
  {
    if (oControl!=null){
      oControl.disabled = true;
    }

    var oPagingLinkDescriptor = oControl.oPagingLinkDescriptor;
    this.PagedWebDataGrid = oPagingLinkDescriptor.oContainerInstance;
    this.PageLinkClicked = oControl;

    if (this.PagedWebDataGrid.ClassType == "WebDataGrid")
    {
      this.PagedWebDataGrid.SetNextPagingLinkDescriptor(oPagingLinkDescriptor);
    }
    else if (this.PagedWebDataGrid.ClassType == "PagingManagerClass")
    {
      WebMessage.SetWebSpreadSheetInfo(this.PagedWebDataGrid.SpreadSheet.Container);
      this.PagedWebDataGrid.SetNextPagingLinkDescriptor(oPagingLinkDescriptor);
    }
    
    WebMessage.ClientStartOfProcessing = new Date();
    LoadApplicationStart = new Date();
    WebControl.InitKpiLogging();
    WebControl.AddKpiLogMessage(new Date(), "WebData_Page", "");

    if (oPagingLinkDescriptor.IsLoaded == false)
    {
      WebStatusBar.SetStatusbarMessage(ids_ReceivingData, 0);
      if (this.PagedWebDataGrid.ClassType == "WebDataGrid")
      {
        oPagingLinkDescriptor.oPagingInfoItem.setAttribute("IsSpreadSheetPage", "false");
      }
      else if (this.PagedWebDataGrid.ClassType == "PagingManagerClass")
      {
        oPagingLinkDescriptor.oPagingInfoItem.setAttribute("IsSpreadSheetPage", "true");
      }
      WebMessage.AddPagingInfoItemToGeneralInfo(oPagingLinkDescriptor.oPagingInfoItem);
      if (this.PagedWebDataGrid.ClassType == "WebDataGrid")
      {
        this.PagedWebDataGrid.HideCurrentRows();
        this.PagedWebDataGrid.TogglePageLink();
      }  
      else if (this.PagedWebDataGrid.ClassType == "PagingManagerClass")
      {
        this.PagedWebDataGrid.HideCurrentRows();
        this.PagedWebDataGrid.TogglePageLink();
      }  
      oPagingLinkDescriptor.IsLoaded = true;           
      window.setTimeout("WebData_PageT();", 50);
    }
    else
    {
      if (this.PagedWebDataGrid.ClassType == "WebDataGrid")
      {
        this.PagedWebDataGrid.HideCurrentRows();
        this.PagedWebDataGrid.TogglePageLink();
        window.setTimeout("WebData.PagedWebDataGrid.ShowCurrentRows();");
      }  
      else if (this.PagedWebDataGrid.ClassType == "PagingManagerClass")
      {
        this.PagedWebDataGrid.HideCurrentRows();
        this.PagedWebDataGrid.TogglePageLink();
        window.setTimeout("WebData.PagedWebDataGrid.ShowCurrentRows();");
      }  
    }

    if (oControl != null)
    {
      oControl.disabled = false;

      var onAfterPageDataHandler = oPagingLinkDescriptor.oContainerInstance.Container.getAttribute("OnAfterPageDataHandler")
      if (typeof(onAfterPageDataHandler) == "string")
      {
        var args = new EventArgs();
        eval(onAfterPageDataHandler + "(oControl, args);");
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_Page", "")
  }
}

function WebData_PageT()
{
  try
  {
    WebMessage.PageData();
    WebStatusBar.SetStatusbarMessage(ids_Ready, 0);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_PageT", "")
  }
}

function WebData_GetDataDirect(tableDescriptoFqn, oMasterRecord)
{
  try
  {
    WebMessage.InitTableDescriptorFqnList();
    WebMessage.InitDataTableRelationDescriptorFqnList();
    WebMessage.AddTableDescriptorFqn(tableDescriptoFqn);

    if (oMasterRecord == null)
    {
      WebMessage.SetGeneralInfoAttribute("FunctionCall", "GetWebData");
      WebMessage.Exchange(false, false);
      WebData.AutoClearOnTransfer = true;
      WebData.Transfer();
    }
    else
    {
      WebMessage.SetGeneralInfoAttribute("FunctionCall", "GetWebDataDetail");     
      WebMessage.Exchange(false, false);
      WebData.AutoClearOnTransfer = true;
      WebData.Transfer(oMasterRecord);
    }  
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetDataDirect", "")
  }
}

function WebData_GetData()
{
  try
  {
    WebStatusBar.SetStatusbarMessage(ids_ReceivingData, 0);

    window.setTimeout("WebData_GetDataT();", 100);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetData", "")
  }
}

function WebData_GetDataT(classType)
{
  try
  {
    classType = classType == null ? "WebDataGrid" : classType;

    if (classType == "WebSpreadSheetClass")
    {
      WebMessage.SetGeneralInfoAttribute("FunctionCall", "GetWebDataSpreadSheet");
    }
    else
    {
      WebMessage.SetGeneralInfoAttribute("FunctionCall", "GetWebData");
    }
    WebMessage.Exchange();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetDataT", "")
  }
}

function WebData_GetFqnAndRowOrder(fqn, oRecord)
{
  try
  {
    var aFqn = fqn.split(".");
    var rowOrder = this.GetDiffgramId(oRecord);
    if (aFqn.length == 2)
    {
      return oRecord.nodeName + "." + aFqn[1] + "_" + rowOrder;
    }
    else
    {
      return aFqn[0] + "_" + rowOrder;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetFqnAndRowOrder", "")
  }
}

function WebData_OnBeforeUnload()
{
  try
  {
    if (typeof(this.BeforeOnBeforeUnload) == "function")
    {
      this.BeforeOnBeforeUnload();
    }

    if (this.AskBeforeUnload == true)
    {
      if (this.HasChanged == true && window.event != null)
      {
        window.event.returnValue = ids_AskDiscardChanges;
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_OnBeforeUnload", "Section1")
  }
}

function WebData_AskDiscardChanges()
{
  try
  {
    var askDiscardChanges = true;
    if (this.HasChanged == true)
    {
      askDiscardChanges = window.confirm(ids_AskDiscardChanges);
    }

    return askDiscardChanges;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_AskDiscardChanges", "Section1")
  }
}

function WebData_AskDelete()
{
  try
  {
    var askDelete = true;
    askDelete = this.CurrentWindow.confirm(ids_AskDelete);

    return askDelete;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_AskDelete", "Section1")
  }
}

function WebData_AskDeleteIrrevocably()
{
  try
  {
    var askDeleteIrrevocably = true;
    askDeleteIrrevocably = this.CurrentWindow.confirm(ids_AskDeleteIrrevocably);

    return askDeleteIrrevocably;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_AskDeleteIrrevocably", "Section1")
  }
}

function WebData_GetRecordSelector(oRecord)
{
  try{
    var pkFD = FormDescriptor.GetPrimaryKeyFieldDescriptor(oRecord.nodeName);
    var pkFna = FormDescriptor.GetFieldnameEffective(pkFD);
    if (pkFna == null)
    {
      pkFna = pkFD.getAttribute("FieldName");
    }
    var xPathSelector = "//" + oRecord.nodeName + "[" + pkFna + "=" + WebData.GetFieldValue(oRecord, oRecord.nodeName + "." + pkFna)+ "]";

    return xPathSelector;
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebData_GetRecordSelector", "Section1")
  }
}

function WebData_GetRecordSelectorA(tdFqn, pkValue)
{
  try{
    var pkFD = FormDescriptor.GetPrimaryKeyFieldDescriptor(tdFqn);
    var pkFna = FormDescriptor.GetFieldnameEffective(pkFD);
    var xPathSelector = "//" + tdFqn + "[" + pkFna + "=" + pkValue + "]";

    return xPathSelector;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetRecordSelectorA", "Section1")
  }
}

function WebData_GetRecordSelectorB(oRecord)
{
  try
  {
    var recordSelector = "";
    var parent = oRecord.parentNode;

    recordSelector = oRecord.nodeName;
    while(parent.nodeName != "NewDataSet")
    {
      recordSelector = parent.nodeName + "/" + recordSelector;
      parent = parent.parentNode;
    }
    return recordSelector;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetRecordSelectorB", "Section1")
  }
}


function WebData_Compare(oRecord, fqn1, fqn2)
{
  try
  {
    var value1 = this.GetFieldValue(oRecord, fqn1);
    var value2 = this.GetFieldValue(oRecord, fqn2);

    if (value1 == value2)
    {
      return 0;
    }
    else
    {
      return 1;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_Compare", "Section1")
  }
}

function WebData_IsValueDifferent(oRecord, fqn1, value)
{
  try
  {
    var value1 = this.GetFieldValue(oRecord, fqn1);
    var value2 = String(value);

    if (Ilp.Util.ConvertToJavaScriptLineFeed(value1) == Ilp.Util.ConvertToJavaScriptLineFeed(value2))
    {
      return false;
    }
    else
    {
      return true;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_IsValueDifferent", "Section1")
  }
}

function WebData_DeleteReferentialData(oRecord)
{
  try
  {
    var xmlData = "";
    var bContinue = true;
    var retValue = "";

    WebMessage.SetGeneralInfoAttribute("PageLogo", PageLogo);

    var deleteDescriptor = FormDescriptor.GetDeleteDescriptor(oRecord.nodeName);
    var ddFqn = deleteDescriptor.getAttribute("Fqn");

    var sourceFqn = deleteDescriptor.getAttribute("SourceTextFqn");
    if (sourceFqn == null) sourceFqn = deleteDescriptor.getAttribute("FieldDescriptorTextFqn");

    var oDeleteInfo = WebMessage.AddDeleteInfo("D1", ddFqn, this.GetPkValue(oRecord), this.GetFieldValue(oRecord, sourceFqn));
    oDeleteInfo.setAttribute("PageHeadline", PageHeadline);
    oDeleteInfo.setAttribute("PageTitle", PageTitle);

    WebMessage.SaveWebMessageTransfer();

    var IDWebMessageTransfer = WebMessage.GetGeneralInfoAttribute("IDWebMessageTransfer");
    var IDSessionInfo = WebMessage.GetGeneralInfoAttribute("IDSessionInfo");

    retValue = this.OpenDeleteDialog(IDWebMessageTransfer, IDSessionInfo);
    return retValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_DeleteReferentialData", "Section1")
  }
}

function WebData_OpenDeleteDialog(IDWebMessageTransfer, IDSessionInfo)
{
  try
  {

    var retValue = "";
    var url = GlobalScriptsDirectoryVirtual + "GTCommon/Delete.aspx?WM=" + String(IDWebMessageTransfer) + "&IDSessionInfo=" + String(IDSessionInfo) + "&RootID=" + WebMessage.GetGeneralInfoAttribute("RootID");
    if (1==1)
    {
      if (1==2)
      {
        window.open(url);
      }
      else
      {
        var dialogFeatures = "";
        dialogFeatures += " dialogTop: 100px;";
        dialogFeatures += " dialogLeft: 20px;";
        dialogFeatures += " dialogWidth: 1000px;";
        dialogFeatures += " dialogHeight: 590px;";
        dialogFeatures += " scroll:Yes;";
        dialogFeatures += " status:No;";
        dialogFeatures += " resizable:Yes;";

        retValue = window.showModalDialog(
          url,
          "",
          dialogFeatures);
      }
    }
    else
    {
      var localFeatures = "";
      localFeatures += "top = 100px,";
      localFeatures += "left = 100px,";
      localFeatures += "width = 550px,";
      localFeatures += "height = 420px,";
      localFeatures += "scroll = Yes,";
      localFeatures += "status = No,";
      localFeatures += "resizable = Yes";

      window.open(
        url,
        '_blank',
        localFeatures,
        true);
    }

    return retValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_OpenDeleteDialog", "Section1")
  }
}

function WebData_UpdateTracking(oRecord)
{
  try
  {
    var fdColumnUpdated = FormDescriptor.GetFieldDescriptor(oRecord.nodeName + ".ColumnUpdated");
    
    if (fdColumnUpdated)
    {
      var fieldDescriptorList = FormDescriptor.GetFieldDescriptorList(oRecord.nodeName);
      for(var i = 0; i < fieldDescriptorList.length; i++)
      {
        var oFieldDescriptor = fieldDescriptorList[i];
        var oControl = WebControl.GetControl(oFieldDescriptor.getAttribute("Fqn"), oRecord);
        if (oControl != null)
        {
          if (oControl.getAttribute("ControlType") == "RadioButton")
          {
            WebControl.CheckGalaxy(oControl);
            WebControl.CheckChangeTracking(oControl.oGalaxy, oRecord);
          }
          else
          {
            WebControl.CheckChangeTracking(oControl, oRecord);
          }
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_UpdateTracking", "Section1")
  }
}


function WebData_UpdateBinding(oRecord, dropDownListOnly, webControlRef)
{
  try
  {
    dropDownListOnly = dropDownListOnly == null ? dropDownListOnly : false;
    webControlRef = webControlRef == null ? WebControl : webControlRef;

    var oTarget = null;
    var oDataField = null;
    var controlValue = null;
    var bindingHash = "";
    var fqn = "";
    var doUpdate = true;

    var oFieldDescriptorList = FormDescriptor.GetFieldDescriptorList(oRecord.nodeName);

    for(var i = 0, len1 = oFieldDescriptorList.length; i < len1; i++)
    {
      oFieldDescripor = oFieldDescriptorList[i];
      fqn = oFieldDescripor.getAttribute("Fqn");

      bindingHash = this.GetBindingHash(fqn, oRecord);
      var binder = webControlRef.FieldToHtmlObject.Get(bindingHash);
      if (binder != null)
      {
        for(var j = 0, len2 = binder.HtmlObjects.Count(); j < len2; j++)
        {
          oTarget = binder.HtmlObjects.Get(j);
          if (binder.BinderType == "Gui")
          {
            doUpdate = true;
            if (oTarget.getAttribute("ControlType") == "DropDownList")
            {
              oTarget = webControlRef.ReplaceFakeCombo(oTarget);
            }
            else
            {
              if (dropDownListOnly == true)
              {
                doUpdate = false;
              }
            }
            if (doUpdate == true && oTarget.oFieldDescriptor)
            {
              oDataField = WebData.GetField(oRecord, fqn);
              var controlTemplateWrapper = webControlRef.Controls.GetInstance(oTarget);
              var boundProperty = controlTemplateWrapper.GetBoundProperty(fqn);
              if (boundProperty != BoundProperty_None)
              {
                var fdWrapper = webControlRef.FieldDescriptors.GetInstance(FormDescriptor.GetFieldDescriptor(fqn));
                controlValue = webControlRef.ConvertWebDataToControlData(oTarget, oTarget.oFieldDescriptor, oDataField, controlTemplateWrapper, fdWrapper);
                webControlRef.SetValue(oTarget, controlValue, false, boundProperty);
              }
            }
          }
          webControlRef.SetIf(oTarget);
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_UpdateBinding", "Section1")
  }
}


function WebData_UpdateIf(oRecord)
{
  try
  {
    var oFieldDescriptorList = FormDescriptor.GetFieldDescriptorList(oRecord.nodeName);
    for(var i = 0; i < oFieldDescriptorList.length; i++)
    {
      var oFieldDescriptor = oFieldDescriptorList[i];
      var oTarget = WebControl.GetControl(oFieldDescriptor.getAttribute("Fqn"), oRecord);
      if (oTarget != null)
      {
        WebControl.SetIf(oTarget);
      }
    }

    var oTBody = WebControl.GetTBody(oRecord);

    if (oTBody != null)
    {
      var recordWrapper = WebControl.Records.GetInstance(oRecord);
      var localArray = oTBody.ClientBoundControlArray;
      for (var i = 0, len = localArray.length; i < len; i++)
      {
        var oTarget = localArray[i];
        var controlTemplateWrapper = WebControl.Controls.GetInstance(oTarget);
        if (controlTemplateWrapper.HasFqn == false)
        {
          WebControl.SetIf(oTarget, controlTemplateWrapper, recordWrapper);
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_UpdateIf", "Section1")
  }
}

function WebData_UpdateFieldBinding(oRecord, fqn, webControlRef)
{
  try
  {
    var oTarget = null;
    var controlValue = null;
    var bindingHash = "";
    var xPath = "*[count(*)=0]";
    var oDataField = this.GetField(oRecord, fqn);

    webControlRef = webControlRef == null ? WebControl : webControlRef;

    bindingHash = this.GetBindingHash(fqn, oRecord);
    var binder = webControlRef.FieldToHtmlObject.Get(bindingHash);
    if (binder != null)
    {
      for(var j = 0; j < binder.HtmlObjects.Count(); j++)
      {
        oTarget = binder.HtmlObjects.Get(j);
        if (oTarget.getAttribute("ControlType") == "DropDownList")
        {
          oTarget = webControlRef.ReplaceFakeCombo(oTarget);
        }
        if (oTarget.oFieldDescriptor)
        {
          var controlTemplateWrapper = webControlRef.Controls.GetInstance(oTarget);
          var boundProperty = controlTemplateWrapper.GetBoundProperty(fqn);
          if (boundProperty != BoundProperty_None)
          {
            var fdWrapper = webControlRef.FieldDescriptors.GetInstance(FormDescriptor.GetFieldDescriptor(fqn));
            controlValue = webControlRef.ConvertWebDataToControlData(oTarget, oTarget.oFieldDescriptor, oDataField, controlTemplateWrapper, fdWrapper);
            webControlRef.SetValue(oTarget, controlValue, false, boundProperty);
          }
          var fqn2 = controlTemplateWrapper.BackgroundColorFqn;
          if (fqn2.length > 0)
          {
            Ilp.HtmlDom.SetStyle(oTarget, "backgroundColor", this.GetFieldValue(oRecord, fqn2));
          }				
        }
        webControlRef.SetIf(oTarget);
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_UpdateFieldBinding", "Section1")
  }
}

function WebData_ReplaceBinding(oControlOld, oControlNew)
{
  try
  {
    var fqn = WebControl.GetFqn(oControlOld);
    var oRecord = oControlOld.oRecord;
    var oTarget = null;
    var bindingHash = "";

    if (typeof(fqn) == "string" && oRecord != null)
    {
      bindingHash = this.GetBindingHash(fqn, oRecord);
      var binder = WebControl.FieldToHtmlObject.Get(bindingHash);
      if (binder != null)
      {
        for(var j = 0; j < binder.HtmlObjects.Count(); j++)
        {
          oTarget = binder.HtmlObjects.Get(j);
          if (oTarget == oControlOld)
          {
            binder.HtmlObjects.Set(j, oControlNew);
          }
        }
      }
    }

    if (oControlOld.oTBody && oControlOld.oTBody.ClientBoundControlArray && oControlOld.BindingIndex)
    {
      oControlOld.oTBody.ClientBoundControlArray[oControlOld.BindingIndex] = oControlNew;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_ReplaceBinding", "Section1")
  }
}

function WebData_ExistsChanges()
{
  try
  {
    var returnValue = false;
    
    if (this.oWebData != null)
    {
      var oRecordList = this.oWebData.selectNodes("//*[@diffgr:hasChanges]");
      returnValue = oRecordList.length > 0;
    }  

    for (var i = 0; i < window.WebFrameArray.length; i++)
    {
      returnValue =  returnValue || window.WebFrameArray[i].ExistsChanges();
    }
    
    return returnValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_ExistsChanges", "Section1")
  }
}

function WebData_ClipCut(sender)
{
  try
  {
    this.SetClipboardData(sender.oRecord, DataType_Record, "ClipCut");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_ClipCut", "Section1")
  }
}

function WebData_ClipCopy(sender)
{
  try
  {
    this.SetClipboardData(sender.oRecord, DataType_Record, "ClipCopy");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_ClipCopy", "Section1")
  }
}

function WebData_ClipPaste(sender, detailTableDescriptorFqn, customWebMethode, customWebArgument)
{
  try
  {
    var returnValue = null;
    
    var oClipboard = this.GetClipboardData(DataType_Record);
    if (oClipboard != null)
    {
      var mode = WebData.GetFieldValue(oClipboard, "ClipboardData.Mode");
      if (mode == "ClipCopy")
      {
        var IDClipboardData = WebData.GetFieldValue(oClipboard, "ClipboardData.IDClipboardData");
        var deepCopy = true;
        var webMethode  = customWebMethode == null ? "ClipPaste" : customWebMethode;
        customWebArgument = customWebArgument == null ? "" : customWebArgument;
        
        var webArgument = "";
        webArgument = "<IDClipboardData>" + IDClipboardData + "</IDClipboardData>"
        webArgument += "<deepCopy>" + deepCopy + "</deepCopy>"
        webArgument += customWebArgument;

        returnValue = WebMessage.CallWebMethod2(webMethode, webArgument);
      }
      else if (mode == "ClipCut")
      {
        returnValue = "0";
      }
    }
    else
    {
      alert(ids_NoDataToForPasting);
    }

    return returnValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_ClipPaste", "Section1")
  }
}


function WebData_MoveTo(oRecord, rowOrder)
{
  try
  {
    rowOrder = Number(rowOrder);
    var currentRowOrder = Number(this.GetRowOrder(oRecord));

    var rowOrderRecordAfter = (rowOrder < currentRowOrder) ? rowOrder : rowOrder + 1;
    var oRecordAfter = this.GetRecordByRowOrder(this.GetRecordSelectorB(oRecord), rowOrderRecordAfter);
    var parentNode = oRecord.parentNode;

    if (oRecordAfter)
    {
      parentNode.insertBefore(oRecord, oRecordAfter);
    }
    else
    {
      parentNode.appendChild(oRecord);
    }
    this.ResetRowOrderA(oRecord);
    this.SetRowOrderA(oRecord);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_MoveTo", "Section1");
  }
}

function WebData_SetToDefault(oRecord, fqn)
{
  try
  {
    var fd = FormDescriptor.GetFieldDescriptor(fqn);
    this.ApplyFieldDefault(oRecord, fd, "new");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SetToDefault", "Section1");
  }
}

function WebData_SetAllowEdit(oRecord, allowEdit)
{
  try
  {
    this.SetFieldValueOnly(oRecord, oRecord.nodeName + ".AC_AllowEdit", allowEdit == false ? "False" : "True");
    var recordWrapper = WebControl.Records.GetInstance(oRecord);
    recordWrapper.AllowEdit = allowEdit;
    if (recordWrapper.AllowEdit == false)
    {
      recordWrapper.AllowDelete = false;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SetAllowEdit", "Section1");
  }
}

function WebData_GetClipboard(addClipboardData)
{
  try
  {
    var oClipboardRecord = null;

    addClipboardData = addClipboardData == null ? false : addClipboardData;

    if (WebData.oMessageDoc != null)
    {
      if (FormDescriptor.GetTableDescriptor("ClipboardData") != null)
      {
        var oSelectedList = WebData.Select("ClipboardData");

        if (oSelectedList.length == 0)
        {
          if (addClipboardData == true)
          {
            oClipboardRecord = this.NewRecord("ClipboardData");
            oClipboardRecord = this.AddRecord(oClipboardRecord);
          }
        }
        else
        {
          oClipboardRecord = oSelectedList[0];
        }
      }
    }

    return oClipboardRecord;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetClipboard", "Section1")
  }
}


function WebData_ClearClipboard()
{
  try
  {
    if (WebData.oMessageDoc != null)
    {
      if (FormDescriptor.GetTableDescriptor("ClipboardData") != null)
      {
        var oSelectedList = WebData.Select("ClipboardData");
        oSelectedList.removeAll();
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_ClearClipboard", "Section1")
  }
}



function WebData_SetClipboardData(oRecord, IDDataType, mode)
{
  try
  {
    var oClipboardRecord = null;
    if (IDDataType == DataType_Record)
    {
      oClipboardRecord = this.GetClipboard(true);
      if (oClipboardRecord != null)
      {
        var oRecordClipped = oRecord.cloneNode(true);
        this.DeleteChildRecords(oRecordClipped);

        this.SetFieldValueOnly(oClipboardRecord, "ClipboardData.IDDataType", DataType_Record);
        this.SetFieldValueOnly(oClipboardRecord, "ClipboardData.Mode", mode);
        this.SetFieldValueOnly(oClipboardRecord, "ClipboardData.TableName", oRecordClipped.nodeName);
        this.SetFieldValueOnly(oClipboardRecord, "ClipboardData.XmlData", Ilp.XmlDom.GetXml(oRecordClipped));

        var webMethode  = "SaveRecord";
        var webArgument = "";
        webArgument += "<formDescriptorFileName>" + WebMessage.GetGeneralInfoAttribute("FormDescriptorFileName") + "</formDescriptorFileName>";
        webArgument += "<tableDescriptorFqn>" + oClipboardRecord.nodeName + "</tableDescriptorFqn>";
        webArgument += "<xmlData>" + escape(Ilp.XmlDom.GetXml(oClipboardRecord)) + "</xmlData>";
        var IDClipboardData = WebMessage.CallWebMethod2(webMethode, webArgument);

        if (WebData.GetRowState(oClipboardRecord) == RS_inserted)
        {
          this.SetFieldValueOnly(oClipboardRecord, "ClipboardData.IDClipboardData", IDClipboardData);
        }
        this.AcceptChanges(oClipboardRecord);

      }
    }

    return oClipboardRecord;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SetClipboardData", "Section1")
  }
}

function WebData_GetClipboardData(IDDataType)
{
  try
  {
    var oClipboardRecord = null;

    if (IDDataType == DataType_Record)
    {
      var oClipboardRecord = this.GetClipboard();
    }

    return oClipboardRecord;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetClipboardData", "Section1")
  }
}

function WebData_GetClipboardValue(fqn)
{
  try
  {
    var clipboardValue = null;
    var oClipboardRecord = this.GetClipboard(false);
    
    if (oClipboardRecord != null)
    {
      var xmlData = this.GetFieldValue(oClipboardRecord, "ClipboardData.XmlData");
      var oRecord = this.CreateRecordFromXml(xmlData);
      
      clipboardValue = this.GetFieldValue(oRecord, fqn);
    }

    return clipboardValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetClipboardValue", "Section1")
  }
}


function WebData_RefreshRowOrder()
{
  try
  {
    var oFirstRecord = this.oWebData.selectSingleNode(".//*[@diffgr:id]");
    if (oFirstRecord)
    {
      this.ResetRowOrderA(oFirstRecord);
      this.SetRowOrderA(oFirstRecord);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_RefreshRowOrder", "Section1")
  }
}

function WebData_IsCsv(csvData)
{
  try
  {
    var aMatch;
    var csvPrep = this.ConvertCsvCellsToPlaceholder(csvData);

    aMatch = csvPrep.aMatch;
    csvData = csvPrep.CsvData;
  
    var isCsv = false;
    var lines = csvData.split("\n");
    
    if (lines.length > 1)
    {
      isCsv = true;
      for (var i = 0, len = lines.length; i < len; i++)
      {
        var line = lines[i];
        var values = line.split("\t");
        if (i == 0) valuesTemp = values;
        if (values.length <= 1 || values.length != valuesTemp.length)
        {
          isCsv = false;
          break;
        }
        var valuesTemp = values;
      }
    }    

    return isCsv;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_IsCsv", "Section1")
  }
}

function WebData_ConvertCsvToHtml(csvData)
{
  try
  {

    var aMatch;
    var csvPrep = this.ConvertCsvCellsToPlaceholder(csvData);

    aMatch = csvPrep.aMatch;
    csvData = csvPrep.CsvData;
       
    var markup = "";
    markup += "<table>\n";
    var lines = csvData.split("\n");
    for (var i = 0, len = lines.length; i < len; i++)
    {
      var line = lines[i];
      markup += " <tr>\n";
      var values = line.split("\t");
      for (var j = 0, len2 = values.length; j < len2; j++)
      {
        var value = values[j];
        markup += "  <td>";
        if (i == 0) markup += "<b>";
        markup += String(value).trim();
        if (i == 0) markup += "</b>";
        markup += "</td>\n";
      }
      markup += " </tr>\n";
    }
    markup += "</table>\n";
    
    for (var i = 0, len = aMatch.length; i < len; i++)
    {
      match = aMatch[i];
      var cellValue = match[0];
      cellValue = cellValue.substring(1, cellValue.length);
      cellValue = cellValue.substring(0, cellValue.length - 1);
      cellValue = cellValue.replace("\n", "<br>");
      cellValue = String(cellValue).trim();
      markup = markup.replace("C_" + String(i), cellValue);
    }    

    return markup;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_ConvertCsvToHtml", "Section1")
  }
}

function WebData_ConvertCsvCellsToPlaceholder(csvData)
{
  try
  {
    var counter = 0;
    var cell_regex=/"[\w() \/–\r\n]*"/im;
    var match = csvData.match(cell_regex);
    var aMatch = new Array();
    while (match)
    {
      aMatch[aMatch.length] = match;
      csvData = csvData.replace(csvData.substring(match.index, match.lastIndex), "C_" + String(counter));
      match = csvData.match(cell_regex);
      counter++;
    }
    
    csvPrep = {};
    csvPrep.aMatch = aMatch;
    csvPrep.CsvData = csvData;
    
    return csvPrep;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_ConvertCsvCellsToPlaceholder", "Section1")
  }
}

function WebData_ConvertRecordToCsv(oRecord, fdList)
{
  try
  {
    var clipboardData = "";

    for (var i = 0, len = fdList.length; i < len; i++)
    {
      var fd = fdList[i];
      fdWrapper = WebControl.FieldDescriptors.GetInstance(fd);
      if (fdWrapper.ExcelAllowExport == true)
      {
        var oDataField = this.GetField(oRecord, fdWrapper.Fqn);
        var oControl = WebControl.GetControl(fdWrapper.Fqn, oRecord);
        var fieldValue = WebControl.ConvertWebDataToControlData(oControl, fdWrapper.oFieldDescriptor, oDataField, null, fdWrapper);
        if (fieldValue == null)
        {
          clipboardData += "\t";
        }
        else
        {
          clipboardData +=  fieldValue + "\t";
        }
      }
    }

    return clipboardData;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_ConvertRecordToCsv", "Section1")
  }
}

function WebData_ConvertCsvToRecord(oRecord, fdList, csvData)
{
  try
  {
    var values = csvData.split("\t");

    var index = 0;
    for (var i = 0, len = fdList.length; i < len; i++)
    {
      var fd = fdList[i];
      fdWrapper = WebControl.FieldDescriptors.GetInstance(fd);
      if (fdWrapper.ExcelAllowExport == true)
      {
        if (index < values.length)
        {
          var fieldValue = WebControl.ConvertControlDataToWebData(null, fdWrapper.oFieldDescriptor, null, null, values[index]);

          if (index == 0)
          {
            this.SetFieldValue(oRecord, fdWrapper.Fqn, fieldValue);
          }
          else
          {
            this.SetFieldValueOnly(oRecord, fdWrapper.Fqn, fieldValue);
          }
          index++;
        }
        else
        {
          this.SetNullOnly(oRecord, fdWrapper.Fqn);
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_ConvertCsvToRecord", "Section1")
  }
}

function WebData_Base64Encode(byteArray)
{
  try
  {
    if (this.Base64CharacterSet == null) this.Base64InitCharacterSet();

    var i = 0;
    var byteArrayLength = byteArray.length;
    var byteArrayMoved = new Array();

    // Padding vorbereiten
    if ((byteArrayLength % 3) == 1)
    {
      byteArray[byteArray.length] = 0;
      byteArray[byteArray.length] = 0;
    }

    if ((byteArrayLength % 3) == 2) byteArray[byteArray.length] = 0;


    // Konvertieren
    while (i < byteArray.length)
    {
      byteArrayMoved[byteArrayMoved.length] = this.Base64CharacterSet[byteArray[i] >> 2];
      byteArrayMoved[byteArrayMoved.length] = this.Base64CharacterSet[((byteArray[i] & 3) << 4) | (byteArray[i + 1] >> 4)];
      byteArrayMoved[byteArrayMoved.length] = this.Base64CharacterSet[((byteArray[i + 1] & 15) << 2) | (byteArray[i + 2] >> 6)];
      byteArrayMoved[byteArrayMoved.length] = this.Base64CharacterSet[byteArray[i + 2] & 63];
      if ((i % 57) == 54) byteArrayMoved[byteArrayMoved.length] = "\n";
      i += 3;
    }

    // Padding abschließen
    if ((byteArrayLength % 3) == 1) byteArrayMoved[byteArrayMoved.length - 1] = byteArrayMoved[byteArrayMoved.length - 2] = "=";
    if ((byteArrayLength % 3) == 2) byteArrayMoved[byteArrayMoved.length - 1] = "=";

    // Array in Text zusammenführen
    return byteArrayMoved.join("");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_Base64Encode", "")
  }
}


function WebData_Base64Decode(base64String)
{
  try
  {
    if (this.Base64CharacterSet == null) this.Base64InitCharacterSet();

    var i = 0;
    var byteArray = new Array();

    // zur decodierung die Umbrueche entfernen
    base64String = base64String.replace(/\n|\r/g, "");
    base64String = base64String.replace(/=/g, "");

    // decodieren
    while (i < base64String.length)
    {
      byteArray[byteArray.length] = (this.Base64CharacterPosition[base64String.charAt(i)] << 2) | (this.Base64CharacterPosition[base64String.charAt(i+1)] >> 4);
      byteArray[byteArray.length] = (((this.Base64CharacterPosition[base64String.charAt(i+1)] & 15) << 4) | (this.Base64CharacterPosition[base64String.charAt(i + 2)] >> 2));
      byteArray[byteArray.length] = (((this.Base64CharacterPosition[base64String.charAt(i+2)] & 3) << 6) | (this.Base64CharacterPosition[base64String.charAt(i + 3)]));
      i += 4;
     }

    if (base64String.length % 4 == 2) d = byteArray.slice(0, byteArray.length - 2);
    if (base64String.length % 4 == 3) d = byteArray.slice(0, byteArray.length - 1);

    return byteArray;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_Base64Decode", "")
  }
}


function WebData_Base64InitCharacterSet()
{
  try
  {
    var base64String = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
    this.Base64CharacterSet = new Array();
    this.Base64CharacterPosition = new Array();

    for (var i = 0; i < base64String.length; i++)
    {
      this.Base64CharacterSet[i] = base64String.charAt(i);
      this.Base64CharacterPosition[base64String.charAt(i)] = i;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_Base64InitCharacterSet", "")
  }
}


function WebData_GetBitValue(byteArray, position)
{
  try
  {
     var byteIndex = Math.floor((position - 1) / 8);
    var byte = byteArray[byteIndex];
    var bitPosition = position % 8;
    var mask = (bitPosition > 0) ? Math.pow(2, bitPosition - 1) : 128;
    return ((byte & mask) > 0) ? 1 : 0;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetBitValue", "")
  }
}

function WebData_SetBitValue(byteArray, position, value)
{
  try
  {
     var byteIndex = Math.floor((position - 1) / 8);
    var byte = byteArray[byteIndex];
    var bitPosition = position % 8;
    var mask = (bitPosition > 0) ? Math.pow(2, bitPosition - 1) : 128;
    if (value == 1 || value == true)
    {
      byteArray[byteIndex] = (b | mask);
    }
    else
    {
      byteArray[byteIndex] = (b & ~mask);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SetBitValue", "")
  }
}

function WebData_GetOriginalRecord(oRecord)
{
  try
  {
    var rowOrder = oRecord.getAttribute("msdata:rowOrder");
    var ilpHash = oRecord.getAttribute("ilp:hash");
    return this.oMessageDoc.selectSingleNode("//diffgr:before/" + oRecord.nodeName + "[@ilp:hash='" + ilpHash + "']");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetOriginalRecord", "Section1")
  }
}

function WebData_GetOriginalValue(oRecord, fqn)
{
  try
  {
    var oRecordOriginal = this.GetOriginalRecord(oRecord);
    if (oRecordOriginal == null) return this.GetFieldValue(oRecord, fqn);
    return this.GetFieldValue(oRecordOriginal, fqn);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetOriginalValue", "Section1")
  }
}

function WebData_IsColumnOriginal(oRecord, fqn)
{
  try
  {
    var oRecordOriginal = this.GetOriginalRecord(oRecord);
    if (oRecordOriginal == null) return true;
    return (this.GetFieldValue(oRecordOriginal, fqn) == this.GetFieldValue(oRecord, fqn)) ? true : false;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_IsColumnOriginal", "Section1")
  }
}

function WebData_GetRecordFromOriginalRecord(oRecord, oWebMessage)
{
  try
  {
    oWebMessage = oWebMessage == null ? this.oMessageDoc : oWebMessage;

    var ilpHash = oRecord.getAttribute("ilp:hash");
    //return this.oMessageDoc.selectSingleNode("//NewDataSet/" + oRecord.nodeName + "[@ilp:hash='" + ilpHash + "']");
    return oWebMessage.selectSingleNode("//NewDataSet/descendant-or-self::*/" + oRecord.nodeName + "[@ilp:hash='" + ilpHash + "']");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetRecordFromOriginalRecord", "Section1")
  }
}

function WebData_ReloadRecord(oRecord)
{
  try
  {
    var oSearchInfoSave = WebMessage.SearchInfoSave();

    var oFieldDescriptor = FormDescriptor.GetPrimaryKeyFieldDescriptor(oRecord.nodeName);
    var fqn = oFieldDescriptor.getAttribute("Fqn");
    var fqnValue = WebData.GetFieldValue(oRecord, fqn);

    var oMasterRecord = null;
    if (WebData.IsChildRecord(oRecord) == false) oMasterRecord = null;
    else oMasterRecord = oRecord.parentNode;

    WebMessage.InitTableDescriptorFqnList();
    WebMessage.InitDataTableRelationDescriptorFqnList();
    WebMessage.AddTableDescriptorFqn(oRecord.nodeName);

    var oSearchInfoItem = null;
    var oRecordNew = null;

    if (oMasterRecord == null)
    {
      WebMessage.InitSearchInfo(true);
      oSearchInfoItem = WebMessage.AddSearchInfoItem(null, fqn, fqnValue, "Equal", false);

      WebMessage.SetGeneralInfoAttribute("FunctionCall", "GetWebDataByPrimaryKey");
      WebMessage.Exchange(false, false);
    }
    else
    {
      WebMessage.InitSearchInfo(true);
      oSearchInfoItem = WebMessage.AddSearchInfoItem(null, fqn, fqnValue, "Equal", false, "DirectSearchInDetail");

      WebMessage.SetGeneralInfoAttribute("FunctionCall", "GetWebDataDetailByPrimaryKey");
      WebMessage.Exchange(false, false);
    }

    oRecordReloaded = this.GetRecordByFieldValue(fqn, String(fqnValue), WebMessage.oMessageResponseDoc.documentElement.selectSingleNode("//NewDataSet"));

    this.CopyRecordTo(oRecordReloaded, oRecord);

    WebMessage.SearchInfoRestore(oSearchInfoSave);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_ReloadRecord", "Section1")
  }
}

function WebData_CreateRecordFromXml(xmlData)
{
  try
  {
    var oDocument = Ilp.XmlDom.CreateXmlDom();
    Ilp.XmlDom.SetSelectionNamespacesDefault(oDocument);
    oDocument.loadXML(xmlData);

    return oDocument.documentElement;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_CreateRecordFromXml", "Section1")
  }
}

function WebData_IsFirstRecord(oRecord)
{
  try
  {
    var returnValue = false;
    if (oRecord && oRecord.parentNode)
    {
      if (this.GetChildRecords(oRecord.parentNode, oRecord.nodeName)[0] == oRecord)
      {
        returnValue = true;
      }
    }
    return returnValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_IsFirstRecord", "Section1")
  }
}

function WebData_IsChildRecord(oRecord)
{
  try
  {
    var returnValue = false;
    if (oRecord && oRecord.parentNode)
    {
      if (oRecord.parentNode.nodeName != "NewDataSet")
      {
        returnValue = true;
      }
    }
    return returnValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_IsChildRecord", "Section1")
  }
}

function WebData_PrepareLikeParameter(parameterValue, addLeftPercent, addRightPercent)
{
  try
  {
    var returnValue = parameterValue;

    if (returnValue.substring(0, 1) == "*")
    {
      returnValue = "%" + returnValue.substring(1, returnValue.length);
    }
    else
    {
      if (addLeftPercent == true) returnValue = "%" + returnValue;
    }
    
    if (returnValue.substring(returnValue.length - 1, returnValue.length) == "*") 
    {
      returnValue = returnValue.substring(0, returnValue.length - 1) + "%";
    }
    else
    {
      if (addRightPercent == true) returnValue = returnValue + "%";
    }
    
    return returnValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_PrepareLikeParameter", "Section1")
  }
}

function WebData_GetMasterRecord(oRecord)
{
  try
  {
    return oRecord.parentNode;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetMasterRecord", "Section1")
  }
}

function WebData_MergeWebServiceReturnDataSet(oRecord, result)
{
  try
  {
    if (typeof(result) == "string" && result != "-1")
    {
      var oXmlDoc = Ilp.XmlDom.CreateXmlDom();
      oXmlDoc.async = false;
      oXmlDoc.validateOnParse = false;
      oXmlDoc.loadXML(result);
      Ilp.XmlDom.SetSelectionNamespacesDefault(oXmlDoc);
    
      var oNewDataSet = WebData.GetNewDataSet(oXmlDoc);
      if (oNewDataSet != null)
      {
        var oRecordReturn = WebData.GetRecord("*", 0, oNewDataSet);
        var oFieldList = WebData.GetFields(oRecordReturn);
      
        var fqn = "";
        var newValue = "";
        for (var i = 0; i < oFieldList.length; i++)
        {
          fqn = oRecordReturn.nodeName + "." + oFieldList[i].nodeName;
          newValue = WebData.GetFieldValue(oRecordReturn, fqn); 
        
          fqn = oRecord.nodeName + "." + oFieldList[i].nodeName;
          
          WebData.SetFieldValue(oRecord, fqn, newValue);
          WebData.UpdateFieldBinding(oRecord, fqn);
        }	
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_MergeWebServiceReturnDataSet", "Section1")
  }
}

function WebData_MergeWebServiceReturnRecord(oRecord, result)
{
  try
  {
    if (typeof(result) == "string" && result != "-1")
    {
      var oRecordReturn = WebData.CreateRecordFromXml(result);
      var oFieldList = WebData.GetFields(oRecordReturn);
    
      var fqn = "";
      var newValue = "";
      for (var i = 0; i < oFieldList.length; i++)
      {
        fqn = oRecordReturn.nodeName + "." + oFieldList[i].nodeName;
        newValue = WebData.GetFieldValue(oRecordReturn, fqn); 
      
        fqn = oRecord.nodeName + "." + oFieldList[i].nodeName;
        
        if (newValue == "-DBNull-") WebData.SetNull(oRecord, fqn);
        else WebData.SetFieldValueOnly(oRecord, fqn, newValue);
        
        WebData.UpdateFieldBinding(oRecord, fqn);
      }	
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_MergeWebServiceReturnRecord", "Section1")
  }
}

function WebData_GetPkValueList(oRecord, detailFqn, fdFqn)
{
  try
  {
    var aValues = new Array();
    var value = 0;
    var counter = 0;

    var oRecordList = WebData.GetChildRecords(oRecord, detailFqn);
    for (var i = 0; i < oRecordList.length; i++)
    {
      value = WebData.GetFieldValue(oRecordList[i], fdFqn);
      if(WebControl.CheckID(value) > 0)
      {
        aValues[counter++] = value;
      }
    }
    
    return aValues.join(",");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_GetPkValueList", "Section1")
  }
}

function WebData_ForceUpdate(oRecord)
{
  try
  {
    var fdList = FormDescriptor.GetFieldDescriptorList(oRecord.nodeName);
    for (var i = 0, len = fdList.length; i < len; i++)
    {
      fd = fdList[i];
      var updateClass = fd.getAttribute("UpdateClass");
      if (updateClass == null || updateClass == "Update")
      {
        var fqn = fd.getAttribute("Fqn");
        this.SetFieldValue(oRecord, fqn, WebData.GetFieldValue(oRecord, fqn));
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_ForceUpdate", "Section1")
  }
}

function WebData_SetColumnValue(fqn, columnValue)
{
  try
  {
    var aFqn = fqn.split(".");
    var oRecordList = WebData.Select(aFqn[0]);
    for (var i = 0, len = oRecordList.length; i < len; i++)
    {
      var oRecord = oRecordList[i];
      WebData.SetFieldValue(oRecord, fqn, columnValue);
      WebData.UpdateFieldBinding(oRecord, fqn);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_SetColumnValue", "Section1")
  }
}

function WebData_ConvertToNewDataSet(result)
{
  try
  {
    var oNewDataSet = null;
    if (typeof(result) == "string" && result != "-1")
    {
      var oXmlDoc = Ilp.XmlDom.CreateXmlDom();
      oXmlDoc.async = false;
      oXmlDoc.validateOnParse = false;
      oXmlDoc.loadXML(result);
      Ilp.XmlDom.SetSelectionNamespacesDefault(oXmlDoc);
          
      oNewDataSet = WebData.GetNewDataSet(oXmlDoc);
    }
    return oNewDataSet;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_ConvertToNewDataSet", "Section1")
  }
}

function WebData_UpdateMapping(sender)
{
  try
  {
    var oRecord = sender.oRecord;
    var oMasterRecord = sender.oRecord.parentNode;
    var oSun = WebControl.FindSun(sender);
    var idExchangeJournal = WebData.GetFieldValue(oMasterRecord, "Exchangejournal.IDExchangejournal");
    var importIDFqn = WebControl.GetFqn(oSun);
    var idPrimaryKey = WebData.GetPkValue(oRecord);
    var idMasterDataPrimaryKey = WebData.GetFieldValue(oRecord, importIDFqn);
    
    if (WebControl.CheckID(idExchangeJournal) > 0 && WebControl.CheckID(idPrimaryKey) > 0)
    {
      if (WebControl.CheckID(idMasterDataPrimaryKey) > 0)
      {
        var webMethode = "UpdateInterfaceMap";
        var webArgument = "<idExchangeJournal>" + String(idExchangeJournal) + "</idExchangeJournal>";
        webArgument += "<idPrimaryKey>" + String(idPrimaryKey) + "</idPrimaryKey>";
        webArgument += "<idMasterDataPrimaryKey>" + String(idMasterDataPrimaryKey) + "</idMasterDataPrimaryKey>";
        webArgument += "<importIDFqn>" + importIDFqn + "</importIDFqn>";
        var result = WebMessage.CallWebMethod2(webMethode, webArgument);
        if (WebControl.ConvertToInt(result) == enum_WebServiceResult_Success)
        {
          alert(ids_Successfully);
        }
        else
        {
          alert(ids_DataHasError);
        }
      }
      else
      {
        alert(ids_UploadFirst);
      }
    }
    else
    {
      alert(ids_SaveFirst);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebData_UpdateMapping", "Section1")
  }
}


/* ============================ GTWebFormDescriptor.js ===========================*/
function LoadFormDescriptor(xmlDomObject)
{
  try
  {
    if (window.XmlVersion == enum_XmlVersion_V1)
    {
      var oXMLObject = window.event.srcElement;
      if (oXMLObject.readyState == 'complete')
      {
        EnsureWebMessage();
        EnsureWebForm();
        EnsureWebControl();
      
        FormDescriptor = new FormDescriptorClass(oXMLObject.XMLDocument);
      }
    }
    else if (window.XmlVersion == enum_XmlVersion_V3)
    {
      Ilp.Page.LoadFormDescriptor();
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "LoadFormDescriptor", "");
  }
}

function FormDescriptorClass(xmlDomObject)
{
  try
  {
    this.FormDescriptorDoc = xmlDomObject;
    Ilp.XmlDom.SetSelectionLanguageDefault(this.FormDescriptorDoc);
    Ilp.XmlDom.SetSelectionNamespaces(this.FormDescriptorDoc, "xmlns:ilp='http://ilp.de/webservices/'");
    this.Counter = new Object();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor", "");
  }
}

FormDescriptorClass.prototype.GetFieldnameEffective = function(fd)
{
  try
  {
    var fieldname = fd.getAttribute("FieldNameAlias");
    if (fieldname == null || fieldname == "")
    {
      fieldname = fd.getAttribute("FieldName");
    }
    return fieldname;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetFieldnameEffective", "");
  }
}

FormDescriptorClass.prototype.GetDbGridCaption = function(fd)
{
  try
  {
    var caption = fd.getAttribute("DbGridCaption");
    if (caption == null || caption == "")
    {
      caption = fd.getAttribute("FieldNameAlias");
    }
    if (caption == null || caption == "")
    {
      caption = fd.getAttribute("FieldName");
    }
    return caption;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetColumnCaption", "");
  }
}

FormDescriptorClass.prototype.GetNextCount = function(tdFqn)
{
  try
  {
    if (this.Counter[tdFqn] == null)
    {
      this.Counter[tdFqn] = 1;
    }
    return this.Counter[tdFqn]++;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetNextCount", "");
  }
}

FormDescriptorClass.prototype.GetNextIlpId = function()
{
  try
  {
    if (this.IDCounterA == null)
    {
      this.IDCounterA = 1;
    }
    return this.IDCounterA++;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptorClass.prototype.GetNextIlpId", "");
  }
}

FormDescriptorClass.prototype.GetFieldDescriptor = function(fdFqn)
{
  try
  {
    var fqn = fdFqn.split(".");
    var fieldDescriptor = this.FormDescriptorDoc.selectSingleNode("/ilp:FormDescriptor/ilp:TableDescriptor[@ID='" + fqn[0] + "']/ilp:FieldDescriptor[@ID='" + fqn[1] + "']");
    return fieldDescriptor;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetFieldDescriptor", "");
  }
}

FormDescriptorClass.prototype.ExitsFieldDescriptor = function(fdFqn)
{
  try
  {
    var fqn = fdFqn.split(".");
    var fieldDescriptor = this.FormDescriptorDoc.selectSingleNode("/ilp:FormDescriptor/ilp:TableDescriptor[@ID='" + fqn[0] + "']/FieldDescriptor[@ID='" + fqn[1] + "']");
    return fieldDescriptor != null;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_ExitsFieldDescriptor", "");
  }
}

FormDescriptorClass.prototype.GetPrimaryKeyFieldDescriptor = function(tdFqn)
{
  try
  {
    return this.FormDescriptorDoc.selectSingleNode("/ilp:FormDescriptor/ilp:TableDescriptor[@ID='" + tdFqn + "']/ilp:FieldDescriptor[@IsPrimaryKey='true']");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetPrimaryKeyFieldDescriptor", "");
  }
}

FormDescriptorClass.prototype.GetOptionValueFd = function(tdFqn)
{
  try
  {
    return this.FormDescriptorDoc.selectSingleNode("/ilp:FormDescriptor/ilp:TableDescriptor[@ID='" + tdFqn + "']/ilp:FieldDescriptor[@CacheUsageClass='MapToOptionValue']");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetOptionValueFd", "");
  }
}

FormDescriptorClass.prototype.GetOptionTextFd = function(tdFqn)
{
  try
  {
    return this.FormDescriptorDoc.selectSingleNode("/ilp:FormDescriptor/ilp:TableDescriptor[@ID='" + tdFqn + "']/ilp:FieldDescriptor[@CacheUsageClass='MapToOptionText']");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetOptionTextFd", "");
  }
}

FormDescriptorClass.prototype.GetOptionReturnFd = function(tdFqn)
{
  try
  {
    return this.FormDescriptorDoc.selectSingleNode("/ilp:FormDescriptor/ilp:TableDescriptor[@ID='" + tdFqn + "']/ilp:FieldDescriptor[@CacheUsageClass='MapToOptionReturn']");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetOptionTextFd", "");
  }
}

FormDescriptorClass.prototype.GetNoUpdatableFields = function(tdFqn)
{
  try
  {
    if (tdFqn && tdFqn.length > 0)
    {
      return this.FormDescriptorDoc.selectNodes("/ilp:FormDescriptor/ilp:TableDescriptor[@ID='" + tdFqn + "']/ilp:*[@UpdateClass='NoUpdate' and not(@TransferClass='Mandatory') and not(@IsPrimaryKey)]");
    }
    else
    {
      return this.FormDescriptorDoc.selectNodes("//ilp:*[@UpdateClass='NoUpdate' and not(@TransferClass='Mandatory') and not(@IsPrimaryKey)]");
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetNoUpdatableFields", "");
  }
}

FormDescriptorClass.prototype.GetNoUpdatableTables = function()
{
  try
  {
    return this.FormDescriptorDoc.selectNodes("//ilp:*[(@AllowDelete='false' and @AllowNew='false' and @AllowEdit='false')]");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor.GetNoUpdatableTables", "");
  }
}

FormDescriptorClass.prototype.GetFieldDescriptorList = function(tdFqn, attributeSelector)
{
  try
  {
    tdFqn = tdFqn == null ? "" : tdFqn;
    attributeSelector = attributeSelector == null ? "" : attributeSelector;
    if (tdFqn.length > 0)
    {
      if (attributeSelector.length > 0)
      {
        return this.FormDescriptorDoc.selectNodes("/ilp:FormDescriptor/ilp:TableDescriptor[@ID='" + tdFqn + "']/ilp:FieldDescriptor" + attributeSelector);
      }
      else
      {
        return this.FormDescriptorDoc.selectNodes("/ilp:FormDescriptor/ilp:TableDescriptor[@ID='" + tdFqn + "']/ilp:FieldDescriptor");
      }
    }
    else
    {
      if (attributeSelector.length > 0)
      {
        return this.FormDescriptorDoc.selectNodes("/ilp:FormDescriptor/ilp:TableDescriptor/ilp:FieldDescriptor" + attributeSelector);
      }
      else
      {
        return this.FormDescriptorDoc.selectNodes("/ilp:FormDescriptor/ilp:TableDescriptor/ilp:FieldDescriptor");
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetFieldDescriptorList", "");
  }
}

FormDescriptorClass.prototype.GetTableDescriptorList = function()
{
  try
  {
    return this.FormDescriptorDoc.selectNodes("/ilp:FormDescriptor/ilp:TableDescriptor");
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "FormDescriptor_GetTableDescriptorList", "");
  }
}

FormDescriptorClass.prototype.GetTableDescriptor = function(tdFqn)
{
  try
  {
    var fqn = tdFqn.split(".");
  
    return this.FormDescriptorDoc.selectSingleNode("/ilp:FormDescriptor/ilp:TableDescriptor[@ID='" + fqn[0] + "']");
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "FormDescriptor_GetTableDescriptor", "");
  }
}

FormDescriptorClass.prototype.GetLookUpRelationDescriptor = function(lurdFqn)
{
  try
  {
    var fqn = lurdFqn.split(".");
  
    return this.FormDescriptorDoc.selectSingleNode("/ilp:FormDescriptor/ilp:LookUpRelationDescriptor[@ID='" + fqn[0] + "']");
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "FormDescriptor_GetLookUpRelationDescriptor", "");
  }
}

FormDescriptorClass.prototype.GetLookUpIDField = function(lurdFqn)
{
  try
  {
    var lurd = this.GetLookUpRelationDescriptor(lurdFqn);  
    var fqnID = lurd.getAttribute("FieldDescriptorIDFqn");
  
    return fqnID;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetLookUpIDField", "");
  }
}

FormDescriptorClass.prototype.GetLookUpTextField = function(lurdFqn)
{
  try
  {
    var lurd = this.GetLookUpRelationDescriptor(lurdFqn);  
    var fqnText = lurd.getAttribute("FieldDescriptorTextFqn");
  
    return fqnText;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetLookUpTextField", "");
  }
}

FormDescriptorClass.prototype.GetLookUpReturnField = function(lurdFqn)
{
  try
  {
    var lurd = this.GetLookUpRelationDescriptor(lurdFqn);  
    var fqnReturn = lurd.getAttribute("FieldDescriptorReturnFqn");
  
    return fqnReturn;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetLookUpReturnField", "");
  }
}


FormDescriptorClass.prototype.GetSearchRelationDescriptor = function(srdFqn)
{
  try
  {
    var fqn = srdFqn.split(".");
  
    return this.FormDescriptorDoc.selectSingleNode("/ilp:FormDescriptor/ilp:SearchRelationDescriptor[@ID='" + fqn[0] + "']");
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "FormDescriptor_GetSearchRelationDescriptor", "");
  }
}

FormDescriptorClass.prototype.GetSearchedFieldDescriptor = function(srdFqn)
{
  try
  {
    var searchRelationDescriptor = this.GetSearchRelationDescriptor(srdFqn);
  
    var fqn = searchRelationDescriptor.getAttribute("TableDescriptorFqnMaster") + "." + searchRelationDescriptor.getAttribute("FieldDescriptorFqnListMaster").split(" ")[0];
    
    return this.GetFieldDescriptor(fqn);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetSearchedFieldDescriptor", "");
  }
}

FormDescriptorClass.prototype.GetUploadDescriptor = function(uplFqn)
{
  try
  {
    var fqn = uplFqn.split(".");
  
    return this.FormDescriptorDoc.selectSingleNode("/ilp:FormDescriptor/ilp:UploadDescriptor[@ID='" + fqn[0] + "']");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetUploadDescriptor", "");
  }
}

FormDescriptorClass.prototype.GetDeleteDescriptor = function(tdFqn)
{
  try
  {
    var td = this.GetTableDescriptor(tdFqn);
    var fqn = "";
    if (td != null)
    {
      fqn = td.getAttribute("DeleteDescriptorFqn");
    }
    return this.FormDescriptorDoc.selectSingleNode("/ilp:FormDescriptor/ilp:DeleteDescriptor[@ID='" + fqn + "']");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetDeleteDescriptor", "");
  }
}

FormDescriptorClass.prototype.GetMoverDescriptor = function(mdFqn)
{
  try
  {
    var fqn = mdFqn.split(".");
  
    return this.FormDescriptorDoc.selectSingleNode("/ilp:FormDescriptor/ilp:MoverDescriptor[@ID='" + fqn[0] + "']");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetMoverDescriptor", "");
  }
}

FormDescriptorClass.prototype.GetPrimaryKeyFieldDescriptorFromDtrd = function(dtrd)
{
  try
  {
    var tableFqn = dtrd.getAttribute("TableDescriptorFqnMaster");
    var primaryKey = dtrd.getAttribute("FieldDescriptorFqnListMaster").split(" ")[0];
    
    return this.GetFieldDescriptor(tableFqn + "." + primaryKey);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetPrimaryKeyFieldDescriptorFromDtrd", "");
  }
}

FormDescriptorClass.prototype.GetPrimaryKeyFieldDescriptorListFromDtrd = function(dtrd)
{
  try
  {
    var fieldDescriptorList = new Array();
    var tableFqn = dtrd.getAttribute("TableDescriptorFqnMaster");
    var primaryKeyList = dtrd.getAttribute("FieldDescriptorFqnListMaster").split(" ");
    
    for (var i = 0; i < primaryKeyList.length; i++)
    {
      fieldDescriptorList[i] = this.GetFieldDescriptor(tableFqn + "." + primaryKeyList[i]);
    }
    
    return fieldDescriptorList;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "GetPrimaryKeyFieldDescriptorListFromDtrd", "");
  }
}

FormDescriptorClass.prototype.GetForeignKeyFieldDescriptor = function(dtrd)
{
  try
  {
    var tableFqn = dtrd.getAttribute("TableDescriptorFqnDetail");
    var foreignKey = dtrd.getAttribute("FieldDescriptorFqnListDetail").split(" ")[0];
    
    return this.GetFieldDescriptor(tableFqn + "." + foreignKey);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetForeignKeyFieldDescriptor", "");
  }
}

FormDescriptorClass.prototype.GetRelationByMasterDetail = function(masterTableFqn, detailTableFqn)
{
  try
  {
    var dtrd = this.FormDescriptorDoc.selectSingleNode("/ilp:FormDescriptor/ilp:DataTableRelationDescriptor[@TableDescriptorFqnMaster='" + masterTableFqn + "' and @TableDescriptorFqnDetail='" + detailTableFqn + "']");
    
    return dtrd;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetRelationByMasterDetail", "");
  }
}

FormDescriptorClass.prototype.GetRelationByMaster = function(masterTableFqn)
{
  try
  {
    var dtrdList = this.FormDescriptorDoc.selectNodes("/ilp:FormDescriptor/ilp:DataTableRelationDescriptor[@TableDescriptorFqnMaster='" + masterTableFqn + "']");
    
    return dtrdList;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetRelationByMaster", "");
  }
}

FormDescriptorClass.prototype.GetRelationByDetail = function(detailTableFqn)
{
  try
  {
    var dtrdList = this.FormDescriptorDoc.selectNodes("/ilp:FormDescriptor/ilp:DataTableRelationDescriptor[@TableDescriptorFqnDetail='" + detailTableFqn + "']");
    
    return dtrdList;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetRelationByDetail", "");
  }
}

FormDescriptorClass.prototype.GetDataTableRelationDescriptor = function(dtrdFqn)
{
  try
  {
    var dtrd = this.FormDescriptorDoc.selectSingleNode("/ilp:FormDescriptor/ilp:DataTableRelationDescriptor[@ID='" + dtrdFqn + "']");
    
    return dtrd;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetDataTableRelationDescriptor", "");
  }
}

FormDescriptorClass.prototype.GetRelatedNames = function(tdFqn, includeSelf)
{
  try
  {
    var tdFqnTemp;
    var nodeNames = new WebArray();
    var queue = new WebQueue();
    var counter = 0;
    
    queue.Enqueue(tdFqn);
    while(queue.Count() > 0)
    {   
      tdFqnTemp  = queue.Dequeue();
      if (includeSelf == true || counter > 0)
      {
        nodeNames.Add(tdFqnTemp)
      }
      counter++;
      
      var dtrdList = this.GetRelationByMaster(tdFqnTemp);
      for (var i = 0, len = dtrdList.length;  i < len; i++) 
      {
        var dtrd = dtrdList[i];
        tdFqnTemp = dtrd.getAttribute("TableDescriptorFqnDetail");
        // Rekursionen werden hier beachtet
        if (nodeNames.Contains(tdFqnTemp) == false)
        {
          queue.Enqueue(tdFqnTemp);
        }
      }
    }
    
    return nodeNames;    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptorClass.prototype.GetRelatedNames", "");
  }
}

FormDescriptorClass.prototype.GetSelectionDescriptor = function(seldFqn)
{
  try
  {
    return this.FormDescriptorDoc.selectSingleNode("/ilp:FormDescriptor/ilp:SelectionDescriptor[@ID='" + seldFqn + "']");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetSelectionDescriptor", "");
  }
}

FormDescriptorClass.prototype.GetAttachedSelectionDescriptor = function(fqn)
{
  try
  {
    var fd = this.GetFieldDescriptor(fqn);
    return this.GetSelectionDescriptor(fd.getAttribute("SelectionDescriptorFqn"));
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetAttachedSelectionDescriptor", "");
  }
}


FormDescriptorClass.prototype.GetSelectionDescriptorList = function()
{
  try
  {
    return this.FormDescriptorDoc.selectNodes("/ilp:FormDescriptor/ilp:SelectionDescriptor");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetSelectionDescriptorList", "");
  }
}


FormDescriptorClass.prototype.GetOptionReturnList = function(seld)
{
  try
  {
    return seld.getAttribute("OptionReturnList").split(" ");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetOptionReturnList", "");
  }
}


FormDescriptorClass.prototype.GetOptionReturnTargetList = function(seld)
{
  try
  {
    return seld.getAttribute("OptionReturnTargetList").split(" ");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetOptionReturnTargetList", "");
  }
}


FormDescriptorClass.prototype.GetConstrainedSelectionDescriptorList = function(constrainerFqn)
{
  try
  {
    var oContrainedList = this.FormDescriptorDoc.selectNodes("/ilp:FormDescriptor/ilp:SelectionDescriptor[@ConstrainerFqn='" + constrainerFqn + "']");
    if (oContrainedList.length == 0)
    {
      oContrainedList = this.FormDescriptorDoc.selectNodes("/ilp:FormDescriptor/ilp:SelectionDescriptor[@ConstrainerSourceFqn='" + constrainerFqn + "']");
    }
    return oContrainedList;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetConstrainedSelectionDescriptorList", "");
  }
}


FormDescriptorClass.prototype.GetMandatoryTables = function()
{
  try
  {
    var xPath = "/ilp:FormDescriptor/ilp:TableDescriptor[@ShowRecordsAtStartup='true']"
    var MandatoryTableList = this.FormDescriptorDoc.selectNodes(xPath);
    
    return MandatoryTableList;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetMandatoryTables", "");
  }
}

FormDescriptorClass.prototype.GetUnitField = function(fd)
{
  try
  {
    var unitFd = null;
    var unitFqn = fd.getAttribute("UnitFieldName");
    if (unitFqn != null)
    {
      unitFd = this.GetFieldDescriptor(unitFqn);
    }
    
    return unitFd;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetUnitField", "");
  }
}

FormDescriptorClass.prototype.ConvertDefaultValueToWebData = function( fd, defaultValue )
{
  try
  {
    var webValue = null;
    defaultValue = (defaultValue == null) ? fd.getAttribute("DefaultValue") : defaultValue;
    var fieldType = fd.getAttribute("FieldType");
    
    switch (fieldType)
    {   
      case "boolean" :
        if ( defaultValue == "1" )
        {
          webValue = "true";
        }
        else
        {
          webValue = "false";
        }          
        break;
        
      case "integer" :
      case "string" :
      case "nString" :
        webValue = WebMessage.ReplaceToken(defaultValue);
        break;
                
      default :
        webValue = defaultValue;
        break;
    }
    return webValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_ConvertDefaultValueToWebData", "");
  }
}

function ShowFormDescriptor(oControl)
{
  try
  {
    if (oControl!=null){
      oControl.disabled = true;
    }  

    WebMessage.ShowXmlDoc(oControl, "FormDescriptor");

    if (oControl!=null){
      oControl.disabled = false;
    }  
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "ShowFormDescriptor", "Section1")
  }
}


FormDescriptorClass.prototype.GetLookUpRelationByDetail = function(lookUpTableFqn)
{
  try
  {
    var lurdList = this.FormDescriptorDoc.selectNodes("/ilp:FormDescriptor/ilp:LookUpRelationDescriptor[@TableDescriptorFqnLookUp='" + lookUpTableFqn + "']");
    return lurdList;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetLookUpRelationByDetail", "");
  }
}


FormDescriptorClass.prototype.IsStringArrayEmpty = function(array)
{
  try
  {
    var ret = false;
    if ((array.length == 0) || (array.length == 1 && array[0].length == 0))
    {
      ret = true;
    }
    return ret;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_IsStringArrayEmpty", "");
  }
}

FormDescriptorClass.prototype.GetExcelExportDescriptor = function(excelExportDescriptorFqn)
{
  try
  {
    var fqn = excelExportDescriptorFqn.split(".");
  
    return this.FormDescriptorDoc.selectSingleNode("/ilp:FormDescriptor/ilp:ExcelExportDescriptor[@ID='" + fqn[0] + "']");
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "FormDescriptor_GetExcelExportDescriptor", "");
  }
}

FormDescriptorClass.prototype.GetExcelExportDescriptorList = function()
{
  try
  {
    return this.FormDescriptorDoc.selectNodes("/ilp:FormDescriptor/ilp:ExcelExportDescriptor");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetExcelExportDescriptorList", "");
  }
}

FormDescriptorClass.prototype.GetFieldName = function(fdFqn)
{
  try
  {
    var fieldName = "";
    var fqn = fdFqn.split(".");
    if (fqn.length == 2)
    {
      fieldName = fqn[1];
    }
    else
    {
      fieldName = fqn[0];
    }
    return fieldName;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetFieldName", "");
  }
}



/* ============================ GTWebControl.js ===========================*/
var WebControlDialogFeatures = "";
WebControlDialogFeatures += "dialogWidth:550px;";
WebControlDialogFeatures += "dialogHeight:400px;";
WebControlDialogFeatures += "scroll:Yes;";
WebControlDialogFeatures += "status:No;";
WebControlDialogFeatures += "resizable:Yes;";

var Graphic3DInstance = new Graphic3D();

function LoadWebControl()
{
  try
  { 
    EnsureWebForm();
    
    window.WebControl = new Object();

    window.WebControl.OnAfterWriteWebData = null;

    window.WebControl.WebMessageDescriptorList = new WebArray();

    window.WebControl.RecordInfo = null;
    window.WebControl.GetRecordInfo = WebControl_GetRecordInfo;
    window.WebControl.ShowRecordInfo = WebControl_ShowRecordInfo;
    window.WebControl.ShowRecordInDialog = WebControl_ShowRecordInDialog;
    window.WebControl.ShowInfoInDialog = WebControl_ShowInfoInDialog;
    window.WebControl.HideRecordInfo = WebControl_HideRecordInfo;
    window.WebControl.EditInLongTextDialog = WebControl_EditInLongTextDialog;    
    window.WebControl.ShowInputDialog = WebControl_ShowInputDialog;
    window.WebControl.ShowColumnOrderDialog = WebControl_ShowColumnOrderDialog;
    window.WebControl.ShowExportColumnSelectionDialog = WebControl_ShowExportColumnSelectionDialog;

    window.WebControl.PostParameter = new Array();

    window.WebControl.Login = WebControl_Login;
    window.WebControl.ReplaceTableName = WebControl_ReplaceTableName;
    
    window.WebControl.ShowNodeSelection = WebControl_ShowNodeSelection;
    window.WebControl.ShowTocSelection = WebControl_ShowTocSelection;

    window.WebControl.GetStandardPP = WebControl_GetStandardPP;
    window.WebControl.GetStandardUrl = WebControl_GetStandardUrl;
    window.WebControl.GetDialogFeatures = WebControl_GetDialogFeatures;
    window.WebControl.GetWindowFeatures = WebControl_GetWindowFeatures;
    
    window.WebControl.GetClientResource = WebControl_GetClientResource;
    window.WebControl.GetSelectedRecords = WebControl_GetSelectedRecords;

    window.WebControl.CopyScripts = WebControl_CopyScripts;
    window.WebControl.CopyStyleSheets = WebControl_CopyStyleSheets;

    window.WebControl.LoadApp = WebControl_LoadApp;

    window.WebControl.LaunchHelp = WebControl_LaunchHelp;
    window.WebControl.SelectLanguage = WebControl_SelectLanguage;

    window.WebControl.CheckRowState = WebControl_CheckRowState;
    window.WebControl.CreateErrorRow = WebControl_CreateErrorRow;
    window.WebControl.ClearErrorRow = WebControl_ClearErrorRow;
    window.WebControl.GetErrorRow = WebControl_GetErrorRow;

    window.WebControl.SelectRecordInDialog = WebControl_SelectRecordInDialog;
    window.WebControl.EditRecordInDialog = WebControl_EditRecordInDialog;
    
    window.WebControl.CurrentMessageLink = null;
    window.WebControl.BeforeValidateInputOnWriteToWebData = null;

    window.WebControl.AskForSaveAndContinue = WebControl_AskForSaveAndContinue;
    window.WebControl.AskForDontSaveAndContinue = WebControl_AskForDontSaveAndContinue;
    window.WebControl.AskForLongTask = WebControl_AskForLongTask;
    window.WebControl.CheckSelection = WebControl_CheckSelection;

    window.WebControl.CheckForNull = WebControl_CheckForNull;
    window.WebControl.NullIf = WebControl_NullIf;
    
    window.WebControl.SetCurrentWindow = WebControl_SetCurrentWindow;
    window.WebControl.GetCurrentWindow = WebControl_GetCurrentWindow;
    window.WebControl.GetCurrentDocument = WebControl_GetCurrentDocument;
    window.WebControl.GetHeaderHeight = WebControl_GetHeaderHeight;
    window.WebControl.GetFooterHeight = WebControl_GetFooterHeight;

    window.WebControl.CalculateTableWidth = WebControl_CalculateTableWidth;    
    window.WebControl.GetExtension = WebControl_GetExtension;
    
    window.WebControl.SetLinkStyle = WebControl_SetLinkStyle;
    window.WebControl.RestoreLinkStyle = WebControl_RestoreLinkStyle;

    window.WebControl.ShowValidatedControl = WebControl_ShowValidatedControl;
    window.WebControl.JumpToControl = WebControl_JumpToControl;
    window.WebControl.JumpToValidatedControl = WebControl_JumpToValidatedControl;
    
    window.WebControl.PositionControl = WebControl_PositionControl;
    window.WebControl.PositionControl2 = WebControl_PositionControl2;
    window.WebControl.ScrollToControl = WebControl_ScrollToControl;

    window.WebControl.CreateTBodyID = WebControl_CreateTBodyID;
    window.WebControl.GetTBody = WebControl_GetTBody;

    window.WebControl.GetEnumDisplayName = WebControl_GetEnumDisplayName;
    window.WebControl.GetPageParamValue = WebControl_GetPageParamValue;
    window.WebControl.MergeImageSource = WebControl_MergeImageSource;

    window.WebControl.IsDeletable = WebControl_IsDeletable;
    window.WebControl.IsEditable = WebControl_IsEditable;
    window.WebControl.IsCopyable = WebControl_IsCopyable;
    window.WebControl.IsNewable = WebControl_IsNewable;
    window.WebControl.FillConstrainedCombo = WebControl_FillConstrainedCombo;
    window.WebControl.FireEvent = WebControl_FireEvent;
    window.WebControl.ToggleText = WebControl_ToggleText;
    window.WebControl.ToggleRows = WebControl_ToggleRows;
    window.WebControl.ToggleImage = WebControl_ToggleImage;
    window.WebControl.IsExpanded = WebControl_IsExpanded;
    window.WebControl.SetToggleState = WebControl_SetToggleState;
    window.WebControl.FindParentRow = WebControl_FindParentRow;
    window.WebControl.FindParentByTagName = WebControl_FindParentByTagName;
    window.WebControl.FindParentById = WebControl_FindParentById;
    window.WebControl.IsExpandable = WebControl_IsExpandable;
    window.WebControl.SetTrueImage = WebControl_SetTrueImage;
    window.WebControl.SetFalseImage = WebControl_SetFalseImage;
    window.WebControl.GetParentWindow = WebControl_GetParentWindow;
    window.WebControl.GetOuterDimension = WebControl_GetOuterDimension;
    window.WebControl.GetCss = WebControl_GetCss;
    window.WebControl.PrepareXPathSelector = WebControl_PrepareXPathSelector;
    window.WebControl.SwitchDataSession = WebControl_SwitchDataSession;
    window.WebControl.FindText = WebControl_FindText;
    window.WebControl.GetWindowHeight = WebControl_GetWindowHeight;
    window.WebControl.GetWindowWidth = WebControl_GetWindowWidth;
    window.WebControl.GetContainer = WebControl_GetContainer;
    window.WebControl.GetChildContainer = WebControl_GetChildContainer;
    window.WebControl.ReplaceFakeCombo = WebControl_ReplaceFakeCombo;
    window.WebControl.AddPrompt = WebControl_AddPrompt;
    window.WebControl.GetComboSourceRecord = WebControl_GetComboSourceRecord;
    window.WebControl.GetComboSourceValue = WebControl_GetComboSourceValue;
    window.WebControl.GetComboSourceValueB = WebControl_GetComboSourceValueB;
    window.WebControl.ReplaceFakeListBox = WebControl_ReplaceFakeListBox;
    window.WebControl.SetComboValue = WebControl_SetComboValue;
    window.WebControl.SetListBoxValue = WebControl_SetListBoxValue;
    window.WebControl.GetWebDataGridMain = WebControl_GetWebDataGridMain;
    window.WebControl.GetWebSpreadSheetMain = WebControl_GetWebSpreadSheetMain;
    window.WebControl.GetWebTreeViewMain = WebControl_GetWebTreeViewMain;
    window.WebControl.DeleteOption = WebControl_DeleteOption;
    window.WebControl.ConvertToJavaScriptType = WebControl_ConvertToJavaScriptType;
    window.WebControl.ConvertWebDataToControlData = WebControl_ConvertWebDataToControlData;
    window.WebControl.ConvertControlDataToWebData = WebControl_ConvertControlDataToWebData;
    window.WebControl.GetValue = WebControl_GetValue;
    window.WebControl.GetValueFromType = WebControl_GetValueFromType;
    window.WebControl.SetValue = WebControl_SetValue;
    window.WebControl.ValidateControl = WebControl_ValidateControl;
    window.WebControl.ValidateForm = WebControl_ValidateForm;
    window.WebControl.ValidateTBody = WebControl_ValidateTBody;
    window.WebControl.ValidateElements = WebControl_ValidateElements;
    window.WebControl.ValidateInput = WebControl_ValidateInput;
    window.WebControl.ConvertToInt = WebControl_ConvertToInt;
    window.WebControl.ConvertBitToString = WebControl_ConvertBitToString;
    window.WebControl.ConvertXmlDateToShortDate = WebControl_ConvertXmlDateToShortDate;
    window.WebControl.ConvertXmlDateToShortDateAndTime = WebControl_ConvertXmlDateToShortDateAndTime;
    window.WebControl.ConvertXmlDateToLongDate = WebControl_ConvertXmlDateToLongDate;
    window.WebControl.ConvertXmlDateToDate = WebControl_ConvertXmlDateToDate;
    window.WebControl.CheckMinMax = WebControl_CheckMinMax;
    window.WebControl.CheckDate = WebControl_CheckDate;
    window.WebControl.CheckTime = WebControl_CheckTime;
    window.WebControl.CheckDateAndTime = WebControl_CheckDateAndTime;
    window.WebControl.CheckDateAndTimeExact = WebControl_CheckDateAndTimeExact;
    window.WebControl.CheckInteger = WebControl_CheckInteger;
    window.WebControl.CheckNumeric = WebControl_CheckNumeric;
    window.WebControl.CheckDotNumber = WebControl_CheckDotNumber;
    window.WebControl.CheckPrice = WebControl_CheckPrice;
    window.WebControl.CheckID = WebControl_CheckID;
    window.WebControl.CheckString = WebControl_CheckString;
    window.WebControl.ConvertAppLocaleToNumberString = WebControl_ConvertAppLocaleToNumberString;
    window.WebControl.ConvertToXmlDate = WebControl_ConvertToXmlDate;
    window.WebControl.ConvertDateToXmlDate = WebControl_ConvertDateToXmlDate;   
    window.WebControl.ConvertTimeToXmlDate = WebControl_ConvertTimeToXmlDate;
    window.WebControl.ConvertDateToString = WebControl_ConvertDateToString;
    window.WebControl.ConvertDateStringToDate = WebControl_ConvertDateStringToDate;
    window.WebControl.ConvertUTCDateToShortDate = WebControl_ConvertUTCDateToShortDate;
    window.WebControl.ConvertXmlDateToTime = WebControl_ConvertXmlDateToTime;
    window.WebControl.ConvertNumberStringToAppLocale = WebControl_ConvertNumberStringToAppLocale;
    window.WebControl.ZeroFill = WebControl_ZeroFill;
    window.WebControl.FillWith = WebControl_FillWith;
    window.WebControl.RemoveAllChildren = WebControl_RemoveAllChildren;
    window.WebControl.RemoveTBodies = WebControl_RemoveTBodies;
    window.WebControl.AddTBody = WebControl_AddTBody;
    window.WebControl.MergeAttributes = WebControl_MergeAttributes;
    window.WebControl.MergeAttachedObjects = WebControl_MergeAttachedObjects;
    window.WebControl.MergeAttachedEvents = WebControl_MergeAttachedEvents;
    window.WebControl.MergeRecord = WebControl_MergeRecord;
    window.WebControl.MergeData = WebControl_MergeData;
    window.WebControl.Fill = WebControl_Fill;
    window.WebControl.FillByDataTableRelationDescriptor = WebControl_FillByDataTableRelationDescriptor;
    window.WebControl.OptionFill = WebControl_OptionFill;
    window.WebControl.OptionFilter = WebControl_OptionFilter;
    window.WebControl.Clear = WebControl_Clear;
    window.WebControl.BuildMarker = WebControl_BuildMarker;
    window.WebControl.GetMarker = WebControl_GetMarker;
    window.WebControl.GetFqn = WebControl_GetFqn;
    window.WebControl.GetTrackedFqn = WebControl_GetTrackedFqn;
    window.WebControl.GetBoundProperty = WebControl_GetBoundProperty;
    window.WebControl.GetTableDescriptorFqn = WebControl_GetTableDescriptorFqn;
    window.WebControl.GetSearchFqn = WebControl_GetSearchFqn;
    window.WebControl.GetBoundValue = WebControl_GetBoundValue;
    window.WebControl.GetBoundIDValue = WebControl_GetBoundIDValue;
    window.WebControl.GetBoundNameValue = WebControl_GetBoundNameValue;
    window.WebControl.GetBoundControl = WebControl_GetBoundControl;
    window.WebControl.SetIf = WebControl_SetIf;
    window.WebControl.BeforeCloseFrame = WebControl_BeforeCloseFrame;
    window.WebControl.CloseFrame = WebControl_CloseFrame;
    window.WebControl.CancelFrame = WebControl_CancelFrame;
    window.WebControl.AddBoundControl = WebControl_AddBoundControl;
    window.WebControl.RemoveBoundControl = WebControl_RemoveBoundControl;
    window.WebControl.RemoveBoundControls = WebControl_RemoveBoundControls;
    window.WebControl.CreateUniqueClientId = WebControl_CreateUniqueClientId;
    window.WebControl.RemoveControl = WebControl_RemoveControl;
    window.WebControl.UpdateCalendarInput = WebControl_UpdateCalendarInput;
    window.WebControl.GetLoginGuid = WebControl_GetLoginGuid;
    window.WebControl.Post = WebControl_Post;
    window.WebControl.InitPostParameter = WebControl_InitPostParameter;
    window.WebControl.AddPostParameter = WebControl_AddPostParameter;
    window.WebControl.SetPostParameter = WebControl_SetPostParameter;
    window.WebControl.GetPostParameter = WebControl_GetPostParameter;
    window.WebControl.Download = WebControl_Download;
    window.WebControl.EditUpload = WebControl_EditUpload;
    window.WebControl.Upload = WebControl_Upload;
    window.WebControl.UploadEdit = WebControl_UploadEdit;
    window.WebControl.ShowUpload = WebControl_ShowUpload;
    window.WebControl.DeleteUpload = WebControl_DeleteUpload;
    window.WebControl.ShowCriterias = WebControl_ShowCriterias;
    window.WebControl.ShowSelection = WebControl_ShowSelection;
    window.WebControl.ShowSearch = WebControl_ShowSearch;
    window.WebControl.GetControl = WebControl_GetControl;
    window.WebControl.GetClass = WebControl_GetClass;
    window.WebControl.CreateSender = WebControl_CreateSender;
    window.WebControl.GetAttachedLable = WebControl_GetAttachedLable;
    window.WebControl.ResetBindingList = WebControl_ResetBindingList;

    window.WebControl.ShowPosition = WebControl_ShowPosition;
    window.WebControl.SwapPosition = WebControl_SwapPosition;
    
    window.WebControl.ResizeToFullWindow = WebControl_ResizeToFullWindow;
    window.WebControl.ApplyDisplayOption = WebControl_ApplyDisplayOption;
    window.WebControl.ApplyDisplayOption2 = WebControl_ApplyDisplayOption2;

    window.WebControl.RequestAccount = WebControl_RequestAccount;
    
    window.WebControl.BuildReturnXml = WebControl_BuildReturnXml;
    window.WebControl.BuildReturnXmlFromRecord = WebControl_BuildReturnXmlFromRecord;

    window.WebControl.ShowSystemRequirement = WebControl_ShowSystemRequirement;
    window.WebControl.ShowAccountRequest = WebControl_ShowAccountRequest;
    window.WebControl.ShowPasswordRequest = WebControl_ShowPasswordRequest;
    window.WebControl.CheckAccountRequestEmail = WebControl_CheckAccountRequestEmail;
    window.WebControl.SubmitAccountRequest = WebControl_SubmitAccountRequest;
    window.WebControl.SubmitPasswordRequest = WebControl_SubmitPasswordRequest;
    
    window.WebControl.GetParentByTagName = WebControl_GetParentByTagName;
    window.WebControl.GetParentByAttribute = WebControl_GetParentByAttribute;
    window.WebControl.FindStarControls = WebControl_FindStarControls;
    window.WebControl.FindSun = WebControl_FindSun;
    window.WebControl.CheckGalaxy = WebControl_CheckGalaxy;

    window.WebControl.BodyOnUnload = WebControl_BodyOnUnload;

    window.WebControl.GetContextMenu = WebControl_GetContextMenu;
    window.WebControl.GetWebPopUp = WebControl_GetWebPopUp;
    window.WebControl.ShowWebPopUp = WebControl_ShowWebPopUp;

    window.WebControl.ShowContextHelpDialog = WebControl_ShowContextHelpDialog;

    window.WebControl.OpenFile = WebControl_OpenFile;
    
    window.WebControl.OpenDownload = WebControl_OpenDownload;
    window.WebControl.OpenExcelDownload = WebControl_OpenExcelDownload;
    window.WebControl.OpenTextDownload = WebControl_OpenTextDownload;
    window.WebControl.UrlDownload = WebControl_UrlDownload;
    window.WebControl.OpenWindow = WebControl_OpenWindow;
    window.WebControl.Open = WebControl_Open;
    window.WebControl.ShowModalDialog = WebControl_ShowModalDialog;

    window.WebControl.GetFormDefault = WebControl_GetFormDefault;
    window.WebControl.GetRandom = WebControl_GetRandom;

    window.WebControl.GetWindow = WebControl_GetWindow;
    window.WebControl.CloseWindow = WebControl_CloseWindow;
    window.WebControl.CloseAllWindow = WebControl_CloseAllWindow;

    window.WebControl.Pick = WebControl_Pick;
    window.WebControl.MoveItem = WebControl_MoveItem;
    window.WebControl.MoveOption = WebControl_MoveOption;
    window.WebControl.MoveOptionBack = WebControl_MoveOptionBack;

    window.WebControl.MoveText = WebControl_MoveText;
    
    window.WebControl.Find = WebControl_Find;
    window.WebControl.ReplaceUmlaut = WebControl_ReplaceUmlaut;
    
    window.WebControl.DisableNavMenu = WebControl_DisableNavMenu;
    window.WebControl.AddDisabledControl = WebControl_AddDisabledControl;
    window.WebControl.DisableControl = WebControl_DisableControl;
    window.WebControl.EnableControls = WebControl_EnableControls;

    window.WebControl.InitGlobalList = WebControl_InitGlobalList;
    
    window.WebControl.KpiLogbook = new WebArray();
    window.WebControl.InitKpiLogging = WebControl_InitKpiLogging;
    window.WebControl.AddKpiLogMessage = WebControl_AddKpiLogMessage;
    window.WebControl.KpiLogbookTransfer = WebControl_KpiLogbookTransfer;
    
    window.WebControl.WriteToWebData = WebControl_WriteToWebData;
    
    window.WebControl.SetRuntimeParameter = WebControl_SetRuntimeParameter;
    
    window.WebControl.GetAbsoluteTop = WebControl_GetAbsoluteTop;
    window.WebControl.GetAbsoluteLeft = WebControl_GetAbsoluteLeft;

    window.WebControl.FirstDayOfMonth = WebControl_FirstDayOfMonth;
    window.WebControl.LastDayOfMonth = WebControl_LastDayOfMonth;
    
    window.WebControl.GetDomElementById = WebControl_GetDomElementById;
    window.WebControl.GetDomElementByName = WebControl_GetDomElementByName;
    window.WebControl.GetDomElementByTagName = WebControl_GetDomElementByTagName;
    window.WebControl.GetDomElementByAttributeValue = WebControl_GetDomElementByAttributeValue;
    window.WebControl.MarkTemplateElements = WebControl_MarkTemplateElements;
    window.WebControl.FindClientBoundControls = WebControl_FindClientBoundControls;
    window.WebControl.FindNamingIDControls = WebControl_FindNamingIDControls;
    window.WebControl.FindSearchControls = WebControl_FindSearchControls;
    window.WebControl.GetFirstInputElement = WebControl_GetFirstInputElement;
    
    window.WebControl.BackgroundColorNoChange = "white";
    window.WebControl.BackgroundColorWrongInput = "coral";
    window.WebControl.BackgroundColorOnFocus = "yellow";
    window.WebControl.BackgroundColorChanged = "#C0FFC0";

    window.WebControl.SetPageLinkStyle = WebControl_SetPageLinkStyle;
    window.WebControl.SetColorRed = WebControl_SetColorRed;
    window.WebControl.SetReadOnly = WebControl_SetReadOnly;
    window.WebControl.IsDisabled = WebControl_IsDisabled;
    window.WebControl.SetDisabled = WebControl_SetDisabled;
    window.WebControl.SetEnabled = WebControl_SetEnabled;
    window.WebControl.IsVisible = WebControl_IsVisible;
    window.WebControl.HideControl = WebControl_HideControl;
    window.WebControl.ShowControl = WebControl_ShowControl;

    window.WebControl.SetClassName = WebControl_SetClassName;
    window.WebControl.ResetClassName = WebControl_ResetClassName;
    
    window.WebControl.SetTabIndex = WebControl_SetTabIndex;
    window.WebControl.ResetTabIndex = WebControl_ResetTabIndex;
    window.WebControl.GetDefaultTabIndex = WebControl_GetDefaultTabIndex;
    window.WebControl.SetColor = WebControl_SetColor;
    window.WebControl.ResetColor = WebControl_ResetColor;
    window.WebControl.SetBackgroundColor = WebControl_SetBackgroundColor;
    window.WebControl.ResetBackgroundColor = WebControl_ResetBackgroundColor;
    
    window.WebControl.Submit = WebControl_Submit;

    window.WebControl.SetEventHandler = WebControl_SetEventHandler;
    
    window.WebControl.ValidationOK = false;
    window.WebControl.ValidationMessage = "";
    window.WebControl.ValidationMessageHTML = "";
    window.WebControl.ValidationFirstFaultyElement = null;
    window.WebControl.HideValidationSummary = WebControl_HideValidationSummary;
    window.WebControl.ShowValidationSummary = WebControl_ShowValidationSummary;
    window.WebControl.PositionValidationSummary = WebControl_PositionValidationSummary;
    window.WebControl.HasInputValidator = WebControl_HasInputValidator;
    window.WebControl.ShowInputValidator = WebControl_ShowInputValidator;
    window.WebControl.HideInputValidator = WebControl_HideInputValidator;
    window.WebControl.GetQueryParameter = WebControl_GetQueryParameter;
    window.WebControl.GetFileName = WebControl_GetFileName;
    window.WebControl.SelectComboItem = WebControl_SelectComboItem;
    window.WebControl.DeleteComboItem = WebControl_DeleteComboItem;
    window.WebControl.ResetConstrainedSelection = WebControl_ResetConstrainedSelection;
    window.WebControl.GetWebMessageDescriptor = WebControl_GetWebMessageDescriptor;
   
    
    window.WebControl.WindowListHash = new Object();
    window.WebControl.WindowListArray = new Array();
    
    window.WebControl.PagingScrollLeft = WebControl_PagingScrollLeft;

    window.WebControl.FieldToHtmlObject = new WebHashtable();
    window.WebControl.NumberOfBinds = 0;
    
    window.WebControl.TimeDiffInSeconds = WebControl_TimeDiffInSeconds;
    
    window.WebControl.CollectValidators = WebControl_CollectValidators;
    window.WebControl.EvaluteValidators = WebControl_EvaluteValidators;
    
    window.WebControl.CheckChangeTracking = WebControl_CheckChangeTracking;
    window.WebControl.GetChangeTrackingButton = WebControl_GetChangeTrackingButton;
    window.WebControl.ShowChangeHistory = WebControl_ShowChangeHistory;
    
    window.WebControl.CopyToClipboard = WebControl_CopyToClipboard;
       
    window.WebControl.DataLinkActive = null;   
    window.WebControl.ExportPage = null;
    window.WebControl.SetCurrentWindow(window);

    window.WebControl.Records = new RecordWrappers();
    window.WebControl.Controls = new ControlTemplateWrappers();
    window.WebControl.ComboTemplates = new ComboTemplateWrappers();
    window.WebControl.FieldDescriptors = new FieldDescriptorWrappers();

    window.WebControl.TheBody = window.WebControl.GetCurrentDocument().body;    
    window.WebControl.ReturnedRecordList = new WebArray();
    
    return window.WebControl;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "LoadWebControl", "")
  }
}

function WebControl_SetRuntimeParameter(oControl)
{
  try
  {
    oControl.EnableDebugging = oControl.getAttribute("EnableDebugging") == "true" ? true : false;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_SetRuntimeParameter", "Section1")
  }
}

function EnsureWebControl()
{
  try
  { 
    if (typeof(window.WebControl) == "undefined") 
    {
      LoadWebControl();
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "EnsureWebControl", "")
  }
}

function WebControl_TimeDiffInSeconds(firstDate, secondDate)
{
  return (secondDate.getTime() - firstDate.getTime()) / 1000;
}

function WebControl_MergeAttributes(oSource, oTarget)
{
  try
  {
    if (oSource.getAttribute("DisabledIf") != null) oTarget.setAttribute("DisabledIf", oSource.getAttribute("DisabledIf"));
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_MergeAttributes", "");
  }
}

function WebControl_MergeAttachedObjects(oSource, oTarget, preserveIdentity)
{
  try
  {
    preserveIdentity = preserveIdentity == null ? true : preserveIdentity;
    
    if (oSource.oTBody != null) oTarget.oTBody = oSource.oTBody;
    if (oSource.oRecord != null) oTarget.oRecord = oSource.oRecord;
    if (oSource.oWebDataGrid != null) oTarget.oWebDataGrid = oSource.oWebDataGrid;
    if (oSource.oWebColumnGrid != null) oTarget.oWebColumnGrid = oSource.oWebColumnGrid;
    if (oSource.oWebDataSheet != null) oTarget.oWebDataSheet = oSource.oWebDataSheet;
    if (oSource.oContainer != null) oTarget.oContainer = oSource.oContainer;
    if (oSource.oContainerInstance != null) oTarget.oContainerInstance = oSource.oContainerInstance;
    if (oSource.oMasterRecord != null) oTarget.oMasterRecord = oSource.oMasterRecord;
    if (oSource.ObjectID != null) oTarget.ObjectID = oSource.ObjectID;
    if (oSource.oFieldDescriptor != null) oTarget.oFieldDescriptor = oSource.oFieldDescriptor;
    if (oSource.oTable != null) oTarget.oTable = oSource.oTable;
    if (oSource.oTable != null) oTarget.oTable.Loaded = oSource.oTable.Loaded;
    if (oSource.oNodeContainer != null) oTarget.oNodeContainer = oSource.oNodeContainer;
    if (oSource.oWebTreeView != null) oTarget.oWebTreeView = oSource.oWebTreeView;
    if (oSource.NamingID != null) oTarget.NamingID = oSource.NamingID;
    if (oSource.BindingIndex != null) oTarget.BindingIndex = oSource.BindingIndex;
    if (oSource.oNode != null) oTarget.oNode = oSource.oNode;

    if (preserveIdentity == true)
    {
      oTarget.id = oSource.id;
      oTarget.name = oSource.name;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_MergeAttachedObjects", "");
  }
}

function WebControl_MergeAttachedEvents(oSource, oTarget)
{
  try
  {
    oTarget.onfocus = oSource.onfocus;
    oTarget.onclick = oSource.onclick;
    oTarget.ondblclick = oSource.ondblclick;
    oTarget.onkeydown = oSource.onkeydown;
    oTarget.onkeyup = oSource.onkeyup;

    oTarget.onblur = oSource.onblur;
    oTarget.onchange = oSource.onchange;
    oTarget.onkeypress = oSource.onkeypress;
    oTarget.onmouseover = oSource.onmouseover;
    
    if (oSource.getAttribute("ControlType") == "ListBox")
    {
      oTarget.setAttribute("OnDblClickHandler", oSource.getAttribute("OnDblClickHandler"));
      oTarget.setAttribute("OnKeyCode13Handler", oSource.getAttribute("OnKeyCode13Handler"));
      oTarget.setAttribute("OnKeyCode27Handler", oSource.getAttribute("OnKeyCode27Handler"));
    }
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebControl_MergeAttachedEvents", "");
  }
}

function WebControl_MergeData(oContainer, oTarget, oRecord, doBinding, controlTemplateWrapper, recordWrapper)
{
  try
  { 
    controlTemplateWrapper = controlTemplateWrapper == null ? WebControl.Controls.GetInstance(oTarget) : controlTemplateWrapper;
    recordWrapper = recordWrapper == null ? WebControl.Records.GetInstance(oTarget.oRecord) : recordWrapper;
  
    var fdWrapper = null;
    var allowEdit = "";
    var oFieldDescriptor = null;
    var fqn = "";
    var oDataField = null;
    var bindingDone = false;
    var args = new EventArgs();

    doBinding = doBinding == null ? true : doBinding;
    // Determine oTarget Type and take action
    switch(controlTemplateWrapper.ControlType)
    {
      case "DataLink":
      case "Panel":
      case "Label":
        var removed = false;
        var removeIf = oTarget.getAttribute("RemoveIf");
        if (typeof(removeIf) == "string")
        {
          if (removeIf.length > 0)
          {
            eval(removeIf);
            if (WebData.ReturnIf == true)
            {
              this.RemoveControl(oTarget);
              WebData.ReturnIf = false;
              removed = true;
            }
          }
        }
        
        if (removed == false)
        {    
          fqn = controlTemplateWrapper.InnerTextFqn;
          if (fqn.length > 0)
          {
            fdWrapper = WebControl.FieldDescriptors.GetInstance(FormDescriptor.GetFieldDescriptor(fqn));
            oFieldDescriptor = fdWrapper.oFieldDescriptor;
            oTarget.oFieldDescriptor = oFieldDescriptor;
            oDataField = WebData.GetField(oRecord, fqn);
            if (doBinding == true)
            {
              this.AddBoundControl(fqn, oRecord, oTarget, "Gui", BoundProperty_InnerText);
              bindingDone = true;
            }
            Ilp.HtmlDom.SetText(oTarget, this.ConvertWebDataToControlData(oTarget, oFieldDescriptor, oDataField, controlTemplateWrapper, fdWrapper));
          }
          else
          {
            fqn = controlTemplateWrapper.InnerHTMLFqn;
            if (fqn.length > 0)
            {
              fdWrapper = WebControl.FieldDescriptors.GetInstance(FormDescriptor.GetFieldDescriptor(fqn));
              oFieldDescriptor = fdWrapper.oFieldDescriptor;
              oTarget.oFieldDescriptor = oFieldDescriptor;
              oDataField = WebData.GetField(oRecord, fqn);
              if (doBinding == true)
              {
                this.AddBoundControl(fqn, oRecord, oTarget, "Gui", BoundProperty_InnerHtml);
                bindingDone = true;
              }
              oTarget.innerHTML = this.ConvertWebDataToControlData(oTarget, oFieldDescriptor, oDataField, controlTemplateWrapper, fdWrapper);
            }
            else
            {
              fqn = controlTemplateWrapper.ListFqn;
              if (fqn.length > 0)
              {
                oFieldDescriptor = FormDescriptor.GetFieldDescriptor(fqn);
                if (oFieldDescriptor != null)
                {
                  oTarget.oFieldDescriptor = oFieldDescriptor;
                  if (oRecord != null)
                  {
                    oDataField = WebData.GetField(oRecord, fqn);
                    if (bindingDone == false && doBinding == true)
                    {
                      this.AddBoundControl(fqn, oRecord, oTarget);
                      bindingDone = true;
                    }
                  }
                }
              }
              
              var value = null;
              if (oDataField != null)
              {
                value = oDataField.text;
              }  
              if (typeof(oTarget.getAttribute("XMLSourceID")) == "string")
              {
                var oXml = null
                if (XmlVersion == enum_XmlVersion_V1) oXml = this.GetCurrentDocument().getElementById(oTarget.getAttribute("XMLSourceID"));
                else oXml = Ilp.XmlCache.XmlCacheList.Get(oTarget.getAttribute("XMLSourceID"));
                
                var oRecordSource = null;
                if (XmlVersion == enum_XmlVersion_V1) oRecordSource = WebData.GetRecordByFieldValue("NewDataSet/DropDownListSource.OptionValue", value, oXml);
                else oRecordSource = WebData.GetRecordByFieldValue("/NewDataSet/DropDownListSource.OptionValue", value, oXml);
              
                var textValue = WebData.GetFieldValue(oRecordSource, "DropDownListSource.OptionText");
                
                Ilp.HtmlDom.SetText(oTarget, textValue);
              }
            }
          }

          fqn = controlTemplateWrapper.PlaceHolderFqn;
          if (fqn.length > 0)
          {
            fdWrapper = WebControl.FieldDescriptors.GetInstance(FormDescriptor.GetFieldDescriptor(fqn));
            oFieldDescriptor = fdWrapper.oFieldDescriptor;
            oTarget.oFieldDescriptor = oFieldDescriptor;
            if (doBinding == true)
            {
              this.AddBoundControl(fqn, oRecord, oTarget, "NonGui");
            }
          }  
          fqn = controlTemplateWrapper.ClassNameFqn;
          if (fqn.length > 0)
          {
            oTarget.className = WebData.GetFieldValue(oTarget.oRecord, fqn);
          }
          fqn = controlTemplateWrapper.BackgroundColorFqn;
          if (fqn.length > 0)
          {
            Ilp.HtmlDom.SetStyle(oTarget, "backgroundColor", WebData.GetFieldValue(oTarget.oRecord, fqn));
          }        
          fqn = controlTemplateWrapper.ColorFqn;
          if (fqn.length > 0)
          {
            Ilp.HtmlDom.SetStyle(oTarget, "color", WebData.GetFieldValue(oTarget.oRecord, fqn));
          }        
          fqn = controlTemplateWrapper.TitleFqn;
          if (fqn.length > 0)
          {
            fdWrapper = WebControl.FieldDescriptors.GetInstance(FormDescriptor.GetFieldDescriptor(fqn));
            oFieldDescriptor = fdWrapper.oFieldDescriptor;
            oDataField = WebData.GetField(oRecord, fqn);
            if (doBinding == true)
            {
              this.AddBoundControl(fqn, oRecord, oTarget, "Gui", BoundProperty_Title);
              bindingDone = true;
            }
            oTarget.title = this.ConvertWebDataToControlData(oTarget, oFieldDescriptor, oDataField, controlTemplateWrapper, fdWrapper);
          }        
          fqn = controlTemplateWrapper.ActionFqn;
          if (fqn.length > 0)
          {
            if (doBinding == true)
            {
              this.AddBoundControl(fqn, oRecord, oTarget, "Gui", BoundProperty_None);
              bindingDone = true;
            }
          }
          this.SetIf(oTarget, controlTemplateWrapper, recordWrapper);
        }
        break;

      case "TextBox":      
        removed = false;
        removeIf = oTarget.getAttribute("RemoveIf");
        if (typeof(removeIf) == "string")
        {
          if (removeIf.length > 0)
          {
            eval(removeIf);
            if (WebData.ReturnIf == true)
            {
              this.RemoveControl(oTarget);
              WebData.ReturnIf = false;
              removed = true;
            }
          }
        }
        
        if (removed == false)
        {
          
          var fqn = controlTemplateWrapper.InnerTextFqn;
          if (fqn.length > 0)
          {
            fdWrapper = WebControl.FieldDescriptors.GetInstance(FormDescriptor.GetFieldDescriptor(fqn));
            oFieldDescriptor = fdWrapper.oFieldDescriptor;
            oTarget.oFieldDescriptor = oFieldDescriptor;
            oDataField = WebData.GetField(oRecord, fqn);
            if (doBinding == true)
            {
              this.AddBoundControl(fqn, oRecord, oTarget, "Gui", BoundProperty_InnerText);
              bindingDone = true;
            }
            Ilp.HtmlDom.SetText(oTarget, this.ConvertWebDataToControlData(oTarget, oFieldDescriptor, oDataField, controlTemplateWrapper, fdWrapper));
          }
          if (oTarget.getAttribute("AllwaysDisabled") == "true") this.SetDisabled(oTarget);
          this.SetIf(oTarget, controlTemplateWrapper, recordWrapper);
        }
        break;

      case "Button":
        var fqn = oTarget.getAttribute("InnerTextFqn");
        if (typeof(fqn) == "string")
        {
          oFieldDescriptor = FormDescriptor.GetFieldDescriptor(fqn);
          oTarget.oFieldDescriptor = oFieldDescriptor;
          oDataField = WebData.GetField(oRecord, fqn);
          if (doBinding == true)
          {
            this.AddBoundControl(fqn, oRecord, oTarget);
            bindingDone = true;
          }
          oTarget.value = this.ConvertWebDataToControlData(oTarget, oFieldDescriptor, oDataField);
        }
        
        var fqn = controlTemplateWrapper.PlaceHolderFqn;
        if (fqn.length > 0)
        {
          fdWrapper = WebControl.FieldDescriptors.GetInstance(FormDescriptor.GetFieldDescriptor(fqn));
          oFieldDescriptor = fdWrapper.oFieldDescriptor;
          oTarget.oFieldDescriptor = oFieldDescriptor;
          if (doBinding == true)
          {
            this.AddBoundControl(fqn, oRecord, oTarget, "NonGui");
          }
        }  
        
        var fqn = oTarget.getAttribute("ActionFqn");
        if (typeof(fqn) == "string")
        {
          fdWrapper = WebControl.FieldDescriptors.GetInstance(FormDescriptor.GetFieldDescriptor(fqn));
          oFieldDescriptor = fdWrapper.oFieldDescriptor;
          oTarget.oFieldDescriptor = oFieldDescriptor;
          if (doBinding == true)
          {
            this.AddBoundControl(fqn, oRecord, oTarget, "NonGui");
          }
        }  
        
        var fqn = oTarget.getAttribute("TitleFqn");
        if (typeof(fqn) == "string")
        {
          oFieldDescriptor = FormDescriptor.GetFieldDescriptor(fqn);
          oDataField = WebData.GetField(oRecord, fqn);
          oTarget.title = this.ConvertWebDataToControlData(oTarget, oFieldDescriptor, oDataField);
        }          
        this.SetIf(oTarget, controlTemplateWrapper, recordWrapper);
        break;
        
      case "RadioButton":
        var fqn = oTarget.getAttribute("CheckedFqn");
        if (typeof(fqn) == "string")
        {
          oFieldDescriptor = FormDescriptor.GetFieldDescriptor(fqn);
          oTarget.oFieldDescriptor = oFieldDescriptor;
          oDataField = WebData.GetField(oRecord, fqn);
          if (doBinding == true)
          {
            this.AddBoundControl(fqn, oRecord, oTarget);
            bindingDone = true;
          }
          var value = this.ConvertWebDataToControlData(oTarget, oFieldDescriptor, oDataField);
          if (oTarget.value == value)
          {
            oTarget.checked = true;
          }
          else
          {
            oTarget.checked = false;
          }  
        }
        this.SetIf(oTarget, controlTemplateWrapper, recordWrapper);
        break;
        
      case "CheckBox":
        var fqn = controlTemplateWrapper.CheckedFqn;
        if (fqn.length > 0)
        {
          fdWrapper = WebControl.FieldDescriptors.GetInstance(FormDescriptor.GetFieldDescriptor(fqn));
          oFieldDescriptor = fdWrapper.oFieldDescriptor;
          oTarget.oFieldDescriptor = oFieldDescriptor;
          oDataField = WebData.GetField(oRecord, fqn);
          if (doBinding == true)
          {
            this.AddBoundControl(fqn, oRecord, oTarget, "Gui", BoundProperty_Checked);
            bindingDone = true;
          }
          oTarget.checked = this.ConvertWebDataToControlData(oTarget, oFieldDescriptor, oDataField, controlTemplateWrapper, fdWrapper);
        }
        this.SetIf(oTarget, controlTemplateWrapper, recordWrapper);
        break;
      
      case "HyperLink":
        var fqn = oTarget.getAttribute("InnerTextFqn");
        if (typeof(fqn) == "string")
        {
          oFieldDescriptor = FormDescriptor.GetFieldDescriptor(fqn);
          oTarget.oFieldDescriptor = oFieldDescriptor;
          oDataField = WebData.GetField(oRecord, fqn);
          if (doBinding == true)
          {
            this.AddBoundControl(fqn, oRecord, oTarget);
            bindingDone = true;
          }
          Ilp.HtmlDom.SetText(oTarget, this.ConvertWebDataToControlData(oTarget, oFieldDescriptor, oDataField));
        }
        else
        {
          var fqn = oTarget.getAttribute("InnerHTMLFqn");
          if (typeof(fqn) == "string")
          {
            oFieldDescriptor = FormDescriptor.GetFieldDescriptor(fqn);
            oTarget.oFieldDescriptor = oFieldDescriptor;
            oDataField = WebData.GetField(oRecord, fqn);
            if (doBinding == true)
            {
              this.AddBoundControl(fqn, oRecord, oTarget);
              bindingDone = true;
            }
            oTarget.innerHTML = this.ConvertWebDataToControlData(oTarget, oFieldDescriptor, oDataField);
          }
        }
        var fqn = oTarget.getAttribute("HrefFqn");
        if (typeof(fqn) == "string")
        {
          oFieldDescriptor = FormDescriptor.GetFieldDescriptor(fqn);
          oTarget.oFieldDescriptor = oFieldDescriptor;
          oDataField = WebData.GetField(oRecord, fqn);
          if (doBinding == true)
          {
            this.AddBoundControl(fqn, oRecord, oTarget);
            bindingDone = true;
          }
          oTarget.href = this.ConvertWebDataToControlData(oTarget, oFieldDescriptor, oDataField);
        }
        this.SetIf(oTarget, controlTemplateWrapper, recordWrapper);
        break;

      case "IFrame":
        var oNewFrame = this.GetCurrentDocument().createElement("<IFRAME id=\"" + oTarget.id + "\" name=\"" + oTarget.name + "\"><IFRAME>");
        oNewFrame.mergeAttributes(oTarget, true);
        var oParent = oTarget.parentElement;
        oNewFrame = oParent.insertBefore(oNewFrame, oTarget);
        oParent.removeChild(oTarget);
        oNewFrame.WebFrame = new WebFrame(oContainer, oNewFrame);
        if (typeof(oTarget.WebSplitter) == "object")
        {
          oTarget.WebSplitter.divRight = oNewFrame;
        }
        oTarget = oNewFrame;
        var fqn = oTarget.getAttribute("PlaceHolderFqn");
        if (typeof(fqn) == "string")
        {
          oFieldDescriptor = FormDescriptor.GetFieldDescriptor(fqn);
          oTarget.oFieldDescriptor = oFieldDescriptor;
          if (doBinding == true)
          {
            this.AddBoundControl(fqn, oRecord, oTarget, "NonGui");
          }
        }  
        var fqn = oTarget.getAttribute("SrcFqn");
        if (typeof(fqn) == "string")
        {
          oFieldDescriptor = FormDescriptor.GetFieldDescriptor(fqn);
          oDataField = WebData.GetField(oRecord, fqn);
          oTarget.oFieldDescriptor = oFieldDescriptor;
          if (doBinding == true)
          {
            this.AddBoundControl(fqn, oRecord, oTarget);
            bindingDone = true;
          }
          oTarget.src = this.ConvertWebDataToControlData(oTarget, oFieldDescriptor, oDataField);
        }  
        break;

      case "WebSplitterContainer":
        oTarget.WebSplitter = new WebSplitter(oContainer, oTarget, "release");
        break;

      case "WebTreeViewContainer2":
      
        var fqn = controlTemplateWrapper.PlaceHolderFqn;
        if (fqn.length > 0)
        {
          fdWrapper = WebControl.FieldDescriptors.GetInstance(FormDescriptor.GetFieldDescriptor(fqn));
          oFieldDescriptor = fdWrapper.oFieldDescriptor;
          oTarget.oFieldDescriptor = oFieldDescriptor;
          if (doBinding == true)
          {
            this.AddBoundControl(fqn, oRecord, oTarget, "NonGui");
          }
        }  
      
        oTarget.WebTreeView = new WebTreeView(oTarget, oRecord);
        oTarget.WebTreeView.FillWebControls();
        break;

      case "Image":
        var removed = false;
        var removeIf = oTarget.getAttribute("RemoveIf");
        if (typeof(removeIf) == "string")
        {
          if (removeIf.length > 0)
          {
            eval(removeIf);
            if (WebData.ReturnIf == true)
            {
              this.RemoveControl(oTarget);
              WebData.ReturnIf = false;
              removed = true;
            }
          }
        }
        
        if (removed == false)
        {
          var fqn = oTarget.getAttribute("SrcFqn");
          if (typeof(fqn) == "string")
          {
            fdWrapper = WebControl.FieldDescriptors.GetInstance(FormDescriptor.GetFieldDescriptor(fqn));
            oFieldDescriptor = fdWrapper.oFieldDescriptor;
            oDataField = WebData.GetField(oRecord, fqn);
            oTarget.oFieldDescriptor = oFieldDescriptor;
            if (doBinding == true)
            {
              this.AddBoundControl(fqn, oRecord, oTarget, "Gui", BoundProperty_Src);
              bindingDone = true;
            }
            var imgUrl = this.ConvertWebDataToControlData(oTarget, oFieldDescriptor, oDataField, controlTemplateWrapper, fdWrapper);
            this.MergeImageSource(oTarget, imgUrl);
          }
          var fqn = oTarget.getAttribute("TrueFalseFqn");
          if (typeof(fqn) == "string")
          {
            fdWrapper = WebControl.FieldDescriptors.GetInstance(FormDescriptor.GetFieldDescriptor(fqn));
            oFieldDescriptor = fdWrapper.oFieldDescriptor;
            oTarget.oFieldDescriptor = oFieldDescriptor;
            oDataField = WebData.GetField(oRecord, fqn);
            if (doBinding == true)
            {
              this.AddBoundControl(fqn, oRecord, oTarget, "Gui", BoundProperty_Src);
              bindingDone = true;
            }
            var imgUrl = this.ConvertWebDataToControlData(oTarget, oFieldDescriptor, oDataField, controlTemplateWrapper, fdWrapper);
            this.MergeImageSource(oTarget, imgUrl);
          }
          var fqn = oTarget.getAttribute("ActionFqn");
          if (typeof(fqn) == "string")
          {
            this.AddBoundControl(fqn, oRecord, oTarget);
          }
          var fqn = oTarget.getAttribute("ValueFqn");
          if (typeof(fqn) == "string")
          {
            this.AddBoundControl(fqn, oRecord, oTarget);
          }
          var fqn = oTarget.getAttribute("TitleFqn");
          if (typeof(fqn) == "string")
          {
            oFieldDescriptor = FormDescriptor.GetFieldDescriptor(fqn);
            oDataField = WebData.GetField(oRecord, fqn);
            oTarget.title = this.ConvertWebDataToControlData(oTarget, oFieldDescriptor, oDataField);
          }        
          var fqn = oTarget.getAttribute("PlaceHolderFqn");
          if (typeof(fqn) == "string")
          {
            oFieldDescriptor = FormDescriptor.GetFieldDescriptor(fqn);
            oTarget.oFieldDescriptor = oFieldDescriptor;
            this.AddBoundControl(fqn, oRecord, oTarget);
          }        
          this.SetIf(oTarget, controlTemplateWrapper, recordWrapper);
        }
        break;

      case "ImageMap":
        var fqn = oTarget.getAttribute("InnerHTMLFqn");
        if (typeof(fqn) == "string")
        {
          oFieldDescriptor = FormDescriptor.GetFieldDescriptor(fqn);
          oTarget.oFieldDescriptor = oFieldDescriptor;
          oDataField = WebData.GetField(oRecord, fqn);
          if (doBinding == true)
          {
            this.AddBoundControl(fqn, oRecord, oTarget);
            bindingDone = true;
          }
          oTarget.innerHTML = this.ConvertWebDataToControlData(oTarget, oFieldDescriptor, oDataField);
          
          oTarget.ClientBoundControlArray = new Array();
          WebControl.FindClientBoundControls(oTarget, oTarget);
          
          var localArray = oTarget.ClientBoundControlArray;
          for (var i = 0, len = localArray.length; i < len; i++)
          {
            var oChildTarget = oTarget.ClientBoundControlArray[i];
            var xPathSelector = oChildTarget.getAttribute("XPathSelector");
            if (typeof(xPathSelector) == "string")
            {
              //var oNextRecordList = WebData.Select(xPathSelector);
              var oNextRecordList = oRecord.selectNodes(xPathSelector);
              if (oNextRecordList.length > 0)
              {
                var oNextRecord = oNextRecordList[0];
                
                oChildTarget.oContainer = oTarget.oContainer;
                oChildTarget.oRecord = oNextRecord;
                oChildTarget.ObjectID = oChildTarget.id;
                oChildTarget.id = this.CreateUniqueClientId(oChildTarget.oRecord, oChildTarget.id);
                
                var controlTemplateWrapperChild = this.Controls.GetInstance(oChildTarget);
                var recordWrapperChild = this.Records.GetInstance(oChildTarget.oRecord);
                
                //WebControl.SetEventHandler(oChildTarget);
              
                this.MergeData(oContainer, oChildTarget, oNextRecord, false, controlTemplateWrapperChild, recordWrapperChild);
              }
            }
          }  
        }  
        this.SetIf(oTarget, controlTemplateWrapper, recordWrapper);
        break;

      case "Table":
        var fqn = this.GetFqn(oTarget);
        if (typeof(fqn) == "string")
        {
          var detailFqn = null;
          var dtrdFqn = oTarget.getAttribute("DataTableRelationDescriptorFqn");
          if (typeof(dtrdFqn) == "string")
          {
            var dtrd = FormDescriptor.GetDataTableRelationDescriptor(dtrdFqn);
            detailFqn = dtrd.getAttribute("TableDescriptorFqnDetail");
          }
          
          if (typeof(detailFqn) == "string")
          {
            var oNextRecordList = WebData.Select(WebData.GetRecordSelector(oRecord) + "/" + detailFqn);
            var fdList = FormDescriptor.GetFieldDescriptorList(detailFqn);
            
            var oTHead = null;
            var oRow = null;
            var oCell = null;
            var fdWrapperTemp = null;
            
            oTHead = oTarget.createTHead();
             oRow = oTHead.insertRow();
            for (var i = 0; i < fdList.length; i++)
            {
              fdWrapperTemp = WebControl.FieldDescriptors.GetInstance(fdList[i]);
              if (fdWrapperTemp.Visible == true)
              {
                oCell = oRow.insertCell();
                oCell.className = "HeaderTD";
                Ilp.HtmlDom.SetText(oCell, FormDescriptor.GetDbGridCaption(fdList[i]));
              }
            }
            
            for (var i = 0; i < oNextRecordList.length; i++)
            {
              oRow = oTarget.insertRow();
              for (var j = 0; j < fdList.length; j++)
              {
                fdWrapperTemp = WebControl.FieldDescriptors.GetInstance(fdList[j]);
                if (fdWrapperTemp.Visible == true)
                {
                  oCell = oRow.insertCell();
                  if (i%2==0)
                  {
                    oCell.className = "EvenTD";
                  }
                  else
                  {
                    oCell.className = "OddTD";
                  }
                  oCell.setAttribute("ObjectID", oTarget.getAttribute("ObjectID") + "_C_" + String(i) + "_" + String(j));
                  oDataField = WebData.GetField(oNextRecordList[i], fdList[j].getAttribute("Fqn"));
                  Ilp.HtmlDom.SetText(oCell, this.ConvertWebDataToControlData(oCell, fdList[j], oDataField, null, fdWrapperTemp));
                }  
              }
            }
            oRow = oTarget.insertRow();
            Ilp.HtmlDom.SetStyle(oRow, "height", "5px");
            for (var j = 0; j < fdList.length; j++)
            {
              fdWrapperTemp = WebControl.FieldDescriptors.GetInstance(fdList[j]);
              if (fdWrapperTemp.Visible == true)
              {
                oCell = oRow.insertCell();
                if (i%2==0)
                {
                  oCell.className = "EvenTD";
                }
                else
                {
                  oCell.className = "OddTD";
                }
                oCell.setAttribute("ObjectID", oTarget.getAttribute("ObjectID") + "_C_" + String(i) + "_" + String(j));
              }  
            }
             
          }
        }
        break;
        
      case "DropDownList":
        var fqn = this.GetFqn(oTarget);
        if (typeof(fqn) == "string")
        {
          oFieldDescriptor = FormDescriptor.GetFieldDescriptor(fqn);
          if (oFieldDescriptor != null)
          {
            oTarget.oFieldDescriptor = oFieldDescriptor;
            if (oRecord != null)
            {
              oDataField = WebData.GetField(oRecord, fqn);
              if (bindingDone == false && doBinding == true)
              {
                this.AddBoundControl(fqn, oRecord, oTarget);
                bindingDone = true;
              }
            }
          }
                    
          var value = null;
          if (oDataField != null)
          {
            value = oDataField.text;
          }  
          if (typeof(oTarget.getAttribute("XMLSourceID")) == "string")
          {
            if (oTarget.options.length > 0)
            {
              this.SetComboValue(oTarget, value, false);
            }
            else
            {
              if (value == null)
              {
                this.AddPrompt(oTarget);
                oTarget.selectedIndex = 0;
              }
              else
              {
                var constrainedFqn = oTarget.getAttribute("ConstrainedFqn");
                var constrainerFqn = oTarget.getAttribute("ConstrainerFqn");
                if (typeof(constrainedFqn) == "string" || typeof(constrainerFqn) == "string")
                {
                  var lurdFqn = oTarget.getAttribute("LookUpRelationDescriptorFqn");
                  var lurd = FormDescriptor.GetLookUpRelationDescriptor(lurdFqn);
                  var fqnID = FormDescriptor.GetLookUpIDField(lurdFqn);
                  var fqnText = FormDescriptor.GetLookUpTextField(lurdFqn);
                  var fqnReturn = FormDescriptor.GetLookUpReturnField(lurdFqn);
                  var includeReturn = fqnReturn == null ? false : true;
                  
                  var oXml = null
                  if (XmlVersion == enum_XmlVersion_V1) oXml = this.GetCurrentDocument().getElementById(oTarget.getAttribute("XMLSourceID"));
                  else oXml = Ilp.XmlCache.XmlCacheList.Get(oTarget.getAttribute("XMLSourceID"));

                  var xPathSelector = oTarget.getAttribute("XPathRecordSelector");
                  
                  xPathSelector = this.PrepareXPathSelector(oRecord, xPathSelector); 
                  var oRecordSource = WebData.Select(xPathSelector, oXml.selectSingleNode("NewDataSet"), 0);
                  var oOption = this.GetCurrentDocument().createElement("OPTION");
                  oTarget.options.add(oOption);
                  if (oRecordSource == null)
                  {
                    oOption.text = "****";
                  }
                  else
                  {
                    oOption.text = WebData.GetFieldValue(oRecordSource, fqnText);              
                  }  
                  oOption.value = value;
                }
                else
                {
                  var lurdFqn = oTarget.getAttribute("LookUpRelationDescriptorFqn");
                  var lurd = FormDescriptor.GetLookUpRelationDescriptor(lurdFqn);
                  var includeReturn = false;
                  if (lurd != null)
                  {
                    includeReturn = lurd.getAttribute("FieldDescriptorReturnFqn") == null ? false : true;
                  }
                  
                  var oXml = null
                  if (XmlVersion == enum_XmlVersion_V1) oXml = this.GetCurrentDocument().getElementById(oTarget.getAttribute("XMLSourceID"));
                  else oXml = Ilp.XmlCache.XmlCacheList.Get(oTarget.getAttribute("XMLSourceID"));
                  
                  var oRecordSource = null;
                  if (XmlVersion == enum_XmlVersion_V1) oRecordSource = WebData.GetRecordByFieldValue("NewDataSet/DropDownListSource.OptionValue", value, oXml);
                  else oRecordSource = WebData.GetRecordByFieldValue("/NewDataSet/DropDownListSource.OptionValue", value, oXml);
                  
                  var oOption = this.GetCurrentDocument().createElement("OPTION");
                  oTarget.options.add(oOption);
                  oOption.text = WebData.GetFieldValue(oRecordSource, "DropDownListSource.OptionText");              
                  oOption.value = value;
                  if (includeReturn == true)
                  {
                    oOption.setAttribute("OptionReturn", WebData.GetFieldValue(oRecordSource, "DropDownListSource.OptionReturn"));
                  }
                  oTarget.selectedIndex = 0;                     
                }
              }
            }
          }
          else
          {
            var done = false;
            var xPathSelector = "";
            
            if (done == false)
            {
              // Beispiel: Stage[IDStage[.='27']]/SealRingMaterialToStageQ[@diffgr:id]
              xPathSelector = oTarget.getAttribute("XPathSelector");
              if (typeof(xPathSelector) == "string")
              {
                var args = new EventArgs();
                var BeforePrepareXPathSelectorHandler = oTarget.getAttribute("BeforePrepareXPathSelectorHandler")
                if (typeof(BeforePrepareXPathSelectorHandler) == "string")
                {
                  args.XPathSelector = xPathSelector;
                  eval(BeforePrepareXPathSelectorHandler + "(oTarget, args);");
                  xPathSelector = args.XPathSelector;
                }
                xPathSelector = this.PrepareXPathSelector(oRecord, xPathSelector);
                oTarget = this.Fill(oTarget, xPathSelector, true);
                if (oTarget.selectedIndex > -1)
                {
                  this.SetComboValue(oTarget, value, false);
                }
                done = true;
              }
            }
            
            if (done == false)
            {
              var oTargetTemp = this.FillByDataTableRelationDescriptor(oRecord, oTarget);
              if (oTargetTemp)
              {
                oTarget = oTargetTemp;
                if (oTarget.oFieldDescriptor == null)
                {
                  var dtrdFqn = oTarget.getAttribute("DataTableRelationDescriptorFqn");
                  this.AddBoundControl(dtrdFqn, oRecord, oTarget, "Dtrd");
                }
                else
                {
                  if (oTarget.selectedIndex > -1)
                  {
                    this.SetComboValue(oTarget, value, false);
                  }
                }
                done = true;
              }
            }  
            
            if (done == false)
            {
              var lurd = null;
              var lurdFqn = oTarget.getAttribute("LookUpRelationDescriptorFqn");
              if (typeof(lurdFqn) == "string")
              {
                lurd = FormDescriptor.GetLookUpRelationDescriptor(lurdFqn);
                xPathSelector = lurd.getAttribute("TableDescriptorFqnLookUp");
              }              
              if (typeof(xPathSelector) == "string")
              {
                this.RemoveBoundControl(oRecord, oTarget);
                oTarget = this.Fill(oTarget, xPathSelector, true);
                this.AddBoundControl(fqn, oRecord, oTarget);                
                if (oTarget.selectedIndex > -1)
                {
                  this.SetComboValue(oTarget, value, false);
                }
                done = true;
              }
            }  
            
          }
        }  
        this.SetIf(oTarget, controlTemplateWrapper, recordWrapper);
        break;
        
      case "ListBox":
        var fqn = this.GetFqn(oTarget);
        if (typeof(fqn) == "string")
        {
          oFieldDescriptor = FormDescriptor.GetFieldDescriptor(fqn);
          if (oFieldDescriptor != null)
          {
            oTarget.oFieldDescriptor = oFieldDescriptor;
            if (oRecord != null)
            {
              oDataField = WebData.GetField(oRecord, fqn);
              if (bindingDone == false && doBinding == true)
              {
                this.AddBoundControl(fqn, oRecord, oTarget);
                bindingDone = true;
              }
            }
          }
          var value = null;
          if (oDataField != null)
          {
            value = oDataField.text;
          }  
      
          if (typeof(oTarget.getAttribute("XMLSourceID")) == "string")
          {
            oTarget = this.ReplaceFakeListBox(oTarget);
            if (oTarget.options.length > 0)
            {
              this.SetComboValue(oTarget, value, false);
            }
          }
          else
          {
            var done = false;
            var xPathSelector = "";
            
            if (done == false)
            {
              // Beispiel: Stage[IDStage[.='27']]/SealRingMaterialToStageQ[@diffgr:id]
              xPathSelector = oTarget.getAttribute("XPathSelector");
              if (typeof(xPathSelector) == "string")
              {
                xPathSelector = this.PrepareXPathSelector(oRecord, xPathSelector);
                oTarget = this.Fill(oTarget, xPathSelector, false);
                done = true;
              }
            }
          
            if (done == false)
            {
              var dtrdFqn = oTarget.getAttribute("DataTableRelationDescriptorFqn");
              if (typeof(dtrdFqn) == "string")
              {
                var dtrd = FormDescriptor.GetDataTableRelationDescriptor(dtrdFqn);
                xPathSelector = dtrd.getAttribute("TableDescriptorFqnDetail");
                xPathSelector = WebData.GetRecordSelector(oRecord) + "/" + xPathSelector;
              }
              else
              {
                xPathSelector = oTarget.getAttribute("TableDescriptorFqn");
              }
              
              if (typeof(xPathSelector) == "string")
              {
                oTarget = this.Fill(oTarget, xPathSelector, false);
                done = true;
              }
            }            
          }
        }
        this.SetIf(oTarget, controlTemplateWrapper, recordWrapper);
        break;

      case "WebDataHeader":
        var fqn = oTarget.getAttribute("InnerTextFqn");
        if (typeof(fqn) == "string")
        {
          oFieldDescriptor = FormDescriptor.GetFieldDescriptor(fqn);
          oTarget.oFieldDescriptor = oFieldDescriptor;
          oDataField = WebData.GetField(oRecord, fqn);
          this.AddBoundControl(fqn, oRecord, oTarget);
          Ilp.HtmlDom.SetText(oTarget, this.ConvertWebDataToControlData(oTarget, oFieldDescriptor, oDataField));
        }
        var fqn = oTarget.getAttribute("PlaceHolderFqn");
        if (typeof(fqn) == "string")
        {
          oFieldDescriptor = FormDescriptor.GetFieldDescriptor(fqn);
          oTarget.oFieldDescriptor = oFieldDescriptor;
          this.AddBoundControl(fqn, oRecord, oTarget, "NonGui");
        }  
        this.SetIf(oTarget, controlTemplateWrapper, recordWrapper);
        break;

      case "WebDataGridContainer":
        if (oTarget.getAttribute("IsDetailContainer") == "true")
        {
          var removed = false;
          var removeIf = oTarget.getAttribute("RemoveIf");
          if (typeof(removeIf) == "string")
          {
            if (removeIf.length > 0)
            {
              eval(removeIf);
              if (WebData.ReturnIf == true)
              {
                this.RemoveControl(oTarget);
                WebData.ReturnIf = false;
                removed = true;
              }
            }
          }
          
          if (removed == false)
          {
            var tableDescriptorFqn = this.GetTableDescriptorFqn(oTarget);
            if (typeof(tableDescriptorFqn) == "string")
            {
              var oWebDataGrid = new WebDataGrid(oTarget, oRecord);
              oWebDataGrid.oParentGrid = oContainer;
              oWebDataGrid.ChildGridLevel = oContainer.ChildGridLevel + 1;
              var bindingHash = WebData.GetBindingHash(tableDescriptorFqn, oRecord, true);
              oContainer.ChildGridCollection[bindingHash] = oWebDataGrid;
              oContainer.ChildGridArray[oContainer.ChildGridArray.length] = oWebDataGrid;
              oNextRecordList = oRecord.selectNodes(tableDescriptorFqn);

              oWebDataGrid.EnableDebugging = oContainer.EnableDebugging;
              oWebDataGrid.FillWebControlsR(oNextRecordList);
            }
          
            this.SetIf(oTarget, controlTemplateWrapper, recordWrapper);
          }
        }
        break;

      case "WebColumnGridContainer":
        if (oTarget.getAttribute("IsDetailContainer") == "true")
        {
          var removed = false;
          var removeIf = oTarget.getAttribute("RemoveIf");
          if (typeof(removeIf) == "string")
          {
            if (removeIf.length > 0)
            {
              eval(removeIf);
              if (WebData.ReturnIf == true)
              {
                this.RemoveControl(oTarget);
                WebData.ReturnIf = false;
                removed = true;
              }
            }
          }
          
          if (removed == false)
          {
            var tableDescriptorFqn = this.GetTableDescriptorFqn(oTarget);
            if (typeof(tableDescriptorFqn) == "string")
            {
              var oWebColumnGrid = new WebColumnGridClass(oTarget, oRecord);
              oWebColumnGrid.oParentGrid = oContainer;
              var bindingHash = WebData.GetBindingHash(tableDescriptorFqn, oRecord, true);
              oContainer.ChildGridCollection[bindingHash] = oWebColumnGrid;
              oContainer.ChildGridArray[oContainer.ChildGridArray.length] = oWebColumnGrid;
              oNextRecordList = oRecord.selectNodes(tableDescriptorFqn);

              oWebColumnGrid.FillWebControlsR(oNextRecordList);
            }
          
            this.SetIf(oTarget, controlTemplateWrapper, recordWrapper);
          }
        }
        break;
      
      case "NavTree":
        if (typeof(NavTree) == "function")
        {
          oTarget.NavTree = new NavTree(oContainer, oTarget);
        }
        else
        {
          if (Ilp.HtmlDom.GetAttribute(oTarget, "MenuBarType", "") == "MenuStrip")
          {
            var oMenuStrip = new MenuStripClass(oTarget, oContainer.JsInstance);
            if (oContainer.MenuStripArray)
            {
              oContainer.MenuStripArray[oContainer.MenuStripArray.length] = oMenuStrip;
            }
          }
        }
        break;
      
      case "PanelContainer":
        var fqn = oTarget.getAttribute("PlaceHolderFqn");
        if (typeof(fqn) == "string")
        {
          oFieldDescriptor = FormDescriptor.GetFieldDescriptor(fqn);
          oTarget.oFieldDescriptor = oFieldDescriptor;
          if (doBinding == true)
          {
            this.AddBoundControl(fqn, oRecord, oTarget, "NonGui");
          }
        }  
        this.SetIf(oTarget, controlTemplateWrapper, recordWrapper);
        break;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_MergeData", "", this.MergeData);
  }
}

function WebControl_Clear(oControl)
{
  var returnControl = oControl;
  try
  { 
    switch(oControl.getAttribute("ControlType"))
    {
      case "TextBox":
        oControl.value = "";
        break;
        
      case "DropDownList":
        var oInput = this.GetCurrentDocument().createElement("SELECT");

        oInput.mergeAttributes(oControl, false);
        this.MergeAttachedObjects(oControl, oInput);
        this.MergeAttachedEvents(oControl, oInput);
        WebData.ReplaceBinding(oControl, oInput);
          
        var oParent = oControl.parentElement;
        if (oParent)
        {
          oParent.insertBefore(oInput, oControl);
          oParent.removeChild(oControl);
        }
        if (typeof(oInput.getAttribute("XMLSourceID")) == "string")
        {
          oInput.setAttribute("State", "Fake");
        }
        returnControl = oInput; 
        
        break;
        
      case "ListBox":
        var readOnly = oControl.getAttribute("ReadOnly");
        if (readOnly == "True")
        {
          oControl.innerHTML = "";
        }
        else{
          var length = oControl.options.length;
          for (var i = 0; i < length; i++){
            oControl.options.remove(0);
          }
        }
        if (typeof(oControl.getAttribute("XMLSourceID")) == "string"){
          oControl.setAttribute("State", "Fake");
        }  
        break;

      case "ImageMap":
        oControl.innerHTML = "";
        returnControl = oControl;
        break;
    }  
    return returnControl;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_Clear", "")
  }
}

function WebControl_OptionFilter(oControl, oSelectedList)
{
  try
  { 
    var oDropDownListSource = null;
    
    var length = oControl.options.length;
    for (var i = 0; i < length; i++)
    {
      oControl.options.remove(0);
    }
    
    this.AddPrompt(oControl);
    
    for (var k = 0, len = oSelectedList.length; k < len; k++)
    {
      oDropDownListSource = oSelectedList[k];
      var oOption = this.GetCurrentDocument().createElement("OPTION");
      oOption.text = oDropDownListSource.selectSingleNode("OptionText").text;
      oOption.value = oDropDownListSource.selectSingleNode("OptionValue").text;
      oControl.options.add(oOption);
      
      var oOptionReturn = oDropDownListSource.selectSingleNode("OptionReturn");
      if (oOptionReturn != null)
      {
        oOption.setAttribute("OptionReturn", oOptionReturn.text);
      }
    }
    
    oControl.setAttribute("State", "Filled");
    oControl.selectedIndex = 0;
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebControl_OptionFilter", "")
  }
}

function WebControl_OptionFill(oControl, oSelectedList, addPrompt)
{
  try
  {
    var idFqn = "";
    var textFqn = "";
    var returnFqn = "";
    var done = false;

    if (done == false)
    {
      var lurd = "";
      var lurdFqn = oControl.getAttribute("LookUpRelationDescriptorFqn");
      if (typeof(lurdFqn) == "string")
      {
        lurd = FormDescriptor.GetLookUpRelationDescriptor(lurdFqn);

        idFqn = lurd.getAttribute("FieldDescriptorIDFqn");
        textFqn = lurd.getAttribute("FieldDescriptorTextFqn");
        returnFqn = lurd.getAttribute("FieldDescriptorReturnFqn");
        done = true;
      }
    }
    
    if (done == false)
    {
      var dtrdFqn = oControl.getAttribute("DataTableRelationDescriptorFqn");
      if (typeof(dtrdFqn) == "string")
      {
        var fd = null;
        var dtrd = FormDescriptor.GetDataTableRelationDescriptor(dtrdFqn);
        var tdFqn = dtrd.getAttribute("TableDescriptorFqnDetail");
        
        fd = FormDescriptor.GetOptionValueFd(tdFqn);
        if (fd != null) idFqn = fd.getAttribute("Fqn");
        fd = FormDescriptor.GetOptionTextFd(tdFqn);
        if (fd != null) textFqn = fd.getAttribute("Fqn");
        fd = FormDescriptor.GetOptionReturnFd(tdFqn);
        if (fd != null) returnFqn = fd.getAttribute("Fqn");
        done = true;
      }
    }
    
    if (done == false)
    {
      var tdFqn = oControl.getAttribute("TableDescriptorFqn");
      if (typeof(tdFqn) == "string")
      {
        var fd = null;
        fd = FormDescriptor.GetOptionValueFd(tdFqn);
        if (fd != null) idFqn = fd.getAttribute("Fqn");
        fd = FormDescriptor.GetOptionTextFd(tdFqn);
        if (fd != null) textFqn = fd.getAttribute("Fqn");
        fd = FormDescriptor.GetOptionReturnFd(tdFqn);
        if (fd != null) returnFqn = fd.getAttribute("Fqn");
        done = true;
      }
    }
    
    if (done == false)
    {
      idFqn = oControl.getAttribute("FieldDescriptorSourceIDFqn");
      textFqn = oControl.getAttribute("FieldDescriptorSourceTextFqn");
      returnFqn = oControl.getAttribute("FieldDescriptorSourceReturnFqn");
      done = true;
    }
      
    addPrompt = addPrompt == null ? false : addPrompt;
    
    var oInput = this.GetCurrentDocument().createElement("SELECT");

    oInput.mergeAttributes(oControl, false);
    this.MergeAttachedObjects(oControl, oInput);
    this.MergeAttachedEvents(oControl, oInput);
    WebData.ReplaceBinding(oControl, oInput);
    //oInput.setAttribute("XPathSelector", select);
    
    if (addPrompt == true)
    {
      this.AddPrompt(oInput, ids_PromptText)
    }
    
    var oNextRecord = null;
    if (oSelectedList.length > 0)
    {
      var hasReturnFqn = (typeof(returnFqn) == "string" && returnFqn.length > 0);
      var currentDocument = this.GetCurrentDocument();
      var oOptions = oInput.options;
      
      for (var k = 0, len = oSelectedList.length; k < len; k++)
      {
        oNextRecord = oSelectedList[k];
        var oOption = currentDocument.createElement("OPTION");
        var oText = WebData.GetFieldValue(oNextRecord, textFqn);
        if (oText == null)
        {
          oText = WebData.GetFieldValue(oNextRecord, "DropDownListSource.OptionText");
        }
        oOption.text = oText;
        var oValue = WebData.GetFieldValue(oNextRecord, idFqn);
        if (oValue == null)
        {
          oValue = WebData.GetFieldValue(oNextRecord, "DropDownListSource.OptionValue");
        }        
        oOption.value = oValue;
        oOptions.add(oOption);

        if (hasReturnFqn == true) oOption.setAttribute("OptionReturn", WebData.GetFieldValue(oNextRecord, returnFqn));
      }
    }
    var oParent = oControl.parentElement;
    if (oParent)
    {
      oParent.insertBefore(oInput, oControl);
      oParent.removeChild(oControl);
    }
    
    return oInput;
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebControl_OptionFill", "")
  }
}

function WebControl_Fill(oControl, select, addPrompt, oXmlDocument)
{
  try
  { 
    var bContinue;
    var xPath = "";
    var oXMLDoc = null;
    
    addPrompt = addPrompt == null ? false : addPrompt;
    oXmlDocument = oXmlDocument == null ? WebData.oWebData : oXmlDocument;
    
    if (typeof(this.GetCurrentWindow().WebSelSearch) == "object") 
    {
      oXMLDoc = WebSelSearch.oForwardXMLDoc;
    }
    
    switch(oControl.getAttribute("ControlType"))
    {
      case "DropDownList":
        oControl = this.Clear(oControl);
        var oNextRecordList = WebData.Select(select, oXmlDocument);
        oControl = this.OptionFill(oControl, oNextRecordList, addPrompt);
        oControl.setAttribute("State", "Filled");
        break;
        
      case "ListBox":
      
        oControl = this.Clear(oControl);
        var readOnly = oControl.getAttribute("ReadOnly");
        
        var idFqn = "";
        var textFqn = "";
        var returnFqn = "";

        var lurd = "";
        var lurdFqn = oControl.getAttribute("LookUpRelationDescriptorFqn");
        if (typeof(lurdFqn) == "string")
        {
          lurd = FormDescriptor.GetLookUpRelationDescriptor(lurdFqn);

          idFqn = lurd.getAttribute("FieldDescriptorIDFqn");
          textFqn = lurd.getAttribute("FieldDescriptorTextFqn");
          returnFqn = lurd.getAttribute("FieldDescriptorReturnFqn");
        }
        var tdFqn = oControl.getAttribute("TableDescriptorFqn");
        if (typeof(tdFqn) == "string")
        {
          idFd = FormDescriptor.GetOptionValueFd(tdFqn);
          textFd = FormDescriptor.GetOptionTextFd(tdFqn);
          returnFd = FormDescriptor.GetOptionReturnFd(tdFqn);
          
          if (idFqn != null) idFqn = idFd.getAttribute("Fqn");
          if (textFd != null) textFqn = textFd.getAttribute("Fqn");
          if (returnFd != null) returnFqn = returnFd.getAttribute("Fqn");
        }
        
        var tableDesriptorFqn = idFqn.split(".")[0];
        var oFDText = FormDescriptor.GetFieldDescriptor(textFqn);              
        var oNextRecord = null;
        
        oNextRecordList = WebData.Select(select);
        
        var count = oNextRecordList.length;
        for (var k = 0; k < count; k++)
        {
          oNextRecord = oNextRecordList[k];
          bContinue = true;
          
          if (readOnly == "True")
          {
            var oSpan = this.GetCurrentDocument().createElement("SPAN");
            oSpan.oRecord = oNextRecord;
            if (k < count - 1)
            {
              oSpan.innerHTML = WebData.GetFieldValue(oNextRecord, textFqn) + " / ";
            }
            else
            {
              oSpan.innerHTML = WebData.GetFieldValue(oNextRecord, textFqn);
            }
            oControl.appendChild(oSpan);
          }
          else
          {
            // Wird in SelSerach-Suchseite verwendet
            if (oXMLDoc != null)
            {
              xPath = "//Record[@OV='" + WebData.GetFieldValue(oNextRecord, idFqn) + "']";
              bContinue = (oXMLDoc.documentElement.selectSingleNode(xPath) == null);
            }
            
            if (bContinue)
            {  
              var oOption = this.GetCurrentDocument().createElement("OPTION");
              oOption.oRecord = oNextRecord;
              oControl.options.add(oOption);
              var oDataField = WebData.GetField(oNextRecord, textFqn);
              oOption.text = this.ConvertWebDataToControlData(oOption, oFDText, oDataField) 
              oOption.value = WebData.GetFieldValue(oNextRecord, idFqn);
              if (typeof(returnFqn) == "string" && returnFqn.length > 0)
              {
                oOption.setAttribute("OptionReturn", WebData.GetFieldValue(oNextRecord, returnFqn));
              }
            }
          }
        }
        break;
    }  
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_Fill", "")
  }
  
  return oControl;
}

function WebControl_FillByDataTableRelationDescriptor(oRecord, oControl)
{
  try
  {
    var oMasterRecord = oRecord; 
    var oControlTemp = null;
    var dtrdFqn = oControl.getAttribute("DataTableRelationDescriptorFqn");
    if (typeof(dtrdFqn) == "string")
    {
      var dtrd = FormDescriptor.GetDataTableRelationDescriptor(dtrdFqn);
      
      // z.B. in ArticlePID.aspx für PIDConfiguration_PIDConnectionToAPIPlanLookUp
      while(oMasterRecord && oMasterRecord.nodeName != dtrd.getAttribute("TableDescriptorFqnMaster"))
      {
        oMasterRecord = oMasterRecord.parentNode;
      }
      xPathSelector = dtrd.getAttribute("TableDescriptorFqnDetail");
    }
    
    if (typeof(xPathSelector) == "string")
    {
      oControlTemp = this.Fill(oControl, WebData.GetRecordSelector(oMasterRecord) + "/" + xPathSelector, true);
    }
    
    return oControlTemp;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_FillByDataTableRelationDescriptor", "")
  }
  
  return oControl;
}

function WebControl_PrepareXPathSelector(oRecord, xPathSelector)
{
  try
  {
    if (typeof(xPathSelector) == "string")
    {
      var xPathSelectorTemp = xPathSelector;
      var dateregex=/-[^-][-.a-zA-Z0-9]*[^-]-/;
      var re1 = new RegExp("-[^-][-.a-zA-Z0-9]*[^-]-", "g");
      var treffer = re1.exec(xPathSelector);
      var match = xPathSelectorTemp.match(dateregex);
      var idPkv = "";
      var re = null;
      var aMatch = new Array();
      while (match)
      {
        aMatch[aMatch.length] = match;
        re = new RegExp(match[0], "g");
        xPathSelectorTemp = xPathSelectorTemp.replace(re, "");
        match = xPathSelectorTemp.match(dateregex);
      }
      
      for (var i = 0, len = aMatch.length; i < len; i++)
      {
        var fqn = aMatch[i][0].substring(1, aMatch[i][0].length-1);
        if (fqn.indexOf(".") == -1) fqn = oRecord.nodeName + "." + fqn;
        idPkv = WebData.GetFieldValue(oRecord, fqn);
        idPkv = idPkv == null ? '$$$' : idPkv;
        re = new RegExp(aMatch[i][0], "g");
        xPathSelector = xPathSelector.replace(re, idPkv);
      }
    }
    
    return xPathSelector;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_PrepareXPathSelector", "")
  }
}

function WebControl_ValidateControl(oControl, silent)
{
  try
  {
    var webMessageDescriptor = this.ValidateInput(oControl, oControl.oFieldDescriptor);
    
    if (silent == false && webMessageDescriptor.Valid == false)
    {
      this.HideValidationSummary();
      this.WebMessageDescriptorList.Add(webMessageDescriptor);
      
      if(this.WebMessageDescriptorList.Count() > 0)
      {
        var oControl = this.WebMessageDescriptorList.Get(0).oControl;
        if (oControl != null && oControl.tagName == "INPUT" && oControl.type == "text" || oControl.tagName == "SELECT")
        {
          this.FireEvent(oControl, "onfocus");
          // wg. ReplaceFakeCombo !
          if (oControl.tagName == "SELECT") oControl = this.WebMessageDescriptorList.Get(0).oControl;
          this.ShowValidatedControl(oControl, true);
        }
        this.ShowValidationSummary();
      }
    }
    
    return webMessageDescriptor.Valid;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ValidateControl", "")
  }
}

function WebControl_WriteToWebData(oControl, forceChange)
{
  try
  {
    var dataHasChanged = forceChange == null ? false : forceChange;
    var dataWereChanged = false;
    var oFieldDescriptor = oControl.oFieldDescriptor;
    if (oFieldDescriptor != null)
    {
      var fieldDescriptorFqn = oFieldDescriptor.getAttribute("Fqn");
      
      if (typeof(oControl.oRecord) == "object")
      {
        var controlNewValue = this.GetValue(oControl);
        var oDataField = WebData.GetField(oControl.oRecord, fieldDescriptorFqn)
        var controlOldValue = this.ConvertWebDataToControlData(oControl, oFieldDescriptor, oDataField)
        
        switch (oControl.getAttribute("ControlType"))
        {
          case "DropDownList":
          case "ListBox":
            if (Number(controlOldValue) > -1)
            {
              controlOldValue =  oControl.options[Number(controlOldValue)].value;
            }
            break;
          case "TextBox":
            if (oControl.tagName == "TEXTAREA" && typeof(oControl.getAttribute("InnerTextFqn")) == "string")
            {
              var oTempInput = this.GetCurrentDocument().createElement(oControl.tagName);
              oTempInput.mergeAttributes(oControl, false);
              this.MergeData(null, oTempInput, oControl.oRecord, false);
              controlOldValue = this.GetValue(oTempInput);
            }
            break;  
        }
      
        if (controlNewValue != controlOldValue)
        {
          dataHasChanged = true;
        }
      }
      
      this.HideValidationSummary();
      if (dataHasChanged == true)
      {
        this.SetBackgroundColor(oControl, this.BackgroundColorChanged);

        var args = new EventArgs();
        if (this.BeforeValidateInputOnWriteToWebData != null)
        {
          args.oFieldDescriptor = oFieldDescriptor;
          this.BeforeValidateInputOnWriteToWebData(oControl, args);
        }
        if (args.Cancel == false)
        {
          var webMessageDescriptor = this.ValidateInput(oControl, oFieldDescriptor);
          if (webMessageDescriptor.Valid == false) this.WebMessageDescriptorList.Add(webMessageDescriptor);
        }
       
        if (this.WebMessageDescriptorList.Count() > 0)
        {
          this.ShowValidationSummary();
          WebStatusBar.SetDataChangedMessage(ids_DataChanged, 1);
          WebData.HasChanged = true;  
        }
        else
        {
          if (typeof(oControl.oRecord) == "object")
          {
            var newValue = this.ConvertControlDataToWebData(oControl, oFieldDescriptor);
            switch(oControl.getAttribute("ControlType"))
            {
              case "DropDownList":
              case "ListBox":
                if (typeof(fieldDescriptorFqn) == "string" && fieldDescriptorFqn.length > 0)
                {
                  if (oControl.selectedIndex > -1)
                  {
                    if (oControl.options(oControl.selectedIndex).value == ""
                      || oControl.options(oControl.selectedIndex).value == "0"
                      || oControl.options(oControl.selectedIndex).value == "-1")
                    {
                      WebData.SetNull(oControl.oRecord, fieldDescriptorFqn);
                      dataWereChanged = true;
                    }
                    else
                    {
                      WebData.SetFieldValue(oControl.oRecord, fieldDescriptorFqn, oControl.options(oControl.selectedIndex).value);
                      dataWereChanged = true;
                    }  
                  }
                  else
                  {
                    WebData.SetNull(oControl.oRecord, fieldDescriptorFqn);
                    dataWereChanged = true;
                  }
                }
                break;
              case "TextBox":
                if (newValue == "" 
                  && (    oControl.oFieldDescriptor.getAttribute("FieldType") == "decimal"
                      || oControl.oFieldDescriptor.getAttribute("FieldType") == "integer"
                      || oControl.oFieldDescriptor.getAttribute("FieldType") == "double"))
                {
                  WebData.SetNull(oControl.oRecord, fieldDescriptorFqn);
                  dataWereChanged = true;
                }
                else if (newValue == "" && oControl.oFieldDescriptor.getAttribute("FieldType") == "dateTime")
                {
                  WebData.SetNull(oControl.oRecord, fieldDescriptorFqn);
                  dataWereChanged = true;
                }
                else
                {
                  WebData.SetFieldValue(oControl.oRecord, fieldDescriptorFqn, newValue);             
                  dataWereChanged = true;
                }
                break;
              case "CheckBox":
                WebData.SetFieldValue(oControl.oRecord, fieldDescriptorFqn, newValue);
                dataWereChanged = true;
                break;
              case "RadioButton":
                WebData.SetFieldValue(oControl.oRecord, fieldDescriptorFqn, newValue);
                dataWereChanged = true;
                break;
              case "Panel":
                WebData.SetFieldValue(oControl.oRecord, fieldDescriptorFqn, newValue);
                dataWereChanged = true;
                break;
            }
          }
        }
      }  
    }
    
    if (typeof(this.OnAfterWriteWebData) == "function")
    {
      var args = new EventArgs();
      args.DataWereChanged = dataWereChanged;
      this.OnAfterWriteWebData(oControl, args);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_WriteToWebData", "")
  }
}

function WebControl_RemoveControl(oControl)
{
  try
  { 
    var oParent = oControl.parentElement;
    oParent.removeChild(oControl);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_RemoveControl", "");
  }
}

function WebControl_GetBoundControl(oRecord, fqn, controlType)
{
  try
  {
    controlType = controlType == null ? "" : controlType;
     
    var oElement = null;
    var bindingHash = WebData.GetBindingHash(fqn, oRecord);
    var binder = this.FieldToHtmlObject.Get(bindingHash);
    if (binder != null) 
    {
      if (controlType.length > 0)
      {
        for(var j = 0; j < binder.HtmlObjects.Count(); j++)
        {
          var oTarget = binder.HtmlObjects.Get(j);
          if (oTarget.getAttribute("ControlType") == controlType)
          {
            oElement = oTarget;
            break;
          }
        }
      }
      else
      {
        oElement = binder.HtmlObjects.Get(0);
      }
    }
    
    return oElement;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetBoundControl", "");
  }
}

function WebControl_ResetBindingList()
{
  try
  {
    this.FieldToHtmlObject.Clear();
    this.NumberOfBinds = 0;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ResetBindingList", "");
  }
}

function WebControl_ReplaceFakeCombo(eSrc)
{
  try
  { 
    var oFakeInput      = eSrc;
    var oInput          = eSrc;
    var oComboTemplate  = null;
    var oComboOld       = null;
    var oComboNew       = null;

    if (oFakeInput.getAttribute("State") == "Fake")
    {
      var constrainedFqn = oInput.getAttribute("ConstrainedFqn");
      var constrainerFqn = oInput.getAttribute("ConstrainerFqn");
      if (typeof(constrainedFqn) == "string" || typeof(constrainerFqn) == "string")
      {
        var xPathSelector = oInput.getAttribute("XPathSelector");
        if (typeof(xPathSelector) == "string")
        {
          var oXml = null
          if (XmlVersion == enum_XmlVersion_V1) oXml = this.GetCurrentDocument().getElementById(oInput.getAttribute("XMLSourceID"));
          else oXml = Ilp.XmlCache.XmlCacheList.Get(oInput.getAttribute("XMLSourceID"));

          var addPrompt = (oInput.getAttribute("AllowPrompt") == "true");
          var comboTemplateWrapper = null;
          xPathSelector = this.PrepareXPathSelector(oInput.oRecord, xPathSelector);
          comboTemplateWrapper = WebControl.ComboTemplates.GetInstance(xPathSelector);
          if (comboTemplateWrapper.oComboTemplate == null)
          {
            oInput = this.Fill(oInput, xPathSelector, addPrompt, oXml.selectSingleNode("NewDataSet"));
            comboTemplateWrapper.oComboTemplate = oInput.cloneNode(true);
          }
          else
          {
            oComboOld = oInput;
            var oComboNew = comboTemplateWrapper.oComboTemplate.cloneNode(true);
            oComboNew.mergeAttributes(oComboOld, false);
            this.MergeAttachedObjects(oComboOld, oComboNew);
            this.MergeAttachedEvents(oComboOld, oComboNew);
            oComboNew.setAttribute("State", "Filled");
            
            var oParent = oComboOld.parentElement;
            if (oParent)
            {
              oParent.insertBefore(oComboNew, oComboOld);
              oParent.removeChild(oComboOld);
            }
            if (addPrompt == true)
            {
              oComboNew.selectedIndex = 0;
            }
            else
            {
              oComboNew.selectedIndex = -1;
            }
            WebData.ReplaceBinding(oComboOld, oComboNew);
            oInput = oComboNew;
            var oWebMessageDescriptor = this.GetWebMessageDescriptor(oComboOld);
            if (oWebMessageDescriptor != null) oWebMessageDescriptor.oControl = oComboNew;
          }
        }
      }
      else
      {    
        var HTMLTargetID = oFakeInput.getAttribute("HTMLTargetID");
        if (typeof(HTMLTargetID) == "string" && HTMLTargetID.length > 0)
        {
          var oEditSource = null;
          if (XmlVersion == enum_XmlVersion_V1)
          {
            oEditSource = this.GetCurrentDocument().getElementById(HTMLTargetID);
            oInput = oEditSource.children[0].cloneNode(true);
          }
          else
          {
            var comboObject = Ilp.ComboManager.ComboList.Get(HTMLTargetID);
            oEditSource = comboObject.Div;
            oInput = oEditSource.children[0].cloneNode(true);
          }
        
          var xmlSourceID = oFakeInput.getAttribute("XMLSourceID");
          var oXml = null
          if (XmlVersion == enum_XmlVersion_V1) oXml = this.GetCurrentDocument().getElementById(xmlSourceID);
          else oXml = Ilp.XmlCache.XmlCacheList.Get(xmlSourceID);
          
          var xPathSelector = oFakeInput.getAttribute("XPathSelector");
          if (typeof(xPathSelector) == "string")
          {
            xPathSelector = this.PrepareXPathSelector(oFakeInput.oRecord, xPathSelector);
            oInput.setAttribute("ControlType", oFakeInput.getAttribute("ControlType"));
            oInput.setAttribute("LookUpRelationDescriptorFqn", oFakeInput.getAttribute("LookUpRelationDescriptorFqn"));
            oInput = this.Fill(oInput, xPathSelector, false, oXml);
          }
          else
          {
            oInput.oXmlSource = oXml;
          }

          var oParent = oFakeInput.parentElement;
          
          oInput.mergeAttributes(oFakeInput, false);
          this.MergeAttachedObjects(oFakeInput, oInput);
          this.MergeAttachedEvents(oFakeInput, oInput);
          this.AddPrompt(oInput);

          WebData.ReplaceBinding(oFakeInput, oInput);
          
          oInput.setAttribute("State", "Filled");
          if (oParent)
          {
            oParent.insertBefore(oInput, oFakeInput);
            oParent.removeChild(oFakeInput);
          }
          
          var oWebMessageDescriptor = this.GetWebMessageDescriptor(oFakeInput);
          if (oWebMessageDescriptor != null) oWebMessageDescriptor.oControl = oInput;
        }
        else
        {
          var tableDescriptorFqn = oInput.getAttribute("TableDescriptorFqn");           
          if (typeof(tableDescriptorFqn) == "string")
          {
            this.Fill(oInput, tableDescriptorFqn, true);
            oInput.setAttribute("State", "Filled");
          }
        }
      }  
    } 
    
    return oInput;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ReplaceFakeCombo", "");
  }
}

function WebControl_GetComboSourceRecord(sender, optionValue)
{
  try
  { 
    var oRecord = null;
    var oCombo = this.ReplaceFakeCombo(sender);
    if (sender != oCombo) this.SetComboValue(oCombo, optionValue, false);
    
    if (oCombo.oXmlSource != null)
    {
      oRecord = oCombo.oXmlSource.selectSingleNode("NewDataSet/DropDownListSource[OptionValue[.='" + String(optionValue) + "']]");
    }
    else
    {
      var xmlSourceID = sender.getAttribute("XMLSourceID");
      var oXml = null
      if (XmlVersion == enum_XmlVersion_V1) 
      {
        oXml = this.GetCurrentDocument().getElementById(xmlSourceID);
      }
      else 
      {
        oXml = Ilp.XmlCache.XmlCacheList.Get(xmlSourceID);   
      }
      if (oXml != null)
      {
        var constrainedFqn = oCombo.getAttribute("ConstrainedFqn");
        var constrainerFqn = oCombo.getAttribute("ConstrainerFqn");
        if (typeof(constrainedFqn) == "string" || typeof(constrainerFqn) == "string")
        {
          var xPathSelector = oCombo.getAttribute("XPathRecordSelector");
          xPathSelector = this.PrepareXPathSelector(oCombo.oRecord, xPathSelector); 
          oRecord = WebData.Select(xPathSelector, oXml.selectSingleNode("NewDataSet"), 0);
        }
        else
        {
          oRecord = oXml.selectSingleNode("NewDataSet/DropDownListSource[OptionValue[.='" + String(optionValue) + "']]");
        }
      }
    }   
    return oRecord;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetComboSourceRecord", "");
  }
}


function WebControl_GetComboSourceValue(oComboSourceRecord, fieldName)
{
  try
  { 
    var returnValue = "";
    var oField = oComboSourceRecord.selectSingleNode(fieldName);
    if (oField != null)
    {
      returnValue = oField.text;
    }
    
    return returnValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetComboSourceValue", "");
  }
}

function WebControl_GetComboSourceValueB(oRecord, boundFqn, sourceFieldName)
{
  try
  { 
    var returnValue = "";
    
    var oCombo = this.GetBoundControl(oRecord, boundFqn);
    
    var oXml = null
    if (XmlVersion == enum_XmlVersion_V1) oXml = this.GetCurrentDocument().getElementById(oCombo.getAttribute("XMLSourceID"));
    else oXml = Ilp.XmlCache.XmlCacheList.Get(oTarget.getAttribute("XMLSourceID"));
    
    var xPathRecordSelector = oCombo.getAttribute("XPathRecordSelector");
    xPathRecordSelector = this.PrepareXPathSelector(oRecord, xPathRecordSelector);

    var oRecordSource = WebData.Select(xPathRecordSelector, oXml.selectSingleNode("NewDataSet"), 0);
    
    returnValue = WebData.GetFieldValue(oRecordSource, oRecordSource.nodeName + "." + sourceFieldName);
    return returnValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetComboSourceValueB", "");
  }
}

function WebControl_ReplaceFakeListBox(eSrc)
{
  try
  { 
    var oFakeInput = eSrc;
    var oInput = eSrc;

    if (oFakeInput.getAttribute("State") == "Fake")
    {
      var HTMLTargetID = oFakeInput.getAttribute("HTMLTargetID");
      if (HTMLTargetID.length > 0)
      {
        var oEditSource = null;
        if (XmlVersion == enum_XmlVersion_V1)
        {
          oEditSource = this.GetCurrentDocument().getElementById(HTMLTargetID);
          oInput = oEditSource.children[0].cloneNode(true);
        }
        else
        {
          var comboObject = Ilp.ComboManager.ComboList.Get(HTMLTargetID);
          oEditSource = comboObject.Div;
          oInput = oEditSource.children[0].cloneNode(true);
        }
        
        var oParent = oFakeInput.parentElement;
        
        oInput.mergeAttributes(oFakeInput, false);
        this.MergeAttachedObjects(oFakeInput, oInput);
        this.MergeAttachedEvents(oFakeInput, oInput);

        oInput.setAttribute("State", "Filled");
        oParent.insertBefore(oInput, oFakeInput);
        oParent.removeChild(oFakeInput);
        
        var textFqn = oFakeInput.getAttribute("FieldDescriptorSourceTextFqn");
        if (typeof(textFqn) == "string")
        {
          var fd = FormDescriptor.GetFieldDescriptor(textFqn);
          if (fd != null)
          {
            if (fd.getAttribute("FieldType") == "dateTime")
            {
              var options = oInput.options;
              for (var i = 0, len = options.length; i < len; i++)
              {
                var option = options[i];
                dataField = new Object();
                dataField.text = Ilp.HtmlDom.GetText(option);
                option.text = this.ConvertWebDataToControlData(oInput, fd, dataField);
              }
            }
          }
        }
      }
    }
    
    return oInput;
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebControl_ReplaceFakeListBox", "");
  }
}

function WebControl_SetComboValue(oCombo, value, selectFirstEntry)
{
  try
  {
    var nSelectedIndex = -1;
    
    var options = oCombo.options;
    for (i = 0, len = options.length; i < len; i++)
    {
      if (options(i).value == value || ((options(i).value == "-1") && (value == null)))
      {
        nSelectedIndex = i;
        break;
      }
    }
    if (nSelectedIndex>-1)
    {
      oCombo.selectedIndex = nSelectedIndex;
    }
    else
    {
      if (selectFirstEntry == true)
      {
        if (oCombo.options.length > 0)
        {
          oCombo.selectedIndex = 0;
        }
      }
    }
    
    return oCombo;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_SetComboValue", "");
  }
}

function WebControl_SetListBoxValue(oListBox, value, selectFirstEntry)
{
  try
  {
    var nSelectedIndex = -1;
    
    var options = oListBox.options;
    for (i = 0, len = options.length; i < len; i++)
    {
      if (options(i).value == value || ((options(i).value == "") && (value == null)))
      {
        nSelectedIndex = i;
        break;
      }
    }
    if (nSelectedIndex > -1)
    {
      oListBox.selectedIndex = nSelectedIndex;
    }
    else
    {
      if (selectFirstEntry == true)
      {
        if (oListBox.options.length > 0)
        {
          oListBox.selectedIndex = 0;
        }
      }
    }
    
    return oListBox;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_SetListBoxValue", "");
  }
}

function WebControl_DeleteOption(oSelect, value)
{
  try
  {
    var nSelectedIndex = -1;
    
    var options = oSelect.options;
    for (i = 0, len = options.length; i < len; i++)
    {
      if (options(i).value == value || ((options(i).value == "") && (value == null)))
      {
        nSelectedIndex = i;
        break;
      }
    }
    
    if (nSelectedIndex > -1)
    {
      var oOption = oSelect.options.remove(nSelectedIndex);
    }
    
    return oSelect;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_DeleteOption", "");
  }
}

function WebControl_ConvertXmlDateToShortDate(xmlDateString, targetLanguage)
{
  try
  {
    if (targetLanguage == null)
    {
      targetLanguage = Language;
    }
    var datestring = "";
    // var dateregex=/^[ ]*[0]?(\d{4,})-(\d{1,2})-(\d{1,2})T(\d{1,2}):(\d{1,2}):(\d{1,2}).(\d{1,7})\+(\d{1,2}):(\d{1,2})[ ]*$/;
    var dateregex=/^[ ]*[0]?(\d{4,})-(\d{1,2})-(\d{1,2})T(\d{1,2}):(\d{1,2}):(\d{1,2}).(\d{1,7})[+-](\d{1,2}):(\d{1,2})[ ]*$|^[ ]*[0]?(\d{4,})-(\d{1,2})-(\d{1,2})T(\d{1,2}):(\d{1,2}):(\d{1,2})[+-](\d{1,2}):(\d{1,2})[ ]*$/;
    if(xmlDateString.length>0)
    {
      var match = xmlDateString.match(dateregex);
      var tmpdate = new Date(Number(match[1]), Number(match[2])-1, Number(match[3]), Number(match[4]), Number(match[5]), Number(match[6]));
      if (targetLanguage == "d" || targetLanguage == "de-DE" || targetLanguage == "f" || targetLanguage == "fr-FR")
      {
        datestring = String(tmpdate.getDate()) + "." + String(tmpdate.getMonth()+1) + "." + String(tmpdate.getFullYear());
      }
      else
      {
        datestring = String(tmpdate.getMonth()+1) + "/" + String(tmpdate.getDate()) + "/" + String(tmpdate.getFullYear());
      }
    }
    
    return datestring;  
  }
  catch(exception)
  {
    var extraInfo = "";
    if (xmlDateString != null)
    {
      extraInfo = xmlDateString;
    }
    WebMessage.SendClientLog(exception, "WebControl_ConvertXmlDateToShortDate", extraInfo);
  }
}

function WebControl_ConvertXmlDateToTime(xmlDateString, targetLanguage, includeMillisecs)
{
  try
  {
    targetLanguage = targetLanguage == null ? Language : targetLanguage;
    includeMillisecs = includeMillisecs == null ? false : includeMillisecs;
    
    var timestring = "";
    var dateregex=/^[ ]*[0]?(\d{4,})-(\d{1,2})-(\d{1,2})T(\d{1,2}):(\d{1,2}):(\d{1,2}).(\d{1,7})[+-](\d{1,2}):(\d{1,2})[ ]*$/;
    if(xmlDateString.length>0)
    {
      var match = xmlDateString.match(dateregex);
      
      var date = new Date(
        Number(match[1]),        // yy
        Number(match[2]) -1,     // MM
        Number(match[3]),         // dd
        Number(match[4]),         // hh
        Number(match[5]),         // mm
        Number(match[6]),         // ss
        Number(match[7]) / 10000);// ms
        
      if (targetLanguage == "d" || targetLanguage == "de-DE" || targetLanguage == "f" || targetLanguage == "fr-FR")
      {
        timestring += this.ZeroFill(date.getHours(), 2);
        timestring += ":";
        timestring += this.ZeroFill(date.getMinutes(), 2);
        timestring += ":";
        timestring += this.ZeroFill(date.getSeconds(), 2);
      }
      else
      {
        timestring += this.ZeroFill(date.getHours(), 2);
        timestring += ":";
        timestring += this.ZeroFill(date.getMinutes(), 2);
        timestring += ":";
        timestring += this.ZeroFill(date.getSeconds(), 2);
      }
      if (includeMillisecs == true)
      {
        timestring += ".";
        timestring += this.ZeroFill(date.getMilliseconds(), 3);
      }
    }
    
    return timestring;  
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebControl_ConvertXmlDateToTime", "");
  }
}

function WebControl_ConvertXmlDateToShortDateAndTime(xmlDateString, targetLanguage, includeMillisecs)
{
  try
  {
    var returnString = "";
    returnString += this.ConvertXmlDateToShortDate(xmlDateString, targetLanguage, includeMillisecs);
    returnString += " ";
    returnString += this.ConvertXmlDateToTime(xmlDateString, targetLanguage, includeMillisecs);
    
    return returnString;  
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebControl_ConvertXmlDateToShortDateAndTime", "");
  }
}

function WebControl_ConvertXmlDateToLongDate(xmlDateString)
{
  try
  {
    var datestring = "";
    dateregex=/^[ ]*[0]?(\d{1,4})-(\d{1,2})-(\d{1,2})T(\d{1,2}):(\d{1,2}):(\d{1,2}).(\d{1,7})[+-](\d{1,2}):(\d{1,2})[ ]*$/;
    if(xmlDateString.length>0){
      var match = xmlDateString.match(dateregex);
      var tmpdate = new Date(match[1], parseInt(match[2], 10)-1, match[3], match[4], match[5], match[6]);
      if (Language=="d" || Language=="de-DE" || Language=="f" || Language=="fr-FR")
      {
        datestring = String(tmpdate.getDate()) + "." + String(tmpdate.getMonth()+1) + "." + String(tmpdate.getFullYear()) + " " + String(match[4]) + ":" + String(match[5]) + ":" + String(match[6]);
      }
      else
      {
        datestring = String(tmpdate.getMonth()+1) + "/" + String(tmpdate.getDate()) + "/" + String(tmpdate.getFullYear()) + " " + String(match[4]) + ":" + String(match[5]) + ":" + String(match[6]);
      }
    }
    
    return datestring;  
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebControl_ConvertXmlDateToLongDate", "");
  }
}

function WebControl_ConvertXmlDateToDate(xmlDateString)
{
  try
  {
    var returnDate;
    dateregex=/^[ ]*[0]?(\d{1,4})-(\d{1,2})-(\d{1,2})T(\d{1,2}):(\d{1,2}):(\d{1,2}).(\d{1,7})[+-](\d{1,2}):(\d{1,2})[ ]*$/;
    if(xmlDateString.length>0)
    {
      var match = xmlDateString.match(dateregex);
      var returnDate = new Date(match[1], parseInt(match[2], 10)-1, match[3], match[4], match[5], match[6]);
    }
    
    return returnDate;  
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ConvertXmlDateToLongDate", "");
  }
}

function WebControl_ConvertWebDataToControlData(oControl, oFieldDescriptor, oDataField, controlTemplateWrapper, fdWrapper)
{
  try
  {
    if (oControl != null)
    {
      controlTemplateWrapper = controlTemplateWrapper == null ? WebControl.Controls.GetInstance(oControl) : controlTemplateWrapper;
    }
    if (controlTemplateWrapper == null)
    {
      controlTemplateWrapper = new Object();
      controlTemplateWrapper.ControlType = "none";
    }
    fdWrapper = fdWrapper == null ? WebControl.FieldDescriptors.GetInstance(oFieldDescriptor) : fdWrapper;
  
    var returnValue = "";
    var fieldValue = "";
    var tempText = "";
    var newDouble = 0;
    var zeroText = "";
    
    formatClass = fdWrapper.FormatClass;
    fieldType = fdWrapper.FieldType;
    decimalPlaces = fdWrapper.DecimalPlaces;
    zeroText = fdWrapper.ZeroText;
    
    var dataFieldText = oDataField == null ? "" : oDataField.text;
    switch(fieldType)
    {
      case "dateTime":
        if (oDataField == null)
        {
          returnValue = "";
        }
        else{
          if(dataFieldText.length == 0)
          {
            returnValue = "";
          }
          else
          {
            fieldValue = dataFieldText;
            switch(formatClass)
            {
              case "LongDate":
                returnValue = this.ConvertXmlDateToLongDate(fieldValue);
                break;
              case "ShortDateAndTime":
                returnValue = this.ConvertXmlDateToShortDateAndTime(fieldValue, Language, false);
                break;
              case "ShortDateAndTimeExact":
                returnValue = this.ConvertXmlDateToShortDateAndTime(fieldValue, Language, true);
                break;
              case "Time":
                returnValue = this.ConvertXmlDateToTime(fieldValue, Language, false);
                break;
              case "TimeExact":
                returnValue = this.ConvertXmlDateToTime(fieldValue, Language, true);
                break;
              default:
                returnValue = this.ConvertXmlDateToShortDate(fieldValue);
                break;
            }
          }
        }
        break;
      
      case "integer":
        switch(controlTemplateWrapper.ControlType)
        {
          case "DropDownList":
          case "ListBox":
      
            returnValue = -1;
            var comboOptions = oControl.options;
            if (oDataField == null)
            {
              if (comboOptions.length > 0){
                returnValue = 0;
              }
            }
            else
            {
              for (var k = 0, len = comboOptions.length; k < len; k++)
              {
                if (comboOptions[k].value == dataFieldText)
                {
                  returnValue = k;
                  break;
                }
              }
            }
            break;

          case "Image":

            if (oDataField == null)
            {
              returnValue = controlTemplateWrapper.FalseUrl;
            }
            else
            {
              if (dataFieldText == "1")
              {
                returnValue = controlTemplateWrapper.TrueUrl;
              }
              else if (dataFieldText == "0")
              {
                returnValue = controlTemplateWrapper.FalseUrl;
              }
            }  
            break;
            
          case "CheckBox":
            if (typeof(oFieldDescriptor.getAttribute("TrueValue")) == "string" || typeof(oFieldDescriptor.getAttribute("FalseValue")) == "string")
            {
              if (dataFieldText == oFieldDescriptor.getAttribute("TrueValue"))
              {
                returnValue = true;
              } 
              else 
              {
                returnValue = false;
              }
            }
            else
            {
              if (dataFieldText == "1")
              {
                returnValue = true;
              }
              else
              {
                returnValue = false;
              }
            }
            break;

          case "Label":
            if (controlTemplateWrapper.XMLSourceID.length > 0)
            {
              var oXml = null
              if (XmlVersion == enum_XmlVersion_V1) oXml = this.GetCurrentDocument().getElementById(controlTemplateWrapper.XMLSourceID);
              else oXml = Ilp.XmlCache.XmlCacheList.Get(controlTemplateWrapper.XMLSourceID);
              
              var oRecordSource = null;
              if (XmlVersion == enum_XmlVersion_V1) oRecordSource = WebData.GetRecordByFieldValue("NewDataSet/DropDownListSource.OptionValue", dataFieldText, oXml);
              else oRecordSource = WebData.GetRecordByFieldValue("/NewDataSet/DropDownListSource.OptionValue", dataFieldText, oXml);
            
              returnValue = WebData.GetFieldValue(oRecordSource, "DropDownListSource.OptionText");
            }
            else
            {
              if (oDataField == null)
              {
                returnValue = "";
              }
              else{
                returnValue = dataFieldText;
              }
            }
            break;
          default:  
            if (oDataField == null)
            {
              returnValue = "";
            }
            else{
              returnValue = dataFieldText;
            }
        }
        break;
      
      case "boolean":
        returnValue = false;
        if (oDataField == null)
        {
          if (controlTemplateWrapper.ControlType == "Image")
          {
            returnValue = controlTemplateWrapper.FalseUrl;
          }
          else if (controlTemplateWrapper.ControlType == "Label")
          {
            tempText = controlTemplateWrapper.NullText;
            if(tempText == "") tempText = controlTemplateWrapper.FalseText;
            if(tempText == "")
            {
              returnValue = this.ConvertBitToString("false");
            }
            else
            {
              returnValue = tempText;
            }
          }
        }
        else
        {
          if (controlTemplateWrapper.ControlType == "Label")
          {
            if (dataFieldText == "true")
            {
              tempText = controlTemplateWrapper.TrueText;
              if(tempText == "")
              {
                returnValue = this.ConvertBitToString("true");
              }
              else
              {
                returnValue = tempText;
              }
            }
            else
            {
              tempText = controlTemplateWrapper.FalseText;
              if(tempText == "")
              {
                returnValue = this.ConvertBitToString("false");
              }
              else
              {
                returnValue = tempText;
              }
            }
          }
          else if (controlTemplateWrapper.ControlType == "Image")
          {
            if (dataFieldText == "true")
            {
              returnValue = controlTemplateWrapper.TrueUrl;
            }
            else
            {
              returnValue = controlTemplateWrapper.FalseUrl;
            }
          }
          else
          {
            if (dataFieldText == "true" || dataFieldText == "1")
            {
              returnValue = true;
            }
          }
        }  
        break;
      
      case "decimal":
      case "double":
        if (oDataField == null)
        {
          returnValue = "";
        }
        else
        {
          if(dataFieldText=="NaN")
          {
            returnValue = "";
          }
          else
          {
            if(formatClass == "NumericDoubleX4")
            {
              newDouble = new Number(dataFieldText);
              tempText = newDouble.toFixed(4);
              returnValue = this.ConvertNumberStringToAppLocale(tempText);
            }
            else if(formatClass == "NumericInteger")
            {
              newDouble = new Number(dataFieldText);
              tempText = newDouble.toFixed(0);
              returnValue = this.ConvertNumberStringToAppLocale(tempText);
            }
            else if(formatClass == "NumericPrecision")
            {
              if (decimalPlaces.length > 0 && Number(decimalPlaces) > 0)
              {
                newDouble = Number(dataFieldText);
                tempText = newDouble.toPrecision(Number(decimalPlaces));
                returnValue = this.ConvertNumberStringToAppLocale(tempText);
              }
              else
              {
                returnValue = this.ConvertNumberStringToAppLocale(dataFieldText);
              }
            }
            else if(formatClass == "NumericExponential")
            {
              if (decimalPlaces.length > 0 && Number(decimalPlaces) > 0)
              {
                newDouble = Number(dataFieldText);
                tempText = newDouble.toExponential(Number(decimalPlaces));
                returnValue = this.ConvertNumberStringToAppLocale(tempText);
              }
              else
              {
                newDouble = Number(dataFieldText);
                tempText = newDouble.toExponential();
                returnValue = this.ConvertNumberStringToAppLocale(tempText);
              }
            }
            else if(formatClass == "NumericDouble")
            {
              if (decimalPlaces.length > 0 && Number(decimalPlaces) > 0)
              {
                newDouble = Number(dataFieldText);
                tempText = newDouble.toFixed(Number(decimalPlaces));
                returnValue = this.ConvertNumberStringToAppLocale(tempText);
              }
              else
              {
                returnValue = this.ConvertNumberStringToAppLocale(dataFieldText);
              }
            }
            else
            {
              if (decimalPlaces.length > 0)
              {
                newDouble = new Number(dataFieldText);
                tempText = newDouble.toFixed(Number(decimalPlaces));
                returnValue = this.ConvertNumberStringToAppLocale(tempText);
              }
              else
              {
                returnValue = this.ConvertNumberStringToAppLocale(dataFieldText);
              }
            }
            if (zeroText.length > 0 && new Number(dataFieldText) == 0)
            {
              returnValue = zeroText;
            }
          }
        }  
        break;
      
      default:
        if (oDataField == null)
        {
          returnValue = "";
        }
        else
        { 
          if (controlTemplateWrapper.ControlType == "DropDownList"
            || controlTemplateWrapper.ControlType == "ListBox")
          {
            returnValue = -1;
            var comboOptions = oControl.options;
            for (var k = 0, len = comboOptions.length; k < len; k++)
            {
              if (comboOptions[k].value == dataFieldText)
              {
                returnValue = k;
                break;
              }
            }   
          }   
          else
          {
            returnValue = dataFieldText;
          }
        }  
        break;
    }
  
    return returnValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ConvertWebDataToControlData", "")
  }
}

function WebControl_ConvertControlDataToWebData(oControl, oFieldDescriptor, index, property, controlValue)
{
  try
  { 
    var convertedValue = "";
    if (controlValue == null)
    {
      controlValue = this.GetValue(oControl, index, property);
    }  
    convertedValue = controlValue;

    oFieldDescriptor = oFieldDescriptor == null ? oControl.oFieldDescriptor : oFieldDescriptor;
      
    var fieldType = oFieldDescriptor.getAttribute("FieldType");
    if (fieldType == null)
    {
      fieldType = "";
    }
    var editClass = oFieldDescriptor.getAttribute("EditClass");
    if (editClass == null)
    {
      editClass = "";
    }
    
    var formatClass = oFieldDescriptor.getAttribute("FormatClass");
     if (formatClass == null)
    {
      formatClass = "";
    }
    
    switch(fieldType)
    {
      case "boolean":
        if (controlValue == "on" || controlValue == true || controlValue == "true")
        {
          convertedValue = "true";
        } 
        else 
        {
          convertedValue = "false";
        }
        break;

      case "dateTime":
        if (formatClass == "Time")
        {
          convertedValue = this.ConvertTimeToXmlDate(controlValue);
        }
        else
        {
          convertedValue = this.ConvertToXmlDate(controlValue);
        }
        break;

      case "integer":
        if (typeof(oFieldDescriptor.getAttribute("TrueValue")) == "string" || typeof(oFieldDescriptor.getAttribute("FalseValue")) == "string")
        {
          if (controlValue == "on" || controlValue == true)
          {
            convertedValue = (oFieldDescriptor.getAttribute("TrueValue") == null) ? "1" : oFieldDescriptor.getAttribute("TrueValue") * 1;
          } 
          else 
          {
            convertedValue = (oFieldDescriptor.getAttribute("FalseValue") == null) ? "0" : oFieldDescriptor.getAttribute("FalseValue") * 1;
          }
        }
        else
        {
          if (convertedValue.length > 0) convertedValue = String(convertedValue * 1);
        }
        break;
        
      case "decimal":
        convertedValue = this.ConvertAppLocaleToNumberString(controlValue);
        if (convertedValue.length > 0) convertedValue = String(convertedValue * 1);
        break;
        
      case "double":
        convertedValue = this.ConvertAppLocaleToNumberString(controlValue);
        if (convertedValue.length > 0) convertedValue = String(convertedValue * 1);
        break;

      default:
        convertedValue = controlValue;
        break;
    }
    
    return convertedValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ConvertControlDataToWebData", "Section1")
  }
}

function WebControl_GetBoundProperty(oControl)
{
  try
  {
    var property = null;
    
    var fqn = oControl.getAttribute("InnerTextFqn");
    if (typeof(fqn) == "string") property = BoundProperty_InnerText;
    
    if (typeof(fqn) != "string")
    {
      fqn = oControl.getAttribute("InnerHTMLFqn");
      if (typeof(fqn) == "string") property = BoundProperty_InnerHtml;
    }
    return property;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetBoundProperty", "Section1")
  }
}

function WebControl_BuildMarker(fqn, ct)
{
  try
  {
    return fqn + "_" + String(ct);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_BuildMarker", "Section1")
  }
}

function WebControl_GetMarker(oControl, args)
{
  try
  {
    if (args && args.MenuItem 
        && args.MenuItem.ClassType == "MenuItem")
    {
      marker = args.MenuItem.ItemName;
    }
    else
    {
      var marker = Ilp.HtmlDom.GetAttribute(oControl, "Marker", "");
      if (this.CheckString(marker) == 0) 
      {
        marker = Ilp.HtmlDom.GetAttribute(oControl, "FieldFqn", "");
      }
      if (this.CheckString(marker) == 0) 
      {
        marker = this.GetFqn(oControl);
      }
      if (this.CheckString(marker) == 0) 
      {
        var isStar = Ilp.HtmlDom.GetAttributeBool(oControl, "IsStar", false);
        if (isStar)
        {
          var ct = Ilp.HtmlDom.GetAttributeInt(oControl, "CT", 0);
          if (ct > 0)
          {
            var oSun = this.FindSun(oControl); 
            if (oSun)
            {
              marker = this.BuildMarker(this.GetFqn(oSun), ct);
            }
          }
        }
      }
    }
    return marker;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetMarker", "Section1")
  }
}

function WebControl_GetFqn(oControl)
{
  try
  {
    var fqn = oControl.getAttribute("FieldDescriptorFqn");
    if (fqn == null)
    {
      fqn = oControl.getAttribute("InnerTextFqn");
    }
    else
    {
      return fqn;
    }
    if (fqn == null)
    {
      fqn = oControl.getAttribute("ListFqn");
    }
    else
    {
      return fqn;
    }
    if (fqn == null)
    {
      fqn = oControl.getAttribute("InnerHTMLFqn");
    }
    else
    {
      return fqn;
    }
    if (fqn == null)
    {
      fqn = oControl.getAttribute("CheckedFqn");
    }
    else
    {
      return fqn;
    }
    if (fqn == null)
    {
      fqn = oControl.getAttribute("ValueFqn");
    }
    else
    {
      return fqn;
    }
    if (fqn == null)
    {
      fqn = oControl.getAttribute("SrcFqn");
    }
    else
    {
      return fqn;
    }
    if (fqn == null)
    {
      fqn = oControl.getAttribute("SearchFqn");
    }
    else
    {
      return fqn;
    }
    if (fqn == null)
    {
      fqn = oControl.getAttribute("PlaceHolderFqn");
    }
    else
    {
      return fqn;
    }
    if (fqn == null)
    {
      fqn = oControl.getAttribute("Fqn");
    }
    else
    {
      return fqn;
    }
    if (fqn == null)
    {
      fqn = oControl.getAttribute("DataTableRelationDescriptorFqn");
    }
    else
    {
      return fqn;
    }
    if (fqn == null)
    {
      fqn = oControl.getAttribute("TableDescriptorFqn");
    }
    else
    {
      return fqn;
    }
    if (fqn == null)
    {
      fqn = oControl.getAttribute("TrueFalseFqn");
    }
    return fqn;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetFqn", "Section1")
  }
}

function WebControl_GetTrackedFqn(oControl)
{
  try
  {
    var fqn = oControl.getAttribute("TrackedFqn")
    if (fqn == null) fqn = this.GetFqn(oControl);
  
    return fqn;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetTrackedFqn", "Section1")
  }
}

function WebControl_GetSearchFqn(oControl)
{
  try
  {
    var fqn = oControl.getAttribute("SearchFqn");
    if (typeof(fqn) != "string")
    {
      fqn = oControl.getAttribute("InnerTextFqn");
    }
    return fqn;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetSearchFqn", "Section1")
  }
}

function WebControl_GetTableDescriptorFqn(oControl)
{
  try
  {
    var fqn = oControl.getAttribute("TableDescriptorFqn");
    if (typeof(fqn) != "string")
    {
      var dtrdFqn = oControl.getAttribute("DataTableRelationDescriptorFqn");
      if (typeof(dtrdFqn) == "string")
      {
        var dtrd = FormDescriptor.GetDataTableRelationDescriptor(dtrdFqn);
        fqn = dtrd.getAttribute("TableDescriptorFqnDetail");
      }
    }
    return fqn;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetTableDescriptorFqn", "Section1", this.GetTableDescriptorFqn)
  }
}

function WebControl_GetBoundValue(oControl)
{
  try
  {
    var fqn = oControl.getAttribute("FieldDescriptorFqn");
    if (typeof(fqn) != "string")
    {
      fqn = oControl.getAttribute("InnerTextFqn");
    }
    if (typeof(fqn) != "string")
    {
      fqn = oControl.getAttribute("InnerHTMLFqn");
    }
    if (typeof(fqn) != "string")
    {
      fqn = oControl.getAttribute("CheckedFqn");
    }
    return WebData.GetFieldValue(oControl.oRecord, fqn);
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebControl_GetBoundValue", "Section1")
  }
}

function WebControl_GetBoundIDValue(oControl)
{
  try
  {
    return WebData.GetFieldValue(oControl.oRecord, oControl.getAttribute("FieldDescriptorIDFqn"));
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebControl_GetBoundIDValue", "Section1")
  }
}

function WebControl_GetBoundNameValue(oControl)
{
  try
  {
    return WebData.GetFieldValue(oControl.oRecord, oControl.getAttribute("FieldDescriptorNameFqn"));
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebControl_GetBoundNameValue", "Section1")
  }
}

function WebControl_GetValueFromType(oControl)
{
  try
  {
    var controlValue = "";
    switch(oControl.type)
    {
      case "textbox":
        controlValue = oControl.value;
        break;

      case "checkbox":
        controlValue = oControl.checked;
        break;

      case "radio":
        controlValue = oControl.value;
        break;

      default:
        controlValue = oControl.value;
        break;
    }
    
    return controlValue;
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebControl_GetValueFromType", "");
  }
}

function WebControl_GetValue(oControl, index, property)
{
  try
  {
    if (Ilp) return Ilp.Util.GetValue(oControl, index, property);
    
    var controlValue = "";
    switch(oControl.getAttribute("ControlType"))
    {
      case "Label":
        controlValue = Ilp.HtmlDom.GetText(oControl);
        break;

      case "TextBox":
        controlValue = oControl.value;
        break;

      case "Panel":
        controlValue = oControl.innerHTML;
        break;

      case "CheckBox":
        controlValue = oControl.checked;
        break;

      case "RadioButton":
        controlValue = oControl.value;
        break;

      case "ListBox":
      case "DropDownList":
      
        if (typeof(property) != "string") property = "value";
        
        if (typeof(index) == "number")
        {
          if (index > -1 && index < oControl.options.length)
          {
            if (property == "text")
            {
              controlValue = oControl.options(index).text;
            }
            else
            {
              controlValue = oControl.options(index).value;
            }
          }  
        }
        else
        {
          if (oControl.selectedIndex > -1)
          {
            if (property == "text")
            {
              controlValue = oControl.options(oControl.selectedIndex).text;
            }
            else
            {
              controlValue = oControl.options(oControl.selectedIndex).value;
            }  
          }
        }  
        break;

      default:
        controlValue = oControl.value;
        break;
    }
    
    return controlValue;
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebControl_GetValue", "");
  }
}

function WebControl_SetValue(oControl, controlValue, updateBinding, property)
{
  try
  {
    updateBinding = updateBinding == null ? true : updateBinding;
    property = property == null ? BoundProperty_InnerText : property;
    switch(oControl.getAttribute("ControlType"))
    {
      case "Label":
        if (property == BoundProperty_InnerHtml)
        {
          oControl.innerHTML = controlValue;
        }
        else if (property == BoundProperty_Title)
        {
          oControl.title = controlValue;
        }
        else if (property == BoundProperty_None)
        {
        }
        else
        {
          Ilp.HtmlDom.SetText(oControl, controlValue);
        }
        break;

      case "DataLink":
        Ilp.HtmlDom.SetText(oControl, controlValue);
        break;

      case "TextBox":
        oControl.value = controlValue;
        break;

      case "CheckBox":
        oControl.checked = controlValue;
        break;

      case "Image":
        oControl.src = controlValue;
        break;

      case "DropDownList":
        oControl.selectedIndex = controlValue;
        break;

      case "RadioButton":
        if (oControl.value == controlValue)
        {
          oControl.checked = true;
        }
        else
        {
          oControl.checked = false;
        }  
        break;

      case "Panel":
        if (property == BoundProperty_InnerHtml)
        {
          oControl.innerHTML = controlValue;
        }
        else
        {
          Ilp.HtmlDom.SetText(oControl, controlValue);
        }
        break;

      default:
        oControl.value = controlValue;
        break;
    }
    
    if (updateBinding == true && oControl.oRecord != null)
    {
      var fqn = "";
      var fieldValue = "";
      var oFieldDescriptor = null;
      
      fqn = oControl.getAttribute("InnerTextFqn");
      if (typeof(fqn) == "string")
      {
        oFieldDescriptor = FormDescriptor.GetFieldDescriptor(fqn);
        fieldValue = this.ConvertControlDataToWebData(oControl, oFieldDescriptor);
        WebData.SetFieldValue(oControl.oRecord, fqn, fieldValue);
      }  
      fqn = oControl.getAttribute("InnerHTMLFqn");
      if (typeof(fqn) == "string")
      {
        oFieldDescriptor = FormDescriptor.GetFieldDescriptor(fqn);
        fieldValue = this.ConvertControlDataToWebData(oControl, oFieldDescriptor);
        WebData.SetFieldValue(oControl.oRecord, fqn, controlValue);
      }  
      fqn = oControl.getAttribute("CheckedFqn");
      if (typeof(fqn) == "string")
      {
        oFieldDescriptor = FormDescriptor.GetFieldDescriptor(fqn);
        fieldValue = this.ConvertControlDataToWebData(oControl, oFieldDescriptor);
        WebData.SetFieldValue(oControl.oRecord, fqn, fieldValue);
      }
    }  
    
    return controlValue;
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebControl_SetValue", "");
  }
}

function WebControl_ValidateTBody(oTBody)
{
  try
  {
    this.HideValidationSummary();
    
    var oElements = oTBody.ClientBoundControlArray;
    this.ValidateElements(oElements);

    this.ShowValidationSummary();
    
    return (this.WebMessageDescriptorList.Count() == 0);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ValidateTBody", "Section1")
  }
}

function WebControl_CollectValidators()
{
  try
  {
    this.WebFormValidators = new Array();
    if (typeof(this.CurrentWindow.WebFormValidators) != "undefined")
    {
      for (var i = 0; i < this.CurrentWindow.WebFormValidators.length; i++)
      {
        this.WebFormValidators[i] = this.GetCurrentDocument().getElementById(this.CurrentWindow.WebFormValidators[i]);
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_CollectValidators", "Section1")
  }
}

function WebControl_EvaluteValidators()
{
  try
  {
    var oValidator = null;
    var oElement = null;
    var oElements = new Array();
    
    this.HideValidationSummary();
    
    for (var i = 0; i < this.WebFormValidators.length; i++)
    {
      oValidator = this.WebFormValidators[i];
      var id = this.CreateUniqueClientId(oValidator.oRecord, oValidator.getAttribute("ControlToValidate"));
      oElement = this.GetCurrentDocument().getElementById(id);
      oElement.oValidator = oValidator;
      oElement.oValidator.IsValid = true;
      Ilp.HtmlDom.SetStyle(oElement, "visibility", "hidden");
      if (typeof(oValidator.getAttribute("ValidationClass")) == "string")
      {
        oElement.setAttribute("ValidationClass", oValidator.getAttribute("ValidationClass"));
      }
      if (typeof(oValidator.getAttribute("ValidationMessage")) == "string")
      {
        oElement.setAttribute("ValidationMessage", oValidator.getAttribute("ValidationMessage"));
      }
      oElements[oElements.length] = oElement;
    }
    
    this.ValidateElements(oElements);
    
    for (var i = 0, len = oElements.length; i < len; i++)
    {
      oElement = oElements[i];
      if (oElement.oValidator.IsValid == false)
      {
        Ilp.HtmlDom.SetStyle(oElement, "visibility", "visible");
      }  
    }    
    
    this.ShowValidationSummary();
    
    return (this.WebMessageDescriptorList.Count() == 0);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_EvaluteValidators", "Section1")
  }
}

function WebControl_ValidateForm(oDomStructur)
{
  try
  {
    var toBeValidated = false;
    var tagNames = new Array("INPUT", "SELECT", "TEXTAREA");
    
    this.HideValidationSummary();
    
    for (var i = 0, len = tagNames.length; i < len; i++)
    {
      var oAllElements = oDomStructur.getElementsByTagName(tagNames[i]);
      var oElements = new Array();
      
      for (var j = 0, len1 = oAllElements.length; j < len1; j++)
      {
        toBeValidated = true;
        if (oAllElements[j].readOnly == true && oAllElements[j].getAttribute("AllwaysDisabled") != "true")
        {
          toBeValidated = false;
        }
        if (typeof(oAllElements[j].getAttribute("ValidationLevel")) == "string" && oAllElements[j].getAttribute("ValidationLevel") == "ValidateOnRecordLevel")
        {
          toBeValidated = false;
        }
        
        if (tagNames[i] == "INPUT")
        {
          if (oAllElements[j].type != "text")
          {
            toBeValidated = false;
          }
        }
        
        if (toBeValidated == true && this.IsVisible(oAllElements[j], false) == true) oElements[oElements.length] = oAllElements[j];
      }
            
      if (oDomStructur.JsInstance && oDomStructur.JsInstance.ClassType && oDomStructur.JsInstance.ClassType == "WebSpreadSheetClass")
      {
        for (var j = 0, len = oElements.length; j < len; j++)
        {
          oElement = oElements[j];
          Ilp.Event.GetEventParams(oElement, oElement);
        }
      }
      this.ValidateElements(oElements);
    }

    if(this.WebMessageDescriptorList.Count() > 0)
    {
      var oControl = this.WebMessageDescriptorList.Get(0).oControl;
      if (oControl != null && oControl.tagName == "INPUT" && oControl.type == "text" || oControl.tagName == "SELECT")
      {
        this.FireEvent(oControl, "onfocus");
        // wg. ReplaceFakeCombo !
        if (oControl.tagName == "SELECT") oControl = this.WebMessageDescriptorList.Get(0).oControl;
        this.ShowValidatedControl(oControl, true);
      }
      this.ShowValidationSummary();
    }
    
    return (this.WebMessageDescriptorList.Count() == 0);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ValidateForm", "Section1")
  }
}

function WebControl_ValidateElements(oElements)
{
  try
  {
    var message = "";
    var valid = false;
    var oElement = null;
    
    for (var j = 0, len = oElements.length; j < len; j++)
    {
      oElement = oElements[j];
      
      var performValidation = true;
      if (Ilp.HtmlDom.GetStyle(oElement, "display") == "none" && typeof(oElement.getAttribute("DisplayIf")) == "string")
      {
        performValidation = false;
      }
      
      if (performValidation == true)
      {
        var oFieldDescriptor = oElement.oFieldDescriptor;
        
        if (oFieldDescriptor == null)
        {
          var fieldDescriptorFqn = oElement.getAttribute("FieldDescriptorFqn");
          
          if (typeof(fieldDescriptorFqn) == "string")
          {
            var oFieldDescriptor = FormDescriptor.GetFieldDescriptor(fieldDescriptorFqn);
          }
        }

        if(typeof(oElement.getAttribute("ValidationClass"))=="string" || oFieldDescriptor != null)
        {
          var validationClass;
          var fieldType = "";
          
          if (oFieldDescriptor == null || typeof(oElement.getAttribute("ValidationClass")) == "string") 
          {
            validationClass = oElement.getAttribute("ValidationClass");
          } 
          else 
          {
            validationClass = oFieldDescriptor.getAttribute("ValidationClass") == null ? "" : oFieldDescriptor.getAttribute("ValidationClass");
            fieldType = oFieldDescriptor.getAttribute("FieldType")
          }
          
          var hasInputValidator = this.HasInputValidator(oElement);
          
          if (hasInputValidator == true)
          {
            this.HideInputValidator(oElement);
          }
          else
          {
            /*
            if (oElement.runtimeStyle.backgroundColor.length > 0 && oElement.runtimeStyle.backgroundColor != this.BackgroundColorNoChange)
            */
            var backgroundColor = Ilp.HtmlDom.GetStyle(oElement, "backgroundColor");
            if (backgroundColor.length > 0 && backgroundColor != this.BackgroundColorNoChange)
            {
              if (oElement.getAttribute("AllwaysDisabled") != "true")
              {
                this.SetBackgroundColor(oElement, this.BackgroundColorNoChange);
              }
            }
          }
          var validIf = oElement.getAttribute("ValidIf");
          if ((String("integer$decimal$double$dateTime").indexOf(fieldType) > -1) || (validationClass != "None" && validationClass != "") || (validIf && validIf.length > 0))
          {
            var webMessageDescriptor = this.ValidateInput(oElement, oFieldDescriptor);
            if(webMessageDescriptor.Valid == false)
            {
               this.WebMessageDescriptorList.Add(webMessageDescriptor);
              
              if (hasInputValidator == true)
              {
                this.ShowInputValidator(oElement, message);
              }
              else
              {
                this.SetBackgroundColor(oElement, this.BackgroundColorWrongInput);
                if (typeof(oElement.oValidator) == "object")
                {
                  oElement.oValidator.IsValid = false;
                }
              }
            }
          }
        }
      }
    }
    
    this.ValidationOK = (this.WebMessageDescriptorList.Count() == 0);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ValidateElements", "Section1")
  }
}

function WebControl_ValidateInput(oControl, oFieldDescriptor, typeValidationOnly)
{
  try
  {
    // this.ReturnIf = (Number(WebControl.ConvertAppLocaleToNumberString(webData)) < Number(WebData.GetFieldValue(oControl.oRecord, "WebControlTest.TextBoxExtendedFloatBoundary")))
    
    var validationClass = "";
    var validationMessage = "";
    var formatClass = "";
    var minValue = "";
    var maxValue = "";
    var webMessageDescriptor = new WebMessageDescriptor(oControl.oContainerInstance, oControl, oFieldDescriptor, "", true);

    if (this.IsDisabled(oControl) == true) return webMessageDescriptor;
    
    typeValidationOnly = typeValidationOnly == null ? false : typeValidationOnly;
    
    if (oFieldDescriptor == null || typeof(oControl.getAttribute("ValidationClass")) == "string")
    {
      validationClass = oControl.getAttribute("ValidationClass");
    }
    else
    {
      validationClass = oFieldDescriptor.getAttribute("ValidationClass");
    }
    
    
    
    if (oFieldDescriptor != null)
    {
      minValue = oFieldDescriptor.getAttribute("MinValue");
      maxValue = oFieldDescriptor.getAttribute("MaxValue");
      formatClass = oFieldDescriptor.getAttribute("FormatClass");
    }

    if (oFieldDescriptor == null || typeof(oControl.getAttribute("ValidationMessage")) == "string")
    {
      validationMessage = oControl.getAttribute("ValidationMessage");
    }
    else
    {
      validationMessage = oFieldDescriptor.getAttribute("ValidationMessage");
    }
    validationMessage = validationMessage == null ? "" : validationMessage;

    var controlValue = this.GetValue(oControl);
    
    var args = new EventArgs();
    var oTarget = oControl;
    var oRecord = oControl.oRecord;
    var validIf = oControl.getAttribute("ValidIf");
    if (typeof(validIf) == "string")
    {
      if (validIf.length > 0)
      {
        eval(validIf);
        if (this.ReturnIf == false)
        {
          if (args.ShowMessage == true)
          {
            webMessageDescriptor.Message = validationMessage == "" ? ids_SomeInputIsWrong : validationMessage;
          }
          webMessageDescriptor.Valid = false;
        }
      }
    }

    // "" * 1 = 0
    // "1,00" * 1 = NaN
    if (webMessageDescriptor.Valid == true)
    {
      if (oFieldDescriptor != null)
      {
        switch (oFieldDescriptor.getAttribute("FieldType"))
        {
          case "string":
          case "nString":
            var fieldLength = oFieldDescriptor.getAttribute("FieldLength");
            if (controlValue.length > Number(fieldLength))
            {
              webMessageDescriptor.Message = ids_InputToLong.replace("{0}", fieldLength);
              webMessageDescriptor.Valid = false;
            }
            break;
          case "dateTime":
            if(controlValue != "")
            {   
              if (formatClass == "Time")
              {
                if (this.CheckTime(controlValue) == false)
                {
                  webMessageDescriptor.Message = validationMessage == "" ? ids_NoValidTime : validationMessage;
                  webMessageDescriptor.Valid = false;
                }
              }
              else if (formatClass == "ShortDateAndTimeExact")
              {
                if (this.CheckDateAndTimeExact(controlValue) == false)
                {
                  webMessageDescriptor.Message = validationMessage == "" ? ids_NoValidTime : validationMessage;
                  webMessageDescriptor.Valid = false;
                }
              }
              else
              {
                if (this.CheckDate(controlValue) == false)
                {
                  webMessageDescriptor.Message = validationMessage == "" ? ids_NoValidDate : validationMessage;
                  webMessageDescriptor.Valid = false;
                }
              }
            }
            break;

          case "integer":
            if(controlValue != "")
            {        
              if (oControl.getAttribute("ControlType") != "CheckBox")
              {
                if (this.CheckInteger(controlValue) == false)
                {
                  webMessageDescriptor.Message = validationMessage == "" ? ids_NoValidInteger : validationMessage;
                  webMessageDescriptor.Valid = false;
                }
                if (webMessageDescriptor.Valid == true && this.CheckMinMax(controlValue, minValue, maxValue) == false)
                {
                  var tempMessage = ids_NoValidRange.replace("{1}", minValue);
                  tempMessage = tempMessage.replace("{2}", maxValue);
                  webMessageDescriptor.Message = validationMessage == "" ? tempMessage : validationMessage;
                  webMessageDescriptor.Valid = false;
                }
              }
            }        
            break;

          case "decimal":
            if(controlValue != "")
            {        
              if (this.CheckNumeric(controlValue) == false)
              {
                webMessageDescriptor.Message = validationMessage == "" ? ids_NoValidNumber : validationMessage;
                webMessageDescriptor.Valid = false;
              }
              if (webMessageDescriptor.Valid == true && this.CheckMinMax(controlValue, minValue, maxValue) == false)
              {
                var tempMessage = ids_NoValidRange.replace("{1}", minValue);
                tempMessage = tempMessage.replace("{2}", maxValue);
                webMessageDescriptor.Message = validationMessage == "" ? tempMessage : validationMessage;
                webMessageDescriptor.Valid = false;
              }
            }        
            break;

          case "double":
            if(controlValue != "")
            {        
              if (this.CheckNumeric(controlValue) == false)
              {
                webMessageDescriptor.Message = validationMessage == "" ? ids_NoValidDouble : validationMessage;
                webMessageDescriptor.Valid = false;
              }
              if (webMessageDescriptor.Valid == true && this.CheckMinMax(controlValue, minValue, maxValue) == false)
              {
                var tempMessage = ids_NoValidRange.replace("{1}", minValue);
                tempMessage = tempMessage.replace("{2}", maxValue);
                webMessageDescriptor.Message = validationMessage == "" ? tempMessage : validationMessage;
                webMessageDescriptor.Valid = false;
              }
            }        
            break;
        }
      }
    }  
    
    if (webMessageDescriptor.Valid == true && typeof(validationClass) == "string" && typeValidationOnly == false)
    {
      switch(validationClass)
      {
        case "NotEmpty":
        case "InternalName":
          switch(oControl.tagName)
          {
            case "INPUT":
              var controlValueString = new String(controlValue);
              if (oControl.type == "text")
              {
                if (controlValueString.length == 0 || controlValueString.trim() == "")
                {
                  webMessageDescriptor.Message = validationMessage == "" ? ids_NotEmpty_Message : validationMessage;
                  webMessageDescriptor.Valid = false;
                }
              }
              break;
                
            case "TEXTAREA":
              if (controlValue == "")
              {
                webMessageDescriptor.Message = validationMessage == "" ? ids_NotEmpty_Message : validationMessage;
                webMessageDescriptor.Valid = false;
                controlValue = this.GetValue(oControl);
              }
              break;
                
            case "SELECT":
              if(controlValue == -1)
              {
                webMessageDescriptor.Message = validationMessage == "" ? ids_NotEmpty_Message : validationMessage;
                webMessageDescriptor.Valid = false;
              }
              break;  
          }  
          break;

        case "NoEmptyString":
          var controlValueString = new String(controlValue);
          switch(oControl.tagName)
          {
            case "INPUT":
              if (oControl.type == "text")
              {
                if (controlValueString.length > 0 && controlValueString.trim() == "")
                {
                  webMessageDescriptor.Message = validationMessage == "" ? ids_NoEmptyString : validationMessage;
                  webMessageDescriptor.Valid = false;
                }
              }
              break;
                
            case "TEXTAREA":
              if (controlValueString.length > 0 && controlValueString.trim() == "")
              {
                webMessageDescriptor.Message = validationMessage == "" ? ids_NoEmptyString : validationMessage;
                webMessageDescriptor.Valid = false;
                controlValue = this.GetValue(oControl);
              }
              break;
                
          }  
          break;

        case "GT0":
          switch(oControl.tagName)
          {
            case "INPUT":
              if (oControl.type == "text")
              {
                controlValue = this.ConvertAppLocaleToNumberString(controlValue);
                if (controlValue * 1 <= 0 || (isNaN(controlValue * 1) == true))
                {
                  webMessageDescriptor.Message = validationMessage == "" ? ids_NoValidGT0 : validationMessage;
                  webMessageDescriptor.Valid = false;
                }
              }
              break;
          }  
          break;
          
        case "ValidEnum":
          switch(oControl.tagName)
          {
            case "INPUT":
              if (oControl.type == "text")
              {
                controlValue = this.ConvertAppLocaleToNumberString(controlValue);
                if (controlValue * 1 <= 0 || (isNaN(controlValue * 1) == true))
                {
                  webMessageDescriptor.Message = validationMessage == "" ? ids_NoValidEnum : validationMessage;
                  webMessageDescriptor.Valid = false;
                }
              }
              break;
          }  
          break;

        case "ValidDateAndTime":
        case "ValidDateAndTimeOrEmpty":
          switch(oControl.tagName)
          {
            case "INPUT":
              if (oControl.type == "text")
              {
                if (controlValue == "")
                {
                  if (validationClass == "ValidDateAndTime")
                  {
                    webMessageDescriptor.Message = validationMessage == "" ? ids_NoValidDate : validationMessage;
                    webMessageDescriptor.Valid = false;
                  }  
                }
                else
                {
                  if (this.CheckDateAndTime(controlValue) == false)
                  {
                    webMessageDescriptor.Message = validationMessage == "" ? ids_NoValidDate : validationMessage;
                    webMessageDescriptor.Valid = false;
                  }
                }
              }
              break;
          }  
          break;
  
        case "ValidDate":
        case "ValidDateOrEmpty":
          switch(oControl.tagName)
          {
            case "INPUT":
              if (oControl.type == "text")
              {
                if (controlValue == "")
                {
                  if (validationClass == "ValidDate")
                  {
                    webMessageDescriptor.Message = validationMessage == "" ? ids_NoValidDate : validationMessage;
                    webMessageDescriptor.Valid = false;
                  }  
                }
                else
                {
                  if (this.CheckDate(controlValue) == false)
                  {
                    webMessageDescriptor.Message = validationMessage == "" ? ids_NoValidDate : validationMessage;
                    webMessageDescriptor.Valid = false;
                  }
                }
              }
              break;
          }  
          break;
        
        case "ValidTime":
         switch(oControl.tagName)
         {
            case "INPUT":
              if (oControl.type == "text")
              {
                if (controlValue == "")
                {
                  if (validationClass == "ValidTime")
                  {
                    webMessageDescriptor.Message = validationMessage == "" ? ids_NoValidTime : validationMessage;
                    webMessageDescriptor.Valid = false;
                  }  
                }
                else
                {
                  if (this.CheckTime(controlValue) == false)
                  {
                    webMessageDescriptor.Message = validationMessage == "" ? ids_NoValidTime : validationMessage;
                    webMessageDescriptor.Valid = false;
                  }
                }
              }
              break;
          }  
          break;

        case "ValidDoubleENOrEmpty":
        case "ValidDoubleEN":
        case "ValidDoubleOrEmpty":
        case "ValidDouble":
          switch(oControl.tagName)
          {
            case "INPUT":
              if (oControl.type == "text")
              {
                if (controlValue == "")
                {
                  if (validationClass == "ValidDouble" || validationClass == "ValidDoubleEN")
                  {
                    webMessageDescriptor.Message = validationMessage == "" ? ids_NoValidDouble : validationMessage;
                    webMessageDescriptor.Valid = false;
                  }
                }
                else
                {
                  if (validationClass == "ValidDoubleEN" || validationClass == "ValidDoubleENOrEmpty")
                  {
                    controlValue = this.ConvertAppLocaleToNumberString(controlValue, "en-US");
                  }
                  else
                  {
                    controlValue = this.ConvertAppLocaleToNumberString(controlValue);
                  }
                  if (controlValue == "" || (isNaN(controlValue * 1) == true))
                  {
                    webMessageDescriptor.Message = validationMessage == "" ? ids_NoValidDouble : validationMessage;
                    webMessageDescriptor.Valid = false;
                  }
                }
              }
              break;
          }  
          break;

        case "ValidDoubleENOrEmpty":
        case "ValidDoubleEN":
          if (this.CheckNumeric(controlValue, "en-US") == false)
          {
            webMessageDescriptor.Message = validationMessage == "" ? ids_NoValidDouble : validationMessage;
            webMessageDescriptor.Valid = false;
          }
          break;
          
        case "ValidDoubleGT0":
          switch(oControl.tagName)
          {
            case "INPUT":
              if (oControl.type == "text")
              {
                controlValue = this.ConvertAppLocaleToNumberString(controlValue);
                if (controlValue * 1 <= 0 || (isNaN(controlValue * 1) == true))
                {
                  webMessageDescriptor.Message = validationMessage == "" ? ids_NoValidDoubleGT0 : validationMessage;
                  webMessageDescriptor.Valid = false;
                }
              }
              break;
          }  
          break;

        case "ValidDoubleNot0":
          switch(oControl.tagName)
          {
            case "INPUT":
              if (oControl.type == "text")
              {
                controlValue = this.ConvertAppLocaleToNumberString(controlValue);
                if (controlValue * 1 == 0 || (isNaN(controlValue * 1) == true))
                {
                  webMessageDescriptor.Message = validationMessage == "" ? ids_NoValidDoubleNot0 : validationMessage;
                  webMessageDescriptor.Valid = false;
                }
              }
              break;
          }  
          break;

        case "ValidInteger":
          switch(oControl.tagName)
          {
            case "INPUT":
              if (oControl.type == "text")
              {               
                if (this.CheckInteger(controlValue) == false)
                {
                  webMessageDescriptor.Message = validationMessage == "" ? ids_NoValidInteger : validationMessage;
                  webMessageDescriptor.Valid = false;
                }
              }
              break;
          }  
          break;

        case "ValidIntegerGT0":
          switch(oControl.tagName)
          {
            case "INPUT":
              if (oControl.type == "text")
              {
                if (this.CheckInteger(controlValue) == false || controlValue * 1 <= 0)
                {
                  webMessageDescriptor.Message = validationMessage == "" ? ids_NoValidIntegerGT0 : validationMessage;
                  webMessageDescriptor.Valid = false;
                }
              }
              break;
          }  
          break;
          
          
        case "ValidIntegerGT0OrEmpty":
          switch(oControl.tagName)
          {
            case "INPUT":
              if (oControl.type == "text")
              {
                if (controlValue.length > 0)
                {
                  if (this.CheckInteger(controlValue) == false || controlValue * 1 <= 0)
                  {
                    webMessageDescriptor.Message = validationMessage == "" ? ids_NoValidIntegerGT0 : validationMessage;
                    webMessageDescriptor.Valid = false;
                  }
                }
              }
              break;
          }  
          break;

        case "ValidIntegerNot0":
          switch(oControl.tagName)
          {
            case "INPUT":
              if (oControl.type == "text")
              {
                if (this.CheckInteger(controlValue) == false || controlValue * 1 == 0)
                {
                  webMessageDescriptor.Message = validationMessage == "" ? ids_NoValidIntegerNot0 : validationMessage;
                  webMessageDescriptor.Valid = false;
                }
              }
              break;
          }  
          break;
          
        case "NotNull":
          switch(oControl.tagName)
          {
            case "INPUT":
              if (oControl.type == "text")
              {
                if (controlValue == "")
                {
                  webMessageDescriptor.Message = validationMessage == "" ? ids_NotEmpty_Message : validationMessage;
                  webMessageDescriptor.Valid = false;
                }
              }  
              break;
                
            case "SELECT":
              if(controlValue != "" && (controlValue == -1 || controlValue == 0))
              {
                webMessageDescriptor.Message = validationMessage == "" ? ids_NotEmpty_Message : validationMessage;
                webMessageDescriptor.Valid = false;
              }
              break;
                
          }  
          break;
          
        case "ValidEmail":
          if (oControl.tagName == "INPUT" || oControl.tagName == "TEXTAREA")
          {
            if (oControl.type == "text" || oControl.type == "textarea")
            {
              var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
              var aControlValue = controlValue.split(";");
              for (var i = 0, len = aControlValue.length; i < len; i++)
              {
                controlValue = String(aControlValue[i]);
                if (!filter.test(controlValue.trim()))
                {
                  webMessageDescriptor.Message = validationMessage == "" ? ids_NotValidEmail_Message : validationMessage;
                  webMessageDescriptor.Valid = false;
                  break;
                }
              }
            }  
          }  
          break;
          
        case "ValidEmailOrEmpty":
          if (oControl.tagName == "INPUT" || oControl.tagName == "TEXTAREA")
          {
            if (oControl.type == "text" || oControl.type == "textarea")
            {
              if (controlValue.length > 0)
              {
                var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
                var aControlValue = controlValue.split(";");
                for (var i = 0, len = aControlValue.length; i < len; i++)
                {
                  controlValue = String(aControlValue[i]);
                  if (!filter.test(controlValue.trim()))
                  {
                    webMessageDescriptor.Message = validationMessage == "" ? ids_NotValidEmail_Message : validationMessage;
                    webMessageDescriptor.Valid = false;
                    break;
                  }
                }  
              }
            }    
          }  
          break;
          
        case "ValidUsername":
          switch(oControl.tagName)
          {
            case "INPUT":
              if (oControl.type == "text")
              {
                var filter  = /.{6,}/;
                if ( ! filter.test(controlValue.trim()))
                {
                  webMessageDescriptor.Message = validationMessage == "" ? ids_NotValidUsername_Message : validationMessage;
                  webMessageDescriptor.Valid = false;
                  break;
                }
              }  
              break;
                
          }  
          break;
          
       case "ValidPassword":
          switch(oControl.tagName)
          {
            case "INPUT":
              if (oControl.type == "text")
              {
               //var filter  = /(?=.{8,})(?=(.*\d){1,})(?=(.*\W){1,})(?=\w*[a-z])(?=\w*[A-Z])/;
                var condition1 = /.{8,}/;
                var condition2 = /(.*\d){1,}/;
                var condition3 = /(.*\W){1,}/;
                var condition4 = /\w*[a-z]/;
                var condition5 = /\w*[A-Z]/;
                
                if ( ! (condition1.test(controlValue) 
                     && condition2.test(controlValue) 
                     && condition3.test(controlValue) 
                     && condition4.test(controlValue) 
                     && condition5.test(controlValue)))
                {
                  webMessageDescriptor.Message = validationMessage == "" ? ids_NotValidPassword_Message : validationMessage;
                  webMessageDescriptor.Valid = false;
                  break;
                }
              }  
              break;
                
          }  
          break;
          
      }    
    }

    return webMessageDescriptor;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ValidateInput", "Section1")
  }
}

function WebControl_CheckMinMax(value, minValue, maxValue){
  try
  {
    var returnValue = true;
    var value = this.ConvertAppLocaleToNumberString(value);
    
    if (minValue != "")
    {
      if (Number(value) < Number(minValue))
      {
        returnValue = false;
      }
    }

    if (maxValue != "")
    {
      if (Number(value) > Number(maxValue))
      {
        returnValue = false;
      }
    }
    
    return returnValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_CheckMinMax", "Section1")
  }
}


function WebControl_CheckDate(strDate)
{
  try
  {
    bRet = this.CheckDateAndTime(strDate);
    if (bRet == false)
    { 
      // versuchs nur mit dem Datumsanteil
      if(strDate && strDate.length > 0)
      {
        if (Language=="d" || Language=="de-DE" || Language=="f" || Language=="fr-FR")
        {
          var dateregex=/^[ ]*[0]?(\d{1,2})\.(\d{1,2})\.(\d{4,4})[ ]*$/;
          var match=strDate.match(dateregex);
          if (match){
            var tmpdate;
            tmpdate=new Date(match[3],parseInt(match[2],10)-1,match[1]);
            if (tmpdate.getDate()==parseInt(match[1],10) && tmpdate.getFullYear()==parseInt(match[3],10) && (tmpdate.getMonth()+1)==parseInt(match[2],10)){ 
              bRet = true; 
            }
          }  
        }
        else
        {
          var dateregex=/^[ ]*[0]?(\d{1,2})\/(\d{1,2})\/(\d{4,4})[ ]*$/;
          var match=strDate.match(dateregex);
          if (match){
            var tmpdate;
            tmpdate=new Date(match[3],parseInt(match[1],10)-1,match[2]);
            if (tmpdate.getDate()==parseInt(match[2],10) && tmpdate.getFullYear()==parseInt(match[3],10) && (tmpdate.getMonth()+1)==parseInt(match[1],10)){ 
              bRet = true; 
            }
          }  
        }
      }
    }
    return bRet;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_CheckDate", "")
  }
}

function WebControl_CheckDateAndTime(strDate)
{
  try
  {
    bRet = false; 
    if(strDate && strDate.length > 0)
    {
      if (Language=="d" || Language=="de-DE" || Language=="f" || Language=="fr-FR")
      {
        var dateregex=/^[ ]*[0]?(\d{1,2})\.(\d{1,2})\.(\d{4,4})[ ](\d{1,2}):(\d{1,2}):(\d{1,2})[ ]*$/;
        var match=strDate.match(dateregex);
        if (match){
          var tmpdate;
          tmpdate=new Date(match[3],parseInt(match[2],10)-1,match[1],match[4],match[5],match[6]);
          if (   tmpdate.getDate() == parseInt(match[1],10) 
              && tmpdate.getFullYear() == parseInt(match[3],10) 
              && (tmpdate.getMonth()+1) == parseInt(match[2],10)
              && (tmpdate.getHours()) == parseInt(match[4],10)
              && (tmpdate.getMinutes()) == parseInt(match[5],10)
              && (tmpdate.getSeconds()) == parseInt(match[6],10)
              )
          { 
            bRet = true; 
          }
        }  
      }
      else
      {
        var dateregex=/^[ ]*[0]?(\d{1,2})\/(\d{1,2})\/(\d{4,})[ ](\d{1,2}):(\d{1,2}):(\d{1,2})[ ]*$/;
        var match=strDate.match(dateregex);
        if (match){
          var tmpdate;
          tmpdate=new Date(match[3],parseInt(match[1],10)-1,match[2],match[4],match[5],match[6]);
          if (   tmpdate.getDate()==parseInt(match[2],10) 
              && tmpdate.getFullYear()==parseInt(match[3],10) 
              && (tmpdate.getMonth()+1)==parseInt(match[1],10)
              && (tmpdate.getHours()) == parseInt(match[4],10)
              && (tmpdate.getMinutes()) == parseInt(match[5],10)
              && (tmpdate.getSeconds()) == parseInt(match[6],10)
              )
          { 
            bRet = true; 
          }
        }  
      }
    }
    return bRet;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_CheckDateAndTime", "")
  }
}

function WebControl_CheckDateAndTimeExact(strDate)
{
  try
  {
    bRet = false; 
    if(strDate.length > 0)
    {
      if (Language=="d" || Language=="de-DE" || Language=="f" || Language=="fr-FR")
      {
        var dateregex=/^[ ]*[0]?(\d{1,2})\.(\d{1,2})\.(\d{4,4})[ ](\d{1,2}):(\d{1,2}):(\d{1,2}).(\d{1,3})[ ]*$/;
        var match=strDate.match(dateregex);
        if (match){
          var tmpdate;
          tmpdate=new Date(match[3],parseInt(match[2],10)-1,match[1],match[4],match[5],match[6],match[7]);
          if (   tmpdate.getDate() == parseInt(match[1],10) 
              && tmpdate.getFullYear() == parseInt(match[3],10) 
              && (tmpdate.getMonth()+1) == parseInt(match[2],10)
              && (tmpdate.getHours()) == parseInt(match[4],10)
              && (tmpdate.getMinutes()) == parseInt(match[5],10)
              && (tmpdate.getSeconds()) == parseInt(match[6],10)
              && (tmpdate.getMilliseconds()) == parseInt(match[7],10)
              )
          { 
            bRet = true; 
          }
        }  
      }
      else{
        var dateregex=/^[ ]*[0]?(\d{1,2})\/(\d{1,2})\/(\d{4,})[ ](\d{1,2}):(\d{1,2}):(\d{1,2}).(\d{1,3})[ ]*$/;
        var match=strDate.match(dateregex);
        if (match){
          var tmpdate;
          tmpdate=new Date(match[3],parseInt(match[1],10)-1,match[2],match[4],match[5],match[6],match[7]);
          if (   tmpdate.getDate()==parseInt(match[2],10) 
              && tmpdate.getFullYear()==parseInt(match[3],10) 
              && (tmpdate.getMonth()+1)==parseInt(match[1],10)
              && (tmpdate.getHours()) == parseInt(match[4],10)
              && (tmpdate.getMinutes()) == parseInt(match[5],10)
              && (tmpdate.getSeconds()) == parseInt(match[6],10)
              && (tmpdate.getMilliseconds()) == parseInt(match[7],10)
              )
          { 
            bRet = true; 
          }
        }  
      }
    }
    return bRet;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_CheckDateAndTimeExact", "")
  }
}


function WebControl_CheckTime(time)
{
  try
  {
    var ret = false; 
    if(time.length > 0)
    {  
      var hhmm = time.split(":");
      if (hhmm.length == 2)
      {
        time += ":00";
      }
      var timeregex = /^[ ]*[0]?(\d{1,2}):(\d{1,2}):(\d{1,2})[ ]*$/;
      var match = time.match(timeregex);
      if (match)
      {
        var nowdate = new Date();
        var tmpdate = new Date(nowdate.getFullYear(),nowdate.getMonth(),nowdate.getDate(),match[1],match[2],match[3]);
      
        if ( 
                (tmpdate.getHours()) == parseInt(match[1],10)
            && (tmpdate.getMinutes()) == parseInt(match[2],10)
            && (tmpdate.getSeconds()) == parseInt(match[3],10)
            )
        { 
          ret = true; 
        }
      }  
    }
    return ret;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_CheckTime", "")
  }
}



function WebControl_CheckInteger(strNumber){
  try{
    var objRegExp = /(^[-,+]?\d\d*$)/;
    
    return objRegExp.test(strNumber);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_CheckInteger", "");
  }
}


function WebControl_CheckNumeric(strNumber, targetLanguage)
{
  try
  {
    //7.7226653915747535E-06
    targetLanguage = targetLanguage == null ? Language : targetLanguage;
    var objRegExp = null;
    
    if (targetLanguage == "d" || targetLanguage == "de-DE" || targetLanguage == "f" || targetLanguage == "fr-FR")
    {
      objRegExp  = /(^(?:[-+])?\d\d*\,\d*$)|(^(?:[-+])?\d\d*\,\d*[Ee](?:[-+])?\d*$)|(^(?:[-+])?\d\d*$)|(^(?:[-+])?\d\d*[Ee](?:[-+])?\d+$)/;
    }
    else
    {
      objRegExp  = /(^(?:[-+])?\d\d*\.\d*$)|(^(?:[-+])?\d\d*\.\d*[Ee](?:[-+])?\d*$)|(^(?:[-+])?\d\d*$)|(^(?:[-+])?\d\d*[Ee](?:[-+])?\d+$)/;
    }  

    return objRegExp.test(strNumber);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_CheckNumeric", "")
  }
}

function WebControl_CheckPrice(priceValue, targetLanguage)
{
  try
  {
    if (this.CheckNumeric(priceValue, targetLanguage) == true)
    {
      if(priceValue == null) priceValue = 0;
      else priceValue *= 1;
    }
    else priceValue = 0;
    
    return priceValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_CheckPrice", "")
  }
}

function WebControl_CheckID(idValue)
{
  try
  {
    if (this.CheckInteger(idValue) == true)
    {
      if(idValue == null) idValue = 0;
      else idValue *= 1;
    }
    else idValue = 0;
    
    return idValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_CheckID", "")
  }
}

function WebControl_CheckString(stringValue)
{
  try
  {
    if (typeof(stringValue) == "string")
    {
      if (stringValue && stringValue.length > 0)
      {
        return stringValue.length;
      }
    }
    return 0;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_CheckString", "")
  }
}

function WebControl_ConvertToJavaScriptType(valueString, fieldType)
{
  try
  {
    var returnValue = "";
    switch(fieldType)
    {
      case "boolean":
        if (valueString == "1" || valueString == "true")
        {
          returnValue = true;
        }
        else
        {
          returnValue = false;
        }
        break;
        
      default:
        returnValue = valueString;
    }
    
    return returnValue;    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ConvertBitToString", "Section1")
  }
}

function WebControl_ConvertToInt(intString)
{
  try
  {
    return intString*1;    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ConvertToInt", "Section1")
  }
}

function WebControl_ConvertBitToString(bitString)
{
  try
  {
    if (bitString == "1" || bitString == "true")
    {
      if (Language == "d" || Language == "de-DE")
      {
        return "Ja";
      }
      else if (Language == "f" || Language == "fr-FR")
      {
        return "Qui";
      }
      else
      {
        return "Yes";
      }  
    }
    else
    {
      if (Language == "d" || Language == "de-DE")
      {
        return "Nein";
      }
      else if (Language == "f" || Language == "fr-FR")
      {
        return "Non";
      }
      else
      {
        return "No";

      }  
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ConvertBitToString", "Section1")
  }
}

function WebControl_ConvertAppLocaleToNumberString(numberToConvert)
{
  try
  {  
    var sValue = new String(numberToConvert);
    
    if (Language == "d" || Language == "de-DE" || Language == "f" || Language == "fr-FR")
    {
      // ersetzte Komma durch Punkt
      var re = new RegExp("[\,]","ig");
      sValue = sValue.replace(re, "$"); 

      var re = new RegExp("[\.]","ig");
      sValue = sValue.replace(re, ""); 
      
      var re = new RegExp("[\$]","ig");
      sValue = sValue.replace(re, "."); 
    }
    else
    {
      // ersetzte Komma durch nichts
      var re = new RegExp("[\,]","ig");
      sValue = sValue.replace(re, ""); 
    }
    return sValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ConvertAppLocaleToNumberString", "")
  }
}

function WebControl_CheckDotNumber(numberToConvert){
  try
  {  
    return this.ConvertAppLocaleToNumberString(numberToConvert);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_CheckDotNumber", "")
  }
}

function WebControl_ConvertNumberStringToAppLocale(numberString, targetLanguage)
{
  try
  {
    var returnString = numberString;
    
    targetLanguage = targetLanguage == null ? Language : targetLanguage;
    
    if (targetLanguage == "d" || targetLanguage == "de-DE" || targetLanguage == "f" || targetLanguage == "fr-FR")
    {
      // ersetzte Punkt durch Komma
      var re = new RegExp("[\.]","ig");
      returnString = returnString.replace(re, "$"); 

      var re = new RegExp("[\,]","ig");
      returnString = returnString.replace(re, "."); 
      
      var re = new RegExp("[\$]","ig");
      returnString = returnString.replace(re, ","); 
    }
    else
    {
      // ersetzte Komma durch nichts
      //var re = new RegExp("[\,]","ig");
      //returnString = returnString.replace(re, ""); 
    }
    return returnString;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ConvertNumberStringToAppLocale", "")
  }
}

function WebControl_ConvertDateToString(date, useTime, useMilliseconds)
{
  try
  {
    var datestring = "";
    if (Language=="d" || Language=="de-DE" || Language=="f" || Language=="fr-FR"){
      datestring = String(date.getDate()) + "." + String(date.getMonth()+1,2) + "." + String(date.getFullYear());
    }
    else{
      datestring = String(date.getMonth()+1,2) + "/" + String(date.getDate()) + "/" + String(date.getFullYear());
    }
    
    useTime = useTime == null ? false : useTime;
    if (useTime == true)
    {
      datestring += " ";
      datestring += this.ZeroFill(date.getHours(),2);
      datestring += ":";
      datestring += this.ZeroFill(date.getMinutes(),2);
      datestring += ":";
      datestring += this.ZeroFill(date.getSeconds(),2);
    }
    useMilliseconds = useMilliseconds == null ? false : useMilliseconds;
    if (useMilliseconds == true)
    {
      datestring += ".";
      datestring += this.ZeroFill(date.getMilliseconds());
      datestring += "0000";
    }
        
    return datestring; 
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ConvertDateToString", "")
  }
}

function WebControl_ConvertDateStringToDate(strDate)
{
  try
  {
    var dateObject = null;
    var dateregex = "";
    if (this.CheckDate(strDate))
    {
      if (Language=="d" || Language=="de-DE" || Language=="f" || Language=="fr-FR")
      {
        dateregex=/^[ ]*[0]?(\d{1,2})\.(\d{1,2})\.(\d{4,})[ ]*$/;
        if(strDate.length>0){
          var match=strDate.match(dateregex);
          var tmpdate;
          dateObject = new Date(match[3],parseInt(match[2],10)-1,match[1]);
        }  
      }
      else
      {
        dateregex=/^[ ]*[0]?(\d{1,2})\/(\d{1,2})\/(\d{4,})[ ]*$/;
        if(strDate.length>0){
          var match=strDate.match(dateregex);
          var tmpdate;
          dateObject = new Date(match[3],parseInt(match[1],10)-1,match[2]);
        }  
      }
    }  
    return dateObject; 
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ConvertDateStringToDate", "")
  }
}

function WebControl_ConvertUTCDateToShortDate(date)
{
  try
  {
    var sRet = "";
    if (sFiledate!="" && sFiledate!=null){
      sFiledate = unescape(sFiledate);
      var dDate = new Date(sFiledate);
      if (Language=="d" || Language=="de-DE" || Language=="f" || Language=="fr-FR")
      {
        sRet = String(dDate.getDate()) + "." + String(dDate.getMonth()+1) + "." + String(dDate.getFullYear());
      }
      else
      {
        sRet = String(dDate.getMonth()+1) + "/" + String(dDate.getDate()) + "/" + String(dDate.getFullYear());
      }
    }
    
    return sRet;  
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ConvertUTCDateToShortDate", "")
  }
}

function WebControl_ConvertToXmlDate(strDate)
{
  try{
    var datestring = "";
    var dateregex = "";
    var match = "";
    var tmpdate = null;
    if (Language=="d" || Language=="de-DE" || Language=="f" || Language=="fr-FR")
    {
      if(strDate.length > 0)
      {
        dateregex=/^[ ]*[0]?(\d{1,2})\.(\d{1,2})\.(\d{4,4})[ ](\d{1,2}):(\d{1,2}):(\d{1,2}).(\d{1,3})*$/;
        match = strDate.match(dateregex);
        if (match)
        {
          tmpdate = new Date(match[3],parseInt(match[2],10)-1,match[1],match[4],match[5],match[6],match[7]);
          datestring = this.ConvertDateToXmlDate(tmpdate, true);
        }
        else
        {
          dateregex=/^[ ]*[0]?(\d{1,2})\.(\d{1,2})\.(\d{4,4})[ ](\d{1,2}):(\d{1,2}):(\d{1,2})*$/;
          match = strDate.match(dateregex);
          if (match)
          {
            tmpdate = new Date(match[3],parseInt(match[2],10)-1,match[1],match[4],match[5],match[6]);
            datestring = this.ConvertDateToXmlDate(tmpdate, true);
          }
          else
          {
            dateregex=/^[ ]*[0]?(\d{1,2})\.(\d{1,2})\.(\d{4,})[ ]*$/;
            match = strDate.match(dateregex);
            if (match)
            {
              tmpdate = new Date(match[3],parseInt(match[2],10)-1,match[1]);
              datestring = this.ConvertDateToXmlDate(tmpdate);
            }  
          }  
        }  
      }  
    }
    else
    {
      if(strDate.length > 0)
      {
        dateregex=/^[ ]*[0]?(\d{1,2})\/(\d{1,2})\/(\d{4,})[ ](\d{1,2}):(\d{1,2}):(\d{1,2}).(\d{1,3})*$/;
        match = strDate.match(dateregex);
        if (match)
        {
          tmpdate = new Date(match[3],parseInt(match[1],10)-1,match[2],match[4],match[5],match[6],match[7]);
          datestring = this.ConvertDateToXmlDate(tmpdate, true);
        }
        else
        {
          dateregex=/^[ ]*[0]?(\d{1,2})\/(\d{1,2})\/(\d{4,})[ ](\d{1,2}):(\d{1,2}):(\d{1,2})*$/;
          match = strDate.match(dateregex);
          if (match)
          {
            tmpdate = new Date(match[3],parseInt(match[1],10)-1,match[2],match[4],match[5],match[6]);
            datestring = this.ConvertDateToXmlDate(tmpdate, true);
          }
          else
          {
            dateregex=/^[ ]*[0]?(\d{1,2})\/(\d{1,2})\/(\d{4,})[ ]*$/;
            match = strDate.match(dateregex);
            if (match)
            {
              tmpdate = new Date(match[3],parseInt(match[1],10)-1,match[2]);
              datestring = this.ConvertDateToXmlDate(tmpdate);
            }  
          }  
        }  
      }  
    }
    return datestring; 
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ConvertToXmlDate", "")
  }
}

function WebControl_ConvertTimeToXmlDate(time)
{
  try
  {
    var date = new Date();
    var xmlDate = "";
    
    var hhmm = time.split(":");
    if (hhmm.length == 2)
    {
      time += ":00";
    }
    var timeregex = /^[ ]*[0]?(\d{1,2}):(\d{1,2}):(\d{1,2})*$/;
    var match = time.match(timeregex);
    if (match)
    {
      xmlDate = this.ConvertDateToXmlDate(new Date(date.getYear(), date.getMonth(), date.getDate(), match[1], match[2], match[3]), true);
    }
    return xmlDate; 
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ConvertTimeToXmlDate", "")
  }
}

function WebControl_ConvertDateToXmlDate(date, useTime)
{
  try
  {
    var xmlDate = "";
    
    useTime = useTime == null ? false : useTime;
    
    //2003-06-30T00:00:00.0000000+02:00
    xmlDate = this.ZeroFill(date.getFullYear(),4) + "-" + this.ZeroFill(date.getMonth()+1,2) + "-" + this.ZeroFill(date.getDate(),2);
    if (useTime == false)
    {
      xmlDate += "T00:00:00.0000000";
    }
    else
    {
      xmlDate += "T";
      xmlDate += this.ZeroFill(date.getHours(),2);
      xmlDate += ":";
      xmlDate += this.ZeroFill(date.getMinutes(),2);
      xmlDate += ":";
      xmlDate += this.ZeroFill(date.getSeconds(),2);
      xmlDate += ".";
      xmlDate += this.ZeroFill(date.getMilliseconds());
      xmlDate += "0000";
    }
    
    if (date.getTimezoneOffset() < 0)
    {
      xmlDate += "+";
    }
    else
    {
      xmlDate += "-";
    }
    xmlDate += this.ZeroFill(parseInt(Math.abs(date.getTimezoneOffset())/60), 2);
    xmlDate += ":";
    xmlDate += this.ZeroFill(Math.abs(date.getTimezoneOffset())%60, 2);

    return xmlDate; 
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ConvertDateToXmlDate", "")
  }
}

function WebControl_ZeroFill(input, length)
{
  try
  {
    input = "" + input;
    while (input.length < length)
    {
      input = "0" + input;
    }
    return input;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ZeroFill", "")
  }
}

function WebControl_FillWith(input, length, filler)
{
  try
  {
    input = "" + input;
    while (input.length < length)
    {
      input = input + filler;
    }
    return input;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_FillWith", "")
  }
}

function WebControl_RemoveAllChildren(oElement)
{
  try
  {
    var oChild = null;
    while (oElement.children.length > 0)
    {
      oChild = oElement.children[0];
      oChild = oElement.removeChild(oChild);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_RemoveAllChildren", "Section1")
  }
}

function WebControl_AddTBody(oTable, oTBody, oRefTBody)
{
  try
  {
    var oFirstTBody = null;
    var returnTBody = null;
    if (oTable.tagName == "TABLE")
    {
      oFirstTBody = oTable.tBodies[0];
      if (oTable.tBodies.length == 1 && oFirstTBody.innerHTML == "")
      {
        if (false)
        {
          var newTBody = this.GetCurrentDocument().createElement("TBODY");
          returnTBody = oTable.appendChild(newTBody);
          returnTBody.innerHTML = oTBody.innerHTML;
          oTable.removeChild(oFirstTBody);
        }
        else
        {
          var newTBody = oTBody.cloneNode(true);
          
          returnTBody = oTable.appendChild(newTBody);
          oTable.removeChild(oFirstTBody);
        }
      }
      else
      {
        var newTBody = oTBody.cloneNode(true);
        if (oRefTBody != null)
        {
          returnTBody = oTable.insertBefore(newTBody, oRefTBody);
        }
        else
        {
          if (false)
          {
            var newTBody = this.GetCurrentDocument().createElement("TBODY");
            returnTBody = oTable.appendChild(newTBody);
            returnTBody.innerHTML = oTBody.innerHTML;
          }
          else
          {
            returnTBody = oTable.appendChild(newTBody);
          }  
        }
      }
    }
    
    return returnTBody;  
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_AddTBody", "Section1")
  }
}

function WebControl_RemoveTBodies(oTable)
{
  try
  {
    var oTBody = null;
    var count = 0;
    if (oTable.tagName == "TABLE")
    {
      
      var tBodyCount = oTable.tBodies.length;
      for (var i = 0; i < tBodyCount; i++)
      {
        oTBody = oTable.tBodies[i];
        oTBody.id = "Trash";
        oTBody.name = "Trash";
        count = oTBody.rows.length;
        for (var j = count-1; j >= 0; j--)
        {
          oTBody.deleteRow(j);
        }
      }
      
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_RemoveTBodies", "Section1")
  }
}

function WebControl_GetDomElementByAttributeValue(oDomRoot, attribute, value)
{
  try
  {
    var children     = null;
    var queue        = new WebQueue();
    var webDomItem   = new WebDomItem(oDomRoot, oDomRoot);
    var element      = null;
    var elementFound = null;
    queue.Enqueue(webDomItem);
    
    while(queue.Count() > 0)
    {   
      webDomItem  = queue.Dequeue();
      element     = webDomItem.oDomElement;
      
      if (element.getAttribute(attribute) == value)
      {
        elementFound = element;
        break;
      }
      
      children = element.children;
      for (var i = 0, len = children.length; i < len; i++)
      {
        webDomItem = new WebDomItem(oDomRoot, children[i]);
        queue.Enqueue(webDomItem);
      }  
    }    

    return elementFound;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetDomElementByAttributeValue", "Section1")
  }
}

function WebControl_GetDomElementById(oDomStructure, id)
{
  try
  {
    var i = 0;
    var oElement = null;
    
    if(oDomStructure!=null)
    {
      while(i < oDomStructure.children.length)
      {
        if(oDomStructure.children[i].id == id)
        {
          oElement = oDomStructure.children[i];
          break;
        }
        else{
          oElement = WebControl_GetDomElementById(oDomStructure.children[i], id);
          if (oElement != null)
          {
            break;
          }
        }
        i++;
      }
    }
    return oElement;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetDomElementById", "Section1")
  }
}

function WebControl_GetDomElementByName(oDomStructure, name)
{
  try
  {
    var i = 0;
    var oElement = null;
    
    if(oDomStructure!=null)
    {
      while(i < oDomStructure.children.length)
      {
        if(oDomStructure.children[i].name == name || oDomStructure.children[i].id == name)
        {
          oElement = oDomStructure.children[i];
          break;
        }
        else{
          oElement = WebControl_GetDomElementByName(oDomStructure.children[i], name);
          if (oElement != null)
          {
            break;
          }
        }
        i++;
      }
    }
    return oElement;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetDomElementByName", "Section1")
  }
}

function WebControl_GetDomElementByTagName(oDomStructure, name)
{
  try
  {
    var i = 0;
    var oElement = null;
    
    if(oDomStructure!=null)
    {
      while(i < oDomStructure.children.length)
      {
        if(oDomStructure.children[i].tagName == name)
        {
          oElement = oDomStructure.children[i];
          break;
        }
        else
        {
          oElement = WebControl_GetDomElementByTagName(oDomStructure.children[i], name);
          if (oElement != null)
          {
            break;
          }
        }
        i++;
      }
    }
    return oElement;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetDomElementByTagName", "Section1")
  }
}

function WebControl_MarkTemplateElements(oDomStructure, tagNames)
{
  try
  {
    var i = 0;
    var oElement = null;
    
    if(oDomStructure != null)
    {
      oDomStructure.IsTemplateElement = false;
      if(tagNames.indexOf(oDomStructure.tagName) > -1)
      {
        oDomStructure.IsTemplateElement = true;
      }
      while(i < oDomStructure.children.length)
      {
        oElement = oDomStructure.children[i];
        oElement.IsTemplateElement = false;
        if(tagNames.indexOf(oElement.tagName) > -1)
        {
          oElement.IsTemplateElement = true;
        }
        if (oElement.children.length)
        {
          WebControl_MarkTemplateElements(oElement, tagNames);
        }
        i++;
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_MarkTemplateElements", "Section1")
  }
}

function WebControl_FindSearchControls(oDomRoot, oDomStructure)
{
  try
  {
    var i = 0;
    var oElement = null;
    
    if(oDomStructure != null)
    {
      if (oDomRoot == oDomStructure)
      {
        if(oDomStructure.getAttribute("IsSearchControl") == "true")
        {
          oDomRoot.SearchControlArray[oDomRoot.SearchControlArray.length] = oDomStructure;
        }
        if(oDomStructure.getAttribute("IsExpertSearch") == "true")
        {
          oDomRoot.ExpertSearchArray[oDomRoot.ExpertSearchArray.length] = oDomStructure;
        }
      }  
      
      while(i < oDomStructure.children.length)
      {
        oElement = oDomStructure.children[i];
        
        if (oElement.tagName != "TR" && oElement.tagName != "TD")
        {
          if(oElement.getAttribute("IsSearchControl") == "true")
          {
            oDomRoot.SearchControlArray[oDomRoot.SearchControlArray.length] = oElement;
          }
          if(oElement.getAttribute("IsExpertSearch") == "true")
          {
            oDomRoot.ExpertSearchArray[oDomRoot.ExpertSearchArray.length] = oElement;
          }
        }
        if (oElement.children.length)
        {
          if (oElement.getAttribute("IsDetailContainer") != "true")
          {
            WebControl_FindSearchControls(oDomRoot, oElement);
          }
        }
        i++;
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_FindSearchControls", "Section1")
  }
}

function WebControl_FindNamingIDControls(oDomRoot, oWebDataGrid)
{
  try
  {
    oDomRoot.ClientBoundControlArray = new Array();
    var oElements = null;
    var oElement = null;

    oElements = oDomRoot.getElementsByTagName("INPUT");
    for (var i = 0, len = oElements.length; i < len; i++)
    {
      oElement = oElements[i];
      if(oElement.getAttribute("NamingID") == oWebDataGrid.ClientID)
      {
        oDomRoot.ClientBoundControlArray[oDomRoot.ClientBoundControlArray.length] = oElement;
      }
    }
    oElements = oDomRoot.getElementsByTagName("SELECT");
    for (var i = 0, len = oElements.length; i < len; i++)
    {
      oElement = oElements[i];
      if(oElement.getAttribute("NamingID") == oWebDataGrid.ClientID)
      {
        oDomRoot.ClientBoundControlArray[oDomRoot.ClientBoundControlArray.length] = oElement;
      }
    }
    oElements = oDomRoot.getElementsByTagName("IMG");
    for (var i = 0, len = oElements.length; i < len; i++)
    {
      oElement = oElements[i];
      if(oElement.getAttribute("NamingID") == oWebDataGrid.ClientID)
      {
        oDomRoot.ClientBoundControlArray[oDomRoot.ClientBoundControlArray.length] = oElement;
      }
    }
    oElements = oDomRoot.getElementsByTagName("DIV");
    for (var i = 0, len = oElements.length; i < len; i++)
    {
      oElement = oElements[i];
      if(oElement.getAttribute("NamingID") == oWebDataGrid.ClientID)
      {
        oDomRoot.ClientBoundControlArray[oDomRoot.ClientBoundControlArray.length] = oElement;
      }
    }
    oElements = oDomRoot.getElementsByTagName("SPAN");
    for (var i = 0, len = oElements.length; i < len; i++)
    {
      oElement = oElements[i];
      if(oElement.getAttribute("NamingID") == oWebDataGrid.ClientID)
      {
        oDomRoot.ClientBoundControlArray[oDomRoot.ClientBoundControlArray.length] = oElement;
      }
    }
    oElements = oDomRoot.getElementsByTagName("MARQUEE");
    for (var i = 0, len = oElements.length; i < len; i++)
    {
      oElement = oElements[i];
      if(oElement.getAttribute("NamingID") == oWebDataGrid.ClientID)
      {
        oDomRoot.ClientBoundControlArray[oDomRoot.ClientBoundControlArray.length] = oElement;
      }
    }
    oElements = oDomRoot.getElementsByTagName("TEXTAREA");
    for (var i = 0, len = oElements.length; i < len; i++)
    {
      oElement = oElements[i];
      if(oElement.getAttribute("NamingID") == oWebDataGrid.ClientID)
      {
        oDomRoot.ClientBoundControlArray[oDomRoot.ClientBoundControlArray.length] = oElement;
      }
    }
    oElements = oDomRoot.getElementsByTagName("A");
    for (var i = 0, len = oElements.length; i < len; i++)
    {
      oElement = oElements[i];
      if(oElement.getAttribute("NamingID") == oWebDataGrid.ClientID)
      {
        oDomRoot.ClientBoundControlArray[oDomRoot.ClientBoundControlArray.length] = oElement;
      }
    }
    oElements = oDomRoot.getElementsByTagName("IFRAME");
    for (var i = 0, len = oElements.length; i < len; i++)
    {
      oElement = oElements[i];
      if(oElement.getAttribute("NamingID") == oWebDataGrid.ClientID)
      {
        oDomRoot.ClientBoundControlArray[oDomRoot.ClientBoundControlArray.length] = oElement;
      }
    }
    oElements = oDomRoot.getElementsByTagName("TABLE");
    for (var i = 0, len = oElements.length; i < len; i++)
    {
      oElement = oElements[i];
      if(oElement.getAttribute("NamingID") == oWebDataGrid.ClientID)
      {
        oDomRoot.ClientBoundControlArray[oDomRoot.ClientBoundControlArray.length] = oElement;
      }
    }    
    oElements = oDomRoot.getElementsByTagName("FIELDSET");
    for (var i = 0, len = oElements.length; i < len; i++)
    {
      oElement = oElements[i];
      if(oElement.getAttribute("NamingID") == oWebDataGrid.ClientID)
      {
        oDomRoot.ClientBoundControlArray[oDomRoot.ClientBoundControlArray.length] = oElement;
      }
    }    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_FindNamingIDControls", "Section1")
  }
}

function WebControl_FindClientBoundControls(oDomRoot, oDomStructure)
{
  try
  {
    var localArray  = oDomRoot.ClientBoundControlArray;
    var index       = localArray.length;
    var children    = null;
    var queue       = new WebQueue();
    var webDomItem  = new WebDomItem(oDomRoot, oDomStructure);
    var element     = null;
    var exclude     = false;
    queue.Enqueue(webDomItem);
    
    while(queue.Count() > 0)
    {   
      webDomItem  = queue.Dequeue();
      element     = webDomItem.oDomElement;
      
      if (element.getAttribute("ClientBound") == "true")
      {
        localArray[index++] = element;
      }
      
      exclude = false;
      if (exclude == false) exclude = element.getAttribute("ControlType") == "WebDataGridContainer";
      if (exclude == false) exclude = element.getAttribute("ControlType") == "WebColumnGridContainer";
      if (exclude == false) exclude = element.getAttribute("ControlType") == "WebTreeViewContainer2";
      if (exclude == false) exclude = element.getAttribute("ControlType") == "NavTree";
      if (exclude == false)
      {
        children = element.children;
        for (var i = 0, len = children.length; i < len; i++)
        {
          webDomItem = new WebDomItem(oDomRoot, children[i]);
          queue.Enqueue(webDomItem);
        }  
      }
    }    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_FindClientBoundControls", "Section1")
  }
}

function WebControl_GetFirstInputElement(oDomRoot, oDomStructure)
{
  try
  {
    var children    = null;
    var queue       = new WebQueue();
    var webDomItem  = new WebDomItem(oDomRoot, oDomStructure);
    var element     = null;
    var exclude     = false;
    queue.Enqueue(webDomItem);
    
    while(queue.Count() > 0)
    {   
      webDomItem  = queue.Dequeue();
      element     = webDomItem.oDomElement;
      
      if (element.tagName == "INPUT" || element.tagName == "SELECT")
      {
        if(element.getAttribute("ClientBound") == "true")
        {
          oDomRoot.FirstInputElement = element;
          break;
        }
      }
      
      exclude = false;
      if (exclude == false) exclude = element.getAttribute("ControlType") == "WebDataGridContainer";
      if (exclude == false) exclude = element.getAttribute("ControlType") == "WebTreeViewContainer2";
      if (exclude == false)
      {
        children = element.children;
        for (var i = 0, len = children.length; i < len; i++)
        {
          webDomItem = new WebDomItem(oDomRoot, children[i]);
          queue.Enqueue(webDomItem);
        }  
      }
    }    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetFirstInputElement", "Section1")
  }
}


function WebControl_SetEventHandler(sender)
{
  try
  {
    
    sender.onfocus = WebForm.OnFocusHandler;
    sender.onkeydown = WebForm.OnKeyDownHandler;
    sender.onkeyup = WebForm.OnKeyUpHandler;
    sender.onkeypress = WebForm.OnKeyPressHandler;
    sender.onblur = WebForm.OnBlurHandler;
    if (sender.onclick == null) sender.onclick = WebForm.OnClickHandler;
    sender.ondblclick = WebForm.OnDblClickHandler;
    sender.onmousedown = WebForm.OnMouseDownHandler;
    if (sender.onmouseover == null) sender.onmouseover = WebForm.OnMouseOverHandler;
    sender.onmouseup = WebForm.OnMouseUpHandler;
    if (sender.onmouseout == null) sender.onmouseout = WebForm.OnMouseOutHandler;
    sender.onchange = WebForm.OnChangeHandler;
    sender.onpaste = WebForm.OnPasteHandler;
    sender.onpropertychaged = WebForm.OnPropertyChagedHandler;
    
    var behavior = sender.getAttribute("Behavior");
    if (typeof(behavior) == "string")
    {
      sender.addBehavior(behavior);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_SetEventHandler", "Section1");
  }
}

function WebControl_GetAbsoluteTop(oNode, unit, oReferenceControl, useScreenPosition)
{
  try
  {
    oReferenceControl = (oReferenceControl == null ? this.GetCurrentDocument().body : oReferenceControl);
    useScreenPosition = (useScreenPosition == null ? false : useScreenPosition);
    
    var iTop = 0;

    if (unit == "px") iTop = oNode.pixelTop;
    else iTop = oNode.offsetTop;

    if (oNode.parentElement)
    {
      var oCurrentNode = oNode.offsetParent;
      while(oCurrentNode != null && oCurrentNode != oReferenceControl)
      {
        if (unit == "px")
        {
          iTop += oCurrentNode.pixelTop - (useScreenPosition == false ? oCurrentNode.scrollTop : 0);
        }
        else
        {
          // bei gescrollten div, wird u.u. nur die Screen - Position benötigt.
          iTop += oCurrentNode.offsetTop - (useScreenPosition == false ? oCurrentNode.scrollTop : 0);
        }
        if (oCurrentNode.parentElement)
        {
          oCurrentNode = oCurrentNode.offsetParent;
        }
        else
        {
          break;
        }
      }
    }
    return iTop;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetAbsoluteTop", "Section1")
  }
}

function WebControl_GetAbsoluteLeft(oNode, unit, oReferenceControl, useScreenPosition)
{
  try
  {
    oReferenceControl = (oReferenceControl == null ? this.GetCurrentDocument().body : oReferenceControl);
    useScreenPosition = (useScreenPosition == null ? false : useScreenPosition);

    var iLeft = 0;
    
    if (unit == "px") iLeft = oNode.pixelLeft;
    else iLeft = oNode.offsetLeft;
    
    if (oNode.parentElement)
    {
      var oCurrentNode = oNode.offsetParent;
      while(oCurrentNode != null && oCurrentNode != oReferenceControl)
      {
        if (unit == "px")
        {
          if (oCurrentNode.tagName == "INPUT") iLeft += oCurrentNode.pixelLeft
          else iLeft += oCurrentNode.pixelLeft - (useScreenPosition == false ? oCurrentNode.scrollLeft : 0);
        }
        else
        {
          if (oCurrentNode.tagName == "INPUT") iLeft += oCurrentNode.offsetLeft
          else iLeft += oCurrentNode.offsetLeft - (useScreenPosition == false ? oCurrentNode.scrollLeft : 0);
        }
        if (oCurrentNode.parentElement)
        {
          oCurrentNode = oCurrentNode.offsetParent;
        }
        else
        {
          break;
        }
      }
    }
    return iLeft;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetAbsoluteLeft", "Section1")
  }
}

function WebControl_FirstDayOfMonth()
{
  try
  {
    var now = new Date();
    var month = now.getMonth();
    var year = now.getFullYear();
    var firstDOM = new Date(year, month, 1);
    
    return firstDOM;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_FirstDayOfMonth", "Section1")
  }
}

function WebControl_LastDayOfMonth()
{
  try
  {
  
    var lastDOM = new Date();
    lastDOM.setTime(lastDOM.getTime() + ((32 - lastDOM.getDate()) * 86400000) );
    lastDOM.setTime(lastDOM.getTime() - (lastDOM.getDate() * 86400000) );
    
    return lastDOM;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_LastDayOfMonth", "Section1")
  }
}

function WebControl_BeforeCloseFrame(sender)
{
  try
  {
    var useArgs = false;
    
    args = new EventArgs();
    args.ReturnValue = "";
    args.CurrentWindow = this.GetCurrentWindow();
    
    if (window.CallingWindow)
    {
      if (typeof(window.CallingWindow.WebControl.OnBeforeCloseFrame) == "function") 
      {
        if (this.GetCurrentWindow().DialogReturnValue && this.GetCurrentWindow().DialogReturnValue == "1")
        {
          window.CallingWindow.WebControl.OnBeforeCloseFrame(sender, args);
          useArgs = !args.Cancel;
        }
      }
      if (typeof(window.CallingWindow.WebControl.OnBeforeCloseDialog) == "function")
      {
        if (this.GetCurrentWindow().DialogReturnValue && this.GetCurrentWindow().DialogReturnValue == "1")
        {
          window.CallingWindow.WebControl.OnBeforeCloseDialog(sender, args);
          useArgs = !args.Cancel;
        }
      }

      if (useArgs == true)
      {
        window.CallingWindow.WebControl.ModalDialogReturnValue = args.ReturnValue;
      }   
    }
    
    if (useArgs == true)
    {
      if (args.ReturnValue != "")
      {
        this.GetCurrentWindow().top.returnValue = args.ReturnValue;
      }
    }  
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_BeforeCloseFrame", "Section1")
  }
}

function WebControl_CloseFrame(sender)
{
  try
  {
    this.GetCurrentWindow().DialogReturnValue = "1";
    this.GetCurrentWindow().top.close();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_CloseFrame", "Section1")
  }
}

function WebControl_CancelFrame(oObject)
{
  try
  {
    this.GetCurrentWindow().DialogReturnValue = "0";
    this.GetCurrentWindow().top.returnValue = "";
    this.GetCurrentWindow().top.close();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_CancelFrame", "Section1")
  }
}

function WebControl_SetColorRed(oControl)
{
  this.SetColor(oControl, "red");
}

function WebControl_ShowValidationSummary()
{
  try
  {
    this.ValidationMessage = "";
    this.ValidationMessageHTML = "";
    
    var validationMessages = 0;
    for (var i = 0, len = this.WebMessageDescriptorList.Count(); i < len; i++)
    {
      validationMessages += 1;
      if (validationMessages < 5)
      {
        webMessageDescriptor = this.WebMessageDescriptorList.Get(i);
        this.ValidationMessage += "- " + webMessageDescriptor.Message + "\n";
        this.ValidationMessageHTML += "<li>" + webMessageDescriptor.BuildMessage() + "</li>";
      }  
      else
      {
        this.ValidationMessage += "- . . . \n";
        this.ValidationMessageHTML += "<li>. . .</li>";
        break;
      }
    }
    
    if (this.WebMessageDescriptorList.Count() > 0)
    {
      webMessageDescriptor = this.WebMessageDescriptorList.Get(0);
      this.ValidationFirstFaultyElement = webMessageDescriptor.oControl;
    }
    else
    {
      return;
    }
    
    var frameElement = this.GetCurrentDocument().getElementById("ifrmValidationSummary");
    var sender = this.ValidationFirstFaultyElement;
    if(frameElement == null) return;
    if(sender == null) return;

    Ilp.HtmlDom.SetStyle(frameElement, "display", "block");
    Ilp.HtmlDom.SetStyle(frameElement, "visibility", "visible");
    Ilp.HtmlDom.SetStyle(frameElement, "zIndex", 1000);
    
    var validationSummaryFrame = this.GetCurrentDocument().frames["ifrmValidationSummary"];
    var validationSummary = validationSummaryFrame.document.getElementById("ValidationSummary");
    var oBody = validationSummaryFrame.document.body;

    validationSummary.innerHTML = "<ul>" + this.ValidationMessageHTML + "</ul>";
    validationSummaryFrame.scrolling = "no";

    Ilp.HtmlDom.SetStyle(frameElement, "top", 0);
    Ilp.HtmlDom.SetStyle(frameElement, "left", 0);
    
    Ilp.HtmlDom.SetStyle(frameElement, "height", oBody.scrollHeight + (oBody.offsetHeight - oBody.clientHeight));
    Ilp.HtmlDom.SetStyle(frameElement, "width", oBody.scrollWidth + (oBody.offsetWidth - oBody.clientWidth));
    
    this.PositionValidationSummary(sender);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ShowValidationSummary", "Section1")
  }
}

function WebControl_PositionValidationSummary(sender)
{
  try
  {
    if(sender == null) return;
    
    var frameElement = this.GetCurrentDocument().getElementById("ifrmValidationSummary");
    if(frameElement == null) return;
    
    var margin = 20;
    
    this.PositionControl2(frameElement, sender, margin);
    
    if (sender.tagName == "INPUT")
    {
      //sender.focus();
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_PositionValidationSummary", "Section1")
  }
}

function WebControl_HasInputValidator(oControl)
{
  try
  {
    var returnValue = false;
    var inputValidatorClientID = oControl.getAttribute("InputValidatorClientID")
    if (typeof(inputValidatorClientID) == "string")
    {
      returnValue = true;
    }
    
    return returnValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_HasInputValidator", "Section1")
  }
}

function WebControl_ShowInputValidator(oControl, message)
{
  try
  {
    var inputValidatorClientID = oControl.getAttribute("InputValidatorClientID")
    if (typeof(inputValidatorClientID) == "string")
    {
      var uniqueID = this.CreateUniqueClientId(oControl.oRecord, inputValidatorClientID);
      var oInputValidator = this.GetCurrentDocument().getElementById(uniqueID);
      if (Ilp.HtmlDom.GetAttribute(oInputValidator, "IsValidator", "false") == "true")
      {
        Ilp.HtmlDom.SetStyle(oInputValidator, "opacity", 1);
      }
      else
      {
        Ilp.HtmlDom.SetStyle(oInputValidator, "visibility", "visible");
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ShowInputValidator", "Section1")
  }
}

function WebControl_HideInputValidator(oControl)
{
  try
  {
    var inputValidatorClientID = oControl.getAttribute("InputValidatorClientID")
    if (typeof(inputValidatorClientID) == "string")
    {
      var uniqueID = this.CreateUniqueClientId(oControl.oRecord, inputValidatorClientID);
      var oInputValidator = this.GetCurrentDocument().getElementById(uniqueID);
      if (oInputValidator)
      {
        if (Ilp.HtmlDom.GetAttribute(oInputValidator, "IsValidator", "false") == "true")
        {
          Ilp.HtmlDom.SetStyle(oInputValidator, "opacity", 0.15);
        }
        else
        {
          Ilp.HtmlDom.SetStyle(oInputValidator, "visibility", "hidden");
        }
      }  
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_HideInputValidator", "Section1")
  }
}

function WebControl_HideValidationSummary()
{
  try
  {
    this.WebMessageDescriptorList.Clear();
    
    var OverlayMessageIFrame = this.GetCurrentDocument().getElementById("ifrmValidationSummary");
    if (OverlayMessageIFrame != null)
    {
      if (Ilp.HtmlDom.GetStyle(OverlayMessageIFrame, "visibility") ==  "visible")
      {
        Ilp.HtmlDom.SetStyle(OverlayMessageIFrame, "visibility", "hidden");
        Ilp.HtmlDom.SetStyle(OverlayMessageIFrame, "display", "none");
      }
    }    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_HideValidationSummary", "Section1")
  }
}


function WebControl_AddDisabledControl(oControl)
{
  try
  {
    if (oControl != null)
    {
      if (this.DisabledControls == null) this.DisabledControls = new Array();
      
      oControl.disabled = true;
      if (oControl.tagName == "IMG")
      {
        Ilp.HtmlDom.SetStyle(oControl, "opacity", 0.15);
      }
      
      this.DisabledControls[this.DisabledControls.length] = oControl;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_AddDisabledControl", "Section1")
  }
}

function WebControl_DisableControl(oControl)
{
  try
  {
    this.AddDisabledControl(oControl);  
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_DisableControl", "Section1")
  }
}


function WebControl_EnableControls()
{
  try
  {
    if (this.DisabledControls != null)
    {
      for (var i = 0, len = this.DisabledControls.length; i < len; i++)
      {
        var oControl = this.DisabledControls[i];
        oControl.disabled = false;
        if (oControl.tagName == "IMG")
        {
          Ilp.HtmlDom.SetStyle(oControl, "opacity", 1);
        }
      }
    }
    this.DisabledControls = null;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_EnableControls", "Section1")
  }
}

function WebControl_SetBackgroundColor(oControl, color) 
{
  try 
  {
    var controlType = oControl.getAttribute("ControlType");
    controlType = controlType == null ? "" : controlType;
    
    switch(oControl.getAttribute("ControlType"))
    {
      case "DropDownList":
      case "CheckBox":
      case "RadioButton":
        break;
      case "TextBox":
        oControl.setAttribute("SaveBackgroundColor", Ilp.HtmlDom.GetStyle(oControl, "backgroundColor"));
        Ilp.HtmlDom.SetStyle(oControl, "backgroundColor", color);
        if (oControl.parentElement && oControl.parentElement.className == "TextBoxDiv")
        {
          Ilp.HtmlDom.SetStyle(oControl.parentElement, "backgroundColor", color);
        }
        if (oControl.parentElement && oControl.parentElement.parentElement)
        {
          var td = oControl.parentElement.parentElement.parentElement;
          if (td && td.tagName == "TD" && Ilp.HtmlDom.HasClass(td, "B_BodyCell") == true)
          {
            Ilp.HtmlDom.SetStyle(td, "backgroundColor", color);
          }
        }
        break;
      default:  
        oControl.setAttribute("SaveBackgroundColor", Ilp.HtmlDom.GetStyle(oControl, "backgroundColor"));
        Ilp.HtmlDom.SetStyle(oControl, "backgroundColor", color);
    }    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_SetBackgroundColor", "Section1")
  }
}

function WebControl_ResetBackgroundColor(oControl)
{
  try 
  {
    var controlType = oControl.getAttribute("ControlType");
    controlType = controlType == null ? "" : controlType;

    var backgroundColor = oControl.getAttribute("SaveBackgroundColor");
    
    switch(oControl.getAttribute("ControlType"))
    {
      case "TextBox":
        if (backgroundColor && backgroundColor.length > 0)
        {
          Ilp.HtmlDom.SetStyle(oControl, "backgroundColor", backgroundColor);
        
          if (oControl.parentElement && oControl.parentElement.className == "TextBoxDiv")
          {
            Ilp.HtmlDom.SetStyle(oControl.parentElement, "backgroundColor", backgroundColor);
          }
          if (oControl.parentElement && oControl.parentElement.parentElement)
          {
            var td = oControl.parentElement.parentElement.parentElement;
            if (td && td.tagName == "TD" && Ilp.HtmlDom.HasClass(td, "B_BodyCell") == true)
            {
              Ilp.HtmlDom.SetStyle(td, "backgroundColor", backgroundColor);
            }
          }
        }
        break;
      default:  
        if (backgroundColor && backgroundColor.length > 0)
        {
          Ilp.HtmlDom.SetStyle(oControl, "backgroundColor", backgroundColor);
        }
    }    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ResetBackgroundColor", "Section1")
  }
}

function WebControl_SetColor(oControl, color) 
{
  try 
  {
    switch(oControl.getAttribute("ControlType"))
    {
      case "DropDownList":
      case "CheckBox":
      case "RadioButton":
        break;
      default:  
        if (oControl.getAttribute("SaveColor") == null)
        {
          oControl.setAttribute("SaveColor", Ilp.HtmlDom.GetStyle(oControl, "color"));
        }
        Ilp.HtmlDom.SetStyle(oControl, "color", color);
    }    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_SetColor", "Section1")
  }
}

function WebControl_ResetColor(oControl)
{
  try 
  {
    var color = oControl.getAttribute("SaveColor");
    if (color && color.length > 0)
    {
      Ilp.HtmlDom.SetStyle(oControl, "color", color);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ResetColor", "Section1")
  }
}

function WebControl_SetClassName(oControl, className) 
{
  try 
  {
    switch(oControl.getAttribute("ControlType"))
    {
      case "DropDownList":
      case "CheckBox":
      case "RadioButton":
        break;
      default:  
        oControl.setAttribute("SaveClassName", oControl.className);
        oControl.className = className;
    }    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_SetClass", "Section1")
  }
}

function WebControl_ResetClassName(oControl, defaultClassName)
{
  try 
  {
    var className = oControl.getAttribute("SaveClassName");
    if (typeof(className) == "string")
    {
      oControl.className = className;
    }
    else
    {
      if (defaultClassName != null) oControl.className = defaultClassName;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ResetClassName", "Section1")
  }
}

function WebControl_SetTabIndex(oControl, tabIndex) 
{
  try 
  {
    if (oControl.getAttribute("SaveTabIndex") == null)
    {
      if (oControl.tabIndex > -1)
      {
        oControl.setAttribute("SaveTabIndex", oControl.tabIndex);
      }  
    }
    oControl.tabIndex = tabIndex;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_SetTabIndex", "Section1")
  }
}

function WebControl_ResetTabIndex(oControl) 
{
  try 
  {
    var tabIndex = oControl.getAttribute("SaveTabIndex");
    if (typeof(tabIndex) == "number")
    {
      oControl.tabIndex = tabIndex;
    }
    else
    {
      oControl.tabIndex = this.GetDefaultTabIndex(oControl);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ResetTabIndex", "Section1")
  }
}

function WebControl_GetDefaultTabIndex(oControl)  
{
  try 
  {
    var defaultTabIndex = -1;
  
    switch(oControl.getAttribute("ControlType"))
    {
      case "TextBox":
      case "DropDownList":
      case "RadioButton":
      case "CheckBox":
      case "Image":
      case "Button":
        defaultTabIndex = 0;
        break;
      default:
        defaultTabIndex = -1;
        break;
    }
    
    return defaultTabIndex;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetDefaultTabIndex", "Section1")
  }
}

function WebControl_AddBoundControl(fqn, oRecord, oTarget, binderType, boundProperty)  
{
  try 
  {
    binderType = binderType == null ? "Gui" : binderType;
    boundProperty = boundProperty == null ? WebControl.GetBoundProperty(oTarget) : boundProperty;
    var bindingHash = WebData.GetBindingHash(fqn, oRecord);
    var binder = this.FieldToHtmlObject.Get(bindingHash);
    if (binder == null)
    {
      binder = new Object();
      this.FieldToHtmlObject.Add(bindingHash, binder);
      binder.HtmlObjects = new WebArray();
      binder.BoundProperties = new WebArray();
      binder.BinderType = binderType;
    }
    if (binder.HtmlObjects.Contains(oTarget) == false)
    {
      binder.HtmlObjects.Add(oTarget);
      this.NumberOfBinds++;
    }
    if (boundProperty != null)
    {
      if (binder.BoundProperties.Contains(boundProperty) == false)
      {
        binder.BoundProperties.Add(boundProperty);
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_AddBoundControl", "Section1")
  }
}

function WebControl_RemoveBoundControl(oRecord, oControl) 
{
  try 
  {
    var fieldDescriptor = oControl.oFieldDescriptor;
    var bindingHash = WebData.GetBindingHash(fieldDescriptor.getAttribute("Fqn"), oRecord);
    
    if (this.FieldToHtmlObject.Contains(bindingHash) == true) 
    {
      var binder = this.FieldToHtmlObject.Get(bindingHash);
      
      var index = binder.HtmlObjects.GetIndex(oControl);
      binder.HtmlObjects.Remove(index);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_RemoveBoundControl", "Section1")
  }
}

function WebControl_RemoveBoundControls(oRecord, oFieldDescriptorList) 
{
  try 
  {
    for (var i = 0, len = oFieldDescriptorList.length; i < len; i++)
    {
      var fieldDescriptor = oFieldDescriptorList[i];
      var bindingHash = WebData.GetBindingHash(fieldDescriptor.getAttribute("Fqn"), oRecord);
      
      if (this.FieldToHtmlObject.Contains(bindingHash) == true) 
      {
        this.FieldToHtmlObject.Set(bindingHash, null);
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_RemoveBoundControls", "Section1")
  }
}

function WebControl_CreateUniqueClientId(oRecord, targetId) 
{
  try 
  {
    var uniqueClientId = targetId;
    
    if (oRecord != null)
    {
      uniqueClientId = WebData.GetBindingHash(uniqueClientId, oRecord)
    }
    
    return uniqueClientId;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_CreateUniqueClientId", "Section1")
  }
}

function WebControl_GetParentByTagName(oTarget, tagName) 
{
  try 
  {
    var oElement = oTarget.parentElement;
    while(oElement && oElement.tagName != tagName && oElement.tagName != "BODY")
    {
      oElement = oElement.parentElement;
    }
    
    return oElement;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetParentByTagName", "Section1")
  }
}

function WebControl_GetParentByAttribute(oTarget, attribute, attributeValue, selfIncluded) 
{
  try 
  {
    selfIncluded = selfIncluded == null ? false : selfIncluded;
    var oElement = selfIncluded == false ? oTarget.parentElement : oTarget;
    while(oElement && oElement.getAttribute(attribute) != attributeValue && oElement.tagName != "BODY")
    {
      oElement = oElement.parentElement;
    }
    
    return oElement;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetParentByAttribute", "Section1")
  }
}

function WebControl_FindStarControls(oDomRoot, oDomStructure)
{
  try
  {
    var localArray  = oDomRoot.StarControlArray;
    var index       = localArray.length;
    var children    = null;
    var queue       = new WebQueue();
    var webDomItem  = new WebDomItem(oDomRoot, oDomStructure);
    var element     = null;
    var exclude     = false;
    queue.Enqueue(webDomItem);
    
    while(queue.Count() > 0)
    {   
      webDomItem  = queue.Dequeue();
      element     = webDomItem.oDomElement;
      
      if (element.getAttribute("IsStar") == "true")
      {
        localArray[index++] = element;
      }
      
      if (element.getAttribute("IsSun") == "true")  oDomRoot.oSun = element;
      if (element.getAttribute("IsSun2") == "true")  oDomRoot.oSun2 = element;
      if (element.getAttribute("IsCaption") == "true")  oDomRoot.oCaption = element;
      if (element.getAttribute("IsFooter") == "true")  oDomRoot.oFooter = element;
      if (element.getAttribute("IsChangeTrackingButton") == "true")  oDomRoot.oChangeTrackingButton = element;
    
      children = element.children;
      for (var i = 0, len = children.length; i < len; i++)
      {
        webDomItem = new WebDomItem(oDomRoot, children[i]);
        queue.Enqueue(webDomItem);
      }  
    }    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_FindStarControls", "Section1")
  }
}

function WebControl_CheckGalaxy(oTarget) 
{
  try 
  {
    if (oTarget.oGalaxy == null)
    {
      var oGalaxy = null;
      if (oTarget.getAttribute("IsSun") == "true" || oTarget.getAttribute("IsSun2") == "true")
      {
        var oGalaxy = this.GetParentByAttribute(oTarget, "IsGalaxy", "true");
        if (oGalaxy)
        {
          oGalaxy.StarControlArray = new Array();
          this.FindStarControls(oGalaxy, oGalaxy);
        }
      }
      oTarget.oGalaxy = oGalaxy;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_CheckGalaxy", "Section1")
  }
}


function WebControl_FindSun(oControl) 
{
  try 
  {
    var oSun = null;
    
    this.CheckGalaxy(oControl); 
    if (oControl.oGalaxy == null)
    {
      var oGalaxy = this.GetParentByAttribute(oControl, "IsGalaxy", "true", true);
      if (oGalaxy)
      {
        if (oGalaxy.StarControlArray == null || oGalaxy.StarControlArray.length == 0)
        {
          oGalaxy.StarControlArray = new Array();
          this.FindStarControls(oGalaxy, oGalaxy);
        }
        oControl.oGalaxy = oGalaxy;
        oSun = oGalaxy.oSun;
      }
    }
    else
    {
      oSun = oControl.oGalaxy.oSun;
    }
    return oSun;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_FindSun", "Section1")
  }
}

function WebControl_SetIf(oTarget, controlTemplateWrapper, recordWrapper) 
{
  try 
  {
    // WebData.ReturnIf = (WebData.GetFieldValue(oRecord, "SealSelected.ProgressiveRatio") == "false");
    // WebData.ReturnIf = (WebData.GetFieldValue(oRecord, "Certificate.SlowRollRequired") == "1");
    // WebData.ReturnIf = (WebData.GetRowState(oRecord) == "inserted");
    // WebData.ReturnIf = (oTarget.options.length > 0);
    // WebData.ReturnIf = ("1 2 3 7".indexOf(WebData.GetFieldValue(oRecord, "IDDiagramType")) == -1)
    // WebData.ReturnIf = (WebData.Count(oTarget.oRecord.nodeName) == 0)
    //return;
    
    var args = new EventArgs();
    
    if (oTarget)
    {
      controlTemplateWrapper = controlTemplateWrapper == null ? WebControl.Controls.GetInstance(oTarget) : controlTemplateWrapper;
      if (oTarget.oRecord)
      {
        recordWrapper = recordWrapper == null ? WebControl.Records.GetInstance(oTarget.oRecord) : recordWrapper;
      }
    }
    
    
    var oRecord = oTarget.oRecord;
    var oFieldDescriptor = oTarget.oFieldDescriptor;
   
    var visibleIf = oTarget.getAttribute("VisibleIf");
    if (typeof(visibleIf) == "string")
    {
      if (visibleIf.length > 0)
      {
        this.CheckGalaxy(oTarget);
        eval(visibleIf);
        if (WebData.ReturnIf == false)
        {
          Ilp.HtmlDom.SetStyle(oTarget, "visibility", "hidden");
          if (oTarget.oGalaxy)
          {
            for(var i = 0; i < oTarget.oGalaxy.StarControlArray.length; i++)
            {
              var oStar = oTarget.oGalaxy.StarControlArray[i];
              Ilp.HtmlDom.SetStyle(oStar, "visibility", "hidden");
            }
          }
        }
        else
        {
          if (Ilp.HtmlDom.GetStyle(oTarget, "visibility") == "hidden")
          {
            Ilp.HtmlDom.SetStyle(oTarget, "visibility", "visible");
          }  
          if (oTarget.oGalaxy)
          {
            for(var i = 0; i < oTarget.oGalaxy.StarControlArray.length; i++)
            {
              var oStar = oTarget.oGalaxy.StarControlArray[i];
              Ilp.HtmlDom.SetStyle(oStar, "visibility", "visible");
            }
          }
        }
      }
    }
    var displayIf = oTarget.getAttribute("DisplayIf");
    if (typeof(displayIf) == "string")
    {
      if (displayIf.length > 0)
      {
        eval(displayIf);
        if (WebData.ReturnIf == false)
        {
          this.HideControl(oTarget);
        }
        else
        {
          this.ShowControl(oTarget);
        }
      }
    }
    var disabledIf = oTarget.getAttribute("DisabledIf");
    if (typeof(disabledIf) == "string")
    {
      if (disabledIf.length > 0)
      {
        this.CheckGalaxy(oTarget);
        eval(disabledIf);
        
        if (WebData.ReturnIf == true)
        {
          this.SetDisabled(oTarget);
          if (oTarget.oGalaxy)
          {
            for(var i = 0; i < oTarget.oGalaxy.StarControlArray.length; i++)
            {
              var oControlTemp = oTarget.oGalaxy.StarControlArray[i];
              if (oControlTemp.getAttribute("ControlType") == "RadioButton")
              {
                var oTargetTemp = oTarget;
                oTarget = oControlTemp;
                eval(disabledIf);
                if (WebData.ReturnIf == true)
                {
                  this.SetDisabled(oTarget);
                }
                oTarget = oTargetTemp;
              }
            }
          }
        }
        else
        {
          this.SetEnabled(oTarget);
        }
      }
    }

    if (oFieldDescriptor && oFieldDescriptor.getAttribute("ValidationClass") == "InternalName")
    {
      WebData.ReturnIf = (WebData.GetRowState(oRecord) != RS_inserted);
      if (WebData.ReturnIf == true)
      {
        this.SetDisabled(oTarget);
      }
      else
      {
        this.SetEnabled(oTarget);
      }  
    }

    if (oTarget.IsSearchControl && oTarget.IsSearchControl == true)
    {
    }
    else
    {
      
      if (oFieldDescriptor != null && oFieldDescriptor.getAttribute("Fqn") == "Article.RemarksAS400")
      {
        //alert(oFieldDescriptor.getAttribute("Fqn"));
      }
      
      
      var controlType = Ilp.HtmlDom.GetAttribute(oTarget, "ControlType", "");
      var buttonType = Ilp.HtmlDom.GetAttribute(oTarget, "ButtonType", "");
      if (controlType == "TextBox"
        || controlType == "TextBoxExtended"
        || controlType == "ListBox"
        || controlType == "DropDownList"
        || controlType == "DropDownListExtended"
        || controlType == "RadioButton"
        || controlType == "CheckBox"
        || controlType == "CheckBoxExtended"
        || controlType == "Label"
        || controlType == "LabelExtended")
      {
        var setReadOnly = false;
        
        this.CheckGalaxy(oTarget);
        if (   oFieldDescriptor != null 
            && oFieldDescriptor.getAttribute("EditClass") == null
            && oTarget.getAttribute("AllwaysDisabled") != "true"
            && "Image$ImageExtended$DataLink$DataLinkExtended".indexOf(controlType) == -1)
        {
          setReadOnly = true;
        }  
        if (setReadOnly == false && oRecord != null)
        {
          setReadOnly = !this.IsEditable(oTarget, oRecord, controlTemplateWrapper, recordWrapper);
        }
        if (setReadOnly == true)
        {
          this.SetReadOnly(oTarget, true);
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_SetIf", "Section1", this.SetIf)
  }
}

function WebControl_SetReadOnly(oControl, readOnly)
{
  try
  {
    readOnly = readOnly == null ? true : readOnly;
    
    switch(oControl.getAttribute("ControlType"))
    {
      case "DropDownList":
        oControl.disabled = true;
        this.SetTabIndex(oControl, -1);
        break;
      case "Label":
        if (oControl.getAttribute("LabelType") == "LongTextDialog")
        {
          oControl.disabled = true;
        }
        break;
      case "DataLink":
        oControl.disabled = true;
        Ilp.HtmlDom.SetStyle(oControl, "opacity", 0.15);
        this.SetTabIndex(oControl, -1);
        break;
      case "Image":
        oControl.disabled = true;
        Ilp.HtmlDom.SetStyle(oControl, "opacity", 0.15);
        this.SetTabIndex(oControl, -1);
        break;
      case "RadioButton":
        oControl.disabled = true;
        this.SetTabIndex(oControl, -1);
        this.SetBackgroundColor(oControl, "#E0E0E0")
        break;
      case "CheckBox":
      case "Button":
        oControl.disabled = true;
        this.SetTabIndex(oControl, -1);
        this.SetBackgroundColor(oControl, "#E0E0E0")
        break;
      case "TextBox":
        oControl.readOnly = true;
        this.SetTabIndex(oControl, -1);
        this.SetBackgroundColor(oControl, "#E0E0E0")
        if (oControl.parentElement && oControl.parentElement.className == "TextBoxDiv")
        {
          this.SetBackgroundColor(oControl.parentElement, "#E0E0E0");
        }
        break;
      default:
        oControl.readOnly = true;
        this.SetTabIndex(oControl, -1);
        this.SetBackgroundColor(oControl, "#E0E0E0")
        break;
    }
    
    if (oControl.oGalaxy)
    {
      var localArray = oControl.oGalaxy.StarControlArray;
      for(var i = 0, len = localArray.length; i < len; i++)
      {
        if (localArray[i].getAttribute("IsCaption") == "true")
        {
          oControl.oGalaxy.oCaption = localArray[i];
          if (localArray[i].getAttribute("IsStar") == "true")
          {
            this.SetReadOnly(localArray[i], readOnly);
          }
        }
        else if (localArray[i].getAttribute("IsFooter") == "true")
        {
          oControl.oGalaxy.oFooter = localArray[i];
        }
        else
        {
          this.SetReadOnly(localArray[i], readOnly);
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_SetReadOnly", "Section1")
  }
}

function WebControl_IsDisabled(oControl)
{
  try
  {
    return oControl.disabled;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_IsDisabled", "Section1")
  }
}

function WebControl_IsVisible(oControl, checkDeep)
{
  try
  {
    checkDeep = checkDeep == null ? false : checkDeep;

    var isVisible = Ilp.HtmlDom.IsVisible(oControl);
    
    if (oControl.oGalaxy != null)
    {
      isVisible = isVisible && Ilp.HtmlDom.IsVisible(oControl.oGalaxy); 
    }
    
    if (isVisible == true && checkDeep == true)
    {
      var oCurrentNode = oControl.parentElement;
      while(oCurrentNode.tagName != "BODY")
      {
        isVisible = isVisible && Ilp.HtmlDom.IsVisible(oCurrentNode); 
          
        if (isVisible == false) break;
        oCurrentNode = oCurrentNode.parentElement;
      }
    }
  
    return isVisible;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_IsVisible", "Section1")
  }
}

function WebControl_SetDisabled(oControl)
{
  try
  {
    switch(oControl.getAttribute("ControlType"))
    {
      case "RadioButton":
      case "CheckBox":
      case "Button":
        oControl.disabled = true;
        this.SetTabIndex(oControl, -1);
        this.SetBackgroundColor(oControl, "#E0E0E0");
        break;
      case "DropDownList":
        oControl.disabled = true;
        this.SetTabIndex(oControl, -1);
        break;
      case "Label":
      case "DataLink":
        oControl.disabled = true;
        this.SetTabIndex(oControl, -1);
        break;
      case "Image":
        oControl.disabled = true;
        Ilp.HtmlDom.SetStyle(oControl, "opacity", 0.15);
        this.SetTabIndex(oControl, -1);
        break;
      case "TextBox":
        oControl.readOnly = true;
        this.SetTabIndex(oControl, -1);
        this.SetBackgroundColor(oControl, "#E0E0E0");
        break;
      default:
        oControl.readOnly = true;
        this.SetTabIndex(oControl, -1);
        this.SetBackgroundColor(oControl, "#E0E0E0");
        break;
    }  
    
    if (oControl.oGalaxy
        && (   Ilp.HtmlDom.GetAttribute(oControl, "IsSun", "") == "true"
            || Ilp.HtmlDom.GetAttribute(oControl, "IsGalaxy", "") == "true"))
    {
      var localArray = oControl.oGalaxy.StarControlArray;
      for(var i = 0, len = localArray.length; i < len; i++)
      {
        if (localArray[i] != oControl)
        {
          this.SetDisabled(localArray[i]);
        }
      }
    }
    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_SetDisabled", "Section1")
  }
}

function WebControl_SetEnabled(oControl)
{
  try
  {
    switch(oControl.getAttribute("ControlType"))
    {
      case "RadioButton":
      case "CheckBox":
      case "Button":
        oControl.disabled = false;
        this.ResetTabIndex(oControl);
        this.ResetBackgroundColor(oControl);
        break;
      case "DropDownList":
        oControl.disabled = false;
        this.ResetTabIndex(oControl);
        break;
      case "Label":
      case "DataLink":
        oControl.disabled = false;
        //Ilp.HtmlDom.SetStyle(oControl, "opacity", 1);
        this.ResetTabIndex(oControl);
        break;
      case "Image":
        oControl.disabled = false;
        if (oControl.getAttribute("IsValidator") == "true")
        {
          Ilp.HtmlDom.SetStyle(oControl, "opacity", 0.15);
        }
        else
        {
          Ilp.HtmlDom.SetStyle(oControl, "opacity", 1);
        }
        if (oControl.getAttribute("IsValidator") != "true") this.ResetTabIndex(oControl);
        break;
      case "TextBox":
        if (oControl.getAttribute("AllwaysDisabled") != "true")
        {
          oControl.readOnly = false;
          this.ResetTabIndex(oControl);
          this.ResetBackgroundColor(oControl);
        }
        break;
      default:
        if (oControl.getAttribute("AllwaysDisabled") != "true")
        {
          oControl.readOnly = false;
          this.ResetTabIndex(oControl);
          this.ResetBackgroundColor(oControl);
        }
        break;
    }
    
    if (oControl.oGalaxy
        && (   Ilp.HtmlDom.GetAttribute(oControl, "IsSun", "") == "true"
            || Ilp.HtmlDom.GetAttribute(oControl, "IsGalaxy", "") == "true"))
    {
      var localArray = oControl.oGalaxy.StarControlArray;
      for(var i = 0, len = localArray.length; i < len; i++)
      {
        if (localArray[i] != oControl)
        {
          this.SetEnabled(localArray[i], 1);
        }
      }
    }
      
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_SetEnabled", "Section1")
  }
}



function WebControl_HideControl(oControl)
{
  try
  {
    this.CheckGalaxy(oControl);
    if (oControl.oGalaxy)
    {
      Ilp.HtmlDom.SetStyle(oControl.oGalaxy, "display", "none");
    }
    else
    {
      Ilp.HtmlDom.SetStyle(oControl, "display", "none");
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_HideControl", "Section1")
  }
}


function WebControl_ShowControl(oControl)
{
  try
  {
    this.CheckGalaxy(oControl);
    if (oControl.oGalaxy)
    {
      Ilp.HtmlDom.SetStyle(oControl.oGalaxy, "display", "block");
    }
    else
    {
      Ilp.HtmlDom.SetStyle(oControl, "display", "block");
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ShowControl", "Section1")
  }
}

function WebControl_UpdateCalendarInput(sender)
{
  try
  {
    switch(sender.getAttribute("ButtonType"))
    {
      case "Calendar":
        var calendarFrame = GetCalendarFrame();     
        var returnDate = new Date(calendarFrame.gYear, calendarFrame.gMonth-1, calendarFrame.gDay);
        var oTextBox = this.GetCurrentDocument().getElementById(this.CreateUniqueClientId(sender.oRecord, sender.getAttribute("TextBoxID")));
        if (oTextBox != null)
        {
          this.SetValue(oTextBox, this.ConvertDateToString(returnDate), false);

          var oDataField = new Object()
          oDataField.text = this.ConvertControlDataToWebData(oTextBox, oTextBox.oFieldDescriptor);
        
          this.SetValue(oTextBox, this.ConvertWebDataToControlData(oTextBox, oTextBox.oFieldDescriptor, oDataField));
          if (oTextBox.oWebDataSearch != null)
          {
            oTextBox.oWebDataSearch.ProcessKeyUp(oTextBox);
          }
          var afterCalendarHandler = sender.getAttribute("AfterCalendarHandler");
          if (typeof(afterCalendarHandler) == "string")
          {
            var args = new EventArgs();
            eval(afterCalendarHandler + "(sender, args);");
          }
        }
        break;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_UpdateCalendarInput", "Section1")
  }
}

function WebControl_GetLoginGuid(relativeVirtualPath)
{ 
  try
  {
    var webArgument =  "<relativeVirtualPath>";  
    webArgument += relativeVirtualPath;
    webArgument += "</relativeVirtualPath>";
  
    return WebMessage.CallWebMethod2("GetLoginGuid", webArgument);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetLoginGuid", "Section1")
  }  
}

function WebControl_Post(sender, actionValue, searchInfoXml)
{
  try
  {
    switch(sender.getAttribute("ControlType"))
    {
      case "Button":
      case "Image":
      case "DataLink":
      case "DataLinkExtended":
        searchInfoXml = searchInfoXml == null ? "" : searchInfoXml;
        actionValue = actionValue == null ? WebData.GetFieldValue(sender.oRecord, sender.getAttribute("ActionFqn")) : actionValue;

        var targetValue = sender.getAttribute("Target");
        var fqn = sender.getAttribute("TargetFqn");
        if (fqn) targetValue = WebData.GetFieldValue(sender.oRecord, sender.getAttribute("TargetFqn"));
        targetValue = targetValue == null ? "_self" : targetValue;

        var actionType = sender.getAttribute("ActionType");
        actionType = actionType == null ? "" : actionType;

        var method = sender.getAttribute("Method");
        method = method == null ? "POST" : method;

        var fqn = sender.getAttribute("ActionFqn");
        if (fqn) actionValue = this.PrepareXPathSelector(sender.oRecord, actionValue);
          
        if (actionValue)
        {           
          if (actionType == "DirectDomainPost")
          {
            actionValue = "http://" + window.location.host + "/" + actionValue;
          }
          else
          {
            if (actionValue.indexOf(RootPath) == -1 && actionValue.indexOf(GlobalScriptsDirectoryVirtual) == -1)
            {
              actionValue = RootPath + actionValue;
            }
          }
          if (typeof(WebMessage) == "object")
          {
            WebMessage.SetGeneralInfoAttribute("TargetUrl", actionValue);
          }
          
          if (actionType == "ParentPost")
          {
            if (this.GetCurrentWindow().opener)
            {
              this.GetCurrentWindow().opener.location.href = actionValue;
            }
          }
          else
          {
            if(actionType == "FramesetPost")
            {
              var hostWindow = Ilp.HtmlDom.GetHostWindow();
              if (hostWindow && hostWindow.location.href.indexOf("GTAdminApp.aspx") > -1)
              {
                this.GetCurrentDocument().forms["frmAction"].action = RootPath + "GlobalScripts/GTAdmin/GTAdminApp.aspx";
              }
              else if (hostWindow && hostWindow.location.href.indexOf("GTMainApp.aspx") > -1)
              {
                this.GetCurrentDocument().forms["frmAction"].action = RootPath + "GlobalScripts/GTMainApp/GTMainApp.aspx";                
              }
              else
              {
                this.GetCurrentDocument().forms["frmAction"].action = RootPath + "LoginFrame.aspx";
              }
            }
            else
            {
              this.GetCurrentDocument().forms["frmAction"].action = actionValue;
            }
            var languageOld = WebControl.GetPostParameter("Language");
            var actionTypeTemp = (actionType.length == 0 ? "DirectPost" : actionType);
            if ((actionTypeTemp == "DirectPost" || actionTypeTemp == "DirectDomainPost") && targetValue == "_blank")
            {
              WebControl.InitPostParameter();
              WebControl.AddPostParameter("PP", this.GetStandardPP(CallingMode_Dialog));
              var languageNew = this.GetQueryParameter(actionValue, "Language", "");
              if (languageNew.length > 0) WebControl.SetPostParameter("Language", languageNew);
            }
            WebControl.SetPostParameter("SearchInfo", searchInfoXml);
            WebControl.SetPostParameter("TargetShowURL", actionValue);
            
            if (typeof(this.OnBeforeSubmit) == "function")
            {
              var args = new EventArgs();
            
              args.Target = targetValue;
              args.ActionFqn = sender.getAttribute("ActionFqn");
              this.OnBeforeSubmit(sender, args);
            }
            
            this.GetCurrentDocument().forms["frmAction"].method = method;
            this.GetCurrentDocument().forms["frmAction"].target = targetValue;
            this.GetCurrentDocument().forms["frmAction"].submit();
            
            WebControl.SetPostParameter("SearchInfo", "");
            WebControl.SetPostParameter("Language", languageOld);
          }
        }
        break;
      default:
        var targetValue = sender.getAttribute("Target");

     
        this.GetCurrentDocument().forms["frmAction"].SearchInfo.value = searchInfoXml;
        this.GetCurrentDocument().forms["frmAction"].method = "POST";
        this.GetCurrentDocument().forms["frmAction"].action = actionValue;
        this.GetCurrentDocument().forms["frmAction"].target = targetValue == null ? "_self" : targetValue;
        this.GetCurrentDocument().forms["frmAction"].submit();   
        this.GetCurrentDocument().forms["frmAction"].SearchInfo.value = "";
      
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_Post", "Section1", this.Post)
  }
}


function WebControl_DeleteUpload(sender)
{
  try
  {
    var oRecord = sender.oRecord;
    var fqn = sender.getAttribute("Fqn");
    var fd = FormDescriptor.GetFieldDescriptor(fqn);
    var upld = FormDescriptor.GetUploadDescriptor(fd.getAttribute("UploadDescriptorFqn"));

    WebData.SetNull(oRecord, upld.getAttribute("FileNameFqn"));
    WebData.UpdateFieldBinding(oRecord, upld.getAttribute("FileNameFqn"));
    WebData.SetNull(oRecord, upld.getAttribute("FileNameTempFqn"));
    WebData.SetNull(oRecord, upld.getAttribute("FileDateFqn"));
    
    var infoFqn = upld.getAttribute("InfoFqn");
    if (typeof(infoFqn) == "string")
    {
      WebData.SetNull(oRecord, infoFqn);
      WebData.UpdateFieldBinding(oRecord, upld.getAttribute("InfoFqn"));
    }    
    
    var srcFqn = upld.getAttribute("SrcFqn");
    if (typeof(srcFqn) == "string")
    {
      WebData.SetNull(oRecord, srcFqn);
      WebData.UpdateFieldBinding(oRecord, upld.getAttribute("SrcFqn"));
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_DeleteUpload", "Section1")
  }
}

function WebControl_Upload(sender, customUrl, customFeatures)
{
  try
  {
    customUrl = customUrl == null ? "" : customUrl;
    customFeatures = customFeatures == null ? "" : customFeatures;

    var dialogFeatures = WebControl.GetDialogFeatures(610, 380);
    var windowFeatures = WebControl.GetWindowFeatures(610, 380, "1");

    if (customFeatures.length > 0) windowFeatures = customFeatures;

    // KnowledgeBase[IDKnowledgeBase=-1]
    var xPathSelector = WebData.GetRecordSelector(sender.oRecord);
    WebMessage.SetGeneralInfoAttribute("XPathSelector", xPathSelector);
    
    
    var fqn = this.GetFqn(sender);
    var fd = FormDescriptor.GetFieldDescriptor(fqn);
    var upldFqn = fd.getAttribute("UploadDescriptorFqn");
    var upld = FormDescriptor.GetUploadDescriptor(upldFqn);
    
    var relativePathValue = "";
    var relativePathFqn = upld.getAttribute("FileSystemRelativePathFqn");
    if (relativePathFqn) relativePathValue = WebData.GetFieldValue(sender.oRecord, relativePathFqn);

    var propertyString = "";
    var propertyStringFqn = upld.getAttribute("PropertyStringFqn");
    if (propertyStringFqn) propertyString = WebData.GetFieldValue(sender.oRecord, propertyStringFqn);

    var itemFullName = "";
    var itemFullNameFqn = upld.getAttribute("ItemFullNameFqn");
    if (itemFullNameFqn) itemFullName = WebData.GetFieldValue(sender.oRecord, itemFullNameFqn);

    var uploadParam = WebMessage.GetUploadParam();

    uploadParam.setAttribute("UploadReferrer", this.GetCurrentWindow().location.href);
    uploadParam.setAttribute("PageHeadline", PageHeadline);
    uploadParam.setAttribute("PageTitle", PageTitle);
    uploadParam.setAttribute("MaxWidth", (upld.getAttribute("MaxWidth") == null ? "0" : upld.getAttribute("MaxWidth")));
    uploadParam.setAttribute("MaxHeight", (upld.getAttribute("MaxHeight") == null ? "0" : upld.getAttribute("MaxHeight")));
    uploadParam.setAttribute("StandardWidth", (upld.getAttribute("StandardWidth") == null ? "0" : upld.getAttribute("StandardWidth")));
    uploadParam.setAttribute("StandardHeight", (upld.getAttribute("StandardHeight") == null ? "0" : upld.getAttribute("StandardHeight")));
    uploadParam.setAttribute("StandardMimeType", (upld.getAttribute("StandardMimeType") == null ? "" : upld.getAttribute("StandardMimeType")));
    uploadParam.setAttribute("KeepOriginalSize", (upld.getAttribute("KeepOriginalSize") == null ? "false" : upld.getAttribute("KeepOriginalSize")));
    uploadParam.setAttribute("AllowedMimeTypes", (upld.getAttribute("AllowedMimeTypes") == null ? "" : upld.getAttribute("AllowedMimeTypes")));
    uploadParam.setAttribute("TransferFqn", this.GetFqn(sender));
    uploadParam.setAttribute("XPathSelector", xPathSelector);
    uploadParam.setAttribute("RelativePathAdditional", (relativePathValue == null ? "" : relativePathValue));
    uploadParam.setAttribute("PropertyString", (propertyString == null ? "" : propertyString));
    uploadParam.setAttribute("ItemFullName", (itemFullName == null ? "" : itemFullName));

    WebMessage.SetGeneralInfoAttribute("PageLogo", PageLogo);
    
    WebMessage.SaveWebMessageTransfer();
    var IDWebMessageTransfer = WebMessage.GetGeneralInfoAttribute("IDWebMessageTransfer");
    var IDSessionInfo = WebMessage.GetGeneralInfoAttribute("IDSessionInfo");
    
    var url = "";

    if (customUrl.length > 0) url = WebControl.GetStandardUrl(customUrl, Verb_Upload, CallingMode_DialogDirect);
    else url = WebControl.GetStandardUrl("GlobalScripts/GTCommon/Upload.aspx", Verb_Upload, CallingMode_DialogDirect);
    
    url += "&IDSessionInfo=" + IDSessionInfo;
    url += "&WM=" + IDWebMessageTransfer;
    
    if (1==1)
    {
      this.GetCurrentWindow().open(
        url,
        '_blank',
        windowFeatures,
        true);
    }
    else
    {   
      this.ShowModalDialog(
        url,
        dialogFeatures);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_Upload", "Section1")
  }
}

function WebControl_UploadEdit(sender, customUrl, customFeatures)
{
  try
  {
    customUrl = customUrl == null ? "" : customUrl;
    customFeatures = customFeatures == null ? "" : customFeatures;

    var dialogFeatures = WebControl.GetDialogFeatures(610, 380);
    var windowFeatures = WebControl.GetWindowFeatures(610, 380, "1");

    if (customFeatures.length > 0) windowFeatures = customFeatures;

    var xPathSelector = WebData.GetRecordSelector(sender.oRecord);
    WebMessage.SetGeneralInfoAttribute("XPathSelector", xPathSelector);
    
    var fqn = this.GetFqn(sender);
    var fd = FormDescriptor.GetFieldDescriptor(fqn);
    var upldFqn = fd.getAttribute("UploadDescriptorFqn");
    var upld = FormDescriptor.GetUploadDescriptor(upldFqn);
    
    var relativePathValue = "";
    var relativePathFqn = upld.getAttribute("FileSystemRelativePathFqn");
    if (relativePathFqn) relativePathValue = WebData.GetFieldValue(sender.oRecord, relativePathFqn);

    var propertyString = "";
    var propertyStringFqn = upld.getAttribute("PropertyStringFqn");
    if (propertyStringFqn) propertyString = WebData.GetFieldValue(sender.oRecord, propertyStringFqn);

    var itemFullName = "";
    var itemFullNameFqn = upld.getAttribute("ItemFullNameFqn");
    if (itemFullNameFqn) itemFullName = WebData.GetFieldValue(sender.oRecord, itemFullNameFqn);

    var uploadParam = WebMessage.GetUploadParam();

    uploadParam.setAttribute("UploadReferrer", this.GetCurrentWindow().location.href);
    uploadParam.setAttribute("PageHeadline", PageHeadline);
    uploadParam.setAttribute("PageTitle", PageTitle);
    uploadParam.setAttribute("TransferFqn", this.GetFqn(sender));
    uploadParam.setAttribute("XPathSelector", xPathSelector);
    uploadParam.setAttribute("RelativePathAdditional", (relativePathValue == null ? "" : relativePathValue));
    uploadParam.setAttribute("PropertyString", (propertyString == null ? "" : propertyString));
    uploadParam.setAttribute("ItemFullName", (itemFullName == null ? "" : itemFullName));

    WebMessage.SetGeneralInfoAttribute("PageLogo", PageLogo);
    
    WebMessage.SaveWebMessageTransfer();
    var IDWebMessageTransfer = WebMessage.GetGeneralInfoAttribute("IDWebMessageTransfer");
    var IDSessionInfo = WebMessage.GetGeneralInfoAttribute("IDSessionInfo");
    
    var url = "";

    if (customUrl.length > 0) url = WebControl.GetStandardUrl(customUrl, Verb_Edit, CallingMode_DialogDirect);
    else url = WebControl.GetStandardUrl("GlobalScripts/GTCommon/Upload.aspx", Verb_Edit, CallingMode_DialogDirect);
    
    url += "&IDSessionInfo=" + IDSessionInfo;
    url += "&WM=" + IDWebMessageTransfer;
    
    if (1==1)
    {
      this.GetCurrentWindow().open(
        url,
        '_blank',
        windowFeatures,
        true);
    }
    else
    {   
      this.ShowModalDialog(
        url,
        dialogFeatures);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_UploadEdit", "Section1")
  }
}

function WebControl_ShowUpload(xmlData)
{
  try
  {
    var oUploadParamDoc = null;
    oUploadParamDoc = Ilp.XmlDom.CreateXmlDom();
    oUploadParamDoc.async = false;
    oUploadParamDoc.validateOnParse = true;
    oUploadParamDoc.loadXML(xmlData);

    var uploadParam = WebMessage.GetUploadParam();

    var fqn = oUploadParamDoc.documentElement.getAttribute("TransferFqn");
    var xPathSelector = oUploadParamDoc.documentElement.getAttribute("XPathSelector");
    var fileClientDirectory = oUploadParamDoc.documentElement.getAttribute("FileClientDirectory");
    var filename = oUploadParamDoc.documentElement.getAttribute("FileName");
    var filenameTemp = oUploadParamDoc.documentElement.getAttribute("FileNameTemp");
    var fileDate = oUploadParamDoc.documentElement.getAttribute("FileDate");
    var fileSize = oUploadParamDoc.documentElement.getAttribute("FileSize");
    var src = oUploadParamDoc.documentElement.getAttribute("Src");
    var href = oUploadParamDoc.documentElement.getAttribute("Href");
    var idMimeType = oUploadParamDoc.documentElement.getAttribute("IDMimeType");
    var propertyString = oUploadParamDoc.documentElement.getAttribute("PropertyString");
    var IDDocumentationItem = oUploadParamDoc.documentElement.getAttribute("IDDocumentationItem");
    var relativePathAdditional = oUploadParamDoc.documentElement.getAttribute("RelativePathAdditional");
    var itemFullName = oUploadParamDoc.documentElement.getAttribute("ItemFullName");
   
    var fd = FormDescriptor.GetFieldDescriptor(fqn);
    var upld = FormDescriptor.GetUploadDescriptor(fd.getAttribute("UploadDescriptorFqn"));
    var oRecordList = WebData.Select(xPathSelector);
    var oRecord = oRecordList[0];
    
    WebData.SetFieldValue(oRecord, upld.getAttribute("FileNameFqn"), filename);
    WebData.UpdateFieldBinding(oRecord, upld.getAttribute("FileNameFqn"));
    
    var fileNameTempFqn = upld.getAttribute("FileNameTempFqn");
    if (fileNameTempFqn != null)
    {
      WebData.SetFieldValueOnly(oRecord, fileNameTempFqn, filenameTemp);
    }

    var fileSystemRelativePathFqn = upld.getAttribute("FileSystemRelativePathFqn");
    if (fileSystemRelativePathFqn != null && relativePathAdditional != null && relativePathAdditional.length > 0)
    {
      WebData.SetFieldValueOnly(oRecord, fileSystemRelativePathFqn, relativePathAdditional);
    }    

    var propertyStringFqn = upld.getAttribute("PropertyStringFqn");
    if (propertyStringFqn != null)
    {
      WebData.SetFieldValueOnly(oRecord, propertyStringFqn, propertyString);
    }    

    var documentationItemFqn = upld.getAttribute("DocumentationItemFqn");
    if (documentationItemFqn != null)
    {
      WebData.SetFieldValueOnly(oRecord, documentationItemFqn, IDDocumentationItem);
      WebData.UpdateFieldBinding(oRecord, documentationItemFqn);
    }    
    
    var itemFullNameFqn = upld.getAttribute("ItemFullNameFqn");
    if (itemFullNameFqn != null)
    {
      WebData.SetFieldValueOnly(oRecord, itemFullNameFqn, itemFullName);
    }    
    
    var hrefFqn = upld.getAttribute("HrefFqn");
    if (hrefFqn != null)
    {
      WebData.SetFieldValueOnly(oRecord, hrefFqn, href);
      WebData.UpdateFieldBinding(oRecord, hrefFqn);
    }    
    
    var date = new Date();
    WebData.SetFieldValueOnly(oRecord, upld.getAttribute("FileDateFqn"), this.ConvertDateToXmlDate(date, true));
    
   
    // Modaler Dialog mit Referenz auf WebData der aufrufenden Instanz.
    if (this.GetCurrentWindow().dialogArguments && this.GetCurrentWindow().dialogArguments.WebControl)
    {  
      var bindingHash = WebData.GetBindingHash(upld.getAttribute("FileNameFqn"), oRecord);
      var binder = this.FieldToHtmlObject.Get(bindingHash);
      if (binder != null)
      {
        for (var i = 0, len = binder.HtmlObjects.Count(); i < len; i++)
        {
          var oTarget = binder.HtmlObjects.Get(i);
          this.MergeData(oTarget.oContainer, oTarget, oRecord);
        }
      }
    }
    
    fileClientDirectoryFqn = upld.getAttribute("FileClientDirectoryFqn");
    if (fileClientDirectoryFqn != null)
    {
      WebData.SetFieldValueOnly(oRecord, upld.getAttribute("FileClientDirectoryFqn"), fileClientDirectory);
    }

    var infoFqn = upld.getAttribute("InfoFqn");
    if (typeof(infoFqn) == "string")
    {
      var info = ids_UploadLastModified.replace("-FileSize-", fileSize);
      info = info.replace("-FileDate-", this.ConvertDateToString(date, true, false));
      WebData.SetFieldValueOnly(oRecord, infoFqn, info);
      WebData.UpdateFieldBinding(oRecord, infoFqn);
     
      if (this.GetCurrentWindow().dialogArguments && this.GetCurrentWindow().dialogArguments.WebControl)
      {  
        var bindingHash = WebData.GetBindingHash(infoFqn, oRecord);
        var binder = this.FieldToHtmlObject.Get(bindingHash);
        if (binder != null)
        {
          for (var i = 0, len = binder.HtmlObjects.Count(); i < len; i++)
          {
            var oTarget = binder.HtmlObjects.Get(i);
            this.MergeData(oTarget.oContainer, oTarget, oRecord);
          }
        }
      }
    }

    var srcFqn = upld.getAttribute("SrcFqn");
    if (typeof(srcFqn) == "string")
    {
      WebData.SetFieldValueOnly(oRecord, srcFqn, src);
      WebData.UpdateFieldBinding(oRecord, srcFqn)
      
      if (this.GetCurrentWindow().dialogArguments && this.GetCurrentWindow().dialogArguments.WebControl)
      { 
        var bindingHash = WebData.GetBindingHash(srcFqn, oRecord);
        var binder = this.FieldToHtmlObject.Get(bindingHash);
        if (binder != null)
        {
          for (var i = 0, len = binder.HtmlObjects.Count(); i < len; i++)
          {
            var oTarget = binder.HtmlObjects.Get(i);
            this.MergeData(oTarget.oContainer, oTarget, oRecord);
          }
        }
      }
    }
    
    
    var mimeTypeFqn = upld.getAttribute("MimeTypeFqn");
    if (typeof(mimeTypeFqn) == "string")
    {
      WebData.SetFieldValueOnly(oRecord, mimeTypeFqn, idMimeType);
      WebData.UpdateFieldBinding(oRecord, mimeTypeFqn)
      
      if (this.GetCurrentWindow().dialogArguments && this.GetCurrentWindow().dialogArguments.WebControl)
      { 
        var bindingHash = WebData.GetBindingHash(mimeTypeFqn, oRecord);
        var binder = this.FieldToHtmlObject.Get(bindingHash);
        if (binder != null)
        {
          for (var i = 0, len = binder.HtmlObjects.Count(); i < len; i++)
          {
            var oTarget = binder.HtmlObjects.Get(i);
            this.MergeData(oTarget.oContainer, oTarget, oRecord);
          }
        }
      }
    }
    
    var oTarget = WebControl.GetControl(upld.getAttribute("FileNameFqn"), oRecord);
    if (oTarget != null)
    {
      var afterShowUploadHandler = oTarget.getAttribute("OnAfterShowUpload");
      if (typeof(afterShowUploadHandler) == "string")
      {
        var args = new EventArgs();
        args.Record = oRecord;
        eval(afterShowUploadHandler + "(oTarget, args);");
      }
    }
    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ShowUpload", "Section1")
  }
}

function WebControl_Download(sender)
{
  try
  {
    var rowState = WebData.GetRowState(sender.oRecord);
    if (rowState == "inserted")
    {
      alert(ids_SaveFirst);
    }
    else
    {
      var fqn = this.GetFqn(sender);
      var fd = FormDescriptor.GetFieldDescriptor(fqn);
      var upld = FormDescriptor.GetUploadDescriptor(fd.getAttribute("UploadDescriptorFqn"));
      var tempFileName = WebData.GetFieldValue(sender.oRecord, upld.getAttribute("FileNameTempFqn"));
      
      if (tempFileName == null || tempFileName.length == 0)
      {    
        alert(ids_UploadFirst);
      }
      else
      {
        if (upld.getAttribute("UploadStorageType") == enum_UploadStorageType_FileSystem)
        {
          var href = WebData.GetFieldValue(sender.oRecord, upld.getAttribute("HrefFqn"));
          this.OpenDownload(href);
        }
        else
        {
          WebMessage.SetGeneralInfoAttribute("TransferFqn", fqn);
          
          var pkFd = FormDescriptor.GetPrimaryKeyFieldDescriptor(sender.oRecord.nodeName);
          var pkFqn = pkFd.getAttribute("Fqn");
          var pkValue = WebData.GetFieldValue(sender.oRecord, pkFqn);
          
          var oSearchInfo = WebMessage.GetSearchInfo();
          WebMessage.InitSearchInfo();
          WebMessage.AddSearchInfoItem(null, pkFqn, pkValue, "", "false");
          
          var target = "_self";
          var extension = this.GetExtension(tempFileName);
          if ("xml".indexOf(extension) > -1
            || "pdf".indexOf(extension) > -1)
          {
            target = "_blank";
          }
          
          this.GetCurrentWindow().frmAction.WebMessage.value = WebMessage.GetXmlSmall();
          this.GetCurrentWindow().frmAction.action = GlobalScriptsDirectoryVirtual + "GTCommon/Download.aspx";
          this.GetCurrentWindow().frmAction.method = "POST";
          this.GetCurrentWindow().frmAction.target = target;
          this.GetCurrentWindow().frmAction.submit();
          this.GetCurrentWindow().frmAction.WebMessage.value = "";
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_Download", "Section1")
  }
}

function WebControl_EditUpload(sender)
{
  try
  {
    var rowState = WebData.GetRowState(sender.oRecord);
    if (rowState == "inserted")
    {
      alert(ids_SaveFirst);
    }
    else
    {
      var fqn = this.GetFqn(sender);
      var fd = FormDescriptor.GetFieldDescriptor(fqn);
      var upld = FormDescriptor.GetUploadDescriptor(fd.getAttribute("UploadDescriptorFqn"));
      var itemFulleName = WebData.GetFieldValue(sender.oRecord, upld.getAttribute("ItemFullNameFqn"));
      
      if (itemFulleName == null || itemFulleName.length == 0)
      {    
        alert(ids_UploadFirst);
      }
      else
      {
        if (upld.getAttribute("UploadStorageType") == enum_UploadStorageType_FileSystem)
        {
          this.OpenFile(itemFulleName);
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_EditUpload", "Section1")
  }
}


function WebControl_DisableNavMenu()
{
  try
  {
    if (parent.frames["NavFrame"])
    {
      if (parent.frames["NavFrame"].document != null)
      {
        var oElements = this.GetCurrentWindow().parent.frames["NavFrame"].document.body.getElementsByTagName("INPUT");
        for (var i = 0, len = oElements.length; i < len; i++)
        {
          this.AddDisabledControl(oElements[i]);  
        }
        var oElements = this.GetCurrentWindow().parent.frames["NavFrame"].document.body.getElementsByTagName("IMG");
        for (var i = 0, len = oElements.length; i < len; i++)
        {
          this.AddDisabledControl(oElements[i]);  
        }
      }
    }
    else
    {
      var footer = document.getElementById("PageFooterContainer");
      if (footer != null)
      {
        var oElements = footer.getElementsByTagName("INPUT");
        for (var i = 0, len = oElements.length; i < len; i++)
        {
          this.AddDisabledControl(oElements[i]);  
        }
        var oElements = footer.getElementsByTagName("IMG");
        for (var i = 0, len = oElements.length; i < len; i++)
        {
          this.AddDisabledControl(oElements[i]);  
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_DisableNavMenu", "Section1")
  }
}

function WebControl_SetPageLinkStyle(oLink)
{
  try
  {
    oLink.className = oLink.IsActive == true ? "PagingLinkCurrent" : "PagingLink";
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_SetPageLinkStyle", "Section1")
  }
}

function WebControl_ShowCriterias(oControl)
{
  try
  {
    var oContainer = WebDataSearch.Container;
    
    if (oContainer != null)
    {
      //this.PositionControl(oContainer, true, null);
      this.PositionControl2(oContainer, oControl, 0);   
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ShowCriterias", "Section1")
  }
}

function WebControl_GetWebDataGridMain(silent)
{
  try
  {
    silent = silent == null ? false : silent;
    
    var oWebDataGrid = null;

    if (typeof(WebDataGridMain) != "undefined" && WebDataGridMain != null && WebDataGridMain.length > 0)
    {
      oWebDataGrid = WebDataGridCollection[WebDataGridMain[0]];
    }
        
    if (oWebDataGrid == null)
    {
      if (silent == false)
      {
        alert(ids_WebDataGridMainNotSpecified);
      }  
    }
      
    return oWebDataGrid;  
    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetWebDataGridMain", "Section1")
  }
}

function WebControl_GetWebSpreadSheetMain(silent)
{
  try
  {
    silent = silent == null ? false : silent;
    
    var oWebSpreadSheet = null;

    if (typeof(WebSpreadSheetMain) != "undefined" && WebSpreadSheetMain != null && WebSpreadSheetMain.length > 0)
    {
      oWebSpreadSheet = WebSpreadSheetCollection[WebSpreadSheetMain[0]];
    }
        
    if (oWebSpreadSheet == null)
    {
      if (silent == false)
      {
        alert(ids_WebSpreadSheetMainNotSpecified);
      }  
    }
      
    return oWebSpreadSheet;  
    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetWebSpreadSheetMain", "Section1")
  }
}

function WebControl_GetWebTreeViewMain(silent)
{
  try
  {
    silent = silent == null ? false : silent;
    
    var oWebTreeView = null;

    if (typeof(WebTreeViewMain) != "undefined" && WebTreeViewMain != null && WebTreeViewMain.length > 0)
    {
      oWebTreeView = WebTreeViewCollection[WebTreeViewMain[0]];
    }

    if (oWebTreeView == null)
    {
      if (silent == false)
      {
        alert(ids_WebTreeViewMainNotSpecified);
      }  
    }
      
    return oWebTreeView;  
    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetWebTreeViewMain", "Section1")
  }
}

function WebControl_ShowSearch(sender)
{
  try
  {
    if (WebDataSearch.IsVisible()) WebDataSearch.Hide();
    else WebDataSearch.Show();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ShowSearch", "Section1")
  }
}

function WebControl_ShowSelection(oControl)
{
  try
  {
    var webDataGridMain = this.GetWebDataGridMain(true);
    if (webDataGridMain && webDataGridMain.Container)
    {
      this.ScrollToControl(webDataGridMain.Container, Graphic3DInstance.Top_Top, 0);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ShowSelection", "Section1")
  }
}

function WebControl_Pick(oObject) 
{
  try
  {
    if (oObject!=null){
      oObject.disabled = true;
    }  

    var id = this.CreateUniqueClientId(oObject.oRecord, oObject.getAttribute("TextBoxClientID"));
    var oInput = this.GetCurrentDocument().getElementById(id);
    
    var fqn = this.GetFqn(oInput);
    oObject.setAttribute("FieldDescriptorFqn", fqn);
    var searchFqn = oObject.getAttribute("SearchFqn");
    if (searchFqn == null)
    {
      oObject.setAttribute("SearchFqn", fqn)
    }
    
    
    var pickList = WebDataSearch.GetCommaSeperatedList(oObject);
    if (pickList.length > 0)
    {
      if (oInput.value.length > 0)
      {
        pickList = oInput.value + ";" + pickList;
      }
      this.SetValue(oInput, pickList);
    }

    if (oObject!=null){
      oObject.disabled = false;
    }  
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_Pick", "Section1")
  } 
}

function WebControl_MoveText(moverButton, fqn1, fqn2) 
{
  try
  {
    var bindingHash = WebData.GetBindingHash(fqn2, moverButton.oRecord);
    var binder = this.FieldToHtmlObject.Get(bindingHash);
    if (binder != null) 
    {
      var oTarget = binder.HtmlObjects.Get(0);
      if (oTarget != null)
      {
        var webData = WebData.GetFieldValue(moverButton.oRecord, fqn1);
        dataField = new Object();
        dataField.text = webData;
        var controlData = this.ConvertWebDataToControlData(oTarget, oTarget.oFieldDescriptor, dataField);
        this.SetValue(oTarget, controlData);
        this.SetIf(moverButton);
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_MoveText", "Section1")
  } 
}

function WebControl_MoveItem(oObject) 
{
  try
  {
    var id = this.CreateUniqueClientId(oObject.oRecord, oObject.getAttribute("MoverListBoxClientID"));
    var moverListBox = this.GetCurrentDocument().getElementById(id);
    var moverDescriptor = FormDescriptor.GetMoverDescriptor(moverListBox.getAttribute("MoverDescriptorFqn"));

    var id = this.CreateUniqueClientId(oObject.oRecord, moverListBox.getAttribute("ListBoxLeftClientID"));
    var oSelectLeft = this.GetCurrentDocument().getElementById(id);
    var id = this.CreateUniqueClientId(oObject.oRecord, moverListBox.getAttribute("ListBoxRightClientID"));
    var oSelectRight = this.GetCurrentDocument().getElementById(id);
    
    switch(oObject.getAttribute("ButtonType"))
    {
      case "Select":
          var oMoveRecordMode = moverDescriptor.getAttribute("MoveRecordMode");
          if (oMoveRecordMode == "NoAction")
          {
            var optionArray = new Array();
            for (var i = oSelectLeft.options.length-1; i >= 0; i--)
            {
              if (oSelectLeft.options(i).selected == true)
              {
                this.MoveOption(i, oSelectLeft, oSelectRight, moverDescriptor, optionArray);
              }
            }
            
            for (var i = optionArray.length-1; i >= 0; i--)
            {
              oSelectRight.options.add(optionArray[i]);
            }
          }
          else
          {
            for (var i = oSelectLeft.options.length-1; i >= 0; i--)
            {
              if (oSelectLeft.options(i).selected == true)
              {
                this.MoveOption(i, oSelectLeft, oSelectRight, moverDescriptor);
              }
            }
          }
        break;
      case "SelectAll":
          var oMoveRecordMode = moverDescriptor.getAttribute("MoveRecordMode");
          if (oMoveRecordMode == "NoAction")
          {
            var optionArray = new Array();
            for (var i = oSelectLeft.options.length-1; i >= 0; i--)
            {
              this.MoveOption(i, oSelectLeft, oSelectRight, moverDescriptor, optionArray);
            }
            
            for (var i = optionArray.length-1; i >= 0; i--)
            {
              oSelectRight.options.add(optionArray[i]);
            }
          }
          else
          {
            for (var i = oSelectLeft.options.length-1; i >= 0; i--)
            {
              this.MoveOption(i, oSelectLeft, oSelectRight, moverDescriptor);
            }
          }
     
        break;
        
      case "DeselectAll":
      
           var oMoveRecordMode = moverDescriptor.getAttribute("MoveRecordMode");
          if (oMoveRecordMode == "NoAction")
          {
            var optionArray = new Array();
            for (var i = oSelectRight.options.length-1; i >= 0; i--)
            {
              this.MoveOptionBack(i, oSelectLeft, oSelectRight, moverDescriptor, optionArray);
            }
            
            for (var i = optionArray.length-1; i >= 0; i--)
            {
              oSelectLeft.options.add(optionArray[i]);
            }
          }
          else
          {
            for (var i = oSelectRight.options.length-1; i >= 0; i--)
            {
              this.MoveOptionBack(i, oSelectLeft, oSelectRight, moverDescriptor);
            }
          }
        
        break;
        
      case "Deselect":
      
       var oMoveRecordMode = moverDescriptor.getAttribute("MoveRecordMode");
          if (oMoveRecordMode == "NoAction")
          {
            var optionArray = new Array();
            for (var i = oSelectRight.options.length-1; i >= 0; i--)
            {
              if (oSelectRight.options(i).selected == true)
              {
                this.MoveOptionBack(i, oSelectLeft, oSelectRight, moverDescriptor, optionArray);
              }
            }
            
            for (var i = optionArray.length-1; i >= 0; i--)
            {
              oSelectLeft.options.add(optionArray[i]);
            }
          }
          else
          {
            for (var i = oSelectRight.options.length-1; i >= 0; i--)
            {
              if (oSelectRight.options(i).selected == true)
              {
                this.MoveOptionBack(i, oSelectLeft, oSelectRight, moverDescriptor);
              }
            }
          }
        break;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_MoveItem", "Section1")
  } 
}

function WebControl_MoveOption(index, oSelectLeft, oSelectRight, moverDescriptor, optionArray)
{
  try
  { 
    var oMoveRecordMode = moverDescriptor.getAttribute("MoveRecordMode");
    if (oMoveRecordMode == "NoAction")
    {
      var oOption1 = oSelectLeft.options[index];
      oSelectLeft.options.remove(index);
      oOption1.selected = false;
      optionArray[optionArray.length] = oOption1;
      
      var afterMoveRecordHandler = oSelectLeft.getAttribute("ListBoxLeftAfterMoveRecordHandler");
      if (typeof(afterMoveRecordHandler) == "string")
      {
        var args = new EventArgs();
        args.Record = oOption1.oRecord;
        args.Option = oOption1;
        eval(afterMoveRecordHandler + "(oOption1, args);");
      }
    }
    else
    {
      var oOption1 = oSelectLeft.options[index];
      var oOption2 = this.GetCurrentDocument().createElement("OPTION");

      var tempIndex = this.Find(oSelectRight, Ilp.HtmlDom.GetText(oOption1));
      oSelectRight.add(oOption2, tempIndex);

      Ilp.HtmlDom.SetText(oOption2, Ilp.HtmlDom.GetText(oOption1));

      oSelectLeft.options.remove(index);
      
      var newRecord = WebData.NewRecord(moverDescriptor.getAttribute("RightTdFqn"));
      
      var fqnListLeft = moverDescriptor.getAttribute("LeftFdFqnList").split(" ");
      var fqnListRight = moverDescriptor.getAttribute("RightFdFqnList").split(" ");
      for (var j = 0; j < fqnListLeft.length; j++)
      {
        var value = WebData.GetFieldValue(oOption1.oRecord, oOption1.oRecord.nodeName + "." + fqnListLeft[j]);
        WebData.SetFieldValueOnly(newRecord, newRecord.nodeName + "." + fqnListRight[j], value);
      }
      
      WebData.SetFieldValue(newRecord, moverDescriptor.getAttribute("RightTextFqn"), Ilp.HtmlDom.GetText(oOption2));
      oOption2.oRecordLeft = oOption1.oRecord;
      oOption2.oRecord = newRecord;
      WebData.AddRecord(newRecord, oSelectRight.oRecord);
      
      oOption2.value = WebData.GetRowOrder(newRecord);
    }
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebControl_MoveOption", "Section1")
  } 
}

function WebControl_MoveOptionBack(index, oSelectLeft, oSelectRight, moverDescriptor, optionArray)
{
  try
  { 
    var oMoveRecordMode = moverDescriptor.getAttribute("MoveRecordMode");
    if (oMoveRecordMode == "NoAction")
    {
      var oOption1 = oSelectRight.options[index];
      oSelectRight.options.remove(index);
      oOption1.selected = false;
      optionArray[optionArray.length] = oOption1;
      
      var afterMoveRecordHandler = oSelectRight.getAttribute("ListBoxRightAfterMoveRecordHandler");
      if (typeof(afterMoveRecordHandler) == "string")
      {
        var args = new EventArgs();
        args.Record = oOption1.oRecord;
        args.Option = oOption1;
        eval(afterMoveRecordHandler + "(oOption1, args);");
      }
    }
    else
    {
      var oOption1 = oSelectRight.options[index];
      var oOption2 = this.GetCurrentDocument().createElement("OPTION");
      
      var tempIndex = this.Find(oSelectLeft, Ilp.HtmlDom.GetText(oOption1));
      oSelectLeft.add(oOption2, tempIndex);

      Ilp.HtmlDom.SetText(oOption2, Ilp.HtmlDom.GetText(oOption1));
      oOption2.oRecord = oOption1.oRecordLeft;

      oOption2.value = WebData.GetFieldValue(oOption2.oRecord, moverDescriptor.getAttribute("RightIDFqn"));
      
      WebData.Delete(oOption1.oRecord);

      oSelectRight.options.remove(index);
    }
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebControl_MoveOptionBack", "Section1")
  } 
}

function WebControl_Find(oTarget, toFind)
{
  try
  {
    var index = 0;
    var allOptions = oTarget.options;

    // Umlaute berücksichtigen
    toFind = this.ReplaceUmlaut(toFind);
    toFind = toFind.toUpperCase();

    for (i = 0, len = allOptions.length; i < len; i++)
    {
      nextOptionText = allOptions(i).text.toUpperCase();

      // By default, the values in the listbox and as entered by the  
      // user are strings. This causes a string comparison to be made, 
      // which is not correct for numbers (1 < 11 < 2).
      // The following lines coerce numbers into an (internal) number 
      // format so that the subsequent comparison is done as a 
      // number (1 < 2 < 11).

      if(!isNaN(nextOptionText) && !isNaN(toFind) )
      {
        nextOptionText *= 1;        // coerce into number
        toFind *= 1;
      }
      else
      {
        nextOptionText = this.ReplaceUmlaut(nextOptionText);
      }

      // Does the next item match exactly what the user typed?
      if(toFind == nextOptionText)
      {
        // OK, we can stop at this option. Set focus here
        index = i;
        break;
      }

      // If the string does not match exactly, find which two entries 
      // it should be between.
      if(i < allOptions.length - 1)
      {
        // If we are not yet at the last listbox item, see if the 
        // search string comes between the current entry and the next 
        // one. If so, place the selection there.

        lookAheadOptionText = allOptions(i+1).text.toUpperCase() ;
        lookAheadOptionText = this.ReplaceUmlaut(lookAheadOptionText);
        if( (toFind > nextOptionText) && (toFind < lookAheadOptionText) )
        {
          index = i + 1;
          break;
        }
      }
      else
      {
        // If we are at the end of the entries and the search string 
        // is still higher than the entries, select the last entry
        if(toFind > nextOptionText)
        {
          index = allOptions.length; // stick it at the end
          break;
        }
      }
    }
    
    return index;
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebControl_Find", "Section1");
  }
}

function WebControl_ReplaceUmlaut(stringValue)
{
  try
  {
    var returnString = stringValue;
    
    if (typeof(returnString) == "string")
    {
      returnString = returnString.replace("Ä", "AE");
      returnString = returnString.replace("Ö", "OE");
      returnString = returnString.replace("Ü", "UE");
    }
    
    return returnString;
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebControl_ReplaceUmlaut", "Section1");
  }
}

function WebControl_MergeRecord(oRecord, oDomStructure)
{
  try
  { 
    // Look for all objects to be bound
    oDomStructure.ClientBoundControlArray = new Array();
    this.FindClientBoundControls(oDomStructure, oDomStructure);
     
    var localArray = oDomStructure.ClientBoundControlArray;
    for (var i = 0, len = localArray.length; i < len; i++)
    {
      var oTarget = localArray[i];
      
      var oObject = new Object();
      oObject.oRecord = oRecord;
      oObject.oContainer = oDomStructure;
      if (oTarget.ObjectID == null)
      {
        oObject.ObjectID = oTarget.id;
        if (oRecord != null)
        {
          oObject.id = this.CreateUniqueClientId(oRecord, oTarget.id);
        }  
        oObject.name = oTarget.id;
      }
      else
      {
        oObject.ObjectID = oTarget.ObjectID;
        oObject.id = oTarget.id;
        oObject.name = oTarget.id;
      }
      
      this.MergeAttachedObjects(oObject, oTarget);
      this.SetEventHandler(oTarget);
      if (oRecord != null)
      {
        this.MergeData(oDomStructure, oTarget, oRecord);
      }  
    }  
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_MergeRecord", "Section1")
  }
}

function WebControl_GetContainer(control, controlType) 
{
  try
  {
    var root = control;
    
    while(root.getAttribute("ControlType") != controlType && root.tagName != "BODY")
    {
      root = root.parentNode;
    }
    
    return root;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetContainer", "Section1")
  }
}

function WebControl_GetChildContainer(parentContainer, tdFqn, oRecord)
{
  try
  {
    var bindingHash = WebData.GetBindingHash(tdFqn, oRecord, true);      
    var oChildContainer =	parentContainer.ChildGridCollection[bindingHash];
    return oChildContainer;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetChildContainer", "Section1")
  }
}

function WebControl_GetWindowHeight() 
{
  var windowHeight = 0;
  if (typeof(this.GetCurrentWindow().innerHeight)=='number') 
  {
    windowHeight = this.GetCurrentWindow().innerHeight;
  }
  else 
  {
    if (this.GetCurrentDocument().documentElement && this.GetCurrentDocument().documentElement.clientHeight) 
    {
      windowHeight = this.GetCurrentDocument().documentElement.clientHeight;
    }
    else 
    {
      if (this.GetCurrentDocument().body && this.GetCurrentDocument().body.clientHeight) 
      {
        windowHeight = this.GetCurrentDocument().body.clientHeight;
      }
    }
  }
  return windowHeight;
}

function WebControl_GetWindowWidth() 
{
  var windowWidth = 0;
  if (typeof(this.GetCurrentWindow().innerWidth)=='number') 
  {
    windowWidth = this.GetCurrentWindow().innerWidth;
  }
  else 
  {
    if (this.GetCurrentDocument().documentElement && this.GetCurrentDocument().documentElement.clientWidth) 
    {
      windowWidth = this.GetCurrentDocument().documentElement.clientWidth;
    }
    else 
    {
      if (this.GetCurrentDocument().body && this.GetCurrentDocument().body.clientWidth) 
      {
        windowWidth = this.GetCurrentDocument().body.clientWidth;
      }
    }
  }
  return windowWidth;
}

function WebControl_InitPostParameter(name, value)
{
  try
  {
    if (this.PostParameter)
    {
      for(var i = 0, len1 = this.PostParameter.length; i < len1; i++)
      {
        var oHidden = this.PostParameter[i];
        var parent = oHidden.parentNode;
        parent.removeChild(oHidden);
      }
    }
    
    this.PostParameter = new Array();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_InitPostParameter", "Section1")
  }
}

function WebControl_AddPostParameter(name, value, formName)
{
  try
  {
    formName = formName == null ? "frmAction" : formName;
    
    var oHidden = null;
    var oForm = document.forms[formName];
    
    var nodeList = oForm.childNodes;
    for(var i = 0, len1 = nodeList.length; i < len1; i++)
    {
      var oElement = nodeList[i];
      if (oElement.name == name)
      {
        oHidden = oElement;
        break;
      }
    }
    
    if (oHidden == null)
    {
      /*
      oHidden = document.createElement("<input type='hidden'>");
      oHidden.name = name;
      */
      oHidden = document.createElement("input");
      oHidden.setAttribute("type", "hidden");
      oHidden.setAttribute("name", name);
      oHidden.setAttribute("id", name);
      oForm.appendChild(oHidden);
    }
    
    oHidden.value = value;
    
    this.PostParameter[this.PostParameter.length] = oHidden;
    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_AddPostParameter", "Section1")
  }
}

function WebControl_SetPostParameter(name, value, formName)
{
  try
  {
    formName = formName == null ? "frmAction" : formName;

    var oHidden = null;
    var oForm = document.forms[formName];
    var isNew = false;
    
    var nodeList = oForm.childNodes;
    for(var i = 0, len1 = nodeList.length; i < len1; i++)
    {
      var oElement = nodeList[i];
      if (oElement.name == name)
      {
        oHidden = oElement;
        break;
      }
    }
    
    if (oHidden == null)
    {
      isNew = true;
      /*
      oHidden = document.createElement("<input type='hidden'>");
      oHidden.name = name;
      */
      oHidden = document.createElement("input");
      oHidden.setAttribute("type", "hidden");
      oHidden.setAttribute("name", name);
      oForm.appendChild(oHidden);
    }
    
    oHidden.value = value;

    if (isNew == true)
    {    
      this.PostParameter[this.PostParameter.length] = oHidden;
    }
    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_SetPostParameter", "Section1")
  }
}

function WebControl_GetPostParameter(name, value, formName)
{
  try
  {
    formName = formName == null ? "frmAction" : formName;

    var oHidden = null;
    var oForm = document.forms[formName];
    
    var nodeList = oForm.childNodes;
    for(var i = 0, len1 = nodeList.length; i < len1; i++)
    {
      var oElement = nodeList[i];
      if (oElement.name == name)
      {
        oHidden = oElement;
        break;
      }
    }
    
    var ret = "";
    if (oHidden != null)
    {
      ret = oHidden.value;
    }
    return  ret;   
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetPostParameter", "Section1")
  }
}

function WebControl_Submit(param, action, target, method, form, targetUrl, loginGuid) 
{
  try
  {
    param = param == null ? "" : param;
    target = target == null ? "_self" : target;
    method = method == null ? "post" : method;
    form = form == null ? "frmAction" : form;
    targetUrl = targetUrl == null ? "" : targetUrl;
    loginGuid = loginGuid == null ? "" : loginGuid;
    
    var pageParameterValue = WebControl.GetPageParamValue("PP");
    if (pageParameterValue)
    {
      WebControl.SetPostParameter("PP", pageParameterValue);
    }
    if (targetUrl.length > 0)
    {
      WebControl.SetPostParameter("TargetShowURL", targetUrl);
    }
    if (loginGuid.length > 0)
    {
      WebControl.SetPostParameter("LoginGuid", loginGuid);
    }
    
    if (action)
    {
      WebControl.GetCurrentDocument().forms[form].action = action;
    }
    WebControl.GetCurrentDocument().forms[form].target = target;
    WebControl.GetCurrentDocument().forms[form].method = method;
    if (WebControl.GetCurrentDocument().forms[form].Param)
    {
      WebControl.GetCurrentDocument().forms[form].Param.value = param;
    }
    WebControl.GetCurrentDocument().forms[form].submit();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_Submit", "Section1")
  }
}

function WebControl_FindText(searchWord) 
{
  try
  {
    if (searchWord.length == 0) return;
    
    var range = this.GetCurrentDocument().body.createTextRange();
    var textFound = new Array();
    for (var i = 0; range.findText(searchWord) != false; i++) 
    {
      textFound[textFound.length] = range.duplicate();
      range.collapse(false);
      if (i > 1000) break;
    }
    for (var i = 0; i < textFound.length; i++) 
    {
      textFound[i].pasteHTML("<span style=\"background-color: yellow;\">" + textFound[i].text + "</span>");
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_FindText", "Section1")
  }
}



function WebControl_GetOuterDimension(oControl, property)
{
  try
  {
    var returnValue = 0;
 
    switch(property)
    {
      case "height":
        returnValue = oControl.clientHeight
         + this.GetCss(oControl, "marginTop")
         + this.GetCss(oControl, "marginBottom")
         + this.GetCss(oControl, "borderTop")
         + this.GetCss(oControl, "borderBottom");
         
        break;

      case "width":
        if (oControl.tagName == "BODY")
        {
          returnValue = oControl.scrollWidth
            + this.GetCss(oControl, "marginLeft")
            + this.GetCss(oControl, "marginRight")
            + this.GetCss(oControl, "borderLeft")
            + this.GetCss(oControl, "borderRight");
        }
        else
        {
          returnValue = oControl.clientWidth
            + this.GetCss(oControl, "marginLeft")
            + this.GetCss(oControl, "marginRight")
            + this.GetCss(oControl, "borderLeft")
            + this.GetCss(oControl, "borderRight");
        } 
        break;
    }  
    
    return returnValue;
  }
  catch(exception)
  {
    //WebMessage.SendClientLog(exception, "WebControl_GetOuterDimension", "Section1")
  }
}

function WebControl_GetCss(oControl, property)
{
  try
  {
    var returnValue = 0;
 
    switch(property)
    {
      case "marginTop":
        /*
        if (oControl.currentStyle.marginTop && oControl.currentStyle.marginTop != "auto")
        */
        if (Ilp.HtmlDom.GetStyle(oControl, "marginTop") && Ilp.HtmlDom.GetStyle(oControl, "marginTop") != "auto")
        {
          /*
          returnValue = parseInt(oControl.currentStyle.marginTop);
          */
          returnValue = parseInt(Ilp.HtmlDom.GetStyle(oControl, "marginTop"));
        }
        break;
      case "marginLeft":
        /*
        if (oControl.currentStyle.marginLeft && oControl.currentStyle.marginLeft != "auto")
        */
        if (Ilp.HtmlDom.GetStyle(oControl, "marginLeft") && Ilp.HtmlDom.GetStyle(oControl, "marginLeft") != "auto")
        {
          /*
          returnValue = parseInt(oControl.currentStyle.marginLeft);
          */
          returnValue = parseInt(Ilp.HtmlDom.GetStyle(oControl, "marginLeft"));
        }
        break;
      case "marginRight":
        /*
        if (oControl.currentStyle.marginRight && oControl.currentStyle.marginRight != "auto")
        */
        if (Ilp.HtmlDom.GetStyle(oControl, "marginRight") && Ilp.HtmlDom.GetStyle(oControl, "marginRight") != "auto")
        {
          /*
          returnValue = parseInt(oControl.currentStyle.marginRight);
          */
          returnValue = parseInt(Ilp.HtmlDom.GetStyle(oControl, "marginRight"));
        }
        break;
      case "marginBottom":
        /*
        if (oControl.currentStyle.marginBottom && oControl.currentStyle.marginBottom != "auto")
        */
        if (Ilp.HtmlDom.GetStyle(oControl, "marginBottom") && Ilp.HtmlDom.GetStyle(oControl, "marginBottom") != "auto")
        {
          /*
          returnValue = parseInt(oControl.currentStyle.marginBottom);
          */
          returnValue = parseInt(Ilp.HtmlDom.GetStyle(oControl, "marginBottom"));
        }
        break;
      case "borderTopWidth":
        /*
        if (oControl.currentStyle.borderTopWidth != "auto")
        */
        if (Ilp.HtmlDom.GetStyle(oControl, "borderTopWidth") && Ilp.HtmlDom.GetStyle(oControl, "borderTopWidth") != "auto")
        {
          /*
          returnValue = parseInt(oControl.currentStyle.borderTopWidth);
          */
          returnValue = parseInt(Ilp.HtmlDom.GetStyle(oControl, "borderTopWidth"));
        }
        break;
      case "borderLeftWidth":
        /*
        if (oControl.currentStyle.borderLeftWidth != "auto")
        */
        if (Ilp.HtmlDom.GetStyle(oControl, "borderLeftWidth") && Ilp.HtmlDom.GetStyle(oControl, "borderLeftWidth") != "auto")
        {
          /*
          returnValue = parseInt(oControl.currentStyle.borderLeftWidth);
          */
          returnValue = parseInt(Ilp.HtmlDom.GetStyle(oControl, "borderLeftWidth"));
        }
        break;
      case "borderRightWidth":
        /*
        if (oControl.currentStyle.borderRightWidth != "auto")
        */
        if (Ilp.HtmlDom.GetStyle(oControl, "borderRightWidth") && Ilp.HtmlDom.GetStyle(oControl, "borderRightWidth") != "auto")
        {
           /*
          returnValue = parseInt(oControl.currentStyle.borderRightWidth);
          */
          returnValue = parseInt(Ilp.HtmlDom.GetStyle(oControl, "borderRightWidth"));
        }
        break;
      case "borderBottomWidth":
        /*
        if (oControl.currentStyle.borderBottomWidth != "auto")
        */
        if (Ilp.HtmlDom.GetStyle(oControl, "borderBottomWidth") && Ilp.HtmlDom.GetStyle(oControl, "borderBottomWidth") != "auto")
        {
          /*
          returnValue = parseInt(oControl.currentStyle.borderBottomWidth);
          */
          returnValue = parseInt(Ilp.HtmlDom.GetStyle(oControl, "borderBottomWidth"));
        }
        break;
      case "width":
        /*
        if (oControl.runtimeStyle.width != "")
        */
        if (Ilp.HtmlDom.GetStyle(oControl, "width") != "")
        {
          /*
          returnValue = parseInt(oControl.runtimeStyle.width);
          */
          returnValue = parseInt(Ilp.HtmlDom.GetStyle(oControl, "width"));
        }
        break;
      case "height":
        /*
        if (oControl.runtimeStyle.height != "")
        */
        if (Ilp.HtmlDom.GetStyle(oControl, "height") != "")
        {
          /*
          returnValue = parseInt(oControl.runtimeStyle.height);
          */
          returnValue = parseInt(Ilp.HtmlDom.GetStyle(oControl, "height"));
        }
        break;
    }  
    
    if (isNaN(returnValue) == true) returnValue = 0;
    
    return returnValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetCss", "Section1")
  }
}


function WebControl_PagingScrollLeft(oControl)
{
  try
  {
    alert("Scroll left");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_PagingScrollLeft", "Section1")
  }
}

function WebControl_OpenExcelDownload()
{
  try
  {
    var localFeatures = "";
    
    localFeatures += "top = 100px,";
    localFeatures += "left = 100px,";
    localFeatures += "width = 750px,";
    localFeatures += "height = 420px,";
    localFeatures += "scroll = Yes,";
    localFeatures += "status = No,";
    localFeatures += "resizable = Yes";
  
  
    WebMessage.SetGeneralInfoAttribute("PageLogo", PageLogo);
    WebMessage.SetGeneralInfoAttribute("IDProgram", IDProgram);
    WebMessage.SaveWebMessageTransfer();
    
    var IDWebMessageTransfer = WebMessage.GetGeneralInfoAttribute("IDWebMessageTransfer");
    var IDSessionInfo = WebMessage.GetGeneralInfoAttribute("IDSessionInfo");
    var url =  GlobalScriptsDirectoryVirtual + "GTCommon/DownloadExcelExport.aspx?IDSessionInfo=" + IDSessionInfo + "&WM=" + String(IDWebMessageTransfer) + "&RootID=" + WebMessage.GetGeneralInfoAttribute("RootID") + "&IDProgram=" + String(IDProgram);
      
    if (this.ExportPage == null || this.ExportPage.closed)
    {
      this.ExportPage = window.open(
        url,
        '_blank',
        localFeatures,
        true);
    }
    else
    {
      this.ExportPage.navigate(url);
      this.ExportPage.focus();
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_OpenExcelDownload", "Section1")
  }
}

function WebControl_OpenFile(url)
{
  try
  {
    var openNewWindow = false;
    
    var localFeatures = "";
    
    if (url.indexOf(".xls") > 0
      || url.indexOf(".pdf") > 0
      || url.indexOf(".txt") > 0
      || url.indexOf(".doc") > 0
      || url.indexOf(".jpg") > 0
      || url.indexOf(".tif") > 0)
    {
      localFeatures += "top = 100,";
      localFeatures += "left = 100,";
      localFeatures += "width = 600,";
      localFeatures += "height = 400,";
      localFeatures += "scrollbars = yes,";
      localFeatures += "status = no,";
      localFeatures += "resizable = yes,";
      localFeatures += "location = no,";
      localFeatures += "menubar = yes";
    }
    else
    {
      localFeatures += "top = 100,";
      localFeatures += "left = 100,";
      localFeatures += "width = 100,";
      localFeatures += "height = 100,";
      localFeatures += "scrollbars = no,";
      localFeatures += "status = no,";
      localFeatures += "resizable = yes,";
      localFeatures += "location = no,";
      localFeatures += "menubar = no";
    }
    
    //var oRet = this.OpenWindow("Download", url, "_blank", localFeatures, true);
    var oRet = WebControl.Open(url, "_blank", localFeatures, true);
    
    return oRet;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_OpenDownload", "Section1")
  }
}

function WebControl_OpenTextDownload(url, windowHash)
{
  try
  {
    oRet = null;
    
    windowHash = windowHash == null ? "Download" : windowHash;
    var openNewWindow = false;
    
    var localFeatures = "";
    localFeatures += "top = 100,";
    localFeatures += "left = 100,";
    localFeatures += "width = 750px,";
    localFeatures += "height = 420px,";
    localFeatures += "scrollbars = yes,";
    localFeatures += "status = no,";
    localFeatures += "resizable = yes,";
    localFeatures += "location = no,";
    localFeatures += "menubar = no";
    
    oRet = this.OpenWindow(windowHash, url, "_blank", localFeatures, true);

    return oRet;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_OpenTextDownload", "Section1")
  }
}

function WebControl_OpenDownload(url)
{
  try
  {
    var openNewWindow = false;
    
    var localFeatures = "";
    
    if (url.indexOf(".xls") > 0
      || url.indexOf(".pdf") > 0
      || url.indexOf(".txt") > 0
      || url.indexOf(".doc") > 0
      || url.indexOf(".jpg") > 0
      || url.indexOf(".tif") > 0)
    {
      localFeatures += "top = 100,";
      localFeatures += "left = 100,";
      localFeatures += "width = 600,";
      localFeatures += "height = 400,";
      localFeatures += "scrollbars = yes,";
      localFeatures += "status = no,";
      localFeatures += "resizable = yes,";
      localFeatures += "location = no,";
      localFeatures += "menubar = yes";
    }
    else
    {
      localFeatures += "top = 100,";
      localFeatures += "left = 100,";
      localFeatures += "width = 100,";
      localFeatures += "height = 100,";
      localFeatures += "scrollbars = no,";
      localFeatures += "status = no,";
      localFeatures += "resizable = yes,";
      localFeatures += "location = no,";
      localFeatures += "menubar = no";
    }
    
    //var oRet = this.OpenWindow("Download", url, "_blank", localFeatures, true);
    var oRet = WebControl.Open(url, "_blank", localFeatures, true);
    
    return oRet;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_OpenDownload", "Section1")
  }
}

function WebControl_UrlDownload(url)
{
  try
  {
    this.GetCurrentDocument().forms["frmAction"].method = "POST";
    this.GetCurrentDocument().forms["frmAction"].encoding = 'application/x-www-form-urlencoded';
    this.GetCurrentDocument().forms["frmAction"].target = "_self";
    this.GetCurrentDocument().forms["frmAction"].action = url;
    this.GetCurrentDocument().forms["frmAction"].submit();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_UrlDownload", "Section1")
  }
}

function WebControl_ShowModalDialog(url, features, oRecord, detailTableAffected)
{
  try
  {
    var oRet = null;
    
    if (features == null)
    {
      features = "";
      features += "dialogWidth:530px;";
      features += "dialogHeight:550px;";
      features += "scroll:No;";
      features += "status:No;";
      features += "resizable:No;";
    }
    
    if (oRecord != null)
    {
      WebData.SetCurrentRecord(oRecord);
      this.GetCurrentWindow().TableAffected = oRecord.nodeName;
      this.GetCurrentWindow().DetailTableAffected = detailTableAffected;
    }
    
    oRet = this.GetCurrentWindow().showModalDialog(url, this.GetCurrentWindow(), features);
    
    this.SetCurrentWindow(window);
    
    if (oRecord != null)
    {
      WebData.UpdateBinding(oRecord);
    }
    
    return oRet;  
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ShowModalDialog", "Section1")
  }
}

function WebControl_OpenWindow(windowName, url, name, features, replace)
{
  try
  {
    var oRet = null;
    
    var openNewWindow = false;
    
    if (this.WindowListHash[windowName] == null)
    {
      openNewWindow = true;
    }
    else
    {
      var isClosed = false;
      try
      {
        isClosed = this.WindowListHash[windowName].closed;
      }
      catch(exception)
      {
        isClosed = true; 
      }
      if (isClosed == true)
      {
        this.WindowListHash[windowName] = null;
        openNewWindow = true;
      }
    }
    
    if (openNewWindow == true)
    {
      this.WindowListHash[windowName] = WebControl.Open(url, name, features, replace);
      if (this.WindowListHash[windowName] != null)
      {
        this.WindowListHash[windowName].WindowName = windowName;
        this.WindowListArray[this.WindowListArray.length] = this.WindowListHash[windowName];
      }
    }
    else
    {
      if (replace == true)
      {
        if (this.WindowListHash[windowName].location.href.indexOf(url) == -1)
        {
          this.WindowListHash[windowName].location.href = url;
        }
      }
      this.WindowListHash[windowName].focus();
    }
    oRet = this.WindowListHash[windowName];
    
    return oRet;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_OpenWindow", "Section1", this.OpenWindow)
  }
}

function WebControl_Open(url, name, features, replace)
{
  try
  {
    return this.GetCurrentWindow().open(url, name, features, replace);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_Open", "Section1")
  }
}

function WebControl_GetWindow(windowName)
{
  try
  {
    var oWindow = this.WindowListHash[windowName];
    var isClosed = false;
    try
    {
      isClosed = this.WindowListHash[windowName].closed;
    }
    catch(exception)
    {
      isClosed = true; 
    }
    if (oWindow && isClosed == true)
    {
      this.WindowListHash[windowName] = null;
      return null;
    }
    return oWindow;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetWindow", "Section1")
  }
}

function WebControl_CloseWindow(windowName)
{
  try
  {
    if (this.WindowListHash[windowName] != null)
    {
      this.WindowListHash[windowName].close();
      this.WindowListHash[windowName] = null;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_CloseWindow", "Section1")
  }
}

function WebControl_CloseAllWindow(windowName)
{
  try
  {
    for (var i = 0; i < this.WindowListArray.length; i++)
    {
      var isClosed = false;
      try
      {
        isClosed = this.WindowListHash[i].closed;
      }
      catch(exception)
      {
        isClosed = false; 
      }
      if (this.WindowListArray[i] && isClosed == false)
      {
        try
        {
          this.WindowListArray[i].close();
        }
        catch(exception)
        {
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_CloseAllWindow", "Section1")
  }
}

function WebControl_BodyOnUnload()
{
  try
  {
    if (window.CallingWindow)
    {
      this.BeforeCloseFrame();
    }  
    this.CloseAllWindow();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_BodyOnUnload", "Section1")
  }
}

function WebControl_SwitchDataSession(currentWindow, windowOpener)
{
  try
  {
    currentWindow.WebMessage.IsWebApplication = windowOpener.WebMessage.IsWebApplication;
    currentWindow.WebMessage.IsAlertEnabled = windowOpener.WebMessage.IsAlertEnabled;
     
    currentWindow.WebData = windowOpener.WebData;
    currentWindow.FormDescriptor = windowOpener.FormDescriptor;
    currentWindow.WebData.CurrentWindow = currentWindow;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_SwitchDataSession", "Section1")
  }
}

function WebControl_GetParentWindow(currentWindow)
{
  try
  {
    var parentWindow = null;
    if (currentWindow.frameElement)
    {
      parentWindow = currentWindow.frameElement.document.parentWindow;
    }
    else
    {
      parentWindow = currentWindow.parent;
    }
    
    return parentWindow;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetParentWindow", "Section1")
  }
}

function WebControl_ToggleText(oControl)
{
  try
  {
    var currentText = Ilp.HtmlDom.GetText(oControl);
    if (currentText && currentText == oControl.getAttribute("TrueText"))
    {
      this.SetValue(oControl, oControl.getAttribute("FalseText"), false);
      oControl.setAttribute("CurrentText", oControl.getAttribute("FalseText"));
    }
    else if (currentText && currentText == oControl.getAttribute("FalseText"))
    {
      this.SetValue(oControl, oControl.getAttribute("TrueText"), false);
      oControl.setAttribute("CurrentText", oControl.getAttribute("TrueText"));
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ToggleText", "Section1")
  }
}

function WebControl_IsExpanded(sender)
{
  try
  {
    var expanded = true;
    if (sender.src.indexOf(sender.getAttribute("TrueUrl")) > -1)
    {
      expanded = false
    }
    
    return expanded;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_IsExpanded", "Section1")
  }
}

function WebControl_ToggleImage(sender)
{
  try
  {
    if (sender.src.indexOf(sender.getAttribute("TrueUrl")) > -1)
    {
      sender.src = sender.getAttribute("FalseUrl");
    }
    else
    {
      sender.src = sender.getAttribute("TrueUrl");
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ToggleImage", "Section1")
  }
}

function WebControl_ToggleRows(sender, indexOfParentTable, startExpandValue)
{
  try
  {
    if (sender.TreeNode == null) // Wenn nicht null, ist es ein WebTreeView2 TreeNode ExpandButton, also mach nix.
    {
      var oTr = null;
      if (indexOfParentTable == null)
      {
        indexOfParentTable = 1;
        oTr = this.FindParentRow(sender, indexOfParentTable);
        if (oTr.parentNode.parentNode.parentNode.getAttribute("ControlType") == "WebDataToolbar"
          || oTr.parentNode.parentNode.parentNode.getAttribute("ControlType") == "ImageExtended")
        {
          indexOfParentTable = 2;
          oTr = this.FindParentRow(sender, indexOfParentTable);
        }
      }
      else
      {
        oTr = this.FindParentRow(sender, indexOfParentTable);
      }

      this.ToggleImage(sender);

      var expandTag = sender.getAttribute("ExpandTag");
      expandTag = expandTag == null ? "" : expandTag;

      if (oTr.tagName == "TR")
      {
        while(oTr.nextSibling != null && oTr.nextSibling.tagName == "TR")
        {
          oTr = oTr.nextSibling;
          var doExpand = this.IsExpandable(oTr, expandTag);
          if (doExpand == true)
          {
            if (oTr.getAttribute("Expanded") == null)
            {
              if (startExpandValue)
              {
                if (startExpandValue == "1")
                {
                  oTr.setAttribute("Expanded", "1");
                  Ilp.HtmlDom.SetStyle(oTr, "display", "block");
                }
                else
                {
                  oTr.setAttribute("Expanded", "0");
                  Ilp.HtmlDom.SetStyle(oTr, "display", "none");
                }
              }
              else
              {
                oTr.setAttribute("Expanded", "1");
                Ilp.HtmlDom.SetStyle(oTr, "display", "block");
              }
            }
            else if (oTr.getAttribute("Expanded") == "0")
            {
              oTr.setAttribute("Expanded", "1");
              Ilp.HtmlDom.SetStyle(oTr, "display", "block");
            }
            else
            {
              oTr.setAttribute("Expanded", "0");
              Ilp.HtmlDom.SetStyle(oTr, "display", "none");
            }
          }
        }  
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ToggleRows", "Section1")
  }
}

function WebControl_SetToggleState(sender, state, indexOfParentTable)
{
  try
  {
    indexOfParentTable = indexOfParentTable == null ? 1 : indexOfParentTable;

    this.ToggleImage(sender);

    var expandTag = sender.getAttribute("ExpandTag");
    expandTag = expandTag == null ? "" : expandTag;
    
    var oTr = this.FindParentRow(sender, indexOfParentTable);

    if (oTr.tagName == "TR")
    {
      while(oTr.nextSibling != null && oTr.nextSibling.tagName == "TR")
      {
        oTr = oTr.nextSibling;
        var doExpand = this.IsExpandable(oTr, expandTag);
        if (doExpand == true)
        {
          oTr.setAttribute("Expanded", state);
        }
      }  
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_SetToggleState", "Section1")
  }
}

function WebControl_FindParentRow(sender, indexOfParentTable)
{
  try
  {
    var parent = sender.parentElement;
    var count = 0;
    while((parent.tagName != "TR" && parent.tagName != "BODY") || (count < indexOfParentTable))
    {
      parent = parent.parentElement;
      count++;
    }
    
    return parent;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_FindParentRow", "Section1")
  }
}

function WebControl_FindParentByTagName(sender, tagName)
{
  try
  {
    var oCurrentNode = sender;
    while(oCurrentNode.tagName != tagName && oCurrentNode.tagName != "BODY")
    {
      oCurrentNode = oCurrentNode.parentElement;
    }
    
    return oCurrentNode;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_FindParentByTagName", "Section1")
  }
}

function WebControl_FindParentById(sender, id)
{
  try
  {
    var oCurrentNode = sender;
    while(oCurrentNode.id != id && oCurrentNode.tagName != "BODY")
    {
      oCurrentNode = oCurrentNode.parentElement;
    }
    
    return oCurrentNode;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_FindParentByTagName", "Section1")
  }
}

function WebControl_IsExpandable(oTr, expandTag)
{
  try
  {
    var doExpand = true;  
    if (expandTag.length > 0)
    {
      doExpand = oTr.getAttribute("ExpandTag") == expandTag;
    }
    else
    {
      var expandable = oTr.getAttribute("Expandable");
      if (expandable) doExpand = (expandable == "true");
    }
    
    return doExpand;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_IsExpandable", "Section1")
  }
}

function WebControl_SetTrueImage(sender)
{
  try
  {
    if (sender)
    {
      sender.src = sender.getAttribute("TrueUrl");
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_SetTrueImage", "Section1")
  }
}

function WebControl_SetFalseImage(sender)
{
  try
  {
    if (sender)
    {
      sender.src = sender.getAttribute("FalseUrl");
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_SetFalseImage", "Section1")
  }
}

function WebControl_FillConstrainedCombo(sender)
{
  try
  {
    var oComboTemplate  = null;
    var oComboNew       = null;
    var oComboOld       = null;
    var binder          = null;
    var j               = 0;    
    var fqn             = this.GetFqn(sender);
    
    var idValue = this.ConvertControlDataToWebData(sender, sender.oFieldDescriptor);
    if (idValue == "-1")
    {
      WebData.SetNullOnly(sender.oRecord, fqn);
    }
    else
    {
      WebData.SetFieldValueOnly(sender.oRecord, fqn, idValue);
    }
    
    var oFieldDescriptor = FormDescriptor.GetFieldDescriptor(fqn);
    var oLookUpRelationDescriptor = FormDescriptor.GetLookUpRelationDescriptor(oFieldDescriptor.getAttribute("LookUpRelationDescriptorFqn"));
    var tableDescriptorFqn = oLookUpRelationDescriptor.getAttribute("TableDescriptorFqnLookUp");
    var oTableDescriptorLookUp = FormDescriptor.GetTableDescriptor(tableDescriptorFqn);
    var dtrdList = FormDescriptor.GetRelationByMaster(tableDescriptorFqn);
    
    for (var i = 0; i < dtrdList.length; i++)
    {
      oDtrd = dtrdList[i];
      var tableDescriptorFqnDetail = oDtrd.getAttribute("TableDescriptorFqnDetail");
      lurdList = FormDescriptor.GetLookUpRelationByDetail(tableDescriptorFqnDetail);
      if (lurdList && lurdList.length > 0)
      {
        oLurd = lurdList[0]; // Es ist unwahrscheinlich mehrere abhaengige Combos fuer einen TableDescriptorFqnLookUp zu verwnden. Wird nicht unterstuezt.
        var constrainedFqn = oLurd.getAttribute("TableDescriptorFqnMaster") + "." + oLurd.getAttribute("FieldDescriptorFqnListMaster");
        var bindingHash = WebData.GetBindingHash(constrainedFqn, sender.oRecord);
        
        binder = this.FieldToHtmlObject.Get(bindingHash);
        if (binder != null) 
        {
          for(j = 0; j < binder.HtmlObjects.Count(); j++)
          {
            var oTarget = binder.HtmlObjects.Get(j);
            if (oTarget.getAttribute("ControlType") == "DropDownList")
            {
              oComboOld = oTarget;
              break;
            }
          }
        }
        
        if (oComboOld != null)
        {
          var xPathSelector = oComboOld.getAttribute("XPathSelector");
          if (typeof(xPathSelector) == "string")
          {
            var oXml = null
            if (XmlVersion == enum_XmlVersion_V1) oXml = this.GetCurrentDocument().getElementById(oComboOld.getAttribute("XMLSourceID"));
            else oXml = Ilp.XmlCache.XmlCacheList.Get(oComboOld.getAttribute("XMLSourceID"));

            var addPrompt = (sender.getAttribute("AllowPrompt") == "true");

            var comboTemplateWrapper = null;
            xPathSelector = this.PrepareXPathSelector(sender.oRecord, xPathSelector);
            comboTemplateWrapper = WebControl.ComboTemplates.GetInstance(xPathSelector);
            if (comboTemplateWrapper.oComboTemplate == null)
            {
              oComboNew = this.Fill(oComboOld, xPathSelector, addPrompt, oXml.selectSingleNode("NewDataSet"));
              comboTemplateWrapper.oComboTemplate = oComboNew.cloneNode(true);
            }
            else
            {
              var oComboNew = comboTemplateWrapper.oComboTemplate.cloneNode(true);
              oComboNew.mergeAttributes(oComboOld, false);
              this.MergeAttachedObjects(oComboOld, oComboNew);
              this.MergeAttachedEvents(oComboOld, oComboNew);
              oComboNew.setAttribute("State", "Filled");
              
              var oParent = oComboOld.parentElement;
              if (oParent)
              {
                oParent.insertBefore(oComboNew, oComboOld);
                oParent.removeChild(oComboOld);
              }
              if (addPrompt == true)
              {
                oComboNew.selectedIndex = 0;
              }
              else
              {
                oComboNew.selectedIndex = -1;
              }
            }
            WebData.ReplaceBinding(oComboOld, oComboNew);
            
            var autoComplete = oComboNew.getAttribute("AutoComplete");
            if (autoComplete != "false")
            {
              if (   (addPrompt == true && oComboNew.options.length == 2) 
                  || (addPrompt == false && oComboNew.options.length == 1))
              {
                if (addPrompt == true)
                {
                  oComboNew.selectedIndex = 1;
                }
                else
                {
                  oComboNew.selectedIndex = 0;
                }
                this.WriteToWebData(oComboNew);
              }
            }
          }

          this.FireEvent(oComboNew, "onchange")
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_FillConstrainedCombo", "Section1")
  }
}

function WebControl_FireEvent(oTarget, eventName)
{
  try
  {
    var oEvent = this.GetCurrentDocument().createEventObject();
    // Set an expando property on the event object. This will be used by the 
    // event handler to determine what element was clicked on.
    oEvent.expando = oTarget.id;
    oTarget.fireEvent(eventName, oEvent);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_FireEvent", "Section1")
  }
}

function WebControl_IsEditable(oTarget, oRecord, controlTemplateWrapper, recordWrapper)
{
  try
  {
    controlTemplateWrapper = controlTemplateWrapper == null ? WebControl.Controls.GetInstance(oTarget) : controlTemplateWrapper;
    recordWrapper = recordWrapper == null ? WebControl.Records.GetInstance(oRecord) : recordWrapper;
    
    var allowEdit = true;
    if (controlTemplateWrapper.AcAllowProtected == false)
    {
      if (allowEdit == true &&  controlTemplateWrapper.oContainer != null)
      {
        allowEdit = controlTemplateWrapper.oContainer.AllowEdit == false ? false : allowEdit;
      }
      if (recordWrapper != null && allowEdit == true)
      {
        allowEdit = recordWrapper.AllowEdit;
      }
    }
    
    return allowEdit;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_IsEditable", "Section1")
  }
}

function WebControl_IsDeletable(oTarget, oRecord, controlTemplateWrapper, recordWrapper)
{
  try
  {
    controlTemplateWrapper = controlTemplateWrapper == null ? WebControl.Controls.GetInstance(oTarget) : controlTemplateWrapper;
    recordWrapper = recordWrapper == null ? WebControl.Records.GetInstance(oRecord) : recordWrapper;
  
    var allowDelete = true;
    if (allowDelete == true && controlTemplateWrapper.oContainer != null)
    {
      allowDelete = controlTemplateWrapper.oContainer.AllowDelete == false ? false : allowDelete;    
    }
    if (recordWrapper != null && allowDelete == true)
    {
      allowDelete = recordWrapper.AllowDelete;
    }
    
    return allowDelete;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_IsDeletable", "Section1")
  }
}

function WebControl_IsCopyable(oTarget, oRecord, controlTemplateWrapper, recordWrapper)
{
  try
  {
    controlTemplateWrapper = controlTemplateWrapper == null ? WebControl.Controls.GetInstance(oTarget) : controlTemplateWrapper;
    recordWrapper = recordWrapper == null ? WebControl.Records.GetInstance(oRecord) : recordWrapper;
    
    var allowCopy = true;
    if (allowCopy == true && controlTemplateWrapper.oContainer != null)
    {
      allowCopy = controlTemplateWrapper.oContainer.AllowCopy == false ? false : allowCopy;
    }
    if (recordWrapper != null && allowCopy == true)
    {
      allowCopy = recordWrapper.AllowCopy;
    }
    
    return allowCopy;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_IsCopyable", "Section1")
  }
}

function WebControl_IsNewable(oTarget, oRecord, controlTemplateWrapper, recordWrapper)
{
  try
  {
    controlTemplateWrapper = controlTemplateWrapper == null ? WebControl.Controls.GetInstance(oTarget) : controlTemplateWrapper;
    recordWrapper = recordWrapper == null ? WebControl.Records.GetInstance(oRecord) : recordWrapper;
    
    var allowNew = true;
    if (allowNew == true && controlTemplateWrapper.oContainer != null)
    {
      allowNew = controlTemplateWrapper.oContainer.AllowNew == false ? false : allowNew;
    }
    if (recordWrapper != null && allowNew == true)
    {
      allowNew = recordWrapper.AllowNew;
    }
    
    return allowNew;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_IsNewable", "Section1")
  }
}

function WebControl_SendExcelMail(sender)
{
  try
  { 
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_SendExcelMail", "Section1")
  }
}

function WebControl_GetQueryParameter(url, parameterKey, parameterDefaultValue)
{
  try
  { 
    var parameterValue = parameterDefaultValue;
    var pair = url.split('?'); 
    var qs = "";
    if (pair.length == 1)
    {      
      qs = unescape(pair[0]);
    }
    else
    {
      qs = unescape(pair[1]);
    }
      
    // W3C recommendation, how to unescape uri attribute values
    // Beispiel: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1
    qs = qs.replace(/\+/g, ' ')
    
    var args = qs.split('&') 
    for (var i = 0; i < args.length; i++) 
    {
      var paramPair = args[i].split('=');
      var name = unescape(paramPair[0]);
      if (paramPair.length == 2)
      {
        value = unescape(paramPair[1]);
        if (name == parameterKey)
        {
          parameterValue = value;
          break;
        }
      }
    }
    return parameterValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetQueryParameter", "Section1")
  }
}

function WebControl_AddPrompt(oTarget, promptText)
{
  try
  { 
    promptText = promptText == null ? oTarget.getAttribute("PromptText") : promptText;
    if (oTarget.getAttribute("AllowPrompt") == "true")
    {
      var oOption = this.GetCurrentDocument().createElement("OPTION");
      oTarget.options.add(oOption, 0);
      oOption.text = oTarget.getAttribute("PromptText");

      oOption.value = "-1";
    }
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebControl_AddPrompt", "Section1")
  }
}

function WebControl_GetClass(sender)
{
  try
  {
    if (sender.oContainer && sender.oContainer.ClassType) return sender.oContainer;
    else if (Ilp.HtmlDom.IsHtmlElement(sender.oContainer) == true && sender.oContainer.JsInstance) return sender.oContainer.JsInstance;
    else if (sender.JsInstance) return sender.JsInstance;
    return null;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetClass", "Section1")
  }
}

function WebControl_GetControl(fqn, oRecord, valueSearched)
{
  var oControl = null;
  
  try
  {
    var bindingHash = WebData.GetBindingHash(fqn, oRecord);
    var binder = this.FieldToHtmlObject.Get(bindingHash);
    var found = false;
    if (binder != null) 
    {
      for(var j = 0; j < binder.HtmlObjects.Count(); j++)
      {
        oControl = binder.HtmlObjects.Get(j);
        if (valueSearched == null)
        {
          found = (oControl.oFieldDescriptor != null || binder.BinderType == "Dtrd");
        }
        else
        {
          found = (oControl.oFieldDescriptor != null && oControl.value == valueSearched);
        }
        
        if (found)
        {
          return oControl;
        }
      }
    }
    return null;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetControl", "Section1")
  }
}

function WebControl_CreateSender(oRecord)
{
  try
  {
    var oSender = new Object();
    oSender.oRecord = oRecord;
    
    return oSender;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_CreateSender", "Section1")
  }
}

function WebControl_GetAttachedLable(oControl)
{
  try
  {
    var attachedLable = oControl;
    switch(oControl.getAttribute("ControlType"))
    {
      case "RadioButton":
        attachedLable = oControl.nextSibling;
        break;
      case "CheckBox":
        attachedLable = oControl.nextSibling;
        break;
      case "TextBox":
      case "DropDownList":

        if (oControl.oGalaxy == null)
        {
          this.CheckGalaxy(oControl);
        }
        if (oControl.oGalaxy)
        {
          if (oControl.oGalaxy.oCaption)
          {
            switch(oControl.oGalaxy.oCaption.getAttribute("ControlType"))
            {
              case "CheckBox":
                attachedLable = oControl.oGalaxy.oCaption.nextSibling;
                break;
              default:
                attachedLable = oControl.oGalaxy.oCaption;
            }
          }
        }
        break;
    }
    
    return attachedLable;  
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetAttachedLable", "Section1")
  }
}


function WebControl_GetCurrentDocument()
{
  try
  {
    var currentWindow = this.GetCurrentWindow();
    return currentWindow.document;
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebControl_GetCurrentDocument", "Section1")
  }
}

function WebControl_GetCurrentWindow()
{
  try
  {
    return this.CurrentWindow == null ? window : this.CurrentWindow;
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebControl_GetCurrentWindow", "Section1")
  }
}

function WebControl_SetCurrentWindow(currentWindow)
{
  try
  {
    this.CurrentWindow = currentWindow;
    this.CollectValidators();
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebControl_SetCurrentWindow", "Section1")
  }
}


function WebControl_GetHeaderHeight(currentWindow)
{
  try
  {
    var heigth = 0;
    var oPageHeader = document.getElementById("phc");
    if (oPageHeader == null)
    {
      oPageHeader = document.getElementById("PageHeader");
    }
    if (oPageHeader)
    {
      heigth = WebControl.GetOuterDimension(oPageHeader, "height");
      //heigth += 4;
    }
    return heigth;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetHeaderHeight", "Section1")
  }
}

function WebControl_GetFooterHeight(currentWindow)
{
  try
  {
    var height = 0;
    var oPageFooter = document.getElementById("PageFooter");
    if (oPageFooter)
    {
      height = WebControl.GetOuterDimension(oPageFooter, "height");
      //height += 4;
    }
    return height;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetFooterHeight", "Section1")
  }
}

function WebControl_ShowNodeSelection(sender, args)
{
  try
  {
    var dialogFeatures = WebControl.GetDialogFeatures(580, 650);
    var windowFeatures = WebControl.GetWindowFeatures(580, 650, "1");
  
    var url = WebControl.GetStandardUrl("GlobalScripts/GTAdmin/ProgramTree/NodeSelection.aspx", Verb_Show, CallingMode_Dialog);
    url += "&NodeSelectionMode=" + String(enum_NodeSelectionMode_Node);
    if (this.CheckID(args.IDAppConfiguration) > 0)
    {
      url += "&IDAppConfiguration=" + args.IDAppConfiguration;
    }
  
    if (1==1)
    {
      WebControl.ShowModalDialog(url, dialogFeatures);
    }
    else
    {
      this.GetCurrentWindow().open(url, '_blank', windowFeatures, true);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ShowNodeSelection", "Section1")
  }
}

function WebControl_ShowTocSelection(sender, args)
{
  try
  {
    var dialogFeatures = WebControl.GetDialogFeatures(580, 650);
    var windowFeatures = WebControl.GetWindowFeatures(580, 650, "1");
  
    var url = WebControl.GetStandardUrl("GlobalScripts/GTAdmin/ProgramTree/NodeSelection.aspx", Verb_Show, CallingMode_Dialog);
    url += "&NodeSelectionMode=" + String(enum_NodeSelectionMode_TableOfContent);
    if (this.CheckID(args.IDAppConfiguration) > 0)
    {
      url += "&IDAppConfiguration=" + args.IDAppConfiguration;
    }
  
    if (1==1)
    {
      WebControl.ShowModalDialog(url, dialogFeatures);
    }
    else
    {
      this.GetCurrentWindow().open(url, '_blank', windowFeatures, true);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ShowTocSelection", "Section1")
  }
}

function WebControl_ShowSystemRequirement(oObject, requestedPage)
{
  try
  {
    requestedPage = requestedPage == null ? "" : requestedPage;
    
    var oWindow = null;
    var dialogFeatures = WebControl.GetDialogFeatures(700, 600);
    //var windowFeatures = WebControl.GetWindowFeatures(700, 400, "1");
    var windowFeatures = WebControl.GetWindowFeatures(700, 600);
    
    if (requestedPage.length == 0)
    {
      requestedPage = "GlobalScripts/GTCommon/SystemRequirements.aspx";
    }
    var url = WebControl.GetStandardUrl(requestedPage, Verb_Show, CallingMode_SystemRequirement);
    
    oWindow = WebControl.OpenWindow("SystemRequirements", url, "_blank", windowFeatures, true);
    oWindow.focus();
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ShowSystemRequirement", "Section1")
  }  
}

function WebControl_ShowAccountRequest(oObject, requestedPage)
{
  try
  {
    requestedPage = requestedPage == null ? "" : requestedPage;
    
    var oWindow = null;
    var dialogFeatures = WebControl.GetDialogFeatures(700, 550);
    var windowFeatures = WebControl.GetWindowFeatures(700, 550, "0");
    
    if (requestedPage.length == 0)
    {
      if (   RootID == RootID_ePro
          || RootID == RootID_ePro_SEPRO
          || RootID == RootID_ePro_KAM
          || RootID == RootID_ePro_Projects
          || RootID == RootID_ePro_Markets
          || RootID == RootID_KAMnet
          || RootID == RootID_eCon
          || RootID == RootID_eCos)
      {
        requestedPage = "GlobalScripts/GTCommon/AccountRequestProRef.aspx?Language=" + Language;
      }
      else if (RootID == RootID_SEPROnet)
      {
        requestedPage = "GlobalScripts/GTCommon/AccountRequestSEPROnet.aspx?Language=" + Language;
      }
      else if (RootID == RootID_ChromoTekWop) 
      {
        requestedPage = "GlobalScripts/GTCommon/AccountRequestWop.aspx";
      }
      else
      {
        requestedPage = "GlobalScripts/GTCommon/AccountRequest.aspx?Language=" + Language;
      }
    }

    var url = WebControl.GetStandardUrl(requestedPage, Verb_Show, CallingMode_AccountRequest);
    
    oWindow = WebControl.OpenWindow("AccoutRequest", url, "_blank", windowFeatures, true);
    oWindow.focus();
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ShowAccountRequest", "Section1")
  }  
}

function WebControl_ShowPasswordRequest(oObject, requestedPage)
{
  try
  {
    requestedPage = requestedPage == null ? "" : requestedPage;

    var oWindow = null;
    var dialogFeatures = WebControl.GetDialogFeatures(700, 550);
    var windowFeatures = WebControl.GetWindowFeatures(700, 550, "0");

    if (requestedPage.length == 0)
    {
      if (RootID == RootID_ChromoTekWop)
      {
        requestedPage = "GlobalScripts/GTCommon/PasswordRequestWop.aspx";
      }
      else
      {
        requestedPage = "GlobalScripts/GTCommon/PasswordRequest.aspx?Language=" + Language;
      }
    }

    var url = WebControl.GetStandardUrl(requestedPage, Verb_Show, CallingMode_AccountRequest);

    oWindow = WebControl.OpenWindow("PasswordRequest", url, "_blank", windowFeatures, true);
    oWindow.focus();
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ShowPasswordRequest", "Section1")
  }  
}

function WebControl_RequestAccount()
{
  try
  {
    var features = "";
    features += "dialogWidth:580px;";
    features += "dialogHeight:530px;";
    features += "scroll:No;";
    features += "status:No;";
    features += "resizable:Yes;";
    
    this.ShowModalDialog(GlobalScriptsDirectoryVirtual + "GTCommon/AccountRequest.aspx?Language=" + Language, features);
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebControl_RequestAccount", "Section1")
  }
}

function WebControl_SetLinkStyle(oControl, style)
{
  try
  {
    switch(style)
    {
      case "Active":
        oControl.className = "DataLinkActive";
        if (this.DataLinkActive) 
        {
          this.DataLinkActive.className = "DataLinkVisited";
          this.DataLinkActive.setAttribute("LinkStyle", this.DataLinkActive.className);
        }
        this.DataLinkActive = oControl;
        this.DataLinkActive.setAttribute("LinkStyle", this.DataLinkActive.className);
        break;
      case "Hover":
        oControl.setAttribute("LinkStyle", oControl.className);
        oControl.className = "DataLinkHover";
        break;
    }
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebControl_SetLinkStyle", "Section1")
  }
}

function WebControl_RestoreLinkStyle(oControl)
{
  try
  {
    if (oControl.getAttribute("LinkStyle"))
    {
      oControl.className = oControl.getAttribute("LinkStyle");
    }
    else
    {
      if (oControl.className != "DataLink")
      {
        oControl.className = "DataLink";
      }  
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_RestoreLinkStyle", "Section1")
  }
}

function WebControl_InitGlobalList()
{
  try
  {
    this.Records = new RecordWrappers();
    this.Controls = new ControlTemplateWrappers();
    this.FieldDescriptors = new FieldDescriptorWrappers();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_InitGlobalList", "Section1")
  }
}

function WebControl_InitKpiLogging()
{
  try
  {
    this.KpiLogStart = new Date();
    this.KpiLogbook = new WebArray();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_InitKpiLogging", "Section1")
  }
}

function WebControl_AddKpiLogMessage(date, originator, message)
{
  try
  {
    var kpiLogEntry = new KpiLogEntry(date, originator, message);
    if(this.KpiLogbook.Count() > 500)
    {
      this.KpiLogbook.Shift();
      this.KpiLogbook.Add(kpiLogEntry);
    }
    else
    {
      this.KpiLogbook.Add(kpiLogEntry);
    }
    this.KpiLogEnd = new Date();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_AddKpiLogMessage", "Section1")
  }
}


function WebControl_KpiLogbookTransfer(kpiDescriptor)
{
  try
  {
    var logEntry1 = null;
    var logEntry2 = null;
    var bodyMarkup = "";
    
    for(var i = 0; i < this.KpiLogbook.Count(); i++)
    {
      var logEntry1 = this.KpiLogbook.Get(i);
      
      var kpiLogEntry = WebMessage.AddKpiLogEntry("K_" + String(kpiDescriptor.childNodes.length));
      if (logEntry2)
      {
        kpiLogEntry.setAttribute("LogDatePrevious", WebControl.ConvertDateToXmlDate(logEntry2.LogDate, true));
        kpiLogEntry.setAttribute("LogDate", WebControl.ConvertDateToXmlDate(logEntry1.LogDate, true));
      }
      else
      {
        kpiLogEntry.setAttribute("LogDatePrevious", WebControl.ConvertDateToXmlDate(this.KpiLogStart, true));
        kpiLogEntry.setAttribute("LogDate", WebControl.ConvertDateToXmlDate(logEntry1.LogDate, true));
      }
      kpiLogEntry.setAttribute("Position", String(i));
      kpiLogEntry.setAttribute("Originator", logEntry1.Originator == null ? "" : logEntry1.Originator);
      kpiLogEntry.setAttribute("Message", logEntry1.Message == null ? "" : logEntry1.Message);

      logEntry2 = logEntry1;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_KpiLogbookTransfer", "Section1")
  }
}

function WebControl_SelectComboItem(sender, oFieldDescriptor, iSelectDialog)
{
  try
  {
    if (sender.oRecord != null)
    {
      var oSearchInfoSave = WebMessage.SearchInfoSave();
      WebMessage.InitSearchInfo(true);
      var args = new EventArgs();

      var oSun = null;
      var fieldDescriptorFqn = "";
      var selectionDescriptorFqn = "";
      if (iSelectDialog)
      {
        selectionDescriptorFqn = iSelectDialog.SelectionDescriptorFqn;
        oSun = WebControl.FindSun(sender);
        fieldDescriptorFqn = this.GetFqn(oSun);
        oFieldDescriptor = FormDescriptor.GetFieldDescriptor(fieldDescriptorFqn);
      }
      else
      {
        if (oFieldDescriptor == null)
        {
          oSun = WebControl.FindSun(sender);
          fieldDescriptorFqn = this.GetFqn(oSun);
          oFieldDescriptor = FormDescriptor.GetFieldDescriptor(fieldDescriptorFqn);
        }
        else
        {
          fieldDescriptorFqn = oFieldDescriptor.getAttribute("Fqn");
        }
        
        selectionDescriptorFqn = oFieldDescriptor.getAttribute("SelectionDescriptorFqn");
      }
      
      if (selectionDescriptorFqn && selectionDescriptorFqn.length > 0)
      {  
        var oSelectionDescriptor = FormDescriptor.GetSelectionDescriptor(selectionDescriptorFqn);

        if (iSelectDialog)
        {
          if (typeof(iSelectDialog.OnBeforeSelectRecordHandler) == "function")
          {
            args.oRecord = sender.oRecord;
            args.oSelectionDescriptor = oSelectionDescriptor;
            iSelectDialog.OnBeforeSelectRecordHandler(sender, args);
          }
        }
        else
        {
          var beforeOpenSelectionHandler = sender.getAttribute("BeforeOpenSelectionHandler");
          if (typeof(beforeOpenSelectionHandler) == "string")
          {
            args.oRecord = sender.oRecord;
            args.oSelectionDescriptor = oSelectionDescriptor;
            eval(beforeOpenSelectionHandler + "(sender, args);");
          }
        }
        
        var oSearchInfoItemList = WebMessage.GetSearchInfoItemList();
        if (oSearchInfoItemList.length == 0)
        {
          WebMessage.AddSearchInfoTable("S_" + oSelectionDescriptor.getAttribute("TableDescriptorFqn"), oSelectionDescriptor.getAttribute("TableDescriptorFqn"));
        }
        
        if (args.Cancel == true) return;
        
        var constrainerFqn = oSelectionDescriptor.getAttribute("ConstrainerFqn");
        var constrainerSourceFqn = oSelectionDescriptor.getAttribute("ConstrainerSourceFqn");
        var constrainerTargetFqn = oSelectionDescriptor.getAttribute("ConstrainerTargetFqn");   

        if (typeof(constrainerFqn) == "string" || (typeof(constrainerSourceFqn) == "string" && typeof(constrainerTargetFqn) == "string"))
        {
          WebDataSearch.BuildConstrainedSelectionSearchInfo(sender.oRecord, oSelectionDescriptor);
        }

        if (WebDataSearch.SelectComboItem(selectionDescriptorFqn))
        {
          var resetConstrainedControls = true;
          
          var oTextValueOld = WebData.GetFieldValue(sender.oRecord, fieldDescriptorFqn);
          var oValueValueOld = null;
                
          var valueFqn = oSelectionDescriptor.getAttribute("ValueFqn");
          if (typeof(valueFqn) == "string")  
          {
            oValueValueOld = WebData.GetFieldValue(sender.oRecord, valueFqn);
            if (oValueValueOld == WebDataSearch.ComboSelectionValue) resetConstrainedControls = false;
          }
          else
          {
            if (oTextValueOld == WebDataSearch.ComboSelectionText) resetConstrainedControls = false;
          }
          
          var performUpdate = false;
          if (resetConstrainedControls == true)
          {    
            WebControl.ResetConstrainedSelection(sender.oRecord, fieldDescriptorFqn);
            performUpdate = true;
          }
          
          var optionReturnList = FormDescriptor.GetOptionReturnList(oSelectionDescriptor);
          if (FormDescriptor.IsStringArrayEmpty(optionReturnList) == false)
          {        
            var optionReturnTargetList = FormDescriptor.GetOptionReturnTargetList(oSelectionDescriptor);
            if (FormDescriptor.IsStringArrayEmpty(optionReturnTargetList) == false)
            {      
              for (var i = 0; i < optionReturnTargetList.length; i++)
              {
                var fqn = sender.oRecord.nodeName + "." + optionReturnTargetList[i];
                var oFd = FormDescriptor.GetFieldDescriptor(fqn);
                if (oFd != null)
                {
                  var oRecordTemp = WebDataSearch.SelectionRecord.documentElement.selectSingleNode("Record");
                  var oValue = oRecordTemp.getAttribute(optionReturnList[i]);
                  if (oValue != null)
                  {
                    WebData.SetFieldValue(sender.oRecord, fqn, unescape(oValue));    
                  }    
                  else
                  {
                    WebData.SetNull(sender.oRecord, fqn);
                  }
                }
              }
            }
            else
            {
              // das muss raus, JS
              for (var i = 0; i < optionReturnList.length; i++)
              {
                var fqn = sender.oRecord.nodeName + "." + optionReturnList[i];
                if (FormDescriptor.GetFieldDescriptor(fqn) != null)
                {
                  var oValue = WebDataSearch.SelectionRecord.documentElement.selectSingleNode("Record").getAttribute(optionReturnList[i]);
                  if (oValue != null)
                  {
                    WebData.SetFieldValue(sender.oRecord, fqn, unescape(oValue));    
                  }    
                  else
                  {
                    WebData.SetNull(sender.oRecord, fqn);
                  }
                }
              }
            }
            performUpdate = true;
          }
          
          args.ComboSelectionText = WebDataSearch.ComboSelectionText;
          args.ComboSelectionValue = WebDataSearch.ComboSelectionValue;
          args.SelectionRecord = WebDataSearch.SelectionRecord;
          if (this.BeforeSelectionTransfer != null)
          {
            this.BeforeSelectionTransfer(sender, args);
          }  
          
          // Wenn ein Mapping angeben ist, sollte das hier nicht ausgeführt werden.
          if (!(args.SetSelectionText == false))
          {
            WebData.SetFieldValue(sender.oRecord, fieldDescriptorFqn, args.ComboSelectionText);
          }
          if (!(args.SetSelectionValue == false))
          {
            if (typeof(valueFqn) == "string") WebData.SetFieldValue(sender.oRecord, valueFqn, args.ComboSelectionValue);
          }  

          WebData.UpdateFieldBinding(sender.oRecord, fieldDescriptorFqn, this);
          
          if (performUpdate == true)
          {
            WebData.UpdateBinding(sender.oRecord);
            WebData.UpdateIf(sender.oRecord);
          }
         
          var afterOpenSelectionHandler = sender.getAttribute("AfterOpenSelectionHandler");
          if (typeof(afterOpenSelectionHandler) == "string")
          {
            args.ComboSelectionText = WebDataSearch.ComboSelectionText;
            args.ComboSelectionValue = WebDataSearch.ComboSelectionValue;
            args.SelectionRecord = WebDataSearch.SelectionRecord;
            
            eval(afterOpenSelectionHandler + "(sender, args);");
          }
        }
      }
      else
      {
        // dies wir aus Kompatibilität erhalten, JS
        var beforeOpenSelectionHandler = sender.getAttribute("BeforeOpenSelectionHandler");
        if (typeof(beforeOpenSelectionHandler) == "string")
        {
          args.oSelectionDescriptor = oSelectionDescriptor;
          eval(beforeOpenSelectionHandler + "(sender, args);");
        }
      }
      
      WebMessage.SearchInfoRestore(oSearchInfoSave);      
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_SelectComboItem", "Section1")
  }
}

function WebControl_DeleteComboItem(sender)
{
  try
  {
    var args = new EventArgs();

    var beforeDeleteHandler = sender.getAttribute("BeforeDeleteHandler");
    if (typeof(beforeDeleteHandler) == "string")
    {
      eval(beforeDeleteHandler + "(sender, args);");
    }
  
    if (args.Cancel == false &&  sender.oRecord != null)
    {
      var oSun = null;
      var fieldDescriptorFqn = "";
      
      oSun = WebControl.FindSun(sender);
      fieldDescriptorFqn = this.GetFqn(oSun);
      oFieldDescriptor = FormDescriptor.GetFieldDescriptor(fieldDescriptorFqn);
      
      var selectionDescriptorFqn = oFieldDescriptor.getAttribute("SelectionDescriptorFqn");
      
      if (selectionDescriptorFqn && selectionDescriptorFqn.length > 0)
      {    
        var oSelectionDescriptor = FormDescriptor.GetSelectionDescriptor(selectionDescriptorFqn);

        var valueFqn = oSelectionDescriptor.getAttribute("ValueFqn");
        if (typeof(valueFqn) == "string") WebData.SetNull(sender.oRecord, valueFqn);
        
        var optionReturnTargetList = FormDescriptor.GetOptionReturnTargetList(oSelectionDescriptor);
        if (FormDescriptor.IsStringArrayEmpty(optionReturnTargetList) == false)
        {      
          for (var i = 0; i < optionReturnTargetList.length; i++)
          {
            var fqn = sender.oRecord.nodeName + "." + optionReturnTargetList[i];
            WebData.SetNull(sender.oRecord, fqn);
          }
        }  
        
        WebData.SetNull(sender.oRecord, fieldDescriptorFqn);
        WebData.UpdateFieldBinding(sender.oRecord, fieldDescriptorFqn);
        
        var afterDeleteHandler = sender.getAttribute("AfterDeleteHandler");
        if (typeof(afterDeleteHandler) == "string")
        {
          var args = new EventArgs();
          
          eval(afterDeleteHandler + "(sender, args);");
        }
        
      }      
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_DeleteComboItem", "Section1")
  }
}

function WebControl_ResetConstrainedSelection(oRecord, constrainerFqn)
{
  try
  {
    var oSelectionDescriptorList = FormDescriptor.GetConstrainedSelectionDescriptorList(constrainerFqn);
    if (oSelectionDescriptorList.length == 0)
    {
      var oSd = FormDescriptor.GetAttachedSelectionDescriptor(constrainerFqn);
      if (oSd)
      {
        constrainerFqn = oSd.getAttribute("ValueFqn");
        oSelectionDescriptorList = FormDescriptor.GetConstrainedSelectionDescriptorList(constrainerFqn);
      }
    }
    if (oSelectionDescriptorList.length == 0) return;
    for (var i = 0; i < oSelectionDescriptorList.length; i++)
    {
      var oFieldDescriptorList = FormDescriptor.GetFieldDescriptorList(null, "[@SelectionDescriptorFqn='" + oSelectionDescriptorList[i].getAttribute("Fqn") + "']"); 
      for (var j = 0; j < oFieldDescriptorList.length; j++)
      {
        var fqn = oFieldDescriptorList[j].getAttribute("Fqn");
        WebData.SetNullOnly(oRecord, fqn);
        WebControl.ResetConstrainedSelection(oRecord, fqn);
      }
      
      var constrainerFieldCollection = new Object();
      var oParentFieldDescriptor = FormDescriptor.GetFieldDescriptor(constrainerFqn);
      while (oParentFieldDescriptor != null)
      {
        constrainerFieldCollection[oParentFieldDescriptor.getAttribute("Fqn")] = 1;
        var oParentSelectionDescriptor = FormDescriptor.GetSelectionDescriptor(oParentFieldDescriptor.getAttribute("SelectionDescriptorFqn"));
        if (oParentSelectionDescriptor != null)
        {
          var valueFqn = oParentSelectionDescriptor.getAttribute("ValueFqn");
          if (typeof(valueFqn) == "string")  constrainerFieldCollection[valueFqn] = 1;
        }
        oParentFieldDescriptor = null;
        if (oParentSelectionDescriptor != null)
        {
          var parentConstrainerFqn = oParentSelectionDescriptor.getAttribute("ConstrainerFqn");
          if (typeof(parentConstrainerFqn) == "string") oParentFieldDescriptor = FormDescriptor.GetFieldDescriptor(parentConstrainerFqn);          
        }
      }
      
      var optionReturnList = FormDescriptor.GetOptionReturnTargetList(oSelectionDescriptorList[i]);
      if (FormDescriptor.IsStringArrayEmpty(optionReturnList) == false)
      {
        for (var j = 0; j < optionReturnList.length; j++)
        {
          var fqn = oRecord.nodeName + "." + optionReturnList[j];
          if (constrainerFieldCollection[fqn] != 1) WebData.SetNullOnly(oRecord, fqn);         
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ResetConstrainedSelection", "Section1")
  }
}



function WebControl_GetExtension(filename)
{
  try
  {
    var tempArray = new Array();
    tempArray = filename.split(".");
    
    return tempArray[tempArray.length-1];
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetExtension", "Section1")
  }
}

function WebControl_GetContextMenu(oControlClass, oControl, dropDownMenuId)
{
  try
  {
    dropDownMenuId = dropDownMenuId == null ? oControl.getAttribute("DropDownMenu") : dropDownMenuId;
    if (typeof(dropDownMenuId) == "string")
    {
      var dropDownMenuContainer = document.getElementById(dropDownMenuId + ".Root");
      if (dropDownMenuContainer != null)
      {
        var dropDownMenu = null;
        if (WebControl.DropDownMenuCollection == null)
        {
          WebControl.DropDownMenuCollection = new Object();
        }
        else
        {
          dropDownMenu = WebControl.DropDownMenuCollection[dropDownMenuId];
        }
        
        if (dropDownMenu == null)
        {
          dropDownMenu = new WebDropDownMenu(oControl, dropDownMenuContainer, "WebControl.DropDownMenuCollection[\"" + dropDownMenuId + "\"]", oControlClass);
          dropDownMenu.Init();
          WebControl.DropDownMenuCollection[dropDownMenuId] = dropDownMenu;
        }
        else
        {
          dropDownMenu.Parent = oControlClass; 
        }
        
        
        oControlClass.DropDownMenu = dropDownMenu;
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetContextMenu", "Section1")
  }
}


function WebControl_GetWebPopUp(src)
{
  try
  {
    if (WebForm.WebPopUp == null)
    {
      var webPopUpContainer = document.getElementById("WebPopUp.Root");
      if (webPopUpContainer != null)
      {
        webPopUpContainer = document.body.insertAdjacentElement("beforeEnd", webPopUpContainer);
        WebForm.WebPopUp = new WebPopUp(webPopUpContainer);
      }
    }
    return WebForm.WebPopUp;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetWebPopUp", "Section1")
  }
}

function WebControl_ShowWebPopUp(sender, src, caller)
{
  try
  {
    var showPopUp = false;
    if (caller == "OnClick")
    {
      var webPopUpBehavior = src.getAttribute("WebPopUpBehavior");
      if (webPopUpBehavior && webPopUpBehavior == enum_WebPopUpBehavior_OnClick)
      {
        showPopUp = true;
      }
    }
    else if (caller == "OnMouseOver")
    {
      var webPopUpBehavior = src.getAttribute("WebPopUpBehavior");
      if (webPopUpBehavior == null || webPopUpBehavior == enum_WebPopUpBehavior_OnMouseOver)
      {
        showPopUp = true;
      }
    }
    
    if (showPopUp)
    {
      var webPopUpFqn = src.getAttribute("WebPopUpFqn");
      var beforePopUpHandler = sender.getAttribute("BeforePopUpHandler")

      if ((webPopUpFqn && webPopUpFqn.length > 0) || typeof(beforePopUpHandler) == "string")
      {
        var args = new EventArgs();
        args.Cancel = false;
        args.Text = null;
        args.Html = null;
      
        if (typeof(beforePopUpHandler) == "string")
        {
          beforePopUpHandler = Ilp.Util.PrepareHandler(beforePopUpHandler);
          eval(beforePopUpHandler + "(sender, args);");
        }
      
        if (args.Cancel == false)
        {
          this.WebPopUp = this.GetWebPopUp(src);
          this.WebPopUp.Show(src, args.Text, args.Html);
          
          var afterPopUpHandler = sender.getAttribute("AfterPopUpHandler")
          if (typeof(afterPopUpHandler) == "string")
          {
            afterPopUpHandler = Ilp.Util.PrepareHandler(afterPopUpHandler);
            eval(afterPopUpHandler + "(sender, args);");
          }
        }  
      }
    } 
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ShowWebPopUp", "Section1")
  }
}

function WebControl_ResizeToFullWindow(oControl)
{
  try
  {
    var windowHeight = this.GetWindowHeight();

    var visibleWidth = document.body.clientWidth 
      - this.GetCss(document.body, "marginLeft")
      - this.GetCss(document.body, "marginRight");
    
    Ilp.HtmlDom.SetStyle(oControl, "position", "absolute");
    Ilp.HtmlDom.SetStyle(oControl, "top", "0");
    Ilp.HtmlDom.SetStyle(oControl, "left", "0");
    Ilp.HtmlDom.SetStyle(oControl, "width", parseInt(visibleWidth) + "px");
    Ilp.HtmlDom.SetStyle(oControl, "height", parseInt(windowHeight) + "px");
    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ResizeToFullWindow", "Section1")
  }
}

function WebControl_PositionControl(oControl, doScroll, oControlReference, margin, useScrollIntoView, useUpperLeft, orbit)
{
  try
  {
    doScroll = (doScroll == null ? true : doScroll);
    margin = (margin == null ? 20 : margin);
    useUpperLeft = (useUpperLeft == null ? false : useUpperLeft);
    
    
    if ((useScrollIntoView == null || typeof(PageDevider) == "object") &&
      (DisplayOption == DisplayOption_InDialog
       || DisplayOption == DisplayOption_InBlankWindow
       || DisplayOption == DisplayOption_InFrameset))
    {
      useScrollIntoView = true;
    }
    useScrollIntoView = (useScrollIntoView == null ? false : useScrollIntoView);
    
    if (orbit == null)
    {
      if (doScroll == false)
      {
        orbit = new WebArray();
        orbit.Add(Graphic3DInstance.UpperRight_UpperLeft);
        orbit.Add(Graphic3DInstance.BottomLeft_UpperLeft);
        orbit.Add(Graphic3DInstance.UpperLeft_UpperRight);
        orbit.Add(Graphic3DInstance.UpperLeft_BottomLeft);
      }
      else
      {
        var orbit = new WebArray();
        orbit.Add(Graphic3DInstance.UpperLeft_UpperLeft);
      }  
    }
    
    var screen = null;
    var viewport = null;
    var controlPositionScreen = null;
    var nogoPositionScreen = null;

    var screenShape = new Shape();
    var viewportShape = new Shape();
    var controlPositionShape = new Shape();
    var nogoPositionShape = null;

    screen = new ScreenObject(
      this.GetCurrentDocument().body,
      this.GetCurrentDocument().body.clientTop, 
      this.GetCurrentDocument().body.clientLeft,
      this.GetCurrentDocument().body.scrollWidth,
      this.GetCurrentDocument().body.scrollHeight);
    
    screenShape.ConvertScreenObjectToShape(screen);
    
    if (typeof(PageDevider) == "object")
    {
      viewport = new ScreenObject(
        PageDevider.Main,
        this.GetAbsoluteTop(PageDevider.Main, null, screen.oControl, true),
        this.GetAbsoluteLeft(PageDevider.Main, null, screen.oControl, true),
        PageDevider.Main.clientWidth,
        PageDevider.Main.clientHeight);
        
      viewportShape.ConvertScreenObjectToShape(viewport);
    }
    else
    {
      if (window.frameElement)
      {
        viewport = new ScreenObject(
          this.GetCurrentDocument().body,
          this.GetCurrentDocument().body.scrollTop, 
          this.GetCurrentDocument().body.scrollLeft,
          this.GetWindowWidth(),
          this.GetWindowHeight());
      }
      else
      {
        viewport = new ScreenObject(
          this.GetCurrentDocument().body,
          this.GetCurrentDocument().body.scrollTop, 
          this.GetCurrentDocument().body.scrollLeft,
          this.GetCurrentDocument().body.clientWidth,
          this.GetCurrentDocument().body.clientHeight);
      }
      
      viewportShape.ConvertScreenObjectToShape(viewport);
    }    
      
    controlPositionScreen = new ScreenObject(
      oControl,
      this.GetAbsoluteTop(oControl, null, screen.oControl),
      this.GetAbsoluteLeft(oControl, null, screen.oControl),
      this.GetOuterDimension(oControl, "width"),
      this.GetOuterDimension(oControl, "height"));
    
    controlPositionShape.ConvertScreenObjectToShape(controlPositionScreen);

    if (oControlReference != null)
    {
      nogoPositionScreen = new ScreenObject(
        oControlReference,
        this.GetAbsoluteTop(oControlReference, null, screen.oControl),
        this.GetAbsoluteLeft(oControlReference, null, screen.oControl),
        this.GetOuterDimension(oControlReference, "width"),
        this.GetOuterDimension(oControlReference, "height"));

      nogoPositionShape = new Shape();
      nogoPositionShape.ConvertScreenObjectToShape(nogoPositionScreen);
    }

    if (doScroll == false)
    {
      
      if (nogoPositionShape != null)
      {
        var done = false;
        controlPositionShape.MoveToOrigin();
        controlPositionShape.CalculateBoundingBox();
        nogoPositionShape.CalculateBoundingBox();

        var newShape = null;
        
        for (var i = 0, len = orbit.Count(); i < len; i++)
        {
          var orbitPosition = orbit.Get(i);
          if (orbitPosition == Graphic3DInstance.UpperRight_UpperLeft)
          {
            // rechts daneben
            newShape = controlPositionShape.Translate(nogoPositionShape.GetVertex(1).Add(new Vector(margin, 0, 0)));
            newShape.CalculateBoundingBox();
          }
          else if (orbitPosition == Graphic3DInstance.BottomRight_UpperLeft)
          {
            // rechts drunter
            newShape = controlPositionShape.Translate(nogoPositionShape.GetVertex(3).Add(new Vector(0, margin, 0)));
            newShape.CalculateBoundingBox();
          }
          else if (orbitPosition == Graphic3DInstance.UpperLeft_UpperRight)
          {
            // links daneben
            var vector = nogoPositionShape.GetVertex(0);
            vector = vector.Add(controlPositionShape.GetVertex(1).Invert());
            newShape = controlPositionShape.Translate(vector.Add(new Vector(-margin, 0, 0)));
            newShape.CalculateBoundingBox();
          }
          else if (orbitPosition == Graphic3DInstance.UpperLeft_BottomLeft)
          {
            // rechts drüber
            var vector = nogoPositionShape.GetVertex(0);
            vector = vector.Add(controlPositionShape.GetVertex(3).Invert());
            newShape = controlPositionShape.Translate(vector.Add(new Vector(0, -margin, 0)));
            newShape.CalculateBoundingBox();
          }
          else if (orbitPosition == Graphic3DInstance.BottomLeft_UpperLeft)
          {
            // links drunter
            newShape = controlPositionShape.Translate(nogoPositionShape.GetVertex(3).Add(new Vector(0, margin, 0)));
            newShape.CalculateBoundingBox();
          }
          
          if (viewportShape.Contains(newShape) == true)
          {
            break;
          }
        }
        
        newShape.ApplyToScreenObject();
      }
    }
    else
    {
      var vector1 = null;
      var vector2 = null;
      var vector3 = null;
      var scalar = 0;
      var scalarTemp = 0;
      var nearestCorner = null;
      
      var orbitPosition = orbit.Get(0);
      if (orbitPosition == Graphic3DInstance.UpperLeft_UpperLeft)
      {
        nearestCorner = 0;
        
        vector1 = viewportShape.Vertices.Get(nearestCorner);
        vector2 = controlPositionShape.Vertices.Get(nearestCorner);
        vector3 = vector2.Add(vector1.Invert());
        
      }
      else if (orbitPosition == Graphic3DInstance.Top_Top)
      {
        nearestCorner = 0;
        
        vector1 = viewportShape.Vertices.Get(nearestCorner);
        vector2 = controlPositionShape.Vertices.Get(nearestCorner);
        vector3 = vector2.Add(vector1.Invert());
      }
      else if (orbitPosition == Graphic3DInstance.Bottom_Bottom)
      {
        nearestCorner = 3;
        
        vector1 = viewportShape.Vertices.Get(nearestCorner);
        vector2 = controlPositionShape.Vertices.Get(nearestCorner);
        vector3 = vector2.Add(vector1.Invert());
        
        vector3 = new Vector(0, vector3.v1[1], 0);
      }
      else
      {
        for (var i = 0, len = viewportShape.Vertices.Count(); i < len; i++)
        {
          vector1 = viewportShape.Vertices.Get(i);
          vector2 = controlPositionShape.PositionVectorCG.Add(vector1.Invert());
          scalar = vector2.GetAbsoluteValue();
          
          if (scalar < scalarTemp || scalarTemp == 0)
          {
            nearestCorner = i;
            scalarTemp = scalar;
          }
        }
        
        vector1 = viewportShape.Vertices.Get(nearestCorner);
        vector2 = controlPositionShape.Vertices.Get(nearestCorner);
        vector3 = vector2.Add(vector1.Invert());
      
        // test for overlapping
        viewportShape.Overlaps(controlPositionShape)
        
        if (viewportShape.XContained == true) vector3 = new Vector(0, vector3.v1[1], 0);
        if (viewportShape.YContained == true) vector3 = new Vector(vector3.v1[0], 0, 0);
      }
      
    
      if (viewportShape.Contains(controlPositionShape) == false)
      {
        if (useScrollIntoView == true)
        {
          if (orbitPosition == Graphic3DInstance.Top_Top)
          {
            if (typeof(PageDevider) == "object")
            {
              PageDevider.Main.scrollLeft = vector3.v1[0]; 
              PageDevider.Main.scrollTop = vector3.v1[1]; 
            }
            else
            {
              oControl.scrollIntoView(true);
            }  
          }
          else
          {
            if (vector3.GetAbsoluteValue() > 0)
            {
              // test for overlapping
              viewportShape.Overlaps(controlPositionShape)
            
              // Scrolls the object so that top of the object is visible at the top of the window.
              if (viewportShape.YLeft == true || viewportShape.YOverlapsLeft == true) oControl.scrollIntoView(true);
              else oControl.scrollIntoView(false);
              window.scrollTo(0,0);
            }
          }
        }
        else
        {
          var shape = viewportShape.Translate(vector3);
          vector1 = shape.Vertices.Get(0);
          
          if (orbitPosition == Graphic3DInstance.Top_Top)
          {
            window.scrollTo(viewportShape.ScreenObject.Left, vector1.v1[1] - viewportShape.ScreenObject.Top);
          }
          else if (orbitPosition == Graphic3DInstance.Bottom_Bottom)
          {
            vector1 = shape.Vertices.Get(3);
            //window.scrollTo(viewportShape.ScreenObject.Left, vector1.v1[1] - viewportShape.ScreenObject.Top);
            window.scrollBy(0, vector3.v1[1]);
          }
          else
          {
            window.scrollTo(vector1.v1[0] - viewportShape.ScreenObject.Left, vector1.v1[1] - viewportShape.ScreenObject.Top);
          }  
        }
      }
      else
      {
        if (useScrollIntoView == true)
        {
          if (vector3.GetAbsoluteValue() > 0)
          {
            // test for overlapping
            viewportShape.Overlaps(controlPositionShape)
          
            // Scrolls the object so that top of the object is visible at the top of the window.
            if (viewportShape.YLeft == true || viewportShape.YOverlapsLeft == true) oControl.scrollIntoView(true);
            else oControl.scrollIntoView(false);
            window.scrollTo(0,0);
          }
        }
        else
        {
          var shape = viewportShape.Translate(vector3);
          vector1 = shape.Vertices.Get(0);
          
          if (orbitPosition == Graphic3DInstance.Top_Top)
          {
            window.scrollTo(viewportShape.ScreenObject.Left, vector1.v1[1] - viewportShape.ScreenObject.Top);
          }
          else
          {
            window.scrollTo(vector1.v1[0] - viewportShape.ScreenObject.Left, vector1.v1[1] - viewportShape.ScreenObject.Top);
          }  
        }
      }        
    }  
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_PositionControl", "Section1")
  }
}

function WebControl_ScrollToControl(oControl, orbitPosition, margin)
{
  try
  {
    var screen = null;
    var viewport = null;
    var control = null;

    var screenShape = new Shape();
    var viewportShape = new Shape();
    var controlShape = new Shape();

    screen = new ScreenObject(
      this.GetCurrentDocument().body,
      this.GetCurrentDocument().body.clientTop, 
      this.GetCurrentDocument().body.clientLeft,
      this.GetCurrentDocument().body.scrollWidth,
      this.GetCurrentDocument().body.scrollHeight);
    
    screenShape.ConvertScreenObjectToShape(screen);
    if (window.DebugPosition) window.DebugPosition.ShowDimension(screen.ToString(), "screen");
    
    if (typeof(PageDevider) == "object")
    {
      // Hier wird der viewport durch ein scrollable div bestimmt
      viewport = new ScreenObject(
        PageDevider.Main,
        this.GetAbsoluteTop(PageDevider.Main, null, screen.oControl),
        this.GetAbsoluteLeft(PageDevider.Main, null, screen.oControl),
        PageDevider.Main.clientWidth,
        PageDevider.Main.clientHeight);
    }
    else
    {
      if (Ilp.HtmlDom.IsCss1Compat() == true)
      {
        // Hier wird der viewport durch ein scrollable div bestimmt
        if (Ilp.HtmlDom.GetStyle(document.body, "overflow") == "hidden")
        {
          var containerControl = document.getElementById("PageMainContainer");  
          if (containerControl == null)
          {
            containerControl = this.GetCurrentDocument().body;  
          }          
          var region = Ilp.HtmlDom.GetRegion(containerControl);
          viewport = new ScreenObject(
            containerControl,
            region.Top, 
            region.Left,
            region.Width,
            region.Height);          
        }
        else
        {
          viewport = new ScreenObject(
            this.GetCurrentDocument().body.parentElement,
            this.GetCurrentDocument().body.parentElement.scrollTop, 
            this.GetCurrentDocument().body.parentElement.scrollLeft,
            this.GetWindowWidth(),
            this.GetWindowHeight());
        }
      }
      else
      {
        viewport = new ScreenObject(
          this.GetCurrentDocument().body,
          this.GetCurrentDocument().body.scrollTop, 
          this.GetCurrentDocument().body.scrollLeft,
          this.GetWindowWidth(),
          this.GetWindowHeight());
      }
    }
    
    viewportShape.ConvertScreenObjectToShape(viewport);
    if (window.DebugPosition) window.DebugPosition.ShowDimension(viewport.ToString(), "viewport");
    if (window.DebugPosition) window.DebugPosition.ShowDimension(viewportShape.ToString(), "viewportShape");
    
    control = new ScreenObject(
      oControl,
      this.GetAbsoluteTop(oControl, null, screen.oControl),
      this.GetAbsoluteLeft(oControl, null, screen.oControl),
      this.GetOuterDimension(oControl, "width"),
      this.GetOuterDimension(oControl, "height"));
    
    controlShape.ConvertScreenObjectToShape(control);
    
    viewportShape.CalculateBoundingBox();
    controlShape.CalculateBoundingBox();
    var isContained = viewportShape.Contains(controlShape);
    
    if (isContained == false)
    {
      if (orbitPosition == Graphic3DInstance.Top_Top)
      {
        var vector1 = viewportShape.Vertices.Get(0);
        var vector2 = controlShape.Vertices.Get(0);

        var scrollTopNew = viewportShape.ScreenObject.oControl.scrollTop + (vector2.v1[1] - vector1.v1[1]) + margin;        
        viewportShape.ScreenObject.oControl.scrollTop = Math.max(0, scrollTopNew);
      }
      else if (orbitPosition == Graphic3DInstance.Bottom_Bottom)
      {
        var vector1 = viewportShape.Vertices.Get(3);
        var vector2 = controlShape.Vertices.Get(3);
        
        var scrollTopNew = viewportShape.ScreenObject.oControl.scrollTop + (vector2.v1[1] - vector1.v1[1]) + margin;        
        viewportShape.ScreenObject.oControl.scrollTop = Math.max(0, scrollTopNew);
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ScrollToControl", "Section1")
  }
}

function WebControl_PositionControl2(oControl, oControlReference, margin)
{
  try
  {
    var screen = null;
    var viewport = null;
    var control = null;
    var nogo = null;
  
    var screenShape = new Shape();
    var viewportShape = new Shape();
    var controlShape = new Shape();
    var nogoShape = null;
  
    var orbit;
    if (oControl.JsInstance && oControl.JsInstance.ClassType == "WebPopUp")
    {
      orbit = Graphic3DInstance.GetStandardOrbit("WebPopUp");
    }
    else orbit = Graphic3DInstance.GetStandardOrbit();
  
    screen = new ScreenObject(
      this.GetCurrentDocument().body,
      this.GetCurrentDocument().body.clientTop, 
      this.GetCurrentDocument().body.clientLeft,
      this.GetCurrentDocument().body.scrollWidth,
      this.GetCurrentDocument().body.scrollHeight);
    
    screenShape.ConvertScreenObjectToShape(screen);
    if (window.DebugPosition) window.DebugPosition.ShowDimension(screen.ToString(), "screen");
    
    if (typeof(PageDevider) == "object")
    {
      // Hier wird der viewport durch ein scrollable div bestimmt
      viewport = new ScreenObject(
        PageDevider.Main,
        this.GetAbsoluteTop(PageDevider.Main, null, screen.oControl),
        this.GetAbsoluteLeft(PageDevider.Main, null, screen.oControl),
        PageDevider.Main.clientWidth,
        PageDevider.Main.clientHeight);
    }
    else
    {
      var viewportElement = Ilp.HtmlDom.GetViewport();
      viewport = new ScreenObject(
        viewportElement,
        viewportElement.scrollTop, 
        viewportElement.scrollLeft,
        Ilp.HtmlDom.GetViewportWidth(),
        Ilp.HtmlDom.GetViewportHeight());
    }
    
    viewportShape.ConvertScreenObjectToShape(viewport);
    if (window.DebugPosition) window.DebugPosition.ShowDimension(viewport.ToString(), "viewport");
    if (window.DebugPosition) window.DebugPosition.ShowDimension(viewportShape.ToString(), "viewportShape");
    
    var region = Ilp.HtmlDom.GetRegion(oControl);
    control = new ScreenObject(
      oControl,
      region.Top,
      region.Left,
      region.Right - region.Left,
      region.Bottom - region.Top);
    
    controlShape.ConvertScreenObjectToShape(control);
    
    if (oControlReference != null)
    {
      var region = Ilp.HtmlDom.GetRegion(oControlReference);
      nogo = new ScreenObject(
        oControlReference,
        region.Top,
        region.Left,
        region.Right - region.Left,
        region.Bottom - region.Top);

      nogoShape = new Shape();
      nogoShape.ConvertScreenObjectToShape(nogo);
      if (window.DebugPosition) window.DebugPosition.ShowDimension(nogo.ToString(), "nogo");
      if (window.DebugPosition) window.DebugPosition.ShowDimension(nogoShape.ToString(), "nogoShape");
    }
    
    if (nogoShape != null)
    {
      var done = false;
      
      if (window.DebugPosition) window.DebugPosition.ShowDimension(controlShape.ToString(), "controlShape");
      //controlShape.MoveToOrigin();
      controlShape = controlShape.Translate(controlShape.GetVertex(0).Invert());
      if (window.DebugPosition) window.DebugPosition.ShowDimension(controlShape.ToString(), "origin");

      controlShape.CalculateBoundingBox();
      nogoShape.CalculateBoundingBox();

      var newShape = null;
      var scrollVector = new Vector(0, 0, 0);
      var translationVector = null;
      
      if (window.DebugPosition)
      {
        window.DebugPosition.ShowDimension("", "orbitShape", "set");
        window.DebugPosition.ShowDimension("", "orbitTranslation", "set");
        Graphic3DInstance.Clear();
      }
      for (var i = 0, len = orbit.Count(); i < len; i++)
      {
        var orbitPosition = orbit.Get(i);
        
        if (orbitPosition == Graphic3DInstance.UpperRight_UpperLeft)
        {
          // 0. rechts daneben
          translationVector = nogoShape.GetVertex(1);
          translationVector = translationVector.Add(controlShape.GetVertex(0).Invert());
          translationVector = translationVector.Add(new Vector(margin, 0, 0));
          tra1nslationVector = translationVector.Add(scrollVector);
        }
        else if (orbitPosition == Graphic3DInstance.BottomLeft_UpperLeft)
        {
          // 1. links drunter
          translationVector = nogoShape.GetVertex(3);
          translationVector = translationVector.Add(controlShape.GetVertex(0).Invert());
          translationVector = translationVector.Add(new Vector(0, margin, 0));
          translationVector = translationVector.Add(scrollVector);
        }
        else if (orbitPosition == Graphic3DInstance.BottomRight_UpperLeft)
        {
          // 2. rechts drunter
          translationVector = nogoShape.GetVertex(2);
          translationVector = translationVector.Add(controlShape.GetVertex(0).Invert());
          translationVector = translationVector.Add(new Vector(margin, 0, 0));
          translationVector = translationVector.Add(scrollVector);
        }
        else if (orbitPosition == Graphic3DInstance.BottomRight_UpperRight)
        {
          // 3.
          translationVector = nogoShape.GetVertex(2);
          translationVector = translationVector.Add(controlShape.GetVertex(1).Invert());
          translationVector = translationVector.Add(new Vector(0, margin, 0));
          translationVector = translationVector.Add(scrollVector);
        }
        else if (orbitPosition == Graphic3DInstance.BottomLeft_UpperRight)
        {
          // 4. links drunter
          translationVector = nogoShape.GetVertex(3);
          translationVector = translationVector.Add(controlShape.GetVertex(1).Invert());
          translationVector = translationVector.Add(new Vector(0, -margin, 0));
          translationVector = translationVector.Add(scrollVector);
        }
        else if (orbitPosition == Graphic3DInstance.UpperLeft_UpperRight)
        {
          // 5. links daneben
          translationVector = nogoShape.GetVertex(0);
          translationVector = translationVector.Add(controlShape.GetVertex(1).Invert());
          translationVector = translationVector.Add(new Vector(-margin, 0, 0));
          translationVector = translationVector.Add(scrollVector);
        }
        else if (orbitPosition == Graphic3DInstance.BottomLeft_BottomRight)
        {
          // 6. links drunter
          translationVector = nogoShape.GetVertex(3);
          translationVector = translationVector.Add(controlShape.GetVertex(2).Invert());
          translationVector = translationVector.Add(new Vector(-margin, 0, 0));
          translationVector = translationVector.Add(scrollVector);
        }
        else if (orbitPosition == Graphic3DInstance.UpperLeft_BottomRight)
        {
          // 7. links drunter
          translationVector = nogoShape.GetVertex(0);
          translationVector = translationVector.Add(controlShape.GetVertex(2).Invert());
          translationVector = translationVector.Add(new Vector(-margin, 0, 0));
          translationVector = translationVector.Add(scrollVector);
        }
        else if (orbitPosition == Graphic3DInstance.UpperRight_BottomRight)
        {
          // 8.
          translationVector = nogoShape.GetVertex(1);
          translationVector = translationVector.Add(controlShape.GetVertex(2).Invert());
          translationVector = translationVector.Add(new Vector(0, -margin, 0));
          translationVector = translationVector.Add(scrollVector);
        }
        else if (orbitPosition == Graphic3DInstance.UpperLeft_BottomLeft)
        {
          // 9. rechts drüber
          translationVector = nogoShape.GetVertex(0);
          translationVector = translationVector.Add(controlShape.GetVertex(3).Invert());
          translationVector = translationVector.Add(new Vector(0, -margin, 0));
          translationVector = translationVector.Add(scrollVector);
        }
        else if (orbitPosition == Graphic3DInstance.UpperRight_BottomLeft)
        {
          // 10.
          translationVector = nogoShape.GetVertex(1);
          translationVector = translationVector.Add(controlShape.GetVertex(3).Invert());
          translationVector = translationVector.Add(new Vector(margin, 0, 0));
          translationVector = translationVector.Add(scrollVector);
        }
        else if (orbitPosition == Graphic3DInstance.RightSide)
        {
          // 11.
          translationVector = new Vector(nogoShape.GetVertex(1).X(), viewportShape.GetVertex(0).Y(), 0);
          translationVector = translationVector.Add(new Vector(margin, 0, 0));
          translationVector = translationVector.Add(scrollVector);
        }
        
        var isContained = true;
        newShape = controlShape.Translate(translationVector);
        newShape.CalculateBoundingBox();
        isContained = viewportShape.Contains(newShape);
        
        if (window.DebugPosition) window.DebugPosition.ShowDimension(String(i) + ". " + isContained + ", " + newShape.ToString(), "orbitShape", "add");
        if (window.DebugPosition) window.DebugPosition.ShowDimension(translationVector.ToString(), "orbitTranslation", "add");
        
        if (isContained == true)
        {
          break;
        }
      }
      
      newShape.ApplyToScreenObject();
      if (window.DebugPosition)
      {
        if (typeof(PageDevider) == "object")
        {
          Graphic3DInstance.DrawingSurface = PageDevider.Main;
          newShape.Draw(Graphic3DInstance);
        }  
        var tempScreen = new ScreenObject(
          newShape.ScreenObject.oControl,
          this.GetAbsoluteTop(newShape.ScreenObject.oControl, null, screen.oControl),
          this.GetAbsoluteLeft(newShape.ScreenObject.oControl, null, screen.oControl),
          this.GetOuterDimension(newShape.ScreenObject.oControl, "width"),
          this.GetOuterDimension(newShape.ScreenObject.oControl, "height"));
      
        window.DebugPosition.ShowDimension(tempScreen.ToString(), "control");
        window.DebugPosition.ShowDimension(newShape.ToString(), "newControlShape");
        window.DebugPosition.ShowDimension(translationVector.ToString(), "translation");
      }
    }    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_PositionControl2", "Section1")
  }
}


function WebControl_CheckChangeTracking(oControl, oRecord)
{
  try
  {
    var columnUpdatedFqn = oControl.getAttribute("ColumnUpdatedFqn");
    if (typeof(columnUpdatedFqn) == "string")
    {
      var oButton = this.GetChangeTrackingButton(oControl);
      if (oButton != null)
      {
        oButton.src = oButton.getAttribute("FalseUrl");
        
        var oFieldDescriptor = FormDescriptor.GetFieldDescriptor(this.GetFqn(oControl));
        var selectionDescriptorFqn = oFieldDescriptor.getAttribute("SelectionDescriptorFqn");
        if (typeof(selectionDescriptorFqn) == "string")
        {
          var oSelectionDescriptor = FormDescriptor.GetSelectionDescriptor(selectionDescriptorFqn);
          var valueFqn = oSelectionDescriptor.getAttribute("ValueFqn");
          if (typeof(valueFqn) == "string")
          {
            oFieldDescriptor = FormDescriptor.GetFieldDescriptor(valueFqn);
          }
        }
                
        var isTrackingEnabled = true;
        var ordinalPosition = Number(oFieldDescriptor.getAttribute("OrdinalPosition"));
        
        var columnTrackedFqn = oControl.getAttribute("ColumnTrackedFqn");
        if (typeof(columnTrackedFqn) == "string")
        {
          var bitValueTrackingEnabled = 0;
          var base64StringTrackingEnabled = WebData.GetFieldValue(oRecord, columnTrackedFqn);
          if (typeof(base64StringTrackingEnabled) == "string")
          {
            var byteArrayTrackingEnabled = WebData.Base64Decode(base64StringTrackingEnabled);   
            bitValueTrackingEnabled = WebData.GetBitValue(byteArrayTrackingEnabled, ordinalPosition); 
          }
          if (bitValueTrackingEnabled == 1) 
          {
            isTrackingEnabled = true;
            this.SetEnabled(oButton);
          }        
          else
          {
            isTrackingEnabled = false;
            this.SetDisabled(oButton);
          }
        }
          
        if (isTrackingEnabled == true)
        {
          var base64String = WebData.GetFieldValue(oRecord, columnUpdatedFqn);
          if (typeof(base64String) == "string")
          {
            var byteArray = WebData.Base64Decode(base64String);          
            var bitValue = WebData.GetBitValue(byteArray, ordinalPosition); 
            if (bitValue == 1)
            {
              oButton.src = oButton.getAttribute("TrueUrl");
            }
          }
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_CheckChangeTracking", "Section1")
  }
}


function WebControl_GetChangeTrackingButton(oControl)
{
  try
  {
    var oButton = null;
    
    if (oControl.oGalaxy) oButton = oControl.oGalaxy.oChangeTrackingButton;
    if (oButton == null)
    {
      this.CheckGalaxy(oControl);
      if (oControl.oGalaxy) oButton = oControl.oGalaxy.oChangeTrackingButton;
    }
    
    return oButton;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetChangeTrackingButton", "Section1")
  }
}




function WebControl_ShowChangeHistory(sender)
{
  try
  {
    var oControl = this.FindSun(sender);
    fqn = this.GetTrackedFqn(oControl);
    var oFieldDescriptor = FormDescriptor.GetFieldDescriptor(fqn);
    var selectionDescriptorFqn = oFieldDescriptor.getAttribute("SelectionDescriptorFqn");
    if (typeof(selectionDescriptorFqn) == "string")
    {
      var oSelectionDescriptor = FormDescriptor.GetSelectionDescriptor(selectionDescriptorFqn);
      var valueFqn = oSelectionDescriptor.getAttribute("ValueFqn");
      if (typeof(valueFqn) == "string")
      {
        fqn = valueFqn;
      }
    }
    var tablename = fqn.split(".")[0];
    var columname = fqn.split(".")[1];
    oFieldDescriptor = FormDescriptor.GetPrimaryKeyFieldDescriptor(oControl.oRecord.nodeName);
    var IDValue = WebData.GetFieldValue(oControl.oRecord, oFieldDescriptor.getAttribute("Fqn"));
    var result = WebMessage.ShowChangeHistory(tablename, columname, IDValue);
    if (typeof(result) == "string" && result.length > 0)
    {
      fqn = oControl.getAttribute("ColumnUpdatedFqn");
      WebData.SetFieldValueOnly(oControl.oRecord, fqn, result);
      WebControl.CheckChangeTracking(oControl, oControl.oRecord);
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ShowChangeHistory", "")
  }  
}

function WebControl_ApplyDisplayOption2()
{
  try
  {
    if (typeof(WebStatusBar) == "object") 
    {
      WebStatusBar.ShowDataChangedMessage = true;
      WebStatusBar.ShowDataSavedMessage = true;
    }  
  
    document.body.onkeyup = body_OnKeyUp;
    document.body.onresize = body_OnResize;

    Ilp.Page.MenuBarManager.Init();
    Ilp.Page.MenuBarManager.AddMenuBarMarkup(PageMenuBar, Ilp.Page.MenuBarManager.GetMenuBarMarkup(PageMenuBar));
    Ilp.Page.PageFooter.Init();
    Ilp.Page.ShowMenu(PageMenuBar);
    Ilp.Page.Resize();

    Ilp.Show(Ilp, window);

    this.GetCurrentWindow().DialogReturnValue = "0";
    this.CheckRowState();
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ApplyDisplayOption2", "Section1")
  }
}

function WebControl_ApplyDisplayOption()
{
  try
  {
    if (window.XmlVersion == enum_XmlVersion_V3)
    {
      this.ApplyDisplayOption2();
      return;
    }

    if (typeof(WebStatusBar) == "object") 
    {
      WebStatusBar.ShowDataChangedMessage = true;
      WebStatusBar.ShowDataSavedMessage = true;
    }  
  
    document.body.onkeyup = body_OnKeyUp;
  
    if (Ilp.HtmlDom.IsCss1Compat() == true)
    {
      var hostWindow = Ilp.HtmlDom.GetHostWindow();
      if (hostWindow)
      {
        var treeviewHostWindow = Ilp.HtmlDom.GetTreeviewHostWindow();
        if (treeviewHostWindow == null)
        {
          if (hostWindow.Host.FormID == "GTDialog")
          {
            Ilp.Page.MenuBarManager.Init();
            Ilp.HtmlDom.GetParentWindow().Ilp.Page.MenuBarManager.AddMenuBarMarkup(PageMenuBar, Ilp.Page.MenuBarManager.GetMenuBarMarkup("PageMenuDescriptor.PageFooter"));
            Ilp.HtmlDom.GetParentWindow().Ilp.Page.PageFooter.Init();
            Ilp.HtmlDom.GetParentWindow().Ilp.Page.ShowMenu(PageMenuBar);
          }
          else
          {
            Ilp.Page.MenuBarManager.Init();
            Ilp.HtmlDom.GetParentWindow().Ilp.Page.MenuBarManager.AddMenuBarMarkup(PageMenuBar, Ilp.Page.MenuBarManager.GetMenuBarMarkup(PageMenuBar));
            Ilp.HtmlDom.GetParentWindow().Ilp.Page.PageFooter.Init();
            Ilp.HtmlDom.GetParentWindow().Ilp.Page.ShowMenu(PageMenuBar);
          }
        }
        else
        {
          Ilp.Page.MenuBarManager.Init();
          Ilp.HtmlDom.GetParentWindow().Ilp.Page.MenuBarManager.AddMenuBarMarkup(PageMenuBar, treeviewHostWindow.Ilp.Page.MenuBarManager.GetMenuBarMarkup(treeviewHostWindow.PageMenuBar));
          Ilp.HtmlDom.GetParentWindow().Ilp.Page.PageFooter.Init();
          Ilp.HtmlDom.GetParentWindow().Ilp.Page.ShowMenu(PageMenuBar);
        }
    
        var header = document.getElementById("PageHeaderContainer");
        Ilp.HtmlDom.SetStyle(header, "display", "none");
        
        if (Ilp.HtmlDom.HasTreeviewHostWindow() == true)
        {
          Ilp.HtmlDom.GetParentWindow().Ilp.Show(Ilp, window);
        }
        else if (Ilp.HtmlDom.IsTabPage() == true)
        {
          var main = document.getElementById("PageMainContainer");
          Ilp.HtmlDom.SetStyle(main, "display", "block");
        }
        else if (Ilp.HtmlDom.IsTreeviewHostWindow() == true)
        {
          Ilp.HtmlDom.SetStyle(document.body.parentElement, "height", "100%");
          Ilp.HtmlDom.SetStyle(document.body.parentElement, "overflow", "hidden");
          
          Ilp.HtmlDom.SetStyle(document.body, "overflow", "hidden");
          Ilp.HtmlDom.SetStyle(document.body, "top", "0px");
          Ilp.HtmlDom.SetStyle(document.body, "left", "0px");
          Ilp.HtmlDom.SetStyle(document.body, "width", "100%");
          Ilp.HtmlDom.SetStyle(document.body, "height", "100%");
        }
        else if (Ilp.HtmlDom.IsTabControl() == true)
        {
          var main = document.getElementById("PageMainContainer");
          //main.style.setExpression("height", "parseInt(Ilp.HtmlDom.GetViewportHeight()) + \"px\"", "JScript");
          //main.style.setExpression("width", "parseInt(Ilp.HtmlDom.GetViewportWidth()) + \"px\"", "JScript");
          Ilp.HtmlDom.SetExpression(main, "height", "parseInt(Ilp.HtmlDom.GetViewportHeight()) + \"px\"", "JScript");
          Ilp.HtmlDom.SetExpression(main, "width", "parseInt(Ilp.HtmlDom.GetViewportWidth()) + \"px\"", "JScript");
        }
        
        var footer = document.getElementById("PageFooterContainer");
        Ilp.HtmlDom.SetStyle(footer, "display", "none");
        
        Ilp.HtmlDom.GetParentWindow().Ilp.Show(Ilp, window);
      }
      else
      {
        var urlDescriptor = new UrlDescriptor(document.location.href);
        if (urlDescriptor.File == "GTMainApp.aspx"
          || urlDescriptor.File == "GTDialog.aspx")
        {
          var header = document.getElementById("PageHeaderContainer");
          if (urlDescriptor.File == "GTMainApp.aspx")
          {
            Ilp.HtmlDom.SetStyle(header, "display", "block");
          }
          else
          {
            Ilp.HtmlDom.SetStyle(header, "display", "none");
          }
          
          var footer = document.getElementById("PageFooterContainer");
          Ilp.HtmlDom.SetStyle(footer, "display", "block");
          
          Ilp.HtmlDom.SetStyle(document.body, "overflow", "hidden");
          Ilp.HtmlDom.SetStyle(document.body, "top", "0px");
          Ilp.HtmlDom.SetStyle(document.body, "left", "0px");
          Ilp.HtmlDom.SetStyle(document.body, "width", "100%");

          Ilp.HtmlDom.SetStyle(document.body.parentElement, "overflow", "hidden");
          if (window.dialogArguments) 
          {
            //document.body.parentElement.style.setExpression("width", "parseInt(Ilp.HtmlDom.GetViewportWidth()) + \"px\"", "JScript");
            Ilp.HtmlDom.SetExpression(document.body.parentElement, "width", "parseInt(Ilp.HtmlDom.GetViewportWidth()) + \"px\"", "JScript");
          }
          else 
          {
            Ilp.HtmlDom.SetStyle(document.body.parentElement, "width", "100%");
          }
        }
        else
        {
          // kommt bei Treeview-Masken und Dialog-Masken vor.
          var header = document.getElementById("PageHeaderContainer");
          var headerHeight = 0;
          if (header)
          {
            if (Ilp.HtmlDom.GetFirstChild(header) == null) // kein Inhalt
            {
              Ilp.HtmlDom.SetStyle(header, "display", "none");
            }
            else
            {
              Ilp.HtmlDom.SetStyle(header, "display", "block");
              var region = Ilp.HtmlDom.GetRegion(header);
              headerHeight = region.Height;
            }
          }
          
          var footer = document.getElementById("PageFooterContainer");
          var footerHeight = 0;
          if (footer)
          {
            if (Ilp.HtmlDom.GetFirstChild(footer) == null) // kein Inhalt
            {
              Ilp.HtmlDom.SetStyle(footer, "display", "none");
            }
            else
            {
              Ilp.HtmlDom.SetStyle(footer, "display", "block");
              var region = Ilp.HtmlDom.GetRegion(footer);
              footerHeight = region.Height;
            }
          }

          var tabTree = document.getElementById("TabTree");
          
          var main = document.getElementById("PageMainContainer");
          if (main)
          {
            Ilp.HtmlDom.SetStyle(main, "display", "block");
            //main.style.setExpression("height", "parseInt(Ilp.HtmlDom.GetViewportHeight() - " + String(headerHeight + footerHeight) + ") + \"px\"", "JScript");
            //main.style.setExpression("width", "parseInt(Ilp.HtmlDom.GetViewportWidth()) + \"px\"", "JScript");
            Ilp.HtmlDom.SetExpression(main, "height", "parseInt(Ilp.HtmlDom.GetViewportHeight() - " + String(headerHeight + footerHeight) + ") + \"px\"", "JScript");
            Ilp.HtmlDom.SetExpression(main, "width", "parseInt(Ilp.HtmlDom.GetViewportWidth()) + \"px\"", "JScript");
            
            if (urlDescriptor.File == "ArticleExplorer.aspx") Ilp.HtmlDom.SetStyle(main, "overflow", "hidden");
            else if (urlDescriptor.File == "LongText.aspx") Ilp.HtmlDom.SetStyle(main, "overflow", "hidden");
            else if (urlDescriptor.File == "ColumnOrder.aspx") Ilp.HtmlDom.SetStyle(main, "overflow", "hidden");
            else if (urlDescriptor.File == "ExportColumnSelection.aspx") Ilp.HtmlDom.SetStyle(main, "overflow", "hidden");
            else if (urlDescriptor.File == "SelSearch.aspx") Ilp.HtmlDom.SetStyle(main, "overflow", "hidden");
            else if (urlDescriptor.File == "ListBoxSelection.aspx") Ilp.HtmlDom.SetStyle(main, "overflow", "hidden");
            else if (tabTree) Ilp.HtmlDom.SetStyle(main, "overflow", "hidden");
            else if (Ilp.HtmlDom.IsTreeviewHostWindow() == true) Ilp.HtmlDom.SetStyle(main, "overflow", "hidden");
            else Ilp.HtmlDom.SetStyle(main, "overflow", "auto");
          }
          
          Ilp.HtmlDom.SetStyle(document.body, "overflow", "hidden");
          Ilp.HtmlDom.SetStyle(document.body, "top", "0px");
          Ilp.HtmlDom.SetStyle(document.body, "left", "0px");
          Ilp.HtmlDom.SetStyle(document.body, "width", "100%");
          
          Ilp.HtmlDom.SetStyle(document.body.parentElement, "overflow", "hidden");
          if (window.dialogArguments)
          {
            //document.body.parentElement.style.setExpression("width", "parseInt(Ilp.HtmlDom.GetViewportWidth()) + \"px\"", "JScript");
            Ilp.HtmlDom.SetExpression(document.body.parentElement, "width", "parseInt(Ilp.HtmlDom.GetViewportWidth()) + \"px\"", "JScript");
          }
          else Ilp.HtmlDom.SetStyle(document.body.parentElement, "width", "100%");
          
          if (DisplayOption == DisplayOption_InDialog || tabTree)
          {
            if (urlDescriptor.File == "SelSearch.aspx"
              || urlDescriptor.File == "ListBoxSelection.aspx"
              || urlDescriptor.File == "SystemRequirements.aspx")
            {
              Ilp.HtmlDom.SetStyle(document.body.parentElement, "height", "100%");
              Ilp.HtmlDom.SetStyle(document.body, "height", "100%");
            }
          }
          
          Ilp.Application.Init();
          Ilp.Application.SetTitle();
          Ilp.Application.SetText();
          Ilp.Page.PageFooter.Init();
          
          if (window.dialogArguments && typeof(window.dialogArguments) == "object")
          {
            window.CallingWindow = window.dialogArguments;
          }
        }
      }
    }
    else
    {
      if (DisplayOption == DisplayOption_InDialog)
      {
        if (Ilp.HtmlDom.HasTreeviewHostWindow() == true)
        {
          // kommt nur bei Treeview-Masken vor.
          var header = document.getElementById("PageHeaderContainer");
          Ilp.HtmlDom.SetStyle(header, "display", "block");
          
          var main = document.getElementById("PageMainContainer");
          Ilp.HtmlDom.SetStyle(main, "display", "block");
          //main.style.setExpression("height", "parseInt(Ilp.HtmlDom.GetViewportHeight() - 65 - 25) + \"px\"", "JScript");
          //main.style.setExpression("width", "parseInt(Ilp.HtmlDom.GetViewportWidth() - 20) + \"px\"", "JScript");
          Ilp.HtmlDom.SetExpression(main, "height", "parseInt(Ilp.HtmlDom.GetViewportHeight() - 65 - 25) + \"px\"", "JScript");
          Ilp.HtmlDom.SetExpression(main, "width", "parseInt(Ilp.HtmlDom.GetViewportWidth() - 20) + \"px\"", "JScript");
          Ilp.HtmlDom.SetStyle(main, "overflow", "hidden");
          
          var footer = document.getElementById("PageFooterContainer");
          Ilp.HtmlDom.SetStyle(footer, "display", "block");
          
          Ilp.HtmlDom.SetStyle(document.body, "overflow", "hidden");
          Ilp.HtmlDom.SetStyle(document.body, "top", "0px");
          Ilp.HtmlDom.SetStyle(document.body, "left", "0px");
          Ilp.HtmlDom.SetStyle(document.body, "width", "100%");

          Ilp.HtmlDom.SetStyle(document.body.parentElement, "overflow", "hidden");
        }
        else
        {
          if (window.dialogArguments)
          {
            if (typeof(window.dialogArguments) == "object")
            {
              window.CallingWindow = window.dialogArguments;
            }
          }
          
          if (window.frameElement)
          {
            window.CallingWindow = window.parent;
          }
        
          Ilp.HtmlDom.SetStyle(document.body, "marginLeft", "0px");
          Ilp.HtmlDom.SetStyle(document.body, "marginRight", "0px");

          var header = document.getElementById("PageHeaderContainer");
          if (Ilp.HtmlDom.HasChildNodes(header) == true)
          {
            Ilp.HtmlDom.SetStyle(header, "display", "block");
          }
          
          var main = document.getElementById("PageMainContainer");
          Ilp.HtmlDom.SetStyle(main, "display", "block");
          
          var footer = document.getElementById("PageFooterContainer");
          if (Ilp.HtmlDom.HasChildNodes(footer) == true)
          {
            Ilp.HtmlDom.SetStyle(footer, "display", "block");
          }

        
          
          var urlDescriptor = new UrlDescriptor(document.location.href);
          if (urlDescriptor.File == "SelSearch.aspx"
            || urlDescriptor.File == "ListBoxSelection.aspx"
            || urlDescriptor.File == "ComboSelection.aspx") 
          {
            // Aenderung Boris 05.02.2010, weil keine Buttons 
            if (footer != null)
            {
              Ilp.HtmlDom.SetStyle(footer, "display", "block");   
            }
            LoadWebPageDevider(WebControl.GetHeaderHeight(), -1);
            PageDevider.Resize();
            
            Ilp.HtmlDom.SetStyle(document.body, "overflow", "hidden");
            //Ilp.HtmlDom.SetStyle(document.body, "overflowY", "auto");
          }
          else
          {
            LoadWebPageDevider(WebControl.GetHeaderHeight(), -1);
            PageDevider.Resize();
          }
        }  
      }
      else if (DisplayOption == DisplayOption_InBlankWindow)
      {
        if (CssVersion == "GTWeb2")
        {
          var header = document.getElementById("PageHeaderContainer");
          if (Ilp.HtmlDom.HasChildNodes(header) == true)
          {
            Ilp.HtmlDom.SetStyle(header, "display", "block");
          }
        }
          
        var footer = document.getElementById("PageFooterContainer");
        if (Ilp.HtmlDom.HasChildNodes(footer) == true)
        {
          Ilp.HtmlDom.SetStyle(footer, "display", "block");
        }

        if (CssVersion == "GTWeb2")
        {
          LoadWebPageDevider(WebControl.GetHeaderHeight(), -1);
          PageDevider.Resize();
        }
        
        var urlDescriptor = new UrlDescriptor(document.location.href);
        if (urlDescriptor.File == "SelSearch.aspx"
          || urlDescriptor.File == "ListBoxSelection.aspx"
          || urlDescriptor.File == "ComboSelection.aspx") 
        {
          Ilp.HtmlDom.SetStyle(document.body, "overflow", "hidden");
          Ilp.HtmlDom.SetStyle(document.body, "overflowY", "auto");
        }
      }
      else if (DisplayOption == DisplayOption_InTreeviewRightSide)
      {
        if (CssVersion == "GTWeb2")
        {
          Ilp.HtmlDom.SetStyle(document.body, "marginLeft", "0px");
          Ilp.HtmlDom.SetStyle(document.body, "marginRight", "0px");
        }  

        var header = document.getElementById("PageHeader");
        if (header == null)
        {
          header = document.getElementById("PageHeaderContainer");
          if (header) Ilp.HtmlDom.SetStyle(header, "display", "none");
        }  

        var main = document.getElementById("PageMainContainer");
        Ilp.HtmlDom.SetStyle(main, "display", "block");

        var footer = document.getElementById("PageFooter");
        if (footer == null)
        {
          var footer = document.getElementById("PageFooterContainer");
          if (footer) Ilp.HtmlDom.SetStyle(footer, "display", "none");
        }  
      }
      else if (DisplayOption == DisplayOption_InFrameset)
      {
        var main = document.getElementById("PageMainContainer");
        if (main)
        {
          Ilp.HtmlDom.SetStyle(main, "display", "block");
        
          LoadWebPageDevider();
          PageDevider.Resize();
        }
      }
    }
    
    this.GetCurrentWindow().DialogReturnValue = "0";
    this.CheckRowState();
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ApplyDisplayOption", "Section1")
  }  
}

function WebControl_MergeImageSource(oImage, newUrl)
{
  try
  {
    if (oImage.src.indexOf(newUrl) == -1)
    {
      oImage.src = newUrl;
    }  
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_MergeImageSource", "Section1")
  }  
}

function WebControl_GetPageParamValue(paramKey)
{
  try
  {
    var paramValue = "";
    var enumArray = eval("window.PageParam");
    if (enumArray)
    {
      for (var i = 0, len = enumArray.length; i < len; i++)
      {
        var pageParamDescriptor = enumArray[i];
        if (pageParamDescriptor.Key == paramKey)
        {
          paramValue = pageParamDescriptor.Value;
          break;
        }
      }
    }
    
    return paramValue;
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetPageParamValue", "Section1")
  }  
}

function WebControl_GetEnumDisplayName(enumName, enumValue)
{
  try
  {
    var enumDisplayName = "";
    var enumArray = eval("window." + enumName);
    if (enumArray)
    {
      for (var i = 0, len = enumArray.length; i < len; i++)
      {
        var enumDescriptor = enumArray[i];
        if (enumDescriptor.Value == enumValue)
        {
          enumDisplayName = enumDescriptor.DisplayName;
          break;
        }
      }
    }
    
    return enumDisplayName;
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetEnumDisplayName", "Section1")
  }  
}

function WebControl_CalculateTableWidth(oTable)
{
  try
  {
    var tableWidth = 0;
    if (oTable)
    {
      var tableWidth = 0;
      var oElementList = oTable.getElementsByTagName("COLGROUP");
      for (var i = 0, len = oElementList.length; i < len; i++)
      {
        var oColGroup = oElementList[i];
        if (oColGroup.parentNode == oTable)
        {
          tableWidth += parseInt(Ilp.HtmlDom.GetStyle(oColGroup, "width"));
        }
      }
    }
    
    return tableWidth;
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_CalculateTableWidth", "Section1")
  }  
}

function WebControl_CreateTBodyID(oRecord)
{
  try
  {
    return "TB_" + WebData.GetBindingHash(oRecord.nodeName, oRecord, true);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_CreateTBodyID", "");
  }
}

function WebControl_GetTBody(oRecord)
{
  try
  {
    return document.getElementById(this.CreateTBodyID(oRecord)); 
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetTBody", "");
  }
}

function WebControl_CheckForNull(stringValue)
{
  try
  {
    var retValue = stringValue;
    if (stringValue == null)
    {
      retValue = "";
    }
    return retValue; 
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_CheckForNull", "");
  }
}

function WebControl_NullIf(fieldValue, compareValue)
{
  try
  {
    var retValue = fieldValue;
    if (fieldValue == compareValue)
    {
      retValue = null;
    }
    return retValue; 
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_NullIf", "");
  }
}

function WebControl_JumpToValidatedControl(oMessageLink)
{
  try
  {
    if (WebControl.CurrentMessageLink) WebControl.ResetColor(WebControl.CurrentMessageLink);
    WebControl.CurrentMessageLink = oMessageLink;
    WebControl.SetColor(WebControl.CurrentMessageLink, "red");
    
    var oControl = document.getElementById(oMessageLink.getAttribute("ObjectId"));
    if (oControl)
    {
      this.ShowValidatedControl(oControl);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_JumpToValidatedControl", "");
  }
}

function WebControl_ShowValidatedControl(oControl)
{
  try
  {
    this.JumpToControl(oControl);
    
    window.TempControl = oControl;
    window.setTimeout("WebControl.PositionValidationSummary(window.TempControl);", 100);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ShowValidatedControl", "");
  }
}

function WebControl_JumpToControl(oControl)
{
  try
  {
    if (this.IsVisible(oControl, true) == false)
    {
      var oCurrentNode = oControl;
      while(oCurrentNode.tagName != "BODY")
      {
        if (this.IsVisible(oCurrentNode, false) == false)
        {
          if (oCurrentNode.oTBodyDescriptor)
          {
            oCurrentNode.oTBodyDescriptor.Show();
          }
          else if (oCurrentNode.tagName == "TR" && oCurrentNode.className == "WebNone")
          {
            Ilp.HtmlDom.SetStyle(oCurrentNode, "display", "block");
          }
          else
          {
          }
        }
        oCurrentNode = oCurrentNode.parentElement;
      }
    }
    
    WebControl.ScrollToControl(oControl, Graphic3DInstance.Top_Top, 0);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_JumpToControl", "");
  }
}

function WebControl_GetWebMessageDescriptor(oControl)
{
  try
  {  
    var webMessageDescriptor = null;
    for (var i = 0, len = this.WebMessageDescriptorList.Count(); i < len; i++)
    {
      webMessageDescriptor = this.WebMessageDescriptorList.Get(i);
      if (webMessageDescriptor.oControl == oControl) break;
    }    
    return webMessageDescriptor;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetWebMessageDescriptor", "Section1")
  }
}

function WebControl_AskForSaveAndContinue(IDValue)
{
  try
  {  
    var returnValue = true;
    if (IDValue*1 < 1 || WebData.ExistsChanges() == true)
    {
      if (confirm(ids_SaveAndContinue) == true)
      {
        WebData.Save();
        if (this.ValidationOK == false)
        {
          returnValue = false;
        }
      }
      else
      {
        returnValue = false;
      }
    }
    return returnValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_AskForSaveAndContinue", "Section1")
  }
}

function WebControl_AskForDontSaveAndContinue(IDValue)
{
  try
  {  
    var returnValue = true;
    if (IDValue*1 < 1 || WebData.ExistsChanges() == true)
    {
      if (confirm(ids_DontSaveAndContinue) == true)
      {
        returnValue = true;
      }
      else
      {
        returnValue = false;
      }
    }
    return returnValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_AskForDontSaveAndContinue", "Section1")
  }
}

function WebControl_CheckSelection()
{
  try
  {  
    var returnValue = true;
    
    WebDataSearch.BuildSearchInfo();
    if (WebDataSearch.ExistsSelection == false && WebMessage.GetSearchInfoItemList().length == 0)
    {
      alert(ids_SelectRecordFirst);
      returnValue = false;
    }
    return returnValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_CheckSelection", "Section1", this.CheckSelection)
  }
}

function WebControl_AskForLongTask()
{
  try
  {  
    var returnValue = false;
    if (confirm(ids_LongTask) == true)
    {
      returnValue = true;
    }
    return returnValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_AskForLongTask", "Section1")
  }
}

function WebControl_BuildReturnXml(selectedItem)
{
  try
  {  
    var xmlData = "";
    xmlData += "<Root>";
    xmlData += "<Record ";
    xmlData += " OptionValue=\"" + escape(selectedItem.value) + "\"";
    xmlData += " OptionText=\""  + escape(selectedItem.text) + "\"";
    xmlData += " ReturnText=\""  + selectedItem.getAttribute("OptionReturn") + "\"";
    for (var i = 0; i < selectedItem.attributes.length; i++)
    {
      var oAttribute = selectedItem.attributes[i];
      if (typeof(oAttribute.value) == "string" && oAttribute.value != "null" && oAttribute.value.length > 0)
      {
        xmlData += " " + oAttribute.name + "=\""  + escape(oAttribute.value) + "\"";
      }
    }
    xmlData += ">";
    xmlData += "</Record>";
    xmlData += "</Root>";
    
    return xmlData;
  
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_BuildReturnXml", "Section1")
  }
}


function WebControl_BuildReturnXmlFromRecord(value, text, returnText, oRecord)
{
  try
  {  
    var xmlData = "";
    xmlData += "<Root>";
    xmlData += "<Record ";
    xmlData += " OptionValue=\"" + escape(value) + "\"";
    xmlData += " OptionText=\""  + escape(text) + "\"";
    xmlData += " ReturnText=\""  + escape(returnText) + "\"";
    for (var i = 0; i < oRecord.childNodes.length; i++)
    {
      var oNode = oRecord.childNodes[i];
      xmlData += " " + oNode.nodeName + "=\""  + escape(oNode.text) + "\"";
    }
    xmlData += ">";
    xmlData += "</Record>";
    xmlData += "</Root>";
    
    return xmlData;
  
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_BuildReturnXmlFromRecord", "Section1")
  }
}

function MainMenu_OnMouseOver(sender)
{
  try
  {
    var senderOfEvent = window.event.srcElement;
    var oTr = null;

    if (senderOfEvent.tagName == "TR")
    {
      oTr = senderOfEvent;
    }
    else if (senderOfEvent.tagName == "TD")
    {
      oTr = senderOfEvent.parentElement;
    }
    else if (senderOfEvent.tagName == "SPAN")
    {
      oTr = senderOfEvent.parentElement.parentElement;
    }

    if (WebControl.oLastMenuTr && WebControl.oLastMenuTr != oTr)
    {
      for (var i = 0; i < WebControl.oLastMenuTr.cells.length; i++)
      {
        WebControl.ResetBackgroundColor(WebControl.oLastMenuTr.cells[i]);
      }
    }
    
    if (WebControl.oLastMenuTr != oTr)
    {
      for (var i = 0; i < oTr.cells.length; i++)
      {
        WebControl.SetBackgroundColor(oTr.cells[i], "#a2a2a2");
      }
      WebControl.oLastMenuTr = oTr;
    }

    if (senderOfEvent.tagName == "SPAN")
    {
      WebControl.SetColor(senderOfEvent, "#ffffff");
    }
  }
  catch(exception)
  {
  }
}

function MainMenu_OnMouseOut(sender)
{
  try
  { 
    var senderOfEvent = window.event.srcElement;

    if (senderOfEvent.tagName == "SPAN")
    {
      EnsureWebControl();
      WebControl.ResetColor(senderOfEvent);
    }
  }
  catch(exception)
  {
  }
}

function NavMenu_OnMouseOver(oControl)
{
  try
  {
    if (oControl.getAttribute("Type") == "Link")
    {
      EnsureWebControl();
      var cssClassSelected = oControl.getAttribute("CssClassSelected");
      if (cssClassSelected) WebControl.SetClassName(oControl, cssClassSelected);
    }
  }
  catch(exception)
  {
  }
}

function NavMenu_OnMouseOut(oControl)
{
  try
  {
    if (oControl.getAttribute("Type") == "Link")
    {
      EnsureWebControl();
      WebControl.ResetClassName(oControl);
    }
  }
  catch(exception)
  {
  }
}

function WebControl_GetFileName(url)
{
  try
  { 
    var result = "";
    var regex = /[^\/]*aspx/;
    var match = regex.exec(url);

    if (match != null) result = match[0];
    else result = "";

    return result;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetFileName", "Section1")
  }
}

function WebControl_CreateErrorRow(oRecord, webDataErrorDescriptor)
{
  try
  { 
    var recordWrapper = this.Records.GetInstance(oRecord);

    var oErrorRow = null;
    var oErrorCell = null;
    
    if (recordWrapper.ErrorRow == null)
    {
      var oTBody = this.GetTBody(oRecord);
      if (oTBody && oTBody.rows)
      {
        var oRow = oTBody.rows[0];
        if (oRow)
        {
          var colSpanCount = 0;
          for (var j = 0; j < oRow.cells.length; j++)
          {
            colSpanCount += oRow.cells[j].colSpan;
          }
          if (oRow.className.indexOf("DataSeperatorRow") > -1
            || Ilp.HtmlDom.HasAttribute(oRow, "IsMasterSeperatorRow", "true") == true)
          {
            oErrorRow = oTBody.insertRow(1);
          }
          else oErrorRow = oTBody.insertRow(0);
          
          oErrorRow.className = "DataErrorRow";
          oErrorCell = oErrorRow.insertCell();
          oErrorCell.className = "DataErrorCell";
          oErrorCell.colSpan = colSpanCount;
        }
      }
      recordWrapper.ErrorRow = oErrorRow;
    }
    
    if (recordWrapper.ErrorRow)  
    {
      Ilp.HtmlDom.SetText(recordWrapper.ErrorRow.cells(0), webDataErrorDescriptor.ErrorText);
      Ilp.HtmlDom.SetStyle(recordWrapper.ErrorRow, "display", "block");
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_CreateErrorRow", "Section1")
  }
}

function WebControl_ClearErrorRow(oRecord)
{
  try
  { 
    var recordWrapper = this.Records.GetInstance(oRecord);

    if (recordWrapper.ErrorRow != null)
    {
      Ilp.HtmlDom.SetText(recordWrapper.ErrorRow.cells(0), "");
      Ilp.HtmlDom.SetStyle(recordWrapper.ErrorRow, "display", "none");
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ClearErrorRow", "Section1")
  }
}

function WebControl_GetErrorRow(oRecord)
{
  try
  { 
    var recordWrapper = this.Records.GetInstance(oRecord);

    return recordWrapper.ErrorRow;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetErrorRow", "Section1")
  }
}

function WebControl_CheckRowState()
{
  try
  { 
    var oSelectedList = WebData.SelectModified();
    if (oSelectedList && oSelectedList.length > 0)
    {
      WebData.HasChanged = true;  
      WebStatusBar.SetDataChangedMessage(ids_DataChanged, 1);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_CheckRowState", "Section1")
  }
}

function WebControl_EditRecordInDialog(sender, args)
{
  try
  { 
    var result = null;
    var oRecord = sender.oRecord;
    
    if (WebData.HasChanged == true)
    {
      if (confirm(ids_SaveAndContinue) == true)
      {
        WebData.Save();
        if (WebControl.ValidationOK == false)
        {
          return result;
        }
      }
      else
      {
        return result;
      }
    }
    
    var verb = Verb_Edit;
    var url = "";
    var dialogFeatures = "";
    var editModal = sender.getAttribute("EditModal");
    var editDialogUrl = sender.getAttribute("EditDialogUrl");
    var editDialogFeatures = sender.getAttribute("EditDialogFeatures");
    if (editDialogUrl && editDialogUrl.length > 0)
    {
      var id = null;
      var editFqn = sender.getAttribute("EditFqn");
      if (editFqn && editFqn.length > 0)
      {
        id = WebData.GetFieldValue(oRecord, editFqn);
      }  

      // Falls IDSchedule == null gilt, gibt es noch keinen zugeordneten Ausführungsplan.
      if (id == null) verb = Verb_New
      else verb = Verb_Edit

      var urlPrep = editDialogUrl;
      urlPrep = WebControl.PrepareXPathSelector(oRecord, urlPrep);
          
      var url = WebControl.GetStandardUrl(urlPrep, verb, CallingMode_DialogDirect);
      dialogFeatures = editDialogFeatures;
      
      var args = new EventArgs();
      args.Url = url;
      args.Features = dialogFeatures;
      args.Verb = verb;

      if (typeof(this.OnBeforeEditRecordHandler) == "function")
      {
        this.OnBeforeEditRecordHandler(oControl, args);
        url = args.Url;
        dialogFeatures = args.Features;
      }
      
      if (args.Cancel == false)
      {
        if (editModal == "false")
        {                   
          var windowFeatures = WebControl.GetWindowFeatures();
          WebControl.Open(url, "", null);
        }
        else
        {
          if (1==1)
          {
            result = WebControl.ShowModalDialog(url, dialogFeatures, null);
          }
          else
          {
            var windowFeatures = this.GetWindowFeatures();
            this.GetCurrentWindow().open(url, '_blank', windowFeatures, true);
          }
          
          if (WebControl.ReturnedRecordList.Count() > 0)
          {
            var oSun = WebControl.FindSun(sender);
            var fqn = this.GetFqn(oSun);
            var oFd = FormDescriptor.GetFieldDescriptor(fqn);
            var sdFqn = oFd.getAttribute("SelectionDescriptorFqn");
            
            if (sdFqn && sdFqn.length > 0)
            {
              var returnedXml = WebControl.ReturnedRecordList.Get(0);
              var returnedRecord = WebData.CreateRecordFromXml(returnedXml);
              
              var oSd = FormDescriptor.GetSelectionDescriptor(sdFqn);
              var optionReturnList = FormDescriptor.GetOptionReturnList(oSd);
              var optionReturnTargetList = FormDescriptor.GetOptionReturnTargetList(oSd);
              
              if (FormDescriptor.IsStringArrayEmpty(optionReturnList) == false
                && FormDescriptor.IsStringArrayEmpty(optionReturnTargetList) == false
                && optionReturnList.length == optionReturnTargetList.length)
              {
                var idValue = 0;
                var fieldName = editFqn.split(".")[1];
                for (var i = 0; i < optionReturnTargetList.length; i++)
                {
                  if (optionReturnTargetList[i] == fieldName)
                  {
                    idValue = WebData.GetFieldValueInt(returnedRecord, optionReturnList[i]);
                    break;
                  }
                }
              
                if (idValue > 0)
                {
                  for (var i = 0; i < optionReturnTargetList.length; i++)
                  {
                    WebData.CopyFieldFromTo(returnedRecord, returnedRecord.nodeName + "." + optionReturnList[i], oRecord, oRecord.nodeName + "." + optionReturnTargetList[i]);
                    WebData.UpdateFieldBinding(oRecord, oRecord.nodeName + "." + optionReturnTargetList[i]);
                  }
                }  
              }
              
            }    
          }

          if (typeof(this.OnAfterEditRecordHandler) == "function")
          {
            this.OnAfterEditRecordHandler(oControl, args);
          }
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_EditRecordInDialog", "");
  }
}

function WebControl_GetRecordInfo(recordInfoSkin)
{
  try
  {
    recordInfoSkin = recordInfoSkin == null ? "None" : recordInfoSkin;
    if (typeof(WebControl.RecordInfoList) == "undefined") WebControl.RecordInfoList = new WebHashtable();
  
    if (WebControl.RecordInfoList.Contains(recordInfoSkin) == false)
    {
      var recordInfoContainer = document.getElementById("RecordInfo.Root." + recordInfoSkin);
      if (recordInfoContainer != null)
      {
        WebControl.RecordInfoList.Set(recordInfoSkin, new RecordInfo(recordInfoContainer));
      }
    }
    return WebControl.RecordInfoList.Get(recordInfoSkin);
    
    /* Vor Umstellung auf RecordInfoSkinEnum
    if (WebControl.RecordInfo == null)
    {
      var recordInfoContainer = document.getElementById("RecordInfo.Root");
      if (recordInfoContainer != null)
      {
        WebControl.RecordInfo = new RecordInfo(recordInfoContainer);
      }
    }
    return WebControl.RecordInfo;
    */
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetRecordInfo", "Section1")
  }
}


function WebControl_ShowRecordInDialog(sender, args)
{
  try
  { 
    var oRecord = sender.oRecord;
    if (oRecord && WebControl.AskForSaveAndContinue(WebData.GetPkValue(oRecord)) == true)
    {  
      // 1. sicher die Auswahlkriterien
      var oSearchInfoSave = WebMessage.SearchInfoSave();
      WebMessage.InitSearchInfo(true);
      
      var oSelectionDescriptor = FormDescriptor.GetSelectionDescriptor(sender.SelectionDescriptorFqn);
      
      var urlPrep = sender.SelectDialogUrl;
      urlPrep = WebControl.PrepareXPathSelector(oRecord, urlPrep);  

      var url = WebControl.GetStandardUrl(urlPrep, Verb_Show, CallingMode_DialogDirect);
      var features = sender.SelectDialogFeatures;
      
      var args = new EventArgs();
      args.Url = url;
      args.Features = features;
      args.oRecord = oRecord;
      args.oSelectionDescriptor = oSelectionDescriptor;
      args.AddedRecordList = new WebArray();

      sender.BeforeOpenSelection = eval(sender.getAttribute("BeforeOpenSelection"));
      if (typeof(sender.BeforeOpenSelection) == "function")
      {
        sender.BeforeOpenSelection(sender, args);
        if (args.Cancel == true) return null;
        url = args.Url;
        features = args.Features;
        oSelectionDescriptor = args.oSelectionDescriptor;
      }
      
      // 3. speichere den SelectionDescriptorFqn
      WebMessage.SetGeneralInfoAttribute("TransferFqn", sender.SelectionDescriptorFqn);
      WebMessage.SetGeneralInfoAttribute("PageHeadline", PageHeadline);
      WebMessage.SetGeneralInfoAttribute("PageLogo", PageLogo);
      WebMessage.SaveWebMessageTransfer();
      
      var IDWebMessageTransfer = WebMessage.GetGeneralInfoAttribute("IDWebMessageTransfer");
      var IDSessionInfo = WebMessage.GetGeneralInfoAttribute("IDSessionInfo");

      url += "&WM=" + String(IDWebMessageTransfer) 

      // 3. rufe den Dialog auf
      WebControl.ShowModalDialog(url, features, null);
      WebMessage.SearchInfoRestore(oSearchInfoSave);      
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ShowRecordInDialog", "");
  }
}

function WebControl_ShowInfoInDialog(sender, args)
{
  try
  { 
    var oRecord = sender.oRecord;
    if (oRecord && WebControl.AskForSaveAndContinue(WebData.GetPkValue(oRecord)) == true)
    {  
      if (sender.getAttribute("InfoDescriptorFqn") != null && sender.getAttribute("InfoDescriptorFqn").length > 0)
      {
        // 1. sicher die Auswahlkriterien
        var oSearchInfoSave = WebMessage.SearchInfoSave();
        WebMessage.InitSearchInfo(true);
        
        var oSelectionDescriptor = FormDescriptor.GetSelectionDescriptor(sender.InfoDescriptorFqn);
        
        var urlPrep = sender.InfoDialogUrl;
        urlPrep = WebControl.PrepareXPathSelector(oRecord, urlPrep);  
      
        var url = WebControl.GetStandardUrl(urlPrep, Verb_Show, CallingMode_DialogDirect);
        var features = sender.InfoDialogFeatures;
        
        var args = new EventArgs();
        args.Url = url;
        args.Features = features;
        args.oRecord = oRecord;
        args.oSelectionDescriptor = oSelectionDescriptor;
        args.AddedRecordList = new WebArray();

        sender.BeforeOpenInfoHandler = eval(sender.getAttribute("BeforeOpenInfoHandler"));
        if (typeof(sender.BeforeOpenInfoHandler) == "function")
        {
          sender.BeforeOpenInfoHandler(sender, args);
          if (args.Cancel == true) return null;
          url = args.Url;
          features = args.Features;
          oSelectionDescriptor = args.oSelectionDescriptor;
        }
        
        // 3. speichere den SelectionDescriptorFqn
        WebMessage.SetGeneralInfoAttribute("TransferFqn", sender.InfoDescriptorFqn);
        WebMessage.SetGeneralInfoAttribute("PageHeadline", PageHeadline);
        WebMessage.SetGeneralInfoAttribute("PageLogo", PageLogo);
        WebMessage.SaveWebMessageTransfer();
        
        var IDWebMessageTransfer = WebMessage.GetGeneralInfoAttribute("IDWebMessageTransfer");
        var IDSessionInfo = WebMessage.GetGeneralInfoAttribute("IDSessionInfo");

        url += "&WM=" + String(IDWebMessageTransfer) 

        // 3. rufe den Dialog auf
        WebControl.ShowModalDialog(url, features, null);
        WebMessage.SearchInfoRestore(oSearchInfoSave);
      }      
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ShowInfoInDialog", "");
  }
}

function WebControl_ShowRecordInfo(sender, recordInfoSkin)
{
  try
  { 
    WebControl.RecordInfo = WebControl.GetRecordInfo(recordInfoSkin);
    if (WebControl.RecordInfo)
    {
      WebControl.RecordInfo.Show(sender, recordInfoSkin);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ShowRecordInfo", "Section1")
  }
}

function WebControl_HideRecordInfo(sender)
{
  try
  {     
    WebControl.RecordInfo = WebControl.GetRecordInfo(sender.getAttribute("RecordInfoSkin"));
    if (WebControl.RecordInfo)
    {
      WebControl.RecordInfo.Hide();
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_HideRecordInfo", "Section1")
  }
}

function WebControl_ShowPosition(sender, detailTableAffected, positionFqn, positionTextFqn)
{
  try
  { 
    var dialogFeatures = WebControl.GetDialogFeatures(740, 450);
    var url = WebControl.GetStandardUrl("GlobalScripts/GTCommon/ChangePosition.aspx", Verb_Show, CallingMode_DialogDirect);  
   
    detailTableAffected = detailTableAffected == null ? "" : detailTableAffected;
    positionFqn = positionFqn == null ? "Position" : positionFqn;
    positionTextFqn = positionTextFqn == null ? "NodeText" : positionTextFqn;
    
    this.GetCurrentWindow().oRecordMaster = sender.oRecord;
    this.GetCurrentWindow().TableAffected = sender.oRecord.nodeName;
    this.GetCurrentWindow().DetailTableAffected = detailTableAffected;
    this.GetCurrentWindow().PositionFqn = positionFqn;
    this.GetCurrentWindow().PositionTextFqn = positionTextFqn;
    
    var positionChanged = this.GetCurrentWindow().showModalDialog(url, this.GetCurrentWindow(), dialogFeatures);
    
    this.SetCurrentWindow(window);
    
    if (sender.oRecord != null) WebData.UpdateBinding(sender.oRecord);
    
    var oRecordListPosition = WebData.Select("PositionLookUp[@msdata:rowOrder]");
    oRecordListPosition.removeAll();
    
    return positionChanged;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ShowPosition", "Section1")
  }
}

function WebControl_SwapPosition(sender, positionFqn, webControlRef)
{
  try
  { 
    positionFqn = positionFqn == null ? "Position" : positionFqn;
    webControlRef = webControlRef == null ? this : webControlRef;
    
    var oRecord = sender.oRecord;
    var oRecordSwaped = null;

    var oTBody = WebControl.GetTBody(oRecord);
    var oTBodySwaped = null;
    
    var newPosition = new Number(this.ConvertControlDataToWebData(sender));
    var oldPosition = new Number(WebData.GetFieldValue(oRecord, oRecord.nodeName + "." + positionFqn));

    var positionSwapped = false;
    
    var oRecordTemp = null;
    var oRecordSwaped = null;
    
    var parentNodeRecord = null;
    var parentNodeTBody = null;
    
    var oRecordList = null;
    if (WebData.IsChildRecord(oRecord) == true)
    {
      oRecordList = WebData.GetChildRecords(oRecord.parentNode, oRecord.nodeName);
    }
    else
    {
      oRecordList = WebData.Select(oRecord.nodeName);
    }
    
    if (oRecordList.length > 1 && newPosition != oldPosition)
    {
      parentNodeRecord = oRecord.parentNode;
      parentNodeTBody = oTBody.parentNode;
    
      var counter = 1;
      for (var i = 0; i < oRecordList.length; i++)
      {
        oRecordTemp = oRecordList[i];
        if (newPosition < oldPosition)
        {
          if (i+1 != oldPosition)
          {
            if (i+1 == newPosition)
            {
              oRecordSwaped = oRecordTemp;
              counter++;
            }
            WebData.SetFieldValue(oRecordTemp, oRecordTemp.nodeName + "." + positionFqn, counter);
            WebData.UpdateFieldBinding(oRecordTemp, oRecordTemp.nodeName + "." + positionFqn, webControlRef);
             counter++;
           }
        }
        else
        {
          if (i+1 != oldPosition)
          {
            WebData.SetFieldValue(oRecordTemp, oRecordTemp.nodeName + "." + positionFqn, counter);
            WebData.UpdateFieldBinding(oRecordTemp, oRecordTemp.nodeName + "." + positionFqn, webControlRef);
             counter++;
            if (i+1 == newPosition)
            {
              if (oRecordTemp != parentNodeRecord.lastChild) oRecordSwaped = oRecordTemp.nextSibling;
              counter++;
            }
          }
        }
      }

      if (oRecordSwaped == null)
      {
        parentNodeRecord.appendChild(oRecord);
        parentNodeTBody.appendChild(oTBody);
      }
      else
      {
        parentNodeRecord.insertBefore(oRecord, oRecordSwaped);
        oTBody = WebControl.GetTBody(oRecord);
        oTBodySwaped = WebControl.GetTBody(oRecordSwaped);

        parentNodeTBody.insertBefore(oTBody, oTBodySwaped);
      }
      
      WebControl.ScrollToControl(oTBody, Graphic3DInstance.Bottom_Bottom, 100);
      
      WebData.SetFieldValue(oRecord, oRecord.nodeName + "." + positionFqn, newPosition);
      WebData.UpdateFieldBinding(oRecord, oRecord.nodeName + "." + positionFqn, webControlRef);
      
      positionSwapped = true;
    }
    
    return positionSwapped;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_SwapPosition", "");
  }
}

function WebControl_GetSelectedRecords(sender, args, selectionDescriptorFqn, tableDescriptorFqn)
{
  try
  { 
    var oSelectionDescriptor = null;
    var tdFqn = "";
    if (selectionDescriptorFqn != null)
    {
      oSelectionDescriptor = FormDescriptor.GetSelectionDescriptor(selectionDescriptorFqn);
      tdFqn = oSelectionDescriptor.getAttribute("TableDescriptorFqn");
    }
    else
    {
      tdFqn = tableDescriptorFqn;
    }
    
    window.WebControl.ReturnedRecordList.Clear();
    if (args.CurrentWindow.FormDescriptor.GetFieldDescriptor(tdFqn + ".Selected") == null)
    {
      var oRecord = args.CurrentWindow.WebData.GetRecord(tdFqn, 0);
      if (oRecord) window.WebControl.ReturnedRecordList.Add(oRecord.xml);
    }
    else
    {
      var oRecordList = args.CurrentWindow.WebData.GetSelectedRecords(null, tdFqn);
      for (var i = 0, len = oRecordList.length; i < len; i++)
      {
        oRecord = oRecordList[i];
        window.WebControl.ReturnedRecordList.Add(oRecord.xml);
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetSelectedRecords", "Section1")
  }
}

function WebControl_LoadApp(sURL, IDProgram, ac)
{
  try
  {
    ac = ac == null ? 0 : 1;
    document.forms["frmAction"].elements["IDMainProgram"].value = IDMainProgram;
    if (IDProgram != null)
    {
      document.forms["frmAction"].elements["IDProgram"].value = IDProgram;
    }
    document.forms["frmAction"].elements["Language"].value = Language;
    document.forms["frmAction"].elements["TargetShowURL"].value = sURL;
    if (RootPath.substring(RootPath.length-1,RootPath.length)=="/")
    {
      document.forms["frmAction"].action = RootPath + "LoginFrame.aspx?AC=" + String(ac);
    }
    else{  
      document.forms["frmAction"].action = RootPath + "/LoginFrame.aspx?AC=" + String(ac);
    }
    document.forms["frmAction"].target = '_blank';
    document.forms["frmAction"].submit();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_LoadApp", "Section1")
  }
}

function WebControl_GetCssBodyHeight(target)
{
  var webFrameHost = new WebFrameHostClass();
  if (webFrameHost.IFrame != null)
  {
    if (webFrameHost.HostWindow.GetFrameBodyHeight)
    {
      if (target == "Css") return parseInt(webFrameHost.HostWindow.GetFrameBodyHeight()) + "px";
      return webFrameHost.HostWindow.GetFrameBodyHeight();
    }
  }
}

function WebControl_GetCssBodyWidth(target)
{
  var webFrameHost = new WebFrameHostClass();
  if (webFrameHost.IFrame != null)
  {
    if (webFrameHost.HostWindow.GetFrameBodyWidth)
    {
      if (target == "Css") return parseInt(webFrameHost.HostWindow.GetFrameBodyWidth()) + "px";
      return webFrameHost.HostWindow.GetFrameBodyWidth();
    }
  }
}

function WebControl_GetFormDefault()
{
  try
  {
    return this.GetCurrentDocument().forms["FormDefault"];
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetFormDefault", "Section1")
  }
}

function WebControl_GetRandom()
{
  try
  {
    return Math.ceil((100000 - 10 + 1) * Math.random()  + 10);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetRandom", "Section1")
  }
}  

function WebControl_ShowContextHelpDialog(sender, src)
{
  try
  { 
    var windowFeatures = WebControl.GetWindowFeatures();  
    var idValue = 0;
    var contextHelpID = Ilp.HtmlDom.GetAttribute(src, "ContextHelpID", "");
    var contextHelpType = Ilp.HtmlDom.GetAttribute(sender, "ContextHelpType", "Fqn");
    var url = WebControl.GetStandardUrl("GlobalScripts/GTCommon/ShowContextHelp.aspx", Verb_Show, CallingMode_ContextHelp);
    url += "&ContextHelpID=" + contextHelpID;  
    
    //FqnAndPk (Nimmt, um den PK zu ermitteln, den FQN des Controls, an dem der ContextHelp hängt)
    if (contextHelpType == enum_ContextHelpType_FqnAndPk)
    {      
      var oSun = WebControl.FindSun(sender);      
      var fqn = WebControl.GetFqn(oSun);
      var oFieldDescriptor = FormDescriptor.GetFieldDescriptor(fqn);
      var selectionDescriptorFqn = Ilp.HtmlDom.GetAttribute(oFieldDescriptor, "SelectionDescriptorFqn", "");
      if (selectionDescriptorFqn.length > 0)
      {
        var oSelectionDescriptor = FormDescriptor.GetSelectionDescriptor(selectionDescriptorFqn);
        var valueFqn = Ilp.HtmlDom.GetAttribute(oSelectionDescriptor, "ValueFqn", "");
        idValue = WebData.GetFieldValue(sender.oRecord, valueFqn);
      }
      else
      {
        idValue = WebData.GetFieldValue(sender.oRecord, fqn);
      }      
    }  
    //ContextHelpFqnAndPk (Nimmt, um den PK zu ermitteln, den FQN der als ContextHelpFqn angegeben wurde)
    else if (contextHelpType == enum_ContextHelpType_ContextHelpFqnAndPk)
    {
      var contextHelpFqn = Ilp.HtmlDom.GetAttribute(src, "ContextHelpFqn", "");      
      idValue = WebData.GetFieldValue(sender.oRecord, contextHelpFqn);
    }
    
    //Wurde zuvor bei den Behandlungen der Typen das IDValue gesetzt, so wird dies hier an die URL gehängt
    if (WebControl.CheckID(idValue) > 0)
    {
      url += "." + String(idValue);
    }
    
    var oWindow = WebControl.OpenWindow("ContextHelp", url, "_blank", windowFeatures, true);  
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ShowContextHelpDialog", "");
  }
}

function WebControl_EditInLongTextDialog(src)
{
  try
  { 
    var oRecord = src.oRecord;
    var oSun = WebControl.FindSun(src);
    var fqn = this.GetFqn(oSun);
        
    var dialogFeatures = src.getAttribute("LongTextFeatures");
    var windowFeatures = WebControl.GetWindowFeatures();

    var url = "";
    var path = src.getAttribute("LongTextUrl") == null ? "GlobalScripts/GTCommon/LongText.aspx" : src.getAttribute("LongTextUrl");
    if (oSun.oGalaxy && oSun.readOnly == true)
    {
      url = WebControl.GetStandardUrl(path, Verb_ReadOnly, CallingMode_DialogLongText);
    }
    else
    {
      url = WebControl.GetStandardUrl(path, Verb_Show, CallingMode_DialogLongText);
    }
    if (oSun.oGalaxy && oSun.oGalaxy.getAttribute("UseRulerImage") == "true")
    {
      url += "&Ruler=1";
    }
   
    window.Fqn = fqn;
    window.oRecord = oRecord;
    window.oSun = oSun;
    
    var result = null;
    if (1==1)
    {
      result = WebControl.ShowModalDialog(url, dialogFeatures, oRecord);
    }
    else
    {
      var oWindow = WebControl.OpenWindow("LongTextDialog", url, "LongTextDialog", windowFeatures, true);
    }
    if(result && result.length > 0) WebData.UpdateFieldBinding(oRecord, fqn); 
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_EditInLongTextDialog", "");
  }
}

function WebControl_ShowColumnOrderDialog(sender, src)
{
  try
  { 
    var dialogFeatures = WebControl.GetDialogFeatures();
    var windowFeatures = WebControl.GetWindowFeatures();

    var url = WebControl.GetStandardUrl("GlobalScripts/GTCommon/ColumnOrder.aspx", Verb_Show, CallingMode_DialogColumnOrder);

    WebMessage.SetWebSpreadSheetInfo(sender);
    WebMessage.SetGeneralInfoAttribute("TableDescriptorFqn", Ilp.HtmlDom.GetAttribute(sender, "TableDescriptorFqn", ""));
    WebMessage.SetGeneralInfoAttribute("ControlType", Ilp.HtmlDom.GetAttribute(sender, "ControlType", ""));
    WebMessage.SetGeneralInfoAttribute("LayoutID", Ilp.HtmlDom.GetAttribute(sender, "LayoutID", ""));
    WebMessage.SaveWebMessageTransfer();
    var IDWebMessageTransfer = WebMessage.GetGeneralInfoAttribute("IDWebMessageTransfer");
    var IDSessionInfo = WebMessage.GetGeneralInfoAttribute("IDSessionInfo");
    url += "&IDSessionInfo=" + IDSessionInfo;
    url += "&WM=" + IDWebMessageTransfer;
    
    var result = null;
    if (1==1)
    {
      result = WebControl.ShowModalDialog(url, dialogFeatures);
    }
    else
    {
      var oWindow = WebControl.OpenWindow("ColumnOrderInDialog", url, "ColumnOrderInDialog", windowFeatures, true);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ShowColumnOrderDialog", "");
  }
}

function WebControl_ShowExportColumnSelectionDialog(sender, src)
{
  try
  { 
    var dialogFeatures = WebControl.GetDialogFeatures();
    var windowFeatures = WebControl.GetWindowFeatures();

    var url = WebControl.GetStandardUrl("GlobalScripts/GTCommon/ExportColumnSelection.aspx", Verb_Show, CallingMode_DialogColumnOrder);

    WebMessage.SetGeneralInfoAttribute("TableDescriptorFqn", Ilp.HtmlDom.GetAttribute(sender, "TableDescriptorFqn", ""));
    WebMessage.SetGeneralInfoAttribute("ExcelDataDescriptorFqn", Ilp.HtmlDom.GetAttribute(sender, "ExcelDataDescriptorFqn", ""));
    WebMessage.SaveWebMessageTransfer();
    var IDWebMessageTransfer = WebMessage.GetGeneralInfoAttribute("IDWebMessageTransfer");
    var IDSessionInfo = WebMessage.GetGeneralInfoAttribute("IDSessionInfo");
    url += "&IDSessionInfo=" + IDSessionInfo;
    url += "&WM=" + IDWebMessageTransfer;
    
    var result = null;
    if (1==1)
    {
      result = WebControl.ShowModalDialog(url, dialogFeatures);
    }
    else
    {
      var oWindow = WebControl.OpenWindow("ExportColumnSelectionDialog", url, "ExportColumnSelectionDialog", windowFeatures, true);
    }
    return result;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ShowExportColumnSelectionDialog", "");
  }
}

function WebControl_ShowInputDialog(url, features, inputHeadline)
{
  try
  { 
    
    WebMessage.SetGeneralInfoAttribute("InputHeadline", inputHeadline);
    WebMessage.SetGeneralInfoAttribute("PageHeadline", PageHeadline);
    WebMessage.SetGeneralInfoAttribute("PageLogo", PageLogo);
    WebMessage.SaveWebMessageTransfer();
    var IDWebMessageTransfer = WebMessage.GetGeneralInfoAttribute("IDWebMessageTransfer");

    var dialogFeatures = WebControl.GetDialogFeatures();
    var windowFeatures = WebControl.GetWindowFeatures();
        
    if (url == null) url = WebControl.GetStandardUrl("GlobalScripts/GTCommon/InputDialog.aspx", Verb_Show, CallingMode_DialogInput);
    url += "&WM=" + IDWebMessageTransfer;  
    
    if (features == null) features = dialogFeatures;
    
    var result = null;
    if (1==1)
    {
      result = WebControl.ShowModalDialog(url, features);
    }
    else
    {
      var oWindow = WebControl.OpenWindow("InputDialog", url, "InputDialog", windowFeatures, true);
    }
    
    if (result != null && result.length > 0) return result;
    else return "";
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ShowInputDialog", "");
  }
}

function WebControl_SelectRecordInDialog(sender, verb, iSelectDialog, oContainerInstance, autoClear)
{
  try
  { 
    autoClear = autoClear == null ? true : autoClear;
    var oRecord = sender.oRecord;
    if (oRecord && WebControl.AskForSaveAndContinue(WebData.GetPkValue(oRecord)) == true)
    {
      // 1. sicher die Auswahlkriterien
      var oSearchInfoSave = WebMessage.SearchInfoSave();
      WebMessage.InitSearchInfo(true);
      
      var oSelectionDescriptor = FormDescriptor.GetSelectionDescriptor(iSelectDialog.SelectionDescriptorFqn);
      var urlPrep = iSelectDialog.SelectDialogUrl;
      urlPrep = WebControl.PrepareXPathSelector(oRecord, urlPrep);  
      
      var url = WebControl.GetStandardUrl(urlPrep, verb, CallingMode_TableSelection);
      var features = iSelectDialog.SelectDialogFeatures;
      
      var args = new EventArgs();
      args.Verb = verb;
      args.Behavior = "Standard";
      args.UrlPrep = urlPrep;
      args.Url = url;
      args.Features = features;
      args.oRecord = oRecord;
      args.oSelectionDescriptor = oSelectionDescriptor;
      args.WindowResult = false;
      args.AddedRecordList = new WebArray();

      if (typeof(iSelectDialog.OnBeforeSelectRecordHandler) == "function")
      {
        iSelectDialog.OnBeforeSelectRecordHandler(sender, args);
        if (args.Cancel == true) return null;
        url = args.Url;
        features = args.Features;
        oSelectionDescriptor = args.oSelectionDescriptor;
      }

      // 3. speichere den SelectionDescriptorFqn
      WebMessage.SetGeneralInfoAttribute("TransferFqn", iSelectDialog.SelectionDescriptorFqn);
      WebMessage.SetGeneralInfoAttribute("PageHeadline", PageHeadline);
      WebMessage.SetGeneralInfoAttribute("PageLogo", PageLogo);
      WebMessage.SaveWebMessageTransfer();
      
      var IDWebMessageTransfer = WebMessage.GetGeneralInfoAttribute("IDWebMessageTransfer");
      var IDSessionInfo = WebMessage.GetGeneralInfoAttribute("IDSessionInfo");

      url += "&WM=" + String(IDWebMessageTransfer) 

      var x = 2;
      if (1==x)
      {
        var windowFeatures = WebControl.GetWindowFeatures();
        var oWindow = WebControl.OpenWindow("Dialog", url, "Dialog", windowFeatures, true);
      }
      else
      {
        // 3. rufe den Dialog auf
        result = WebControl.ShowModalDialog(url, features, null);
        args.WindowResult = result;
        if (result)
        {
          // 4. Datensätze werden angelegt
          if (WebControl.ReturnedRecordList.Count() > 0 && args.Behavior == "Standard")
          {
            if (oContainerInstance.ClassType && oContainerInstance.ClassType == "WebDataGrid")
            {  
              for (var i = 0, len = WebControl.ReturnedRecordList.Count(); i < len; i++)
              {
                var oRecordReturnXml = WebControl.ReturnedRecordList.Get(i);
                var oRecordReturn = WebData.CreateRecordFromXml(oRecordReturnXml);
                
                var oRecordNew = oContainerInstance.NewRecordOnly(sender, "append", args);
                
                var oSelectionDescriptor = FormDescriptor.GetSelectionDescriptor(iSelectDialog.SelectionDescriptorFqn);
                var optionReturnList = FormDescriptor.GetOptionReturnList(oSelectionDescriptor);
                var optionReturnTargetList = FormDescriptor.GetOptionReturnTargetList(oSelectionDescriptor);
                for (var j = 0; j < optionReturnTargetList.length; j++)
                {
                  var fqn = oRecordNew.nodeName + "." + optionReturnTargetList[j];
                  var oFd = FormDescriptor.GetFieldDescriptor(fqn);
                  var fieldType = oFd.getAttribute("FieldType");
                  var fieldValue = WebData.GetFieldValue(oRecordReturn, optionReturnList[j]);
                  if (fieldValue != null) WebData.SetFieldValue(oRecordNew, fqn, fieldValue);
                  else WebData.SetNull(oRecordNew, fqn);
                }
                
                if (iSelectDialog.SaveSelection == true)
                {
                  WebData.SaveRecord(oRecordNew);
                  WebData.AcceptChanges(oRecordNew);
                  WebData.ReloadRecord(oRecordNew);
                }
                
                // 5. Zeige die Daten am Bildschirm an
                WebData.UpdateBinding(oRecordNew);
                
                args.AddedRecordList.Add(oRecordNew);
              }
              oContainerInstance.ShowTotal();
              
              // Wenn ein neuer DS in einem Detail hinzugefügt wird, 
              // soll der Sichtbereich aufgeklappt werden.
              var oMasterRecord = WebData.GetMasterRecord(oRecordNew);
              if(oMasterRecord)oContainerInstance.ExpandChapter();
              
              // 4a. Der Focus wird auf den zuletzt angelegten Datensatz gesetzt
              oContainerInstance.SetFocus(args.oRecordNew, args.oTBody);
            }
            else if (oContainerInstance.ClassType && oContainerInstance.ClassType == "WebTreeView")
            {
              var oWebTreeView = sender.oNode.WebTreeView;
              detailTableDescriptorFqn = sender.oNode.WebTreeView.GetDetailFqn(sender.oNode, iSelectDialog.DetailTableDescriptorFqn);
              if (detailTableDescriptorFqn.length > 0)
              {
                for (var i = 0, len = WebControl.ReturnedRecordList.Count(); i < len; i++)
                {
                  var oRecordReturnXml = WebControl.ReturnedRecordList.Get(i);
                  var oRecordReturn = WebData.CreateRecordFromXml(oRecordReturnXml);
                    
                  var oRecordNew = null;
                  var oNodeTarget = null;
                  var detailTargetFqn = "";
                  if (detailTableDescriptorFqn == "AlphaCategoryPosition")
                  {
                    var IDAlphaCategoryPosition = WebData.GetFieldValueInt(oRecordReturn, "IDAlphaCategoryPosition");
                    var oRecordAlpha = WebData.Select("//AlphaCategoryPosition[NodeID='" + String(IDAlphaCategoryPosition) + "']", null, 0);
                    // 1. oNode finden
                    oNodeTarget = this.GetBoundNode(oRecordAlpha);
                    // 2. oNode anzeigen
                    oNodeTarget.Show();
                    // 3. target detail holen
                    detailTargetFqn = this.GetDetailFqn(oNodeTarget);
                  }
                  else
                  {
                    oNodeTarget = sender.oNode;
                    detailTargetFqn = detailTableDescriptorFqn;
                  }
                    
                  oRecordNew = WebData.NewRecord(detailTargetFqn);
                  oRecordNew = WebData.AddRecord(oRecordNew, oNodeTarget.Record);
                  args.oRecordNew = oRecordNew;

                  newNode = new NodeClass(oNodeTarget.WebTreeView, oRecordNew);
                  oNodeTarget.Add(newNode);
                  newNode.Render();
                  oNodeTarget.SetMoreData();
                  oNodeTarget.SetExpandImage();
                  oNodeTarget.ShowInnerContainer();
                    
                  var oSelectionDescriptor = FormDescriptor.GetSelectionDescriptor(iSelectDialog.SelectionDescriptorFqn);
                  var optionReturnList = FormDescriptor.GetOptionReturnList(oSelectionDescriptor);
                  var optionReturnTargetList = FormDescriptor.GetOptionReturnTargetList(oSelectionDescriptor);
                  for (var j = 0; j < optionReturnTargetList.length; j++)
                  {
                    var fqn = oRecordNew.nodeName + "." + optionReturnTargetList[j];
                    var fieldValue = WebData.GetFieldValue(oRecordReturn, optionReturnList[j]);
                    if (fieldValue != null) WebData.SetFieldValueOnly(oRecordNew, fqn, fieldValue);    
                    else WebData.SetNull(oRecordNew, fqn);
                  }
                  
                  if (typeof(this.OnNewNodeAdded) == "function")
                  {
                    this.OnNewNodeAdded(sender, args);
                  }
                  WebData.SaveRecord(oRecordNew);
                  if (typeof(this.OnNewNodeSaved) == "function")
                  {
                    this.OnNewNodeSaved(sender, args);
                  }
                  WebData.AcceptChanges(oRecordNew);
                  WebData.ReloadRecord(oRecordNew);
                  WebData.UpdateBinding(oRecordNew);
                  oWebTreeView.UpdateNodeSetting(oRecordNew, newNode);
                  
                  args.AddedRecordList.Add(oRecordNew);
                }
                sender.oNode.Loaded = false;
                sender.oNode.Filled = false;
              }          
            }
          }
        }
        else
        {
          WebControl.ReturnedRecordList.Clear();
        }
        
        if (typeof(iSelectDialog.OnAfterSelectRecordHandler) == "function")
        {
          iSelectDialog.OnAfterSelectRecordHandler(sender, args);
        }
      }
      
      if (autoClear == true) WebControl.ReturnedRecordList.Clear();
      WebMessage.SearchInfoRestore(oSearchInfoSave);      
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_SelectRecordInDialog", "Section1")
  }
};

function WebControl_LaunchHelp(sender, args)
{
  try 
  {
    if (args) args.Cancel = true;
    
    var helpLanguage = "";
    var helpFile = "";
    
    this.SetDisabled(sender);
      
    switch (RootID) 
    {
      case "eOrder":
        helpLanguage = "de-DE";
        helpFile = RootPath + "Help/Help.asp";
        break;
      case "eLog":
        helpLanguage = "de-DE";
        helpFile = RootPath + "MainApp/MainAppHelp/Help.asp";     
        break;
 
      case "ESPEY":
        helpLanguage = "de-DE";
        if (location.href.indexOf("Admin.aspx") > -1)
        {
          helpFile = RootPath + "Admin/AdminHelp/Help.asp";
        }
        else
        {
          helpFile = RootPath + "Help/Help.asp";
        }  
        break;
      default:
        helpLanguage = this.SelectLanguage();
        switch (RootID) 
        {
          case "MDS":
            if (helpLanguage == "d" || helpLanguage == "de-DE") 
            {
              helpFile = RootPath + "Help/Help.asp";
            } 
            else 
            {
              helpFile = RootPath + "HelpEng/Help.asp";
            }
            break;
          default:
            if (helpLanguage == "d" || helpLanguage == "de-DE") 
            {
              helpFile = HelpPath + "Help/Help.asp";
            } 
            else if (helpLanguage == "f" || helpLanguage == "fr-FR") 
            {
              helpFile = HelpPath + "HelpFra/Help.asp";
            } 
            else 
            {
              helpFile = HelpPath + "HelpEng/Help.asp";
            }
        }
    }
    
    document.forms["frmAction"].action = helpFile;
    document.forms["frmAction"].target = "_blank";
    if (this.CheckString(helpLanguage) > 0) 
    {
      document.forms["frmAction"].submit();
    }
    
    this.SetEnabled(sender);
    return false;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_LaunchHelp", "Section1")
  }
}

function WebControl_SelectLanguage() 
{
  try 
  {
    var features = "dialogHeight:280px;dialogWidth:350px;status:no;";
    var helpLanguage = "";
    var supportedLanguages = "";
    var url = "";
    
    url = GlobalScriptsDirectoryVirtual + "GTCommon/SelectLanguage.aspx?Language=" + Language + "&RootID=" + RootID;
    if (WebMessage)
    {
      supportedLanguages = WebMessage.GetGeneralInfoAttribute("SupportedLanguages");
      if (this.CheckString(supportedLanguages) > 0)
      {
        url += "&SupportedLanguages=" + supportedLanguages;
      }
    }
    helpLanguage = window.showModalDialog(url, PageLogo, features);
      
    return helpLanguage;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_SelectLanguage", "Section1")
  }
}

function WebControl_GetClientResource(resourceKey) 
{
  try 
  {
    var oResourceSet = this.GetCurrentDocument().getElementById("ClientResourceStore$");
    var oRecord = oResourceSet.selectSingleNode("NewDataSet/ClientResource[ResourceKey[.='" + String(resourceKey) + "']]");
    if(oRecord) return  WebData.GetFieldValue(oRecord, "ClientResource.ResourceValueLoc");
    else return "";
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetClientResource", "Section1")
  }
}

function WebControl_CopyScripts(documentSource, documentTarget, headTarget) 
{
  try 
  {
    if (documentTarget.scripts.length == 0)
    {
      var headTarget = documentTarget.getElementsByTagName("head")[0];
      for (var i = 0; i < document.scripts.length; i++)
      {
        var oScript = documentTarget.scripts[i];
        
        var e = documentTarget.createElement("script");
        e.type = oScript.type;
        e.language = oScript.language;
        if (oScript.src && oScript.src.length > 0) 
        {
          e.src = oScript.src;
          headTarget.appendChild(e); 
        }
        else
        {
          if (i == 0)
          {
            e.text = oScript.text;
            headTarget.appendChild(e); 
          }
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_CopyScripts", "Section1")
  }
}

function WebControl_CopyStyleSheets(documentSource, documentTarget, headTarget) 
{
  try 
  {
    if (documentTarget.styleSheets.length == 0)
    {
      var headTarget = documentTarget.getElementsByTagName("head")[0];
      for (var i = 0; i < documentSource.styleSheets.length; i++)
      {
        var oStyleSheet = documentSource.styleSheets[i];
        if (oStyleSheet.href && oStyleSheet.href.length > 0) 
        {
          var e = documentTarget.createElement("link");
          e.href = oStyleSheet.href;
          e.type = "text/css";
          e.rel = "stylesheet";
          e.media = "screen";
          
          headTarget.appendChild(e); 
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_CopyStyleSheets", "Section1")
  }
}

function WebControl_GetStandardPP(callingMode) 
{
  try 
  {
    var ppParameter = "";
    if (Ilp.HtmlDom.IsCss1Compat() == true)
    {
      if (callingMode == CallingMode_Dialog)
      {
        ppParameter = PPCriteriaSelection;
      }
    }
    else
    {
      if (callingMode == CallingMode_Dialog)
      {
        ppParameter = PPInDialog;
      }
    }
    return ppParameter;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetStandardPP", "Section1")
  }
}

function WebControl_GetStandardUrl(relativeUrl, verb, callingMode) 
{
  try 
  {
    var url = "";
    var urlDescriptor = new UrlDescriptor(document.location.href);
    
    var delimiter = "?";      
    if (relativeUrl.indexOf("?") > -1) delimiter = "&";
    
    if (Ilp.HtmlDom.IsCss1Compat() == true)
    {
      if (callingMode == CallingMode_MainApp)
      {
        url = location.protocol + "//" + location.hostname + RootPath + "GlobalScripts/GTMainApp/GTMainApp.aspx";
        url += "?PP=" + PPStandard;
        url += "&Caller=" + urlDescriptor.File;
        url += "&FormID=" + WebMessage.GetGeneralInfoAttribute("FormID");
        url += "&Verb=" + verb;  
        url += "&Target=" + relativeUrl;  
      }
      else if (callingMode == CallingMode_Dialog)
      {
        url += location.protocol + "//" + location.hostname + RootPath + "GlobalScripts/GTMainApp/GTDialog.aspx";
        url += "?PP=" + PPCriteriaSelection;
        url += "&Caller=" + urlDescriptor.File;
        url += "&FormID=" + WebMessage.GetGeneralInfoAttribute("FormID");
        url += "&Verb=" + verb;  
        url += "&Target=" + relativeUrl;
      }
      else if (callingMode == CallingMode_DialogDirect)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PPStandard7;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
      else if (callingMode == CallingMode_DialogDirect2)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PP_001100110001010;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
      else if (callingMode == CallingMode_DialogSearch)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PP_111010110001011;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
      else if (callingMode == CallingMode_DialogLongText
        || callingMode == CallingMode_DialogInput)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PPStandard5;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
      else if (callingMode == CallingMode_DialogColumnOrder)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PP_000000100001010;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
      else if (callingMode == CallingMode_SelSearch)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PP_001000100000010;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
      else if (callingMode == CallingMode_TableSelection)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PP_001000100000010;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
      else if (callingMode == CallingMode_ListBoxSelection)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PP_001000100000010;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
      else if (callingMode == CallingMode_ComboSelection)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PP_001000100000010;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
      else if (callingMode == CallingMode_GridSelection)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PP_001100110001010;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
      else if (callingMode == CallingMode_SystemRequirement
        || callingMode == CallingMode_AccountRequest)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PP_000000100001010;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
      else if (callingMode == CallingMode_KAM)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PP_110111001011001;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
      else if (callingMode == CallingMode_TreeViewRightSide)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PP_110111001011011;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
      else if (callingMode == CallingMode_TreeViewRightSide2)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PPInTreeviewRightSideWithRowSeperatorAsXhtml;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
      else if (callingMode == CallingMode_IFrame)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PP_100111001011011;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
      else if (callingMode == CallingMode_MenuStrip)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PP_100000110000010;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
      else if (callingMode == CallingMode_ContextHelp)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PPTreeview;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
      else if (callingMode == CallingMode_SubmitSelf)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
    }
    else
    {
      if (callingMode == CallingMode_MainApp)
      {
        url = location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += "?PP=" + PPInDialogWithWebDataToolbar;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
      else if (callingMode == CallingMode_Dialog
        || callingMode == CallingMode_DialogDirect)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PPInDialog;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }  
      if (callingMode == CallingMode_DialogDirect2)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PP_001100110001000;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }  
      else if (callingMode == CallingMode_DialogSearch)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PPInDialogWithSearchContainer;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
      else if (callingMode == CallingMode_DialogLongText
        || callingMode == CallingMode_DialogInput)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PPInDialogWithWebDataHeader;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
      else if (callingMode == CallingMode_DialogColumnOrder)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PPInBlankWindow;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
      else if (callingMode == CallingMode_SelSearch)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PP_001000100000000;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
      else if (callingMode == CallingMode_TableSelection)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PP_001000100000000;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
      else if (callingMode == CallingMode_ListBoxSelection)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PP_001000100000000;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
      else if (callingMode == CallingMode_ComboSelection)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PP_001000100000000;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
      else if (callingMode == CallingMode_GridSelection)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PP_001100110001000;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
      else if (callingMode == CallingMode_SystemRequirement
        || callingMode == CallingMode_AccountRequest)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PPInBlankWindow;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
      else if (callingMode == CallingMode_KAM)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PP_110111001011001;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
      else if (callingMode == CallingMode_TreeViewRightSide)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PP_110111001011001;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
      else if (callingMode == CallingMode_TreeViewRightSide2)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PPInTreeviewRightSideWithRowSeperator;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
      else if (callingMode == CallingMode_IFrame)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PP_100111001010000;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
      else if (callingMode == CallingMode_MenuStrip)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PP_100000110000000;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
      else if (callingMode == CallingMode_ContextHelp)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "PP=" + PPInDialog;  
        url += "&Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
      else if (callingMode == CallingMode_SubmitSelf)
      {
        url += location.protocol + "//" + location.hostname + RootPath + relativeUrl;
        url += delimiter + "Caller=" + urlDescriptor.File;
        url += "&Verb=" + verb;  
      }
    }
    
    return url;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetStandardUrl", "Section1")
  }
}

function WebControl_GetDialogFeatures(width, height) 
{
  try 
  {
    width = width == null ? 600 : width;
    height = height == null ? 400 : height;
    
    var dialogFeatures = "";
    
    dialogFeatures += "dialogWidth:" + String(width) + "px;";
    dialogFeatures += "dialogHeight:" + String(height) + "px;";
    dialogFeatures += "scroll:Yes;";
    dialogFeatures += "status:No;";
    dialogFeatures += "resizable:Yes;";
    
    return dialogFeatures;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetDialogFeatures", "Section1")
  }
}

function WebControl_GetWindowFeatures(width, height, mode) 
{
  try 
  {
    width = width == null ? 800 : width;
    height = height == null ? 600 : height;
    mode = mode == null ? "" : mode;

    var windowFeatures = "";
    
    if (mode == "1")
    {
      windowFeatures += "width = " + String(width) + "px,";
      windowFeatures += "height = " + String(height) + "px,";
      windowFeatures += "scroll = Yes,";
      windowFeatures += "scrollbars = Yes,";
      windowFeatures += "status = No,";
      windowFeatures += "resizable = Yes,";
    }
    else if (mode == "2")
    {
      windowFeatures += "width = " + String(width) + "px,";
      windowFeatures += "height = " + String(height) + "px,";
      windowFeatures += "scroll = No,";
      windowFeatures += "scrollbars = Yes,";
      windowFeatures += "status = No,";
      windowFeatures += "resizable = Yes,";
    }
    else
    {
      windowFeatures += "width = " + String(width) + "px,";
      windowFeatures += "height = " + String(height) + "px,";
      windowFeatures += "scroll = Yes,";
      windowFeatures += "scrollbars = Yes,";
      windowFeatures += "status = Yes,";
      windowFeatures += "resizable = Yes,";
      windowFeatures += "location = Yes,";
      windowFeatures += "menubar = Yes,";
      windowFeatures += "titlebar = Yes,";
      windowFeatures += "toolbar = Yes";
    }
    
    return windowFeatures;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetWindowFeatures", "Section1")
  }
}

function WebControl_Login(sender) 
{
  try 
  {
    var handled = false;
    var loginMainForm = document.forms["LoginMain"];
    if (loginMainForm == null) loginMainForm = document.forms["FormDefault"];

    var targetUrl = sender.getAttribute("TargetUrl");
    if (targetUrl && targetUrl.indexOf("Admin.aspx") > -1)
    {
      if (Ilp.HtmlDom.IsCss1Compat() == true)
      {
        if (window.frameElement)
        {
          document.getElementById("login_LanguageToken").value = WebControl.GetQueryParameter(targetUrl, "Language", "de-DE");
          document.getElementById("login_ProgramStart").value = "GlobalScripts/GTAdmin/GTAdminApp.aspx";
          loginMainForm.target = "_top";
          handled = true;
        }
        else
        {
          document.getElementById("login_LanguageToken").value = WebControl.GetQueryParameter(targetUrl, "Language", "de-DE");
          document.getElementById("login_ProgramStart").value = "GlobalScripts/GTAdmin/GTAdminApp.aspx";
          loginMainForm.target = "_self";
          handled = true;
        }
      }
      else
      {
        if (window.frameElement)
        {
          document.getElementById("login_LanguageToken").value = WebControl.GetQueryParameter(targetUrl, "Language", "de-DE");
          document.getElementById("login_ProgramStart").value = targetUrl;
          loginMainForm.target = "_self";
          handled = true;
        }
        else
        {    
          WebControl.InitPostParameter();
          WebControl.AddPostParameter("PageIndex", 1, "LoginMain");
          WebControl.AddPostParameter("TargetShowURL", "Admin/Admin.aspx", "LoginMain");
          
          document.getElementById("login_LanguageToken").value = WebControl.GetQueryParameter(targetUrl, "Language", "de-DE");
          document.getElementById("login_ProgramStart").value = targetUrl;
          loginMainForm.target = "_self";
          loginMainForm.action = RootPath + "LoginFrame.aspx";
          handled = true;
        }
      }
    }
    
    if (handled == false)
    {
      if (   (RootID == RootID_eCos
              || RootID == RootID_eCon 
              || RootID == RootID_NetInventory 
              || RootID == RootID_Magnat 
              || RootID == RootID_GSE
              || RootID == RootID_ePro_Projects
              || RootID == RootID_ePro_Markets
              || RootID == RootID_ProductCatalog
              || RootID == RootID_ChromoTek) 
          && (targetUrl.indexOf("MainApp.aspx") > -1 
              || targetUrl.indexOf("ePro.aspx") > -1 
              || targetUrl.indexOf("Markets.aspx") > -1 
              || targetUrl.indexOf("eCosApp.aspx") > -1 
              || targetUrl.indexOf("MagantCalculation.aspx") > -1
              || targetUrl.indexOf("KAMSelection.aspx") > -1))
      {
        if (Ilp.HtmlDom.IsCss1Compat() == true)
        {
          if (window.frameElement)
          {
            document.getElementById("login_LanguageToken").value = WebControl.GetQueryParameter(targetUrl, "Language", "de-DE");
            document.getElementById("login_ProgramStart").value = "GlobalScripts/GTMainApp/GTMainApp.aspx";
            loginMainForm.target = "_top";
            handled = true;
          }
          else
          {
            document.getElementById("login_LanguageToken").value = WebControl.GetQueryParameter(targetUrl, "Language", "de-DE");
            document.getElementById("login_ProgramStart").value = "GlobalScripts/GTMainApp/GTMainApp.aspx";
            loginMainForm.target = "_self";
            handled = true;
          }
        }
      }
    }
    
    if (handled == false)
    {
      if(   RootID == RootID_eCon
         || RootID == RootID_eCos
         || RootID == RootID_NetInventory 
         || RootID == RootID_Magnat 
         || RootID == RootID_GSE
         || RootID == RootID_ePro_Projects
         || RootID == RootID_ePro_Markets
         || RootID == RootID_ProductCatalog
         || RootID == RootID_ChromoTekWop)
      {
        if (window.frameElement)
        {      
          document.getElementById("login_LanguageToken").value = WebControl.GetQueryParameter(targetUrl, "Language", "de-DE");
          document.getElementById("login_ProgramStart").value = targetUrl;
          loginMainForm.target = "_top";
          handled = true;
        }
        else
        {
          document.getElementById("login_LanguageToken").value = WebControl.GetQueryParameter(targetUrl, "Language", "de-DE");
          document.getElementById("login_ProgramStart").value = targetUrl;
          loginMainForm.target = "_top";
          handled = true;
        }
      }
      else
      {
        if (window.frameElement)
        {      
          document.getElementById("login_LanguageToken").value = WebControl.GetQueryParameter(targetUrl, "Language", "de-DE");
          document.getElementById("login_ProgramStart").value = targetUrl;
          loginMainForm.target = "_self";
          handled = true;
        }
        else
        {
          WebControl.InitPostParameter();
          WebControl.AddPostParameter("PageIndex", 1, "LoginMain");
          WebControl.AddPostParameter("TargetShowURL", targetUrl, "LoginMain");
          
          document.getElementById("login_LanguageToken").value = WebControl.GetQueryParameter(targetUrl, "Language", "de-DE");
          document.getElementById("login_ProgramStart").value = targetUrl;
          loginMainForm.target = "_self";
          loginMainForm.action = RootPath + "LoginFrame.aspx";
          handled = true;
        }
      }
    }

    if (handled)
    {
      //Ilp.LoginManager.SaveLogin();
      loginMainForm.submit();
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_GetWindowFeatures", "Section1")
  }
}


function WebControl_ReplaceTableName(controlArray, tableName) 
{
  try 
  {
    var controlTemplateWrapper = null;
    var fdFqn = "";
    for (var i = 0, len = controlArray.length; i < len; i++)
    {
      var oTarget = controlArray[i];
      if (oTarget.TrueFalseFqn && oTarget.TrueFalseFqn.length > 0)
      {
        //controlTemplateWrapper = this.Controls.GetInstance(oTarget);
        fdFqn = oTarget.TrueFalseFqn.split(".")[1];
        oTarget.TrueFalseFqn = tableName + "." + fdFqn;
        //controlTemplateWrapper.TrueFalseFqn = fdFqn;
      }
      if (oTarget.TitleFqn && oTarget.TitleFqn.length > 0)
      {
        var fdFqn = oTarget.TitleFqn.split(".")[1];
        oTarget.TitleFqn = tableName + "." + fdFqn;
      }
      if (oTarget.SrcFqn && oTarget.SrcFqn.length > 0)
      {
        var fdFqn = oTarget.SrcFqn.split(".")[1];
        oTarget.SrcFqn = tableName + "." + fdFqn;
      }
      if (oTarget.InnerTextFqn && oTarget.InnerTextFqn.length > 0)
      {
        var fdFqn = oTarget.InnerTextFqn.split(".")[1];
        oTarget.InnerTextFqn = tableName + "." + fdFqn;
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_ReplaceTableName", "Section1")
  }
}


function WebControl_CopyToClipboard(sender) 
{
  try 
  {
    var oSun = WebControl.FindSun(sender);
    if (oSun != null)
    {
      var oText = WebControl.GetValue(oSun);
      if (oText != null && oText.length > 0)
      {
        window.clipboardData.setData("Text", String(oText));
        alert(ids_TextWasCopiedToClipboard);
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_CopyToClipboard", "Section1")
  }
}

function WebControl_CheckAccountRequestEmail(sender, oRecord)
{
  try
  {
    var webMethode = "CheckEmail";
    var email = WebData.GetFieldValue(oRecord, "AccountRequest.Email");
    var webArgument = "<email>" + String(email) + "</email>";

    WebMessage.EvalAuthenticationStatus = false;
    return WebMessage.CallWebMethod2(webMethode, webArgument);
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_CheckAccountRequestEmail", "Section1")
  }
}

function WebControl_SubmitAccountRequest(sender, oRecord)
{
  try
  {
    WebData.HasChanged = true;
    WebMessage.EvalAuthenticationStatus = false;
    WebData.Save();

    if (WebControl.ValidationOK == false)
    {
      return;
    }

    var returnValue = WebControl.CheckAccountRequestEmail(sender, oRecord);
    if (returnValue == "0")
    {
      var webMethode = "SubmitAccountRequest";
      var IDAccountRequest = WebData.GetFieldValue(oRecord, "AccountRequest.IDAccountRequest");
      var webArgument = "<IDAccountRequest>" + String(IDAccountRequest) + "</IDAccountRequest>";
      WebMessage.EvalAuthenticationStatus = false;
      var returnValue = WebMessage.CallWebMethod2(webMethode, webArgument);
      if (returnValue == "1")
      {
        alert(ids_AccountRequestSubmitted);
        if (window.external) window.external.AutoCompleteSaveForm(WebControl.GetFormDefault());
        window.close();
      }
      else
      {
        alert(ids_RetryAfterError);
      }
    }
    else
    {
      alert(ids_EmailAllreadyExists);
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_SubmitAccountRequest", "Section1")
  }
}

function WebControl_SubmitPasswordRequest(sender, oRecord)
{
  try
  {
    WebData.HasChanged = true;
    WebMessage.EvalAuthenticationStatus = false;
    WebData.Save();

    if (WebControl.ValidationOK == false)
    {
      return;
    }

    var returnValue = WebControl.CheckAccountRequestEmail(sender, oRecord);
    if (returnValue == "1")
    {
      var webMethode = "SubmitPasswordRequest";
      var IDAccountRequest = WebData.GetFieldValue(oRecord, "AccountRequest.IDAccountRequest");
      var webArgument = "<IDAccountRequest>" + String(IDAccountRequest) + "</IDAccountRequest>";
      WebMessage.EvalAuthenticationStatus = false;
      var returnValue = WebMessage.CallWebMethod2(webMethode, webArgument);
      if (returnValue == "1")
      {
        alert(ids_PasswordRequestSubmitted);
        window.close();
      }
      else
      {
        alert(ids_RetryAfterError);
      }
    }
    else
    {
      alert(ids_EmailDoesNotExist);
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "WebControl_SubmitPasswordRequest", "Section1")
  }
}


/* ============================ GTWebSplitter.js ===========================*/
window.WebSplitterObjects = new Object();

function WebSplitter(container, splitterContainer, debug, mode)
{
  try
  {
    this.Container = container;
    this.SplitterContainer = splitterContainer;
    
    this.Mode = mode == null ? "table" : mode;
    if (this.Mode == "float")
    {
      this.divLeft = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_WebSplitterContainer_Left);
      this.divLeft.WebSplitter = this;

      this.divRight = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_WebSplitterContainer_Right);
      this.divRight.WebSplitter = this;
      
      this.SetIFrameSize();
    }
    else
    {
      this.table = WebControl.GetDomElementByTagName(this.SplitterContainer, "TABLE");
      this.tdLeft = this.table.rows[0].cells[0];
      this.divLeft = this.table.rows[0].cells[0].children[0];
      this.divLeft.WebSplitter = this;

      this.tdMiddle = this.table.rows[0].cells[1];

      this.tdRight = this.table.rows[0].cells[2];
      this.divRight = this.table.rows[0].cells[2].children[0];
      this.divRight.WebSplitter = this;
    }
    
    this.ClientID = this.SplitterContainer.id;
    
    this.debug = debug;
    
    this.moverBar = null;
    
    this.leftMost = 0;
    this.rightMost = 0;
    
    this.clientX = 0;
    
    this.onResizeHandler = null;
    this.eventHandler = new Array();
    
    window.WebSplitterObjects[this.ClientID] = this;
    
    this.OnLoad();
    window.setTimeout("window.WebSplitterObjects[\"" + this.ClientID + "\"].DoResize();", 100);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebSplitter", "Section1")
  }
}

WebSplitter.prototype.SetIFrameSize = function() 
{
  try
  {
    var rightWidthNew = 0;
    if (Ilp.HtmlDom.IsCss1Compat() == true) rightWidthNew = Ilp.HtmlDom.GetViewportWidth() - Ilp.HtmlDom.GetWidth(this.divLeft) - 12;
    else rightWidthNew = Ilp.HtmlDom.GetViewportWidth() - Ilp.HtmlDom.GetWidth(this.divLeft) - 50;
    if(rightWidthNew > 0) 
    {
      Ilp.HtmlDom.SetStyle(this.divRight, "width", rightWidthNew.toString() + "px");
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebSplitter.prototype.SetIFrameSize", "Section1")
  }
};

WebSplitter.prototype.OnReadyStateChange = function() 
{
  try
  {
    if (event.srcElement.readyState == "complete")
    {
      event.srcElement.WebSplitter.OnLoad();
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebSplitter_OnReadyStateChange", "Section1")
  }
};

WebSplitter.prototype.OnLoad = function() 
{
  try
  {
    this.moverBar = document.createElement("DIV");
    this.moverBar.id = this.ClientID + "MoverBar";
    
    Ilp.HtmlDom.SetStyle(this.moverBar, "height", "100%");
    Ilp.HtmlDom.SetStyle(this.moverBar, "width", "19px");
    Ilp.HtmlDom.SetStyle(this.moverBar, "position", "absolute");
    Ilp.HtmlDom.SetStyle(this.moverBar, "top", "0px");
    Ilp.HtmlDom.SetStyle(this.moverBar, "left", "0px");
    Ilp.HtmlDom.SetStyle(this.moverBar, "backgroundColor", "transparent");
    Ilp.HtmlDom.SetStyle(this.moverBar, "zIndex", "99999");
    Ilp.HtmlDom.SetStyle(this.moverBar, "display", "none");
    Ilp.HtmlDom.AddClass(this.moverBar, "SplitterMoverBar");
    document.body.appendChild(this.moverBar);
    
    if (this.Mode == "float")
    {
      this.onResizeHandler = window.onresize;
      eval("window.onresize = function() {"
        + "if(window.WebSplitterObjects['" + this.ClientID + "'].onResizeHandler) "
        + "{" 
        + "window.WebSplitterObjects['" + this.ClientID + "'].onResizeHandler();"
        + "}" 
        + "window.WebSplitterObjects['" + this.ClientID + "'].DoResize(); "
        + "}");
      
    }
    else
    {
      if(this.table.parentNode.nodeName.toLowerCase() == "body"
      ||(   this.table.parentNode.nodeName.toLowerCase() == "form"
          && this.table.parentNode.parentNode.nodeName.toLowerCase() == "body")) 
      {
        Ilp.HtmlDom.SetStyle(document.body, "margin", "0");
        Ilp.HtmlDom.SetStyle(document.body, "padding", "0");
        Ilp.HtmlDom.SetStyle(document.body, "overflow", "hidden");
      }
      else 
      {
        eval("this.table.parentNode.doresize = function() {" 
          + "window.WebSplitterObjects['" + this.ClientID + "'].DoResize();};");
      }
      
      this.onResizeHandler = window.onresize;
      eval("window.onresize = function() {"
        + "if(window.WebSplitterObjects['" + this.ClientID + "'].onResizeHandler) "
        + "{" 
        + "window.WebSplitterObjects['" + this.ClientID + "'].onResizeHandler();"
        + "}" 
        + "window.WebSplitterObjects['" + this.ClientID + "'].DoResize(); "
        + "}");
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebSplitter_OnLoad", "Section1")
  }
};

WebSplitter.prototype.DoResize = function() 
{
  try
  {
    if (this.Mode == "float")
    {
      this.SetIFrameSize();
    }
    else
    {
      var parentNode = this.table.parentNode;

      var wscTop = Ilp.HtmlDom.GetRegion(parentNode).Top;
      var windowHeight = 0;
      windowHeight = Ilp.HtmlDom.GetViewportHeight();
      var newHeight = windowHeight - wscTop;
      if (typeof(PageDevider) == "object")
      {
        newHeight = newHeight - PageDevider.FooterHeight - 5;
      }
      else
      {
        var footer = document.getElementById("PageFooter");
        if (footer) 
        {
          newHeight = newHeight - Ilp.HtmlDom.GetRegion(footer).Height;
        }
      }
      
      if (newHeight < 20) newHeight = 20;
      
      Ilp.HtmlDom.SetStyle(parentNode, "height", newHeight.toString() + "px");
      
      Ilp.HtmlDom.SetStyle(this.table, "height", newHeight.toString() + "px");

      var divHeight = newHeight
        - parseInt(Ilp.HtmlDom.GetStyle(this.divLeft.parentElement, "paddingTop"))
        - parseInt(Ilp.HtmlDom.GetStyle(this.divLeft.parentElement, "paddingBottom"));

      Ilp.HtmlDom.SetStyle(this.divLeft, "height", divHeight.toString() + "px");
      Ilp.HtmlDom.SetStyle(this.divRight, "height", divHeight.toString() + "px");

      Ilp.HtmlDom.SetStyle(this.divRight, "width", "1px");
      Ilp.HtmlDom.SetStyle(this.divRight, "width", this.divRight.parentNode.offsetWidth.toString() + "px");
        
    }
    this.ShowDebugInfo();      
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebSplitter_DoResize", "Section1")
  }
};

WebSplitter.prototype.CalculateOuterMost = function ()
{
  try
  {
    if (this.Mode == "float")
    {
      var left = WebControl.GetAbsoluteLeft(this.Container);
      if(this.leftMostStart == null || this.leftMostStart <= 0) 
      {
        this.leftMost = left + 30;
      }
      else 
      {
        this.leftMost = left + this.leftMostStart;
      }
      if(this.rightMostStart == null || this.rightMostStart <= 0 || this.rightMostStart >= this.Container.offsetWidth) 
      {
        this.rightMost = left + this.Container.offsetWidth - 30;
      }
      else 
      {
        this.rightMost = left + this.rightMostStart;
      }
    }
    else
    {
      var left = this.GetLeft(this.table);
      if(this.leftMostStart == null || this.leftMostStart <= 0) 
      {
        this.leftMost = left + 30;
      }
      else 
      {
        this.leftMost = left + this.leftMostStart;
      }
      if(this.rightMostStart == null || this.rightMostStart <= 0 || this.rightMostStart >= this.table.offsetWidth) 
      {
        this.rightMost = left + this.table.offsetWidth - 30;
      }
      else 
      {
        this.rightMost = left + this.rightMostStart;
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebSplitter_CalculateOuterMost", "Section1")
  }
}

WebSplitter.prototype.HideIFrames = function() 
{
  try
  {
    for (var i = 0; i < window.WebFrameArray.length; i++)
    {
      window.WebFrameArray[i].Hide();
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebSplitter_HideIFrames", "Section1")
  }
};

WebSplitter.prototype.ShowIFrames = function() 
{
  try
  {
    for (var i = 0; i < window.WebFrameArray.length; i++)
    {
      window.WebFrameArray[i].Show();
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebSplitter_ShowIFrames", "Section1")
  }
};

WebSplitter.prototype.OnMouseDown = function() 
{
  try
  {
    this.CalculateOuterMost();
  
    this.HideIFrames();
    
    this.eventHandler[0] = document.onmousemove;
    this.eventHandler[1] = document.onmouseup;
    this.eventHandler[2] = document.onmousedown;
    this.eventHandler[3] = document.onselectstart;

    eval("document.onmousemove = function(e) {window.WebSplitterObjects['" + this.ClientID + "'].OnMouseMove(e);};");
    eval("document.onmouseup = function(e) {window.WebSplitterObjects['" + this.ClientID + "'].OnMouseUp(e);};"); 
    
    document.onmousedown = function() {return false;};
    document.onselectstart = function() {return false;};
    
    Ilp.HtmlDom.SetStyle(this.moverBar, "left", event.clientX);
    Ilp.HtmlDom.SetStyle(this.moverBar, "top", document.body.scrollTop);
    Ilp.HtmlDom.SetStyle(this.moverBar, "height", document.body.clientHeight.toString()+"px");
    Ilp.HtmlDom.SetStyle(this.moverBar, "display", "block");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebSplitter_OnMouseDown", "Section1")
  }
};

WebSplitter.prototype.OnMouseMove = function() 
{
  try
  {
    if((event.clientX >= this.leftMost && event.clientX <= this.rightMost)) 
    {
      Ilp.HtmlDom.SetStyle(this.moverBar, "left", event.clientX);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebSplitter_OnMouseMove", "Section1")
  }
};

WebSplitter.prototype.OnMouseUp = function() 
{
  try
  {
    /*
    this.moverBar.style.display = "none";
    */
    Ilp.HtmlDom.SetStyle(this.moverBar, "display", "none");
    
    this.ShowIFrames();
    
    document.onmousemove = this.eventHandler[0];
    document.onmouseup = this.eventHandler[1];
    document.onmousedown = this.eventHandler[2];
    document.onselectstart = this.eventHandler[3];
    
    this.clientX = event.clientX;
    if(event.clientX < this.leftMost) 
    {
      this.clientX = this.leftMost;
    }
    if(event.clientX > this.rightMost) 
    {
      this.clientX = this.rightMost;
    }

    if (this.Mode == "float")
    {
      var leftWidthNew = this.clientX - WebControl.GetAbsoluteLeft(this.divLeft);
      var leftWidthOld = this.divLeft.offsetWidth;
      Ilp.HtmlDom.SetStyle(this.divLeft, "width", leftWidthNew.toString() + "px");
      
      this.SetIFrameSize();
    }
    else
    {
      var leftWidthNew = this.clientX - this.GetLeft(this.table);
      var leftWidthOld = this.tdLeft.offsetWidth;
      var rightWidthNew = this.tdRight.offsetWidth + leftWidthOld - leftWidthNew;
      
      Ilp.HtmlDom.SetStyle(this.divLeft, "width", leftWidthNew.toString() + "px");
      Ilp.HtmlDom.SetStyle(this.tdLeft, "width", leftWidthNew.toString() + "px");
      if(rightWidthNew > 0) 
      {
        Ilp.HtmlDom.SetStyle(this.divRight, "width", rightWidthNew.toString() + "px");
        Ilp.HtmlDom.SetStyle(this.tdRight, "width", rightWidthNew.toString() + "px");
      }
      
      // damit das Resizen wieder funktioniert...
      Ilp.HtmlDom.SetStyle(this.tdRight, "width", "");
    }
    
    this.ShowDebugInfo();      
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebSplitter_OnMouseUp", "Section1")
  }
};

WebSplitter.prototype.ShowMeasurements = function (element)
{
  try
  {
    var innerHTML = "";
    
    innerHTML += "id: " + element.id + "<br>";
    innerHTML += "clientWidth: " + String(element.clientWidth) + "<br>";
    innerHTML += "scrollWidth: " + String(element.scrollWidth) + "<br>";
    innerHTML += "offsetWidth: " + String(element.offsetWidth) + "<br>";
    innerHTML += "style.width: " + element.style.width + "<br>";
    innerHTML += "---------------<br>";
    
    return innerHTML;
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebSplitter_ShowMeasurements", "Section1")
  }
}

WebSplitter.prototype.ShowDebugInfo = function() 
{
  try
  {
    if (this.debug == true)
    {
      this.divLeft.innerHTML = this.ShowMeasurements(document.body);
      this.divLeft.innerHTML += this.ShowMeasurements(this.table);
      this.divLeft.innerHTML += this.ShowMeasurements(this.tdLeft);
      this.divLeft.innerHTML += this.ShowMeasurements(this.divLeft);
      this.divLeft.innerHTML += this.ShowMeasurements(this.tdMiddle);
      this.divLeft.innerHTML += this.ShowMeasurements(this.moverBar);

      if (this.divRight.tagName != "IFRAME")
      {
        this.divRight.innerHTML = this.ShowMeasurements(document.body);
        this.divRight.innerHTML += this.ShowMeasurements(this.table);
        this.divRight.innerHTML += this.ShowMeasurements(this.tdRight);
        this.divRight.innerHTML += this.ShowMeasurements(this.divRight);
        this.divRight.innerHTML += this.ShowMeasurements(this.tdMiddle);
        this.divRight.innerHTML += this.ShowMeasurements(this.moverBar);
      }
    }
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebSplitter_ShowDebugInfo", "Section1")
  }
};

WebSplitter.prototype.GetLeft = function(element) 
{
  try
  {
    var left = 0;
    if (element.offsetParent) 
    {
      while (element.offsetParent) 
      {
        left += element.offsetLeft;
        element = element.offsetParent;
      }
    }
    else if (element.x)
    {
      left += element.x;
    }  
    
    return left;
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebSplitter_GetLeft", "Section1")
  }
};

WebSplitter.prototype.GetTop = function(element) 
{
  try
  {
    var top = 0;
    if (element.offsetParent) 
    {
      while (element.offsetParent) 
      {
        top += element.offsetTop;
        element = element.offsetParent;
      }
    }
    else if (element.y)  
      top += element.y;
    
    return top;
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebSplitter_GetTop", "Section1")
  }
};


/* ============================ GTComboUtility.js ===========================*/


/* ============================ GTWebFrame.js ===========================*/
window.WebFrameArray = new Array();

function WebFrame(container, target)
{
  try
  {
    this.ClientID = target.id;
    this.ParentContainer = container;
    this.Container = target; 
    window.WebFrameArray[window.WebFrameArray.length] = this;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebFrame", "Section1")
  }
}
WebFrame.prototype.SetSrc = function(url)
{
  try
  {
    if (this.Container.src != url)
    {
      this.Container.src = url;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebFrame.prototype.SetSrc", "Section1")
  }
}
WebFrame.prototype.SetToContentSize = function()
{
  try
  {
    var contentWindow = this.GetContentWindow();
    var oBody = contentWindow.document.body;
    Ilp.HtmlDom.SetStyle(this.Container, "width", Ilp.HtmlDom.GetScrollWidth() + Ilp.HtmlDom.GetViewportWidth());
    Ilp.HtmlDom.SetStyle(this.Container, "height", Ilp.HtmlDom.GetScrollHeight() + Ilp.HtmlDom.GetViewportHeight());
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebFrame.prototype.SetToContentSize", "Section1")
  }
}
WebFrame.prototype.GetContentWindow = function()
{
  try
  {
    return this.Container.contentWindow;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebFrame_GetContentWindow", "Section1")
  }
}
WebFrame.prototype.GetFrameWindow = function()
{
  try
  {
    var frameWindow = null;
    for (var i = 0; i < window.frames.length; i++)
    {
      if (window.frames[i].frameElement.id == this.ClientID)
      {
        frameWindow = window.frames[i];
        break;
      }
    }
    
    return frameWindow;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebFrame_GetFrameWindow", "Section1")
  }
}

WebFrame.prototype.Save = function()
{
  try
  {
    for (var i = 0; i < window.frames.length; i++)
    {
      if (window.frames[i].frameElement.id == this.ClientID)
      {
        if (typeof(window.frames[i].WebDataSave) == "function")
        {
          window.frames[i].WebDataSave();
          break;
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebFrame_Save", "Section1")
  }
}

WebFrame.prototype.ShowWebMessage = function()
{
  try
  {
    for (var i = 0; i < window.frames.length; i++)
    {
      if (window.frames[i].frameElement.id == this.ClientID)
      {
        if (typeof(window.frames[i].WebDataSave) == "function")
        {
          window.frames[i].ShowWebMessage();
          break;
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebFrame_ShowWebMessage", "Section1")
  }
}

WebFrame.prototype.ExistsChanges = function()
{
  try
  {
    var returnValue = false;

    for (var i = 0; i < window.frames.length; i++)
    {
      if (window.frames[i].frameElement.id == this.ClientID)
      {
        if (typeof(window.frames[i].WebData) == "object")
        {
          returnValue = returnValue || window.frames[i].WebData.ExistsChanges();
        }  
      }
    }
    
    return returnValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebFrame_ExistsChanges", "Section1")
  }
}

WebFrame.prototype.Hide = function()
{
  try
  {
    for (var i = 0; i < window.frames.length; i++)
    {
      if (window.frames[i].frameElement.id == this.ClientID)
      {
        if (typeof(window.frames[i].WebControl) == "object")
        {
          if (CssVersion == "GTLayout") 
          {
            /*
            window.frames[i].document.body.parentElement.runtimeStyle.display = "none";
            */
            Ilp.HtmlDom.SetStyle(window.frames[i].document.body.parentElement, "display", "none");
          }
          else 
          {
            /*
            window.frames[i].document.body.runtimeStyle.display = "none";
            */
            Ilp.HtmlDom.SetStyle(window.frames[i].document.body, "display", "none");
          }
        }  
        break;  
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebFrame_DisableMouseOver", "Section1")
  }
}

WebFrame.prototype.Show = function()
{
  try
  {
    for (var i = 0; i < window.frames.length; i++)
    {
      if (window.frames[i].frameElement.id == this.ClientID)
      {
        if (typeof(window.frames[i].WebControl) == "object")
        {
          if (CssVersion == "GTLayout") 
          {
            /*
            window.frames[i].document.body.parentElement.runtimeStyle.display = "block";
            */
            Ilp.HtmlDom.SetStyle(window.frames[i].document.body.parentElement, "display", "block");
          }
          else 
          {
            /*
            window.frames[i].document.body.runtimeStyle.display = "block";
            */
            Ilp.HtmlDom.SetStyle(window.frames[i].document.body, "display", "block");
          }
        }
        break;  
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebFrame_EnableMouseOver", "Section1")
  }
}

function WebFrameHostClass()
{
  try
  {
    this.IFrame = window.frameElement;
    
    if (this.IFrame != null)
    {
      this.HostWindow = this.IFrame.document.parentWindow; 
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebFrameHostClass", "Section1")
  }
}

WebFrameHostClass.prototype.Show = function()
{
  try
  {
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebFrameHostClass_Show", "Section1")
  }
}

function ResizeIFrame(oIFrame)
{
  try
  { 
    var oBody = oIFrame.document.body;
    oIFrame.style.height = oBody.scrollHeight + (oBody.offsetHeight - oBody.clientHeight);
    oIFrame.style.width = oBody.scrollWidth + (oBody.offsetWidth - oBody.clientWidth);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "ResizeIFrame", "");
  }
}

function HideFrame()
{
  try
  { 
    if (parent)
    {
      parent.WebControl.HideValidationSummary();
    }
    else
    {
      if (top.frames["MainFrame"] && top.frames["MainFrame"].WebControl)
      {
        top.frames["MainFrame"].WebControl.HideValidationSummary();
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HideFrame", "");
  }
}

function WebFrameGoToLogin(sender, url)
{
  url = (url == null) ? (RootID == RootID_MetabionWos ? "LoginMain.aspx" : "Login.aspx") : url;
  if (RootID == RootID_ESPEY)
  {
    url = "http://" + window.location.hostname;
  }
  else
  {
    url = "http://" + window.location.hostname + RootPath + url;
    if (typeof(MapID) == "string" && MapID.length > 0) 
    {
      if (url.indexOf("?") > -1)
      {
        url += "&";
      }
      else
      {
        url += "?";
      }
      url += "MapID=" + MapID;
    }
  }
  window.top.location.href = url;
}


function SetMainFrameset()
{
  var isIFrame = false;
 
  if (window.frameElement != null)
  {
    if (window.frameElement.tagName == "IFRAME")
    {
      isIFrame = true;
    }
  }    
  
  if (isIFrame)
  {
    window.parent.top.location.href = "Login.aspx"; 
  }
  else
  {
    if (parent.MainFrameset)
    {
      parent.MainFrameset.rows = "0%, 100%, 0%";
    }
  }
}

/* ============================ GTWebDropDownMenu.js ===========================*/
function WebDropDownMenu(oControl, dropDownMenuContainer, referenceName, oControlClass)
{
  try
  {
    EnsureWebForm();
    this.Parent = oControlClass;
    this.Loaded = false;
    this.Container = dropDownMenuContainer;
    this.ReferenceName = referenceName;
    this.Fqn = oControl.getAttribute("DropDownMenu");

    this.Init = WebDropDownMenu_Init;
    this.OnClickHandler = WebDropDownMenu_OnClickHandler;
    this.OnMouseOverHandler = WebDropDownMenu_OnMouseOverHandler;
    this.OnMouseOutHandler = WebDropDownMenu_OnMouseOutHandler;

    this.Show = WebDropDownMenu_Show;
    this.Hide = WebDropDownMenu_Hide;
    this.HideT = WebDropDownMenu_HideT;
    this.GetRecord = WebDropDownMenu_GetRecord;

    this.GetMenuItemListByIndex = WebDropDownMenu_GetMenuItemListByIndex;
    this.GetMenuItemListByID = WebDropDownMenu_GetMenuItemListByID;
    this.GetMenuItemByName = WebDropDownMenu_GetMenuItemByName;

    this.SetVisible = WebDropDownMenu_SetVisible;
    this.SetSeparatorVisible = WebDropDownMenu_SetSeparatorVisible;
    this.CheckSeperator = WebDropDownMenu_CheckSeperator;   
    this.SetEventHandler = WebDropDownMenu_SetEventHandler;

    this.MaxWidth = 200;

    window.CanHideMenu = true;
    this.IsNavigationBar = (oControl.getAttribute("IsNavigationBar") == "true") ? true : false;
    this.OpenMenuBehaviour = oControl.getAttribute("OpenMenuBehaviour");
    this.WindowEventSrcElement = null;
    this.CanHide = true;

    if (typeof(oControl.getAttribute("OnBeforeContextMenuPopUp")) == "string")
    {
      this.OnBeforeContextMenuPopUp = eval(oControl.getAttribute("OnBeforeContextMenuPopUp"));
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDropDownMenu", "");
  }
}

function WebDropDownMenu_Init()
{
  try
  {
    this.OpenMenus = new Array();
    this.Menus = new Array();

    if (this.Container != null)
    {
      //var divs = this.Container.children.tags("DIV");
      var divs = this.Container.children.tags("ul");
      for(var i = 0; i < divs.length; i++)
      {
        //this.Menus[i] = new MenuItemList(this, this, divs[i], divs[i].children[0], i);
        this.Menus[i] = new MenuItemList(this, this, divs[i], divs[i], i);
      }
    }

    for (var i = 0; i < this.Menus.length; i++)
    {
      this.Menus[i].Init();
    }

    WebForm.AddDocumentHandler("OnClick", "if(" + this.ReferenceName + " != null) " + this.ReferenceName + ".Hide();");

    if (this.OpenMenuBehaviour == "MouseOver")
    {
      WebForm.AddDocumentHandler("OnMouseOver", "if(" + this.ReferenceName + " != null) " + this.ReferenceName + ".HideT();");
    }


    if (this.Container != null)
    {
      this.SetEventHandler(this.Container);
    }
    this.Loaded = true;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDropDownMenu_Init", "");
  }
}


function WebDropDownMenu_OnClickHandler()
{
  try
  {
    sender = window.event.srcElement;

    var li = WebControl.FindParentByTagName(sender, "LI");
    var dropDownMenu = li.DropDownMenu;
    if (li.MenuItem != null && li.MenuItem.Enabled == true)
    {
      var menuItemList = li.MenuItem.ParentList;
      while (menuItemList)
      {
        if (menuItemList.OpenMenu)
        {
          menuItemList.OpenMenu.Container.style.display = "none";
        }
        menuItemList = menuItemList.OpenMenu;
      }

      if (li.MenuItem.MoreData == true)
      {
        if (dropDownMenu.OpenMenuBehaviour == null)
        {
          var menuItemListNext = li.MenuItem.DropDownMenu.GetMenuItemListByID(li.MenuItem.IDNext);

          var control = li.MenuItem.Control;
          li.MenuItem.ParentList.OpenMenu = dropDownMenu.Show(control, menuItemListNext.Index);
        }
      }
      else
      {
        if (dropDownMenu.IsNavigationBar == true)
        {
          window.CanHideMenu = true;
          dropDownMenu.Hide();
          if (typeof(li.MenuItem.OnClickHandler) == "function")
          {
            var args = new EventArgs();
            args.MenuItem = li.MenuItem;
            li.MenuItem.OnClickHandler(sender, args);
          }
        }
        else
        {
          dropDownMenu.Hide();
          var ancor = WebControl.FindParentByTagName(sender, "A");
          ancor.MenuItem = li.MenuItem;
          li.DropDownMenu.Parent.ProcessContextClick(ancor);
        }
      }
    }
    window.event.cancelBubble = true;
    return false;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDropDownMenu_OnClickHandler", "");
  }
}

function WebDropDownMenu_OnMouseOverHandler(sender)
{
  try
  {
    sender = window.event.srcElement;

    var li = WebControl.FindParentByTagName(sender, "LI");
    if (li.DropDownMenu != null)
    {
      var dropDownMenu = li.DropDownMenu;
      if (dropDownMenu.IsNavigationBar == true)
      {
        var cssClassSelected = sender.getAttribute("CssClassSelected");
        if (typeof(cssClassSelected) == "string") sender.className = cssClassSelected;
      }

      if (dropDownMenu.OpenMenuBehaviour == "MouseOver")
      {
        window.CanHideMenu = false;
        if (li.MenuItem != null && li.MenuItem.Enabled == true)
        {
          var menuItemList = li.MenuItem.ParentList;
          while (menuItemList)
          {
            if (menuItemList.OpenMenu)
            {
              menuItemList.OpenMenu.Container.style.display = "none";
            }
            menuItemList = menuItemList.OpenMenu;
          }

          if (li.MenuItem.MoreData == true)
          {
            if (dropDownMenu.OpenMenuBehaviour == "MouseOver")
            {
              var menuItemListNext = li.MenuItem.DropDownMenu.GetMenuItemListByID(li.MenuItem.IDNext);
              var control = li.MenuItem.Control;
              if (dropDownMenu.IsNavigationBar == true)
              {
                li.MenuItem.ParentList.OpenMenu = dropDownMenu.Show(control, menuItemListNext.Index);
              }
              else
              {
                li.MenuItem.ParentList.OpenMenu = dropDownMenu.Show(control, menuItemListNext.Index, top, left);
              }
            }
          }
        }
      }
    }
    window.event.cancelBubble = true;
    return false;
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebDropDownMenu_OnMouseOverHandler", "");
  }
}

function WebDropDownMenu_OnMouseOutHandler(sender)
{
  try
  {
    sender = window.event.srcElement;

    var li = WebControl.FindParentByTagName(sender, "LI");
    if (li.DropDownMenu != null)
    {
      if (li.DropDownMenu.IsNavigationBar == true)
      {
        var cssClass = sender.getAttribute("CssClass");
        if (typeof(cssClass) == "string") sender.className = cssClass;
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDropDownMenu_OnMouseOutHandler", "");
  }
}

function WebDropDownMenu_Show(sender, index)
{
  try
  {
    WebForm.ContextMenu = this;

    var args = new EventArgs();
    args.DropDownMenu = this;

    var oTarget = sender;
    
    var oRecord = null;
    if (sender.oNode) oRecord = sender.oNode.Record;
    else oRecord = sender.oRecord;

    args.oRecord = oRecord;
    
    args.IsSelected = true;
    if (sender.oNode) args.IsSelected = sender.oNode.WebTreeView.IsSelected(sender.oNode);
    
    var controlTemplateWrapper = WebControl.Controls.GetInstance(oTarget);
    var recordWrapper = WebControl.Records.GetInstance(oRecord)

    var menuItemList;
    var menuItem;
    for (var i = 0; i < this.Menus.length; i++)
    {
      menuItemList = this.Menus[i];
      for (var j = 0; j < menuItemList.MenuItem.length; j++)
      {
        menuItem = menuItemList.MenuItem[j];
        menuItem.Enabled = true;
        if (menuItem.Enabled == true && menuItem.AllowDeleteRequired == true)
        {
          var allowDelete = WebControl.IsDeletable(oTarget, oRecord, controlTemplateWrapper, recordWrapper);
          if (allowDelete == false)
          {
            menuItem.Enabled = false;
          }
        }
        if (menuItem.Enabled == true && menuItem.AllowEditRequired == true)
        {
          var allowEdit = WebControl.IsEditable(oTarget, oRecord, controlTemplateWrapper, recordWrapper);
          if (allowEdit == false)
          {
            menuItem.Enabled = false;
          }
        }
        if (menuItem.Enabled == true && menuItem.AllowCopyRequired == true)
        {
          var allowCopy = WebControl.IsCopyable(oTarget, oRecord, controlTemplateWrapper, recordWrapper);
          if (allowCopy == true)
          {
            menuItem.Enabled = false;
          }
        }
      }
    }

    var menuItemNew = this.GetMenuItemByName("New");
    if (menuItemNew)
    {
      menuItemNew.Enabled = false;
      var allowEdit = WebControl.IsEditable(oTarget, oRecord, controlTemplateWrapper, recordWrapper);
      if (allowEdit == true)
      {
        menuItemNew.Enabled = true;
      }
    }

    var menuItemEdit = this.GetMenuItemByName("Edit");
    if (menuItemEdit)
    {
      menuItemEdit.Enabled = false;
      var allowEdit = WebControl.IsEditable(oTarget, oRecord, controlTemplateWrapper, recordWrapper);
      if (allowEdit == true)
      {
        menuItemEdit.Enabled = true;
      }
    }

    var menuItemMove = this.GetMenuItemByName("Move");
    if (menuItemMove)
    {
      menuItemMove.Enabled = false;
      var allowEdit = WebControl.IsEditable(oTarget, oRecord, controlTemplateWrapper, recordWrapper);
      if (allowEdit == true)
      {
        menuItemMove.Enabled = true;
      }
    }

    var menuItemCopyAndMove = this.GetMenuItemByName("CopyAndMove");
    if (menuItemCopyAndMove)
    {
      menuItemCopyAndMove.Enabled = false;
      var allowEdit = WebControl.IsEditable(oTarget, oRecord, controlTemplateWrapper, recordWrapper);
      if (allowEdit == true)
      {
        menuItemCopyAndMove.Enabled = true;
      }
    }

    var menuItemClipPaste = this.GetMenuItemByName("ClipPaste");
    if (menuItemClipPaste)
    {
      menuItemClipPaste.Enabled = false;
      var allowEdit = WebControl.IsEditable(oTarget, oRecord, controlTemplateWrapper, recordWrapper);
      if (allowEdit == true)
      {
        menuItemClipPaste.Enabled = true;
      }
    }

    var menuItemDelete = this.GetMenuItemByName("Delete");
    if (menuItemDelete)
    {
      menuItemDelete.Enabled = false;
      var allowDelete = WebControl.IsDeletable(oTarget, oRecord, controlTemplateWrapper, recordWrapper);
      if (allowDelete == true)
      {
        menuItemDelete.Enabled = true;
      }
    }

    var menuItemCopy   = this.GetMenuItemByName("Copy");
    if (menuItemCopy)
    {
      menuItemCopy.Enabled = false;
      var allowCopy = WebControl.IsCopyable(oTarget, oRecord, controlTemplateWrapper, recordWrapper);
      if (allowCopy == true)
      {
        menuItemCopy.Enabled = true;
      }
    }

    if (typeof(this.OnBeforeContextMenuPopUp) == "function")
    {
      this.OnBeforeContextMenuPopUp(sender, args);
    }

    this.CheckSeperator();

    var menuItemList = this.GetMenuItemListByIndex(index);
    visibleMenuItem = menuItemList.GetVisibleMenuItems();
    
    if (args.Cancel == true || visibleMenuItem.length == 0)
    {
      return;
    }

    if(index == 0)
    {
      this.Hide();
    }
    
    var menuItemList = this.GetMenuItemListByIndex(index);
    if (menuItemList != null)
    {
      var container = menuItemList.Container; // = DIV
      Ilp.HtmlDom.SetStyle(container, "display", "block");

      for (var i = 0; i < menuItemList.MenuItem.length; i++)
      {
        if (menuItemList.MenuItem[i].Visible == true)
        {
          Ilp.HtmlDom.SetStyle(menuItemList.MenuItem[i].Control, "display", "block");
        }
        else
        {
          Ilp.HtmlDom.SetStyle(menuItemList.MenuItem[i].Control, "display", "none");
        }
        if (menuItemList.MenuItem[i].Enabled == true)
        {
          menuItemList.MenuItem[i].Control.disabled = false;
        }
        else
        {
          menuItemList.MenuItem[i].Control.disabled = true;
        }
      }

      if (this.IsNavigationBar == false)
      {
        var oEl = document.body.insertAdjacentElement("beforeEnd", container);

        Ilp.HtmlDom.SetStyle(oEl, "position", "absolute");
        Ilp.HtmlDom.SetStyle(oEl, "zIndex", 1000);

        WebControl.PositionControl2(oEl, sender, (index == 0 ? 10 : 0));
      }

      this.OpenMenus[this.OpenMenus.length] = new Object();
      this.OpenMenus[this.OpenMenus.length - 1].MenuItemList = menuItemList;
      this.OpenMenus[this.OpenMenus.length - 1].Caller = sender;
    }

    return menuItemList;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDropDownMenu_Show", "");
  }
}

function WebDropDownMenu_HideT()
{
  try
  {
    if (window.CanHideMenu == false)
    {
      window.CanHideMenu = true;
      this.WindowEventSrcElement = window.event.srcElement;
      window.setTimeout(this.ReferenceName + ".Hide();", 1100);
    }
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebDropDownMenu_HideT", "");
  }
}

function WebDropDownMenu_Hide()
{
  try
  {
    if (window.CanHideMenu == true)
    {
      var closeMenu = false;
      var openMenu = null;
      var eSrc = null;
      if (window.event != null)
      {
        eSrc = window.event.srcElement;
      }
      else
      {
        eSrc = this.WindowEventSrcElement;
      }
      if (this.OpenMenus.length > 0)
      {
        closeMenu = true;
        for (var i = 0; i < this.OpenMenus.length; i++)
        {
          openMenu = this.OpenMenus[i];
          var container = openMenu.MenuItemList.Container;
          if( container.contains(eSrc) || openMenu.Caller.contains(eSrc) )
          {
            closeMenu == false;
            break;
          }
        }
      }

      if (closeMenu == true)
      {
        for (var i = 0; i < this.OpenMenus.length; i++)
        {
          openMenu = this.OpenMenus[i];
          /*
          openMenu.MenuItemList.Container.style.display = "none";
          openMenu.MenuItemList.Container.runtimeStyle.display = "none";
          */
          Ilp.HtmlDom.SetStyle(openMenu.MenuItemList.Container, "display", "none");
        }
        this.OpenMenus = new Array();
      }
    }
    this.WindowEventSrcElement = null;
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebDropDownMenu_Hide", "");
  }
}

function WebDropDownMenu_GetMenuItemListByIndex(index)
{
  try
  {
    var menuItemList = null;

    index = index == null ? 0 : index;
    if (index >= 0 && index < this.Menus.length)
    {
      menuItemList = this.Menus[index];
    }

    return menuItemList;
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebDropDownMenu_GetMenuItemListByIndex", "");
  }
}

function WebDropDownMenu_GetMenuItemListByID(name)
{
  try
  {
    var menuItemList = null;

    for (var i = 0; i < this.Menus.length; i++)
    {
      menuItemList = this.Menus[i];
      if (menuItemList.ID == name)
      {
        break;
      }
    }

    return menuItemList;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDropDownMenu_GetMenuItemListByID", "");
  }
}

function WebDropDownMenu_GetMenuItemByName(name)
{
  try
  {
    var menuItemList = null;
    var menuItem = null;

    for (var i = 0; i < this.Menus.length; i++)
    {
      menuItemList = this.Menus[i];
      for (var j = 0; j < menuItemList.MenuItem.length; j++)
      {
        if (menuItemList.MenuItem[j].ItemName == name)
        {
          menuItem = menuItemList.MenuItem[j];
          break;
        }
      }
      if (menuItem != null)
      {
        break;
      }
    }
    return menuItem;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDropDownMenu_GetMenuItemByName", "");
  }
}

function WebDropDownMenu_SetVisible(visible, keepDisabledItem)
{
  try
  {
    keepDisabledItem = keepDisabledItem == null ? false : keepDisabledItem;
    
    var menuItemList = null;
    var menuItem = null;

    for (var i = 0; i < this.Menus.length; i++)
    {
      menuItemList = this.Menus[i];
      for (var j = 0; j < menuItemList.MenuItem.length; j++)
      {
        menuItem = menuItemList.MenuItem[j];
        if (keepDisabledItem == false || menuItem.Enabled == true)
        {
          menuItem.Visible = visible;
        }
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDropDownMenu_SetVisible", "");
  }
}

function WebDropDownMenu_SetSeparatorVisible(visible)
{
  try
  {
    var menuItemList = null;
    var menuItem = null;

    for (var i = 0; i < this.Menus.length; i++)
    {
      menuItemList = this.Menus[i];
      for (var j = 0; j < menuItemList.MenuItem.length; j++)
      {
        menuItem = menuItemList.MenuItem[j];
        if (menuItem.CT == enum_CT_ContextMenu_Separator) menuItem.Visible = visible;
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDropDownMenu_SetSeparatorVisible", "");
  }
}

function WebDropDownMenu_CheckSeperator()
{
  try
  {
    var menuItemList = null;
    var menuItem = null;
    var menuItem2 = null;
    
    this.SetSeparatorVisible(true);
    
    var visibleMenuItem = null;
    for (var i = 0; i < this.Menus.length; i++)
    {
      menuItemList = this.Menus[i];
      visibleMenuItem = menuItemList.GetVisibleMenuItems();

      // Setzte alle Seperatoren am Anfang auf Visible=false;
      for (var j = 0, len = visibleMenuItem.length; j < len; j++)
      {
        menuItem = visibleMenuItem[j];
        if (menuItem.CT == enum_CT_ContextMenu_Separator) menuItem.Visible = false;
        else break;
      }
      
      // Setzte alle Seperatoren am Ende auf Visible=false;
      for (var len = visibleMenuItem.length - 1, j = len; j >= 0; j--)
      {
        menuItem = visibleMenuItem[j];
        if (menuItem.CT == enum_CT_ContextMenu_Separator) menuItem.Visible = false;
        else break;
      }
            
      visibleMenuItem = menuItemList.GetVisibleMenuItems();
      for (var len = visibleMenuItem.length - 1, j = len; j >= 0; j--)
      {
        menuItem = visibleMenuItem[j];

        if (j == len)
        {
          if (menuItem.CT == enum_CT_ContextMenu_Separator) menuItem.Visible = false;
        }
        else if (j == 0)
        {
          if (menuItem.CT == enum_CT_ContextMenu_Separator) menuItem.Visible = false;
        }
        else
        {
          menuItem2 = visibleMenuItem[j - 1];
          if (   menuItem.CT == enum_CT_ContextMenu_Separator
              && menuItem2.CT == enum_CT_ContextMenu_Separator)
          {
            menuItem.Visible = false;
          }
        }

      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDropDownMenu_CheckSeperator", "");
  }
}

function WebDropDownMenu_SetEventHandler(oControl)
{
  try
  {
    oControl.DropDownMenu = this;
    oControl.onclick = this.OnClickHandler;
    oControl.onmouseover = this.OnMouseOverHandler;
    oControl.onmouseout = this.OnMouseOutHandler;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDropDownMenu_SetEventHandler", "");
  }
}

function WebDropDownMenu_GetRecord(sender)
{
  try
  {
    var oRecord = null;

    if (sender.oRecord != null)
    {
      oRecord = sender.oRecord;
    }

    if (oRecord == null)
    {
      if (sender.oNode != null)
      {
        oRecord = sender.oNode.Record;
      }
    }

    if (oRecord == null)
    {
      if (this.Parent.ContextControl != null)
      {
        oRecord = this.Parent.ContextControl.oRecord;
      }
    }

    if (oRecord == null)
    {
      if (this.Parent.ContextControl.oNode != null)
      {
        oRecord = this.Parent.ContextControl.oNode.Record;
      }
    }

    return oRecord;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebDropDownMenu_GetRecord", "");
  }
}



function MenuItemList(dropDownMenu, parentMenu, menuItemListContainer, menuItemListControl, index)
{
  try
  {
    this.DropDownMenu = dropDownMenu;
    this.ParentMenu = parentMenu;
    this.Container = menuItemListContainer; // = DIV
    this.Control = menuItemListControl; // = UL
    this.Index = index;
    this.MenuItem = new Array();
    this.Caller = null;
    this.ID = this.Container.getAttribute("ID");

    this.Init = MenuItemList_Init;
    this.GetVisibleMenuItems = MenuItemList_GetVisibleMenuItems;

    this.DropDownMenu.SetEventHandler(this.Control);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MenuItemList", "");
  }
}

function MenuItemList_Init()
{
  try
  {
    var lis = this.Control.children.tags("LI");
    for(var i = 0; i < lis.length; i++)
    {
      this.MenuItem[i] = new MenuItem(this.DropDownMenu, this.ParentMenu, this, this.Control, lis[i], i);
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MenuItemList_Init", "");
  }
}

function MenuItemList_GetVisibleMenuItems()
{
  try
  {
    var visibleMenuItem = new Array();
    var counter = 0;
    for(var i = 0; i < this.MenuItem.length; i++)
    {
      var menuItem = this.MenuItem[i];
      if (menuItem.Visible == true)
      {
        visibleMenuItem[counter++] = menuItem;
      }
    }
    return visibleMenuItem;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MenuItemList_GetVisibleMenuItems", "");
  }
}

function MenuItem(dropDownMenu, parentMenu, parentList, menuItemContainer, menuItemControl, index)
{
  try
  {
    this.ClassType = "MenuItem";

    this.Container = menuItemContainer; // = UL
    this.Control = menuItemControl; // = LI 
    this.Control.MenuItem = this;       
    this.ObjectID = Ilp.HtmlDom.GetAttribute(this.Control, "ID", "");
    this.ClientID = Ilp.HtmlDom.GetAttribute(this.Control, "ID", "");
    this.Fqn = Ilp.HtmlDom.GetAttribute(this.Control, "Fqn", "");
    this.CT = Ilp.HtmlDom.GetAttribute(this.Control, "CT", 0);
    this.ID = Ilp.HtmlDom.GetAttribute(this.Control, "ID", "");
    this.ItemName = Ilp.HtmlDom.GetAttribute(this.Control, "ItemName", "");

    this.AllowDeleteRequired = Ilp.HtmlDom.GetAttributeBool(this.Control, "AllowDeleteRequired", "false");
    this.AllowNewRequired = Ilp.HtmlDom.GetAttributeBool(this.Control, "AllowNewRequired", "false");
    this.AllowEditRequired = Ilp.HtmlDom.GetAttributeBool(this.Control, "AllowEditRequired", "false");
    this.AllowCopyRequired = Ilp.HtmlDom.GetAttributeBool(this.Control, "AllowCopyRequired", "false");
            
    this.DropDownMenu = dropDownMenu;
    this.ParentMenu = parentMenu;
    this.MoreData = (this.Control.getAttribute("MoreData") == "true");
    this.CssClass = this.Control.getAttribute("CssClass");
    this.CssClassSelected = this.Control.getAttribute("CssClassSelected");
    var onClickHandler = this.Control.getAttribute("OnClickHandler");
    if (typeof(onClickHandler) == "string") this.OnClickHandler = eval(onClickHandler);
    this.IDNext = this.Control.getAttribute("IDNext");
    this.Index = index;
    this.ParentList = parentList;
    this.Enabled = true;
    this.Visible = true;
    this.DetailFqn = this.Control.getAttribute("DetailFqn");


    this.EditModal = Ilp.HtmlDom.GetAttribute(this.Control, "EditModal", "true");
    this.EditDialogUrl = Ilp.HtmlDom.GetAttribute(this.Control, "EditDialogUrl", "");
    this.EditDialogFeatures = Ilp.HtmlDom.GetAttribute(this.Control, "EditDialogFeatures", "");

    this.EditFqn = this.Control.getAttribute("EditFqn");
    this.EditFqn = this.EditFqn == null ? "" : this.EditFqn;

    this.EditReturnFqn = this.Control.getAttribute("EditReturnFqn");
    this.EditReturnFqn = this.EditReturnFqn == null ? "" : this.EditReturnFqn;

    this.MoveModal = Ilp.HtmlDom.GetAttribute(this.Control, "MoveModal", "true");
    this.MoveDialogUrl = Ilp.HtmlDom.GetAttribute(this.Control, "MoveDialogUrl", "");
    this.MoveDialogFeatures = Ilp.HtmlDom.GetAttribute(this.Control, "MoveDialogFeatures", "");

    this.MoveFqn = this.Control.getAttribute("MoveFqn");
    this.MoveFqn = this.MoveFqn == null ? "" : this.MoveFqn;

    this.MoveReturnFqn = this.Control.getAttribute("MoveReturnFqn");
    this.MoveReturnFqn = this.MoveReturnFqn == null ? "" : this.MoveReturnFqn;

    this.SelectDialogUrl = this.Control.getAttribute("SelectDialogUrl");
    this.SelectDialogUrl = this.SelectDialogUrl == null ? "" : this.SelectDialogUrl;

    this.SelectDialogFeatures = this.Control.getAttribute("SelectDialogFeatures");
    this.SelectDialogFeatures = this.SelectDialogFeatures == null ? "" : this.SelectDialogFeatures;

    this.SelectionDescriptorFqn = this.Control.getAttribute("SelectionDescriptorFqn");
    this.SelectionDescriptorFqn = this.SelectionDescriptorFqn == null ? "" : this.SelectionDescriptorFqn;

    this.OnBeforeSelectRecordHandler = this.Control.getAttribute("OnBeforeSelectRecordHandler");
    this.OnBeforeSelectRecordHandler = this.OnBeforeSelectRecordHandler == null ? "" : this.OnBeforeSelectRecordHandler;

    this.OnAfterSelectRecordHandler = this.Control.getAttribute("OnAfterSelectRecordHandler");
    this.OnAfterSelectRecordHandler = this.OnAfterSelectRecordHandler == null ? "" : this.OnAfterSelectRecordHandler;

    this.DropDownMenu.SetEventHandler(this.Control);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "MenuItem", "");
  }
}

/* ============================ GTWebDragDrop.js ===========================*/



/* ============================ GTWebPageDevider.js ===========================*/
function LoadWebPageDevider(headerHeight, footerHeight, mode)
{
  try
  {
    mode = mode == null ? "Standard" : mode;
    headerHeight = headerHeight == null ? -1 : headerHeight;
    footerHeight = footerHeight == null ? -1 : footerHeight;
    
    PageDevider = new WebPageDevider(headerHeight, footerHeight, mode);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "LoadWebPageDevider", "");
  }
}

function WebPageDevider(headerHeight, footerHeight, mode)
{
  try
  {
    mode = mode == null ? "Standard" : mode;
    
    this.Mode = mode;
    
    this.Header = document.getElementById("PageHeader");
    if (this.Header == null) this.Header = document.getElementById("PageHeaderContainer");
    this.Main = document.getElementById("PageMain");
    if (this.Main == null) this.Main = document.getElementById("PageMainContainer");
    this.Main.style.overflow = "auto";
    this.Footer = document.getElementById("PageFooter");
    if (this.Footer == null) this.Footer = document.getElementById("PageFooterContainer");

    this.Wdgc1 = document.getElementById("wdgc1");
    
    if (this.Header == null)
    {
      this.HeaderHeight = 0;
    }
    else
    {
      if (headerHeight == -1 || headerHeight == 0) headerHeight = WebControl.GetOuterDimension(this.Header, "height");
      this.HeaderHeight = headerHeight;
      
		  if (this.Mode == "Fixed")
		  {
		    this.Header.style.position = "absolute";
        this.Header.style.top = "0px";
        document.body.appendChild(this.Header);
      }  
    }

		if (this.Mode == "Fixed")
		{
		  this.Main.style.position = "absolute";
		}
    
    if (this.Footer == null)
    {
      this.FooterHeight = 0;
    }
    else
    {
      if (footerHeight == -1 || footerHeight == 0) footerHeight = WebControl.GetOuterDimension(this.Footer, "height");
      this.FooterHeight = footerHeight;
      
		  if (this.Mode == "Fixed")
		  {
		    this.Footer.style.position = "absolute";
        document.body.appendChild(this.Footer);
      }  
    }
    
		if (this.Mode == "Standard")
		{
      document.body.style.overflow = "hidden";
      document.body.style.top = "0px";
      document.body.style.left = "0px";
      document.body.style.width = WebControl.GetWindowWidth().toString() + "px";
      document.body.style.height = WebControl.GetWindowHeight().toString() + "px";
    }
    
    WebForm.AddBodyHandler("OnResize", "PageDevider.Resize()");
    WebForm.AddBodyHandler("OnScroll", "PageDevider.Scroll()");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebPageDevider", "");
  }
}

WebPageDevider.prototype.Resize = function()
{
  try
  {
    var windowHeight = WebControl.GetWindowHeight();

    var visibleWidth = document.body.clientWidth 
      - WebControl.GetCss(document.body, "marginLeft")
      - WebControl.GetCss(document.body, "marginRight");
      
    if (visibleWidth < 0) visibleWidth = 0; 

    if (this.Header != null)
    {
			if (this.Mode == "Fixed")
			{
        this.Header.style.top = "0px";
        this.Header.style.backgroundColor = document.body.style.backgroundColor;
        this.Header.style.zOrder = 20;
      }  
      this.Header.style.height = this.HeaderHeight.toString() + "px";
      this.Header.style.width = visibleWidth;
    }
    
    if (this.Main)
    {
			this.Main.style.width = visibleWidth;
			if (this.Mode == "Fixed")
			{
			  this.Main.style.top = this.HeaderHeight.toString() + "px";
      }
      
			var resizeHeight = (windowHeight - this.HeaderHeight - this.FooterHeight - 2);
	    
			if (resizeHeight < 0) resizeHeight = 0;
			
			if (this.Mode == "Standard")
			{
			  this.Main.style.height = resizeHeight.toString() + "px";
			}  
    }
    
		if (this.Mode == "Standard")
		{
      //if (this.Wdgc1) this.Wdgc1.style.height = "100%";
    }  
    
    this.Scroll();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebPageDevider_Resize", "");
  }
};
WebPageDevider.prototype.Scroll = function()
{
  try
  {
    if (this.Header != null)
    {
			if (this.Mode == "Fixed")
			{
        this.Header.style.top = WebControl.GetCurrentDocument().body.scrollTop
      }  
    }
    if (this.Footer != null)
    {
      var visibleWidth = document.body.clientWidth 
        - WebControl.GetCss(document.body, "marginLeft")
        - WebControl.GetCss(document.body, "marginRight");
    
			if (this.Mode == "Fixed")
			{
        var exp = "";
        exp += "( ";
        exp += " ignoreMe2 = ";
        exp += " ( ";
        exp += "   (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) ";
        exp += "   + ";
        exp += "   (document.documentElement.scrollHeight ? document.documentElement.scrollHeight : document.body.scrollHeight) ";
        exp += "   - ";
        exp += String(this.FooterHeight);
        exp += " ) + 'px'";
        exp += ") ";

        exp = "";
        exp += "( ";
        exp += " ignoreMe2 = ";
        exp += " ( ";
        exp += "   (document.body.scrollTop) ";
        exp += "   + ";
        exp += "   (document.body.clientHeight) ";
        exp += "   - ";
        exp += String(this.FooterHeight);
        exp += " ) + 'px'";
        exp += ") ";

        var statusText = "(scrollTop:-x-, clientHeight:-y-, FooterHeight:-z-)";
        statusText = statusText.replace("-x-", WebControl.GetCurrentDocument().body.scrollTop);
        statusText = statusText.replace("-y-", WebControl.GetCurrentDocument().body.clientHeight);
        statusText = statusText.replace("-z-", this.FooterHeight);
        WebStatusBar.SetStatusbarMessage(statusText, 1);
        
        this.Footer.style.top = WebControl.GetCurrentDocument().body.scrollTop + WebControl.GetCurrentDocument().body.clientHeight - this.FooterHeight;
        this.Footer.style.left = 0;
        this.Footer.style.zIndex = 20;
        this.Footer.style.height = this.FooterHeight.toString() + "px";
        this.Footer.style.width = visibleWidth.toString() + "px";
      }        
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebPageDevider.prototype.Scroll", "");
  }
};



/* ============================ GTWebSlider.js ===========================*/
window.WebSliderCollection = new Object();

function WebPagingClass(oPagingContainer)
{
  try
  {
    this.Container = oPagingContainer;
    this.Container.JsInstance = this;
    this.ObjectID = this.Container.id;
    this.ClientID = this.Container.id;
    this.ClassType = "WebPagingClass";
  
    this.LeftArrow = Ilp.HtmlDom.GetFirstDescendantByAttribute(oPagingContainer, "CT", enum_CT_WebPaging_LeftArrow);
    this.Area = Ilp.HtmlDom.GetFirstDescendantByAttribute(oPagingContainer, "CT", enum_CT_WebPaging_Area);
    this.RightArrow = Ilp.HtmlDom.GetFirstDescendantByAttribute(oPagingContainer, "CT", enum_CT_WebPaging_RightArrow);
    
    if (this.LeftArrow) this.LeftArrow.oWebPaging = this;
    if (this.RightArrow) this.RightArrow.oWebPaging = this;
    
    if (this.LeftArrow) this.LeftArrow.onclick = WebPagingClass_MoveRight;
    if (this.RightArrow) this.RightArrow.onclick = WebPagingClass_MoveLeft;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebPagingClass", "");
  }
}

function WebPagingClass_MoveRight()
{
  try
  {
    oSrc = window.event.srcElement;
    var oWebPaging = oSrc.oWebPaging;

    var marginLeft = Ilp.HtmlDom.GetMeasure(oWebPaging.Area, "marginLeft");
    marginLeft += Ilp.HtmlDom.GetRegion(oWebPaging.Area.parentElement).Width;
    marginLeft = Math.min(0, marginLeft);
    Ilp.HtmlDom.SetStyle(oWebPaging.Area, "marginLeft", String(marginLeft) + "px");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebPagingClass_MoveRight", "");
  }
}

function WebPagingClass_MoveLeft()
{
  try
  {
    oSrc = window.event.srcElement;
    var oWebPaging = oSrc.oWebPaging;

    if (Ilp.HtmlDom.GetRegion(oWebPaging.Area).Width - Ilp.HtmlDom.GetRegion(oWebPaging.Area.parentElement).Width > 0)
    {
      var marginLeft = Ilp.HtmlDom.GetMeasure(oWebPaging.Area, "marginLeft");
      marginLeft -= Ilp.HtmlDom.GetRegion(oWebPaging.Area.parentElement).Width;
      marginLeft = Math.max(-(Ilp.HtmlDom.GetRegion(oWebPaging.Area).Width - Ilp.HtmlDom.GetRegion(oWebPaging.Area.parentElement).Width), marginLeft);
      Ilp.HtmlDom.SetStyle(oWebPaging.Area, "marginLeft", String(marginLeft) + "px");
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebPagingClass_MoveLeft", "");
  }
}


function WebSlider(oSlider, direction)
{
  try
  {
    this.Container = oSlider;
    this.Container.oWebSlider = this;
    this.ObjectID = this.Container.id;
    this.ClientID = this.Container.id;
    
    this.BoundaryLeft = 0;
    this.BoundaryRight = 0;
    this.BoundaryTop = 0;
    this.BoundaryBottom = 0;
    
    this.SliderLeft = null;
    this.SliderMiddle = null;
    this.SliderRight = null;
    this.SliderArea = null;
    
    this.OnDragStartHandler = null;
    this.OnDragHandler = null;
    this.OnDragEndHandler = null;
    this.OnMovedHandler = null;
    
    this.Direction = direction == null ? "horizontal" : direction;
    this.PercentMoved = 0;
   
    this.Prepared = false;
     
    this.OffsetX;                       // On the dragstart event, this variable is
                                        //    set to track the difference between the
                                        //    mouse position and the corner of the
                                        //    element

    this.OffsetY;                       // Same as OffsetX, but for Y coordinate

    this.SliderMiddleZindex = -1;       // Tracks the regular zIndex so it can be
                                        //    restored once the dragend event occurs

    this.Init = WebSlider_Init;
    this.CalculateBoundaries = WebSlider_CalculateBoundaries;
    this.MoveRight = WebSlider_MoveRight;
    this.MoveLeft = WebSlider_MoveLeft;
    this.PrepareElement = WebSlider_PrepareElement;
    this.RestoreElement = WebSlider_RestoreElement;
    this.Hide = WebSlider_Hide;
    this.Show = WebSlider_Show;
    this.MoveTo = WebSlider_MoveTo;
    this.MoveElement = WebSlider_MoveElement;
    this.DoMouseDown = WebSlider_DoMouseDown;
    this.DoMouseMove = WebSlider_DoMouseMove;
    this.DoMouseUp = WebSlider_DoMouseUp;
    
    this.Init();
    
    window.WebSliderCollection[this.ClientID] = this;
    window.WebSliderCollection[window.WebSliderCollection.length] = this;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebSlider", "");
  }
}

function WebSlider_Init()
{
  try
  {
    if (CssVersion == "GTLayout")
    {
      this.SliderLeft = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_Slider_Left);
      this.SliderLeft.oWebSlider = this;

      this.SliderMiddle = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_Slider_Middle);
      this.SliderMiddle.oWebSlider = this;

      this.SliderRight = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_Slider_Right);
      this.SliderRight.oWebSlider = this;

      this.SliderArea = Ilp.HtmlDom.GetFirstDescendantByAttribute(this.Container, "CT", enum_CT_Slider_Area);
      this.SliderArea.oWebSlider = this;
    }
    else
    {
      var tags = this.Container.getElementsByTagName("IMG");
      for (var i = 0; i < tags.length; i++)
      {
        var tag = tags[i];
        if (tag.getAttribute("IsSliderLeft") == "true")
        {
          this.SliderLeft = tag;
          this.SliderLeft.oWebSlider = this;
        }
        else if (tag.getAttribute("IsSliderMiddle") == "true")
        {
          this.SliderMiddle = tag;
          this.SliderMiddle.oWebSlider = this;
        }
        else if (tag.getAttribute("IsSliderRight") == "true")
        {
          this.SliderRight = tag;
          this.SliderRight.oWebSlider = this;
        }
      }
      var tags = this.Container.getElementsByTagName("DIV");
      for (var i = 0; i < tags.length; i++)
      {
        var tag = tags[i];
        if (tag.getAttribute("IsSliderArea") == "true")
        {
          this.SliderArea = tag;
          this.SliderArea.oWebSlider = this;
        }
      }
    }
    
    this.SliderLeft.onmousedown = this.MoveLeft;
    this.SliderRight.onmousedown = this.MoveRight;
    
    this.SliderMiddle.style.top = "0px";
    this.SliderMiddle.style.left = "0px";
    this.SliderMiddle.onmousedown = this.DoMouseDown;
    this.SliderMiddle.onmouseup = this.DoMouseUp;
    
    this.SliderMiddleZindex = this.SliderMiddle.style.zIndex;

    this.CalculateBoundaries();
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebSlider_Init", "");
  }
}


function WebSlider_CalculateBoundaries()
{ 
  try
  {
    this.BoundaryLeft = 0;
    //this.BoundaryRight = parseInt(this.SliderArea.style.width);
    this.BoundaryRight = this.SliderArea.clientWidth;
    this.BoundaryTop = 0;
    this.BoundaryBottom = 15;
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebSlider_CalculateBoundaries", "");
  }
}

function WebSlider_MoveRight()
{
  try
  {
    oSrc = window.event.srcElement;
    var oWebSlider = oSrc.oWebSlider;

    oWebSlider.PrepareElement();
    oWebSlider.MoveTo(
      parseInt(oWebSlider.SliderMiddle.style.left) + (oWebSlider.BoundaryRight - oWebSlider.BoundaryLeft)*0.1, 
      parseInt(oWebSlider.SliderMiddle.style.top));
    oWebSlider.RestoreElement();
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebSlider_MoveRight", "");
  }
}

function WebSlider_MoveLeft()
{
  try
  {
    oSrc = window.event.srcElement;
    var oWebSlider = oSrc.oWebSlider;

    oWebSlider.PrepareElement();
    oWebSlider.MoveTo(
      parseInt(oWebSlider.SliderMiddle.style.left) - (oWebSlider.BoundaryRight - oWebSlider.BoundaryLeft)*0.1, 
      parseInt(oWebSlider.SliderMiddle.style.top));
    oWebSlider.RestoreElement();
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebSlider_MoveLeft", "");
  }
}

function WebSlider_PrepareElement()
{
  try
  {
    this.SliderMiddle.style.marginLeft = 0;
    this.SliderMiddle.style.position = "absolute";
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebSlider_PrepareElement", "");
  }
}

function WebSlider_RestoreElement()
{
  try
  {
    this.SliderMiddle.style.marginLeft = this.SliderMiddle.style.left;
    this.SliderMiddle.style.position = "static";
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebSlider_RestoreElement", "");
  }
}

function WebSlider_Hide()
{
  try
  {
    /*
    this.Container.style.visibility = "hidden";
    this.Container.runtimeStyle.visibility = "hidden";
    */
    Ilp.HtmlDom.SetStyle(this.Container, "visibility", "hidden");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebSlider_Hide", "");
  }
}

function WebSlider_Show()
{
  try
  {
    /*
    this.Container.style.visibility = "visible";
    this.Container.runtimeStyle.visibility = "visible";
    */
    Ilp.HtmlDom.SetStyle(this.Container, "visibility", "visible");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebSlider_Show", "");
  }
}


function WebSlider_MoveTo(iNewX, iNewY)
{
  try
  {
    iNewX = parseInt(iNewX);
    iNewY = parseInt(iNewY);

    if (isNaN(iNewX) && isNaN(iNewY)) return false;
    
    //  Call MoveElement to move the piece
    this.MoveElement(iNewX, iNewY);
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebSlider_MoveTo", "");
  }
}


function WebSlider_MoveElement(iNewX, iNewY)
{
  try
  {
    if (this.Direction != "vertical" && iNewX != null)
    {
      //
      //  Otherwise, if the piece has just a boundary, then it needs to be
      //  enforced.  If the piece is outside the boundaries, put it inside
      //
      if (this.BoundaryLeft != null
          && iNewX < this.BoundaryLeft)
      {
          iNewX = this.BoundaryLeft;
      }
      else if (this.BoundaryRight != null
          && iNewX > this.BoundaryRight - this.SliderMiddle.offsetWidth)
      {
          iNewX = this.BoundaryRight - this.SliderMiddle.offsetWidth;
      }

      //  Put the piece in it's (possibly adjusted) position
      this.SliderMiddle.style.left = iNewX;
    }

    if (this.Direction != "horizontal" && iNewY != null)
    {
      //
      //  Otherwise, if the piece has just a boundary, then it needs to be
      //  enforced.  If the piece is outside the boundaries, put it inside
      //
      if (this.BoundaryTop != null
          && iNewY < this.BoundaryTop)
      {
          iNewY = this.BoundaryTop;
      }
      else if (this.BoundaryBottom != null
          && iNewY > this.BoundaryBottom - this.SliderMiddle.offsetHeight)
      {
          iNewY = this.BoundaryBottom - this.SliderMiddle.offsetHeight;
      }

      //  Put the piece in it's (possibly adjusted) position
      this.SliderMiddle.style.top = iNewY;
    }
    
    this.PercentMoved = 100 / (this.BoundaryRight - this.BoundaryLeft - this.SliderMiddle.offsetWidth) 
  	  * (parseInt(this.SliderMiddle.style.left) - this.BoundaryLeft);
    
    if (this.OnMovedHandler)
    {
      var args = new EventArgs();
	    this.OnMovedHandler(this.SliderMiddle, args);
	  }  
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebSlider_MoveElement", "");
  }
}


function WebSlider_DoMouseDown()
{
  try
  {
    oSrc = window.event.srcElement;
    var oWebSlider = oSrc.oWebSlider;
    
    oWebSlider.PrepareElement();
    
    //  Capture the mouse
    oWebSlider.SliderMiddle.setCapture();
    
    //  Set the zIndex to 1000 to put it over other elements while it's moved
	  oWebSlider.SliderMiddle.style.zIndex = 1000;

    //
    //  Determine the difference between the mouse click on the element and
    //  the top left corner	
    //
	  oWebSlider.OffsetX = window.event.clientX - WebControl.GetAbsoluteLeft(oWebSlider.SliderMiddle);
	  oWebSlider.OffsetY = window.event.clientY - WebControl.GetAbsoluteTop(oWebSlider.SliderMiddle);

    //  Start tracking the mousemove
	  oWebSlider.SliderMiddle.onmousemove = oWebSlider.DoMouseMove;
	  if (oWebSlider.OnDragStartHandler)
	  {
	    var args = new EventArgs();
	    oWebSlider.OnDragStartHandler(oSrc, args);
	  }
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebSlider_DoMouseDown", "");
  }
}	


function WebSlider_DoMouseMove()
{
  try
  {
    // this ist in diesem Fall durch den setCapture()-Aufruf oWebSlider.SliderMiddle
    oSrc = this;
    var oWebSlider = oSrc.oWebSlider;
    if (oWebSlider == null)
    {
      var x = 1;
    }
	  if (oWebSlider.Direction != "vertical") 
	  {
	    //  Set position based on mouse movement
	    var iNewX = window.event.clientX - WebControl.GetAbsoluteLeft(oWebSlider.SliderArea) - oWebSlider.OffsetX;
      
      //  Obey left boundary
	    if (oWebSlider.BoundaryLeft != null
	        && iNewX < oWebSlider.BoundaryLeft)
	    {
	        iNewX = oWebSlider.BoundaryLeft;
	    }
      
	    //  Obey right boundary
	    if (oWebSlider.BoundaryRight != null
	        && iNewX > oWebSlider.BoundaryRight - oWebSlider.SliderMiddle.offsetWidth)
	    {
	        iNewX = oWebSlider.BoundaryRight - oWebSlider.SliderMiddle.offsetWidth;
	    }

      //  Place element
	    oWebSlider.SliderMiddle.style.left = iNewX;
	  }

	  if (oWebSlider.Direction != "horizontal")
	  {
	    //  Set position based on mouse movement
	    var iNewY = window.event.clientY - WebControl.GetAbsoluteTop(oWebSlider.SliderArea) - oWebSlider.OffsetY;
      
	    //  Obey top boundary
	    if (oWebSlider.BoundaryTop != null 
	        && iNewY < oWebSlider.BoundaryTop)
	    {
	        iNewY = oWebSlider.BoundaryTop;
	    }
      
	    //  Obey bottom boundary
	    if (oWebSlider.BoundaryBottom != null 
	        && iNewY > oWebSlider.BoundaryBottom - oWebSlider.SliderMiddle.offsetHeight)
	    {
	        iNewY = oWebSlider.BoundaryBottom - oWebSlider.SliderMiddle.offsetHeight;
	    }
      
	    //  Place element
	    oWebSlider.SliderMiddle.style.top = iNewY;
	  }
    
    oWebSlider.PercentMoved = 100 / (oWebSlider.BoundaryRight - oWebSlider.BoundaryLeft - oWebSlider.SliderMiddle.offsetWidth) 
  	  * (parseInt(oWebSlider.SliderMiddle.style.left) - oWebSlider.BoundaryLeft);
    
	  if (oWebSlider.OnMovedHandler)
	  {
	    var args = new EventArgs();
	    oWebSlider.OnMovedHandler(oSrc, args);
	  }  
	  if (oWebSlider.OnDragHandler)
	  {
	    var args = new EventArgs();
	    oWebSlider.OnDragHandler(oSrc, args);
	  }
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebSlider_DoMouseMove", "");
  }
}


function WebSlider_DoMouseUp()
{
  try
  {
    // this ist in diesem Fall durch den setCapture()-Aufruf oWebSlider.SliderMiddle
    oSrc = this;
    var oWebSlider = oSrc.oWebSlider;

    //  Return the zIndex to its previous value
	  oWebSlider.SliderMiddle.style.zIndex = oWebSlider.SliderMiddleZindex;

    oWebSlider.SliderMiddle.onmousemove = null;

	  //  Release the mouse
	  oWebSlider.SliderMiddle.releaseCapture();

	  if (oWebSlider.OnDragEndHandler)
	  {
	    var args = new EventArgs();
	    oWebSlider.OnDragEndHandler(oSrc, args);
	  }
    oWebSlider.RestoreElement()
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "WebSlider_DoMouseUp", "");
  }
}



/* ============================ GTWebPopUp.js ===========================*/
function WebPopUp(popUpContainer)
{
  try
  {
    EnsureWebForm();
    this.Container = popUpContainer;  
    this.Container.JsInstance = this;
    this.ClassType = "WebPopUp";
    
    this.Loaded = false;
    
    this.Show = WebPopUp_Show;
    this.Hide = WebPopUp_Hide;   
    this.MaxWidth = 350;   
    
    this.OnClick = WebPopUp_OnClick;
    
    this.Container.onclick = this.OnClick;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebPopUp", "");
  }
}

function WebPopUp_OnClick(sender, src) 
{
  try
  {
    // Der Event wird vom sender "behandelt", sprich der fängt ihn ab
    // Der Event wird von src ausgelöst, z.B. durch einen click.
    sender = Ilp.Event.GetSender(sender, src, this);
    src = Ilp.Event.GetSrc(sender, src);
    
    if (Ilp.HtmlDom.GetAttribute(WebForm.WebPopUp.Container, "tagName", "") == "IFRAME")
    {
      src = WebForm.WebPopUp.Container.contentWindow.event.srcElement;
    }

    switch(src.getAttribute("LabelType"))
    {
      case "PopUpClose":
        WebForm.WebPopUp.Hide();
        Ilp.Event.Cancel(sender);
        break;
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebPopUp_OnClick", "");
  }
}

function WebPopUp_Show(sender, text, html) 
{
  try
  {
    WebForm.WebPopUp = this;
  
    if (this.Container)
    {   
      Ilp.HtmlDom.SetStyle(this.Container, "position", "absolute");
      Ilp.HtmlDom.SetStyle(this.Container, "zIndex", 1000);
			
			var iWebPopUp = new IWebPopUpClass(sender);
  	  
      Ilp.HtmlDom.SetStyle(this.Container, "width", iWebPopUp.WebPopUpWidth);
  	  this.Behavior = iWebPopUp.WebPopUpBehavior;
  	  
	    if (html == null && text == null)
	    {
			  text = WebData.GetFieldValue(sender.oRecord, iWebPopUp.WebPopUpFqn);
			  if( text == null) text = "";
			}

      if (this.Behavior == enum_WebPopUpBehavior_OnClick
        || this.Behavior == enum_WebPopUpBehavior_OnMouseOver)
      {
        var html1 = "";
        var width = parseInt(iWebPopUp.WebPopUpWidth) - 4 + "px";
        var height = parseInt(iWebPopUp.WebPopUpHeight) + "px";
        var style = "style='width:" + width + "; height:" + height + "'";
        
        var htmlTag = "DIV";
        if (iWebPopUp.WebPopUpLayout == "Div") htmlTag = "DIV";
        else if (iWebPopUp.WebPopUpLayout == "TextArea") htmlTag = "TEXTAREA";
        else if (iWebPopUp.WebPopUpLayout == "Samp") htmlTag = "SAMP";
        else if (iWebPopUp.WebPopUpLayout == "Pre") htmlTag = "PRE";
        
        html1 = "";
        if (html != null)
        {
          html1 +=  "<DIV class='PopUpClose' LabelType='PopUpClose'>X " + ids_Close + "</DIV>";
          html1 +=  "<DIV class='PopUpCaption'>" + iWebPopUp.WebPopUpCaption + "</DIV>";
          if (iWebPopUp.WebPopUpLayout == "TextArea")
          {
			      if (Ilp.HtmlDom.GetAttribute(this.Container, "tagName", "") == "IFRAME")
			      {
              html1 += "<-HtmlTag- id='PopUpContentTextArea' class='PopUpContentTextArea'>" + html + "</-HtmlTag->";
            }
            else
            {
              html1 += "<div id='PopUpContentTextAreaDiv' " + style + " class='PopUpContentTextAreaDiv'>";
              html1 += "<-HtmlTag- id='PopUpContentTextArea' class='PopUpContentTextArea'>" + html + "</-HtmlTag->";
              html1 += "</div>";
            }  
          }
          else
          {
            html1 += "<-HtmlTag- id='PopUpContentTextArea' class='PopUpContent'>" + html + "</-HtmlTag->";
          }
        }
        else
        {
          html1 +=  "<DIV class='PopUpClose' LabelType='PopUpClose'>X " + ids_Close + "</DIV>";
          html1 +=  "<DIV class='PopUpCaption'>" + iWebPopUp.WebPopUpCaption + "</DIV>";
          if (iWebPopUp.WebPopUpLayout == "TextArea")
          {
			      if (Ilp.HtmlDom.GetAttribute(this.Container, "tagName", "") == "IFRAME")
			      {
              html1 += "<-HtmlTag- id='PopUpContentTextArea' class='PopUpContentTextArea'>" + text + "</-HtmlTag->";
            }
            else
            {
              html1 += "<div id='PopUpContentTextAreaDiv' " + style + " class='PopUpContentTextAreaDiv'>";
              html1 += "<-HtmlTag- id='PopUpContentTextArea' class='PopUpContentTextArea'>" + text + "</-HtmlTag->";
              html1 += "</div>";
            }
          }
          else
          {
            html1 += "<-HtmlTag- id='PopUpContentTextArea' class='PopUpContent'>" + text + "</-HtmlTag->";
          }
        }
        text = null;
        var regex = /-HtmlTag-/img;
        html = html1.replace(regex, htmlTag);
      }
			
			if ((text && text.length > 0) || (html && html.length > 0))
			{
			  if (1==1)
			  {
			    if (Ilp.HtmlDom.GetAttribute(this.Container, "tagName", "") == "IFRAME")
			    {
			      var doc = this.Container.contentWindow.document;
			      
  	        WebControl.CopyStyleSheets(document, doc);
			      
			      var oDiv = doc.getElementById(this.Container.id);
			      if (oDiv == null)
			      {
			        var oDiv = doc.createElement("div");
			        oDiv.className = "HtmlGenericControlSimple_WebPopUp";
			        oDiv.id = this.Container.id;
			        
              doc.body.appendChild(oDiv);

              oDiv.onclick = WebForm.WebPopUp.OnClick;
      				oDiv.style.display = "block";
            }

			      if (text) Ilp.HtmlDom.SetText(oDiv, text);
			      else oDiv.innerHTML = html;
			    }
			    else
			    {
			      var doc = document;

			      if (text) Ilp.HtmlDom.SetText(this.Container, text);
			      else this.Container.innerHTML = html;
			    }
          if (iWebPopUp.WebPopUpLayout == "TextArea")
          {
			      var oTextArea = doc.getElementById("PopUpContentTextArea");
			      if (oTextArea) Ilp.Util.AdjustTextArea(oTextArea);
			    }
			  }
			  else
			  {
          var senderScreenObject = new ScreenObject(
            sender,
            WebControl.GetAbsoluteTop(sender, null, document.body),
            WebControl.GetAbsoluteLeft(sender, null, document.body),
            WebControl.GetOuterDimension(sender, "width"),
            WebControl.GetOuterDimension(sender, "height"));
            
          Ilp.HtmlDom.SetText(this.Container, "Element position (top,left,width,height): " + senderScreenObject.ToString2());
			  }
			  
				this.Container.style.display = "block";
				/*
        Ilp.HtmlDom.SetStyle(this.Container, "display", "block");
        */
  
        Ilp.HtmlDom.SetStyle(this.Container, "position", "absolute");
        var region = Ilp.HtmlDom.GetRegion(sender);
	      WebControl.PositionControl2(this.Container, sender, 5);
			}
			else
			{
        Ilp.HtmlDom.SetStyle(this.Container, "display", "none");
			}
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebPopUp_Show", "");
  }
}

function WebPopUp_Hide() 
{
  try
  {
    if (Ilp.HtmlDom.GetAttribute(WebForm.WebPopUp.Container, "tagName", "") == "IFRAME")
    {
      WebForm.WebPopUp.Container.style.display = "none";
    }
    else
    {
      if (this.Container && window.event.srcElement != this.Container)
      {   
        this.Container.style.display = "none";
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebPopUp_Hide", "");
  }
}

/* ============================ GTCalendar.js ===========================*/
gDay = 0;
gMonth = 0;
gYear = 0;

var activeDate = new Date();

calendarType = "";
activeCal = "";
backgroundColorSave = "";

function getNow()
{
  try{
	  var now = new Date();
	  var Monat = now.getMonth();
	  var Monatname = "";
	  var Jahr = now.getYear();
	  if (Jahr < 2000) Jahr+=1900;
	  var Erster = new Date(Jahr,Monat,1);
	  activeDate = now;
	  update(Monat, Jahr, Erster);
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "getNow", "Section1")
  }
}

function setCalendar(strDate, language)
{
  try{
    var dateregex = "";
    var match = null;
	  var now = new Date();
    var Monat = now.getMonth();
    var Jahr = now.getYear();
	  if (Jahr < 2000) Jahr+=1900;
	  Tag = now.getDay();
    
    if (language=="d" || language=="de-DE" || Language=="f" || Language=="fr-FR")
    {
      dateregex=/^[ ]*[0]?(\d{1,2})\.(\d{1,2})\.(\d{4,})[ ]*$/;
      if(strDate.length>0){
        match = strDate.match(dateregex);
        Monat = match[2]*1-1;
        Jahr = match[3]*1;
        Tag = match[1]*1;
      }
    }
    else
    {
      dateregex=/^[ ]*[0]?(\d{1,2})\/(\d{1,2})\/(\d{4,})[ ]*$/;
      if(strDate.length>0){
        match = strDate.match(dateregex);
        Monat = match[1]*1-1;
        Jahr = match[3]*1;
        Tag = match[2]*1;
      }  
    }

	  var Erster = new Date(Jahr,Monat,1);
	  
    if(strDate.length>0){
      activeDate = new Date(Jahr, Monat, Tag);
  	  update(Monat, Jahr, Erster);
  	}
  	else{
  	  getNow();
  	}  
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "setCalendar", "Section1")
  }
}

function nextMonth()
{
  try{
	  mydate = new Date(gYear*1, gMonth*1, 1);
	  update(mydate.getMonth(), mydate.getYear(), mydate);
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "nextMonth", "Section1")
  }
}

function prevMonth()
{
  try{
	  mydate = new Date(gYear*1, gMonth*1-2, 1);
	  update(mydate.getMonth(), mydate.getYear(), mydate);
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "prevMonth", "Section1")
  }
}



function nextYear()
{
  try{
	  mydate = new Date(gYear*1+1, gMonth*1-1, 1);
	  update(mydate.getMonth(), mydate.getYear(), mydate);
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "nextYear", "Section1")
  }
}

function prevYear()
{
  try{
	  mydate = new Date(gYear*1-1, gMonth*1-1, 1);
	  update(mydate.getMonth(), mydate.getYear(), mydate);
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "prevYear", "Section1")
  }
}

function update(Monat, Jahr, Erster)
{
  try{
    var calendarDocument = document;

    clearCalender();

    if (Monat==0) Monatname="Jan.";
    if (Monat==1) Monatname="Feb.";
    if (Monat==2) Monatname="Mar.";
    if (Monat==3) Monatname="Apr.";
    if (Monat==4) Monatname="Mai";
    if (Monat==5) Monatname="Jun.";
    if (Monat==6) Monatname="Jul.";
    if (Monat==7) Monatname="Aug.";
    if (Monat==8) Monatname="Sep.";
    if (Monat==9) Monatname="Okt.";
    if (Monat==10) Monatname="Nov.";
    if (Monat==11) Monatname="Dez.";
    
    Ilp.HtmlDom.SetText(calendarDocument.getElementById("year"), Jahr);
    Ilp.HtmlDom.SetText(calendarDocument.getElementById("mj"), Monatname/* + " " + Jahr*/);
      
    offX = 0;
    offY = 0;
    
    // Verschiebung Sonntag berücksichtigen (So = day 0)
    add = Erster.getDay() - 1;
    if (add == -1) add = 6;
    
    offX += add;
    
    i=0
    while (i<=31)
    {
      i++;
      Heute = new Date(Jahr,Monat,i)
      if (Heute.getMonth()!=Monat){break;}
      if (i<=9){i="0"+i}

      target = calendarDocument.getElementById("g"+offY+"."+offX);
      Ilp.HtmlDom.SetText(target, String(i));
      target.onmouseover = Calendar_OnMouseOver;
      target.onmouseout = Calendar_OnMouseOut;
      target.onclick = Calendar_OnClick;
      
      if (i*1 == activeDate.getDate()*1 && activeDate.getMonth() == Monat && activeDate.getYear() == Jahr) 
      {
        target.style.backgroundColor = "silver";
      }  

      today = new Date();
      if (i*1 == today.getDate()*1 && today.getMonth() == Monat && today.getYear() == Jahr) 
      {
        target.style.backgroundColor = "red";
      }  
      
      offX++;
      if (offX > 6)
      {
    	  offX = 0;
    	  offY++;
      }
    }
    
    gDay = 1;
    gMonth = Monat+1;
    if (gMonth < 10) gMonth = "0"+gMonth;
    gYear = Jahr;
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "update", "Section1")
  }
}

function clearCalender()
{	
  try{
    var calendarDocument = document;
	  for (j=0; j<=5; j++)
	  {
		  for (i=0; i<=6; i++)
		  {
			  target = calendarDocument.getElementById("g"+j+"."+i);
			  Ilp.HtmlDom.SetText(target, " ");
			  target.style.border = "";
        target.style.backgroundColor = "white";
			  target.onmouseover = "";
			  target.onmouseout = "";
			  target.onclick = "";
  				
		  }
	  }	
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "clearCalender", "Section1")
  }
}

function Calendar_OnMouseOver()
{
  try{
    backgroundColorSave = event.srcElement.style.backgroundColor;
  	event.srcElement.style.backgroundColor = "#ff0000";
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "Calendar_OnMouseOver", "Section1")
  }
}

function Calendar_OnMouseOut()
{
  try{
    if (backgroundColorSave!=""){
      event.srcElement.style.backgroundColor = backgroundColorSave;
    }
    else{
  	  event.srcElement.style.backgroundColor = "#ffffff";
  	}  
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "Calendar_OnMouseOut", "Section1")
  }
}

function Calendar_OnClick()
{
  try
  {
    EnsureWebControl();
	  gDay = Ilp.HtmlDom.GetText(event.srcElement);
	  if (calendarType=="Grid"){
	    parent.GridUpdateDataCell(activeCal);
	  }
	  else if (calendarType=="Search"){
	    parent.SearchUpdateCell(activeCal);
	  }
	  else if (calendarType=="AppStatistic"){
	    parent.AppStatisticUpdateCell(activeCal);
	  }
	  else if (calendarType=="WebDataSearchContainer"){
	    parent.WebControl.UpdateCalendarInput(activeCal);
	  }
	  else if (calendarType=="WebDataSheetContainer"){
	    parent.WebControl.UpdateCalendarInput(activeCal);
	  }
	  else if (calendarType=="WebDataGridContainer"){
	    parent.WebControl.UpdateCalendarInput(activeCal);
	  }
	  else
	  {
	    if (Language=="d" || Language=="de-DE" || Language=="f" || Language=="fr-FR")
	    {
	      parent.document.getElementById(activeCal).value = gDay + "." + gMonth + "." + gYear;
	    }
	    else
	    {
	      parent.document.getElementById(activeCal).value = gMonth + "/" + gDay + "/" + gYear;
	    }
    }	
    
    HideCalendar()
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "Calendar_OnClick", "Section1")
  }
}

function HideCalendar(){
  try{
    var oCalendarContainer = parent.document.getElementById("CalendarContainer");
    if (oCalendarContainer!=null){
      if (oCalendarContainer.style.visibility=="visible"){
        oCalendarContainer.style.visibility=="hidden";
        oCalendarContainer.style.display = "none";
      }
    }
  }
  catch (exception){
    WebMessage.SendClientLog(exception, "HideCalendar", "Section1")
  }  
}

function GetCalendarFrame()
{
  try
  {
    var calendarFrame;
    //calendarFrame = document.parentWindow.parent.frames["MainFrame"].document.frames["CalendarContainer"];
    //calendarFrame = top.frames["MainFrame"].document.frames["CalendarContainer"];      
    calendarFrame = document.frames["CalendarContainer"];
    
    return calendarFrame;
  }
  catch (exception){
    WebMessage.SendClientLog(exception, "GetCalendarFrame", "Section1")
  }  
}

function ShowCalendarStart(sender)
{
	try{	
    if (sender != null){
      sender.disabled = true;
    }  

    var calendarFrame = GetCalendarFrame();
    if (calendarFrame != null){
     
      EnsureWebControl();
      calendarFrame.calendarType = "";
      if (typeof(sender.oWebDataSearch) == "object")
      {
        calendarFrame.calendarType = "WebDataSearchContainer";
      }
      else if (typeof(sender.oWebDataSheet) == "object")
      {
        calendarFrame.calendarType = "WebDataSheetContainer";
      }
      else if (typeof(sender.oWebDataGrid) == "object")
      {
        calendarFrame.calendarType = "WebDataGridContainer";
      }
      else
      {
        calendarFrame.calendarType = "WebDataSheetContainer";
      }
      
      if (calendarFrame.calendarType.length > 0)
      {
        calendarFrame.activeCal = sender;
        
        if (sender.value == "" || sender.value == null)
        {
          calendarFrame.getNow();
        }
        else
        {
          if (WebControl.CheckDate(sender.value) == true)
          {
            var d = WebControl.ConvertDateStringToDate(sender.value);
            calendarFrame.setCalendar(WebControl.ConvertUTCDateToShortDate(d.toUTCString()), Language);
          }
          else
          {
            calendarFrame.getNow();
          }     
        }
        //ShowCalendar(WebControl.GetAbsoluteTop(sender) + 15, WebControl.GetAbsoluteLeft(sender) + 25);
        ShowCalendar(sender);
      }
    }

    if (sender != null)
    {
      sender.disabled = false;
    }  
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "ShowCalendarStart", "Section1")
  }
}

function ShowCalendar(sender)
{
	try
	{	
    var oCalendarContainer = document.getElementById("CalendarContainer");

	  var oBody = window.document.body;
    
    var calendarFrame = GetCalendarFrame();
    calendarFrame.scrolling = "no";
	  var oBodyCalendar = calendarFrame.document.body;
	  var oDivCalendar = calendarFrame.document.getElementById("divCalendarContainer");
	  oBodyCalendar.style.posWidth = oDivCalendar.style.posWidth;
    
    
    oCalendarContainer.style.display = "block";
    oCalendarContainer.style.visibility = "visible";
    
    if (oBodyCalendar.scrollHeight + (oBodyCalendar.offsetHeight - oBodyCalendar.clientHeight)>0){
	    oCalendarContainer.style.height = oBodyCalendar.scrollHeight + (oBodyCalendar.offsetHeight - oBodyCalendar.clientHeight);
	  }
	  oCalendarContainer.style.width = oDivCalendar.offsetWidth + 2;
    
    WebControl.PositionControl2(oCalendarContainer, sender, 10);   
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "ShowCalendar", "Section1")
  }
}




/* ============================ GTWebStatusBar.js ===========================*/
function WebStatusBarClass(statusBarContainer)
{
  try
  { 
    this.StatusBar = statusBarContainer;
    this.Panels = new Array();

    if (this.StatusBar == null)
    {
      if (parent.frames["TopFrame"])
      {
        this.StatusBar = parent.frames["TopFrame"].document.getElementById("StatusbarContainer");
        if (this.StatusBar == null)
        {
				  this.StatusBar = parent.frames["TopFrame"].document.getElementById("phc_StatusbarContainer");
        }
      }
      else if (parent.parent.frames["TopFrame"])
      {
        this.StatusBar = parent.parent.frames["TopFrame"].document.getElementById("StatusbarContainer");
        if (this.StatusBar == null)
        {
				  this.StatusBar = parent.parent.frames["TopFrame"].document.getElementById("phc_StatusbarContainer");
        }
      }
      else
      {  
        this.StatusBar = document.getElementById("PageHeaderComposition_StatusbarContainer");
        if (this.StatusBar == null)
        {
				  this.StatusBar = document.getElementById("phc_StatusbarContainer");
        }
        if (this.StatusBar == null)
        {
			    this.StatusBar = parent.document.getElementById("phc_StatusbarContainer");
        }
        if (this.StatusBar == null)
        {
			    this.StatusBar = parent.document.getElementById("PageHeader_StatusbarContainer");
        }
      }
    }
    
    if (this.StatusBar != null)
    {
      this.Container = this.StatusBar;
      this.Container.JsInstance = this;
      this.ObjectID = this.Container.id;
      this.ClientID = this.Container.id;
      this.ClassType = "WebStatusBarClass";
    
      if (this.StatusBar.tagName == "DIV")
      {
        var panelDivs = this.StatusBar.getElementsByTagName("DIV");
        for(i = 0; i < panelDivs.length; i++)
        {
          this.Panels[this.Panels.length] = panelDivs[i];
        }
      }
      else
      {
        var row = this.StatusBar.rows.item(0);
        for(i = 0; i < row.cells.length; i++)
        {
          this.Panels[this.Panels.length] = row.cells[i];
        }
      }
      
      this.ShowDataChangedMessage = true;
      this.ShowDataSavedMessage = true;
      this.InitStatusbar();
      
    }  
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebStatusBarClass", "");
  }
}

WebStatusBarClass.prototype.InitStatusbar = function(panelMessage, panelIndex) 
{
  try
  {
    for(i = 0; i < this.Panels.length; i++)
    {
      Ilp.HtmlDom.SetStyle(this.Panels[i], "backgroundColor", "White");
      this.Panels[i].innerHTML = "";
      this.Panels[i].IsProtected = false;
    }
    if (this.Panels.length > 0)
    {  
      this.Panels[0].innerHTML = ids_Ready;
    }  
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebStatusBarClass.prototype.InitStatusbar", "");
  }
}

WebStatusBarClass.prototype.SetStatusbarMessage = function(panelMessage, panelIndex, backgroundColor) 
{
  try
  {
    if (this.Panels[panelIndex] != null)
    {
      Ilp.HtmlDom.SetStyle(this.Panels[panelIndex], "color", "Black");
      if (backgroundColor != null) Ilp.HtmlDom.SetStyle(this.Panels[panelIndex], "backgroundColor", backgroundColor);
      this.Panels[panelIndex].innerHTML = panelMessage;
    }  
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebStatusBarClass.prototype.SetStatusbarMessage", "");
  }
}

WebStatusBarClass.prototype.SetDataChangedMessage = function(panelMessage, panelIndex)
{
  try
  {
    if (this.ShowDataChangedMessage == true)
    {
			if (this.Panels[panelIndex] != null)
			{
        Ilp.HtmlDom.SetStyle(this.Panels[panelIndex], "backgroundColor", "Red");
				this.Panels[panelIndex].innerHTML = panelMessage;
			}  
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebStatusBarClass.prototype.SetDataChangedMessage", "");
  }
}

WebStatusBarClass.prototype.SetDataSavedMessage = function(panelMessage, panelIndex)
{
  try
  {
    if (this.ShowDataSavedMessage == true)
    {
      if (this.Panels[panelIndex] != null)
      {
        Ilp.HtmlDom.SetStyle(this.Panels[panelIndex], "backgroundColor", "Green");
        Ilp.HtmlDom.SetStyle(this.Panels[panelIndex], "color", "White");
        this.Panels[panelIndex].innerHTML = panelMessage;
      }  
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebStatusBarClass.prototype.SetDataSavedMessage", "");
  }
}

WebStatusBarClass.prototype.SetProtected = function(panelIndex, isProtected)
{
  try
  {
    if (this.Panels[panelIndex] != null)
    {
      this.Panels[panelIndex].IsProtected = isProtected
    }  
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebStatusBarClass.prototype.SetProtected", "");
  }
}

WebStatusBarClass.prototype.SetDataInitMessage = function(panelMessage, panelIndex)
{
  try
  {
    if (this.Panels[panelIndex] != null)
    {
      if (this.Panels[panelIndex].IsProtected == false)
      {
        Ilp.HtmlDom.SetStyle(this.Panels[panelIndex], "backgroundColor", "White");
        Ilp.HtmlDom.SetStyle(this.Panels[panelIndex], "color", "Black");
        this.Panels[panelIndex].innerHTML = panelMessage;
      }
    }  
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebStatusBarClass.prototype.SetDataInitMessage", "");
  }
}


/* ============================ GTCache.js ===========================*/
var aXMLDocument = new Array();
var nXMLDocumentIndex = 0;

function XMLReadyStateChangeHandler()
{
  try
  {
    var oXMLObject = window.event.srcElement;
    var sXMLSourceID = "";
    var sXSLSourceID = "";

    if (oXMLObject.readyState == 'complete')
    {
      oXMLObject.setAttribute("Complete", "1");

      sXMLSourceID = oXMLObject.getAttribute("XMLSourceID");
      sXSLSourceID = oXMLObject.getAttribute("XSLSourceID");

      if (sXMLSourceID!="" && sXSLSourceID!="")
      {
        var oXML = document.getElementById(oXMLObject.getAttribute("XMLSourceID"));
        var oXSL = document.getElementById(oXMLObject.getAttribute("XSLSourceID"));

        if (oXML!=null && oXSL!=null)
        {
          if (oXML.getAttribute("Complete")==1 && oXSL.getAttribute("Complete")==1)
          {

            aXMLDocument[aXMLDocument.length] = new Object();
            //aXMLDocument[aXMLDocument.length-1].Loading = true;
            aXMLDocument[aXMLDocument.length-1].Complete = true;
            aXMLDocument[aXMLDocument.length-1].Ready = false;
            aXMLDocument[aXMLDocument.length-1].Handled = false;
            aXMLDocument[aXMLDocument.length-1].XMLDocumentIndex = aXMLDocument.length-1;
            aXMLDocument[aXMLDocument.length-1].TargetFrameID = oXML.getAttribute("TargetFrameID");
            aXMLDocument[aXMLDocument.length-1].HTMLTargetID = oXML.getAttribute("HTMLTargetID");
            aXMLDocument[aXMLDocument.length-1].XMLSourceID = oXML.getAttribute("XMLSourceID");
            aXMLDocument[aXMLDocument.length-1].XSLSourceID = oXML.getAttribute("XSLSourceID");
            aXMLDocument[aXMLDocument.length-1].XMLID = oXML.getAttribute("id");
            aXMLDocument[aXMLDocument.length-1].oXML = oXML;
            aXMLDocument[aXMLDocument.length-1].oXSL = oXSL;
            aXMLDocument[aXMLDocument.length-1].oXMLDocument = oXML.XMLDocument;
            oXML.setAttribute("XMLDocumentIndex", aXMLDocument.length-1);
          }
        }  
      }  
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "XMLReadyStateChangeHandler: " + oXMLObject.readyState, "Section1")
  } 
}

function ProcessCache()
{
  try
  {
    if (aXMLDocument.length>0)
    {
      for (var i=0; i<aXMLDocument.length; i++)
      {
        if (aXMLDocument[i].Complete==false)
        {
          break;
        }
      }
      if (i < aXMLDocument.length)
      {
        alert("Not yet loaded. (" + String(i) + ", " + aXMLDocument[i].XMLSourceID + ", " + String(aXMLDocument.length) + ")");
      }

      for (var i=0; i<aXMLDocument.length; i++)
      {
        if (aXMLDocument[i].Complete == true)
        {
          var oXML = aXMLDocument[i].oXML;
          var oXSL = aXMLDocument[i].oXSL;
          var result = "";

          if (Ilp.XmlDom.HasParseError(oXML.XMLDocument) == true)
          {
            result = Ilp.XmlDom.GetParseErrorText(oXML.XMLDocument);
            WebMessage.SendClientLog(null, "ProcessCache", "(1), " + result);
          }  
          else
          {
            if (Ilp.XmlDom.HasParseError(oXSL.XMLDocument) == true)
            {
              result = Ilp.XmlDom.GetParseErrorText(oXSL.XMLDocument);
              WebMessage.SendClientLog(null, "ProcessCache", "(2), " + result);
            }  
            else
            {
              try 
              {
                result = oXML.XMLDocument.transformNode(oXSL.XMLDocument);
              }
              catch (exception)
              {
                WebMessage.SendClientLog(exception, "ProcessCache", "(3), " + i);
              }
            }
          }

          aXMLDocument[i].innerHTML = result;
          aXMLDocument[i].Ready = true;

          RenderXMLDocument(aXMLDocument[i]);
          
        }
      }
    }  
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "ProcessCache", "Section1")
  }
}

function RenderXMLDocument(oXMLDocument)
{
  try
  {

    var bContinue = false;
    var oXMLContainer = null;
    
    if (oXMLDocument.Ready == true)
    {
      if (oXMLDocument.Handled == false)
      {
        if (parent.frames[oXMLDocument.TargetFrameID])
        {
          if (parent.frames[oXMLDocument.TargetFrameID].document)
          {
            if (oXMLDocument.HTMLTargetID=="")
            {
              var oDiv = parent.frames[oXMLDocument.TargetFrameID].document.createElement("DIV");
              oDiv.style.display = "block";
              oDiv.id = "magic";
              parent.frames[oXMLDocument.TargetFrameID].document.body.appendChild(oDiv);
              oXMLContainer = oDiv;
            }
            else
            {
              oXMLContainer = parent.frames[oXMLDocument.TargetFrameID].document.getElementById(oXMLDocument.HTMLTargetID);
              if (oXMLContainer==null)
              {
                oXMLContainer = document.getElementById(oXMLDocument.HTMLTargetID);
              }              
              if (oXMLContainer==null)
              {
                var oDiv = parent.frames[oXMLDocument.TargetFrameID].document.createElement("DIV");
                oDiv.style.display = "none";
                oDiv.id = oXMLDocument.HTMLTargetID;
                parent.frames[oXMLDocument.TargetFrameID].document.body.appendChild(oDiv);
                oXMLContainer = oDiv;
              }
            }  
            bContinue = true;
          }
          else
          {
            WebMessage.SendClientLog(exception, "RenderXMLDocument", oXMLDocument.TargetFrameID + " (1): " + oXMLDocument.HTMLTargetID + " von " + aXMLDocument.length)
          }  
        }
        else
        {
          oXMLContainer = document.getElementById[oXMLDocument.HTMLTargetID];
          if (oXMLDocument.HTMLTargetID != "")
          {
            if (oXMLContainer == null)
            {
              var oDiv = document.createElement("DIV");
              oDiv.style.display = "none";
              oDiv.id = oXMLDocument.HTMLTargetID;
              document.body.appendChild(oDiv);
              oXMLContainer = oDiv;
            }
          }  
          bContinue = true;
        }  
        
        if (bContinue==true)
        {
          if (oXMLContainer==null)
          {
            //WebMessage.SendClientLog(exception, "RenderXMLDocument", oXMLDocument.HTMLTargetID + " (0): " + oXMLDocument.XMLDocumentIndex + " von " + aXMLDocument.length)
          }
          else
          {
            oXMLContainer.innerHTML = oXMLDocument.innerHTML;
            oXMLDocument.Handled = true;
          }  
        }
      }
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "RenderXMLDocument", "")
  }  
}

/* ============================ GTHeaderAndForm.js ===========================*/
var Features = "";
Features += "dialogWidth:550px;";
Features += "dialogHeight:400px;";
Features += "scroll:Yes;";
Features += "status:No;";
Features += "resizable:Yes;";

var oFormParam = null;
var LoadApplicationStart = new Date();

function BodyOnClickHandler()
{
  try
  {
    HideCalendar();
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "BodyOnClickHandler", "Section1")
  }  
}


function BodyOnKeyDownHandler()
{
}

function BodyOnloadHandler()
{
  try
  {
    EnsureWebMessage();
    if (parent.frames["TopFrame"])
    {
      DoProcessCache();
      SetAppHeaderContent();
    }
    else
    {
      document.title = window.PageTitle;
      ProcessCache();
    }
    LoadApplication();
  }
  catch (exception)
  {
  }  
}  

function DoProcessCache()
{
  try{
    if (typeof(parent.frames["TopFrame"]) == "undefined" || typeof(parent.frames["MainFrame"]) == "undefined" || typeof(parent.frames["NavFrame"]) == "undefined")
    {
      return;
    }
    if (parent.frames["TopFrame"].document == null || parent.frames["MainFrame"].document == null || parent.frames["NavFrame"].document == null)
    {
      return;
    }
    if (parent.frames["TopFrame"].document.readyState == 'complete'
      && parent.frames["MainFrame"].document.readyState == 'complete'
      && parent.frames["NavFrame"].document.readyState == 'complete')
    {
      parent.frames["MainFrame"].ProcessCache();
    }		
  }
  catch (exception){
    WebMessage.SendClientLog(exception, "DoProcessCache", "Section1")
  }  
}

function SetAppHeaderContent()
{
  try{
    if (typeof(parent.frames["TopFrame"]) == "undefined" || typeof(parent.frames["MainFrame"]) == "undefined")
    {
      return;
    }
    if (parent.frames["TopFrame"].document == null || parent.frames["MainFrame"].document == null)
    {
      return;
    }
    if (parent.frames["TopFrame"].document.readyState == 'complete'
      && parent.frames["MainFrame"].document.readyState == 'complete')
    {
      var oPageHeader = parent.frames["TopFrame"].document.getElementById("phc");
      var oPageHeaderOuterTable = parent.frames["TopFrame"].document.getElementById("phc_OuterTable");
    
      var oPageLogoClient = parent.frames["TopFrame"].document.getElementById("PageHeader_PageLogoClient");
      if (oPageLogoClient == null)
      {
        oPageLogoClient = parent.frames["TopFrame"].document.getElementById("phc_PageLogoClient");
      }
      if (oPageLogoClient == null)
      {
        oPageLogoClient = parent.frames["TopFrame"].document.getElementById("PageLogoClient");
      }
      if (oPageLogoClient != null)
      {
        oPageLogoClient.src = parent.frames["MainFrame"].PageLogo;
      }

      var oPageHeadlineClient = parent.frames["TopFrame"].document.getElementById("PageHeader_PageHeadlineClient");
      if (oPageHeadlineClient == null)
      {
        oPageHeadlineClient = parent.frames["TopFrame"].document.getElementById("phc_PageHeadlineClient");
      }	
      if (oPageHeadlineClient == null)
      {
        oPageHeadlineClient = parent.frames["TopFrame"].document.getElementById("PageHeadlineClient");
      }	
      if (oPageHeadlineClient!= null)
      {
        oPageHeadlineClient.innerHTML = parent.frames["MainFrame"].PageHeadline;
      }	

      var oPageUserClient = parent.frames["TopFrame"].document.getElementById("PageHeader_PageUserClient");
      if (oPageUserClient == null)
      {
        oPageUserClient = parent.frames["TopFrame"].document.getElementById("phc_PageUserClient");
      }  
      if (oPageUserClient == null)
      {
        oPageUserClient = parent.frames["TopFrame"].document.getElementById("PageUserClient");
      }  
      if (oPageUserClient != null)
      {
        oPageUserClient.innerHTML = parent.frames["MainFrame"].PageUser;
      }  
      
      var oBottomNote = parent.frames["TopFrame"].document.getElementById("BottomNote");
      if (oBottomNote == null)
      {
        oBottomNote = parent.frames["TopFrame"].document.getElementById("phc_BottomNote");
      }  
      if (oBottomNote == null)
      {
        oBottomNote = parent.frames["TopFrame"].document.getElementById("PageHeader_BottomNote");
      }  
      if (oBottomNote != null)
      {
        oBottomNote.innerHTML = parent.frames["MainFrame"].PageUser;
      }  


      top.document.title = parent.frames["MainFrame"].PageTitle;
      
      parent.frames["TopFrame"].HeaderComplete = true;
      parent.frames["TopFrame"].WebToc_Reset();
      
      if (parent.frames["MainFrame"].FormID != 'LoginMain')
      {
        EnsureWebControl();
        if (RootID == RootID_ProductCatalog)
        {
          //parent.MainFrameset.rows = "0, *, 25";
        }
        else
        {
          var heigth = 30;
          if (oPageHeader != null)
          {
            heigth = WebControl.GetOuterDimension(oPageHeader, "height");
          }  
          else
          {
            if (oPageHeaderOuterTable != null)
            {
              heigth = WebControl.GetOuterDimension(oPageHeaderOuterTable, "height");
            }
            else
            {
              heigth = WebControl.GetOuterDimension(oPageLogoClient, "height");
            }
          }
          parent.MainFrameset.rows = String(heigth) + ", *, 50";
        }
      }
    }		
  }
  catch (exception){
    WebMessage.SendClientLog(exception, "SetAppHeaderContent", "Section1")
  }  
}

function LoadApplication()
{
  try 
  {
    EnsureWebMessage();
    if (window.XmlVersion == enum_XmlVersion_V3)
    {
      EnsureIlp();
      Ilp.Page.LoadPage();
    }
    else
    {
      if (parent.frames["TopFrame"])
      {
        DoProcessCache();
        SetAppHeaderContent();
      }
      else
      {
        document.title = window.PageTitle;
        ProcessCache();
      }
      
      window.WebFrameHost = null;
      if (window.frameElement != null)
      {
        if (window.frameElement.tagName == "IFRAME")
        {
          window.WebFrameHost = new WebFrameHostClass();
        }
      }

      var hostWindow = Ilp.HtmlDom.GetHostWindow();
      if (window.top.frames["TopFrame"] == null && DisplayOption == DisplayOption_InFrameset && hostWindow == null)
      {
        WebFrameGoToLogin(null);
      }
      window.WebStatusBar = Ilp.Util.GetWebStatusBar();
      window.WebStatusBar.SetStatusbarMessage(ids_Ready, 0);
        

      LoadWebForm();  
      LoadWebSelSearch();
      if (typeof(WebDataObjects) != "undefined")
      {
        LoadObjects();
      }  
      if (typeof(WebDataSheetObjects) != "undefined")
      {
        LoadSheets();
      }  
      if (typeof(WebDataGridObjects) != "undefined")
      {
        LoadGrids();
      }  
      if (typeof(WebSpreadSheetObjects) != "undefined")
      {
        LoadSpreadSheets();
      }  
      if (typeof(WebTreeViewObjects) != "undefined")
      {
        LoadTrees();
      }
      
      if (typeof(WebDataSearchObjects) != "undefined")
      {
        for (var i = 0; i < WebDataSearchObjects.length; i++)
        {
          if (WebDataSearchObjects[i] == "body")
          {
            WebDataSearchObjects[i] = document.body;
          } 
          else 
          {
            WebDataSearchObjects[i] = document.getElementById(WebDataSearchObjects[i]);
          }  
        }
      }

      LoadWebDataSearch();
    }

    if (typeof(OnInitHandler) == "string")
    {
      if (OnInitHandler.length > 0)
      {
        eval(OnInitHandler + "()");
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "LoadApplication", "Section1");
  }
}


/* ============================ GTProgram.js ===========================*/
function GoToAdminProgram(sender)
{
  try
  {
    if (sender!=null) sender.disabled = true;
    window.setTimeout("GoToAdminProgramExecute();", nTimeout);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "GoToAdminProgram", "Section1")
  }
}

function GoToAdminProgramExecute(sender)
{
  try
  {
    document.forms["frmAction"].encoding = 'application/x-www-form-urlencoded';
    document.forms["frmAction"].target = "_self";
    document.forms["frmAction"].action = RootPath + "Admin/Admin.aspx";
    document.forms["frmAction"].submit();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "GoToAdminProgramExecute", "Section1")
  }
}

function LoadAppInNewWindow(sURL, IDProgram)
{
  try
  {
    LoadAppInNewWindowAspx(sURL, IDProgram);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "LoadAppInParentForm", "Section1")
  }
}

function LoadAppInNewWindowAspx(sURL, IDProgram, ac)
{
  try
  {
    ac = ac == null ? 0 : 1;
    document.forms["frmAction"].elements["IDMainProgram"].value = IDMainProgram;
    if (IDProgram != null)
    {
      document.forms["frmAction"].elements["IDProgram"].value = IDProgram;
    }
    document.forms["frmAction"].elements["Language"].value = Language;
    document.forms["frmAction"].elements["TargetShowURL"].value = sURL;
    if (RootPath.substring(RootPath.length-1,RootPath.length)=="/")
    {
      document.forms["frmAction"].action = RootPath + "LoginFrame.aspx?AC=" + String(ac);
    }
    else{  
      document.forms["frmAction"].action = RootPath + "/LoginFrame.aspx?AC=" + String(ac);
    }
    document.forms["frmAction"].target = '_blank';
    document.forms["frmAction"].submit();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "LoadAppInParentForm", "Section1")
  }
}

function LoadAppInNewWindowAfterLogin(sURL, IDProgram, Username, Password)
{
  try
  {
    var LocalFeatures = "";
    LocalFeatures += "width=930,";
    LocalFeatures += "height=600,";
    LocalFeatures += "scrollbars=yes,";
    LocalFeatures += "status=yes,";
    LocalFeatures += "location=no,";
    LocalFeatures += "menubar=yes,";
    LocalFeatures += "titlebar=no,";
    LocalFeatures += "toolbar=yes,";
    LocalFeatures += "fullscreen=no,";
    LocalFeatures += "resizable=yes";


    RetValue = window.open(
      RootPath + "/LoginFrame.asp?TargetShowURL=" + escape(sURL) + "&IDProgram=" + IDProgram + "&txtUsername=" + Username + "&txtPassword=" + Password, 
      "_blank", 
      LocalFeatures);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "LoadAppInWindowOpen", "Section1")
  }
}
/*
function LaunchFileURL(sFileURL)
{
  try
  {
    var sMethod = window.frmAction.method;
    
    window.frmAction.method = "GET";
    window.frmAction.action = sFileURL;
    window.frmAction.encoding = 'application/x-www-form-urlencoded';
    window.frmAction.target = "_blank";
    window.frmAction.submit(); 
    window.frmAction.method = sMethod;
  }
  catch (exception){
    WebMessage.SendClientLog(exception, "LaunchFileURL", "Section1")
  }  
}
*/
/*
function LaunchProgram(oProgramLinkContainer)
{
  try
  {
    var TargetSelf = oProgramLinkContainer.getAttribute("TargetSelf");
    if (TargetSelf == null)
    {
      TargetSelf = "true";
    }
    if (TargetSelf == "true")
    {
      window.frmAction.IDProgram.value = oProgramLinkContainer.getAttribute("IDProgram");
      var sPath = oProgramLinkContainer.getAttribute("ProgramPath");
      if (sPath.substring(0,1)=="/"){
        window.frmAction.action = oProgramLinkContainer.getAttribute("ProgramPath") + "/" + oProgramLinkContainer.getAttribute("ProgramStart");
      }
      else{
        window.frmAction.action = RootPath + "/" + oProgramLinkContainer.getAttribute("ProgramPath") + "/" + oProgramLinkContainer.getAttribute("ProgramStart");
      }
      window.frmAction.encoding = 'application/x-www-form-urlencoded';
      window.frmAction.target = "_self";
      window.frmAction.submit(); 
    }
    else{
      var sPath = oProgramLinkContainer.getAttribute("ProgramPath");
      var url = "";
      if (sPath.substring(0,1)=="/"){
        url = oProgramLinkContainer.getAttribute("ProgramPath") + "/" + oProgramLinkContainer.getAttribute("ProgramStart");
      }
      else{
        url = RootPath + "/" + oProgramLinkContainer.getAttribute("ProgramPath") + "/" + oProgramLinkContainer.getAttribute("ProgramStart");
      }
      LoadAppInNewWindow(url, oProgramLinkContainer.getAttribute("IDProgram"));
    }
  }
  catch (exception)
  {
    WebMessage.SendClientLog(exception, "LaunchProgram", "Section1")
  }  
}
*/

function HistoryBack(sender, iDistance)
{
  try
  {
    if (sender!=null) sender.disabled = true;
    
    if (iDistance==null) window.history.back();
    else
    {
      for (var i=0; i<iDistance; i++) window.history.back();
    }  
    
    if (sender!=null) sender.disabled = false;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "HistoryBack", "Section1")
  }
}

function ChangeProgram(sender)
{
  try
  {
    if (sender!=null)
    {
      sender.disabled = true;
    }  

    window.setTimeout("ChangeProgramExecute();", 10);

    if (sender!=null)
    {
      sender.disabled = false;
    }  
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "ChangeProgram", "Section1")
  }
}

function ChangeProgramExecute()
{
  try
  {
    if (WebControl.GetCurrentDocument().forms["frmAction"].WebMessage)
    {
      WebControl.GetCurrentDocument().forms["frmAction"].WebMessage.value = "";
    }
    WebControl.Submit(null, HomePath);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "ChangeProgramExecute", "Section1")
  }
}

/*
function ChangeMainFrameLocation(oObject)
{
  try
  {
    if (oObject!=null){
      oObject.disabled = true;
    }  

    if (parent.MainFrame){
      DisplayMenu("None");
      window.setTimeout("ChangeMainFrameLocationExecute();", nTimeout);
    }
    
    if (oObject!=null){
      oObject.disabled = false;
    }  
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "ChangeMainFrameLocation", "Section1")
  }
}

function ChangeMainFrameLocationExecute(oObject){
  try{
    UnloadFormMenu();
    var path = HomePath + "?IDAppUser=" + IDAppUser + "&Language=" + Language;
    parent.MainFrame.location.href = path;
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "ChangeMainFrameLocationExecute", "Section1")
  }
}
*/

/* ============================ GTHelp.js ===========================*/


function StartHelp(oObject){
  try{
    if (oObject!=null){
      oObject.disabled = true;
    }
    if (UseAspx == true)
    {
      document.forms[FormID].encoding = 'application/x-www-form-urlencoded';
      document.forms[FormID].method = "get";
      document.forms[FormID].action = HelpPath;
	    document.forms[FormID].target = "_blank";
	    document.forms[FormID].submit();
    }
    else
    {  
      document.forms[FormName].encoding = 'application/x-www-form-urlencoded';
      document.forms[FormName].method = "post";
      document.forms[FormName].action = HelpPath;
	    document.forms[FormName].target = "_blank";
	    document.forms[FormName].submit();
	  }
    if (oObject!=null){
      oObject.disabled = false;
    }  
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "StartHelp", "Section1")
  }
}

function LaunchHelp(oObject)
{
  try 
  {
    var sLanguage;
    var helpFile;
    
    if (oObject != null){
      oObject.disabled = true;
    }
      
    switch (RootID) {
      case "eOrder":
        sLanguage = "de-DE";
        helpFile = RootPath + "Help/Help.asp";
        break;
      case "eLog":
        sLanguage = "de-DE";
        helpFile = RootPath + "MainApp/MainAppHelp/Help.asp";     
				break;
      case "ESPEY":
        sLanguage = "de-DE";
        if (location.href.indexOf("Admin.aspx") > -1)
        {
          helpFile = RootPath + "Admin/AdminHelp/Help.asp";
        }
        else
        {
          helpFile = RootPath + "Help/Help.asp";
        }  
        break;
      default:
        sLanguage = SelectLanguage();
        //sLanguage = "de-DE";
        switch (RootID) {
          case "MDS":
            if (sLanguage == "d" || sLanguage == "de-DE") {
              helpFile = RootPath + "Help/Help.asp";
            } else {
              helpFile = RootPath + "HelpEng/Help.asp";
            }
            break;
          default:
            if (sLanguage == "d" || sLanguage == "de-DE") 
            {
              helpFile = HelpPath + "Help/Help.asp";
            } 
            else if (sLanguage == "fr-FR") 
            {
              helpFile = HelpPath + "HelpFra/Help.asp";
            } 
            else 
            {
              helpFile = HelpPath + "HelpEng/Help.asp";
            }
        }
    }
    document.forms["frmAction"].action = helpFile;
	  document.forms["frmAction"].target = "_blank";
	  if (sLanguage != null) 
	  {
	    document.forms["frmAction"].submit();
	  }
	  
    if (oObject != null)
    {
      oObject.disabled = false;
    }  
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "LaunchHelp", "Section1")
  }
}

function CallHelp(sLanguage){
  try{
	  if (sLanguage=='d' || sLanguage=='de-DE'){
	  	document.forms[FormName].action = HelpPath + "Help/Help.asp";
	  }
	  else{
	  	document.forms[FormName].action = HelpPath + "HelpEng/Help.asp";
	  }
	  document.forms[FormName].target = "_blank";
	  document.forms[FormName].submit();
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "CallHelp", "Section1")
  }
}

function Help_Show(){
  try{
    document.forms[FormName].target = '_blank';
    document.forms[FormName].action = HelpASP;
    document.forms[FormName].submit();
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "Help_Show", "Section1")
  }
}
  
function Help_Edit(){
  try{
    document.forms[FormName].target = '_blank';
    document.forms[FormName].action = HelpASP;
    document.forms[FormName].submit();
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "Help_Edit", "Section1")
  }
}
 
function GoToAdminHelp(oObject){
  try{
    if (oObject!=null){
      oObject.disabled = true;
    }  

    document.forms["frmAction"].encoding = 'application/x-www-form-urlencoded';
	  if (Language=='d' || Language=='de-DE'){
      document.forms["frmAction"].action = HelpPath + "AdminHelp/Help.asp"; 
	  }
	  else{
      document.forms["frmAction"].action = HelpPath + "AdminHelpEng/Help.asp"; 
	  }
    document.forms["frmAction"].target = "_blank";
    document.forms["frmAction"].submit(); 

    oObject.disabled = false;
  }  
  catch (exception){
    WebMessage.SendClientLog(exception, "GoToAdminHelp", "Section1")
  }  
}
 


function LaunchHelpFromShow(sLanguage){
  try{
    if (document.forms["HeadForm"]){
      var FormName = "HeadForm";
      var HelpPath = window.top.HelpPath;
    }
	  if (sLanguage=='d' || sLanguage=='de-DE'){
 	    document.forms[FormName].action = HelpPath + "Help/HelpFromShow.asp";
	  }
	  else{
 	  	document.forms[FormName].action = HelpPath + "HelpEng/HelpFromShow.asp";
	  }
    document.forms[FormName].target = "_blank";
	  document.forms[FormName].submit();
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "LaunchHelpFromShow", "Section1")
  }
}


function CallHelpDirect(sForm){
  try{
	  document.forms[FormName].target = '_blank';
	  document.forms[FormName].action = sForm;
	  document.forms[FormName].submit();
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "CallHelpDirect", "Section1")
  }
}

function CallHelpInNewWindow(sLanguage){
  try{
	  document.forms[FormName].target = '_blank';
	  if (sLanguage=='d' || sLanguage=='de-DE'){
	  	document.forms[FormName].action = HelpPath + "Help/Help.asp";
	  }
	  else{
	  	document.forms[FormName].action = HelpPath + "HelpEng/Help.asp";
	  }
	  document.forms[FormName].submit();
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "CallHelpInNewWindow", "Section1")
  }
}

function CallCriterionHelp(sLanguage){
  try{
	  if (sLanguage=='d' || sLanguage=='de-DE'){
	  	document.forms[FormName].action = HelpPath + "Help/HelpFromShow.asp";
	  }
	  else{
	  	document.forms[FormName].action = HelpPath + "HelpEng/HelpFromShow.asp";
	  }
    document.forms[FormName].target = "_blank";
	  document.forms[FormName].submit();
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "CallCriterionHelp", "Section1")
  }
}

function OpenHelp(oObject){
  try{
    if (oObject!=null){
      oObject.disabled = true;
    }  
    document.forms["frmAction"].action = HelpPath;
	  document.forms["frmAction"].target = "_blank";
	  document.forms["frmAction"].submit();
    oObject.disabled = false;
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "StartHelp", "Section1")
  }
}

function SelectLanguage() 
{
  var sFeatures = "dialogHeight:280px;dialogWidth:350px;status:no;";
  var sLanguage = "";
  var supportedLanguages = "";
  var sUrl = "";
  
  sUrl = GlobalScriptsDirectoryVirtual + "GTCommon/SelectLanguage.aspx?Language=" + Language + "&RootID=" + RootID;
  if (WebMessage)
  {
    supportedLanguages = WebMessage.GetGeneralInfoAttribute("SupportedLanguages");
    if (supportedLanguages.length > 0)
    {
      sUrl += "&SupportedLanguages=" + supportedLanguages;
    }
  }
  sLanguage = window.showModalDialog(sUrl, PageLogo, sFeatures);
    
  return sLanguage;
}

/* ============================ GTWebSelSearch.js ===========================*/
function LoadWebSelSearch()
{
  try
  {
    window.WebSelSearch = new Object();
    window.WebSelSearch.FilterOption = WebSelSearch_FilterOption;
    window.WebSelSearch.Close = WebSelSearch_Close;
    window.WebSelSearch.Cancel = WebSelSearch_Cancel;
    window.WebSelSearch.ConvertHTMLSelectToXML = WebSelSearch_ConvertHTMLSelectToXML;
    
    if (window.dialogArguments)
    {
      var callingWindow = window.dialogArguments;
      if (typeof(callingWindow.XmlFound) == "string")
      {
        window.WebSelSearch.oForwardXMLDoc = Ilp.XmlDom.CreateXmlDom();
        window.WebSelSearch.oForwardXMLDoc.loadXML(callingWindow.XmlFound);
        if (Ilp.XmlDom.HasParseError(window.WebSelSearch.oForwardXMLDoc) == true)
        {
          result = Ilp.XmlDom.GetParseErrorText(window.WebSelSearch.oForwardXMLDoc);
          WebMessage.SendClientLog(exception, "LoadWebSelSearch", result);
        }  
      }  
    }    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "LoadWebSelSearch", "");
  }
}

function WebSelSearch_FilterOption()
{
  try
  {
    if (WebSelSearch.oForwardXMLDoc != null)
    {
      var oListBoxSearch = document.getElementById("ListBoxSearch");
      
      var xPath = "//Record";
      var oRecordList = WebSelSearch.oForwardXMLDoc.documentElement.selectNodes(xPath); 
      for (var i = 0; i<oRecordList.length; i++)
      {
        var oRecord = oRecordList.item(i);
        WebControl.DeleteOption(oListBoxSearch, oRecord.getAttribute("OV"));
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebSelSearch_FilterOption", "Section1")
  }
}


function WebSelSearch_Close(oButton)
{
  try
  {
    if (oButton!=null){
      oButton.disabled = true;
    }  

    window.returnValue = WebSelSearch.ConvertHTMLSelectToXML(document.getElementById("ListBoxSearch"), true);
    window.close();

  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebSelSearch_Close", "Section1")
  }
}

function WebSelSearch_Cancel(oButton)
{
  try
  {
    window.returnValue = "";
    window.close();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebSelSearch_Cancel", "Section1")
  }
}

function WebSelSearch_ConvertHTMLSelectToXML(oSelect, bOnlySeleted)
{
  try
  { 
    var xmlData = "";
    var bContinue = true;
    
    xmlData += "<Root>";
    for (var i=0; i<oSelect.options.length; i++){
    
      bContinue = true;
      if (bOnlySeleted==true){
        if (oSelect.options(i).selected==false){
          bContinue = false;
        }
      }
      if (bContinue==true){
        xmlData += "<Record ";
        xmlData += " OptionValue=\"" + escape(oSelect.options(i).value) + "\"";
        xmlData += " OptionText=\"" + escape(oSelect.options(i).text) + "\"";
        xmlData += " ReturnText=\"" + escape(oSelect.options(i).getAttribute("OptionReturn")) + "\"";
        xmlData += "></Record>";
      }  
    }  
    xmlData += "</Root>";

    return xmlData; 
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "WebSelSearch_ConvertHTMLSelectToXML", "Section1")
  }
}




/* ============================ GTWebFormDescriptor.js ===========================*/
function LoadFormDescriptor(xmlDomObject)
{
  try
  {
    if (window.XmlVersion == enum_XmlVersion_V1)
    {
      var oXMLObject = window.event.srcElement;
      if (oXMLObject.readyState == 'complete')
      {
        EnsureWebMessage();
        EnsureWebForm();
        EnsureWebControl();
      
        FormDescriptor = new FormDescriptorClass(oXMLObject.XMLDocument);
      }
    }
    else if (window.XmlVersion == enum_XmlVersion_V3)
    {
      Ilp.Page.LoadFormDescriptor();
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "LoadFormDescriptor", "");
  }
}

function FormDescriptorClass(xmlDomObject)
{
  try
  {
    this.FormDescriptorDoc = xmlDomObject;
    Ilp.XmlDom.SetSelectionLanguageDefault(this.FormDescriptorDoc);
    Ilp.XmlDom.SetSelectionNamespaces(this.FormDescriptorDoc, "xmlns:ilp='http://ilp.de/webservices/'");
    this.Counter = new Object();
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor", "");
  }
}

FormDescriptorClass.prototype.GetFieldnameEffective = function(fd)
{
  try
  {
    var fieldname = fd.getAttribute("FieldNameAlias");
    if (fieldname == null || fieldname == "")
    {
      fieldname = fd.getAttribute("FieldName");
    }
    return fieldname;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetFieldnameEffective", "");
  }
}

FormDescriptorClass.prototype.GetDbGridCaption = function(fd)
{
  try
  {
    var caption = fd.getAttribute("DbGridCaption");
    if (caption == null || caption == "")
    {
      caption = fd.getAttribute("FieldNameAlias");
    }
    if (caption == null || caption == "")
    {
      caption = fd.getAttribute("FieldName");
    }
    return caption;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetColumnCaption", "");
  }
}

FormDescriptorClass.prototype.GetNextCount = function(tdFqn)
{
  try
  {
    if (this.Counter[tdFqn] == null)
    {
      this.Counter[tdFqn] = 1;
    }
    return this.Counter[tdFqn]++;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetNextCount", "");
  }
}

FormDescriptorClass.prototype.GetNextIlpId = function()
{
  try
  {
    if (this.IDCounterA == null)
    {
      this.IDCounterA = 1;
    }
    return this.IDCounterA++;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptorClass.prototype.GetNextIlpId", "");
  }
}

FormDescriptorClass.prototype.GetFieldDescriptor = function(fdFqn)
{
  try
  {
    var fqn = fdFqn.split(".");
    var fieldDescriptor = this.FormDescriptorDoc.selectSingleNode("/ilp:FormDescriptor/ilp:TableDescriptor[@ID='" + fqn[0] + "']/ilp:FieldDescriptor[@ID='" + fqn[1] + "']");
    return fieldDescriptor;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetFieldDescriptor", "");
  }
}

FormDescriptorClass.prototype.ExitsFieldDescriptor = function(fdFqn)
{
  try
  {
    var fqn = fdFqn.split(".");
    var fieldDescriptor = this.FormDescriptorDoc.selectSingleNode("/ilp:FormDescriptor/ilp:TableDescriptor[@ID='" + fqn[0] + "']/FieldDescriptor[@ID='" + fqn[1] + "']");
    return fieldDescriptor != null;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_ExitsFieldDescriptor", "");
  }
}

FormDescriptorClass.prototype.GetPrimaryKeyFieldDescriptor = function(tdFqn)
{
  try
  {
    return this.FormDescriptorDoc.selectSingleNode("/ilp:FormDescriptor/ilp:TableDescriptor[@ID='" + tdFqn + "']/ilp:FieldDescriptor[@IsPrimaryKey='true']");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetPrimaryKeyFieldDescriptor", "");
  }
}

FormDescriptorClass.prototype.GetOptionValueFd = function(tdFqn)
{
  try
  {
    return this.FormDescriptorDoc.selectSingleNode("/ilp:FormDescriptor/ilp:TableDescriptor[@ID='" + tdFqn + "']/ilp:FieldDescriptor[@CacheUsageClass='MapToOptionValue']");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetOptionValueFd", "");
  }
}

FormDescriptorClass.prototype.GetOptionTextFd = function(tdFqn)
{
  try
  {
    return this.FormDescriptorDoc.selectSingleNode("/ilp:FormDescriptor/ilp:TableDescriptor[@ID='" + tdFqn + "']/ilp:FieldDescriptor[@CacheUsageClass='MapToOptionText']");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetOptionTextFd", "");
  }
}

FormDescriptorClass.prototype.GetOptionReturnFd = function(tdFqn)
{
  try
  {
    return this.FormDescriptorDoc.selectSingleNode("/ilp:FormDescriptor/ilp:TableDescriptor[@ID='" + tdFqn + "']/ilp:FieldDescriptor[@CacheUsageClass='MapToOptionReturn']");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetOptionTextFd", "");
  }
}

FormDescriptorClass.prototype.GetNoUpdatableFields = function(tdFqn)
{
  try
  {
    if (tdFqn && tdFqn.length > 0)
    {
      return this.FormDescriptorDoc.selectNodes("/ilp:FormDescriptor/ilp:TableDescriptor[@ID='" + tdFqn + "']/ilp:*[@UpdateClass='NoUpdate' and not(@TransferClass='Mandatory') and not(@IsPrimaryKey)]");
    }
    else
    {
      return this.FormDescriptorDoc.selectNodes("//ilp:*[@UpdateClass='NoUpdate' and not(@TransferClass='Mandatory') and not(@IsPrimaryKey)]");
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetNoUpdatableFields", "");
  }
}

FormDescriptorClass.prototype.GetNoUpdatableTables = function()
{
  try
  {
    return this.FormDescriptorDoc.selectNodes("//ilp:*[(@AllowDelete='false' and @AllowNew='false' and @AllowEdit='false')]");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor.GetNoUpdatableTables", "");
  }
}

FormDescriptorClass.prototype.GetFieldDescriptorList = function(tdFqn, attributeSelector)
{
  try
  {
    tdFqn = tdFqn == null ? "" : tdFqn;
    attributeSelector = attributeSelector == null ? "" : attributeSelector;
    if (tdFqn.length > 0)
    {
      if (attributeSelector.length > 0)
      {
        return this.FormDescriptorDoc.selectNodes("/ilp:FormDescriptor/ilp:TableDescriptor[@ID='" + tdFqn + "']/ilp:FieldDescriptor" + attributeSelector);
      }
      else
      {
        return this.FormDescriptorDoc.selectNodes("/ilp:FormDescriptor/ilp:TableDescriptor[@ID='" + tdFqn + "']/ilp:FieldDescriptor");
      }
    }
    else
    {
      if (attributeSelector.length > 0)
      {
        return this.FormDescriptorDoc.selectNodes("/ilp:FormDescriptor/ilp:TableDescriptor/ilp:FieldDescriptor" + attributeSelector);
      }
      else
      {
        return this.FormDescriptorDoc.selectNodes("/ilp:FormDescriptor/ilp:TableDescriptor/ilp:FieldDescriptor");
      }
    }
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetFieldDescriptorList", "");
  }
}

FormDescriptorClass.prototype.GetTableDescriptorList = function()
{
  try
  {
    return this.FormDescriptorDoc.selectNodes("/ilp:FormDescriptor/ilp:TableDescriptor");
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "FormDescriptor_GetTableDescriptorList", "");
  }
}

FormDescriptorClass.prototype.GetTableDescriptor = function(tdFqn)
{
  try
  {
    var fqn = tdFqn.split(".");
  
    return this.FormDescriptorDoc.selectSingleNode("/ilp:FormDescriptor/ilp:TableDescriptor[@ID='" + fqn[0] + "']");
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "FormDescriptor_GetTableDescriptor", "");
  }
}

FormDescriptorClass.prototype.GetLookUpRelationDescriptor = function(lurdFqn)
{
  try
  {
    var fqn = lurdFqn.split(".");
  
    return this.FormDescriptorDoc.selectSingleNode("/ilp:FormDescriptor/ilp:LookUpRelationDescriptor[@ID='" + fqn[0] + "']");
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "FormDescriptor_GetLookUpRelationDescriptor", "");
  }
}

FormDescriptorClass.prototype.GetLookUpIDField = function(lurdFqn)
{
  try
  {
    var lurd = this.GetLookUpRelationDescriptor(lurdFqn);  
    var fqnID = lurd.getAttribute("FieldDescriptorIDFqn");
  
    return fqnID;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetLookUpIDField", "");
  }
}

FormDescriptorClass.prototype.GetLookUpTextField = function(lurdFqn)
{
  try
  {
    var lurd = this.GetLookUpRelationDescriptor(lurdFqn);  
    var fqnText = lurd.getAttribute("FieldDescriptorTextFqn");
  
    return fqnText;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetLookUpTextField", "");
  }
}

FormDescriptorClass.prototype.GetLookUpReturnField = function(lurdFqn)
{
  try
  {
    var lurd = this.GetLookUpRelationDescriptor(lurdFqn);  
    var fqnReturn = lurd.getAttribute("FieldDescriptorReturnFqn");
  
    return fqnReturn;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetLookUpReturnField", "");
  }
}


FormDescriptorClass.prototype.GetSearchRelationDescriptor = function(srdFqn)
{
  try
  {
    var fqn = srdFqn.split(".");
  
    return this.FormDescriptorDoc.selectSingleNode("/ilp:FormDescriptor/ilp:SearchRelationDescriptor[@ID='" + fqn[0] + "']");
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "FormDescriptor_GetSearchRelationDescriptor", "");
  }
}

FormDescriptorClass.prototype.GetSearchedFieldDescriptor = function(srdFqn)
{
  try
  {
    var searchRelationDescriptor = this.GetSearchRelationDescriptor(srdFqn);
  
    var fqn = searchRelationDescriptor.getAttribute("TableDescriptorFqnMaster") + "." + searchRelationDescriptor.getAttribute("FieldDescriptorFqnListMaster").split(" ")[0];
    
    return this.GetFieldDescriptor(fqn);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetSearchedFieldDescriptor", "");
  }
}

FormDescriptorClass.prototype.GetUploadDescriptor = function(uplFqn)
{
  try
  {
    var fqn = uplFqn.split(".");
  
    return this.FormDescriptorDoc.selectSingleNode("/ilp:FormDescriptor/ilp:UploadDescriptor[@ID='" + fqn[0] + "']");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetUploadDescriptor", "");
  }
}

FormDescriptorClass.prototype.GetDeleteDescriptor = function(tdFqn)
{
  try
  {
    var td = this.GetTableDescriptor(tdFqn);
    var fqn = "";
    if (td != null)
    {
      fqn = td.getAttribute("DeleteDescriptorFqn");
    }
    return this.FormDescriptorDoc.selectSingleNode("/ilp:FormDescriptor/ilp:DeleteDescriptor[@ID='" + fqn + "']");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetDeleteDescriptor", "");
  }
}

FormDescriptorClass.prototype.GetMoverDescriptor = function(mdFqn)
{
  try
  {
    var fqn = mdFqn.split(".");
  
    return this.FormDescriptorDoc.selectSingleNode("/ilp:FormDescriptor/ilp:MoverDescriptor[@ID='" + fqn[0] + "']");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetMoverDescriptor", "");
  }
}

FormDescriptorClass.prototype.GetPrimaryKeyFieldDescriptorFromDtrd = function(dtrd)
{
  try
  {
    var tableFqn = dtrd.getAttribute("TableDescriptorFqnMaster");
    var primaryKey = dtrd.getAttribute("FieldDescriptorFqnListMaster").split(" ")[0];
    
    return this.GetFieldDescriptor(tableFqn + "." + primaryKey);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetPrimaryKeyFieldDescriptorFromDtrd", "");
  }
}

FormDescriptorClass.prototype.GetPrimaryKeyFieldDescriptorListFromDtrd = function(dtrd)
{
  try
  {
    var fieldDescriptorList = new Array();
    var tableFqn = dtrd.getAttribute("TableDescriptorFqnMaster");
    var primaryKeyList = dtrd.getAttribute("FieldDescriptorFqnListMaster").split(" ");
    
    for (var i = 0; i < primaryKeyList.length; i++)
    {
      fieldDescriptorList[i] = this.GetFieldDescriptor(tableFqn + "." + primaryKeyList[i]);
    }
    
    return fieldDescriptorList;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "GetPrimaryKeyFieldDescriptorListFromDtrd", "");
  }
}

FormDescriptorClass.prototype.GetForeignKeyFieldDescriptor = function(dtrd)
{
  try
  {
    var tableFqn = dtrd.getAttribute("TableDescriptorFqnDetail");
    var foreignKey = dtrd.getAttribute("FieldDescriptorFqnListDetail").split(" ")[0];
    
    return this.GetFieldDescriptor(tableFqn + "." + foreignKey);
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetForeignKeyFieldDescriptor", "");
  }
}

FormDescriptorClass.prototype.GetRelationByMasterDetail = function(masterTableFqn, detailTableFqn)
{
  try
  {
    var dtrd = this.FormDescriptorDoc.selectSingleNode("/ilp:FormDescriptor/ilp:DataTableRelationDescriptor[@TableDescriptorFqnMaster='" + masterTableFqn + "' and @TableDescriptorFqnDetail='" + detailTableFqn + "']");
    
    return dtrd;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetRelationByMasterDetail", "");
  }
}

FormDescriptorClass.prototype.GetRelationByMaster = function(masterTableFqn)
{
  try
  {
    var dtrdList = this.FormDescriptorDoc.selectNodes("/ilp:FormDescriptor/ilp:DataTableRelationDescriptor[@TableDescriptorFqnMaster='" + masterTableFqn + "']");
    
    return dtrdList;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetRelationByMaster", "");
  }
}

FormDescriptorClass.prototype.GetRelationByDetail = function(detailTableFqn)
{
  try
  {
    var dtrdList = this.FormDescriptorDoc.selectNodes("/ilp:FormDescriptor/ilp:DataTableRelationDescriptor[@TableDescriptorFqnDetail='" + detailTableFqn + "']");
    
    return dtrdList;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetRelationByDetail", "");
  }
}

FormDescriptorClass.prototype.GetDataTableRelationDescriptor = function(dtrdFqn)
{
  try
  {
    var dtrd = this.FormDescriptorDoc.selectSingleNode("/ilp:FormDescriptor/ilp:DataTableRelationDescriptor[@ID='" + dtrdFqn + "']");
    
    return dtrd;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetDataTableRelationDescriptor", "");
  }
}

FormDescriptorClass.prototype.GetRelatedNames = function(tdFqn, includeSelf)
{
  try
  {
    var tdFqnTemp;
    var nodeNames = new WebArray();
    var queue = new WebQueue();
    var counter = 0;
    
    queue.Enqueue(tdFqn);
    while(queue.Count() > 0)
    {   
      tdFqnTemp  = queue.Dequeue();
      if (includeSelf == true || counter > 0)
      {
        nodeNames.Add(tdFqnTemp)
      }
      counter++;
      
      var dtrdList = this.GetRelationByMaster(tdFqnTemp);
      for (var i = 0, len = dtrdList.length;  i < len; i++) 
      {
        var dtrd = dtrdList[i];
        tdFqnTemp = dtrd.getAttribute("TableDescriptorFqnDetail");
        // Rekursionen werden hier beachtet
        if (nodeNames.Contains(tdFqnTemp) == false)
        {
          queue.Enqueue(tdFqnTemp);
        }
      }
    }
    
    return nodeNames;    
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptorClass.prototype.GetRelatedNames", "");
  }
}

FormDescriptorClass.prototype.GetSelectionDescriptor = function(seldFqn)
{
  try
  {
    return this.FormDescriptorDoc.selectSingleNode("/ilp:FormDescriptor/ilp:SelectionDescriptor[@ID='" + seldFqn + "']");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetSelectionDescriptor", "");
  }
}

FormDescriptorClass.prototype.GetAttachedSelectionDescriptor = function(fqn)
{
  try
  {
    var fd = this.GetFieldDescriptor(fqn);
    return this.GetSelectionDescriptor(fd.getAttribute("SelectionDescriptorFqn"));
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetAttachedSelectionDescriptor", "");
  }
}


FormDescriptorClass.prototype.GetSelectionDescriptorList = function()
{
  try
  {
    return this.FormDescriptorDoc.selectNodes("/ilp:FormDescriptor/ilp:SelectionDescriptor");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetSelectionDescriptorList", "");
  }
}


FormDescriptorClass.prototype.GetOptionReturnList = function(seld)
{
  try
  {
    return seld.getAttribute("OptionReturnList").split(" ");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetOptionReturnList", "");
  }
}


FormDescriptorClass.prototype.GetOptionReturnTargetList = function(seld)
{
  try
  {
    return seld.getAttribute("OptionReturnTargetList").split(" ");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetOptionReturnTargetList", "");
  }
}


FormDescriptorClass.prototype.GetConstrainedSelectionDescriptorList = function(constrainerFqn)
{
  try
  {
    var oContrainedList = this.FormDescriptorDoc.selectNodes("/ilp:FormDescriptor/ilp:SelectionDescriptor[@ConstrainerFqn='" + constrainerFqn + "']");
    if (oContrainedList.length == 0)
    {
      oContrainedList = this.FormDescriptorDoc.selectNodes("/ilp:FormDescriptor/ilp:SelectionDescriptor[@ConstrainerSourceFqn='" + constrainerFqn + "']");
    }
    return oContrainedList;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetConstrainedSelectionDescriptorList", "");
  }
}


FormDescriptorClass.prototype.GetMandatoryTables = function()
{
  try
  {
    var xPath = "/ilp:FormDescriptor/ilp:TableDescriptor[@ShowRecordsAtStartup='true']"
    var MandatoryTableList = this.FormDescriptorDoc.selectNodes(xPath);
    
    return MandatoryTableList;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetMandatoryTables", "");
  }
}

FormDescriptorClass.prototype.GetUnitField = function(fd)
{
  try
  {
    var unitFd = null;
    var unitFqn = fd.getAttribute("UnitFieldName");
    if (unitFqn != null)
    {
      unitFd = this.GetFieldDescriptor(unitFqn);
    }
    
    return unitFd;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetUnitField", "");
  }
}

FormDescriptorClass.prototype.ConvertDefaultValueToWebData = function( fd, defaultValue )
{
  try
  {
    var webValue = null;
    defaultValue = (defaultValue == null) ? fd.getAttribute("DefaultValue") : defaultValue;
    var fieldType = fd.getAttribute("FieldType");
    
    switch (fieldType)
    {   
      case "boolean" :
        if ( defaultValue == "1" )
        {
          webValue = "true";
        }
        else
        {
          webValue = "false";
        }          
        break;
        
      case "integer" :
      case "string" :
      case "nString" :
        webValue = WebMessage.ReplaceToken(defaultValue);
        break;
                
      default :
        webValue = defaultValue;
        break;
    }
    return webValue;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_ConvertDefaultValueToWebData", "");
  }
}

function ShowFormDescriptor(oControl)
{
  try
  {
    if (oControl!=null){
      oControl.disabled = true;
    }  

    WebMessage.ShowXmlDoc(oControl, "FormDescriptor");

    if (oControl!=null){
      oControl.disabled = false;
    }  
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "ShowFormDescriptor", "Section1")
  }
}


FormDescriptorClass.prototype.GetLookUpRelationByDetail = function(lookUpTableFqn)
{
  try
  {
    var lurdList = this.FormDescriptorDoc.selectNodes("/ilp:FormDescriptor/ilp:LookUpRelationDescriptor[@TableDescriptorFqnLookUp='" + lookUpTableFqn + "']");
    return lurdList;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetLookUpRelationByDetail", "");
  }
}


FormDescriptorClass.prototype.IsStringArrayEmpty = function(array)
{
  try
  {
    var ret = false;
    if ((array.length == 0) || (array.length == 1 && array[0].length == 0))
    {
      ret = true;
    }
    return ret;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_IsStringArrayEmpty", "");
  }
}

FormDescriptorClass.prototype.GetExcelExportDescriptor = function(excelExportDescriptorFqn)
{
  try
  {
    var fqn = excelExportDescriptorFqn.split(".");
  
    return this.FormDescriptorDoc.selectSingleNode("/ilp:FormDescriptor/ilp:ExcelExportDescriptor[@ID='" + fqn[0] + "']");
  }
  catch(exception){
    WebMessage.SendClientLog(exception, "FormDescriptor_GetExcelExportDescriptor", "");
  }
}

FormDescriptorClass.prototype.GetExcelExportDescriptorList = function()
{
  try
  {
    return this.FormDescriptorDoc.selectNodes("/ilp:FormDescriptor/ilp:ExcelExportDescriptor");
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetExcelExportDescriptorList", "");
  }
}

FormDescriptorClass.prototype.GetFieldName = function(fdFqn)
{
  try
  {
    var fieldName = "";
    var fqn = fdFqn.split(".");
    if (fqn.length == 2)
    {
      fieldName = fqn[1];
    }
    else
    {
      fieldName = fqn[0];
    }
    return fieldName;
  }
  catch(exception)
  {
    WebMessage.SendClientLog(exception, "FormDescriptor_GetFieldName", "");
  }
}



