
//==================================================================================
//==================================================================================
// 
// SHOP-MODUL HAUPTPROGRAMM
// OO-PROGRAMMIERUNG
// AUTOR: DF
// ERSTELLT: 24.01.2005
//
//==================================================================================
//==================================================================================


// ============================================================
// Globale Deklarationen
// ============================================================

// den undefinierten Wert deklarieren
var undefined;


/////////////////////////////////////////////////////////////////////////////////////////////////////////////

// ============================================================
// Klasse ITEM
// ============================================================

// ------------------------------------------------------------
// Konstruktor
// ------------------------------------------------------------

// ---------------------------------------
// Item()
// ---------------------------------------
//
// Beschreibung:
// -------------
// Konstruiert ein Item Objekt.
//
// Beispiel:
// ---------
// 

function Item() {  
  // Attribute
  this._language = undefined; 
  this._id = undefined;
  this._orderNumber = undefined;
  this._title = undefined; 
  this._price = undefined;
  this._propertyMap = {};
  this._itemType = {};
  
  // Initialisierungen
  this.language();
  this.id();
  this.orderNumber();
  this.title();
  this.price();
  this.propertyMap(); 
  this.itemType(); 
  
  //Default setzen
  this.setLanguage('de');
}

// ------------------------------------------------------------
// Zugriffsfunktionen
// ------------------------------------------------------------

// -----------
// language(string)
// -----------
//
// Beschreibung:
// -------------
//

Item.prototype.language = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      focus();
      throw new Error("ArgumentError:noString!");
    }
    this._language = str;
  }
  return this._language;
}

// -----------
// id(str)
// -----------
//
// Beschreibung:
// -------------
//

Item.prototype.id = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      focus();
      throw new Error("ArgumentError:noString!");
    }
    this._id = str;
  }
  return this._id;
}

// -----------
// title(str)
// -----------
//
// Beschreibung:
// -------------
//

Item.prototype.title = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      focus();
      throw new Error("ArgumentError:noString!");
    }
    this._title = str;
  }
  return this._title;
}

// -----------
// orderNumber(str)
// -----------
//
// Beschreibung:
// -------------
//

Item.prototype.orderNumber = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      focus();
      throw new Error("ArgumentError:noString!");
    }
    this._orderNumber = str;
  }
  return this._orderNumber;
}

// -----------
// price(n)
// -----------
//
// Beschreibung:
// -------------
//

Item.prototype.price = function(n) {
  if (arguments.length) {
    if (!ShopUtils.checkNumber(n)) {
      focus();
      throw new Error("ArgumentError:notANumber");
    }
    n = ShopUtils.checkNumber(n);
    this._price = n;
  }
  return this._price;
}

// --------------
// propertyMap(arr)
// --------------
//
// Beschreibung:
// -------------
//

Item.prototype.propertyMap = function(arr) {
  if (arguments.length) {
    if (! arr instanceof Array) {
      focus();
      throw new Error("ArgumentError:noObjectFromClassArray!");
    }
    this._propertyMap = arr;
  }
  return this._propertyMap;
}

// --------------
// itemType(obj)
// --------------
//
// Beschreibung:
// -------------
//

Item.prototype.itemType = function(obj) {
  if (arguments.length) {
    if (! obj instanceof ItemType) {
      focus();
      throw new Error("ArgumentError:noObjectFromClassItemType!");
    }
    this._itemType = obj;
  }
  return this._itemType;
}

// ------------------------------------------------------------
// Private Instanzmethoden
// ------------------------------------------------------------

// -------------------------------------------
// _setID()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// this._setID();
//

Item.prototype._setID = function(str) { 
  if (arguments.length) {
    str = ShopUtils.stripSpace(str);
    if (typeof str != "string") {
      focus();
      throw new Error("ArgumentError:noString!");
    }
    this.id(str);
  }
}

// ------------------------------------------------------------
// Öffentliche Instanzmethoden
// ------------------------------------------------------------

// -------------------------------------------
// setLanguage()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// this.setLanguage();
//

Item.prototype.setLanguage = function(str) { 
  if (arguments.length) {
    str = ShopUtils.stripSpace(str);
    if (typeof str != "string") {
      focus();
      throw new Error("ArgumentError:noString!");
    }
    this.language(str);
  }
}

