function jah(url,target) {
    document.getElementById(target).innerHTML = '';
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
        req.onreadystatechange = function() {jahDone(target);};
        req.open("GET", url, true);
        req.send(null);
		
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
            req.onreadystatechange = function() {jahDone(target);};
            req.open("GET", url, true);
            req.send();
        }
    }
}    

function jahDone(target) {
    // only if req is "loaded"
    if (req.readyState == 4) {
        // only if "OK"
        if (req.status == 200) {
            results = req.responseText;
            document.getElementById(target).innerHTML = results;
			
        } else {
            document.getElementById(target).innerHTML="jah error:\n" +
                req.statusText;
        }
    }
}

function requestPoster($chosen_poster, $gal_id){
	var openWithParam= "strony/pl/show_photo.php?chosen_poster="+$chosen_poster;
	
	f1=document.getElementById('foto').style;
	f2=document.getElementById('foto2').style;
	if(f2.display=='none') {
		f2.display='';
		f1.display='none';
	}
	//setYfoto($gal_id);
	jah(openWithParam,"foto2");
	
}

/*function setYfoto (element) {
	y = document.getElementById(element).offsetTop-30;
	document.getElementById('foto2').style.marginTop=y;
}*/

function hideMe(id)
{

hIdh=document.getElementById('hideId'+id).style;
w=document.getElementById('w_'+id).style;
z=document.getElementById('z_'+id).style;
if(hIdh.display=='none') {
	hIdh.display='';
	w.display='none';
	z.display=''; 
	}
	else {
		hIdh.display='none';
		w.display='';
		z.display='none'; 
	}

}
function hideMeN()
{
hIdn=document.getElementById('hideIdn').style;
w=document.getElementById('w_n').style;
z=document.getElementById('z_n').style;
if(hIdn.display=='none') {
	hIdn.display='';
	w.display='none';
	z.display=''; 
	}
	else {
		hIdn.display='none';
		w.display='';
		z.display='none'; 
	}
}
		