//<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">

// ¿Â·Îµå ½ÇÇà ÇÔ¼ö
function OnloadFunction() {
  //OnloadReplace();
  allBlur();  
}

// png
function png(obj) { 
  var IE_Version = new Number(((window.navigator.appVersion.split('; '))[1].split(' '))[1]);
  if (IE_Version >= 6) {
    obj.width=obj.height=1; 
    obj.className=obj.className.replace(/\bpng\b/i,''); 
    obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');" 
    obj.src='';  
    return ''; 
  }
} 


// ·Î±×ÀÎ ¿µ¿ª BG 
function LoginBgChange() {
  var ThisInput = event.srcElement;
  ThisInput.style.backgroundPosition = "left bottom";
}

// ÅÇµ¿Àå
function TabMove(name,num) {
  if(!document.getElementsByName(name)) return false;
  
  var TabGroup = document.getElementsByName(name);
  var TabThis = num-1;
  
  for(i=0; i<TabGroup.length; i++) {
    var TabName = name+(i+1);
    var TabContents = document.getElementById(TabName);
    if(i==TabThis) {
      TabGroup[TabThis].className = "on";
      TabContents.style.display = "block";
    }
    else {
      TabGroup[i].className = "";
      TabContents.style.display = "none";
    }
  }
}

// ·¹ÀÌ¾î º¸±â
function OverLayer(name) {
  if(!document.getElementById(name)) return false;
  
  var Layer = document.getElementById(name);  
  Layer.style.display = "block";
  
  if(name == 'GmaeInfo') {
    GameInfoShadow();
  }
  
  if(name == 'BoomLayer') {
	var o = document.getElementsByName('giftticket')[0];
	if (o) o.style.visibility = 'hidden';
  }
}
function OutLayer(name) {
  if(!document.getElementById(name)) return false;
  
  var Layer = document.getElementById(name);  
  Layer.style.display = "none";

  if(name == 'BoomLayer') {
	var o = document.getElementsByName('giftticket')[0];
	if (o) o.style.visibility = 'visible';
  }
}

// ·¹ÀÌ¾îÅä±Û
function toggleLayer(id) {
  if(!document.getElementById(id)) return false;
  
  var Layer = document.getElementById(id);

  if(id=='MyFriendList' && Layer.offsetParent.tagName!='BODY') {
    var LayerTop = findPosY(Layer);
    var LayerLeft = findPosX(Layer);
    document.getElementsByTagName('body')[0].insertBefore(Layer,document.getElementsByTagName('body')[0].firstChild);
    Layer.style.position = 'absolute';
    Layer.style.top = LayerTop+22+'px';
    Layer.style.left = LayerLeft+2+'px';
  }
  
  if(Layer.style.display == 'block') Layer.style.display = 'none';
  else Layer.style.display = 'block'; 
}

// °ÔÀÓÁ¤º¸ ±×¸²ÀÚ
function GameInfoShadow() {
  document.getElementById('GameInfoShadow').style.height = document.getElementById('GameInfo').firstChild.clientHeight;
}


// ´Ù¿î·Îµå ¸Þ´º±¸¼º
function GetDownloadMenu(MainNum,Subnum) {

  var DownloadMenuIndex = new Array();
  /* 01.½ºÆä¼ÈÆ÷½º */ DownloadMenuIndex[1] = new Array("01.½ºÆä¼ÈÆ÷½º","°ÔÀÓ¼Ò°³");
  /* 02.°ÔÀÓÁØºñ   */ DownloadMenuIndex[2] = new Array("02.°ÔÀÓÁØºñ","´Ù¿î·Îµå","¼³Ä¡/½ÇÇà");
  /* 03.°ÔÀÓ½ÃÀÛ   */ DownloadMenuIndex[3] = new Array("03.°ÔÀÓ½ÃÀÛ","¼­¹ö","Ã¤³Î","·Îºñ","´ë±â½Ç","°ÔÀÓÈ­¸é");
  /* 04.ÀÎÅÍÆäÀÌ½º */ DownloadMenuIndex[4] = new Array("04.ÀÎÅÍÆäÀÌ½º","Ä³¸¯ÅÍ¼¥","¹«±â¼¥","ÀÎº¥Åä¸®","¸®ÇÃ·¹ÀÌ");
  /* 05.¸ÊÁ¤º¸     */ DownloadMenuIndex[5] = new Array("05.¸ÊÁ¤º¸","¸ÊÁ¤º¸");
  /* 06.Ä³¸¯ÅÍÁ¤º¸ */ DownloadMenuIndex[6] = new Array("06.Ä³¸¯ÅÍÁ¤º¸","Ä³¸¯ÅÍ Á¤º¸");
  /* 07.¹«±âÁ¤º¸   */ DownloadMenuIndex[7] = new Array("07.¹«±âÁ¤º¸","ÁÖ¹«±â","º¸Á¶¹«±â","µµ±¸");
  /* 08.½Ã½ºÅÛ     */ DownloadMenuIndex[8] = new Array("08.½Ã½ºÅÛ","°ÔÀÓ¸ðµå","Á¶ÀÛ¹ý","°è±Þ");
  /* 09.µ¿¿µ»ó     */ DownloadMenuIndex[9] = new Array("09.µ¿¿µ»ó","µ¿¿µ»ó");
  
  var IndexEnd = "";
  var SubEnd = "";
  
  var IndexHead = '<div class="box_in">';
  var IndexFoot = '</div>';
  var IndexList = '';
  var Nowlocation = 'guide'+MainNum+'_'+Subnum;
  var onclass = '';
  
  var ImageURL = "http://file.pmang.com/images/pmang/specialforce/renew2007/img/download/img_menu_";
  var GuideURL = "http://file.pmang.com/images/pmang/specialforce/renew2007/guide/";
  
  var LinkMovie = 'http://specialforce.pmang.com/specialforce_board.nwz?index_srl=53';
  var DownLoad = 'http://specialforce.pmang.com/gamepub/gamepub_download.nwz?ssn=208';
  
  
  for(i=1; i<DownloadMenuIndex.length; i++) {
    var title = '<h6><img src="'+ImageURL+i+'.gif" alt="'+DownloadMenuIndex[i][0]+'"></h6><ul class="menu'+i+'">';
    var menu = '';
    for(j=1; j<DownloadMenuIndex[i].length; j++) {
      var location = 'guide'+i+'_'+j;
      // ÇöÁ¦ ¸Þ´º Ç¥½Ã
      if( Nowlocation == location) { onclass='on'; } else { onclass = ''; }
      
      if ( location == 'guide9_1' ) { menu += '<li class="'+onclass+'"><a href="'+LinkMovie+'">'+DownloadMenuIndex[i][j]+'</a></li>'; } //µ¿¿µ»óÀÏ¶§
      else if ( location == 'guide2_1' ) { menu += '<li class="'+onclass+'"><a href="'+DownLoad+'">'+DownloadMenuIndex[i][j]+'</a></li>'; } //´Ù¿î·ÎµåÀÏ¶§
      else {  menu += '<li class="'+onclass+'"><a href="'+GuideURL+location+'.html">'+DownloadMenuIndex[i][j]+'</a></li>'; }
    }
    IndexList += title+menu+'</ul>';
  } 
    
  document.getElementById('DownloadIndex').innerHTML = IndexHead+IndexList+IndexFoot; 
  
}



