function new_window(strToUrl)
{
 window.open(strToUrl, 'Widok','toolbar=no,scrollbars=no,width=570,height=420');
}
function new_window2(strToUrl)
{
 window.open(strToUrl, 'Spis','toolbar=no,scrollbars=yes,width=570,height=420');
}

function new_windowPrint(strToUrl)
{
 window.open(strToUrl, 'Wydruk','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=457,height=400');
}

function new_windowSize(strToUrl,name,width,height)
{
 window.open(strToUrl, name,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width= ' + (width) + ',height=' + (height));
}

function new_windowPrintArts(strToUrl)
{
 window.open(strToUrl, 'Wydruk','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=600,height=400');
}

function new_windowTopTen(strToUrl,name,width,height)
{
 window.open(strToUrl, name,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width= ' + (width) + ',height=' + (height));
}
function new_windowTopTen_pop(strToUrl,name,width,height)
{
 window.open(strToUrl, name,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width= ' + (width) + ',height=' + (height)+',left='+(screen.width/2-width/2)+',top='+(screen.height/2-height/2));
}

function new_windowTable(strToUrl, title, width,height)
{
 scrwidth = parseInt(width) + 30;
 window.open(strToUrl + "&width=" + width, 'Tabelka','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width= ' + ((width != 0) ? scrwidth  : 540) + ',height=' + (height));
}

function new_windowPhoto(strToUrl, title, width, height)
{
    window.open('/php/showimage.php?img=' + strToUrl + '&title=' + title, 'Galeria','titlebar=no,toolbar=no,resizable=no,scrollbars=no,status=no,menubar=no,width=' + (width + 100)+ ',height=' + (height + 45));
}

function new_windowPhoto_author(strToUrl, title, width, height, author)
{
    window.open('/php/showimage.php?img=' + strToUrl + '&title=' + title + '&author=' + author, 'Galeria','titlebar=no,toolbar=no,resizable=no,scrollbars=no,status=no,menubar=no,width=' + (width + 100)+ ',height=' + (height + 45));
}

function new_windowPhotok(strToUrl, title, width, height)
{
   window.open('/php/showimage2.php?img=' + strToUrl + '&title=' + title , 'okienko','titlebar=no,toolbar=no,resizable=no,scrollbars=yes,status=no,menubar=no,width=' + (width + 100)+ ',height=' + (height + 45));
}

function getCookieData(label) 
{
      var labelLen = label.length
      var cLen = document.cookie.length
      var i = 0
      while (i < cLen) {
         var j = i + labelLen
         if (document.cookie.substring(i,j) == label) {
            var cEnd = document.cookie.indexOf(";",j)

            if (cEnd == -1) {
                cEnd = document.cookie.length

            }
            return unescape(document.cookie.substring(j+1,cEnd))
         }
         i++
      }
      return ""
}


var base = new Date(0)
dateAdjustment = base.getTime()

function getExpParam() {        
var expDate = new Date()        
var dateInSecs = expDate.getTime()        

var oneWkFromNow = (7 * 24 * 60 * 60 * 1000) + dateInSecs - (2 * dateAdjustment)        

expDate.setTime(oneWkFromNow)                
                
return ("; expires=" + expDate.toGMTString())        

}

function savecookies(chk,sKey)
{


s = getCookieData(sKey)

if (chk.checked)
{

	if (s!="") 
	{
		s = s + "|" + chk.value;
	}
    else
	{
		s = "0|" + chk.value;
	}

}
else
{
	a = s.split("|")
	
	s="0"

    for (i=0; i<a.length; i++)
		if(a[i]!=chk.value && a[i]!=0)
		{
			if (s!="") 
			{
				s = s + "|" + a[i];
			}
			else
			{
				s = "0|" + a[i];
			}
		}
	
}


    var expParam = getExpParam();      
	document.cookie=sKey + "=" + escape(s) + expParam;
	return 0;

}
