//Bookmarksammlung

function Erstelle_Bookmarks()
{
  Bookmarking();
  AusgabeBookmark = "";
  for (i=0; i<Bookmark.length ; i++ )
  {
    B_Bookmark = Bookmark[i].split("|");
    B_Name = B_Bookmark[0];
    B_Bild = B_Bookmark[1];
    B_URL = B_Bookmark[2];
    B_Hinzufuegen = B_Bookmark[3];
    AusgabeBookmark += "<a href=\""+B_Hinzufuegen+"\" title=\"Diese Seite zu "+B_Name+" hinzufügen\" target=\"_blank\"><img src=\"Bilder/Symbole/bookmarks/"+B_Bild+"\" alt=\"Diese Seite zu "+B_Name+" hinzufügen\" border=\"0\" width=\"16\" height=\"16\" \/></a> ";
  }
  document.writeln(AusgabeBookmark);

  return;
}

function Bookmarking()
{
  zeile = 0;
  Bookmark = new Array();
  //Name | Bild | URL | onKlick
  Bookmark[zeile] = "Del.icio.us|delicious.png|http://www.del.icio.us|http://del.icio.us/post?v=2&amp;url="+encodeURIComponent(location.href)+"&amp;notes=&amp;tags=&amp;title="+encodeURIComponent(document.title);
  zeile += 1;

  Bookmark[zeile] = "Digg|digg.png|http://www.digg.com|http://digg.com/submit?phase=2&amp;url="+encodeURIComponent(location.href)+"&amp;bodytext=&amp;tags=&amp;title="+encodeURIComponent(document.title);
  zeile += 1;

  Bookmark[zeile] = "Facebook|facebook.png|http://www.facebook.com|http://www.facebook.com/sharer.php?u="+encodeURIComponent(location.href)+"&amp;t="+encodeURIComponent(document.title);
  zeile += 1;

  Bookmark[zeile] = "Favoriten|favoriten.gif|http://www.favoriten.de|http://www.favoriten.de/url-hinzufuegen.html?bm_url="+encodeURIComponent(location.href)+"&amp;bm_title="+encodeURIComponent(document.title);
  zeile += 1;

  Bookmark[zeile] = "Google|google.png|http://www.google.com|http://www.google.com/bookmarks/mark?op=add&amp;hl=de&amp;bkmk="+encodeURIComponent(location.href)+"&amp;annotation=&amp;labels=&amp;title="+encodeURIComponent(document.title);
  zeile += 1;

  Bookmark[zeile] = "Linkarena|linkarena.png|http://www.linkarena.com|http://linkarena.com/bookmarks/addlink/?url="+encodeURIComponent(location.href)+"&amp;title="+encodeURIComponent(document.title)+"&amp;desc=&amp;tags=";
  zeile += 1;

  Bookmark[zeile] = "Live MSN|live.png|http://favorites.live.com/|https://favorites.live.com/quickadd.aspx?marklet=1&mkt=en-us&url="+encodeURIComponent(location.href)+"&amp;title="+encodeURIComponent(document.title);
  zeile += 1;

  Bookmark[zeile] = "Mister Wong|misterwong.png|http://www.mister-wong.de/add_url/\|http://www.mister-wong.de/index.php?action=addurl&amp;bm_url="+encodeURIComponent(location.href)+"&amp;bm_description="+encodeURIComponent(document.title);
  zeile += 1;

  Bookmark[zeile] = "My Space|myspace.png|http://www.myspace.com|http://www.myspace.com/index.cfm?fuseaction=postto&u="+encodeURIComponent(location.href)+"&amp;bm_description="+encodeURIComponent(document.title);
  zeile += 1;

  Bookmark[zeile] = "Newsvine|newsvine.png|http://www.newsvine.com|http://www.newsvine.com/_wine/save?popoff=1&amp;u="+encodeURIComponent(location.href)+"&amp;tags=&amp;blurb="+encodeURIComponent(document.title);
  zeile += 1;

  Bookmark[zeile] = "Reddit|reddit.png|http://www.reddit.com|http://reddit.com/submit?url="+encodeURIComponent(location.href)+"&amp;tags=&amp;blurb="+encodeURIComponent(document.title);
  zeile += 1;

  Bookmark[zeile] = "studiVZ|studivz.gif|http://www.studivz.net|http://www.studivz.net/Suggest/Selection/?u="+encodeURIComponent(location.href)+"&amp;tags=&amp;blurb="+encodeURIComponent(document.title);
  zeile += 1;

  Bookmark[zeile] = "StumbleUpon|stumbleupon.png|http://www.stumbleupon.com|http://www.stumbleupon.com/submit?url="+encodeURIComponent(location.href)+"&amp;title="+encodeURIComponent(document.title);
  zeile += 1;

  Bookmark[zeile] = "Twitter|twitter.png|http://www.twitter.com|http://twitter.com/home?status="+encodeURIComponent(location.href)+"&amp;title="+encodeURIComponent(document.title);
  zeile += 1;

  Bookmark[zeile] = "YahooMyWeb|yahoomyweb.png|http://yahoo-myweb.social-web.tel/|http://myweb2.search.yahoo.com/myresults/bookmarklet?t="+encodeURIComponent(document.title)+"&d=&tag=&u="+encodeURIComponent(location.href);
  zeile += 1;

  Bookmark[zeile] = "Y!GG|yigg.png|http://www.yigg.de/|http://yigg.de/neu?exturl="+encodeURIComponent(location.href);
  zeile += 1;

  return;
}


