function getCookie( name )
{
	var nameOfCookie = name + "=";
	var x = 0;
	while ( x <= document.cookie.length )
	{
		var y = (x+nameOfCookie.length);
		if ( document.cookie.substring( x, y ) == nameOfCookie ) 
		{
			if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
			endOfCookie = document.cookie.length;
			return unescape( document.cookie.substring( y, endOfCookie ) );
		}
		x = document.cookie.indexOf( " ", x ) + 1;

		if ( x == 0 )
			break;
	}
	return "";
}

function openPopupGetPosition(width,height)
{
	var adjT, adjL, rtnStr
	adjL   = (screen.availWidth - width) / 2
	adjT   = (screen.availHeight - height) / 2
	rtnStr = ',top='+adjT+',left='+adjL
	return rtnStr
}

function openPopup(url,width,height,cname,opts)
{
	var popName, popNameOri, allowOpen
	popName    = 'CJFEEDPOPUP'
	popNameOri = popName
	allowOpen  = true

	if (cname != null)
	{
		var noticeCookie = getCookie(cname)
		if (noticeCookie == "no")
		{
			allowOpen = false
			popName = cname
		}
	}

	if(allowOpen)
	{
		var strSize = 'width='+width+',height='+height
		var strPos  = openPopupGetPosition(width,height)
		window.open(url,cname,strSize+strPos+opts)
	}
}

