//Æ÷Ä¿½º Blur ÇÔ¼ö
function bluring(){ 
	if(event.srcElement.tagName == "A" || event.srcElement.tagName == "IMG")
	document.body.focus(); 
} 
document.onfocusin=bluring;

// PNG»ç¿ë
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='../img/common/blank.gif';
    return '';  
}

// Flash
function printFlashObject(flash_src, name, width, height, option_param_tag){
	var obj_html = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' width='" + width + "' height='" + height + "' id='" + name + "' align='middle'>\n";
	if (window.addEventListener) {
		obj_html = "<object type='application/x-shockwave-flash' id='" + name + "' data='" + flash_src + "' width='" + width + "' height='" + height + "' align='middle'>\n";
	}
	obj_html += "<param name='movie' value='" + flash_src + "' />\n";
	obj_html += "<param name='allowScriptAccess' value='always' />\n";
	obj_html += "<param name='quality' value='high' />\n";
	obj_html += "<param name='wmode' value='transparent' />\n";
	obj_html += "<param name='menu' value='false' />\n";
	obj_html += option_param_tag + "\n";
	obj_html += "</object>\n";
	document.write(obj_html);
}

// Media
function printPlayerObject(file_src,name,width,height,file_start,option_param_tag){
  obj_html = "<object CLASSID=CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6 width='"+width+"' height='"+height+"' id='"+name+"' />\
  <param name='URL' value='"+file_src+"' />\
  <param name='AutoStart' value='"+file_start+"'>";
  obj_html = obj_html + option_param_tag;
  obj_html = obj_html + "</object>";
  document.write(obj_html);
}

// addevent
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 openCommunityPopup()
{
 window.open('http://file.pmang.kr/images/pmang/gamepub/police/community.html', '_policy', 'width=670,height=495,resizable=no,scrollbars=no,scrolling=no' );
}

function tabMove(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].className = "on";
				TabContents.style.display = "block";
			}
			else {
				TabGroup[i].className = "";
				TabContents.style.display = "none";
			}
		}
	}
}

function themeMove(name,num)
{
  tabMove(name,num);
	var more1 = document.getElementById("theme_bbs_link1");
  var more2 = document.getElementById("theme_bbs_link2");
  var more3 = document.getElementById("theme_bbs_link3");  
	
  if ( num == 1 )
  {
    more1.style.display = '';
    more2.style.display = 'none';
    more3.style.display = 'none';
  }
  else if ( num == 2 )
  {
    more1.style.display = 'none';
    more2.style.display = '';
    more3.style.display = 'none';
  }
  else
  {
    more1.style.display = 'none';
    more2.style.display = 'none';
    more3.style.display = '';    
  }

}

function screenMove(name,num)
{
  tabMove(name,num);
	var more1 = document.getElementById("screen_bbs_link1");
  var more2 = document.getElementById("screen_bbs_link2");
	
  if ( num == 1 )
  {
    more1.style.display = '';
    more2.style.display = 'none';
  }
  else 
  {
    more1.style.display = 'none';
    more2.style.display = '';
  }
}

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";
	}
}

//Å¬·¡½ºÂüÁ¶
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;
}

// float banner
function Floating(FloatingObj,MarginY,Percentage,setTime) {
	this.FloatingObj = FloatingObj;
	this.FloatingObj.style.position = "absolute";
	this.MarginY = (MarginY) ? MarginY : 0;
	this.Percentage = (Percentage) ? Percentage : 20;
	this.setTime = (setTime) ? setTime : 10;
	this.Run();
}
Floating.prototype.Run = function () {
	var This = this;
	var FloatingObjTop = (this.FloatingObj.style.top) ? parseInt(this.FloatingObj.style.top,10) : this.FloatingObj.offsetTop;
	var DocTop = document.body.scrollTop + this.MarginY;
	var MoveY = Math.abs(FloatingObjTop - DocTop);
	MoveY = Math.ceil(MoveY / this.Percentage);
	if (FloatingObjTop < DocTop) {
		var maxTop = document.body.scrollHeight - (av_floating.scrollHeight +250);
		if(FloatingObjTop < maxTop){
			this.FloatingObj.style.top = FloatingObjTop + MoveY + "px";
		}
	} else {
		this.FloatingObj.style.top = FloatingObjTop - MoveY + "px";
	}
	setTimeout(function () { This.Run(); },This.setTime);
}

