var predkosc=50;var przerwa1=2000;var przerwa2=0;	
var uagent = window.navigator.userAgent.toLowerCase();var IEB=(uagent.indexOf('msie') != -1)?true:false;
var x=0;
var y=0;
var n=0;
var ide1='sam1';
var ide2='sam2';
function losowanie(){
	i=Math.round(Math.random()*2);
	if (i==0){
		ide1='sam1';
		ide2='sam2';
	}
	else if (i==1){
		ide1='sam3';
		ide2='sam4';
	}
	else if (i==2){
		ide1='sam5';
		ide2='sam6';
	}
}
function reset(){
	var obrazki = document.getElementById("obrazki").getElementsByTagName("img");
	losowanie();
	for (var z=0;z<obrazki.length;z++){	
		var foto=document.getElementById(obrazki[z].id);
		foto.style.opacity=0;
		if(IEB==true){foto.filters.alpha.opacity=0}	
	}
}
function znikanie(){
	var foto=document.getElementById(ide1);
	foto.style.opacity=foto.style.opacity-0.05;
	if(IEB==true){foto.filters.alpha.opacity=foto.filters.alpha.opacity-5;}
	if (x>0){setTimeout('znikanie()',predkosc);}
	if (x==10){
		pojawianie2();
	}
	if (x<=0){
		
		if (ide1=='sam1'){		
			ide1='sam3';		
		}
		else if (ide1=='sam3'){
			ide1='sam5';
		}
		else if (ide1=='sam5'){
			ide1='sam7';
		}
		else if (ide1=='sam7'){
			ide1='sam1';
		}
	}
	x=x-1;
}
function pojawianie(){
	var foto=document.getElementById(ide1);	foto.style.opacity=x/20;
	if(IEB==true){foto.filters.alpha.opacity=x*5;}
	if (x<20){setTimeout('pojawianie()',predkosc);}
	if (x>=20){x=20;setTimeout('znikanie()',przerwa1);}
	x=x+1;
}
function znikanie2(){
	var foto=document.getElementById(ide2);
	foto.style.opacity=foto.style.opacity-0.05;
	if(IEB==true){foto.filters.alpha.opacity=foto.filters.alpha.opacity-5;}
	if (y>0){setTimeout('znikanie2()',predkosc);}
	if (y==10){
		pojawianie();
	}
	if (y<=0){
		if (ide2=='sam2'){
			ide2='sam4';
		}
		else if (ide2=='sam4'){
			ide2='sam6';
		}
		else if (ide2=='sam6'){
			ide2='sam8';
		}
		else if (ide2=='sam8'){
			ide2='sam2';
		}
	}
	y=y-1;
}
function pojawianie2(){
	var foto=document.getElementById(ide2);	foto.style.opacity=y/20;
	if(IEB==true){foto.filters.alpha.opacity=y*5;}
	if (y<20){setTimeout('pojawianie2()',predkosc);}
	if (y>=20){y=20;setTimeout('znikanie2()',przerwa1);}
	y=y+1;
}
function logo(){
	var lo=document.getElementById('trangor2');

	if (n!=20){
		lo.style.opacity=n/20;
		if(IEB==true){lo.filters.alpha.opacity=n*5;}
		n++;
		setTimeout('logo()',50);	
	}
	//else if (n==20){
		//setTimeout('logo2()',2000);	
	//}
}
function logo2(){
	var lo=document.getElementById('trangor2');
	if (n!=0){
		lo.style.opacity=n/20;
		if(IEB==true){lo.filters.alpha.opacity=n*5;}
		n--;
		setTimeout('logo2()',50);	
	}
}