
window.addEvent("domready",function(){

if($('tab1'))
{
	var anchor = self.document.location.hash.substring(1);

	if(anchor == 'opis')
	{
		changeTab(1);
	}
	else if(anchor == 'dane-techniczne')
	{
		changeTab(2);
	}
	else if(anchor == 'podobne-produkty')
	{
		changeTab(3);
	}
}

 if($("najKupowane"))
 {
		var scroller	= new Fx.Scroll("najKupowane",{duration: 500});
		var sItems		= $$('.sItem');
		var current		= 0;

		$('prevProd').addEvent("click",function(event){
				var event = new Event(event);
				event.stop();
				if(current > 0)
				{
					current--;
					scroller.toElement(sItems[current]);
				}
				else
				{
					current = sItems.length-4;
					scroller.toElement(sItems[current]);
				}
		});

		$('nextProd').addEvent("click",function(event){
				var event = new Event(event);
				event.stop();
				if(current < (sItems.length-4))
				{
					current++;
					scroller.toElement(sItems[current]);
				}
				else
				{
					current = 0;
					scroller.toElement(sItems[current]);
				}

		});
 }
});

function activeME(name)
{
	$(name).style.backgroundColor = '#fff7d9';
	$(name).disabled = false;
}
function unactiveME(name)
{
	$(name).style.backgroundColor = '#eeeeee';
	$(name).disabled = true;
}
function changeTab(id)
{
	$$('.tabActive').each(function(el){
				el.className = 'tabNormal';
			});
	$$('.tabContent').each(function(el){
				el.style.display = 'none';
			});

	document.getElementById('tab'+id).className = 'tabActive';
	document.getElementById('tabc'+id).style.display = 'block';
}
function openFoto(url, path)
{
	var foto = url.slice(url.lastIndexOf('/')+1);
	window.open(path+foto, 'Foto', 'location=0,status=0,scrollbars=1');
}
