/*
	°³¹ßÀÚ 		: 	±èÈ¿Áß(samtler@samtler.com)	msn: samtler@hotmail.com
	ÇÁ·Î±×·¥¸í	:	popup Help script 1.0
	¼³¸í		: 	ÆË¾÷Ã¢¿¡ ÇÊ¿äÇÑ ½ºÅ©¸³Æ®¿Í ÄíÅ°¼³Á¤À» ÅëÇÑ ¼³Á¤±â°£µ¿¾È ÆË¾÷Ã¢ Á¦¾î
	»ç¿ë¹ý		: 	
				@»õÃ¢¿ä±¸ ÆäÀÌÁö 	
					popup(»õÃ¢ÁÖ¼Ò, »õÃ¢ÀÌ¸§, °¡·Î, ¼¼·Î,top, left,½ºÅ©·Ñ, ÄíÅ°ÀÌ¸§); Çü½ÄÀ¸·Î »õÃ¢À» ¿äÃ»ÇÑ´Ù.
				@ÆË¾÷Ã¢ ÆäÀÌÁö
					popup_close(ÆûÀÌ¸§, ÄíÅ°ÀÌ¸§, ¸¸·á±â°£); À¸·Î È£Ãâ
					ÄíÅ° ¸¸·á ±â°£Àº ÀÏ¼ö ´ÜÀ§ : 24½Ã°£ÀÏ °æ¿ì 1·Î ¼³Á¤ÇÏ¸é µÊ.
					ÄíÅ°ÀÌ¸§¸¸ ¼³Á¤	=> ÄíÅ°°ªÀº ÀÚµ¿À¸·Î "done"ÀÌ¶ó´Â °ªÀ¸·Î ¼³Á¤µÊ
					close¹öÆ°¿¡ popup_close()È£Ãâ 
					Ã¼Å©¹Ú½º Áï Ã¼Å©½Ã ÇÏ·ç¾Èº¸ÀÌ±â µî.. ±â´ÉÀ» »ç¿ë½Ã 
					ex) popup_close(document.formName.checkboxName, cookieName, 1);

	ÀúÀÛ±Ç		: 	ÁÖ¼®À» »èÁ¦ÇÏÁö ¾Ê°í ¸¶À½´ë·Î ¹èÆ÷°¡´ÉÇÔ..
					Ãß°¡ °³¹ßÇÏ¿© º¯°æ½Ã GNUÁ¤¼ºÀ» ¹Þ¾Æµé¿© ÃÊ±â °³¹ßÀÚ¿¡°Ô »ç¿ë¹ý°ú ÇÔ²² ¸ÞÀÏ¹Ù¶ø´Ï´Ù.
					º¸´Ù ÁÁÀº ÇÁ·Î±×·¥À» À§ÇØ...
*/
/*

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( 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 setCookie( name, value, expiredays ) 
{ 
	var todayDate = new Date(); 
	todayDate.setDate( todayDate.getDate() + expiredays ); 
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";" 
	//alert( todayDate.setDate( todayDate.getDate() + expiredays ));
} 

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 popup(theURL,winName, nowWidth,nowHeight,nowTop, nowLeft, scrolling, cookieName){
	var d = new Date() ;
	var date_check  = d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() ;
	var month_check = d.getFullYear() + '-' + (d.getMonth() + 1) + '-00';
	
	var cih  = date_check + 'cih';
	//var nowCookie = month_check + cookieName;
	var nowCookie = cookieName;
	
	//alert( nowCookie + "=" + getCookie(nowCookie) );
	if (getCookie(nowCookie) != 'done' ) {
		window.open(theURL, winName, 'width='+ nowWidth+ ',height=' + nowHeight +',left=' + nowLeft + ',top=' + nowTop + ',toolbar=no,location=no,directories=no,status=no,resizable=no,scrollbars='+scrolling); 
	}
}

function popup_close(tform, cookieName,expiredays) 
{ 
   var d           = new Date() ;
   var date_check  = d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() ;
   var month_check = d.getFullYear() + '-' + (d.getMonth() + 1) + '-00' ;
   //var cookie_name = month_check + cookieName;

   if (tform.checked) { 
      	setCookie(cookieName, 'done' , expiredays ); 
		//alert( cookieName );//+ "=" + getCookie(cookie_name) );
       	self.close(); 
   } else { 
       	self.close(); 
   } 
}