// Æ÷Ä¿½º Á¦°Å
var ForBlurAnchors = document.getElementsByTagName('a');
function allBlur() { 
  for (i=0;i<ForBlurAnchors.length;i++) { 
    ForBlurAnchors[i].onfocus = new Function("ForBlurAnchors["+i+"].blur()"); 
  }
}


//sf ¸®´º¾óÇÒ¶§ ÇÊ¿äÇÑ ÇÔ¼ö Ãß°¡ by ¾ç¼±¼÷-½ÃÀÛ//
//window.onload = OnloadFunction;

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 givePointItem()
{
  virtual_fr.location.href="/event/event070829/proc.nwz";
  return;
}
//sf ¸®´º¾óÇÒ¶§ ÇÊ¿äÇÑ ÇÔ¼ö Ãß°¡ by ¾ç¼±¼÷--³¡//


//±è¿ø±â°¡ onload handle ¼öÁ¤
//if ('undefined' != typeof(addOnloadHandle))
//  addOnloadHandle("if ('undefined' != typeof(OnloadFunction)) OnloadFunction();");

function setRoyalPcb()
{
  tg = window.open("/gunbang/gunbang_set_loyal_pcb.nwz", 'gunbang_pop', 'width=465, height=260, toolbar=no, location=no, resizable=no');

  if(tg) tg.focus();
  return;
}

function gunbang_renewal_event_popup( is_force )
{
  var cookie= getCookie("sf_gb_renewal_event");

  if ( cookie == "" || cookie == undefined || is_force )
  {
    window.open('/gunbang/gunbang_renewal_popup.nwz', 'gunbang_event_pop', 'width=450,height=640,resizable=no,scrollbars=no,scrolling=no' );
  }
}

/////////////////////////
// 

// ÆË¾÷ ¸ðÀ½ ÇÔ¼ö
function sf_popup()
{
	var ret, url;
	var args = sf_popup.arguments;

	switch (args[0])
	{
	case "policy": // °Ô½ÃÆÇ ¿î¿µÁ¤Ã¥
		url = "http://file.pmang.com/images/pmang/gamepub/police/specialforce.html";
		if (args[1]) url += ("#"+args[1]);
		open_win(url, 'poppolicy', 670, 540);
		break;
	case "call": // °áÁ¦/À¯·á»ó´ã
		window.open( "http://file.pmang.com/images/pmang/specialforce/guide/pop_footer.html", "board_guide", "width=491,height=551");
		break;
	case "clan_interview": // Å¬·£ÀÎÅÍºä ½ÅÃ»ÇÏ±â
		window.open( "./apply_clan_interview.nwz", "clan_interview", "width=536,height=560");
		break;
	case "clan_policy": // Ä¿¹Â´ÏÆ¼ ÀÌ¿ë¾à°ü
    window.open('http://file.pmang.kr/images/pmang/gamepub/police/community.html', '_policy', 'width=670,height=495,resizable=no,scrollbars=no,scrolling=no' );
		break;

	}

	return ret;
}


function RelocateSelects() {
  for(var j=0; j<REPLACE_SELECTS_CLASSNAME.length; j++) {
    var t = REPLACE_SELECTS_CLASSNAME[j];
    var sel = getElementsByClass(t + '_selectArea');
    var opt = getElementsByClass(t + '_optionsDiv');
    for (var k = 0; k<sel.length; k++) {
      document.body.removeChild(sel[k]);
      document.body.removeChild(opt[k]);
    }
  }
  //OnloadReplace();
  addOnloadHandle("OnloadReplace();");
  return false;
}