// -------------------------------------------
// setTitle()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// this.setTitle();
//

Item.prototype.setTitle = function(str) { 
  if (arguments.length) {
    str = ShopUtils.stripSpace(str);
    if (typeof str != "string") {
      focus();
      throw new Error("ArgumentError:noString!");
    }
    this.title(str);
  }
}

// -------------------------------------------
// setOrderNumber()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// this.setOrderNumber();
//

Item.prototype.setOrderNumber = function(str) { 
  if (arguments.length) {
    str = ShopUtils.stripSpace(str);
    if (typeof str != "string") {
      focus();
      throw new Error("ArgumentError:noString!");
    }
    this.orderNumber(str);
  }
}

// -----------
// setPrice(n)
// -----------
//
// Beschreibung:
// -------------
//

Item.prototype.setPrice = function(n) {
  if (arguments.length) {
    n = ShopUtils.stripSpace(n);
    if (!ShopUtils.checkNumber(n)) {
      n = 0;
    }
    n = ShopUtils.checkNumber(n);
    this.price(n);
  }
}

// -------------------------------------------
// setPropertyMap()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// this.setPropertyMap();
//

Item.prototype.setPropertyMap = function(arr) {
  if (arguments.length) {
    if (! arr instanceof Array) {
      focus();
      throw new Error("ArgumentError:noObjectFromClassArray!");
    }
    for (var i in arr){
      if (! arr[i] instanceof ItemProperty) {
        focus();
        throw new Error("ItemError:noObjectFromClassItemProperty!");
      }
      var index = ShopUtils.Item_SetPropertyMap_getIndexFromArray(this.itemType().propertyDefinitionList(), arr[i].name());
      if (index == undefined){
        focus();
        throw new Error("ItemError:noDefinitionForItemProperty='"+ arr[i].name() +"'!");
      }
      if (this.itemType().propertyDefinitionList()[parseFloat(index)].type() == 'text-einzeilig'){
        if (typeof arr[i].value() != "string") {
          focus();
          throw new Error("ItemError:ItemPropertyNoString='"+ arr[i].name() +"'!");
        }
      }
      if (this.itemType().propertyDefinitionList()[parseFloat(index)].type() == 'text-mehrzeilig'){
        if (typeof arr[i].value() != "string") {
          focus();
          throw new Error("ItemError:ItemPropertyNoString='"+ arr[i].name() +"'!");
        }
      }
      if (this.itemType().propertyDefinitionList()[parseFloat(index)].type() == 'float'){
        if (ShopUtils.checkFloat(arr[i].value()) == undefined) {
          focus();
          throw new Error("ItemError:ItemPropertyNoFloat='"+ arr[i].name() +"'!");
        }
      }
      if (this.itemType().propertyDefinitionList()[parseFloat(index)].type() == 'integer'){
        if (ShopUtils.checkInteger(arr[i].value()) == undefined) {
          focus();
          throw new Error("ItemError:ItemPropertyNoInteger='"+ arr[i].name() +"'!");
        }
      }
      if (this.itemType().propertyDefinitionList()[parseFloat(index)].type() == 'decimal'){
        if (ShopUtils.checkDecimal(arr[i].value()) == undefined) {
          focus();
          throw new Error("ItemError:ItemPropertyNoDecimal='"+ arr[i].name() +"'!");
        }
      }
      if (this.itemType().propertyDefinitionList()[parseFloat(index)].type() == 'liste'){
        if (! arr[i].value() instanceof Array) {
          focus();
          throw new Error("ItemError:ItemPropertyNoArray!");
        }
      }
    }
    this.propertyMap(arr);
  }
}

// -------------------------------------------
// setItemType()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// this.setItemType();
//

Item.prototype.setItemType = function(obj) {
  if (arguments.length) {
    if (! obj instanceof ItemType) {
      focus();
      throw new Error("ArgumentError:noObjectFromClassItemType!");
    }
    this.itemType(obj);
  }
}

// -------------------------------------------
// getFormatedPrice()
// -------------------------------------------
//
// Beschreibung:
// -------------
//

Item.prototype.getFormatedPrice = function() {
  if (this.price()){
    return ShopUtils.formatCashFloat(this.price());
  }
  return '0,00';
}

