
/* 
Wie fuege ich ein neues Bild ein?

1. Das Bild in 2 Verzeichnissen abspeichern :
	\\web2000\webs\Dialogika\resource\german\images\title_img\
   	\\web2000\webs\Dialogika\resource\englisch\images\title_img\

	Bildgroesse :  width = 178 px, height = 134 px
	
2. Pro Bild ein neues Array-Element erzeugen (s.u.)

3. Fertig!

*/

// Die Funktion 'reload_img' wird onload der Home-Seite aufgerufen, 
// sie wählt zufällig ein Bild und eine String aus der Menge angegebener Bilder und alternativer Texte aus, 
// und setzt sie als Werte der entsprechenden Parameter im HTML-Code.

//Globals
var mypath = "./images/title_img/";
var lang = "de";
var rows = 4;
var cols = 4;
var imgArray;
var altArray;


function reload_img(imgID, path, lang)
{
	try 
	{
		InitArrays(lang);
		var imgNumber = imgArray.length;
		var randInd = Math.round(Math.random()*(imgNumber-1))
		document.images[imgID].src = path + imgArray[randInd];
		document.images[imgID].alt = altArray[randInd];	
	}
	catch (er)
	{}
	
}

function InitArrays(lang)
{
	try 
	{
		imgArray = new Array(); 
		imgArray[0] = "diastairs.jpg"; 
		imgArray[1] = "forest.jpg";
		imgArray[2] = "helix.jpg";
		imgArray[3] = "kaktus.jpg"; 
		imgArray[4] = "lamp.jpg";
		imgArray[5] = "leaf.jpg";
		imgArray[6] = "leafcells.jpg";
		imgArray[7] = "limb.jpg";
		imgArray[8] = "pampasgras.jpg";
		imgArray[9] = "riverside.jpg";
		imgArray[10] = "seashore.jpg"; 
		imgArray[11] = "snowlimb.jpg"; 
		imgArray[12] = "tree_neg.jpg"; 
		imgArray[13] = "wintersun.jpg";
		imgArray[14] = "panzer.jpg";
		imgArray[15] = "canyon.jpg";
		imgArray[16] = "Strohballen.jpg";
		imgArray[17] = "Hochhaus.jpg";
		imgArray[18] = "Gletscher.jpg";
		imgArray[19] = "Rose.jpg";
		imgArray[20] = "Planetarium.jpg";
		imgArray[21] = "Eiche.jpg";
		imgArray[22] = "Deepwater.jpg";
		imgArray[23] = "Tanks.jpg";
		imgArray[24] = "Berg.jpg";
		imgArray[25] = "ungeheuer.jpg";
		imgArray[26] = "planten.jpg";
		imgArray[27] = "tropfen.jpg";
		imgArray[28] = "oel.jpg";
		imgArray[29] = "hafen.jpg";
		imgArray[30] = "zustand.jpg";
		imgArray[31] = "rauschen.jpg";
		imgArray[32] = "durchkreuzt.jpg";
		imgArray[33] = "beach.jpg";
		imgArray[34] = "marche.jpg";

		imgArray[35] = "motor.jpg";
		imgArray[36] = "Abwärts.jpg";
		imgArray[37] = "Armatur.jpg";
		imgArray[38] = "Athlon.jpg";
		imgArray[39] = "Kabelsalat.jpg";
		imgArray[40] = "Stillstand.jpg";
		imgArray[41] = "NextGeneration.jpg";
		imgArray[42] = "Dampfradio.jpg";
		imgArray[43] = "TecDetail.jpg";
		imgArray[44] = "StrasseTechnik.jpg";
		
		
		// Fotowettbewerb 2007
		imgArray[45] = "Festplatte.dibr.jpg"; //Januar
		imgArray[46] = "DIaLOGIKa 2007 Bild1.jpg"; //Februar
		imgArray[47] = "Los Voladores Mexico 2007.JPG"; //Maerz
		imgArray[48] = "P1010552_bearbeitet-2.jpg"; //April
		imgArray[49] = "100_1293.jpg"; //Mai
		imgArray[50] = "rio-antirrio_clouds_20x30.jpg"; //Juni
		imgArray[51] = "No Risk - No Fun 07.jpg"; //Juli
		imgArray[52] = "IMG_0053-3.jpg"; //August
		imgArray[53] = "Ballon.JPG"; //September
		imgArray[54] = "IMG_3609_NR2.jpg"; //Oktober
		imgArray[55] = "Dynamic Station.jpg"; //November
		imgArray[56] = "001_4544.jpg"; //Dezember
			
		
		
		//	ein neues Element in imgArray erzeugen
		//	Template: imgArray[] = "*.jpg";
		
	altArray = new Array();
		if (lang == "de")
		{
			altArray[0] = "Wendeltreppe in der DIaLOGIKa, Saarbrücken 2002, Foto: Torsten Weller";
			altArray[1] = "Sonnenuntergang am Kaninchenberg, Saarbrücken 2002, Foto: Torsten Weller";
			altArray[2] = "Spiraltreppe in der Sagrada Família, Barcelona 2003, Foto: Rainer Siedle";
			altArray[3] = "Botanischer Garten der Universität des Saarlandes, Saarbrücken 2003, Foto: Wolfgang Keber";
			altArray[4] = "Lampe am Labornetzgerät, Arbeitsraum im Keller 1993, Foto: Jochen Wagner";
			altArray[5] = "Botanischer Garten der Universität des Saarlandes, Saarbrücken 2003, Foto: Wolfgang Keber";
			altArray[6] = "Trebah Garden, Südengland 2003, Foto: Wolfgang Keber";
			altArray[7] = "Glendurgan Garden, Südengland 2003, Foto: Wolfgang Keber";
			altArray[8] = "Pampasgras im Gegenlicht, Völklingen 1988, Foto: Carsten Grammes"; 
			altArray[9] = "Saarufer, Saarbrücken 2002, Foto: Torsten Weller";
			altArray[10] = "Abendstimmung am Dünenstrand von Maspalomas, Gran Canaria 1988, Foto: Carsten Grammes";
			altArray[11] = "Astspitze mit Schnee, Saarbrücken 2001, Foto: Torsten Weller";
			altArray[12] = "Wenn die Nacht zum Tag wird..., Saarbrücken 1997, Foto: Rainer Siedle";
			altArray[13] = "Wintersonne nahe der Universität des Saarlandes, Saarbrücken 1984, Foto: Manfred Ries";	
			altArray[14] = "In wachsenden Ringen, Saarbrücken 2004, Foto: Florian Jung";	
			altArray[15] = "Grand Canyon (USA), Grand Canyon 1994, Foto: Wolfgang Keber";	
			altArray[16] = "Strohballen, Saarbrücken 1984, Foto: Manfred Ries";	
			altArray[17] = "Hochhaus, Saarbrücken 1984, Foto: Kerstin Reese";	
			altArray[18] = "Gletscher, Saarbrücken 1984, Foto: Kerstin Reese";	
			altArray[19] = "Kamelienblüte, Saarbrücken 2004, Foto: Wolfgang Keber";	
			altArray[20] = "Dach zu den Sternen, Saarbrücken 2004, Foto: Christian Klein";	
			altArray[21] = "Eiche, Saarbrücken 1984, Foto: Carsten Grammes";	
			altArray[22] = "Mono Lake (USA), Mono Lake 1994, Foto: Wolfgang Keber";	
			altArray[23] = "Tanks, Saarbrücken 1984, Foto: Carsten Grammes";	
			altArray[24] = "Schichten, Saarbrücken 2004, Foto: Florian Jung";	
			altArray[25] = "Meeres-Ungeheuer-lich, Foto: Klaus Musseleck";	
			altArray[26] = "Planten un Blomen - Hamburg, Foto: Florian Jung";	
			altArray[27] = "Wassertropfen am Felsenpfad in St. Arnual, Foto: Thorsten Weller";	
			altArray[28] = "Öl, Foto: Manfred Ries";	
			altArray[29] = "Rostocker Hafen, Foto: Stephanie Bruhn";	
			altArray[30] = "Aggregatzustände, Foto: Ralf Linnebach";	
			altArray[31] = "Weißes Rauschen, Foto: Jochen Wagner";	
			altArray[32] = "Durchkreuzt, Foto: Klaus Musseleck";	
			altArray[33] = "Der Whitehaven Beach auf Whitsunday Island, Foto: Christian Lambert";	
			altArray[34] = "Place du marché, Ganvié (Bénin), Foto: Françoise Hontoy";
					
			altArray[35] = "Aus Freude am Fahren, Foto: Carsten Grammes";		
			altArray[36] = "Abwärts, Foto: Carsten Grammes";		
			altArray[37] = "Armatur, Foto: Carsten Grammes";		
			altArray[38] = "Athlon, Foto: Jochen Wagner";		
			altArray[39] = "Kabelsalat, Foto: Jochen Wagner";		
			altArray[40] = "Stillstand?, Foto: Carsten Grammes";		
			altArray[41] = "Generationskonflikt?, Foto: Manfred Ries";		
			altArray[42] = "Dampfradio, Foto: Carsten Grammes";		
			altArray[43] = "Technik in Detail, Foto: Thorsten Weller";		
			altArray[44] = "Straßen der Technik, Foto: Thorsten Weller";	
			
			
			//Fotowettbewerb 2007
			altArray[45] = "Festplatte, Foto: Dirk Brutscher";	
			altArray[46] = "Flamenco, Foto: Florian Jung";
			altArray[47] = "Los Voladores Mexico, Foto: Joachim Walter";
			altArray[48] = "Fahrradrennen, Foto: Wolfgang Keber";
			altArray[49] = "Karussell, Foto: Klaus Musseleck";
			altArray[50] = "Rio Antirrio Clouds, Foto: Wilhelmus van Gemert";
			altArray[51] = "No Risk - No Fun, Foto: Josef Hinterleitner";
			altArray[52] = "Abenteuer, Foto: Nathalie Plompen";
			altArray[53] = "Hei&szlig;luftballon, Foto: Bernd Schmidt";
			altArray[54] = "Autoscooter, Foto: Jari Pekki";
			altArray[55] = "Dynamic Station, Foto: Nathalie Plompen";
			altArray[56] = "Brandung, Foto: Kuba Borówka"; 
					
			//	ein neues Element in altArray erzeugen
			//	Template: altArray[] = "";
		}
		else if (lang == "en")
		{
			altArray[0] = "Spiral Staircase at DIaLOGIKa, Saarbrücken 2002, Photo: Torsten Weller";
			altArray[1] = "Sunset at Kaninchenberg, Saarbrücken 2002, Photo: Torsten Weller";
			altArray[2] = "Spiral Staircase at Sagrada Família, Barcelona 2003, Photo: Rainer Siedle";
			altArray[3] = "Botanical Garden at Saarland University, Saarbrücken 2003, Photo: Wolfgang Keber";
			altArray[4] = "Light Bulb of Lab Power Unit, Basement Shop 1993, Photo: Jochen Wagner";
			altArray[5] = "Botanical Garden at Saarland University, Saarbrücken 2003, Photo: Wolfgang Keber";
			altArray[6] = "Trebah Garden, Southern England 2003, Photo: Wolfgang Keber";
			altArray[7] = "Glendurgan Garden, Southern England 2003, Photo: Wolfgang Keber";
			altArray[8] = "Backlit Pampas Grass, Völklingen 1988, Photo: Carsten Grammes"; 
			altArray[9] = "On the Banks of the Saar, Saarbrücken 2002, Photo: Torsten Weller";
			altArray[10] = "Evening Mood at the Dune Beach of Maspalomas, Gran Canaria 1988, Photo: Carsten Grammes";
			altArray[11] = "Snowy Branch, Saarbrücken 2001, Photo: Torsten Weller";
			altArray[12] = "When Night Turns into Day..., Saarbrücken 1997, Photo: Rainer Siedle";
			altArray[13] = "Winter Sun (near Saarland University), Saarbrücken 1984, Photo: Manfred Ries";	
			altArray[14] = "In growing rings, Saarbrücken 2004, Photo: Florian Jung";	
			altArray[15] = "Grand Canyon, Saarbrücken 1984, Photo: Wolfgang Keber";	
			altArray[16] = "Straw, Saarbrücken 1984, Photo: Manfred Ries";	
			altArray[17] = "Tower, Saarbrücken 1984, Photo: Kerstin Reese";	
			altArray[18] = "Glacier, Saarbrücken 1984, Photo: Kerstin Reese";	
			altArray[19] = "Camellia, Saarbrücken 2004, Photo: Wolfgang Keber";	
			altArray[20] = "Roof to the stars, Saarbrücken 2004, Photo: Christian Klein";	
			altArray[21] = "Oak, Saarbrücken 1984, Photo: Carsten Grammes";	
			altArray[22] = "Mono Lake (USA), Mono Lake 1994, Photo: Wolfgang Keber";	
			altArray[23] = "Tanks, Saarbrücken 1984, Photo: Carsten Grammes";	
			altArray[24] = "Beds, Saarbrücken 2004, Photo: Florian Jung";	
			altArray[25] = "Meeres-Ungeheuer-lich, Photo: Klaus Musseleck";	
			altArray[26] = "Planten un Blomen - Hamburg, Photo: Florian Jung";	
			altArray[27] = "Drops at Felsenpfad in St. Arnual, Foto: Thorsten Weller";	
			altArray[28] = "Oil, Photo: Manfred Ries";	
			altArray[29] = "Rostock Port, Photo: Stephanie Bruhn";	
			altArray[30] = "Agregates, Photo: Ralf Linnebach";	
			altArray[31] = "White Noise, Photo: Jochen Wagner";	
			altArray[32] = "Crossed, Photo: Klaus Musseleck";	
			altArray[33] = "Whitehaven Beach at Whitsunday Island, Photo: Christian Lambert";	
			altArray[34] = "Place du marché, Ganvié (Bénin), Photo: Françoise Hontoy";
					
			altArray[35] = "The pleasure to drive, Photo: Carsten Grammes";		
			altArray[36] = "Downwards, Photo: Carsten Grammes";		
			altArray[37] = "Fitting, Photo: Carsten Grammes";		
			altArray[38] = "Athlon, Photo: Jochen Wagner";		
			altArray[39] = "Cable Spaghetti, Photo: Jochen Wagner";		
			altArray[40] = "Downtime?, Photo: Carsten Grammes";		
			altArray[41] = "Next Generation, Photo: Manfred Ries";		
			altArray[42] = "Tube Radio, Photo: Carsten Grammes";		
			altArray[43] = "Technique in Detail, Photo: Thorsten Weller";		
			altArray[44] = "Streets of Technique, Photo: Thorsten Weller";	
			
			
			//Fotowettbewerb 2007
			altArray[45] = "Harddisk, Foto: Dirk Brutscher";	
			altArray[46] = "Flamenco, Foto: Florian Jung";
			altArray[47] = "Los Voladores Mexico, Foto: Joachim Walter";
			altArray[48] = "Bicycle Race, Foto: Wolfgang Keber";
			altArray[49] = "Merry-Go-Round, Foto: Klaus Musseleck";
			altArray[50] = "Rio Antirrio Clouds, Foto: Wilhelmus van Gemert";
			altArray[51] = "No Risk - No Fun, Foto: Josef Hinterleitner";
			altArray[52] = "Adventure, Foto: Nathalie Plompen";
			altArray[53] = "Hot-Air Balloon, Foto: Bernd Schmidt";
			altArray[54] = "Dodgem Car, Foto: Jari Pekki";
			altArray[55] = "Dynamic Station, Foto: Nathalie Plompen";
			altArray[56] = "Breakers, Foto: Kuba Borówka"; 	
					
			//	ein neues Element in altArray erzeugen
			//	Template: altArray[] = "";
		}
		
	}
	catch (er)
	{}
	
}