function RemoveSelects(t, n) {
  if (n == null) n=0;
  var sel = getElementsByClass(t + '_selectArea');
  var opt = getElementsByClass(t + '_optionsDiv');
  document.body.removeChild(sel[n]);
  document.body.removeChild(opt[n]);
}

function getElementsByClass(searchClass,node,tag) {
    var classElements = new Array();
    if ( node == null )
        node = document;
    if ( tag == null )
        tag = '*';
    var els = node.getElementsByTagName(tag);
    var elsLen = els.length;
    var pattern = new RegExp('(^|\\s)'+searchClass+'(\\s|$)');
    for (i = 0, j = 0; i < elsLen; i++) {
        if ( pattern.test(els[i].className) ) {
            classElements[j] = els[i];
            j++;
        }
    }
    return classElements;
}

function addEvent( obj, type, fn ) {
  if (obj.addEventListener) {
    obj.addEventListener( type, fn, false );
    EventCache.add(obj, type, fn);
  }
  else if (obj.attachEvent) {
    obj["e"+type+fn] = fn;
    obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
    obj.attachEvent( "on"+type, obj[type+fn] );
    EventCache.add(obj, type, fn);
  }
  else {
    obj["on"+type] = obj["e"+type+fn];
  }
}


var EventCache = function(){
  var listEvents = [];
  return {
    listEvents : listEvents,
    add : function(node, sEventName, fHandler){
      listEvents.push(arguments);
    },
    flush : function(){
      var i, item;
      for(i = listEvents.length - 1; i >= 0; i = i - 1){
        item = listEvents[i];
        if(item[0].removeEventListener){
          item[0].removeEventListener(item[1], item[2], item[3]);
        };
        if(item[1].substring(0, 2) != "on"){
          item[1] = "on" + item[1];
        };
        if(item[0].detachEvent){
          item[0].detachEvent(item[1], item[2]);
        };
        item[0][item[1]] = null;
      };
    }
  };
}();


function screenshotNav() {
  var sc = document.getElementById('screenshot_list');
  if (!sc) return;
  var items = sc.getElementsByTagName('LI');
  var items_grp = Math.round(items.length / 2);
  var prev = document.getElementById('screenshot_prev');
  prev.onclick = function() {
    if (ScOffset > 1) {
      ScOffset -= 1;
    } else {
      ScOffset = items_grp;
    }
	setScreenshot();
    return false;
  }
  var next = document.getElementById('screenshot_next');
  next.onclick = function() {
    if (ScOffset < items_grp) {
      ScOffset += 1;
    } else {
      ScOffset = 1;
    }
	setScreenshot();
    return false;
  }
}


function setScreenshot() {
  var sc = document.getElementById('screenshot_list');
  if (!sc) return;
  var itemHeight = 127;
  var items = sc.getElementsByTagName('LI');
  var items_grp = Math.round(items.length / 2);
  if (ScOffset > items_grp) ScOffset = 1;
  for (var i=0; i<items.length; i++) {
	var t = itemHeight * (ScOffset - 1) * -1;
	items[i].style.top = t + 'px';
  }
}


ScOffset = 1;


function showPcbangBenefit() {
	var o = document.getElementById('BannerPcbangBenefit');
	if (!o) return;
	o.src = o.src.replace(/pcbang\_no\.gif$/, 'pcbang_benefit.gif');
}

function hidePcbangBenefit() {
	var o = document.getElementById('BannerPcbangBenefit');
	if (!o) return;
	o.src = o.src.replace(/pcbang\_benefit\.gif$/, 'pcbang_no.gif');
}



function popChance() {
	var popChance = window.open("/event/event090226/popup_event.nwz", popChance, "width=440, height=550");
}

addEvent(window, 'load', screenshotNav);
addEvent(window, 'unload', EventCache.flush);


function calc_strlen (str)
{
  var len = 0;

  for (var i=0; i < str.length; i++) {
    var n = str.charCodeAt(i);
    if ((n >= 0)  && (n < 256))
      len ++;
    else
      len += 2;
  }
  return len;
}

function getBonusCoupon_090414()
{

	if (!open_confirm("my", "<center>Å¬·£¾ÆÀÌÅÛ 30%ÇÒÀÎÄíÆùÀ» ¹ÞÀ¸½Ã°Ú½À´Ï±î?<br><br>(1ÀÎ 1È¸¿¡ ÇÑÇØ Áö±ÞÇØ µå¸³´Ï´Ù.)</center>", "ÇÇ¸Á - e½ºÆ÷Ã÷ ´ëÇ¥ FPS ½ºÆä¼ÈÆ÷½º!", 420, 220, "¿¹", "70", "¾Æ´Ï¿À", "70", "", "")){
		return;
	}else{

		var strRetMsg = "./event/event090414/event_coupon_proc.nwz";
		var ret_value = virtualGET(strRetMsg);
		var out_value = ret_value.substr(0,1);	
		var msgs = ret_value.substr(2);	

		if (out_value == 2) {

			var SayModal = open_alert("my",msgs,"ÇÇ¸Á - e½ºÆ÷Ã÷ ´ëÇ¥ FPS ½ºÆä¼ÈÆ÷½º!",370,260,"È® ÀÎ",80,"",0);

			if (SayModal) {
				window.open("/specialforce_frame.nwz?mKey=5&sKey=3");
			}

		}else{

			var SayModal = open_alert("my",msgs,"ÇÇ¸Á - e½ºÆ÷Ã÷ ´ëÇ¥ FPS ½ºÆä¼ÈÆ÷½º!",370,260,"È® ÀÎ",80,"",0);

		}	

	}

}

