//<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">

// ·Î±×ÀÎ ¿µ¿ª BG (IEÀü¿ë)
function LoginBgChange() {
	var ThisInput = event.srcElement;
	ThisInput.style.backgroundImage = "none";
}

function setMainFlash() {
	window.setInterval('checkMainFlash()',100);
}
function checkMainFlash() {
	var flashDiv = document.getElementById('mainFlashImg');
	var bodyWidth = document.body.clientWidth;
	if ( bodyWidth > 980) {
		flashDiv.style.width = Math.round(bodyWidth/2-27)+'px';
	}	else { flashDiv.style.width = '463px'; }
}

function setSubImg() {
	window.setInterval('checkSubImg()',100);
}
function checkSubImg() {
	var subDiv = document.getElementById('subLayoutImg');
	var bodyWidth = document.body.clientWidth;
	if ( bodyWidth > 968) {
		subDiv.style.width = Math.round(bodyWidth/2+301)+'px';
	}	else { subDiv.style.width = '860px'; }
}


// ·Î±×ÀÎ Á¤º¸¿µ¿ª Åä±Û
function toggleUserInfo(obj,id) {
	var userinfo = document.getElementById(id);
	
	if(userinfo.className == 'info_close') { 
		userinfo.className='info_open '+id+'_open'; 
		obj.src = 'http://file.pmang.com/images/pmang/debut/ob/img/common/btn_login_close.gif';
	}
	else if(userinfo.className == 'info_open '+id+'_open') { 
		userinfo.className='info_close'; 
		obj.src = 'http://file.pmang.com/images/pmang/debut/ob/img/common/btn_login_more.gif';
	}
}

// ·¹ÀÌ¾îÅä±Û
function toggleLayer(id) {
  if(!document.getElementById(id)) return false;
  
  var Layer = document.getElementById(id);
  
  if(Layer.style.display == 'block') Layer.style.display = 'none';
  else Layer.style.display = 'block'; 
}


// ÅÇµ¿ÀÛ
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) {
				TabContents.style.display = "block";
				TabGroup[TabThis].parentNode.className = "on";
			}
			else {
				TabContents.style.display = "none";
				TabGroup[i].parentNode.className = "";
			}
		}
	}
}

// labelµ¿ÀÛ
function clicklabel(id) {	
	if(navigator.appVersion.indexOf('MSIE') != -1){
		document.getElementById(id).click()}
}

// ·¹ÀÌ¾î º¸±â
function LayerView(layer) {
	if(document.getElementById(layer)) 	document.getElementById(layer).style.display = "block";
}

// ·¹ÀÌ¾î ´Ý±â 
function LayerClose(layer) {
	if(document.getElementById(layer)) 	document.getElementById(layer).style.display = "none";
}

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);
}

// ¹Ìµð¾îÇÃ·¹ÀÌ¾î ½ºÅ©¸³Æ®
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);
}

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' );
  if (document.domain == "cyworld.com")
  {
	  var url = "http://file-pm.game.cyworld.com/images/pmang/gamepub/police/community.html";
  }
  else if (document.domain == "tooniland.com")
  {
	  var url = "http://tenvifile.tooniland.com/images/pmang/gamepub/police/community.html";
  }
  else
  {
  	  var url = "http://file.pmang.com/images/pmang/gamepub/police/community.html";
  }

 window.open( url , '_policy', 'width=670,height=495,resizable=no,scrollbars=no,scrolling=no' );
}

//  -- Æ¼Àú ÆäÀÌÁö »õÃ¢ ½ºÅ©¸³Æ®
function teaser_open() {
	var customWidth = screen.width-8+'px';
	var customHeight = screen.height-55+'px';
	window.open('/teaser.nwz', 'flash_pop', 'left=0, top=0, width=' + customWidth + ', height=' + customHeight + ', fullscreen=no, menubar=no, status=no, toolbar=no, titlebar=yes, location=no, scrollbar=no');
}
function teaser_close() {
	self.close();
}

