function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
function eraseCookie(name) {
	createCookie(name,"",-1);
}
function addToCookie(name, value) {
	var old = readCookie(name);
	if (old == null) createCookie(name, value);
	else createCookie(name,parseInt(old)+value);
}
function hideNotify() {
	node = document.getElementById('alertLayer')
	if (node) {	
		document.getElementsByTagName('BODY')[0].removeChild(node);
	}
}	
	
function showNotify() {

	height = (navigator.appName.indexOf("Netscape") != -1) ? pageYOffset + (innerHeight/2) - 140 : document.body.scrollTop + (document.body.clientHeight/2) -140;
	hideNotify();	
	notifyLayer = document.createElement('div')
	notifyLayer.id = "alertLayer";
	notifyLayer.onclick = function () {hideNotify();};
	notifyLayer.style.height =((navigator.appName.indexOf("Netscape") != -1) ? pageYOffset + innerHeight: document.body.scrollTop + document.body.clientHeight) +'px';
	notify = document.createElement('div')
	notify.id = "addToCartAlert";
	ifr = document.createElement('iframe');
	ifr.id = "alertIfr";
	ifr.frameBorder = "0";
	ifr.style.marginTop = (height)+'px';
	ifr.setAttribute('allowtransparency',true);

	
	pIntro = document.createElement('p');
	pIntroText = document.createTextNode('Produkt został dodany do listy.');
	pIntro.appendChild(pIntroText);

	pContener = document.createElement('div');
	pContener.id="alertContener";
	pContener.innerHTML = "<h2>Moja lista zakupów</h2><span onclick='hideNotify()'></span><p>Produkt został dodany do listy.</p>"+
		"<div><input type='button' class='btnOK' onclick='hideNotify();'/><input type=\"button\" class=\"btnShowList\" onclick=\"openWindowSc('/mpng2-front/pre?zone=productlistZone','700','800','yes');hideNotify();\"/></div>"
	notify.appendChild(pContener);
	notifyLayer.appendChild(ifr);
	notifyLayer.appendChild(notify);
	
		
	
	document.getElementsByTagName('BODY')[0].appendChild(notifyLayer);	
	
}

