/*
	SSI Studio www.ssi.com.pl
	Wszystkie prawa zastrzerzone przez SSI Studio
*/
var text = new Array(100);

function opened(id) {
 var Win = window.open("galeria/show.php?id=" + id,"displayWindow",'width=320,height=240,resizable=0,scrollbars=no,menubar=no');
}

function openwindow(id,width,height) {
 var Win = window.open(id,"displayWindow",'width=' + width + ',height=' + height + ',resizable=0,scrollbars=no,menubar=no');
}


function active_picture(obj)
{
	for(i = 1; i < maximage; i++)
	{
		var target = 'anim' + i + 'pic';
		{
			document.getElementById(target).style.border = '1px solid #99948F';
			document.getElementById(target).style.filter='alpha(opacity=70)'; 
			document.getElementById(target).style.opacity=0.70;
		}
	}
	obj.style.border = '1px solid #9B1E1E';
	obj.style.filter='alpha(opacity=100)'; 
	obj.style.opacity=1.00;
}

function setImage(img,nazwa,opis)
{
	document.getElementById('picture').src  = 'galeria/srednie/' + img + '.jpg';
	document.getElementById('picture').title  = nazwa;
	document.getElementById('picture').alt  = nazwa;
	//document.getElementById('tytul').innerHTML = nazwa; 
	document.getElementById('opis').innerHTML = opis + '<br><br>';
}

function show_hide(nr) {
	if(document.getElementById(nr).innerHTML == '')
	{
		if(text[nr])
			document.getElementById(nr).innerHTML = text[nr];
	}
	else
	{
		text[nr] = document.getElementById(nr).innerHTML;
		document.getElementById(nr).innerHTML = '';		
	}
}

function  show_all(id)
{
	for(o=1;o<id;o++)
	{
		show_hide(o);
	}
}

function inCursor(i)
{
	i.src = i.src.replace("-1","-2");
}

function outCursor(i)
{
	i.src = i.src.replace("-2","-1");
}

function next()
{
	if(active < maximage-5 ) 
		active++;
	animacja();
}
							
function previoust()
{
	if(active > 0)
		active--;

	animacja();
}
							
function animacja()
{
	// robimy animacje
	if(maximage > 4)
	{
		if(active < maximage-5)
		{
			document.getElementById('str_down').style.visibility = 'visible';	
		}
		else
		{
			document.getElementById('str_down').style.visibility = 'hidden';
		}
		
		if(active > 0)
		{
			document.getElementById('str_up').style.visibility = 'visible';			
		}
		else
		{
			document.getElementById('str_up').style.visibility = 'hidden';			
		}
		
		for(i = 1; i < maximage; i++)
		{
			var target = 'anim' + i;
			if(i > active && i < (active+5))
			{					
				document.getElementById(target).style.display ='block';
			}
			else 
			{
				document.getElementById(target).style.display = 'none';
			}
		}
	}	
	else
	{
		if(document.getElementById('anim1'))
			document.getElementById('anim1').style.display ='block';

		if(document.getElementById('anim2'))
			document.getElementById('anim2').style.display ='block';
		
		if(document.getElementById('anim3'))
			document.getElementById('anim3').style.display ='block';
		
		if(document.getElementById('anim4'))
			document.getElementById('anim4').style.display ='block';
		
		document.getElementById('str_up').style.visibility = 'hidden';
		document.getElementById('str_down').style.visibility = 'hidden';
	}
}

function outMouse(doc)
{
	//var doc = document.getElementById(a);
	doc.style.filter='alpha(opacity=70)'; 
	doc.style.opacity=0.70;
}

function overMouse(doc)
{
	//var doc = document.getElementById(a);
	doc.style.filter='alpha(opacity=100)'; 
	doc.style.opacity=1.00;
}
