function OA_adjs(z,n,c,div_id, div2_id){
	if (location.host == 'dobrzemieszkaj.pl' || location.host == 'www.dobrzemieszkaj.pl' || location.host == 'www.dobrzemieszkaj.com.pl' || location.host == 'dobrzemieszkaj.com.pl'){
		if (z>-1) {
	
			var az="<"+"script language='JavaScript' type='text/javascript' ";
			az += "src='"+OA_p+"//www.openx.dobrzemieszkaj.pl/www/delivery/ajs.php?n="+n+"&zoneid="+z;
			az +="&source="+OA_channel+"&exclude="+document.OA_used+"&r="+OA_r;
			az +="&mmm_fo="+(document.mmm_fo)?'1':'0';
			az +="&tag="+OA_tag;
			az +="&div="+div2_id;
			
			if (c != null) az += "&count="+c;
			if (document.context) az += "&context=" + escape(document.context);
			if (window.location) az +="&loc="+escape(window.location);
			if (document.referrer) az +="&referer="+escape(document.referrer);
			az+="'><"+"/script>";
			document.write(az);
		}
	}
}

function show_div(div){
	if (document.getElementById(div)){
		document.getElementById(div).style.display = '';
	}
}

function check_divs(div_id,div2_id){
	var child_list = (document.getElementById(div_id)).childNodes;
	for (var i = 0 ; i < child_list.length; i++){
		if((child_list.item(i)).tagName == 'DIV'){
			document.getElementById(div2_id).style.display = '';
			break;
		}
	}
}

//toplayer

var topl_width = 0;
var topl_height = 0;

var poz_poz = 0;
var poz_pion = 200;

var psapl = 6;
var psii = 0; var psij;
var badElems=["SELECT","IFRAME","APPLET","EMBED"];
var backupElems=[];
var plugin;
var psaie = (document.all && (window.navigator.userAgent.indexOf ("Opera") == -1)) ? true : false;
var psting;

function $_s(id) {
	return document.getElementById(id).style;
}

function shsel(vis) {
	if(backupElems && (backupElems.length>0)){
		for(psii=0;psii<backupElems.length;psii++){
			if(backupElems[psii].length>0)
				for(psij=0;psij<backupElems[psii].length;psij++)
			if(backupElems[psii][psij].style)
				backupElems[psii][psij].style.visibility=vis;
		}
	}
}

function onFinishedPlaying() {
	/*if (psaie) shsel('visible');
	$_s('toplayer').visibility='hidden';*/
	if (document.getElementById('toplayer')){
		document.body.removeChild(document.getElementById('toplayer'));
	}
	
	if (window.attachEvent){
		window.detachEvent("onresize", pshorp);
		window.detachEvent("onscroll", psvert);
	}else{
		window.removeEventListener("resize",pshorp, false);
		window.removeEventListener("scroll",psvert, false);
	}
	
}

function top_layer_close(){
	onFinishedPlaying();
}

function pshorp(){
	if (document.getElementById('toplayer')){
		get_sizes();
		$_s('toplayer').left = poz_poz+'px';
		$_s('toplayer').top = poz_pion+'px';
	}
}

function psvert() {
	if (document.getElementById('toplayer')){
		if (psting) clearTimeout(psting);
		psfro = parseInt($_s('toplayer').top);
		pstto = poz_pion + ((document.body.scrollTop) ? document.body.scrollTop : document.documentElement.scrollTop);
		if (psfro > pstto) $_s('toplayer').top = (psfro - ((psfro-pstto)/14)) + 'px';
		if (psfro < pstto) $_s('toplayer').top = (psfro + ((pstto-psfro)/14)) + 'px';
		if (psfro != pstto)psting = setTimeout("psvert();",20);
	}
}

function pspl() {
	/*if (psaie) {
		for(psii=0;psii<badElems.length;psii++){
			backupElems[psii]=document.getElementsByTagName?document.getElementsByTagName(badElems[psii]):document.all?document.all.tags(badElems[psii]):""; 
		}
		shsel('hidden'); 
	}*/
	
	$_s('toplayer').visibility='visible';
	
	pshorp();
	psvert();
	
	setTimeout("onFinishedPlaying();",30000);
	
	if (window.attachEvent) {
		window.attachEvent("onresize", pshorp);
		window.attachEvent("onscroll", psvert);
	}else {
		window.addEventListener("resize",pshorp, false);
		window.addEventListener("scroll",psvert, false);
	}
}

function run_top_layer(){
	topl_width = document.getElementById('toplayer').offsetWidth;
	topl_height = document.getElementById('toplayer').offsetHeight;
	get_sizes();
	document.getElementById('toplayer').style.left = poz_poz+'px';
	document.getElementById('toplayer').style.top = poz_pion+'px';
	pspl();
}

function GetInsideWindowSize() {
	if (window.innerWidth) {
		return {x:window.innerWidth, y:window.innerHeight};
	} else if (document.compatMode && document.compatMode.indexOf("CSS1") >= 0) {
		return {x:document.body.parentNode.clientWidth, y:document.body.parentNode.clientHeight};
	} else if (document.body && document.body.clientWidth) {
		return {x:document.body.clientWidth, y:document.body.clientHeight};
	}
	return 0;
}


function get_sizes(){
	var window_size = GetInsideWindowSize();
	poz_poz = (window_size.x - topl_width) / 2;
	poz_pion = (window_size.y - topl_height) / 2;
}

function ElementsHS_gora_srodek(type){
}

function showExpand(div){
	div.style.overflow = 'visible';
}

function disableExpand(div){
	div.style.overflow = 'hidden';
}