// Çù·Â»ç ¹è³Ê
function floatMenuMove(){
	if(document.body.clientWidth > 1660 ){
		document.getElementById('ava_float').style.right=10;
		document.getElementById('ava_float').style.display='block';
	}
	else { 
		document.getElementById('ava_float').style.display='block';
	}
	window.onresize = floatMenuMove;
}

//·¹ÀÌ¾î È£Ãâ
function logOpen(){
  document.getElementById('ava_login').style.display='block';
}
function logClose(){
  document.getElementById('ava_login').style.display='none';
}
function boardOpen(){
  GotoSubUrl('http://ava.pmang.com/ava_board.nwz?ssn=320&bserial=10')
  document.getElementById('ava_board').style.display='block';
}
function boardClose(){
  document.getElementById('ava_board').style.display='none';
}

function GotoSubUrl(url)
{
    if (url != "")
      document.all.INFO_DOC.src=url;
    else
    {
      url = "";
      document.all.INFO_DOC.src=url;
    }
}

function ava_begin_game()
{
  location.href="http://ava.pmang.com/gamepub/game_running.nwz?ssn=320";
}

function ava_finish_game()
{
  execGameEndProc(320);
}

function ava_start()
{
  run_pubgame();
}

function gamestart()
{ 
  run_pubgame();
}

function go_home()
{
  document.location.href = 'http://ava.pmang.com/ava_home.nwz?ssn=320&intro=done';
}

function go_menu(param1,param2)
{
    document.location.href = 'http://ava.pmang.com/ava_frame.nwz?mKey='+param1+'&sKey='+param2;
}

function go_menu2(param1)
{
  if (param1 == 8 )
    window.open('http://www.pmang.com/gamepub/cpa/cpa_charge.nwz?ssn=320','_esports');
  else
    window.open('http://ava.pmang.com/esports/ava_home.nwz?menu='+param1,'_esports');
}

function getCookie (sCookieName)
{
    var sName=sCookieName+"=", ichSt, ichEnd;
    var sCookie=document.cookie;

    if ( sCookie.length && ( -1 != (ichSt = sCookie.indexOf(sName)) ) )
    {
        if (-1 == ( ichEnd = sCookie.indexOf(";",ichSt+sName.length) ) )
            ichEnd = sCookie.length;
        return unescape(sCookie.substring(ichSt+sName.length,ichEnd));
    }
    
    return null;
}

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 = AppletSession.getvalue('memo_cnt_new')+"Åë" + ' <img src=http://file.pmang.kr/images/pmang/ava/ob2/img/common/bl_n.gif align=absmiddle>';
  else
    my_memo_newcount.innerHTML = "¾øÀ½";
}

function openSkillTree()
{
    window.open('http://ava.pmang.com/ava_skill_tree.nwz', 'ava_skill_tree', 'resizable=no,width=750,height=530');
}

function viewUserInfo(usn)
{
    window.open('http://ava.pmang.com/ava_user_info.nwz?usn='+usn, 'ava_user_info', 'resizable=no,width=480,height=587');
}

function viewUserInfo2(usn)
{
    window.open('http://ava.pmang.com/ava_user_info.nwz?usn='+usn, '_ava_user_info', 'resizable=no,width=480,height=587');
}

function buyPopup()
{
    window.open('http://ava.pmang.com/ava_frame.nwz?mKey=9&sKey=1&url=http://ava.pmang.com/ava_item_list.nwz?category=2&order=D&list_type=image');
}

