function readCookie(cookie){
	index = document.cookie.indexOf (cookie + "=");
	if (index == -1) return 0;
   	   	   	   	
	start = document.cookie.indexOf ("=", index) + 1;
	meta = document.cookie.indexOf ("; ", start);

	if (meta < start) meta = document.cookie.length;

	return document.cookie.substring (start, meta); 
}

// czas podajemy w sekundach
function setCookie(variable, value, time){
	// ustawienie daty ważności
	expires = new Date();
	oneYearFromNow = expires.getTime() + (365 * 24 * 60 * 60 * 1000);
	
	timeFromNow = expires.getTime() + (time * 1000);
	
	expires.setTime(timeFromNow);
	
	document.cookie = variable + '=' + value + '; expires=' + expires.toGMTString(); 
}

function delCookie(variable){
	document.cookie = variable + '=; expires=-1';
}

function checkFlash(FlashDoc, nonFlashDoc){
	if (readCookie("pageStyle") == 'flash') doc = FlashDoc;
	else if (read("pageStyle") == 'nonflash') doc = nonFlashDoc;
	else doc = nonFlashDoc;

	checkBrowser();
	if (IE4) top.frames[2].frames[0].location.href = doc;
	else top.frames[0].location.href = doc;
}