// ------------------------------------------------------------
// Private Klasseneigenschaften
// ------------------------------------------------------------

// ------------------------------------------------------------
// Öffentliche Klasseneigenschaften
// ------------------------------------------------------------

Item.Instance = {};
Item.ID = [];

// ------------------------------------------------------------
// Private Klassenmethoden
// ------------------------------------------------------------

// -------------------------------------------
// Item._CreateIndex()
// -------------------------------------------
//
// Beschreibung:
// -------------
// Methode erstellt eindeutige ID;
//
// Beispiel:
// ---------
// Item._CreateIndex();
//

Item._CreateIndex = function(id) {
  var index = id;
  if (index == undefined){
    Item.ID.push('');
    index = Item.ID.length;
  }  
  index = index.toString();
  return index;
}

// -------------------------------------------
// Item._SetInstance()
// -------------------------------------------
//
// Beschreibung:
// -------------
// Methode erstellt Item-Objekt und registriert Objekt in Array Item.Instance;
//
// Beispiel:
// ---------
// Item._SetInstance();
//

Item._SetInstance = function(id) {
  if (Item.Instance[id] == undefined){
    Item.Instance[id] = new Item();
    Item.Instance[id]._setID(id);
  }  
}

// ------------------------------------------------------------
// Öffentliche Klassenmethoden
// ------------------------------------------------------------

// -------------------------------------------
// Item.GetInstance()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// Item.getInstance();
//

Item.GetInstance = function(id) {
  if (id == undefined){
    var index = Item.ID.length;
    index = index.toString();
    return Item.Instance[index];
  } else {
    if (Item.Instance[id] == undefined){
      focus();
      throw new Error("System-Error:NoObject-InstanceWithID='" + id +"'");
    } else {
      return Item.Instance[id];
    }
  }
}


// -------------------------------------------
// Item.CreateInstance(id)
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// Item.CreateInstance(id);
//

Item.CreateInstance = function(id) {  
  // defaultArguments
  var index = Item._CreateIndex(id);
  Item._SetInstance(index);
  return Item.GetInstance(index);
}

// ------------------------------------------------------------
// toString()
// ------------------------------------------------------------

Item.prototype.toString = function() {
  // zunaechst an Methode der Basisklasse weiterleiten
  //return Object.prototype.toString.apply(this);
  var str = new String('');
  str += 'Item:\n'
  str += 'language = ' + this.language() +'\n';
  str += 'id = ' + this.id() +'\n';
  str += 'orderNumber = ' + this.orderNumber() +'\n';
  str += 'title = ' + this.title() +'\n';
  str += 'price = ' + this.price() +'\n';
  str += '\n';
  str += 'propertyMap:\n';
  str += '\n';
  for (var i in this.propertyMap()){
    str += i.toString() +' = ' + this.propertyMap()[i].toString() +'\n';
  }
  str += 'typ = ' + this.itemType().toString() +'\n';
  return str;
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// ENDE ITEM
/////////////////////////////////////////////////////////////////////////////////////////////////////////////


// ============================================================
// Klasse ITEMPROPERTY
// ============================================================

// ------------------------------------------------------------
// Konstruktor
// ------------------------------------------------------------

// ---------------------------------------
// ItemProperty()
// ---------------------------------------
//
// Beschreibung:
// -------------
// Konstruiert ein ItemProperty Objekt.
//
// Beispiel:
// ---------
// 

function ItemProperty() {  
  // Attribute
  this._language = undefined;
  this._name = undefined;  
  this._value = undefined; 
  
  // Initialisierungen
  this.language();
  this.name();
  this.value();
  
  //Default setzen
  this.setLanguage('de');
}

// ------------------------------------------------------------
// Zugriffsfunktionen
// ------------------------------------------------------------

// -----------
// language(string)
// -----------
//
// Beschreibung:
// -------------
//

ItemProperty.prototype.language = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      focus();
      throw new Error("ArgumentError:noString!");
    }
    this._language = str;
  }
  return this._language;
}

// -----------
// name(str)
// -----------
//
// Beschreibung:
// -------------
//

