// JavaScript Document
function initScripts() 
	{
	loadScrollBars();
	initLightbox();
	initPath();
	document.getElementById('logo').onmouseover=function() {animateLogo(1, true); }
	document.getElementById('logo').onmouseout=function() {animateLogo(1, false); }
	}





function showCategory(event, parent)
	{
	return;
	event.preventDefault();
	event.stopPropagation();
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null)
	  {
	  alert ("Browser does not support HTTP Request");
	  return;
	  }
	var url="getGallery.php";
	url=url+"?id="+parent;
	xmlhttp.onreadystatechange=stateChangedGal;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	}

function stateChangedGal()
	{
	if (xmlhttp.readyState==4)
		{
		running=true;
		var divGal=document.getElementById('divFrame');
		divGal.innerHTML=xmlhttp.responseText;
		}
	}















function animateLogo(step, dir)
	{
	if(step>=6) return;
	var a=document.getElementById('logo').firstChild;
	var time=50;

	if(dir)
		{
		var top=-step*69;
		a.style.backgroundPosition="0px "+top+"px";
		step++;
		setTimeout("animateLogo("+step+", true)",time);
		}
	else
		{
		var top=-(5-step)*69;
		a.style.backgroundPosition="0px "+top+"px";
		step++;
		setTimeout("animateLogo("+step+", false)",30);
		}
	}
	
	
var stop=true;
function initPath()	
	{
	var textSpan=document.getElementById('textPath');
	var textWindow=document.getElementById('windowPath');
	var left=document.getElementById('leftPath');
	var right=document.getElementById('rightPath');
	if(textWindow.offsetWidth<textSpan.offsetWidth)
		{
		var index=(-textSpan.offsetWidth+textWindow.offsetWidth);
		textSpan.style.left=index+"px";
		textSpan.setAttribute('class', index);
		document.getElementById('leftPath').style.display='block';
		}
	left.onmouseover=function() 	{ stop=false; movePath(1); 	};
	left.onmouseout= function() 	{ stop=true; };
	right.onmouseover=function() 	{ stop=false; movePath(-1); };
	right.onmouseout= function() 	{ stop=true; };
	}
function movePath(val)
	{	
	var time=7;
	var step=1;
	var textSpan=document.getElementById('textPath');
	var index=parseInt(textSpan.getAttribute('class'));
	// nie ma juz w prawo
	if(val==1)
		{
		document.getElementById('rightPath').style.display='block';
		if(index>=0)
			{
			document.getElementById('leftPath').style.display='none';
			return;
			}
		}
	if(val==-1)
		{
		document.getElementById('leftPath').style.display='block';
		if(index<=(-textSpan.offsetWidth+document.getElementById('windowPath').offsetWidth)) 
			{
			document.getElementById('rightPath').style.display='none';
			return;
			}
		}
	index=index+(val*step);
	textSpan.style.left=index+"px";
	textSpan.setAttribute('class', index);
	if(!stop) 
		{
		setTimeout("movePath("+val+")",time);
		}
	}


function loadScrollBars() 
	{
	var scroller  = null;
	var scrollbar = null;	
	if	(document.getElementById('Scroller-1').offsetHeight<
		(document.getElementById('Scroller-Container').offsetHeight-10))
		{
		document.getElementById('Scrollbar-Container').style.display='block';
		scroller  = new Scrolling.Scroller(
				document.getElementById("Scroller-1"), 
				400, 
				200,
				document.getElementById('Scroller-Container'));
		scrollbar = new Scrolling.Scrollbar(
				document.getElementById("Scrollbar-Container"), 
				scroller, 
				new Scrolling.ScrollTween()
				);
		}
	}




var divBgr= new Image(833,662);
divBgr.src = "../img/div_bgr.jpg";
	
// CZEKANIE NA ZALADOWANIE DOM

// for Mozilla browsers
if (document.addEventListener) 
	{
	document.addEventListener("DOMContentLoaded", domLoaded, false);
	}
// for Internet Explorer
/*@cc_on @*/
/*@if (@_win32)
  document.write("<script defer src=ie_onload.js><\/script>");
/*@end @*/

/*
 var ld=(document.all);
  var ns4=document.layers;
 var ns6=document.getElementById&&!document.all;
 var ie4=document.all;
  if (ns4)
 	ld=document.loading;
 else if (ns6)
 	ld=document.getElementById("loading").style;
 else if (ie4)
 	ld=document.all.loading.style;
 */
// for other browsers
window.onload = function() {
	domLoaded;
	hideWaitScreen();	
}

function hideWaitScreen()
	{
	document.getElementById("loading").style.display="none";
	document.getElementById("heightWrapper").style.display="block";
	initScripts();
	}

function domLoaded() 
	{
	if (arguments.callee.done) return;
	arguments.callee.done = true;
	};