  // New Version
  function openAlert(imgdir, title, msg, width, height, MODALESS)/*{{{*/
  {
    return openSayDialog(imgdir, title, msg, width, height, MODALESS, 0);
  }/*}}}*/

  function openAlertNoIcon(imgdir, title, msg, width, height, MODALESS)/*{{{*/
  {
    var oSayDialog = new SayDialog();
    if ("undefined" != typeof(imgdir) && imgdir) oSayDialog.imgdir   = imgdir;
    if ("undefined" != typeof(msg)    && msg)    oSayDialog.msg      = msg;
    if ("undefined" != typeof(title)  && title)  oSayDialog.title    = title;
    if ("undefined" != typeof(width)  && width)  oSayDialog.width    = width;
    if ("undefined" != typeof(height) && height) oSayDialog.height   = height;
    if ("undefined" != typeof(MODALESS))         oSayDialog.modaless = MODALESS;
    oSayDialog.iconImg   = "";
    oSayDialog.isConfirm = 0;
    return oSayDialog.display();
  }/*}}}*/

  function openConfirm(imgdir, title, msg, width, height, MODALESS)/*{{{*/
  {
    return openSayDialog(imgdir, title, msg, width, height, MODALESS, 1);
  }/*}}}*/

  function openSayDialog(imgdir, title, msg, width, height, MODALESS, isConfirm)/*{{{*/
  {
    var oSayDialog = new SayDialog();
    if ("undefined" != typeof(imgdir) && imgdir) oSayDialog.imgdir   = imgdir;
    if ("undefined" != typeof(msg)    && msg)    oSayDialog.msg      = msg;
    if ("undefined" != typeof(title)  && title)  oSayDialog.title    = title;
    if ("undefined" != typeof(width)  && width)  oSayDialog.width    = width;
    if ("undefined" != typeof(height) && height) oSayDialog.height   = height;
    if ("undefined" != typeof(MODALESS))          oSayDialog.modaless = MODALESS;
    oSayDialog.isConfirm = isConfirm;
    return oSayDialog.display();
  }/*}}}*/

  function SayDialog()/*{{{*/
  {
    this.display = sayDialog_Display;
    
    this.imgdir    = "common";
    this.title     = "¿À·ù";
    this.msg       = "¿À·ù°¡ ¹ß»ýÇÏ¿´½À´Ï´Ù.";
    this.width     = 360;
    this.height    = 220;
    this.align     = "left";

    this.isConfirm = 0;

    this.modaless  = false;

    this.btnLink_1 = "";
    this.btnImg_1  = _getSSLResourceURL("http://file.sayclub.co.kr/images/incredible/search/button/btn_confirm.gif");
    this.btnLink_2 = "";
    this.btnImg_2  = _getSSLResourceURL("http://file.sayclub.co.kr/images/incredible/search/button/btn_cancel.gif");

    this.iconImg   = _getSSLResourceURL("http://file.sayclub.co.kr/images/incredible/search/bullet/icon_i.gif");
  }/*}}}*/

  function sayDialog_Display()/*{{{*/
  {
    var sayDialog = null;
    var sURL = "";
    var vArguments = new Array();
    var sFeatures = "";

    sURL = _getSSLURL("http://"+location.hostname+"/global/SayModalPop05.nwz?")+"imgdir="+this.imgdir+"&isconfirm="+this.isConfirm+"&align="+this.align;

    vArguments["title"]     = this.title;
    vArguments["msg"]       = this.msg;
    vArguments["btnLink_1"] = this.btnLink_1;
    vArguments["btnImg_1"]  = this.btnImg_1;
    vArguments["btnLink_2"] = this.btnLink_2;
    vArguments["btnImg_2"]  = this.btnImg_2;
    vArguments["iconImg"]   = this.iconImg;

    sFeatures = "dialogWidth:"+this.width+"px; dialogHeight:"+this.height+"px; edge:sunken; center:yes; resizable:no; status:no; help:no; scroll:no;";

    if (!this.modaless)
      sayDialog = window.showModalDialog(sURL, vArguments, sFeatures);
    else
      sayDialog = window.showModelessDialog(sURL, vArguments, sFeatures);

    return sayDialog;
  }/*}}}*/



  function open_alert(moduleID, msg, winTitle, winWidth, winHeight, btnTitle, btnWidth, icon, MODALESS)/*{{{*/
  {
    var args = new Array();

    if(!moduleID || 'undefined' == typeof(moduleID))
      var moduleID = "www";
    if(!msg || 'undefined' == typeof(msg))
      var msg = "¿À·ù°¡ ¹ß»ýÇÏ¿´½À´Ï´Ù."
    if(!winTitle || 'undefined' == typeof(winTitle))
      var winTitle = "¿À·ù"
    if(!winWidth || 'undefined' == typeof(winWidth))
      var winWidth = 360;
    if(!winHeight || 'undefined' == typeof(winHeight))
      var winHeight = 220;
    if(!btnTitle || 'undefined' == typeof(btnTitle))
      var btnTitle = "È®ÀÎ";
    if(!btnWidth || 'undefined' == typeof(btnWidth))
      var btnWidth = "70";
    if(icon && 'undefined' != typeof(icon))
      args["icon"]      = icon;
    if(moduleID=='sayting')
    {
       return openAlert('chatting', winTitle, msg, winWidth, winHeight,MODALESS);
    }

    args["msg"]       = msg;
    args["winTitle"]  = winTitle;
    args["btnTitle"]  = btnTitle;
    args["btnWidth"]  = btnWidth;
    args["btnLink"]  = "javascript:yessir()";

    if (moduleID == 'sayteen')
    {
      //args["icon"]      = "<img src=http://file.sayclub.co.kr/images/ditto//main/u_replynone.gif >";
      args["btnImage"]  = "<img src=http://file.sayclub.co.kr/images/incredible/search/button/btn_confirm.gif>";
    }


    var SayDialog = null;
		var popurl = "";
		if( parseInt ( moduleID ) == moduleID ) popurl = "http://"+location.hostname+"/global/GamePubModalPop.nwz?";
		else popurl = "http://"+location.hostname+"/global/SayModalPop.nwz?";

    if(!MODALESS || 'undefined' == typeof(MODALESS))
      SayDialog = window.showModalDialog(_getSSLURL(popurl)+"moduleID="+moduleID+"&title="+winTitle, args,
                  "dialogWidth:"+winWidth+"px; dialogHeight:"+winHeight+"px; edge:sunken; center:yes; resizable:no; status:no; help:no; scroll:no;");
    else
      SayDialog = window.showModelessDialog(_getSSLURL(popurl)+"moduleID="+moduleID+"&title="+winTitle, args,
                  "dialogWidth:"+winWidth+"px; dialogHeight:"+winHeight+"px; edge:sunken; center:yes; resizable:no; status:no; help:no; scroll:no;");

    return SayDialog;
  }/*}}}*/

  function open_confirm(moduleID, msg, winTitle, winWidth, winHeight, btnTitle, btnWidth, btn2Title, btn2Width, icon, MODALESS)/*{{{*/
  {
    var args = new Array();

    if(!moduleID || 'undefined' == typeof(moduleID))
      var moduleID = "www";
    if(!msg || 'undefined' == typeof(msg))
      var msg = "¿À·ù°¡ ¹ß»ýÇÏ¿´½À´Ï´Ù."
    if(!winTitle || 'undefined' == typeof(winTitle))
      var winTitle = "¿À·ù"
    if(!winWidth || 'undefined' == typeof(winWidth))
      var winWidth = 360;
    if(!winHeight || 'undefined' == typeof(winHeight))
      var winHeight = 220;
    if(!btnTitle || 'undefined' == typeof(btnTitle))
      var btnTitle = "¿¹";
    if(!btnWidth || 'undefined' == typeof(btnWidth))
      var btnWidth = "70";
    if(!btn2Title || 'undefined' == typeof(btn2Title))
      var btn2Title = "¾Æ´Ï¿À";
    if(!btn2Width || 'undefined' == typeof(btn2Width))
      var btn2Width = "70";
    if(icon && 'undefined' != typeof(icon))
      args["icon"]      = icon;

    args["msg"]       = msg;
    args["winTitle"]  = winTitle;
    args["btnTitle"]  = btnTitle;
    args["btnWidth"]  = btnWidth;
    args["btnLink"]  = "javascript:yessir();";
    args["btn2Title"] = btn2Title;
    args["btn2Width"] = btn2Width;
    args["btn2Link"]  = "javascript:nosir();";

    var SayDialog = null;
    var popurl = "";
		if( parseInt ( moduleID ) == moduleID ) popurl = "http://"+location.hostname+"/global/GamePubModalPop.nwz?";
    else popurl = "http://"+location.hostname+"/global/SayModalPop.nwz?";
						
    if(!MODALESS || 'undefined' == typeof(MODALESS))
      SayDialog = window.showModalDialog(_getSSLURL( popurl )+"moduleID="+moduleID+"&title="+winTitle, args,
                  "dialogWidth:"+winWidth+"px; dialogHeight:"+winHeight+"px; edge:sunken; center:yes; resizable:no; status:no; help:no; scroll:no;");
    else
      SayDialog = window.showModelessDialog(_getSSLURL( popurl )+"moduleID="+moduleID+"&title="+winTitle, args,
                  "dialogWidth:"+winWidth+"px; dialogHeight:"+winHeight+"px; edge:sunken; center:yes; resizable:no; status:no; help:no; scroll:no;");

    return SayDialog;
  }
  function open_dialog(moduleID, msg, winTitle, winWidth, winHeight, btnTitle, btnWidth, btnLink, btn2Title, btn2Width, btn2Link, icon, MODALESS)
  {
    var args = new Array();

    if(!moduleID || 'undefined' == typeof(moduleID))
      var moduleID = "www";
    if(!msg || 'undefined' == typeof(msg))
      var msg = "¿À·ù°¡ ¹ß»ýÇÏ¿´½À´Ï´Ù."
    if(!winTitle || 'undefined' == typeof(winTitle))
      var winTitle = "¿À·ù"
    if(!winWidth || 'undefined' == typeof(winWidth))
      var winWidth = 360;
    if(!winHeight || 'undefined' == typeof(winHeight))
      var winHeight = 220;
    if(!btnTitle || 'undefined' == typeof(btnTitle))
      var btnTitle = "¿¹";
    if(!btnLink || 'undefined' == typeof(btnLink))
      var btnLink = "javascript:yessir()";
    if(!btnWidth || 'undefined' == typeof(btnWidth))
      var btnWidth = "70";
    if(btn2Title != '' && 'undefined' != typeof(btn2Title))
      args["btn2Title"] = btn2Title;
    if(btn2Link != '' && 'undefined' != typeof(btn2Link))
      args["btn2Link"]  = btn2Link;
    if(btn2Width != '' && 'undefined' != typeof(btn2Width))
      args["btn2Width"] = btn2Width;
    if(icon != '' && 'undefined' != typeof(icon))
      args["icon"]      = icon;

    args["msg"]       = msg;
    args["winTitle"]  = winTitle;
    args["btnTitle"]  = btnTitle;
    args["btnLink"]   = btnLink;
    args["btnWidth"]  = btnWidth;

    var SayDialog = null;

    if(!MODALESS || 'undefined' == typeof(MODALESS))
      SayDialog = window.showModalDialog(_getSSLURL("http://"+location.hostname+"/global/SayModalPop.nwz?")+"moduleID="+moduleID+"&title="+winTitle, args,
                  "dialogWidth:"+winWidth+"px; dialogHeight:"+winHeight+"px; edge:sunken; center:yes; resizable:no; status:no; help:no; scroll:no;");
    else
      SayDialog = window.showModelessDialog(_getSSLURL("http://"+location.hostname+"/global/SayModalPop.nwz?")+"moduleID="+moduleID+"&title="+winTitle, args,
                  "dialogWidth:"+winWidth+"px; dialogHeight:"+winHeight+"px; edge:sunken; center:yes; resizable:no; status:no; help:no; scroll:no;");

    return SayDialog;
  }/*}}}*/

  function _getSSLURL(url)
  {
    if (typeof(getSSLURL) != "function")
      return url;
    return getSSLURL(url);
  }

  function _getSSLResourceURL(imgsrc)
  {
    if (typeof(getSSLResourceURL) != "function")
      return imgsrc;
    return getSSLResourceURL(imgsrc);
  }

  function _isOverXPSP2()/*{{{*/
  {
    var strVerStr = window.navigator.appVersion;
    var arrVerStr = strVerStr.split('; ');
    if( arrVerStr.length >= 4 )
    {
      var arrOsVer = arrVerStr[2].split(' ');
      if( arrOsVer.length >= 3 && arrOsVer[0] == "Windows" )
      {
        var osVerNum = new Number(arrOsVer[2]);
        if( osVerNum >= 5.1 && strVerStr.indexOf("SV1") >= 35 ) // »õ·Î¿î Windows Version ³ª¿Ã¶§ ¼öÁ¤ÇÊ¿ä
          return true;
      }
    }
    return false;
  }/*}}}*/


  // Modal Window resize
  function resizeModalWindow(width, height)/*{{{*/
  {
    window.dialogHeight = ''+(width)+'px';
    window.dialogWidth  = ''+(height)+'px';
  }/*}}}*/

  // Modal Window¿ë auto resize
  function autoResizeModalWindow(scrollHH, clientHH)/*{{{*/
  {
    if( typeof(scrollHH) == 'undefined' )
      var scrollHH = window.document.all.tags("body")[0].scrollHeight;
    if( typeof(clientHH) == 'undefined' )
      var clientHH = window.document.all.tags("body")[0].clientHeight;
    //var offsetHH = window.document.all.tags("body")[0].offsetHeight;
    var dialogHH = new Number((window.dialogHeight+"").replace("px", ""));
    var frameHH = dialogHH - clientHH;
    var diffHH = 0;
    var overHH = 0;
    if( frameHH > 40 ) // exist status bar (sp1°íÀü-29,sp1±âº»-36, sp2°íÀü-49, sp2±âº»-56) // status bar size = always 20
    {
      diffHH = 24;
      overHH = frameHH - 49;
    }
    else
    {
      diffHH = 28;
      overHH = frameHH - 29;
    }

    if( _isOverXPSP2() )
      diffHH *= 2;

    diffHH += overHH;

    var resizeHH = scrollHH + diffHH;

    window.dialogHeight = ''+resizeHH+'px';
    window.dialogWidth  = ''+(window.document.all.tags("body")[0].scrollWidth+10)+'px';
  }/*}}}*/

