//funkcje do podmiany zdjec
function fon(n){document.images[n].src='grafika/'+n+'.gif';}
function foff(n){document.images[n].src='grafika/'+n+'1.gif';}

//funkcja do wyswietlania popupu
var okno='';
function popup(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}
	okno=window.open(uerel, '_blank', 'scrollbars='+scrol+',height='+he+',width='+wi+',top='+yy+',left='+xx);
}

/* (c) Konrad */
function show(co, wi, he)
{
  wii = wi + 40;
  hee = he + 20;
	
  if ( screen.availHeight - 50 < hee )
	  hee = screen.availHeight - 50;
	
  if ( screen.availWidth < wii )
	{
	  wii = screen.availWidth - 30;
		hee += 10;
	}
	
  if ( okno && !okno.closed )
	  okno.close();
	
  xx = ( screen.availHeight - hee ) / 2 - 10;
  yy = ( screen.availWidth - wii ) / 2;
  okno = window.open( 'about:blank', '', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,fullscreen=no,channelmode=no,height=' + hee + ',width=' + wii + ',top=' + xx + ',left=' + yy );
  okno.document.write( '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><HTML><HEAD><META CONTENT="text/html; charset=iso-8859-2" HTTP-EQUIV=Content-Type><META NAME="Author" CONTENT="www.venti.com.pl"><TITLE>Sorel</TITLE></HEAD><BODY style="background: #fff; margin: 0px; padding: 0px"><TABLE WIDTH="100%" height="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0"><tr><td style="padding:5px 10px; text-align: center; vertical-align: middle"><a onfocus="blur()" href="javascript:self.close()"><img src="'+co+'" width="'+wi+'" height="'+he+'" style="border: 1px solid #ddd"></a></td></tr></TABLE></BODY></HTML>' );
}

function ScrollToElement( theElement )
{
	e = document.getElementById( theElement );
	
	var selectedPosX = 0;
	var selectedPosY = 0;
	          
	while ( e != null )
	{
		selectedPosX += e.offsetLeft;
		selectedPosY += e.offsetTop;
		e = e.offsetParent;
	} // END while ( e != null )
	                    		      
	window.scrollTo( selectedPosX, selectedPosY );
} // END function ScrollToElement( theElement )

/* (c) Bartek */
function BlurAll()
{
	var links = document.getElementsByTagName('a');
	for ( var i = 0; i < links.length; i++ )
	{
  	links[i].onfocus = BlurMe;
  }
}

function BlurMe()
{
	this.blur();
}

function Init()
{
	BlurAll();
	return true;
}


function checkclear(what){
	if(!what._haschanged){
	  what.value=''
	};
	what._haschanged=true;
}

function openInNewWindow(e) {
	var event;
	if (!e) event = window.event;
	else event = e;
	if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) {
		return true;
	}
	else {
	    var newWindow = window.open(this.getAttribute('href'), '_blank');
		if (newWindow) {
			if (newWindow.focus) {
				newWindow.focus();
			}
			return false;
		}
		return true;
	}
}

function getNewWindowLinks() {
	if (document.getElementById && document.createElement && document.appendChild) {
		var strNewWindowAlert = "";
		var links = document.getElementsByTagName('a');
		var objWarningText;
		var link;
		for (var i = 0; i < links.length; i++) {
			link = links[i];
			if (/\bnon\-html\b/.test(link.className)) {
				objWarningText = document.createElement("em");
				objWarningText.appendChild(document.createTextNode(strNewWindowAlert));
				link.appendChild(objWarningText);
				link.onclick = openInNewWindow;
			}
		}
		objWarningText = null;
	}
}