ItemProperty.prototype.name = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      focus();
      throw new Error("ArgumentError:noString!");
    }
    this._name = str;
  }
  return this._name;
}

// -----------
// typ(str)
// -----------
//
// Beschreibung:
// -------------
//

ItemProperty.prototype.value = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      focus();
      throw new Error("ArgumentError:noString!");
    }
    this._value = str;
  }
  return this._value;
}

// ------------------------------------------------------------
// Private Instanzmethoden
// ------------------------------------------------------------

// ------------------------------------------------------------
// Öffentliche Instanzmethoden
// ------------------------------------------------------------

// -------------------------------------------
// setLanguage()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// this.setLanguage();
//

ItemProperty.prototype.setLanguage = function(str) { 
  if (arguments.length) {
    if (typeof str != "string") {
      focus();
      throw new Error("ArgumentError:noString!");
    }
    this.language(str);
  }
}

// -------------------------------------------
// setName()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// this.setName();
//

ItemProperty.prototype.setName = function(str) { 
  if (arguments.length) {
    str = ShopUtils.stripSpace(str);
    if (typeof str != "string") {
      focus();
      throw new Error("ArgumentError:noString!");
    }
    this.name(str);
  }
}

// -------------------------------------------
// setValue()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// this.setValue();
//

ItemProperty.prototype.setValue = function(str) { 
  if (arguments.length) {
    str = ShopUtils.stripSpace(str);
    if (typeof str != "string") {
      focus();
      throw new Error("ArgumentError:noString!");
    }
    this.value(str);
  }
}

// ------------------------------------------------------------
// Private Klasseneigenschaften
// ------------------------------------------------------------

// ------------------------------------------------------------
// Öffentliche Klasseneigenschaften
// ------------------------------------------------------------

ItemProperty.Instance = [];
ItemProperty.ID = [];

// ------------------------------------------------------------
// Private Klassenmethoden
// ------------------------------------------------------------

// -------------------------------------------
// ItemProperty._CreateIndex()
// -------------------------------------------
//
// Beschreibung:
// -------------
// Methode erstellt eindeutige ID;
//
// Beispiel:
// ---------
// ItemProperty._CreateIndex();
//

ItemProperty._CreateIndex = function() {
  ItemProperty.ID.push('');
  index = ItemProperty.ID.length;
  return index;
}

// -------------------------------------------
// ItemProperty._SetInstance()
// -------------------------------------------
//
// Beschreibung:
// -------------
// Methode erstellt ItemProperty-Objekt und registriert Objekt in Array ItemProperty.Instance;
//
// Beispiel:
// ---------
// ItemProperty._SetInstance();
//

ItemProperty._SetInstance = function(id) {
  if (ItemProperty.Instance[id] == undefined){
    ItemProperty.Instance[id] = new ItemProperty();
  }  
}

// ------------------------------------------------------------
// Öffentliche Klassenmethoden
// ------------------------------------------------------------

// -------------------------------------------
// ItemProperty.GetInstance()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// ItemProperty.getInstance();
//

ItemProperty.GetInstance = function() {
  return ItemProperty.Instance[ItemProperty.Instance.length-1];
}


// -------------------------------------------
// ItemProperty.CreateInstance()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// ItemProperty.CreateInstance();
//

ItemProperty.CreateInstance = function() {  
  // defaultArguments
  var index = ItemProperty._CreateIndex();
  ItemProperty._SetInstance(index);
  return ItemProperty.GetInstance();
}

// ------------------------------------------------------------
// toString()
// ------------------------------------------------------------

