/*kopiowanie i wykorzystywanie do działalności komercyjnej zabronione*/

function zmien(grafika,plik)
{
	document.images[grafika].src=plik;
}


						/**************************************************************/
/************************************************************ PRELOAD*************************************************************/
						/**************************************************************/
function dopreload()
{
   var the_images = new Array('img/menu1.jpg','img/homenapis.png','img/reklamynapis.png','img/filmynapis.png','img/usluginapis.png',
   'img/stronynapis.png','img/slubynapis.png','img/muzykafnapis.png','img/teledyskinapis.png','img/innenapis.png','img/kontaktnapis.png','img/anim.gif','img/logo.png','img/strona800x600.jpg');
   preloadimages(the_images);
   //parent.window.location.replace("home.html");
}
function preloadimages(the_images_array) {
   for(var loop = 0; loop < the_images_array.length; loop++)
   {
 	var an_image = new Image();
	an_image.src = the_images_array[loop];
	//alert("loaded:" +the_images_array[loop]);
   }
}

function show_divs()
{
	show_div('nadrzedny');
	show_div('up');
	show_div('down');
}
function show_div(div_name)
{
	var gl = new getObj(div_name);
	gl.style.visibility = "visible";
}
						/**************************************************************/
/************************************************************ SCROLL*************************************************************/
						/**************************************************************/
var clipTop = 0;
var clipWidth = 500;
var clipBottom = 430;
var topper = 10;
var lyrheight = 0;
var time,amount,theTime,theHeight,DHTML;
var autostop = 0;

function init(layername,layermeasure)
{
	DHTML = (document.getElementById || document.all || document.layers)
	if (!DHTML) return;
	var x = new getObj(layername);
	var gl = new getObj('nadrzedny');
	if (document.layers)
	{
		lyrheight = x.style.clip.bottom;
		lyrheight += 20;
		x.style.clip.top = clipTop;
		x.style.clip.left = 0;
		x.style.clip.right = clipWidth;
		x.style.clip.bottom = clipBottom;
	}
	else if (document.getElementById || document.all)
	{
		lyrheight = x.obj.offsetHeight;
		x.style.clip = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,0)';
	}	
	var pomiar = new getObj(layermeasure);
	autostop = pomiar.obj.offsetHeight;
	if(isNaN(autostop) || autostop < 5) autostop=1020;
	show_divs();
}

function scrollayer(layername,amt,tim)
{
	if (!DHTML) return;
	thelayer = new getObj(layername);
	if (!thelayer) return;
	amount = amt;
	theTime = tim;
	realscroll();
}

function realscroll()
{
	if (!DHTML) return;
	clipTop += amount;
	clipBottom += amount;
	topper -= amount;
	//if (clipTop < 0 || clipBottom > lyrheight)
	if (clipTop < 0 || clipBottom > (autostop+200))
	{
		clipTop -= amount;
		clipBottom -= amount;
		topper += amount;
		return;
	}
	if (document.getElementById || document.all)
	{
		clipstring = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,0)';
		thelayer.style.clip = clipstring;
		thelayer.style.top = topper + 'px';
	}
	else if (document.layers)
	{
		thelayer.style.clip.top = clipTop;
		thelayer.style.clip.bottom = clipBottom;
		thelayer.style.top = topper;
	}
	time = setTimeout('realscroll()',theTime);
}

function stopScroll()
{
	if (time) clearTimeout(time);
}

function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}