function teaser_realname() {
	window.open("https://secure.pmang.com/www/check_member_realname_confirm_popup.nwz?from=pmang","_realname","width=510,height=503");
}


 

function policy_pop()
{
	
  //window.open("http://file.pmang.kr/images/pmang/gamepub/police/debut.html#12", '_check', "resizable=no,scrollbars=no, width=670, height=535");

  if (document.domain == "cyworld.com")
  {
	  var url = "http://file-pm.game.cyworld.com/images/pmang/gamepub/police/debut.html#12";
  }
  else if (document.domain == "tooniland.com")
  {
	  var url = "http://tenvifile.tooniland.com/images/pmang/gamepub/police/debut_TN.html#12";
  }
  else
  {
  	  var url = "http://file.pmang.com/images/pmang/gamepub/police/debut.html#12";
  }
   window.open( url , '_check', "resizable=no,scrollbars=no, width=670, height=535");
}
function checkSystem(checked)
{
    var result = checkCominfo(checked);
    if ( result != "" )
      document.all.my_com_info.value=result;
    else
      document.all.my_com_info.value="";
}

function GotoSubUrl(url)
{
    if (url != "")
      document.all.INFO_DOC.src=url;
    else
    {
      url = "";
      document.all.INFO_DOC.src=url;
    }
}

function go_menu(param1,param2)
{
  //document.location.href = 'http://www.pmang.com/debut/debut_frame.nwz?mKey='+param1+'&sKey='+param2;
	//document.location.href = 'http://' + document.location.hostname +  '/debut/debut_frame.nwz?mKey='+param1+'&sKey='+param2;
	document.location.href = '/debut_frame.nwz?mKey='+param1+'&sKey='+param2;
} 

function go_home ()
{
 	document.location.href = '/debut_home.nwz?ssn=328';
} 

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 go_left_popup(url, wid, hgt)
{
  open_win_scroll(url, "_left_dt_banner", wid, hgt);
}

function openMusicPlayer(is_force)
{
   if (document.domain ==  "cyworld.com")
		var url = "http://debut.game.cyworld.com";
	 else	if (document.domain ==  "tooniland.com")
		var url = "http://debut.tooniland.com";
	else
	   var url = "http://debut.pmang.com";

  if (is_force != true )
  {
	   
	  if (document.domain ==  "cyworld.com")
		  var is_open = getCookie("cyworld_328_player");
		else	if (document.domain ==  "tooniland.com")
			var is_open = getCookie("tooniland_328_player");
	  else
		  var is_open = getCookie("pmang_328_player");

      if ( is_open != "Y" )
            // window.open('http://www.pmang.com/gamepub/music_player.nwz?ssn=328', 'player', 'resizable=no,width=300,height=147');
			window.open( url + '/gamepub/music_player.nwz?ssn=328', 'player', 'resizable=no,width=300,height=147');
  }
  else
    //window.open('http://www.pmang.com/gamepub/music_player.nwz?ssn=328', 'player', 'resizable=no,width=300,height=147');
    window.open( url + '/gamepub/music_player.nwz?ssn=328', 'player', 'resizable=no,width=300,height=147');
}

function pop_stylist_cookie(result)
{
  if ( result == true )
  {
		 var ExpDate = new Date();   
		 ExpDate.setDate(ExpDate.getDate() + 1);   
		// document.cookie = 'debut_event_20080911' + "=" + escape("no") + ";domain=pmang.com;path=; expires=" + ExpDate.toGMTString() + ";"
		 document.cookie = 'debut_event_20080911' + "=" + escape("no") + ";domain=" + document.domain + ";path=; expires=" + ExpDate.toGMTString() + ";"
	}   
  document.all.pop_stylelist.style.visibility = "hidden";
}

