
// Gaga Slide Show fuer M.Goto
// Copyright: BrunO Zacke, Berlin 28.08.2004
// http://www.ufocomes.de

// --------------Data Fotos----------------------

// Fotos fuer Slideshow 1:

var slideShow1 = new Array (
"../gaga/mg113.jpg",
"../gaga/mg108.jpg",
"../gaga/mg102.jpg",
"../gaga/mg103.jpg",
"../gaga/mg107.jpg",
"../gaga/mg104.jpg",
"../gaga/mg105.jpg",
"../gaga/mg106.jpg",
"../gaga/mg111.jpg",
"../gaga/mg110.jpg",
"../gaga/mg109.jpg",
"../gaga/mg112.jpg"
);

// Fotos fuer Slideshow 2:

var slideShow2 = new Array (
"../gaga/mg201.jpg",
"../gaga/mg212.jpg",
"../gaga/mg202.jpg",
"../gaga/mg203.jpg",
"../gaga/mg204.jpg",
"../gaga/mg205.jpg",
"../gaga/mg206.jpg",
"../gaga/mg211.jpg",
"../gaga/mg207.jpg",
"../gaga/mg208.jpg",
"../gaga/mg209.jpg",
"../gaga/mg210.jpg");

// -------------------Photos zaehlen--------------

var pictures = new Array();

function photoIndex()
{
 for (var i=0; i<data.length; i++)
 {
  pictures[i] = data[i];
 }
}

// -------------auf Seite anpassen-----------------

var data = "";
var page1;

var reg = /masah\.html$/;
page1 = reg.exec(location.href);

if (page1)
 data = slideShow1;
else data = slideShow2;

photoIndex();

// ---------------Zirkus Preload--------------------

// Blenden laden:

 var black = new Image();
 black.src = "../gaga/blind.jpg";
 var white = new Image();
 white.src = "../gaga/blind2.jpg";

// Fotos vorladen:

function preLoad(num)
{
 var loaded = new Array();
 var numbers = new Array();

 if (num == 0) numbers[0] = pictures.length-1;
 else numbers[0] = num - 1;

 numbers[1] = num;

 if (num == pictures.length-1) numbers[2] = 0;
 else numbers[2] = num + 1;

 for (var i = 0; i<numbers.length; i++)
 {
  loaded[i] = new Image();
  loaded[i].src = pictures[numbers[i]];
 }
}

// ----------------Internet Explorer Special-----------------

function msie()
{
 clearView("show");

 var ae = String.fromCharCode(228);
 var Ae = String.fromCharCode(196);
 var oe = String.fromCharCode(246);
 var Oe = String.fromCharCode(214);
 var ue = String.fromCharCode(252);
 var Ue = String.fromCharCode(220);
 var sz = String.fromCharCode(223);
 var aula = String.fromCharCode(39);

 var achtung = 'Diese Galerie funktioniert mit einem neueren Mozilla am besten. Sie wurde mit dem Internet Explorer 6.0 unter Windows getestet. Die Slideshow kann ab und zu f'+ue+'r eine Weile anhalten. Das h'+ae+'ngt von Ihren Cache-Einstellungen und von der Verbindung ab. W'+ae+'hlen Sie z.B. "Bei jedem Start von IE" auf Aktualit'+ae+'t pr'+ue+'fen. Denken Sie auch daran, was f'+ue+'r ein alter Browser der IE 6.0 nun ist. Er wurde im Oktober 2001 ver'+oe+'ffentlicht! Oder nehmen Sie mit der Html-Version vorlieb.';

 var attention = 'This gallery works best with a newer Mozilla browsers. Internet Explorer 6.0 on Windows and 5.0 on Mac works too. The slideshow may halt for a while. That depends on your cache settings and connection bandwidth. Let the pages be checked "When you start IE". It'+aula+'s worth to mention, that IE 6.0 came out in Oktober 2001! Perhaps the html gallery does.';

 var joy = 'Enjoy the photos of Mr. Masahiro Goto and visit his two homepages for more!';


 note = document.createElement("div");
 note.setAttribute("width","340");
 note.setAttribute("id","notes");
 note.setAttribute("align","left");

 note_textDe = document.createTextNode(achtung);
 note.appendChild(note_textDe);

 newline = document.createElement("br");
 note.appendChild(newline);
 newline = document.createElement("br");
 note.appendChild(newline);

 note_textEn = document.createTextNode(attention);
 note.appendChild(note_textEn);

 newline = document.createElement("br");
 note.appendChild(newline);
 newline = document.createElement("br");
 note.appendChild(newline);

 enjoy = document.createElement("p");
 enjoy.setAttribute("id","joya");
 enjoy_text = document.createTextNode(joy);
 enjoy.appendChild(enjoy_text);
 note.appendChild(enjoy);

 document.getElementById("show").appendChild(note);

 newline = document.createElement("br");
 document.getElementById("show").appendChild(newline);

 accept = document.createElement("a");
 accept_text = document.createTextNode("[ O K ]");
 accept.appendChild(accept_text);
 accept.setAttribute("href","javascript:start()");
 document.getElementById("show").appendChild(accept);

 newline = document.createElement("br");
 document.getElementById("show").appendChild(newline);
 newline = document.createElement("br");
 document.getElementById("show").appendChild(newline);

 html = document.createElement("a");
 html_text = document.createTextNode("[Html]");
 html.appendChild(html_text);
 html.setAttribute("href","masah3.html");
 html.setAttribute("target","_top");
 document.getElementById("show").appendChild(html);
}

// ------------------Browser einweichen---------------------

