function $(id) { return document.getElementById(id); }
function $$(id) { return window.opener.document.getElementById(id); }

function jump(url) {
	location.href = url;
}

function photo(id) {
  window.open("/obrazek-"+id+".htm", '', "toolbar=no, location=no, scrollbars=yes");
}

function youtube(id) {
  window.open("/youtube-"+id+".htm", '', "toolbar=no, location=no, scrollbars=yes");
}


function scrollTop() {
	if (window.pageYOffset != undefined) return window.pageYOffset;
	if (document.documentElement.scrollTop != undefined) return document.documentElement.scrollTop;
	if (document.body.scrollTop != undefined) return document.body.scrollTop;
	return 0;
}

function simple_ajax(url) {
    var http_request = false;
    if (window.XMLHttpRequest) { // Mozilla, Safari,...
        http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType) {
            //http_request.overrideMimeType('text/xml');
        }
    } else if (window.ActiveXObject) { // IE
        try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
        }
    }
    if (!http_request)
    	return false;

	http_request.open('GET', url, true);
	http_request.send(null);
}


function show(sender, description) {
	$('big_img').src = 'img/loading.gif';
	$('big_img').height = 32;
	$('big_img').width = 32;
	$('img_desc').innerHTML = 'Wczytywanie...';
	$('img_div').style.display='block';
	$('img_div').style.top = scrollTop() + 10 + 'px';

	var img = new Image;
	img.onload = function() {
//		$('img_div2').style.backgroundImage = 'url(' + img.src + ')';
//		$('img_div2').style.backgroundRepeat = 'no-repeat';
//		$('img_div2').style.backgroundPosition = 'center center';
//		$('big_img').src = 'img/blank.gif';
		$('img_desc').innerHTML = (description != undefined) ? description : '';
		$('big_img').src = img.src;
		$('big_img').height = img.height;
		$('big_img').width = img.width;
	}

	img.src = sender;
	return true;
}

function hide() {
	$('img_div').style.display='none';
}