function viewUserInfo3(usn,type)
{
    window.open('http://ava.pmang.com/ava_user_info.nwz?usn='+usn+'&type='+type, 'ava_user_info', 'resizable=no,width=480,height=587');
}

function policy_pop()
{
  window.open("http://file.pmang.kr/images/pmang/gamepub/police/ava.html#12", '_check', "resizable=no,scrollbars=no, width=670, height=550");
}

function policy_bottom()
{
  window.open("http://file.pmang.kr/images/pmang/ava/ob/html/policy.html", '_check', "resizable=no,scrollbars=yes, width=680, height=440");
}

function viewCoupon()
{
  window.open("http://ava.pmang.com/gamepub/coupon/reg.nwz?ssn=320", '_coupon', "resizable=no,scrollbars=no, width=450, height=370");
}

//ava Á¦ÈÞ¸ÞÀÏ Æû
function viewAvaProposalMailForm() 
{
	window.open("http://ava.pmang.com/ava_pop_proposal_mail_form.nwz", 'mail', "resizable=no,scrollbars=no,width=500,height=532");
}


function viewPcbang()
{
  window.open("http://ava.pmang.com/pcbang.nwz", '_pcbang', "resizable=no,scrollbars=no, width=660, height=670");
}

function buyItem_select(item_code)
{
  var str = eval("document.all.item_"+item_code);
  //open_win("http://www.pmang.com/gamepub_purchase.nwz?ssn=320&saleinfo_id="+str.value, "_buy","430","700");
  pub_shop.buy(320,str.value);
}
function buyItem(saleinfo_id)
{
  //open_win("http://www.pmang.com/gamepub_purchase.nwz?ssn=320&saleinfo_id="+saleinfo_id, "_buy","430","700");
  pub_shop.buy(320,saleinfo_id);
}

function presentItem(saleinfo_id)
{
  //open_win("http://www.pmang.com/gamepub_gift.nwz?ssn=320&saleinfo_id="+saleinfo_id, "_buy","430","700");
  pub_shop.gift(320,saleinfo_id);
}


function item_view(saleinfo_id)
{
  document.location.href = "http://ava.pmang.com/ava_item_view.nwz?saleinfo_id="+saleinfo_id;
}

function viewTempItem(saleinfo_id)
{
  location.href = 'http://ava.pmang.com/ava_item_temp.nwz?saleinfo_id='+saleinfo_id;
}

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=320','',420,600);
}

function list_move(){
	bomblist.start();
}
function list_stop(){
	bomblist.stop();
}

function open_guide()
{
  location.href = "http://ava.pmang.com/ava_frame.nwz?mKey=2&sKey=3";
  //window.open('http://file.pmang.kr/images/pmang/ava/ob/easy_guide/ava_guide.htm', 'guide', 'resizable=no,width=800,height=600');
}

function openGuide()
{
  window.open('http://ava.pmang.com/ava_frame.nwz?mKey=2&sKey=3','guide');
}

var e_start_num = 2;
var e_end_num = 4;

function getEsportsScreenShot(e_start_num,e_end_num)
{
  var oAjax = new Ajax();
  var arrParam = new Array();
  arrParam["e_start_num"] = e_start_num;
  arrParam["e_end_num"] = e_end_num;
  oAjax.sendRequest("http://ava.pmang.com/esports/ava_main_screen_shot.nwz", arrParam, "GET", "doEsportsScreenShot", "TEXT", false);
}

function doEsportsScreenShot(data)
{
  document.all["screenshot"].innerHTML = data;
}

function pop_pcbang_on()
{
  window.open('http://file.pmang.com/images/pmang/ava/ob/popup/pcbang3/popup.htm', '_pop_pcbang_on', 'resizable=no,width=200,height=300');
}

function pop_pcbang_off()
{
  window.open('http://file.pmang.com/images/pmang/ava/ob/popup/pcbang3/popup2.htm', '_pop_pcbang_off', 'resizable=no,width=200,height=300');
}