function hp_alert(msg,line,type,title)/*{{{*/
{
  var args = new Array();
  var win_title;
  var height;

  if(typeof(title) == "undefined")
    win_title = "ÇÔ²²ÇÏ¸é Áñ°Å¿î »ç¶÷µé, ¼¼ÀÌÅ¬·´";

  // 1: ¼º°ø , 2: ´À³¦Ç¥, 3:½ÇÆÐ
  if(type == 1)
    args["icon"] = "http://file.sayclub.co.kr/images/hompy2/bu_hompy14.gif";
  else if(type == 2)
    args["icon"] = "http://file.sayclub.co.kr/images/incredible/hompy2/bullet/ic_notice.gif";
  else if(type == 3)
    args["icon"] = "http://file.sayclub.co.kr/images/hompy2/bu_hompy15.gif";

  args["msg"] = msg;
  if(line == "1" || line == "2")
  {
    args["height"] = "48";
    height = 158;
  }
  if(line == "3")
  {
    args["height"] = "65";
    height = 175;
  }
    
  var retVal = showModalDialog("http://"+location.hostname+"/global/hp_modalpop.nwz?title="+win_title ,args,"dialogWidth:357px;dialogHeight:"+height+"px;edge:sunken; center:yes; resizable:no; status:no; help:no; scroll:no;");
  return retVal;
} /*}}}*/

