// JavaScript Document

var kier = null;
var last = "";
//var klient = "./img/informacje/wgal/";

function changePic(thFile, file, name, thName) {
	document.images[name].src =  thFile;
	if(last != "")
	{
		document.getElementById(last).style.border = "1px solid #e6eaee";
	}
	document.getElementById(thName).style.border = "1px solid #a9a9a9";
	document.getElementById("pictureLink"+name).setAttribute("href", file);
	
}

function removeBorder(thName){
	last = thName;
	
}
//szerokosc pomiedzy strzalkami
var widthSlider = 550;
 
function moveBar(kier, id, barWidth)
{
	var val	= 5 * kier;
	
	se = window.setInterval("move("+val+","+id+","+barWidth+");", 10);
}

function stopMove()
{
	window.clearInterval(se)
}

function move(val,id, barWidth)
{
	var el = document.getElementById(id).style;	
	
	if ((el.posLeft+val) <= 0)
	{ 
		if ((el.posLeft+val) >= (widthSlider - barWidth))
		{
			el.posLeft += val;
		}
	}	

	if ((myParseInt(el.left)+val) <= 0)
	{ 
		if ((myParseInt(el.left)+val) >= (widthSlider - barWidth))
		{
			el.left = (myParseInt(el.left)) + val +"px";
		}
	}
}

function myParseInt(s)
{
	var ret = parseInt(s);
	return (isNaN(ret) ? 0 : ret);
}

/*window.onload = function()
{
	document.images[last].style.border = "2px solid #cc0033";
}*/

