function Galerie ()
{}

Galerie.Depot = function ()
{
	this.arr = new Array();
         return this;
}

Galerie.Depot.prototype.push = function ( aObj )
{
         /* length = 1 obwohl noch nichts enthalten */
         this.arr[ this.arr.length ] = aObj;
         return this;
}

Galerie.Bild = function (id, status, title, location, year, width, height, signature, technic )
{
	this.id = id;
	this.status = status;
	this.title = title;
	this.loco = location;
	this.year = year;
	this.width = width;
	this.height = height;
	this.sign = signature;
	this.tech = technic;
	// preload the icon. In which thread ? will body::onload be delayed ?
	this.icon = new Image();
	this.icon.src = 'galerie/i' + id + '.jpg';
	return this;
}

theDepot = new Galerie.Depot();

theDepot.push( new Galerie.Bild( '01','','Kopf','Franchieux','1963','076','100','','Mischtechnik auf Papier auf Leinwand'));
theDepot.push( new Galerie.Bild( '02','','','','1966','75','53','','Öl auf Papier, Spanplatte'));
theDepot.push( new Galerie.Bild( '03','','','','1969','50','70','','Öl auf Leinwand'));
theDepot.push( new Galerie.Bild( '04','','','','1973','47','28','','Acrylskizze'));
theDepot.push( new Galerie.Bild( '05','','','Laigueglia','1982','100','075','','Acryl auf Leinwand'));
theDepot.push( new Galerie.Bild( '06','','','Mallorca','1986','48','36','','Acrylskizze'));
theDepot.push( new Galerie.Bild( '07','','','Provence','1987/1987','130','100','','Acryl auf Leinwand'));
theDepot.push( new Galerie.Bild( '08','','','Hogenbögen','1988','83','59','','Acryl auf Leinwand'));
theDepot.push( new Galerie.Bild( '09','','','Seguret','1989','100','075','','Acryl auf Leinwand'));
theDepot.push( new Galerie.Bild( '10','','','Katalonien','1990','48','36','','Kreide, Acryl auf Leinwand'));
theDepot.push( new Galerie.Bild( '11','','','Lünen, Churwalden','1991','100','070','','Acryl auf Leinwand'));
theDepot.push( new Galerie.Bild( '12','','','Lünen','1992','36','14','','Acrylskizze.'));

Galerie.show = function( aBild )
{
    var img = new Image();
	img.src = aBild.icon.src;
         /* 'filepath/filename = galerie/i' + aDesc.id + '.jpg'; */

	var obj = document.getElementById( "bild" );
	if( obj != null) {
		if( img != null )
			obj.src = img.src;
        obj = document.getElementById( "rahmen" );
                 if( obj != null) {
                		var theW = 256;
                		var theH = 256;
						var aW = (0.0+aBild.width);
						var aH = (0.0+aBild.height);
						// alert( "w:"+aW+" h:"+aH );
                		if( aW > aH )
                		{ theH = parseInt((256.0 * aH) / (0.0+aW )); }
                		else
                		{ theW = parseInt((256.0 * aW ) / (0.0+aH )); };

         		var aStyle = "width:"+theW+"px; "+"height:"+theH+"px;";
         		// alert( aStyle );
         		obj.setAttribute( "style", aStyle);
                 }
         }

    obj = document.getElementById( "descid" );
         /* alert( obj.firstChild.nodeType ); */
         if( obj != null)
                 obj.firstChild.nodeValue = aBild.id + ' ' + aBild.title;

	obj = document.getElementById( "desctitel" );
         if( obj != null)
                 obj.firstChild.nodeValue = aBild.year + ' '+aBild.loco;

	obj = document.getElementById( "descsujet" );
		if( obj != null)
			obj.firstChild.nodeValue = ' ';

         obj = document.getElementById( "descfact" );
         if( obj != null)
                 obj.firstChild.nodeValue = parseInt(aBild.width)+' x '+parseInt(aBild.height)+' cm, '+aBild.tech;

         return true;
}