function hp_confirm(msg,line,from)/*{{{*/
{ 
  var args = new Array();
  var win_title;

  if(typeof(win_title) == "undefined")
    win_title = "ÇÔ²²ÇÏ¸é Áñ°Å¿î »ç¶÷µé, ¼¼ÀÌÅ¬·´";

  // 1: ¼º°ø , 2: ´À³¦Ç¥, 3:½ÇÆÐ
  args["from"] = from;
  args["icon"] = "http://file.sayclub.co.kr/images/hompy2/bu_hompy10.gif";
  args["msg"] = msg;
  args["line"] = line;
  args["confirm"] = "TRUE";

  if(line == "1" || line == "2")
  {
    args["height"] = "48";
    height = 158;
  }
  if(line == "3")
  {
    args["height"] = "65";
    height = 175;
  }

  var retVal = showModalDialog("http://"+location.hostname+"/global/hp_modalpop.nwz?title="+win_title ,args,"dialogWidth:358px;dialogHeight:158px;edge:sunken; center:yes; resizable:no; status:no; help:no; scroll:no;");
  
  return retVal;
}/*}}}*/

function hp_popup(str,width,link1,link2,title,header,debug)/*{{{*/
{
  if(typeof(str) == 'undefined')  return;
  if(typeof(width) == 'undefined') width = 400;
  if(typeof(link1) == 'undefined') link1 = 'javascript:self.close();';
  if(typeof(link2) == 'undefined') link2 = '';
  if(typeof(title) == 'undefined') title = 'ÇÔ²²ÇÏ¸é Áñ°Å¿î »ç¶÷µé, ¼¼ÀÌÅ¬·´';
  if(typeof(header) == 'undefined') header = '';
  if(typeof(debug) == 'undefined') debug = 0;
  
  link1 = escape(link1);
  link2 = escape(link2);
  title = escape(title);
  header = escape(header);
  popWin = window.open('http://hompy.sayclub.com/hp_popup.nwz?title='+title+'&link1='+link1+'&link2='+link2+'&header='+header+'&dc='+debug, '', 'width='+width+',height=350,scrollbars=no,resizable=yes');
  popWin.opener = opener;
  AppletSession.setvalue('hp_popup_str_var',str);
}/*}}}*/