function close_player()
{
  try
  {
    //var player = window.open('http://file.pmang.com/images/pmang/debut/ob/html/dummy.html', 'player', 'resizable=no,width=10,height=10');
	  if (document.domain == "cyworld.com")
	  {
		  var url = "http://file-pm.game.cyworld.com/images/pmang/debut/ob/html/dummy.html";
	  }
	  else	if (document.domain ==  "tooniland.com")
	  {
	    var url = "http://tenvifile.tooniland.com/images/pmang/debut/ob/html/dummy.html";
	  }
	  else
	  {
		  var url = "http://file.pmang.com/images/pmang/debut/ob/html/dummy.html";
	  }

	var player = window.open( url, 'player', 'resizable=no,width=10,height=10');
	 
    player.close();
  }
  catch ( exception ) {}
}


// ¹ÂÁ÷Åå Hot¹ÂÁ÷ ·Ñ¸µ 
function fitMusicHot() {
}
function checkMaxNum(id,startNum) {
	var startNum = (startNum==null)?0:startNum;
	var maxNum = 0;	
	while(document.getElementById(id+startNum)) {
		++startNum;
		++maxNum
	}	
	return maxNum;	
}
function onMusicHot(no) {	
	var maxNum = checkMaxNum('musichot',1);
	for(i=1; i<=maxNum; i++) {
		//document.getElementById('musichot'+i).getElementsByTagName('a')[0].style.padding = parseInt((document.getElementById('channel').clientHeight-220)/2)+'px 0';
		if(i==no) document.getElementById('musichot'+i).className = 'on';
		else document.getElementById('musichot'+i).className = '';		
	}
}
function goMusicHot(no) {
	var maxNum = checkMaxNum('musichot',1);
	if(no==null) no=1;
	
	onMusicHot(no);
	
	no = (++no>maxNum)?1:no;
	rollingEvent = setTimeout("goMusicHot("+no+")",2000);
}


// ÁÂÇ¥±¸ÇÔ
function findPosY(obj) {
	var posTop = 0;
	while (obj.offsetParent) {
		posTop += obj.offsetTop;
		obj = obj.offsetParent;
	}
	return posTop;
}

function findPosX(obj) {
	var posLeft = 0;
	while (obj.offsetParent) {
		posLeft += obj.offsetLeft;
		obj = obj.offsetParent;
	}
	return posLeft;
}

//Background Clear 
function BGClear() {
	event.srcElement.style.backgroundImage = 'none';	
}


// ¹ÂÁ÷Åå ¹ÂÁ÷ preÇÃ·¹ÀÌ¾î 
function MPrePlay(musicid, name) {
	
	var myObject = document.getElementById("MprePlayer");
	var mPlay = document.getElementById('mTalkPlayer');
	
	var posname = "btnPlay"+musicid;
	var posobj = document.getElementById(posname);
	var posY = findPosY(posobj)+17;
	var posX = findPosX(posobj)-196;
	var player = document.getElementById('mTalkPlayer');
	var playerTitle = document.getElementById('mTalkPlayerTitle');
	
	player.style.display = 'block';
	player.style.top = posY+'px';
	player.style.left = posX+'px';
	playerTitle.innerText = name;

	myObject.FileName = "mms://streaming.pmang.com/pmang/publicgame/debut/dt_" + parseInt(musicid) + ".wma";
  myObject.play();
}

function MPrePlayClose() {
	document.getElementById('mTalkPlayer').style.display = "none";
	document.getElementById("MprePlayer").pause();
}

function toggleMprePlay() {
	var btn = document.getElementById('mTalkPlayerBtn');
	var btn_pause = 'http://file.pmang.com/images/pmang/debut/ob/bbs/img/btn_mpreplay_pause.gif'
	var btn_play = 'http://file.pmang.com/images/pmang/debut/ob/bbs/img/btn_mpreplay_play.gif'
	var myObject = document.getElementById("MprePlayer");
	
	if(btn.src == btn_pause) {
		btn.src = btn_play;
		myObject.pause();
	}
	else if(btn.src == btn_play) {
		btn.src = btn_pause;
		myObject.play();
	}
}

