function setCookiePop(name, value, expiredays)
{
	var c_date = new Date();
	c_date.setDate( c_date.getDate() + expiredays );
	document.cookie = name+"=" + escape(value) + "; path=/; expires=" + c_date.toGMTString() + ";";
}
function getCookiePop( 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 close_popup(cooknm, cookval, cookday )
{
	setCookiePop(cooknm, cookval, cookday );
	window.close();
}

function open_popup(idx, title,img,cooknm,cookday,wname, x,y,w,h )
{
	if( getCookiePop( cooknm ) == "" ) {
		var url = "/popup/popup.html?";
		url+="idx=" + idx;
		url+="&title="+title;
		url+="&img="+img;
		url+="&cooknm="+cooknm;
		url+="&cookday="+cookday;
		window.open(url, 
					wname 
					,"left="+x+", top="+y+", width="+w+", height="+h+", toolbar=no, menubar=no, statusbar=no, scrollbars=yes, resizable=yes");
	}
}

