
//  -- ÂÊÁö
function processNewMemo ()
{
  var p_memo_up = 200;
  if ('string'!=typeof(my_memo_newcount.innerHTML))
  {
    setTimeout("processNewMemo()", p_memo_up);
    p_memo_up *= 2;
    return;
  }
  p_memo_up = 200;

  if ('object'==typeof(AppletSession) && ''!=AppletSession.getvalue('memo_cnt_new') && AppletSession.getvalue('memo_cnt_new') > 0)
    //my_memo_newcount.innerHTML = "<strong>" + AppletSession.getvalue('memo_cnt_new')+"</strong><img src='http://file.pmang.kr/images/pmang/debut/cb/img/common/img_info_num.gif' alt='°³' class='img_num'>";
    my_memo_newcount.innerHTML = "<strong>" + AppletSession.getvalue('memo_cnt_new')+"</strong>Åë <img src='http://file.pmang.kr/images/pmang/debut/cb/bbs/img/ico_bbs_new.gif' class='ico_new'> ";
  else
    //my_memo_newcount.innerHTML = " 0 <img src='http://file.pmang.kr/images/pmang/debut/cb/img/common/img_info_num.gif' alt='°³' class='img_num'>";
     my_memo_newcount.innerHTML = "<strong>0</strong> Åë";
}

function checkSystem(checked)
{
    var result = checkCominfo(checked);
    if ( result != "" )
      document.all.my_com_info.value=result;
    else
      document.all.my_com_info.value="";
}

function CheckSystem()
{
        //virtual_fr.location = "http://www.pmang.com/gamepub/check_system.nwz";
    virtual_fr.location = "/gamepub/check_system.nwz";
}

function addSystemAndSubmit()
{
    var str = idEditorIframe.getHTML();
    if ( document.fo_board_post.is_allow_information.checked == true )
    {
      var cominfo = document.fo_board_post.my_com_info.value;
      cominfo = cominfo.replace(/(\n)/g,"<br>");
      if (cominfo != "") {
        cominfo = "<br><br>======================================================================<br>" + cominfo;
        str = str + cominfo;
      }
    }
    setHTML(str);
    formSubmit();
}


function setPng24(obj) {
    obj.width=obj.height=1;
    obj.className=obj.className.replace(/\bpng24\b/i,'');
    obj.style.filter =
    "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"
    obj.src='';
    return '';
}

function dt_begin_game()
{
  close_player();
  //location.href="http://www.pmang.com/gamepub/game_running.nwz?ssn=328";
  location.href="/gamepub/game_running.nwz?ssn=328";
}

function dt_finish_game()
{
  execGameEndProc(328);
}

function dt_start()
{
  run_pubgame();
}

function gamestart()
{
  run_pubgame();
}

function selectTicket()
{
   var product_id = document.all.giftticket.value;
   if (product_id != 'X') giftTicket(product_id);
}
function giftTicket(saleinfo_id)
{
  open_win('http://www.pmang.com/gamepub_gift_ticket.nwz?saleinfo_id='+saleinfo_id+'&ssn=328','',420,600);
}

function viewUserInfo(usn, main_no)       // modifeid by iprid123 2008-12-23
{
  var go_url = "";

  if (main_no == 1)
  {
    go_url = '/debut_user_info.nwz?usn='+usn;
  }
  else if (main_no == 2)
  {
    go_url = '/debut_user_item_present.nwz';
  }
  else
  {
    go_url = '/debut_user_friends_request.nwz';
  }
    window.open(go_url, 'debut_detail_info', 'resizable=no, scrollbars=no,scrolling=no, width=434,height=416');
}
// Åä±Û modified by iprid123 start
function ViewContentDT(ID,bCalcOffset)
  {
    var oPreview = document.getElementById(ID);
    if (!oPreview) return;

    var cPreview = oPreview.cloneNode(true);

   var offsetY = 0;
    if (bCalcOffset) {
      offsetY = this.offsetY;
      if (!offsetY) {
        offsetY = 0;
        var o = oPreview;
        while (o.offsetParent)
        {
          offsetY += o.offsetParent.offsetTop;
          offsetY += o.offsetParent.clientLeft;
          o = o.offsetParent;
        }
        this.offsetY = offsetY;
      }
    }

    oPreview.style.top = document.body.scrollTop + event.clientY + 10 - offsetY;
    oPreview.style.display = "block";
  }

  function HideContentDT(ID)
  {
    var o = document.getElementById(ID);
    if (o) o.style.display = "none";
  }
// Åä±Û modified by iprid123 end