function getBuyEventItem_90430()
{

	if (!open_confirm("my", "<center><b>[±ÝÀåPSG1 ÃÑ±â Àü°Ý ¾÷µ¥ÀÌÆ® ÇÑÁ¤ÆÇ¸Å]</b><br><br>±ÝÀåPSG1 ¾ÆÀÌÅÛÀ» ±¸¸ÅÇÏ½Ã°Ú½À´Ï±î?</center>", "ÇÇ¸Á - e½ºÆ÷Ã÷ ´ëÇ¥ FPS ½ºÆä¼ÈÆ÷½º!", 420, 220, "¿¹", "70", "¾Æ´Ï¿À", "70", "", "")){
		return;
	}else{

		var strRetMsg = "/event/event090501/event_buy_item.nwz";
		var ret_value = virtualGET(strRetMsg);
		var out_value = ret_value.substr(0,1);	
		var msgs = ret_value.substr(2);	

		var SayModal = open_alert("my",msgs,"ÇÇ¸Á - e½ºÆ÷Ã÷ ´ëÇ¥ FPS ½ºÆä¼ÈÆ÷½º!",370,260,"È® ÀÎ",80,"",0);

	}

}

function getMoneyEventItem( item )
{

	if (!open_confirm("208", "<center>¾ÆÀÌÅÛÀ» ±¸¸ÅÇÏ½Ã°Ú½À´Ï±î?</center>", "ÇÇ¸Á - e½ºÆ÷Ã÷ ´ëÇ¥ FPS ½ºÆä¼ÈÆ÷½º!", 300, 220, "¿¹", "70", "¾Æ´Ï¿À", "70", "", "")){
		return;
	}else{

		var strRetMsg = "/event/event090818/event_buy_item.nwz?item_id=" + item;
		var ret_value = virtualGET(strRetMsg);
		var out_value = ret_value.substr(0,1);	
		var msgs = ret_value.substr(2);	

		var SayModal = open_alert("208",msgs,"ÇÇ¸Á - e½ºÆ÷Ã÷ ´ëÇ¥ FPS ½ºÆä¼ÈÆ÷½º!",370,260,"È® ÀÎ",80,"",0);

	}

}

function getSPGachaCoupon( )
{

	if (!open_confirm("208", "<center>¹«±âÃ¢°í ÇÃ·¯½º ÄíÆùÀ» Áö±Þ¹ÞÀ¸½Ã°Ú½À´Ï±î?</center>", "ÇÇ¸Á - e½ºÆ÷Ã÷ ´ëÇ¥ FPS ½ºÆä¼ÈÆ÷½º!", 400, 220, "¿¹", "70", "¾Æ´Ï¿À", "70", "", "")){
		return;
	}else{

		var strRetMsg = "/event/event090818/event_give_ticket.nwz";
		var ret_value = virtualGET(strRetMsg);
		var out_value = ret_value.substr(0,1);	
		var msgs = ret_value.substr(2);	

		var SayModal = open_alert("208",msgs,"ÇÇ¸Á - e½ºÆ÷Ã÷ ´ëÇ¥ FPS ½ºÆä¼ÈÆ÷½º!",370,260,"È® ÀÎ",80,"",0);

	}

}
 
function getLocalClanApply( )
{
 	if (!open_confirm("208", "<center>Å¬·£ Æ¼¼ÅÃ÷¸¦ Áö±Þ¹ÞÀ¸½Ã°Ú½À´Ï±î?</center>", "ÇÇ¸Á - e½ºÆ÷Ã÷ ´ëÇ¥ FPS ½ºÆä¼ÈÆ÷½º!", 400, 220, "¿¹", "70", "¾Æ´Ï¿À", "70", "", ""))
    {
		return;
	}
	else
   {
		
		var cwin = window.open("/event/event090825/popup_character.nwz", "character","width=600, height=400, toolbar=no, location=no, resizable=no");
		cwin.focus();
	}

}

function openPollSF(url, wid, hgt){
		 
	tg = window.open(url, "poll_sf", "width=" + wid + ", height=" + hgt + ", toolbar=no, location=no, resizable=no");
	tg.focus();
}

function applyPollSF()
{
		tg = window.open("/poll_208_5.nwz", "poll_sf", "width=420, height=100, toolbar=no, location=no, resizable=no");
		tg.focus();
}

  // modified by iprid123 2009-08-20 ¼¥ °Ë»ö

  function goSearchShop()
  {
      var obj       = document.getElementById("searchkey");

      if (obj.value.length < 2 )
      {
        open_alert("208","°Ë»öÇÒ »óÇ°¸íÀ» ÃÖ¼Ò 2ÀÚ ÀÌ»ó ÀÔ·ÂÇØ ÁÖ¼¼¿ä..","¾ÆÀÌÅÛ °Ë»ö",370,260,"È® ÀÎ",80,"",0);
        return;
      }
      else
      {
          key = obj.value;
      }
	  
      location.href="/specialforce_itemlist.nwz?searchkey=" + key;
  }

