function newsletterKeyPressed(event,element) {
    var e = event ? event : window.event;
    var thisKey;
    if (nav == "Microsoft Internet Explorer") {
        currentElement = e.srcElement;
        thisKey = e.keyCode;
    }
    else {
        currentElement = element;
        thisKey = e.which;
    }


    if (thisKey == 13) {
        		if (document.getElementById('newsletter').value!="wpisz swój mail")
			{
			document.location.href="newsletter.php?newsletter="+document.getElementById('newsletter').value;
			}
    }
}


function ukryjZdjecie() {
    divWzor = document.getElementById('divZdjecia');
    imageWzor = divWzor.getElementsByTagName('img').item(0);
    divWzor.style.visibility = 'hidden';
    divWzor.style.left = 0;
    divWzor.style.top = 0;
    imageWzor.src = "";
}
function powiekszZdjecia(src) {
    divWzor = document.getElementById('divZdjecia');
    imageWzor = divWzor.getElementsByTagName('img').item(0);
    if (divWzor.style.visibility == 'visible') {
        divWzor.style.visibility = 'hidden';
        divWzor.style.left = 0;
        divWzor.style.top = 0;
        imageWzor.src = "";
    }
    else {
        divWzor.style.visibility = 'hidden';
        divWzor.style.left = 0;
        divWzor.style.top = 0;
        imageWzor.src = "";
        divWzor.style.visibility = 'visible';
        cursor = getPosition(event);
        divWzor.style.left = cursor.x;
        divWzor.style.top = cursor.y;
        imageWzor.src = src;
    }
}
function noty(divWzor) {
    elementWzor=divWzor.getElementsByTagName('div').item(0);
    if (elementWzor.style.visibility == 'visible') {
        elementWzor.style.visibility = 'hidden';
        elementWzor.style.position = 'absolute';
    }
    else {
        elementWzor.style.visibility = 'visible';
        elementWzor.style.position = 'static';
    }
   // document.getElementsByName('divNoty').length;
    for (i = 0; i < document.getElementsByTagName('div').length; i++) {
        if (divWzor != document.getElementsByTagName('div').item(i) && document.getElementsByTagName('div').item(i).name == 'divNoty') {
            divPom = document.getElementsByTagName('div').item(i);
            elementWzor = divPom.getElementsByTagName('div').item(0);
            elementWzor.style.visibility = 'hidden';
            elementWzor.style.position = 'absolute';

        }
    }
}

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_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_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_checkImage() 
{ //v3.0
	var i,j=0,k="nie",x,a=MM_checkImage.arguments; 
	for(i=0;i<(a.length-1);i=i+1)
	{
		x=document.getElementById(a[i]).src;
		if(x.indexOf(a[i+1])!=-1) 
		{
			k="tak";
		}
	}

return k;

    
}

function enter()
{

	if(event.keyCode=='13'){
		wyszukajClick();
	} 
}

function wyszukajClick() 
{ //v3.0
	var i,j=0,nazwiskoTytul,x,y;
	nazwiskoTytul="";
		x=document.getElementById('tytul').src;
		if(x.indexOf('elementy/wyszukiwarka/wyszukiwarkatytulb.jpg')==-1)
		{
			x=document.getElementById('autor').src;
			if(x.indexOf('elementy/wyszukiwarka/wyszukiwarkaautorb.jpg')!=-1)
			{
			nazwiskoTytul="Autor";			
			} 
		}
		else 
			nazwiskoTytul="Tytul";
		if (nazwiskoTytul!="")
		{
		if (document.getElementById('szukaj').value!="Szukaj")
			{
			document.location.href="index.php?"+nazwiskoTytul+"="+document.getElementById('szukaj').value+"&Podstrona=0";
			}
		}
		else
		{
		nazwiskoTytul="Tytul";
		if (document.getElementById('szukaj').value!="Szukaj")
			{
			document.location.href="index.php?"+nazwiskoTytul+"="+document.getElementById('szukaj').value+"&Podstrona=0";
			}
		}

}

function newsletterClick() 
{

		if (document.getElementById('newsletter').value!="wpisz swój mail")
			{
			document.location.href="newsletter.php?newsletter="+document.getElementById('newsletter').value;
			}

}
function getPosition(e) {
    e = e || window.event;
    var cursor = { x: 0, y: 0 };
    if (e.pageX || e.pageY) {
        cursor.x = e.pageX;
        cursor.y = e.pageY;
    }
    else {
        var de = document.documentElement;
        var b = document.body;
        cursor.x = e.clientX +
            (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0);
        cursor.y = e.clientY +
            (de.scrollTop || b.scrollTop) - (de.clientTop || 0);
    }
    return cursor;
}

