// JavaScript Document
/*
	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 kolor(id) {
 var Win = window.open("galeria/show_kolor.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 set_picture(id)
{
	//alert(id);
	for(i = 1; i < maximage; i++)
	{
		var target = 'anim' + i + 'pic';
		if(document.getElementById(target).lang == id)
		{
			active = (i-2);
		}
	}
	//alert(active);
	//animacja();
}

function active_picture(obj)
{
	for(i = 1; i < maximage; i++)
	{
		var target = 'anim' + i + 'pic';
		{
			document.getElementById(target).style.filter='alpha(opacity=70)'; 
			document.getElementById(target).style.opacity=0.70;
		}
	}
	obj.style.filter='alpha(opacity=100)'; 
	obj.style.opacity=1.00;
}

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-4 ) 
		active++;
	
	animacja();
}
							
function previoust()
{
	if(active > 0)
		active--;

	animacja();
}
							
function animacja()
{
	if(active < 0) active = 0;
	// robimy animacje
	if(maximage > 3)
	{
		if(active < maximage-4)
		{
			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+4))
			{					
				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';
		
		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;
}