function changeImage(imageId,imgSrc)
{
	document.images[imageId].src=imgSrc;
}

//
//	Creates a gallery from the existing JavaScript array
//	Params:
//		intFrom --> Start Index
//		intTo   --> End Index
//		intYear --> Free Text for Heading 
//
function CreateGalleryFromArray(intFrom, intTo, intYear)
{

        var body = document.getElementById("GALLERY");
        
        
        var heading = document.createElement("h2");
        var YearHeading = document.createTextNode(intYear);
        heading.style.borderBottom = "#ac2b31 solid 1px";
        heading.style.marginTop = "30px";
        heading.style.marginBottom = "10px";
        
        
        body.appendChild(heading);
        heading.appendChild(YearHeading);

        // creates a <table> element and a <tbody> element
        var tbl     = document.createElement("table");
        var tblBody = document.createElement("tbody");

        // creating all cells
        for (var j = 0; j < rows; j++) {
             
            if(intFrom==intTo) break;         
            // creates a table row
            var row = document.createElement("tr");

            for (var i = 0; i < cols; i++) {
                // Create a <td> element and a text node, make the text
                // node the contents of the <td>, and put the <td> at
                // the end of the table row
                
                if(intFrom==intTo) break;
                
                var cell = document.createElement("td");
                cell.style.border = "solid #d8d8d8 1px";
                cell.style.borderRight = "solid #999999 2px";
                cell.style.borderBottom = "solid #999999 2px";
                cell.style.padding = "5px";
                                
                var img = document.createElement("img");
                img.setAttribute("src", mypath + imgArray[intFrom]);
                img.setAttribute("alt", altArray[intFrom]);
                img.style.width = "178px";
                img.style.height = "134px";
                
                cell.appendChild(img);
                row.appendChild(cell);
                intFrom++;
            }

            // add the row to the end of the table body
            tblBody.appendChild(row);
        }

        // put the <tbody> in the <table>
        tbl.appendChild(tblBody);
        // appends <table> into <body>
        body.appendChild(tbl);       
}

//Call with InitPath('<TMPL_VAR NAME=FOLDER_IMAGES>/title_img/','en');
function InitPath(imgpath, lang)
{
	mypath = imgpath;
	InitArrays(lang);	
}