//	A "True" Preloader
//	Written by: Randy Girard - April 2003
//	You are free to redistribute or edit this code in
//	any way as long as this notice stays intact.


//I do not recommend having any images on your "loading" page

var DoRedirect = "true"; 	//set this to "true" to redirect when completed loading, other values will be considered false (case sensitive)
var RedirectTo = "index2.php";	//This is the page we will navigate to once the load is complete (this may be case sensitive, depending on the server it is hosted on)
var AmmountPreloads = 16; 	//How many things do you have to preload?

var imgArray = CreateArray(AmmountPreloads + 1,2);

	imgArray[1][0] = "grafika/intro.gif";
	imgArray[1][1] = "image";
	imgArray[2][0] = "grafika/kont.jpg";
	imgArray[2][1] = "image";	
	imgArray[3][0] = "grafika/akt2.jpg";
	imgArray[4][0] = "grafika/part.jpg";
	imgArray[5][0] = "grafika/shape1.jpg";
	imgArray[6][0] = "grafika/catering.jpg";
	imgArray[7][0] = "grafika/mapa.swf";
	imgArray[8][1] = "flash";
	imgArray[9][0] = "grafika/logoboston.swf";
	imgArray[10][0] = "grafika/1.swf";
	imgArray[11][0] = "grafika/2.swf";
	imgArray[12][0] = "grafika/3.swf";
	imgArray[13][0] = "grafika/4.swf";
	imgArray[14][0] = "grafika/5.swf";
	imgArray[15][0] = "grafika/6.swf";
	imgArray[16][0] = "grafika/wifi.swf";

	function CreateArray(dim1) {
		if (CreateArray.arguments.length == 1) {
			return new Array(dim1);
		} else {
			var multiArray = new Array(dim1)
			for (var i = 0; i < dim1; i++) {
				multiArray[i] = new Array(CreateArray.arguments[1]);
			}
			return multiArray;
		}
	}

//This will print a hidden DIV layer for us to preload our stuff on.
window.document.write("<div id='preloadLayer' style='position:absolute; left:0px; top:0px; width:0px; height:1px; z-index:1; visibility: hidden;'>");

//Loop through all of our things to preload
var LastType = "";
for (loop = 1; loop < imgArray.length; loop++) {
	var PrintString = "";
	var CheckType = "";

	//Check to make sure the path to what we are preloading exists
	if ( imgArray[loop][0] ) {
	//Check if it is an image type of load
	if ( imgArray[loop][1] == "image" || (!imgArray[loop][1] && LastType == "image" )) {
		//A simple image code is written to the page
		PrintString = "<img src='" + imgArray[loop][0] + "'>";
	//Check if it is a flash type of load
	} else if ( imgArray[loop][1] == "flash" || (!imgArray[loop][1] && LastType == "flash" )) {
		//Again, a pretty simple flash code is written to the page
		PrintString = "<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0'> <PARAM NAME=movie VALUE='" + imgArray[loop][0] + "'> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#000000> <EMBED src='" + imgArray[loop][0] + "' quality=high bgcolor=#000000 ALIGN='' TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'></EMBED></OBJECT>";
	//Self explanitary ^_^
	} else {
		//O NO!! The type of load they specified is not supported!! Lets alert the user
		alert("Preload Warning: Typ pliku '" + imgArray[loop][1] + "' nie jest obslugiwany! ");
	}

	if ( imgArray[loop][1] ) { LastType = imgArray[loop][1]; } }


	window.document.write("<br>" + PrintString);
}

window.document.write("</div>");

function Redirect() {
    window.location.replace(RedirectTo);
}

if ( DoRedirect == "true" ) {
	window.onload = Redirect;
}