function MPrePlayPause() {
	myObject.pause();	
	var imgRoot = "http://file.pmang.com/images/pmang/r2beat/renew2007/img/community/";
	
	document.getElementById('MPrePlayBtn').outerHTML =  "<img src='"+imgRoot+"btn_play_play.gif' class='btn_play' id='MPrePlayBtn' onClick='MPrePlayGo()'>";
}

function MPrePlayGo() {
	myObject.play();	
	var imgRoot = "http://file.pmang.com/images/pmang/r2beat/renew2007/img/community/";
	
	document.getElementById('MPrePlayBtn').outerHTML =  "<img src='"+imgRoot+"btn_play_stop.gif' class='btn_play' id='MPrePlayBtn' onClick='MPrePlayPause()'>";
}

function MPrePlayRe() {
	var imgRoot = "http://file.pmang.com/images/pmang/r2beat/renew2007/img/community/";
	document.getElementById('MPrePlayBtn').outerHTML =  "<img src='"+imgRoot+"btn_play_play.gif' class='btn_play' id='MPrePlayBtn' onClick='MPrePlayGo()'>";
}

function popOpenPoll(subnum) {
	//var pollurl = "http://www.pmang.com/debut/debut_board.nwz?act=read&ssn=328&bserial=301&lbserial=301&ano="+subnum+"&no=1";
	var pollurl ="/debut_board.nwz?act=read&ssn=328&bserial=301&lbserial=301&ano="+subnum+"&no=1";
	window.open(pollurl, "pop_poll", "width=540,height=640,resizable=no,scrollbars=no,scrolling=no");
}



// function cyFooter() {
	// var o = document.getElementById('cy_footer');
	// if (!o) {
		// return;
	// }
	// var new_footer = o.cloneNode();
	// new_footer.innerHTML = o.innerHTML;
	// o.parentNode.removeChild(o);
	// document.body.appendChild(new_footer);
// }


// addEvent(window, 'load', cyFooter);
// addEvent(window, 'unload', EventCache.flush);

// °Ô½ÃÆÇ ÀÌº¥Æ® 

function applyEventDT()
{ 
 
	  var strRetMsg			= "/event/event090427/event_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("328",msgs,"¹ßÄ¢ÇÑ ¿©¿ìµéÀÇ ¹«´ë DEBUT",370,260,"È® ÀÎ",80,"",0);
		  //if (SayModal)	location.reload();

	  }
	  else
		var SayModal = open_alert("328",msgs,"¹ßÄ¢ÇÑ ¿©¿ìµéÀÇ ¹«´ë DEBUT",370,260,"È® ÀÎ",80,"",0);
 
}


function applyEventCouponDT( no )
{ 
 
	  var strRetMsg			= "/debut_event_coupon.nwz?no=" + no;
	  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("328",msgs,"¹ßÄ¢ÇÑ ¿©¿ìµéÀÇ ¹«´ë DEBUT",370,260,"È® ÀÎ",80,"",0);
		  //if (SayModal)	location.reload();

	  }
	  else
		var SayModal = open_alert("328",msgs,"¹ßÄ¢ÇÑ ¿©¿ìµéÀÇ ¹«´ë DEBUT",370,260,"È® ÀÎ",80,"",0);
 
}

function applyEventHopi()
{ 
	virtual_fr.location.href="/event/20100209/get_item.nwz";
}

function applyValEvent1()
{ 
	virtual_fr.location.href="/event/20100210/get_item.nwz?etype=100";
}
function applyValEvent2()
{ 
	virtual_fr.location.href="/event/20100210/get_item.nwz?etype=200";
}
function applyValEvent3()
{ 
	virtual_fr.location.href="/event/20100210/get_item.nwz?etype=300";
}