// item shop Ãß°¡ modified by iprid123 2009-08-20
 function multListItem(type, cd)
{
  var bt_obj     = document.getElementById("BT_" + cd);
  var st_obj     = document.getElementById("ST_" + cd);
  
	if (st_obj.value == "" )
	{
		alert("¸ÕÀú ºÎ´ë¸¦ ¼±ÅÃÇØÁÖ¼¼¿ä.");
		return;
	}

  var str_name   = "Base_" + cd + "_" + bt_obj.value + "_" +  st_obj.value;
 
  try {
    var obj = document.getElementById(str_name);

    try {

        var sid = obj.value.split(":");

    } catch ( Ex ) { alert( "ÇöÀç ±â´ÉÀÌ Á¤»óÀûÀ¸·Î µ¿ÀÛÇÏ°í ÀÖÁö ¾Ê½À´Ï´Ù." ); return; }

    switch( type )
    {
      case 'b': goPurchaseCashItemNew( sid[0] ); break;
      case 'g': goGiftCashItemNew( sid[0] ); break;  	  
	  case 'r':
			if (sid[4] <3000)
			{
				alert("Á¶¸£±â ¾ÆÀÌÅÛÀº 3000¿ø ÀÌ»ó¸¸ °¡´ÉÇÕ´Ï´Ù.");
				return;
			}
			goJorugiNew( sid[0] ); 
		break;  	  
	  case 'w': goWishNew( sid[0] ); break;  	  
    }
  } catch( E ) { alert( "¿À·ù : " + E.message ); }
}
// Á¶¸£±â
function goJorugiNew ( saleinfo_id )
{
	  pub_shop.open_win('/gamepub/jorugi/send_jorugi.nwz?jsaleinfo_id='+saleinfo_id+'&ssn=208','_jorugi',500,400);
}
// Èñ¸Á ¾ÆÀÌÅÛ
function goWishNew ( saleinfo_id )
{
   pub_shop.open_win('/specialforce_wish.nwz?saleinfo_id='+saleinfo_id+'&ssn=208','_wish',400,400);
}

function goItemViewSF( group_code )		
{
	if ( group_code == "")
		pub_shop.alert("Á¤»óÀûÀÎ Á¢±ÙÀÌ ¾Æ´Õ´Ï´Ù.");
	
	parent.location.href="/specialforce_frame.nwz?mKey=6&sKey=0&url=/specialforce_iteminfo.nwz?group_code=" + group_code ;  
}
function goGiftCashItemNew(saleinfo_id)
{
  pub_shop.gift( 208, saleinfo_id );
}

function goPurchaseCashItemNew(saleinfo_id)
{
  pub_shop.buy( 208, saleinfo_id );
}
// item shop Ãß°¡ modified by iprid123 2009-08-20

// ob3 start
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);
}


 document.domain = "pmang.com";   
 function SetCookie(name, value, expiredays)   
 {   
         var todayDate = new Date();   
         todayDate.setDate(todayDate.getDate() + expiredays);   
         document.cookie = name + "=" + escape(value) + "; path=/; domain=pmang.com;expires=" + todayDate.toGMTString() + ";"   
 }   
    
 function cookiehidden(cookiename, expdays)   
 {   
         SetCookie(cookiename, cookiename, expdays);   
         document.all.div_banner.style.display = "none";   
 }   
 
function check_tachy()
{
	tachy_clsid="92d76507-24cd-42e6-bea9-d84410a44de5";
	if(typeof(AppletSession)=="undefined")return;

	if(AppletSession.externalmethod("isinstalled",tachy_clsid,0,0,"20031223-0"))
		AppletSession.externalmethod("run",tachy_clsid,0,0,"");
	else{
		window.open("http://tachy.pmang.com/");
		AppletSession.externalmethod("install",tachy_clsid,0,0,"¼¼ÀÌÅ¬·´ Å¸Å° ´Ù¿î·Îµå");
	}
}    

function run_sf()
{
	alert("°ÔÀÓÀ» ÇÏ½Ã·Á¸é ·Î±×ÀÎÀ» ÇÏ¼Å¾ß ÇÕ´Ï´Ù.");
}

function goEventCPA()
{
	open_alert('my','·Î±×ÀÎÀÌ ÇÊ¿äÇÑ ¼­ºñ½ºÀÔ´Ï´Ù.','¾Ë¸²',360,240);
}
function printEndLayerBanner()
{
	html = game_start_layer.innerHTML;
	if(html.indexOf('empty') < 0)
	  document.all["banner_03"].style.visibility = "visible";
}

