/*
 * ¸¶±¸¸¶±¸ °øÅë ½ºÅ©¸³Æ®
 */

var ma9url = "/ma9"; // ¸¶±¸¸¶±¸ °¡»óµð·ºÅä¸® °æ·Î
var ma9site = "";
try {
	ma9site = /^http:\/\/[^.]+.([^.]+).(?:com|net){1}/i.exec(location.href.toLowerCase())[1];
} catch (ex) {
	ma9site = "netmarble";
}

// Ä«µå»ó¼¼Á¤º¸ ÀÌµ¿ÇÔ¼ö
function f_cardinfo(p_idx, p_name) {
	if (opener) {
		opener.location.href= ma9url + "/cardinfo/card/cardDetailinfo.asp?reqidx="+p_idx + "&reqname=" + p_name;
	} else {
		location.href= ma9url + "/cardinfo/card/cardDetailinfo.asp?reqidx="+p_idx + "&reqname=" + p_name;
	}
}

// New Ä«µå»ó¼¼Á¤º¸ ÀÌµ¿ÇÔ¼ö
function f_Teampopup_cardinfo(p_idx, p_name) {
	if (parent.opener) {
		parent.opener.location.href= ma9url + "/cardinfo/card/index.asp?searchTxt=" + p_name;
	}
}

// ½ºÆçÄ«µåÁ¤º¸ ÀÌµ¿ÇÔ¼ö
function f_spellcardinfo(p_spelltype, p_idx, p_name) {
	if (opener) {
		opener.location.href= ma9url + "/cardinfo/card/spellcard.asp?reqSpelltype=" + p_spelltype + "&reqidx="+p_idx + "&reqname=" + p_name +"#cardfocus" + p_idx;
	} else {
		location.href= ma9url + "/cardinfo/card/spellcard.asp?reqSpelltype=" + p_spelltype + "&reqidx="+p_idx + "&reqname=" + p_name +"#cardfocus" + p_idx;
	}
}

// ÀåºñÄ«µåÁ¤º¸ ÀÌµ¿ÇÔ¼ö
function f_itemcardinfo(p_itemtype, p_idx, p_name) {
	if (opener) {
		opener.location.href= ma9url + "/cardinfo/card/itemcard.asp?reqitemtype=" + p_itemtype + "&reqidx="+p_idx + "&reqname=" + p_name +"#cardfocus" + p_idx;
	} else { 
		location.href= ma9url + "/cardinfo/card/itemcard.asp?reqitemtype=" + p_itemtype + "&reqidx="+p_idx + "&reqname=" + p_name +"#cardfocus" + p_idx;
	}
}

// New ÀåºñÄ«µåÁ¤º¸ ÀÌµ¿ÇÔ¼ö
function f_Teampopup_itemcardinfo(p_itemtype, p_idx, p_name) {
	if (parent.opener) {
		parent.opener.location.href= ma9url + "/cardinfo/card/itemcard.asp?reqitemtype=" + p_itemtype + "&reqidx="+p_idx + "&reqname=" + p_name +"#cardfocus" + p_idx;
	}
}

// Ä«µå»ó¼¼Á¤º¸ ÀÌµ¿ÇÔ¼ö
function f_cardinfo_self(p_idx, p_name) {
	location.href= ma9url + "/cardinfo/card/cardDetailinfo.asp?reqidx="+p_idx + "&reqname=" + p_name;
}

// ½ºÆçÄ«µåÁ¤º¸ ÀÌµ¿ÇÔ¼ö
function f_spellcardinfo_self(p_spelltype, p_idx, p_name) {
	location.href= ma9url + "/cardinfo/card/spellcard.asp?reqSpelltype=" + p_spelltype + "&reqidx="+p_idx + "&reqname=" + p_name +"#cardfocus" + p_idx;
}

// ½ºÆçÄ«µåÁ¤º¸ ÀÌµ¿ÇÔ¼ö
function f_spellcardinfo_self_sub(p_spelltype, p_idx, p_name) {
	location.href= ma9url + "/cardinfo/card/spellcard_sub.asp?reqSpelltype=" + p_spelltype + "&reqidx="+p_idx + "&reqname=" + p_name +"#cardfocus" + p_idx;
}

// ÀåºñÄ«µåÁ¤º¸ ÀÌµ¿ÇÔ¼ö
function f_itemcardinfo_self(p_itemtype, p_idx, p_name) {
	location.href= ma9url + "/cardinfo/card/itemcard.asp?reqitemtype=" + p_itemtype + "&reqidx="+p_idx + "&reqname=" + p_name +"#cardfocus" + p_idx;
}

// ÀåºñÄ«µåÁ¤º¸ ÀÌµ¿ÇÔ¼ö
function f_itemcardinfo_self_sub(p_itemtype, p_idx, p_name) {
	location.href= ma9url + "/cardinfo/card/itemcard_sub.asp?reqitemtype=" + p_itemtype + "&reqidx="+p_idx + "&reqname=" + p_name +"#cardfocus" + p_idx;
}