// µ¥ºäÇÁ·ÎÇÊ »ç¿ëÁß ¾ÆÀÌÅÛ Á¤º¸
function useItemInfo(itemname,start,end,rate) {

}
function useItemMsg(name,start,end,rate) {

}

// modfied by iprid123 start 2009-01-16

  function goSearchShop()
  {
      var obj       = document.getElementById("searchkey");

      if (obj.value.length < 2 )
      {
        open_alert("my","°Ë»öÇÒ »óÇ°¸íÀ» ÃÖ¼Ò 2ÀÚ ÀÌ»ó ÀÔ·ÂÇØ ÁÖ¼¼¿ä..","<?=$html->title?>",370,260,"È® ÀÎ",80,"",0);
        return;
      }
      else
      {
          key = obj.value;
      }
      location.href="/debut_shop_list.nwz?searchkey=" + key;
  }

  function goGiftCashItem(chargeid)
  {
   // var url = "http://www.pmang.com/gamepub_gift.nwz?saleinfo_id="+chargeid+"&&ssn=328";
    var url = "/gamepub/pm/gamepub_gift.nwz?saleinfo_id="+chargeid+"&&ssn=328";
    open_win(url, '_buy', 430, 400);
  }

  function multListItem(type, icon)
  {
        var obj = document.getElementById("ST_" + icon);
         //alert(obj.value);
         if (type == 'b')
         {
              goPurchaseCashItem(obj.value);
         }
         else
         {
                goGiftCashItem(obj.value);
         }
  }

  function goPurchaseCashItem(chargeid)
  {
    //var url = "http://www.pmang.com/gamepub_purchase.nwz?saleinfo_id="+chargeid+"&&ssn=328";
  var url = "/gamepub/pm/gamepub_purchase.nwz?saleinfo_id="+chargeid+"&&ssn=328";
    open_win(url, '_buy', 430, 400);
  }

  function goItemInfo(icon)
  {
  var s_id = '';
  var obj = document.getElementById("ST_" + icon);

  if (obj != null )
  {
    var s_id = obj.value;
  }

    var url = "/debut_shop_detail.nwz?icon="+icon+"&s_id="+s_id;
    open_win(url, '_buy', 380, 460);
  }

// modifeid by iprid123 end 2009-01-16

// modified by iprid123 start 2009-01-29 ¼±¹°ÇÔ


function OpenGiftBox(gift_srl)
{
   var title = "Debut ¼±¹°¹Þ±â";

  if (!open_confirm("my", "¼±¹°¹ÞÀº ¾ÆÀÌÅÛÀ» »ç¿ëÇÏ½Ã°Ú½À´Ï±î?<br><br>(<b>¿¹</b>¸¦ ¼±ÅÃÇÒ °æ¿ì º¸À¯Áß ¶Ç´Â »ç¿ëÁßÀÎ ¾ÆÀÌÅÛÀ¸·Î ÀÌµ¿ÇÕ´Ï´Ù.)", title, 420, 220, "¿¹", "70", "¾Æ´Ï¿À", "70", "", ""))
    return;
  else
    //strRetMsg = virtualGET("http://www.pmang.com/debut/item/debut_item_proc.nwz?action_type=DT_OPEN_GIFTBOX&gift_srl="+ gift_srl);
  strRetMsg = virtualGET("/item/debut_item_proc.nwz?action_type=DT_OPEN_GIFTBOX&gift_srl="+ gift_srl);

  var out_value = strRetMsg.substr(0,1);
  var msgs       = strRetMsg.substr(2);

  if (out_value == 1) {

    var SayModal = open_alert("my",msgs,title,370,260,"È® ÀÎ",80,"",0);

    if (SayModal) {

      location.reload();

    }

  }else{

    var SayModal = open_alert("my",msgs, title,370,260,"È® ÀÎ",80,"",0);

  }
}

  function GoDebutDescription(icon)
  {
      try {
            var obj       = document.getElementById("ST_" + icon);
            if (obj.value != "")
            {
              location.href="/debut_shop_detail.nwz?icon=" + icon + "&s_id=" + obj.value;
            }

      } catch( E ) {}
  }
// modified by iprid123 end 2009-01-29

  function openNick(id)
  {
     document.location.href="/item/debut_item_use.nwz?item_id=" + id;
  //  open_win(url, 'change', 380, 388);

  }