function browsers()
{
 if(navigator.userAgent.indexOf("Safari") != -1)
  location.href ="masah3.html";
 if(navigator.userAgent.indexOf("iCab") != -1)
  location.href ="masah3.html";
// if(window.opera)
//  location.href ="masah3.html";
 if ((page1) && (navigator.userAgent.indexOf("MSIE") != -1))
  msie();
 else start();
}

// ------------------loeschen----------------------

function clearView(ID)
{
 nodes = document.getElementById(ID).childNodes;
 while (nodes.length != 0)
 {
  for (var i=0;i<nodes.length;i++)
  document.getElementById(ID).removeChild(nodes[i]);
 }
}

// ---------------Link-Hover faken-------------------

function fakeLink(ID)
{
 document.getElementById(ID).style.cursor="pointer";
 document.getElementById(ID).style.color="#ee2fef";
 document.getElementById(ID).style.textDecoration="underline";
}

function deFake(ID)
{
 document.getElementById(ID).style.color="#fbff8e";
 document.getElementById(ID).style.textDecoration="none";
}

// ---------------Verschluss auf-------------------

function unShut()
{
 if (document.getElementById("blind").height > 0)
 {
  document.getElementById("blind").width = 530;
  document.getElementById("blind").height -= 40;
  setTimeout ('unShut()',10);
 }
 else
 {
  document.getElementById("blind").width = 0;
  document.getElementById("blind").height = 0;
 }
}

// ----------------Verschluss zu------------------

function shut()
{
 if (document.getElementById("blind").width < 530)
 {
  document.getElementById("blind").height = 490;
  document.getElementById("blind").width += 53;
  setTimeout ('shut()',1);
 }
}

// ---------------Foto laden-------------------

var showMe = "";

function photoLoad()
{
 with (document.getElementById("show").style)
 {
  backgroundImage="url(" + showMe + ")";
  backgroundPosition="center";
  backgroundRepeat="no-repeat";
 }
}

// --------------Foto anzeigen-----------------

function showPhoto(photo)
{
 showMe = photo;
 shut();
 t_load = setTimeout('photoLoad()',1000);
 t_show = setTimeout('unShut()',1000);
}

// ----------------Bildwechsel------------------

var photoNumber = pictures.length-1;

function change()
{
 photoNumber++;
 if (photoNumber == pictures.length) photoNumber = 0;
 preLoad(photoNumber);
 showPhoto(pictures[photoNumber]);
 t_change = setTimeout('change()',9000);
}

// -----------Wechsel anhalten----------------

function stop()
{
 clearTimeout(t_change);
}

// ----------------------Go or Stop-----------------

function goStop()
{
 if (document.getElementById("go").firstChild.nodeValue == "[Stop]")
 {
  document.getElementById("go").firstChild.nodeValue = "[ G o ]";
  stop();
 }
 else
 {
  document.getElementById("go").firstChild.nodeValue = "[Stop]";
  change();
 }
}

// ------------------manuell vor----------------------

function forw()
{
 clearTimeout(t_change);
 clearTimeout(t_load);
 clearTimeout(t_show);
 if (document.getElementById("go").firstChild.nodeValue == "[Stop]")
 document.getElementById("go").firstChild.nodeValue = "[ G o ]";
 photoNumber++;
 if (photoNumber == pictures.length) photoNumber = 0;
 preLoad(photoNumber);
 showPhoto(pictures[photoNumber]);
}

// ------------------manuell zurueck------------------

function prew()
{
 clearTimeout(t_change);
 clearTimeout(t_load);
 clearTimeout(t_show);
 if (document.getElementById("go").firstChild.nodeValue == "[Stop]")
 document.getElementById("go").firstChild.nodeValue = "[ G o ]";
 photoNumber--;
 if (photoNumber < 0) photoNumber = pictures.length-1;
 preLoad(photoNumber);
 showPhoto(pictures[photoNumber]);
}

// -------------------Navi erzeugen-----------------------

function navi()
{
 var shutter = "";
 var link = "";
 var link_text = ""
 if(page1)
 {
 shutter = "../gaga/blind.jpg";
 link = "masah2.html"
 link_text = "[More]";
 }
 else
 {
 shutter = "../gaga/blind2.jpg";
 link = "masah.html"
 link_text = "[Home]";
 }

 image = document.createElement("img");
 image.setAttribute('src',shutter);
 image.setAttribute("id","blind");
 document.getElementById("show").appendChild(image);

 // Navigation fuer erste Seite erzeugen:
 navi_baw = document.createElement("a");
 navi_baw.setAttribute("id","baw");
 navi_baw.setAttribute("href","javascript:prew()");
 baw_v = document.createTextNode("[- ]");
 navi_baw.appendChild(baw_v);
 document.getElementById("nav1").appendChild(navi_baw);

 navi_stop = document.createElement("a");
 navi_stop.setAttribute("id","go");
 navi_stop.setAttribute("href","javascript:goStop()"),
 stop_v = document.createTextNode("[Stop]");
 navi_stop.appendChild(stop_v);
 document.getElementById("nav2").appendChild(navi_stop);

 navi_fow = document.createElement("a");
 navi_fow.setAttribute("id","fow");
 navi_fow.setAttribute("href","javascript:forw()");
 fow_v = document.createTextNode("[+]");
 navi_fow.appendChild(fow_v);
 document.getElementById("nav3").appendChild(navi_fow);

 navi_ano = document.createElement("a");
 navi_ano.setAttribute("id","ano");
 navi_ano.setAttribute("href",link);
 navi_ano.setAttribute("target","_top");
 ano_v = document.createTextNode(link_text);
 navi_ano.appendChild(ano_v);
 document.getElementById("nav4").appendChild(navi_ano);
}

// -------------------sollte mal Main werden-------------------------

function start()
{
 clearView("show");
 navi();
 change();
}