
function setCookie(name, value, expiredays){
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}

function getCookie(uName) {
	var flag = document.cookie.indexOf(uName+'=');
	if (flag != -1) { 
		flag += uName.length + 1
		end = document.cookie.indexOf(';', flag) 
		if (end == -1) end = document.cookie.length
		return unescape(document.cookie.substring(flag, end))
	}
}

function newPopup(href,width,height,top,left) {
	window.open(href, "", "toolbar=no, location=no, directories=no, status=no, menubar=no, resizable=no, scrollbars=no, width="+width+", height="+height+",top="+top+",left="+left);
}

function closeDay(name, value, expiredays) 
{
	setCookie(name, value, expiredays);
	self.close();
}

function checkPopUp(uName, wd, ht, tp, lf) 
{
	if (getCookie(uName) != 'sdmpp') 
	{
		newPopup("/popup/"+uName,wd,ht,tp,lf);
	}
}