function hideEndLayerBanner()
{
	document.all["banner_03"].style.visibility = "hidden";
}
 
 function go_cpa(adsrl,site)
{
	window.open("./gamepub/cpa/cpa_sender.nwz?ad="+adsrl+"&et="+site,"_blank");
}

 function go_menu(iKey,sKey)
  {
    if ( iKey == 10 && sKey == 3 )
    {
      linkurl  = "/gamepub/pm/my_profile.nwz";
      window.open( linkurl,'','');
    }
	  else if ( iKey == 6 && sKey == 100 )
		{
      linkurl  = "/gamepub/cpa/cpa_charge.nwz?ssn=208";
      window.open( linkurl,'','');
		}
    else
    {
      linkurl  = "specialforce_frame.nwz?mKey="+iKey+"&sKey="+sKey;
      document.location.href= linkurl ;
    }
  }
  function GotoSubUrl(url)
  {
    document.all.INFO_DOC.src=url;
  }
  function viewGuide()
  {
    tg = window.open("http://file.pmang.com/images/pmang/specialforce/beginner/beginner_intro.html", 'guide', 'width=1000, height=700, toolbar=no, location=no, resizable=yes');
    if(tg) tg.focus();
    return;
  }
  function gbpcSearch()
  {

    var form = document.all.fo_search_gb;

    if (form.keyword.value == "" || form.keyword.value == "µ¿ÀÌ³ª ÀÌ¸§À» ÀÔ·ÂÇÏ¼¼¿ä")
    {
      alert("Áö¿ª(µ¿) ÀÌ¸§ÀÌ³ª PC¹æ ÀÌ¸§À» ÀÔ·ÂÇÏ¿© ÁÖ¼¼¿ä.");
      form.keyword.focus();
      return;
    }

    var keyword = document.fo_search_gb.keyword.value;

    if (keyword.length <2)
    {

      alert("°Ë»ö¾î´Â 2ÀÚÀÌ»ó ÀÔ·ÂÇØÁÖ¼¼¿ä.");
      form.keyword.focus();
      return;

    }

    form.menu.value = "6";
    //form.url.value = "http://pmang.sayclub.com/specialforce/gunbang/gunbang_search.nwz?keyword="+keyword;
	form.url.value = "/gamepub/search_paid_pcbang.nwz?ssn=208&keyword="+keyword;
    form.action = "/gunbang/gunbang_home.nwz?menu=6";
    form.submit();

  }

	function doBuy( item_index )
	{
		tg = window.open("/gunbang/gunbang_buy_item.nwz?item_index="+item_index, 'gunbang_pop', 'width=465, height=260, toolbar=no, location=no, resizable=no');

		if(tg) tg.focus();
		return;
	}
	  function movepage( page )
  {
    document.fo.page.value = page;
		document.fo.submit();
  }

	// °Ç»§ pc¹æ Çýµ• °ü·Ã
   function open_gb_benefit()
  {
    open_window( "specialforce_gb_benefit.nwz", "_sf_gb_benefit_", "width=450,height=506,top=100,left=622" );
  }
  function move_month( month )
  {
    location.href = "?type=<?=$type?>&month="+month;
  }
  function movepage( page )
  {
    document.fo.page.value = page;
		document.fo.submit();
  }
  function couponPopup()
  {
    window.open('specialforce_coupon.nwz', 'sf_coupon', 'width=453,height=340,toolbar=no,location=no,directories=no,status=no,menuBar=no,scrollbars=no');
  }

  
// ÆË¾÷ ¸ðÀ½ ÇÔ¼ö
function sf_popup()
{
	var ret, url;
	var args = sf_popup.arguments;

	switch (args[0])
	{
	case "policy": // °Ô½ÃÆÇ ¿î¿µÁ¤Ã¥
		url = "http://file.pmang.com/images/pmang/gamepub/police/specialforce.html";
		if (args[1]) url += ("#"+args[1]);
		open_win(url, 'poppolicy', 670, 540);
		break;
	case "call": // °áÁ¦/À¯·á»ó´ã
		window.open( "http://file.pmang.com/images/pmang/specialforce/guide/pop_footer.html", "board_guide", "width=491,height=551");
		break;
	case "clan_interview": // Å¬·£ÀÎÅÍºä ½ÅÃ»ÇÏ±â
		window.open( "./apply_clan_interview.nwz", "clan_interview", "width=536,height=560");
		break;
	case "clan_policy": // Ä¿¹Â´ÏÆ¼ ÀÌ¿ë¾à°ü
    window.open('http://file.pmang.kr/images/pmang/gamepub/police/community.html', '_policy', 'width=670,height=495,resizable=no,scrollbars=no,scrolling=no' );
		break;

	}

	return ret;
}

  // ob3 end¿ÀÈÄ 1:45



function getApplyKnife( )
{

	if (!open_confirm("208", "<center>Áö±Ý °æ¸Å¿¡ ÀÀ¸ðÇÏ½Ã°Ú½À´Ï±î? <br><br>ÀÀ¸ð Áï½Ã 2,000 SP°¡ ¼ÒÁøµË´Ï´Ù.</center>", "ÇÇ¸Á - e½ºÆ÷Ã÷ ´ëÇ¥ FPS ½ºÆä¼ÈÆ÷½º!", 400, 220, "¿¹", "70", "¾Æ´Ï¿À", "70", "", "")){
		return;
	}else{

		var strRetMsg = "/event/event090828/event_proc.nwz";
		var ret_value = virtualGET(strRetMsg);
		var out_value = ret_value.substr(0,1);	
		var msgs = ret_value.substr(2);	

		var SayModal = open_alert("208",msgs,"ÇÇ¸Á - e½ºÆ÷Ã÷ ´ëÇ¥ FPS ½ºÆä¼ÈÆ÷½º!",370,260,"È® ÀÎ",80,"",0);

	}

}

 function sf_begin_game()
{
  //top.virtual_fr.location="http://pmang.sayclub.com/gamepub/check_system.nwz?ssn=210&type=log";
  //top.virtual_fr.location="http://pmang.sayclub.com/guild/guild_ongame_proc.nwz?act=ON&ssn=208&channel="+ServerNo;
  location.href="/gamepub/game_running.nwz?ssn=208";
}
function sf_finish_game()
{
	 execGameEndProc(208);
}

