/** (c) 2008,  Marcin Wrzyciel **/
function include_banner(loc, type){
 	uid = "ban_"+loc+"_"+type
	cv = Cookie.get(uid);
	document.write('<div id="ban_'+loc+'_'+type+'" style="display:none"></div>');
//	window.addEvent("domready", function(){
		url = abs_path +'getbanner.php?loc='+loc+'&type='+type;
		url += (cv != "")? '&last='+cv: '';
		new Ajax(url, 
				{ method: 'get', onComplete: function(){
				    $ad  = Json.evaluate(this.response.text);
				    if( 1 == $ad.errcode) return;
				    // zapisanie jaki baner byl ostanio na tej pozycji
				    uid =  "ban_"+$ad.sekcja_id+"_"+$ad.miejsce_id;
				    Cookie.set(uid, $ad.id);
				    if($ad.banner_typ == "img"){
				    	//img
				    	a = new Element('a', {'href': $ad.odnosnik});
				    	img = new Element('img', {'src': abs_path + $ad.zrodlo, 'target': $ad.okno});
				    	img.injectInside(a);
				    	a.injectInside(uid);
				    }else{
				    	// flash
				    	so = new SWFObject(abs_path + $ad.zrodlo, uid, $ad.szerokosc, $ad.wysokosc, "7", '', true );
					//so.addVariable("clickTag", "http://www.domena.pl/reklama_pop.php?kbor=132";);

				    	so.write(uid);
				    }
				    $(uid).setStyle('display','');
				} }).request();
//	});
}