function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
	eval(targ + ".location='" + selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}


function PokazZwin(id){
	var div = document.getElementById(id);

	if(div.style.display == 'none'){
		div.style.display = 'block';
	}else{
		div.style.display = 'none';
	}
}

function PokazZwinSlownik(id){

	var div = document.getElementById(id);
	var link = document.getElementById('link_'+id);
	if(div.style.display == 'none'){
		div.style.display = 'block';
		link.className = 'link_slownik_on';
	}else{
		div.style.display = 'none';
		link.className = 'link_slownik';
	}
		//$('#'+id).toggle("normal");
}

function drukuj(id,typ){
	displayWindow('drukuj.php?id='+id+'&typ='+typ,670,600);
}

function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width + ',height=' + height + 'resizable=no,scrollbars=no,menubar=no' );
} 

function SendNewsletter(value)
{
 if (value == 0) document.getElementById('opcjanews').value='off';
 else document.getElementById('opcjanews').value='on';

 document.newsletter.submit();
}

var ilosc_dosw=1;
function KolejneDoswiadczenieZawodowe(max){
	ilosc_dosw=ilosc_dosw+1;
	$('#doswiadczenie'+ilosc_dosw).toggle();
	if(ilosc_dosw==max)
		$('#link_dodaj_kolejna').toggle();
	$('#ilosc_doswiadczen').value=ilosc_dosw;
}

var ilosc_wyksz=1;
function KolejneWyksztalcenie(max){
	ilosc_wyksz=ilosc_wyksz+1;
	$('#wyksztalcenie'+ilosc_wyksz).toggle();
	if(ilosc_dosw==max)
		$('#link_dodaj_kolejna_wyksz').toggle();
	$('#ilosc_wyksztalcen').value=ilosc_wyksz;
}

//DODAJ DO ULUBIONYCH
function addToBookmarks( sTitle, sHref ) 
	{
	//Wersja skryptu 1.0
	//Modyfikacji dokonał: Krzysztof Samelko
	//Data: 2008-05-12

	if( window.sidebar && window.sidebar.addPanel ) 
		{
		//Gecko (Netscape 6 etc.) - add to Sidebar
		window.sidebar.addPanel( sTitle, sHref, '' );
		} 
	else if( window.external && ( navigator.platform == 'Win32' || ( window.ScriptEngine && ScriptEngine().indexOf('InScript') + 1 ) ) ) 
		{
		//IE Win32 or iCab - checking for AddFavorite produces errors for no
		//good reason, so I use a platform and browser detect.
		//adds the current page page as a favourite; if this is unwanted,
		//simply write the desired page in here instead of 'location.href'
		window.external.AddFavorite( window.location.href, document.title );
		} 
	else if( window.opera && window.print ) 
		{
		
		//window.open('js/opera_dodaj_do_ulubionych.php','','width=150,height=50');
		//Opera 6+ - add as sidebar panel to Hotlist
		return true;
		} 
	else if( document.layers ) 
		{
		//NS4 & Escape - tell them how to add a bookmark quickly (adds current page,
		//not target page)
		window.alert( 'Proszę kilknąć Ctrl+D aby dodać strone do ulubionych' );
		} 
	else 
		{
		//other browsers - tell them to add a bookmark (adds current page, not target page)
		window.alert( 'Proszę użyć menu przeglądarki by utworzyć dodać strone do ulubionych' );
		}
	return false;
	}
//DODAJ DO ULUBIONYCH

function getWindowWidth() {
 
  var r;
 
  if(document != null && document.body != null)
    r = document.body.clientWidth;
  else if(document != null && document.documentElement != null)
    r = document.documentElement.clientHeight;
 
  return r;
 
}
 
function getWindowHeight() {
 
  var r;
 
  if(document != null && document.body != null)
    r = document.body.clientHeight;
  else if(document != null && document.documentElement != null)
    r = document.documentElement.clientHeight;
 
  return r;
 
}
 
// this is a simple convenience method allowing us
// to fetch a document's element easily
function getElement(id) {
 
  var r;
 
  if(document.getElementById)
    r = document.getElementById(id);
  else if(document.all)
    r = document.all[id];
 
  return r;
 
}
 
function checkForSize() {
 
  var w = getWindowWidth();
  var h = getWindowHeight();
 
  var e = getElement("flash");
 
  if(w == null || h == null || e == null)
    return;
 
  if(w < minwidth)
    e.style.width = minwidth;
  else
    e.style.width = "100%";
 
  if(h < minheight)
    e.style.height = minheight;
  else
    e.style.height = "100%";
 
}