function hp_popup_scroll(str,width,height,link1,link2,title,header,debug)/*{{{*/
{
  if(typeof(str) == 'undefined')  return;
  if(typeof(width) == 'undefined') width = 400;
  if(typeof(height) == 'undefined') height = 350;
  if(typeof(link1) == 'undefined') link1 = 'javascript:self.close();';
  if(typeof(link2) == 'undefined') link2 = '';
  if(typeof(title) == 'undefined') title = 'ÇÔ²²ÇÏ¸é Áñ°Å¿î »ç¶÷µé, ¼¼ÀÌÅ¬·´';
  if(typeof(header) == 'undefined') header = '';
  if(typeof(debug) == 'undefined') debug = 0;
  
  link1 = escape(link1);
  link2 = escape(link2);
  title = escape(title);
  header = escape(header);
  popWin = window.open('http://hompy.sayclub.com/hp_popup.nwz?no_auto_fit_wnd=1&title='+title+'&link1='+link1+'&link2='+link2+'&header='+header+'&dc='+debug, '', 'width='+width+',height='+height+',scrollbars=yes,resizable=yes');
  popWin.opener = opener;
  AppletSession.setvalue('hp_popup_str_var',str);
}/*}}}*/

function chat_alert(title, msg)/*{{{*/
{
  args["msg"] = msg;
  var retVal = showModalDialog("http://"+location.hostname+"/global/chat_modalpop.nwz?title="+title ,args,"dialogWidth:324px;dialogHeight:169px;edge:sunken; center:yes; resizable:no; status:no; help:no; scroll:no;");
}/*}}}*/

