	
	/** author: Wido Widlewski */
	
	var ziel;
	
	var fotos = new Array ('airkom', 'chips', 'digitalanzeige', 'kondensatoren', 'netzwerk', 'oszi');
		
	var zahl_array = new Array();
	
	
	function GetRandom( min, max ) {
	
        if( min > max ) {
                return( -1 );
        }
        if( min == max ) {
                return( min );
        }
 
        var r = parseInt( Math.random() * ( max+1 ) );
 
        return( r + min <= max ? r + min : r );
		
	}
	
	/* funktion, die ueberprueft, ob ein wert im array ist */
	
	function in_array (wert, feld) {
	
		drin = 0;
		
		for (i = 0; i < feld.length; i++)
		{
			if (wert == feld[i])
			{
				drin++;
			}
			
		}
		
		if (drin != 0)
		{
			return true;
		}
		else
		{
			return false;
		}
	
	}
	

	/* rekursive funktion, um ein zufaellige zahl zu bekommen, die wir noch nicht hatten */
	
	function get_zahl () {
		
		zahl = GetRandom(0, (fotos.length - 1));
			
		if (in_array(zahl, zahl_array))
		{
			return get_zahl();
		}
		else
		{
			//alert('neue zahl' + zahl);
			zahl_array[zahl_array.length] = zahl;
			return zahl;
		}
		
		
	}
	
	function weiterleitung () 
	{
		window.location.href = ziel;
	}

	
	function nichts () {
		for ( i = 0; i < 10000; i++)
		{
			i = i +1;
		}
	}
	
	
	
	
	// siehe: http://docs.jquery.com/Using_jQuery_with_Other_Libraries
	jQuery.noConflict();
	
	/* beim kompletten laden des dokumentes */
	
	jQuery(document).ready(function ($){
	//$('document').ready(function (){
			
		// fuer alle png bilder	
		//$('img[@src$=.png]').ifixpng(); 		
				
		$('#logo').hide();
			
		$('#schaltplan').hide();
		
		
				
		for (i = 0; i < fotos.length; i++)
		{
			bildname = '#bild_' + (i + 1);
			
			var pfad = 'fileadmin/ieb/design/startseite/';
			
			//alert(fotos[i]);
			
			$(bildname).hide();
			
			zahl = get_zahl();
			//&alert(pfad + fotos[zahl]);
			$(bildname).find('img').attr('src', pfad + fotos[zahl] + '.jpg');
			
			
			/* die fotos aus dem array einfach anzeigen */									
			//$(bildname).find('img').attr('src', pfad + fotos[i] + '.jpg');
			
			//$(bildname).fadeIn('slow');
						
			/*
			for (k = (fotos.length - 1); k >= zahl; k--)
			{
				//alert(k);
				
				$(bildname).find('img').attr('src', pfad + fotos[k] + '.jpg');
				$(bildname).show('slow');
			}
			*/
			
		}
		
		$('#bild_1').fadeIn('slow', function() {
		
			$('#bild_2').fadeIn('slow', function() {
			
				$('#bild_3').fadeIn('slow', function() {
				
					$('#bild_4').fadeIn('slow', function() {
					
						$('#bild_5').fadeIn('slow', function() {
						
							$('#bild_6').fadeIn('slow', function () {
							
							
								$('#schaltplan').fadeIn('slow', function() {
								
									ziel = $('#logo').find('a').attr('href');
		
									//alert(ziel);	
				
									//$('#logo').fadeIn('slow');
									$('#logo').fadeIn('slow', function() { window.setTimeout("weiterleitung()",3000); });
								
								
								});
								
							});
						
						});
					
					});
					
				});
				
			});
		
		});
					
	
	});
	