ItemProperty.prototype.toString = function() {
  // zunaechst an Methode der Basisklasse weiterleiten
  //return Object.prototype.toString.apply(this);
  var str = new String('');
  str += 'ItemProperty:\n'
  str += 'language = ' + this.language() +'\n';
  str += 'name = ' + this.name() +'\n';
  str += 'value = ' + this.value() +'\n';
  return str;
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// ENDE ITEMPROPERTY
/////////////////////////////////////////////////////////////////////////////////////////////////////////////

// ============================================================
// Klasse ITEMTYPE
// ============================================================

// ------------------------------------------------------------
// Konstruktor
// ------------------------------------------------------------

// ---------------------------------------
// ItemType()
// ---------------------------------------
//
// Beschreibung:
// -------------
// Konstruiert ein ItemType Objekt.
//
// Beispiel:
// ---------
// 

function ItemType() {  
  // Attribute
  this._language = undefined;
  this._title = undefined;  
  this._name = undefined;
  this._propertyDefinitionList = [];
  
  // Initialisierungen
  this.language();
  this.title();
  this.name();
  this.propertyDefinitionList(); 
  
  //Default setzen
  this.setLanguage('de');
}

// ------------------------------------------------------------
// Zugriffsfunktionen
// ------------------------------------------------------------

// -----------
// language(string)
// -----------
//
// Beschreibung:
// -------------
//

ItemType.prototype.language = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      focus();
      throw new Error("ArgumentError:noString!");
    }
    this._language = str;
  }
  return this._language;
}

// -----------
// title(str)
// -----------
//
// Beschreibung:
// -------------
//

ItemType.prototype.title = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      focus();
      throw new Error("ArgumentError:noString!");
    }
    this._title = str;
  }
  return this._title;
}

// -----------
// name(str)
// -----------
//
// Beschreibung:
// -------------
//

ItemType.prototype.name = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      focus();
      throw new Error("ArgumentError:noString!");
    }
    this._name = str;
  }
  return this._name;
}

// --------------
// propertyDefinitionList(arr)
// --------------
//
// Beschreibung:
// -------------
//

ItemType.prototype.propertyDefinitionList = function(arr) {
  if (arguments.length) {
    if (! arr instanceof Array) {
      focus();
      throw new Error("ArgumentError:noObjectFromClassArray!");
    }
    this._propertyDefinitionList = arr;
  }
  return this._propertyDefinitionList;
}

// ------------------------------------------------------------
// Private Instanzmethoden
// ------------------------------------------------------------

// ------------------------------------------------------------
// Öffentliche Instanzmethoden
// ------------------------------------------------------------

// -------------------------------------------
// setLanguage()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// this.setLanguage();
//

ItemType.prototype.setLanguage = function(str) { 
  if (arguments.length) {
    str = ShopUtils.stripSpace(str);
    if (typeof str != "string") {
      focus();
      throw new Error("ArgumentError:noString!");
    }
    this.language(str);
  }
}

// -------------------------------------------
// setTitle()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// this.setTitle();
//

ItemType.prototype.setTitle = function(str) { 
  if (arguments.length) {
    str = ShopUtils.stripSpace(str);
    if (typeof str != "string") {
      focus();
      throw new Error("ArgumentError:noString!");
    }
    this.title(str);
  }
}

// -------------------------------------------
// setName()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// this.setName();
//

ItemType.prototype.setName = function(str) { 
  if (arguments.length) {
    str = ShopUtils.stripSpace(str);
    if (typeof str != "string") {
      focus();
      throw new Error("ArgumentError:noString!");
    }
    this.name(str);
  }
}

// -------------------------------------------
// setItemPropertyDefinitionList()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// this.setItemPropertyDefinitionList();
//

ItemType.prototype.setItemPropertyDefinitionList = function(arr) {
  if (arguments.length) {
    if (! arr instanceof Array) {
      focus();
      throw new Error("ArgumentError:noObjectFromClassArray!");
    }
    this.propertyDefinitionList(arr);
  }
}

// ------------------------------------------------------------
// Private Klasseneigenschaften
// ------------------------------------------------------------

// ------------------------------------------------------------
// Öffentliche Klasseneigenschaften
// ------------------------------------------------------------

ItemType.Instance = {};
ItemType.ID = [];

// ------------------------------------------------------------
// Private Klassenmethoden
// ------------------------------------------------------------

// -------------------------------------------
// ItemType._CreateIndex()
// -------------------------------------------
//
// Beschreibung:
// -------------
// Methode erstellt eindeutige ID;
//
// Beispiel:
// ---------
// ItemType._CreateIndex();
//

ItemType._CreateIndex = function(id) {
  var index = id;
  if (index == undefined){
    ItemType.ID.push('');
    index = ItemType.ID.length;
  }  
  index = index.toString();
  return index;
}