function viewEvent(url, wid, hgt)
{
	tg = window.open(url, 'specialforce', 'width=' + wid +', height=' + hgt + ', toolbar=no, location=no, resizable=no');
	if(tg) tg.focus();
	return;
}

function strlen_chk (str)
{
  var len = 0;

  for (var i=0; i < str.length; i++) {
    var n = str.charCodeAt(i);
    if ((n >= 0)  && (n < 256))
      len ++;
    else
      len += 2;
  }
  return len;
}


function searchPcbang(frm)
{
  if ( frm.keyword.value == "" )
  {
    alert("Áö¿ª(µ¿) ÀÌ¸§ÀÌ³ª PC¹æ ÀÌ¸§À» ÀÔ·ÂÇÏ¿© ÁÖ¼¼¿ä.");
    frm.keyword.focus();
    return;
  }
  
  if (strlen_chk(frm.keyword.value) <4)
  {
    alert("°Ë»ö¾î´Â ÇÑ±Û2ÀÚ(¿µ¹®4ÀÚ)ÀÌ»ó ÀÔ·ÂÇØÁÖ¼¼¿ä.");
    frm.keyword.focus();
    return;
  }

  frm.url.value = '/gamepub/search_paid_pcbang.nwz?ssn=208&keyword='+frm.keyword.value;
  frm.submit();
}

function noticeEvent(day,arg) {
  $.get("/event/event"+ day +"/event_proc.nwz",arg,function(xml) {
    alert(xml);
  });
}

function getBonusCoupon_0901110()
{

	if (!open_confirm("208", "<center>½ºÆä¼ÈÆ÷½º ÇÁ¸®ÆÐÅ°Áö 20% ÇÒÀÎÄíÆùÀ» ¹ÞÀ¸½Ã°Ú½À´Ï±î?<br><br></center>", "ÇÇ¸Á - e½ºÆ÷Ã÷ ´ëÇ¥ FPS ½ºÆä¼ÈÆ÷½º!", 420, 220, "¿¹", "70", "¾Æ´Ï¿À", "70", "", "")){
		return;
	}else{

		var strRetMsg = "./event/event091110/event_coupon_proc.nwz";
		var ret_value = virtualGET(strRetMsg);
		var out_value = ret_value.substr(0,1);	
		var msgs = ret_value.substr(2);	

		if (out_value == 1) {

			var SayModal = open_alert("208",msgs,"ÇÇ¸Á - e½ºÆ÷Ã÷ ´ëÇ¥ FPS ½ºÆä¼ÈÆ÷½º!",370,260,"È® ÀÎ",80,"",0);

			if (SayModal) {
				window.open("/specialforce_frame.nwz?mKey=6&sKey=0");
			}

		}else{

			var SayModal = open_alert("208",msgs,"ÇÇ¸Á - e½ºÆ÷Ã÷ ´ëÇ¥ FPS ½ºÆä¼ÈÆ÷½º!",370,260,"È® ÀÎ",80,"",0);

		}	

	}

}

function getBonusCoupon_091124()
{

	if (!open_confirm("208", "<center>½ºÆä¼ÈÆ÷½º ¼Óµµ¾÷ÇÁ¸®ÆÐÅ°Áö 20% ÇÒÀÎÄíÆùÀ» ¹ÞÀ¸½Ã°Ú½À´Ï±î?<br><br></center>", "ÇÇ¸Á - e½ºÆ÷Ã÷ ´ëÇ¥ FPS ½ºÆä¼ÈÆ÷½º!", 420, 220, "¿¹", "70", "¾Æ´Ï¿À", "70", "", "")){
		return;
	}else{

		var strRetMsg = "./event/event091124/event_coupon_proc.nwz";
		var ret_value = virtualGET(strRetMsg);
		var out_value = ret_value.substr(0,1);	
		var msgs = ret_value.substr(2);	

		if (out_value == 1) {

			var SayModal = open_alert("208",msgs,"ÇÇ¸Á - e½ºÆ÷Ã÷ ´ëÇ¥ FPS ½ºÆä¼ÈÆ÷½º!",370,260,"È® ÀÎ",80,"",0);

			if (SayModal) {
				window.open("/specialforce_frame.nwz?mKey=6&sKey=0");
			}

		}else{

			var SayModal = open_alert("208",msgs,"ÇÇ¸Á - e½ºÆ÷Ã÷ ´ëÇ¥ FPS ½ºÆä¼ÈÆ÷½º!",370,260,"È® ÀÎ",80,"",0);

		}	

	}

}