function open_poll_popup(url)
{
    window.open(url, '_pollpop', 'resizable=no,scrollbars=no,width=560,height=730'); 
}

function getPrevEsportsScreenShot()
{
  if ( this.e_start_num <= 0 )
  {
    this.e_start_num = 0;
    this.e_end_num = 2;
  }
  else
  {
    this.e_start_num = this.e_start_num - 1;
    this.e_end_num = this.e_end_num - 1;    
  }
  getEsportsScreenShot(this.e_start_num,this.e_end_num);
}

function getNextEsportsScreenShot()
{
  if ( this.e_end_num >= 6 )
  {
    this.e_start_num = 4;
    this.e_end_num = 6;
  }
  else
  {
    this.e_start_num = this.e_start_num + 1;
    this.e_end_num = this.e_end_num + 1;    
  }
  getEsportsScreenShot(this.e_start_num,this.e_end_num);
}


function noticeChg(num){
	var totalNum = 3;
	for(i=1;i<=totalNum;i++){
		notice = "notice_"+i;
		if(num==i){
			document.getElementById(notice).style.display="block";
		}
		else {
			document.getElementById(notice).style.display="none";
		}
	}
}

function tiOpen(){
}
function tiClose(){
  	  if (document.all.ti_banner.checked == true) {   
		     var ExpDate = new Date();   
		     ExpDate.setDate(ExpDate.getDate() + 1);   
	       document.cookie = 'ti_banner_open' + "=" + escape("no") + ";domain=pmang.com;path=; expires=" + ExpDate.toGMTString() + ";"
 	    }   
  document.getElementById('ava_ti').style.display='none';
}

//È®Àå ÇÃ·¡½Ã ¹è³Ê
function expandBannerOpen(){
	var html = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='455' height='455' id='bannertop' align='middle' />\
	<param name='allowScriptAccess' value='always' />\
	<param name='movie' value='http://file.pmang.kr/images/pmang/ava/ob2/swf/expand_banner.swf' />\
	<param name='quality' value='high' />\
	<param name='bgcolor' value='#ffffff' />\
	<param name='wmode' value='transparent'>\
	<param name='menu' value='false'>";
	html = html + "<embed src='http://file.pmang.kr/images/pmang/ava/ob2/swf/expand_banner.swf' wmode='transparent' quality='high' bgcolor='#ffffff' width='455' height='455' name='bannertop' align='middle' allowscriptaccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />\
	</object>";
	document.getElementById('av_expandbanner').innerHTML = html;
	document.getElementById('av_expandbanner').style.display='block';
}

function expandBannerClose(){
	document.getElementById('av_expandbanner').style.display='none';
}

function openPresent()
{
    window.open('http://ava.pmang.com/event/20081222/index.nwz', 'ava_1year', 'resizable=no,width=100,height=100');
}

function getFirstCoupon()
{
   document.fo_ava_search.target = "virtual_fr";
   document.fo_ava_search.action = "ava_get_dis_coupon.nwz";
   document.fo_ava_search.method = "POST";
   document.fo_ava_search.submit();
}

function searchPcbang(frm)
{
  if ( frm.gugun.value == "" )
  {
    alert('½Ã/±¸/±ºÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä');
    frm.gugun.focus();
    return;
  }

  if ( frm.type.value == 1 )
    frm.url.value = 'http://ava.pmang.com/ava_pcbang.nwz?searchit=Y&sido='+frm.sido.value+'&gugun='+frm.gugun.value+'&dong='+frm.dong.value+'&order=';
  else
    frm.url.value = 'http://ava.pmang.com/ava_pcbang2.nwz?searchit=Y&sido='+frm.sido.value+'&gugun='+frm.gugun.value+'&dong='+frm.dong.value+'&order=';  
  frm.submit();
}

function viewDetail(num)
{
  document.location.href = 'ava_medal_view.nwz?medal_id='+num;
}

