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

  // den undefinierten Wert deklarieren
  var undefined;


// ============================================================
// Klasse Memo
// ============================================================

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

// ---------------------------------------
// Memo(string,string,string,string,string,string,string)
// ---------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
//   ...
//
function Memo(titel,nr,jahrgang,groesse,url,kategorie1,kategorie2) {
  // Attribute
  this._id = undefined;
  this._titel = undefined;
  this._nr = undefined;
  this._jahrgang = undefined;
  this._groesse = undefined;
  this._url = undefined;
  this._kategorie1 = undefined;
  this._kategorie2 = undefined;
  this._deleted = undefined;
  // Initialisierungen
  this.id(Memo._getValideId());
  this.titel(titel);
  this.nr(nr);
  this.jahrgang(jahrgang);
  this.groesse(groesse);
  this.url(url);
  this.kategorie1(kategorie1);
  this.kategorie2(kategorie2);
  this.deleted(false);
}

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

// -----------
// id(number)
// -----------
//
// Beschreibung:
// -------------
//   ...
//
Memo.prototype.id = function(number) {
  if (arguments.length) {
    if (typeof number != "number") {
      throw new Error("Argument in 'Memo.prototype.id' ist nicht vom Typ number!");
    }
    this._id = number;
  }
  return this._id;
}

// -----------
// titel(string)
// -----------
//
// Beschreibung:
// -------------
//   ...
//
Memo.prototype.titel = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      throw new Error("Argument in 'Memo.prototype.titel' ist nicht vom Typ string!");
    }
    this._titel = str;
  }
  return this._titel;
}

// -----------
// nr(string)
// -----------
//
// Beschreibung:
// -------------
//   ...
//
Memo.prototype.nr = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      throw new Error("Argument in 'Memo.prototype.nr' ist nicht vom Typ string!");
    }
    this._nr = str;
  }
  return this._nr;
}

// -----------
// jahrgang(string)
// -----------
//
// Beschreibung:
// -------------
//   ...
//
Memo.prototype.jahrgang = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      throw new Error("Argument in 'Memo.prototype.jahrgang' ist nicht vom Typ string!");
    }
    this._jahrgang = str;
  }
  return this._jahrgang;
}

// -----------
// groesse(string)
// -----------
//
// Beschreibung:
// -------------
//   ...
//
Memo.prototype.groesse = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      throw new Error("Argument in 'Memo.prototype.groesse' ist nicht vom Typ string!");
    }
    this._groesse = str;
  }
  return this._groesse;
}

// -----------
// url(string)
// -----------
//
// Beschreibung:
// -------------
//   ...
//
Memo.prototype.url = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      throw new Error("Argument in 'Memo.prototype.url' ist nicht vom Typ string!");
    }
    this._url = str;
  }
  return this._url;
}

// -----------
// kategorie1(string)
// -----------
//
// Beschreibung:
// -------------
//   ...
//
Memo.prototype.kategorie1 = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      throw new Error("Argument in 'Memo.prototype.kategorie1' ist nicht vom Typ string!");
    }
    this._kategorie1 = str;
  }
  return this._kategorie1;
}

// -----------
// kategorie2(string)
// -----------
//
// Beschreibung:
// -------------
//   ...
//
Memo.prototype.kategorie2 = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      throw new Error("Argument in 'Memo.prototype.kategorie2' ist nicht vom Typ string!");
    }
    this._kategorie2 = str;
  }
  return this._kategorie2;
}

// -----------
// deleted(boolean)
// -----------
//
// Beschreibung:
// -------------
//   ...
//
Memo.prototype.deleted = function(bool) {
  if (arguments.length) {
    if (typeof bool != "boolean") {
      throw new Error("Argument in 'Memo.prototype.deleted' ist nicht vom Typ boolean!");
    }
    this._deleted = bool;
  }
  return this._deleted;
}

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

// ---------------------------------------
// xxx(VariablenTypXxx1, VariablenTypXxx2)
// ---------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
//   ...
//
Memo.prototype.xxx = function(VariablenNameXxx1, VariablenNameXxx2) {
  // ...
}

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

// ----------------------------------------
// xxx(VariablenTypXxx1, VariablenTypXxx2)
// ----------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
//   ...
//
Memo.prototype.xxx = function(VariablenNameXxx1, VariablenNameXxx2) {
  // ...
}


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

Memo.xxx = undefined;


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

Memo._itemList = [];


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

// -------------------------------------------
// Memo.getItemList()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
//   ...
//
Memo.getItemList = function() {

  return Memo._itemList;

}

// -------------------------------------------
// Memo.deleteItem(string)
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
//   ...
//
Memo.deleteItem = function(id) {

  var deleted;

  if (Memo._itemList[id]) {
    var deleted = Memo._itemList[id].deleted(true);
  }

  return deleted;

}


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

// -------------------------------------------
// Memo._getValideId()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
//   ...
//
Memo._getValideId = function() {

  var newId;
  var currentItemList = [];
  currentItemList = Memo.getItemList();

  newId = currentItemList.length;

  return newId;

}

// -------------------------------------------
// Memo.createInstance(string,string,string,string,string,string,string)
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
//   ...
//
Memo.createInstance = function(titel,nr,jahrgang,groesse,url,kategorie1,kategorie2) {

  var tempMemo = new Memo(titel,nr,jahrgang,groesse,url,kategorie1,kategorie2);

  Memo._itemList[Memo._itemList.length] = tempMemo;

  //alert('Der Wein \n"' + titel + '"\n wurde auf dem Merkzettel notiert.');
  alert('Der Wein \n"' + titel + '"\n wurde auf dem Merkzettel notiert. \n \n Um Ihren Merkzettel aufzurufen, klicken Sie bitte am \n Anfang der Seite auf den Link \"virtueller Merkzettel\".');

}


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

Memo.prototype.toString = function() {
  // zunaechst an Methode der Basisklasse weiterleiten
  return Object.prototype.toString.apply(this);
}