// Ä«µå¼Ò°³ > Ä«µåÈ®ÀÎ¹æ¹ý ÀÌµ¿ÇÔ¼ö
function f_cardconfirm_guide() {
	location.href= ma9url + "/Coach/guide/guide11.asp";
}

// Ä«µå¼Ò°³ > Ä«µå»ç¿ë¹æ¹ý ÀÌµ¿ÇÔ¼ö
function f_carduse_guide() {
	location.href= ma9url + "/Coach/guide/guide11.asp";
}

// ¼±¼ö °Ë»öÆû Ã¼Å©
function f_searchsubmit() {
	var f = document.frm_search;

	if (f.keyword.value.length == 0) {
		alert("°Ë»öÇÒ ¼±¼ö¸íÀ» ÀÔ·ÂÇØÁÖ¼¼¿ä.");
		f.keyword.focus();
		return false;
	}
	return;
}

function goEvent1() {
	var ob_banner1 = window.open("about:blank");
	ob_banner1.location.href = NM_DOMAIN_EVENT + "/event/2006/ma9/_html/ma9TotoEvent/ma9TotoEventSelectLs.asp";
}

function goNotice1() {
	var ob_banner2 = window.open("about:blank");
    ob_banner2.location.href = "http://pcbang.netmarble.net/customercenter/pcroom_search.asp";
}

// ÆÀÁ¤º¸ ÆË¾÷
function f_teaminfo(p_seq, p_teamname, p_userid) {
	f_openWinNoResize(ma9url + "/teaminfo/TeamTotalInfo.asp?seqid=" + p_seq + "&UserID="+p_userid+"&teamname=" + p_teamname ,800,550,"teaminfo");
}

// ÆÀÁ¤º¸ ÆË¾÷
function my_teaminfo(p_seq, p_teamname, p_userid) {
	f_openWinNoResize(ma9url + "/teaminfo/TeamTotalInfo.asp?seqid=" + p_seq + "&UserID="+p_userid+"&teamname=" + p_teamname ,800,550,"myteaminfo");
}

// ÆÀÁ¤º¸ ÆË¾÷
function f_teaminfo_club(p_seq, p_teamname, p_userid) {
	f_openWinNoResize(ma9url + "/teaminfo/TeamTotalInfo.asp?menuno=5&seqid=" + p_seq + "&UserID="+p_userid+"&teamname=" + p_teamname ,800,550,"teaminfo");
}

// ÆÀÁ¤º¸ ÆË¾÷
function my_teaminfo_club(p_seq, p_teamname, p_userid) {
	f_openWinNoResize(ma9url + "/teaminfo/TeamTotalInfo.asp?menuno=5&seqid=" + p_seq + "&UserID="+p_userid+"&teamname=" + p_teamname ,800,550,"myteaminfo");
}

//
function FlashPlay(Url, tWidth, tHeight, Wmode, swfId) // °æ·Î,°¡·Î,¼¼·Î,Åõ¸í,ID
{
   var tmpStr = "";
   tmpStr += "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,29,0' width='"+ tWidth +"' height='"+ tHeight +"' id='"+ swfId +"'>"
   tmpStr += "<param name='movie' value='"+ Url +"'>"
   tmpStr += "<param name='quality' value='high'>"
   tmpStr += "<param name='wmode' value='"+ Wmode +"'>"
   tmpStr += "<param name='allowScriptAccess' value='always'>"
   tmpStr += "<embed src='"+ Url +"' width='"+ tWidth +"' height='"+ tHeight +"' wmode='"+ Wmode +"' id='"+ swfId +"' allowScriptAccess='always' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash'></embed>"
   tmpStr += "</object>"
   
   document.write (tmpStr);
}

//¸ÞÀÎ left ÇÃ·¡½Ã »çÀÌÁî
function FlashHeight(num){
	document.getElementById('ma9_event').style.height = 488 + (22 * num);
}

//subLeft ·Ñ¸µ¹è³Ê
old_sub_event = 1
function Show(n){
	divs = document.getElementById("lme_div");

	if(old_sub_event==1){
	divs.getElementsByTagName("dt")[0].style.display = "none"
	}else{
	divs.getElementsByTagName("dt")[old_sub_event-1].style.display = "none"
	}
	divs.getElementsByTagName("dt")[n-1].style.display = "block";
	old_sub_event = n
}

