var expDays = 90;var exp = new Date();exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
function CookieManager(id){Who(id);Count();}
function Who(id){var Visitor = GetCookie('Visitor');if(Visitor==null){Visitor=id;SetCookie('Visitor',Visitor,exp);}return Visitor;}
function Count(){var visits = GetCookie('visits');if(visits == null){visits=0;}else{visits++;}SetCookie('visits',visits,exp);return visits;}
function getCookieVal(offset){var endstr=document.cookie.indexOf (';', offset);if(endstr==-1)endstr=document.cookie.length;return unescape(document.cookie.substring(offset, endstr));}
function GetCookie(name){var arg=name+'=';var alen=arg.length;var clen=document.cookie.length;var i=0;while(i<clen){var j=i+alen;if(document.cookie.substring(i,j)==arg)return getCookieVal(j);i=document.cookie.indexOf(' ', i)+1;if(i==0)break;}return null;}
function SetCookie(name,value){var argv=SetCookie.arguments;var argc=SetCookie.arguments.length;var expires=(argc>2)?argv[2]:null;var path=(argc>3)?argv[3]:null;var domain=(argc>4)?argv[4]:null;var secure=(argc>5)?argv[5]:false;var string=name+'='+escape(value)+((expires == null)?'':('; expires='+expires.toGMTString()+''))+((path == null)?('; path='+'/'):('; path='+path))+((domain==null)?'':('; domain='+domain))+((secure==true)?'; secure':'');document.cookie=string;}
// Modyfikacja 2005-10-3
// zapisuje do ciasteczka wartosc pól formularza, które podane zostały kao argument
function saveFormValue4cookie() {var args=saveFormValue4cookie.arguments;    
for(i=0; i<args.length; i++) {o=GetObject(args[i]);if(o!=undefined) SetCookie(args[i],o.value); if(args[i]==undefined) break;}}
// odczytuje podane jako argument
function readFormValue4cookie() {
var val,args=readFormValue4cookie.arguments 
for(i=0; i<args.length; i++){val = GetCookie(args[i]);val=(val=='null' || val==null)?'':val;o=GetObject(args[i]);
if(o!=undefined && val!='') o.value = val;if(args[i]==undefined) break;}}  
// usuwa podane jako argument
function removFormValue4cookie(){var args=removFormValue4cookie.arguments; 
for(i=0; i<args.length; i++){o = GetObject(args[i]); if(o!=undefined) SetCookie(args[i],null);if(args[i]==undefined) break;}}
/* 2006-06-18 - obsługa wybranych Chosen */
/* Cookie add Chossen */
function cac(chosname,addvalue){var my=GetCookie(chosname),newcookie,i=0;my=(my!=''&&my!=null)?my.split(','):new Array();for(var a=0;a<my.length;a++){if(my[a]!='')i++;}my[i]=addvalue;newcookie=my.join(',');return SetCookie(chosname,newcookie);}
/* Cookie delete chossen */
function cdc(chosname,RemValue){var my=GetCookie(chosname),newcookie,newArray=new Array(),i=0;my=(my!=''&&my!=null)?my.split(','):new Array();for(var a=0;a<my.length;a++){if(my[a]!=RemValue&&my[a]!=''){newArray[i]=my[a];i++;}}newcookie=newArray.join(',');return SetCookie(chosname,newcookie);}
/* Sprawdza czy dane id jest w ciostku */
function isChosen(chosname,id) {
  var my=GetCookie(chosname);
  my=(my!=''&&my!=null)?my.split(','):new Array();
  i=0;
  for(var a=0;a<my.length;a++) { 
    if(my[a] == id) return 1;
  } 
  return 0;
}
/* Cookie Zwraca liczbę wybranych elementów */
function allChosen(chosneName){my=GetCookie(chosneName);my=(my!=''&&my!=null)?my.split(','):new Array();return(my.length>0)?my.length:'0';}
/* Czyści ciastko z wybranych */
function clearChosen(chosneName){SetCookie(chosneName,'')}

function testBrowser() { SetCookie('testBrowser',1); return GetCookie('testBrowser'); }