function my_bbs_paging(page,usn)
{
    var arrParam = new Array();
    arrParam["av_login_pop_type"] = '4';
    arrParam["page"] = page;
    arrParam["usn"] = usn;
    ajax_print_layer("gamepub_get_av_login_popup","ava_bbs_layer",arrParam);
}

function editQuickLink()
{
  window.open('http://ava.pmang.com/ava_set_quick_link.nwz', '_quick_link', 'resizable=no,width=440,height=320');
}

// °í°´¼¾ÅÍ °ü·Ã
function hdLastClass() {
	var c_name = getElementsByClass('av_helpdesk');
	if (!c_name[0]) return;
	var changeValue = getElementsByClass('tab');
	if (!changeValue[0]) return;
	changeValue[0].lastChild.className +='last';
	var changeValue = getElementsByClass('policy');
	if (!changeValue[0]) return;
	changeValue[0].lastChild.className +='last';
}

//Table Stripe Color : Pcbang Search
function changeBgColor(){
	var targetEl = "pcbang_list";	//target class
	var cells = getElementsByClass(targetEl);
	if(!cells.length) return false;
	cells = cells[0].getElementsByTagName('tr');
	for(i=1;i<cells.length;i++){
		cells[i].onmouseover = function(){
			this.style.backgroundColor = '#E3DBCA';
		}
		cells[i].onmouseout = function(){
			this.style.backgroundColor = '';
		}
	}
}

function goWeapon(code,act)
{
  window.open('http://ava.pmang.com/ava_frame.nwz?mKey=2&sKey=4&url='+encodeURIComponent('http://ava.pmang.com/ava_guide_weapon.nwz?m='+act+'#'+code));
}

function flash_error(msg)
{
  alert(msg);
}

function scrollTop(){
	scroll(0,0);
}

function checkLogin()
{
    var arrParam = new Array();
    var oAjax = new Ajax();
    var blogin = oAjax.sendRequest( "http://ava.pmang.com/gamepub/client/check_login.nwz", arrParam, "GET", null, "TEXT", true);
    if( blogin=="ONLINE" ) return true;
    return false;
}

// Å¬¶óÀÌ¾ðÆ® º¹±¸ÇÏ±â
function run_recovery()
{
  gamepub.launcher.set("ssn", 320);
  gamepub.launcher.download("recovery");
  /*
  if ( checkLogin() )
  	run_launcher('http://dl.pmang.com/ava/version.ini 40969800|pv6_recovery');
  else
    pub_alert('·Î±×ÀÎ ÈÄ ÀÌ¿ëÇØ ÁÖ¼¼¿ä.');
  */
}
// °ÔÀÓÆÐÄ¡ »¡¸®¹Þ±â
function run_patch()
{
  gamepub.launcher.set("ssn", 320);
  gamepub.launcher.download("patch");
}

function Itemview(saleinfo_id,category,order,list_type)
{
  document.location.href = "http://ava.pmang.com/ava_item_view.nwz?saleinfo_id="+saleinfo_id+"&category="+category+"&order="+order+"&list_type="+list_type;
}
function Itemview2(item_code,category,order,list_type)
{
var saleinfo_id = eval('document.fo.saleinfo_id_'+item_code+'.value;');
document.location.href = "http://ava.pmang.com/ava_item_view.nwz?saleinfo_id="+saleinfo_id+"&category="+category+"&order="+order+"&list_type="+list_type;
}
function Itemview3(item_code)
{
var saleinfo_id = eval('document.fo.saleinfo_id_best_'+item_code+'.value;');
document.location.href = "http://ava.pmang.com/ava_item_view.nwz?saleinfo_id="+saleinfo_id;
}
function Itembuy2(item_code)
{
var saleinfo_id = eval('document.fo.saleinfo_id_'+item_code+'.value;');
//open_win("http://www.pmang.com/gamepub_purchase.nwz?ssn=320&saleinfo_id="+saleinfo_id, "_buy","430","700");
pub_shop.buy(320,saleinfo_id);
}