//ÁÖ¹Î¹øÈ£ Ã¼Å©~
function isValidSSNCode(front, back) {

  var birthday = front.value;
  var num = back.value;

  var hap = 0;
  for(var i=0; i < 6; i++) {
    var temp = birthday.charAt(i) * (i+2);
    hap += temp;
  }

  var n1 = num.charAt(0);
  var n2 = num.charAt(1);
  var n3 = num.charAt(2);
  var n4 = num.charAt(3);
  var n5 = num.charAt(4);
  var n6 = num.charAt(5);
  var n7 = num.charAt(6);

  hap += n1*8+n2*9+n3*2+n4*3+n5*4+n6*5;
  hap %= 11;
  hap = 11 - hap;
  hap %= 10;
  if(hap != n7) {

    alert("Àß¸øµÈ ÁÖ¹Î¹øÈ£¸¦ ÀÔ·ÂÇÏ¼Ì½À´Ï´Ù.");
    front.focus();
    return false;
  }

  return true;
}


// º¯°æ°¡´ÉÇÑ ´Ð³×ÀÓ °Ë»ö
function searchNickname()
{
  if( arguments.length > 0 )
  {
    var objNick = document.getElementById( "new_nickname" + arguments[0] );
    switch( true )
    {
      case ( objNick.value.length==0 ):
        alert('´Ð³×ÀÓÀ» ÀÔ·ÂÇÏ¿© ÁÖ¼¼¿ä');
        break;
      case ( objNick.value.length < 2 ):
        alert('ÃÖ¼Ò 2±ÛÀÚ ÀÌ»óÀ» ÀÔ·ÂÇÏ¿© ÁÖ¼¼¿ä');
        break;
      case ( objNick.value.length > 12 ):
        alert('ÃÖ´ë 12±ÛÀÚ ÀÌÇÏ¸¦ ÀÔ·ÂÇÏ¿© ÁÖ¼¼¿ä');
        break;
      default :
        var syncObject = new Object();
        syncObject.async = false;
        syncObject.timeout = 2000;
        syncObject.url = "/item/debut_item_proc.nwz";
        syncObject.type = "POST";
        syncObject.dataType = "json";
        syncObject.data = {"action_type":"DT_CHECK_NICKNAME","is_checked":null,"new_nicknam":objNick.value};
        alert( $.ajax( syncObject ).responseText );
        /*
        eval("auth = "+);
        if( arguments.length>0 && arguments[0] && false )
        {
          $('#dialog').dialog({ autoOpen:false, modal: true, resizable: false, width:400, height:350 });
          $('#dialog').dialog('option', 'buttons', { "È®ÀÎ":function(){ $('#dialog').dialog('close'); } });
          $("#dialog").html( this.serialize( auth ) );
          $('#dialog').dialog('open');
        }
        auth.objdate = new Date();
        */
        return;
    }
    objNick.focus();
    return;
  }
  else
  {
    if ( document.fo.new_nickname.value == '' )
    {
      alert('´Ð³×ÀÓÀ» ÀÔ·ÂÇÏ¿© ÁÖ¼¼¿ä');
      document.fo.new_nickname.focus();
      return;
    }

    if ( document.fo.new_nickname.value.length < 2 )
    {
      alert('ÃÖ¼Ò 2±ÛÀÚ ÀÌ»óÀ» ÀÔ·ÂÇÏ¿© ÁÖ¼¼¿ä');
      document.fo.new_nickname.focus();
      return;
    }
    if ( document.fo.new_nickname.value.length > 12 )
    {
      alert('ÃÖ´ë 12±ÛÀÚ ÀÌÇÏ¸¦ ÀÔ·ÂÇÏ¿© ÁÖ¼¼¿ä');
      document.fo.new_nickname.focus();
      return;
    }

    document.fo.target = "virtual_fr";
    document.fo.action = "/item/debut_item_proc.nwz";
    document.fo.submit();
  }
}


// modified by iprid123 2009-03-10 start

function multListItemNew(type, icon)
{

     try
   {
    var obj = document.getElementById("ST_" + icon);

    switch( type )
    {
      case 'b': goPurchaseCashItemNew( obj.value ); break;
      case 'g': goGiftCashItemNew( obj.value ); break;
      case 'd': goItemViewDT( obj.value, icon ); break;
    }
    } catch( E ) { alert( "¿À·ù : " + E.message ); }

}

function goItemViewDT( saleinfo_id,  icon )
{
  pub_shop.showdetail( 328, saleinfo_id, icon);
}

function goGiftCashItemNew(saleinfo_id)
{
  pub_shop.gift( 328, saleinfo_id );
}

function goPurchaseCashItemNew(saleinfo_id)
{
  pub_shop.buy( 328, saleinfo_id );
}

// modified by iprid123 2009-03-10 end