function getBonusDice()
{

	if (!open_confirm("208", "<center> ÁÖ»çÀ§¸¦ Áö±Þ ¹ÞÀ¸½Ã°Ú½À´Ï±î?<br><br></center>", "ÇÇ¸Á - e½ºÆ÷Ã÷ ´ëÇ¥ FPS ½ºÆä¼ÈÆ÷½º!", 420, 220, "¿¹", "70", "¾Æ´Ï¿À", "70", "", "")){
		return;
	}else{

		var strRetMsg = "./event/event100211/event_dice_proc.nwz";
		var ret_value = virtualGET(strRetMsg);
		var out_value = ret_value.substr(0,1);	
		var msgs = ret_value.substr(2);	

		if (out_value == 1) {

			var SayModal = open_alert("208",msgs,"ÇÇ¸Á - e½ºÆ÷Ã÷ ´ëÇ¥ FPS ½ºÆä¼ÈÆ÷½º!",370,260,"È® ÀÎ",80,"",0);

			if (SayModal) {
				window.open("./event/event100211/index.nwz");
			}

		}else{

			var SayModal = open_alert("208",msgs,"ÇÇ¸Á - e½ºÆ÷Ã÷ ´ëÇ¥ FPS ½ºÆä¼ÈÆ÷½º!",370,260,"È® ÀÎ",80,"",0);

		}	

	}

}
 
 function getBonusGlass()
{

	if (!open_confirm("208", "<center> ¾ÆÀÌÅÛÀ» Áö±Þ ¹ÞÀ¸½Ã°Ú½À´Ï±î?<br><br></center>", "ÇÇ¸Á - e½ºÆ÷Ã÷ ´ëÇ¥ FPS ½ºÆä¼ÈÆ÷½º!", 420, 220, "¿¹", "70", "¾Æ´Ï¿À", "70", "", "")){
		return;
	}else{

		var strRetMsg = "./event/event100211/event_glass_proc.nwz";
		var ret_value = virtualGET(strRetMsg);
		var out_value = ret_value.substr(0,1);	
		var msgs = ret_value.substr(2);	

		if (out_value == 1) {

			var SayModal = open_alert("208",msgs,"ÇÇ¸Á - e½ºÆ÷Ã÷ ´ëÇ¥ FPS ½ºÆä¼ÈÆ÷½º!",370,260,"È® ÀÎ",80,"",0);

			if (SayModal) {
				window.open("./specialforce_home.nwz");
			}

		}else{

			var SayModal = open_alert("208",msgs,"ÇÇ¸Á - e½ºÆ÷Ã÷ ´ëÇ¥ FPS ½ºÆä¼ÈÆ÷½º!",370,260,"È® ÀÎ",80,"",0);

		}	

	}

}

  var p_memo_up = 200;
  function processNewMemo ()
  {
	if ('string'!=typeof(my_memo_newcount.innerHTML) ||
	  'string'!=typeof(my_memo_newicon.innerHTML) ||
	  'string'!=typeof(my_memo_write.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 = (AppletSession.getvalue('memo_cnt_new')+"Åë").bold();
	  my_memo_newicon.style.display = "inline";
	}
	else {
	  my_memo_newcount.innerHTML = "¾øÀ½"
	  my_memo_write.style.display = "inline";
	}
  }
 
 function dSetTab(type, flag, fix) {
	
	if (fix == "d")
	{
		var now  = window[type+'_index'];	
		if (!now) now = 1;
		var tabs = getElementsByClass(type);
		var total = tabs.length - 1;
		
		if ( flag == "1")	// ÀÌÀü
		{
				if (now == 1) now = total; 
				else now -= 1;
		}
		else
		{
				if (now == total) now = 1; 
				else now += 1;
		}	  
		window[type+'_index'] = now;
		var id = type + now;	

	}
	else
	{
		now = flag;
		id = fix;
	}
 
	if ($("#"+id).html() == "") {
		$.post("sf_get_contents.nwz", {type:id}, function(ret) {
		  $("#"+id).html(ret);
		});
	}  	
	setTab(type, now);
}

function getEventInfo(day) {

  layerHide('sf_schedule');

  var arrParam = new Array();
  arrParam["day"] = day;

  var oAjax = new Ajax();
  var retHTML = oAjax.sendRequest("specialforce_event_info.nwz", arrParam, "GET", "", "TEXT", true);

  if (retHTML.length > 0) {    
    layerView('sf_schedule');
    var tem = retHTML.substring(1, retHTML.length);
    document.getElementById("event_info").innerHTML = tem;
    
    if (retHTML.charAt(0) == "W") { tabMoveEvent('tab_sche','2'); } 
    else                          { tabMoveEvent('tab_sche','1'); }


  }
	viewEventCalendar(day);
}

function layerView(layer) {
	if(document.getElementById(layer)) 	document.getElementById(layer).style.display = "block";
}

function layerHide(layer) {
	if(document.getElementById(layer)) 	document.getElementById(layer).style.display = "none";
}

function layerViewHide(layer) {
	if(document.getElementById(layer).style.display=='block'){
		document.getElementById(layer).style.display = "none";
	}
	else {
		document.getElementById(layer).style.display = "block";
	}
}

// event calender
function tabMoveEvent(name,num) {
	
	if(!document.getElementsByName(name)) return;
	
	var TabGroup = document.getElementsByName(name);
	var TabThis = num-1;

	for(i=0; i<TabGroup.length; i++) {
		var TabName = name+(i+1);
		var TabContents = document.getElementById(TabName);
		if (TabContents) {
			if(i==TabThis) {
				TabGroup[TabThis].parentNode.className = "on";
				TabContents.style.display = "block";
			}
			else {
				TabGroup[i].parentNode.className = "";
				TabContents.style.display = "none";
			}
		}
	}
}