// -------------------------------------------
// ItemType._SetInstance()
// -------------------------------------------
//
// Beschreibung:
// -------------
// Methode erstellt ItemType-Objekt und registriert Objekt in Array ItemType.Instance;
//
// Beispiel:
// ---------
// ItemType._SetInstance();
//

ItemType._SetInstance = function(id) {
  if (ItemType.Instance[id] == undefined){
    ItemType.Instance[id] = new ItemType();
  }  
}

// ------------------------------------------------------------
// Öffentliche Klassenmethoden
// ------------------------------------------------------------

// -------------------------------------------
// ItemType.GetInstance()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// ItemType.getInstance();
//

ItemType.GetInstance = function(id) {
  if (id == undefined){
    var index = ItemType.ID.length;
    index = index.toString();
    return ItemType.Instance[index];
  } else {
    if (ItemType.Instance[id] == undefined){
      focus();
      throw new Error("System-Error:NoObject-InstanceWithID='" + id +"'");
    } else {
      return ItemType.Instance[id];
    }
  }
}


// -------------------------------------------
// ItemType.CreateInstance(id)
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// ItemType.CreateInstance(id);
//

ItemType.CreateInstance = function(id) {  
  // defaultArguments
  var index = ItemType._CreateIndex(id);
  ItemType._SetInstance(index);
  return ItemType.GetInstance(index);
}

// ------------------------------------------------------------
// toString()
// ------------------------------------------------------------

ItemType.prototype.toString = function() {
  // zunaechst an Methode der Basisklasse weiterleiten
  //return Object.prototype.toString.apply(this);
  var str = new String('');
  str += 'ItemType:\n'
  str += 'language = ' + this.language() +'\n';
  str += 'title = ' + this.title() +'\n';
  str += 'name = ' + this.name() +'\n';
  str += '\n';
  str += 'propertyDefinitionList: ' + this.propertyDefinitionList().length +' Items\n';
  str += '\n';
  for (var i=0; i<this.propertyDefinitionList().length; i++){
    str += 'item-'+ i +' = ' + this.propertyDefinitionList()[i].toString() +'\n';
  }
  return str;
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// ENDE ITEMTYPE
/////////////////////////////////////////////////////////////////////////////////////////////////////////////


// ============================================================
// Klasse PROPERTYDEFINITION
// ============================================================

// ------------------------------------------------------------
// Konstruktor
// ------------------------------------------------------------

// ---------------------------------------
// ItemPropertyDefinition()
// ---------------------------------------
//
// Beschreibung:
// -------------
// Konstruiert ein ItemPropertyDefinition Objekt.
//
// Beispiel:
// ---------
// 

function ItemPropertyDefinition() {  
  // Attribute
  this._language = undefined;
  this._title = undefined;  
  this._name = undefined;  
  this._typ = undefined;
  
  // Initialisierungen
  this.language();
  this.title();
  this.name();
  this.type();
  
  //Default setzen
  this.setLanguage('de');
}

// ------------------------------------------------------------
// Zugriffsfunktionen
// ------------------------------------------------------------

// -----------
// language(string)
// -----------
//
// Beschreibung:
// -------------
//

ItemPropertyDefinition.prototype.language = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      focus();
      throw new Error("ArgumentError:noString!");
    }
    this._language = str;
  }
  return this._language;
}

// -----------
// title(str)
// -----------
//
// Beschreibung:
// -------------
//

ItemPropertyDefinition.prototype.title = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      focus();
      throw new Error("ArgumentError:noString!");
    }
    this._title = str;
  }
  return this._title;
}

// -----------
// name(str)
// -----------
//
// Beschreibung:
// -------------
//

ItemPropertyDefinition.prototype.name = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      focus();
      throw new Error("ArgumentError:noString!");
    }
    this._name = str;
  }
  return this._name;
}

// -----------
// typ(str)
// -----------
//
// Beschreibung:
// -------------
//

ItemPropertyDefinition.prototype.type = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      focus();
      throw new Error("ArgumentError:noString!");
    }
    this._typ = str;
  }
  return this._typ;
}

// ------------------------------------------------------------
// Private Instanzmethoden
// ------------------------------------------------------------

// ------------------------------------------------------------
// Öffentliche Instanzmethoden
// ------------------------------------------------------------

// -------------------------------------------
// setLanguage()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// this.setLanguage();
//

