var okno='';
function p(wi,he,uerel,alignx,aligny,scrol)
{
	if(okno &&!okno.closed){okno.close()}
	if(wi=='100%'){wi=screen.availWidth-30}
	if(he=='100%'){he=screen.availHeight-0}
	if(alignx=='left'){xx=0}
	else if(alignx=='right'){xx=(screen.availWidth-wi)-10}
	else{xx=(screen.availWidth-wi)/2}
	if(aligny=='top'){yy=0}
	else if(aligny=='bottom'){yy=(screen.availHeight-he)}
	else{yy=(screen.availHeight-he)/2}
	
	if(wi>screen.availWidth || he>screen.availHeight){
		wi+=16;
		he+=16;
		scrol = 'yes';
	}
	
	okno=window.open(uerel, '_blank', 'scrollbars='+scrol+',height='+he+',width='+wi+',top='+yy+',left='+xx);
}

function rt(x, y){
		window.resizeTo(x,y);
	}

function createFlash(movie, wdth, hght, bgnd, idName, cel, fVars)
{
	obj_setFlash = document.getElementById(cel);
	objTag = '<object width="'+wdth+'" height="'+hght+'" type="application/x-shockwave-flash" data="'+movie+'"><param name="movie" value="'+movie+'" /><param name="quality" value="high" /><param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer" /></object>';
 	obj_setFlash.innerHTML=objTag;
}

function changeV(id){
	if(document.getElementById('gal'+id).style.display=='none' || !document.getElementById('gal'+id).style.display){
		document.getElementById('gal'+id).style.display = 'block';
		document.getElementById('galName'+id).style.backgroundImage = "url('images/gal_on_bg.gif')";
	}
	else{
		document.getElementById('gal'+id).style.display = 'none';
		document.getElementById('galName'+id).style.backgroundImage = "url('images/gal_off_bg.gif')";
	}
}

function drukuj(idw){
	p('780', '500', 'wynikToPrint.php?idw='+idw, '', '', 'yes');	
}

function drukujText(ids){
	p('780', '500', 'pageToPrint.php?ids='+ids, '', '', 'yes');	
}

function countdown(yr,m,d){
	var today=new Date()
	var todayy=today.getFullYear()
	var todaym=today.getMonth()
	var todayd=today.getDate()
	var todaystring=montharray[todaym]+" "+todayd+", "+todayy
	var futurestring=montharray[m-1]+" "+d+", "+yr
	var difference=(Math.round((Date.parse(futurestring)-Date.parse(todaystring))/(24*60*60*1000))*1)
	if (difference==0)
	document.write(current)
	else if (difference>0)
	document.write("Zostało "+difference+" dni do "+before)
}