function Finde_alle_Bilder()
{
  zaehler = 0;
  AnzeigeBilder = new Array();
  AlleBilder = document.getElementsByTagName("img");
  for (i=0; i<AlleBilder.length ; i++ )
  {
    if((AlleBilder[i].src).indexOf("_vs") != -1)
    {
      if((AlleBilder[i].alt)[0] != "-")
      {
        AnzeigeBilder[zaehler] = new Array()
        AnzeigeBilder[zaehler].Dateiname = (AlleBilder[i].src);
        AnzeigeBilder[zaehler].Text = AlleBilder[i].alt;
        AnzeigeBilder[zaehler].Kategorie = AlleBilder[i].title;
        zaehler++;
      }
    }
  }
  return;
}


function Bildfenster_oeffnen(datname,kat)
{
  document.getElementById("Bilderanzeige_Bildbeschr").firstChild.data = "&nbsp;";
  document.getElementById("Bilderanzeige_Bild").src = "Bilder/Bilder_global/Grafik_laden.JPG";
  Bildfensterhoehe = 520;
  Bildfensterbreite = 620;
  Bildnummer = 0;
  for(i=0; i<AnzeigeBilder.length; i++)
  {
    if((AnzeigeBilder[i].Dateiname).indexOf(datname) != -1) break;
  }

  Bildnummer = i;
  Bild_Kategorie = ((AnzeigeBilder[Bildnummer].Kategorie == "") ? "Bildanzeige" : AnzeigeBilder[Bildnummer].Kategorie);

  temp_AnzeigeBilder = new Array();
  z=0;
  for(i=0; i<AnzeigeBilder.length; i++)
  {
    if((AnzeigeBilder[i].Kategorie).indexOf(Bild_Kategorie) != -1)
    {
      temp_AnzeigeBilder[z] = new Array();
      temp_AnzeigeBilder[z].Dateiname = AnzeigeBilder[i].Dateiname;
      temp_AnzeigeBilder[z].Text = AnzeigeBilder[i].Text;
      temp_AnzeigeBilder[z].Kategorie = AnzeigeBilder[i].Kategorie;
      z++;
    }
  }


  for(i=0; i<temp_AnzeigeBilder.length; i++)
  {
    if((temp_AnzeigeBilder[i].Dateiname).indexOf(datname) != -1) break;
  }

  Bildnummer = i;
  bZaehler = (datname.split(".")).length;
  Bild_Dateiendung = datname.split(".")[(bZaehler-1)];
  Bild_Dateiname = temp_AnzeigeBilder[Bildnummer].Dateiname.split("_vs")[0] + "." + Bild_Dateiendung;
  Bild_Beschreibung = temp_AnzeigeBilder[Bildnummer].Text;
  Bild_Kategorie = ((temp_AnzeigeBilder[Bildnummer].Kategorie == "") ? "Bildanzeige" : temp_AnzeigeBilder[Bildnummer].Kategorie);

  if(document.documentElement.clientWidth >= 0)
  {
    Fensterbreite = document.documentElement.clientWidth;
    Fensterhoehe = document.documentElement.clientHeight;
  }
  else
  {
    Fensterbreite = window.innerWidth;
    Fensterhoehe = window.innerHeight;
  }


  if(document.documentElement.scrollTop >= 0)
  {
    neue_xPos = Math.ceil(document.documentElement.scrollLeft + (Fensterbreite - Bildfensterbreite) / 2);
    neue_yPos = Math.ceil(document.documentElement.scrollTop + (Fensterhoehe - Bildfensterhoehe) / 2);

  }
  else
  {
    neue_xPos = Math.ceil(window.pageXOffset + (Fensterbreite - Bildfensterbreite) / 2);
    neue_yPos = Math.ceil(window.pageYOffset + (Fensterhoehe - Bildfensterhoehe) / 2);
  }

  neue_xPos = ((neue_xPos < 1)? 1 : neue_xPos);
  neue_yPos = ((neue_yPos < 1)? 1 : neue_yPos);

  document.getElementById("Bilderanzeige").style.left = neue_xPos + "px";
  document.getElementById("Bilderanzeige").style.top = neue_yPos + "px";
  document.getElementById("Bilderanzeige_Bild").src = Bild_Dateiname;
  document.getElementById("Bilderanzeige_Bildbeschr").firstChild.data = Bild_Beschreibung;
  document.getElementById("Bilderanzeige_Kategorie").firstChild.data = Bild_Kategorie;
  if(Bildnummer < (temp_AnzeigeBilder.length-1))
  {
    document.getElementById("Bilderanzeige_nachR").firstChild.href="javascript:Bildfenster_oeffnen('"+temp_AnzeigeBilder[Bildnummer+1].Dateiname+"')";
    Zeige_Objekt("Bilderanzeige_nachR");
  }
  if(Bildnummer > 0)
  {
    document.getElementById("Bilderanzeige_nachL").firstChild.href="javascript:Bildfenster_oeffnen('"+temp_AnzeigeBilder[Bildnummer-1].Dateiname+"')";
    Zeige_Objekt("Bilderanzeige_nachL");
  }
  if(Bildnummer == 0) Verstecke_Objekt("Bilderanzeige_nachL");
  if(Bildnummer == (temp_AnzeigeBilder.length-1)) Verstecke_Objekt("Bilderanzeige_nachR");

  Zeige_Objekt("Bilderanzeige");

  document.getElementById("Schatten").style.left = "0px";
  document.getElementById("Schatten").style.top = "0px";

  t1 = document.body.scrollHeight;
  t2 = document.body.offsetHeight;
  if (t1 > t2)
  {
    seitenbreite = document.body.scrollWidth;
    seitenhoehe = document.body.scrollHeight;
  }
  else
  {
    seitenbreite = document.body.offsetWidth;
    seitenhoehe = document.body.offsetHeight;
  }
  document.getElementById("Schatten").style.width = seitenbreite + "px";
  document.getElementById("Schatten").style.height = seitenhoehe + "px";
  Zeige_Objekt("Schatten");

  return;
}

function Zeige_Objekt(Objektname)
{
  document.getElementById(Objektname).style.visibility = "visible";
  return;
}

function Verstecke_Objekt(Objektname)
{
  if(Objektname == "Bilderanzeige")
  {
    document.getElementById("Bilderanzeige_nachL").style.visibility = "hidden";
    document.getElementById("Bilderanzeige_nachR").style.visibility = "hidden";
  }
  document.getElementById(Objektname).style.visibility = "hidden";
  return;
}