// Tab Content
function initTabMenu(tabContainerID) {
	var tabContainer = document.getElementById(tabContainerID);
	var tabAnchor = tabContainer.getElementsByTagName("a");
	var i = 0;

	for(i=0; i<tabAnchor.length; i++) {
		if (tabAnchor.item(i).className == "tab")
			thismenu = tabAnchor.item(i);
		else
			continue;

		thismenu.container = tabContainer;
		thismenu.targetEl = document.getElementById(tabAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		thismenu.imgEl = thismenu.getElementsByTagName("img").item(0);
		thismenu.onclick = function tabMenuClick() {
			currentmenu = this.container.current;
			if (currentmenu == this)
				return;

			if (currentmenu) {
				currentmenu.targetEl.style.display = "none";
				if (currentmenu.imgEl) {
					currentmenu.imgEl.src = currentmenu.imgEl.src.replace("on.gif", ".gif");
				} else {
					currentmenu.className = currentmenu.className.replace(" on", "");
				}
			}

			this.targetEl.style.display = "block";
			if (this.imgEl) {
				this.imgEl.src = this.imgEl.src.replace(".gif", "on.gif");
			} else {
				this.className += " on";
			}
			this.container.current = this;

			return false;
		};

		if (!thismenu.container.first)
			thismenu.container.first = thismenu;
	}
	if (tabContainer.first)
		tabContainer.first.onclick();
}

/* Á¶ÀÛ¹ý */
function layer_show(s) {
	if (document.layers) {
		document.layers[s].top = event.clientY + document.body.scrollTop;   
		document.layers[s].left = event.clientX + document.body.scrollLeft;   
	}
	if (document.all) {
		document.all(s).style.top = event.clientY + document.body.scrollTop; 
		document.all(s).style.left =event.clientX + document.body.scrollLeft; 
	}
}

function my_show_layer(lname) {
	if (lname == '') return;

	var layer  = document.all ? document.all(lname).style : document.layers[lname];
	var show  = document.all ? 'visible' : 'show';
	var hide  = document.all ? 'hidden' : 'hide';

	if (my_show_layer.arguments.length <= 1)
		layer.visibility = show;
	else
		layer.visibility = (my_show_layer.arguments[1] == 0 ? show : hide);
}

function my_hide_layer(lname) {
	if (document.layers)
		document.layers[lname].visibility = 'hide'    
	if(document.all)
		document.all(lname).style.visibility = 'hidden' 
}

function Div_Show(div_id){
	document.getElementById(div_id).style.display = "block";
}

function Div_Hide(div_id){
	document.getElementById(div_id).style.display = "none";
}

function TabItem(str){

	if(str==1){
	document.getElementById("item01").style.display = "block"
	document.getElementById("item02").style.display = "none"
	document.getElementById("tab_item01").src = "http://c2.img.netmarble.kr/web/2005_cp/img/ma9_v2/main/hot_tab01on.gif"
	document.getElementById("tab_item02").src = "http://c2.img.netmarble.kr/web/2005_cp/img/ma9_v2/main/hot_tab02.gif"
	}else{
	document.getElementById("item01").style.display = "none"
	document.getElementById("item02").style.display = "block"
	document.getElementById("tab_item01").src = "http://c2.img.netmarble.kr/web/2005_cp/img/ma9_v2/main/hot_tab01.gif"
	document.getElementById("tab_item02").src = "http://c2.img.netmarble.kr/web/2005_cp/img/ma9_v2/main/hot_tab02on.gif"

	}
}

function hiddenrd(nrdcode) {
	if (ma9site == "netmarble") {
		rd_frame.location.href = "http://nrd.netmarble.net/" + nrdcode + ".rd";
	}
}

function hiddentr(nrdcode) {
	if (ma9site == "netmarble") {
		rd_frame.location.href = "http://nrd.netmarble.net/" + nrdcode + ".tr";
	}
}

old_club = "";
function Club_Show(div_id){	
	if (old_club != div_id) {
		document.getElementById(div_id).style.display = "block";
		if (old_club!=""){
			document.getElementById(old_club).style.display = "none";
		}
	}
	old_club = div_id;
}

function Club_Hide(div_id){
	document.getElementById(div_id).style.display = "none";
	old_club = ""
}

//Tab °øÅë 
function c_tab(no,total,lname) {
	if (no == "") no = "01";

	for(var i=1;i <= total;i++){
	var tlayer = eval("document.all."+lname+"0"+i);
	
	if(tlayer)
	tlayer.style.display = 'none';
	}

	eval("document.all."+lname+no+".style.display = 'block';");
}

// ¸¶±¸¹é°ú»çÀü
function f_ma9pedia(menu) {
	if (!menu || menu == 'undefined') {
		menu = "";
	}

	f_openWinNoResize(ma9url + "/ma9pedia/index.asp?menu=" + menu, 920, 700, "ma9pedia");
}

// °¡»ó ¼¼Æ®µ¦
function f_virtualSetdeck() {
	f_openWinNoResize(ma9url + "/coach/virtualteam/index.asp", 900, 700, "VirtualSetdeck");
}

// µ¿¿µ»ó°¡ÀÌµå
function f_movieGuide() {
	openWin('/ma9/MovieGuide/popMovieGuide.asp', 860, 652);
}

// A ÅÂ±×¿¡ µû¶ó¼­ ÀÌµ¿
function goByAnchor(obj) {
	if (obj != null && obj.tagName.toLowerCase() == "a") {
		if (obj.href.toLowerCase().indexOf("javascript:") == 0) {
			eval(obj.href.substr(11));
		} else {
			switch (obj.target.toLowerCase()) {
				case "_blank": window.open(obj.href); break;
				case "_top": top.location.href = obj.href; break;
				case "_parent": parent.location.href = obj.href; break;
				case "_self": case "": self.location.href = obj.href; break;
				default:
					if (document.getElementsByName(obj.target).length > 0) {
						eval(obj.target + ".location.href = '" + obj.href + "';");
					} else {
						window.open(obj.href, obj.target);
					}
			}
		}
	}
}