ItemPropertyDefinition.prototype.setLanguage = function(str) { 
  if (arguments.length) {
    str = ShopUtils.stripSpace(str);
    if (typeof str != "string") {
      focus();
      throw new Error("ArgumentError:noString!");
    }
    this.language(str);
  }
}

// -------------------------------------------
// setTitle()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// this.setTitle();
//

ItemPropertyDefinition.prototype.setTitle = function(str) { 
  if (arguments.length) {
    str = ShopUtils.stripSpace(str);
    if (typeof str != "string") {
      focus();
      throw new Error("ArgumentError:noString!");
    }
    this.title(str);
  }
}

// -------------------------------------------
// setName()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// this.setName();
//

ItemPropertyDefinition.prototype.setName = function(str) { 
  if (arguments.length) {
    str = ShopUtils.stripSpace(str);
    if (typeof str != "string") {
      focus();
      throw new Error("ArgumentError:noString!");
    }
    this.name(str);
  }
}

// -------------------------------------------
// setTyp()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// this.setTyp();
//

ItemPropertyDefinition.prototype.setTyp = function(str) { 
  if (arguments.length) {
    str = ShopUtils.stripSpace(str);
    if (typeof str != "string") {
      focus();
      throw new Error("ArgumentError:noString!");
    }
    this.type(str);
  }
}

// ------------------------------------------------------------
// Private Klasseneigenschaften
// ------------------------------------------------------------

// ------------------------------------------------------------
// Öffentliche Klasseneigenschaften
// ------------------------------------------------------------

ItemPropertyDefinition.Instance = [];
ItemPropertyDefinition.ID = [];

// ------------------------------------------------------------
// Private Klassenmethoden
// ------------------------------------------------------------

// -------------------------------------------
// ItemPropertyDefinition._CreateIndex()
// -------------------------------------------
//
// Beschreibung:
// -------------
// Methode erstellt eindeutige ID;
//
// Beispiel:
// ---------
// ItemPropertyDefinition._CreateIndex();
//

ItemPropertyDefinition._CreateIndex = function() {
  ItemPropertyDefinition.ID.push('');
  index = ItemPropertyDefinition.ID.length;
  return index;
}

// -------------------------------------------
// ItemPropertyDefinition._SetInstance()
// -------------------------------------------
//
// Beschreibung:
// -------------
// Methode erstellt ItemPropertyDefinition-Objekt und registriert Objekt in Array ItemPropertyDefinition.Instance;
//
// Beispiel:
// ---------
// ItemPropertyDefinition._SetInstance();
//

ItemPropertyDefinition._SetInstance = function(id) {
  if (ItemPropertyDefinition.Instance[id] == undefined){
    ItemPropertyDefinition.Instance[id] = new ItemPropertyDefinition();
  }  
}

// ------------------------------------------------------------
// Öffentliche Klassenmethoden
// ------------------------------------------------------------

// -------------------------------------------
// ItemPropertyDefinition.GetInstance()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// ItemPropertyDefinition.getInstance();
//

ItemPropertyDefinition.GetInstance = function() {
  return ItemPropertyDefinition.Instance[ItemPropertyDefinition.Instance.length-1];
}


// -------------------------------------------
// ItemPropertyDefinition.CreateInstance()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// ItemPropertyDefinition.CreateInstance();
//

ItemPropertyDefinition.CreateInstance = function() {  
  // defaultArguments
  var index = ItemPropertyDefinition._CreateIndex();
  ItemPropertyDefinition._SetInstance(index);
  return ItemPropertyDefinition.GetInstance();
}

// ------------------------------------------------------------
// toString()
// ------------------------------------------------------------

ItemPropertyDefinition.prototype.toString = function() {
  // zunaechst an Methode der Basisklasse weiterleiten
  //return Object.prototype.toString.apply(this);
  var str = new String('');
  str += 'ItemPropertyDefinition:\n'
  str += 'language = ' + this.language() +'\n';
  str += 'title = ' + this.title() +'\n';
  str += 'name = ' + this.name() +'\n';
  str += 'typ = ' + this.type() +'\n';
  return str;
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// ENDE PROPERTYDEFINITION
/////////////////////////////////////////////////////////////////////////////////////////////////////////////

