var image1= new Image(); image1.src = 'grafika/arrow_up.jpg';
var image2= new Image(); image1.src = 'grafika/arrow_down.jpg';

function showFoto(id) {
	window.open('show_foto.php?id='+id+'&sze='+screen.width+'&wys='+screen.height, 'Foto', 'menubar=no, toolbar=no, location=no, scrollbars=no, resizable=yes, status=no, width=800, height=60, left=100, top=50');
}

var minHeight = 0;
var maxHeight = 361;

function getSpeed(a, b) {
	var i = (a - b) / 5;
	if (i < 1) i = 1;
	
	return Math.round(i);
}

function logoDisplay(e) {
	var div = document.getElementById(e);

	if (div.destHeight == undefined) div.destHeight = div.style.height.substr(0, div.style.height.length - 2);
	
//	if (div.Animation) window.clearInterval(div.Animation);
	
	if (div.destHeight >= maxHeight) {
		updateFlash('hide');
		document.getElementById('linkShowHide').innerHTML = 'rozwiń animację <img src="grafika/arrow_down.jpg" id="arrow_img" border="0" />';
		div.destHeight = minHeight;
		
		div.style.display = 'none';
	} else {
		updateFlash('show');
		document.getElementById('linkShowHide').innerHTML = 'zwiń animację <img src="grafika/arrow_up.jpg" id="arrow_img" border="0" />';
		div.destHeight = maxHeight;
		
		div.style.display = 'block';
	}
	
	div.style.height = div.destHeight+'px';
	
/*	
	div.Animation = window.setInterval(
		function() {
			div.cureHeight = Number(div.style.height.substr(0, div.style.height.length - 2));
		
			if (div.cureHeight > div.destHeight) div.cureHeight -= getSpeed(div.cureHeight, div.destHeight);
			else if (div.cureHeight < div.destHeight) div.cureHeight += getSpeed(div.destHeight, div.cureHeight);
			else window.clearInterval(div.Animation);
			
			div.style.height = div.cureHeight+'px';
		}
	, 20);
*/

}

function updateFlash(value) {
	xmlhttp_get = false;

	if (window.XMLHttpRequest) {
		xmlhttp_get = new XMLHttpRequest();
	} else if (window.ActiveXObject) { 
		try {
			xmlhttp_get = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				xmlhttp_get = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}

	xmlhttp_get.open('GET', 'flash.php?val='+value+'&amp;rand='+new Date(), true);
	xmlhttp_get.setRequestHeader('Content-Type','text/html; charset=iso-8859-2;'); 
	xmlhttp_get.send(null);
}
