/* 
 * cookies.js
 * 
 * Cookie-k kezelése
 * 
 */

function siteCookie(name, value) {
	return setCookie(name, value, 0, "/");
}

function setCookie(name, value, expire, path) {
	if (expire == 0 || !expire) {
		expire = new Date(new Date().getTime() + 24 *  60 * 60 * 90 * 1000);
	}
	document.cookie = name + "=" + escape(value) + "; expires=" + expire.toGMTString() + ((!path) ? "" : "; path=" + path);
}

function getCookie(name) {
	var search = name + "=";
	if (document.cookie.length > 0) {
		offset = document.cookie.indexOf(search);
		if (offset != -1) {
			offset += search.length;
			end = document.cookie.indexOf(";", offset);
			if (end == -1)
				end = document.cookie.length;
			return unescape(document.cookie.substring(offset, end));
		}
	}
}

function getCookieFlash(name, flashName) {
	//alert(getCookie(name));
	//show_props(document[flashName]);
	document[flashName].SetVariable(name, getCookie(name));
}