function Itembuy(saleinfo_id)
{
//open_win("http://www.pmang.com/gamepub_purchase.nwz?ssn=320&saleinfo_id="+saleinfo_id, "_buy","430","700");
pub_shop.buy(320,saleinfo_id);
}

function Itempresent2(item_code)
{
var saleinfo_id = eval('document.fo.saleinfo_id_'+item_code+'.value;');
//open_win("http://www.pmang.com/gamepub_gift.nwz?ssn=320&saleinfo_id="+saleinfo_id, "_buy","430","700");
pub_shop.gift(320,saleinfo_id);
}
function Itembuy3(item_code)
{
var saleinfo_id = eval('document.fo.saleinfo_id_best_'+item_code+'.value;');
//open_win("http://www.pmang.com/gamepub_purchase.nwz?ssn=320&saleinfo_id="+saleinfo_id, "_buy","430","700");
pub_shop.buy(320,saleinfo_id);
}

function Itempresent3(item_code)
{
var saleinfo_id = eval('document.fo.saleinfo_id_best_'+item_code+'.value;');
//open_win("http://www.pmang.com/gamepub_gift.nwz?ssn=320&saleinfo_id="+saleinfo_id, "_buy","430","700");
pub_shop.gift(320,saleinfo_id);
}

function Itempresent(saleinfo_id)
{
//open_win("http://www.pmang.com/gamepub_gift.nwz?ssn=320&saleinfo_id="+saleinfo_id, "_buy","430","700");
pub_shop.gift(320,saleinfo_id);
}

function my_pmang()
{
  window.open('http://www.pmang.com/profile_check_ssn2_gate_pmang.nwz?pageurl=www.pmang.com%2Fmy_profile.nwz&from=pmang');
}

function CapsuleItem(node){
	target = document.getElementById(node);
	if(!target) return false;
	if(target.getElementsByTagName('a').length==0) return false;
	for(i=0;i<target.getElementsByTagName('a').length;i++){
		target.getElementsByTagName('a')[i].onclick = function(){
			viewCapsuleItem(node, this);
		}
	}
}

function viewCapsuleItem(node, now){
	target = document.getElementById(node);
	for(i=0;i<target.getElementsByTagName('a').length;i++){
		target.getElementsByTagName('a')[i].className="";
	}
	now.className="on";
	var imgURL = now.getElementsByTagName('img')[0].src;
	var imgTag = getElementsByClass("capsule_image",target);
	imgURL = imgURL.replace("1.gif","0.gif");
	imgTag[0].src=imgURL;
}

function bgCheck(){
	if(document.getElementById('av_mainbg')){
		document.getElementById('av_mainbg').style.backgroundImage = "url(http://file.pmang.kr/images/pmang/ava/ob2/img/common/bg_"+avaHtml.flashbg+".jpg)";
		if(!window.addEventListener) document.getElementById('av_wrapin').style.backgroundImage = "url(http://file.pmang.kr/images/pmang/ava/ob2/img/common/bg_hide.gif)";
	}
	if(document.getElementById('av_subbg')){
		document.getElementById('av_subbg').style.backgroundImage = "url(http://file.pmang.kr/images/pmang/ava/ob2/img/common/bgs_"+avaHtml.flashbg+".jpg)";
	}
}

function search_pcbang(frm)
{
  if ( frm.keyword.value == "" )
  {
    pub_alert("Áö¿ª(µ¿) ÀÌ¸§ÀÌ³ª PC¹æ ÀÌ¸§À» ÀÔ·ÂÇÏ¿© ÁÖ¼¼¿ä.");
    frm.keyword.focus();
    return;
  }
  
  frm.url.value = '/gamepub/search_paid_pcbang.nwz?ssn=320&keyword='+frm.keyword.value;
  frm.submit();
}

addEvent(window, 'load', bgCheck);