// File Name : window.js

/*

 ÇÁ·¹ÀÓ ÇÔ¼ö
 ==========================
 void		parentframe(w)	 	»óÀ§ÇÁ·¹ÀÓ location ¹Ù²Ù±â
 void		popWindow(wname,fname,width,height,resizable,scrollbar) : À©µµ¿ì ÆË¾÷Ã¢ ¿­±â
 void		chWindow1(page1, frame1, page2, frame2) : 2°³ ÇÁ·¹ÀÓÆäÀÌÁö º¯°æ 
 void		chWindow2(p1, f1, p2, f2, p3, f3) : 3°³ ÇÁ·¹ÀÓÆäÀÌÁö º¯°æ
 void		chWindow3(p1, p2)  : p1Àº ÇöÀçÃ¢À» p2´Â »õÃ¢À¸·Î openÇÑ´Ù.
 void		viewCalendar(form_name, obj_name, date_value) : ´Þ·Â popupÃ¢

 */


/*=======================
 ÇÁ·¹ÀÓ ÇÔ¼ö 
 ========================*/

//»óÀ§ÇÁ·¹ÀÓ location ¹Ù²Ù±â
function parentframe(w)
{
  parent.location.href = w;
}

// À©µµ¿ì ÆË¾÷Ã¢ ¿­±â
function popWindow(url, fname, width, height, resizable, scrollbar)
{
  
  if(!resizable)
  {
    resizable = "yes";
  }
  if(!scrollbar)
  {
    scrollbar = "yes"; 
  }
  
  var scrX = (screen.width / 2) - (width / 2);
  var scrY = (screen.height / 2) - (height / 2);
  var specs = "width=" + width + ",height=" + height + ",left=" + scrX + ",top=" + scrY + ",";
      specs += "directories=no, location=no, locationbar=no, menubar=no, status=yes, titlebar=no, toolbar=no";
      specs += ", resizable=" + resizable + ", scrollbars=" + scrollbar;
  
  var opn = window.open(url, fname, specs);
  opn.focus();
}


function openCookiePopup(cookieName, url, fname, width, height, left, top, resizable, scrollbar, force)
{
//  var cookieValue = getCookie(cookieName);
  var cookieValue = getCookie(url);
  if(cookieValue == null || cookieValue != "nopop" || force)
  {
    if(!width) width = 800;
    if(!height) height = 600;
    if(!left) left = (screen.width / 2) - (width / 2);
    if(!top) top = (screen.height / 2) - (height / 2);
    if(!resizable) resizable = "yes";
    if(!scrollbar) scrollbar = "yes"; 
    
    var specs = "width=" + width + ",height=" + height + ",left=" + left + ",top=" + top + ",";
        specs += "directories=no, location=no, locationbar=no, menubar=no, status=yes, titlebar=no, toolbar=no";
        specs += ", resizable=" + resizable + ", scrollbars=" + scrollbar;
    
    var opn = window.open(url, fname, specs);
    opn.focus();
  }
  else
  {
//    setCookie(cookieName, null);
  }
}

function closeCookiePopup()
{
  var cookieName = window.location.pathname;
//  setCookie(popupCookieName, "nopop", 24 * 60 * 60, "/cne/hmms/popup/");
//  setCookie(popupCookieName, "nopop", 24 * 60 * 60, "/");
  setCookie(cookieName, "nopop", 24 * 60 * 60, "/");
//  alert(cookieName + "===" + getCookie(cookieName));
  window.close();
}

// ÇÁ·¹ÀÓÆäÀÌÁö º¯°æ
function chWindow1(page1, frame1, page2, frame2)
{
  if (page1 != null && page1 != "") {
    window.open(page1, frame1);
  }
  if (page2 != null && page2 != "") {
    window.open(page2, frame2);
  }
}

function chWindow2(p1, f1, p2, f2, p3, f3)
{
  window.open(p1, f1);
  window.open(p2, f2);
  window.open(p3, f3);
}

// new window
function chWindow3(p1, p2)
{
  window.open(p1, "_self");
  window.open(p2, "_blank");
}
