
	var aImages = new Array();
	var aURL = new Array();
	var aArtists = new Array();
	var iPrev = -1;
	var iRnd = -1;
	var temp = "../";
	window.onresize = function doResize() {
		var myWidth = 0, myHeight = 0;
		  if( typeof( window.innerWidth ) == 'number' ) {
			//Non-IE
			myWidth = window.innerWidth;
			myHeight = window.innerHeight;
		  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			//IE 6+ in 'standards compliant mode'
			myWidth = document.documentElement.clientWidth;
			myHeight = document.documentElement.clientHeight;
		  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			//IE 4 compatible
			myWidth = document.body.clientWidth;
			myHeight = document.body.clientHeight;
		  }
							
		if(myWidth/myHeight < 1.4) {
			document.getElementById('bg').style.width= 'auto';
			document.getElementById('bg').style.height= '50%';
		} else if(myWidth/myHeight >= 1.4) {
			document.getElementById('bg').style.width= '50%';
			document.getElementById('bg').style.height= 'auto';
		}
	};
	
	aImages[0] = "madwands_3d_wizualizacje_animacje/dummies1";
	aImages[1] = "madwands_3d_wizualizacje_animacje/dummies2";
	aImages[2] = "madwands_3d_wizualizacje_animacje/dummies3";
	aImages[3] = "madwands_3d_wizualizacje_animacje/eon1";
	aImages[4] = "madwands_3d_wizualizacje_animacje/eon2";
	aImages[5] = "madwands_3d_wizualizacje_animacje/lebork1";
	aImages[6] = "madwands_3d_wizualizacje_animacje/lebork2";
	aImages[7] = "madwands_3d_wizualizacje_animacje/lebork3";
	aImages[8] = "madwands_3d_wizualizacje_animacje/lebork4";
	aImages[9] = "madwands_3d_wizualizacje_animacje/ojcow1";
	aImages[10] = "madwands_3d_wizualizacje_animacje/biskupin4";
	aImages[11] = "madwands_3d_wizualizacje_animacje/ojcow3";
	aImages[12] = "madwands_3d_wizualizacje_animacje/ojcow4";
	aImages[13] = "madwands_3d_wizualizacje_animacje/ojcow5";
	aImages[14] = "madwands_3d_wizualizacje_animacje/ojcow6";
	aImages[15] = "madwands_3d_wizualizacje_animacje/ojcow7";
	aImages[16] = "madwands_3d_wizualizacje_animacje/tree1";
	aImages[17] = "madwands_3d_wizualizacje_animacje/tree2";
	aImages[18] = "madwands_3d_wizualizacje_animacje/patio";
	aImages[19] = "madwands_3d_wizualizacje_animacje/biskupin1";
	aImages[20] = "madwands_3d_wizualizacje_animacje/biskupin2";
	aImages[21] = "madwands_3d_wizualizacje_animacje/dummies4";
	aImages[22] = "madwands_3d_wizualizacje_animacje/dummies5";
	aImages[23] = "madwands_3d_wizualizacje_animacje/dummies6";
	aImages[24] = "madwands_3d_wizualizacje_animacje/piap1";
	aImages[25] = "madwands_3d_wizualizacje_animacje/piap2";
	aImages[26] = "madwands_3d_wizualizacje_animacje/tree3";
	aImages[27] = "madwands_3d_wizualizacje_animacje/banan1";
	aImages[28] = "madwands_3d_wizualizacje_animacje/banan2";
	aImages[29] = "madwands_3d_wizualizacje_animacje/maieutica2";
	aImages[30] = "madwands_3d_wizualizacje_animacje/maieutica3";
	aImages[31] = "madwands_3d_wizualizacje_animacje/face1";

	aURL[0] = "http://www.madwands.com/dummies";
	aURL[1] = "http://www.madwands.com/dummies";
	aURL[2] = "http://www.madwands.com/dummies";
	aURL[3] = "http://www.madwands.com/eon";
	aURL[4] = "http://www.madwands.com/eon";
	aURL[5] = "http://www.madwands.com/lebork";
	aURL[6] = "http://www.madwands.com/lebork";
	aURL[7] = "http://www.madwands.com/lebork";
	aURL[8] = "http://www.madwands.com/lebork";
	aURL[9] = "http://www.madwands.com/ojcow";
	aURL[10] = "http://www.madwands.com/biskupin";
	aURL[11] = "http://www.madwands.com/ojcow";
	aURL[12] = "http://www.madwands.com/ojcow";
	aURL[13] = "http://www.madwands.com/ojcow";
	aURL[14] = "http://www.madwands.com/ojcow";
	aURL[15] = "http://www.madwands.com/ojcow";
	aURL[16] = "http://www.madwands.com/park";
	aURL[17] = "http://www.madwands.com/park";
	aURL[18] = "http://www.madwands.com/4dinstitute";
	aURL[19] = "http://www.madwands.com/biskupin";
	aURL[20] = "http://www.madwands.com/biskupin";
	aURL[21] = "http://www.madwands.com/dummies";
	aURL[22] = "http://www.madwands.com/dummies";
	aURL[23] = "http://www.madwands.com/dummies";
	aURL[24] = "http://www.madwands.com/piap";
	aURL[25] = "http://www.madwands.com/piap";
	aURL[26] = "http://www.madwands.com/park";
	aURL[27] = "http://www.madwands.com/banan";
	aURL[28] = "http://www.madwands.com/banan";
	aURL[29] = "http://www.madwands.com/maieutica";
	aURL[30] = "http://www.madwands.com/maieutica";
	aURL[31] = "http://www.madwands.com/face";
	
	aArtists[0] = "animacja 3d motion capture";
	aArtists[1] = "animacja 3d motion capture";
	aArtists[2] = "animacja 3d motion capture";
	aArtists[3] = "animacja 3d do książki EON";	
	aArtists[4] = "animacja 3d do książki EON";
	aArtists[5] = "animowany film 3d - średniowieczny Lębork";
	aArtists[6] = "animowany film 3d - średniowieczny Lębork";
	aArtists[7] = "animowany film 3d - średniowieczny Lębork";
	aArtists[8] = "animowany film 3d - średniowieczny Lębork";
	aArtists[9] = "animowany film stereo 3d - Powstanie Doliny Prądnika";
	aArtists[10] = "prezentacja multimedialna realtime 3d - Biskupin";
	aArtists[11] = "animowany film stereo 3d - Powstanie Doliny Prądnika";
	aArtists[12] = "animowany film stereo 3d - Powstanie Doliny Prądnika";
	aArtists[13] = "animowany film stereo 3d - Powstanie Doliny Prądnika";
	aArtists[14] = "animowany film stereo 3d - Powstanie Doliny Prądnika";
	aArtists[15] = "animowany film stereo 3d - Powstanie Doliny Prądnika";
	aArtists[16] = "animacja 3d do filmu - Park Ujście Warty";
	aArtists[17] = "animacja 3d do filmu - Park Ujście Warty";
	aArtists[18] = "animacja 3d do prezentacji multimedialnej 4D Institute";
	aArtists[19] = "prezentacja multimedialna realtime 3d - Biskupin";
	aArtists[20] = "prezentacja multimedialna realtime 3d - Biskupin";
	aArtists[21] = "animacja 3d motion capture";
	aArtists[22] = "animacja 3d motion capture";
	aArtists[23] = "animacja 3d motion capture";
	aArtists[24] = "animowana wizualizacja przemysłowa";
	aArtists[25] = "animowana wizualizacja przemysłowa";
	aArtists[26] = "animacja 3d do filmu - Park Ujście Warty";
	aArtists[27] = "animacja banana 3d do spotu społecznego";
	aArtists[28] = "animacja banana 3d do spotu społecznego";
	aArtists[29] = "teaser filmu MAIEUTICA dla WDDW Polska";
	aArtists[30] = "teaser filmu MAIEUTICA dla WDDW Polska";
	aArtists[31] = "animacja twarzy za pomocą motion capture";

	
	$(document).ready(function() {
	
		/* Define the function that triggers to fade in the background as soon as the image has loaded */
		$("img#bg").load(function()
			{
				/* Fade in during 3 seconds */
				$("img#bg").fadeTo(1500,1);
				
				/* Animate the picture description during 1 second */
				setTimeout(function() { $("#image_description").animate({right: '+=180'}, 1000) }, 1000);
			
				/* Set the timeout to fade out the image and the description after 10 seconds*/
		    	setTimeout(function() 
			    	{
			    		$("#image_description").animate({right: '-=180'}, 1000);
			    		$("img#bg").fadeOut(1500);
			    		
			    		/* Load the next image after 4 seconds */
			    		setTimeout(LoadImages,3000);
			    	}
			    	,5000);
			}			
		)
	
		/* Start the slideshow one second after the page is ready */ 
		setTimeout(LoadImages,1000);
		
    });


    function LoadImage(iNr)
	{
	
		var myWidth = 0, myHeight = 0;
		  if( typeof( window.innerWidth ) == 'number' ) {
			//Non-IE
			myWidth = window.innerWidth;
			myHeight = window.innerHeight;
		  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			//IE 6+ in 'standards compliant mode'
			myWidth = document.documentElement.clientWidth;
			myHeight = document.documentElement.clientHeight;
		  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			//IE 4 compatible
			myWidth = document.body.clientWidth;
			myHeight = document.body.clientHeight;
		  }
		
		/* Assign the new image to the background */
		if(myWidth >= 1400)
			$("img#bg").attr("src", temp + aImages[iNr]+".jpg");
		else if(myWidth < 1400)
			$("img#bg").attr("src", temp + aImages[iNr]+"_b.jpg");
							
		if(myWidth/myHeight < 1.4) {
			document.getElementById('bg').style.width= 'auto';
			document.getElementById('bg').style.height= '50%';
		} else if(myWidth/myHeight >= 1.4) {
			document.getElementById('bg').style.width= '50%';
			document.getElementById('bg').style.height= 'auto';
		}
			
		
 		/* Assign the artist name to the description */
 		$("#image_artist").html(aArtists[iNr]);
 		
 		/* Assign the image url to the description */
        $("a#image_url").attr("href", aURL[iNr]);
        $("a#image_url").html("<span style='letter-spacing:normal; color:#9FF;'>&raquo; </span>zobacz projekt...");                	
    };
    
    function LoadImages()
    {
    	
    	/* Select a random image number and make sure this is not equal to the previous image */
    	while(iPrev == iRnd)
    	{
    		iRnd = Math.floor(Math.random()*aImages.length);
    	}
    	
    	/* Show the selected image */
    	LoadImage(iRnd);
    	
    	iPrev = iRnd;
    	
    };
	
	function show(layer_id) {

		if (document.getElementById(layer_id).style.display == 'none')

			document.getElementById(layer_id).style.display = 'block';

		else

			document.getElementById(layer_id).style.display = 'none';

	};
	function show2(layer_id) {

			document.getElementById(layer_id).style.display = 'none';

	};
	
	
