document.write('<script type="text/javascript" src="'+InCludeDomain+'/js/selectBox.js"></script>');


//******************************************//
//							ÀÌ¹ÌÁö ·ÎÅ×ÀÌÆ®	 						//
//*****************************************//
function xwzRollingImageTrans(imageName, thumbnailName, eventName, winName){
	this.Index = 0;
	this.ListItem = new Array(0);
	this.Name = imageName;
	this.Thumbnail = thumbnailName;
	this.tmRotate = null;
	this.nInterval = 4500;
	this.eventName = eventName;
	this.winTarget = winName;
	
	if(window.xwzRollObject == null) window.xwzRollObject = new Array(0);
	window.xwzRollObject[this.Name] = this;

	//== ÃÊ±âÈ­ ÇÔ¼ö
	this.install = function(){
		window.document.images[this.Name].onclick=this.goLink;
		if(this.ListItem.length == 0) return;
		this.tmRotate = setTimeout("window.xwzRollObject['" + this.Name + "'].rotateTrans()" , this.nInterval);
		var icons = document.getElementsByName(this.Thumbnail);
		for(var i = 0; i < icons.length; i++){
			if(this.eventName == 'over') icons[i].onmouseover=new Function("window.xwzRollObject['"+this.Name+"'].alterImage(" + i + ")");
			else icons[i].onclick=new Function("window.xwzRollObject['"+this.Name+"'].alterImage(" + i + ")");
		}
	}
	//== ÇØ´ç ¾ÆÀÌÅÛ Ãß°¡ 
	this.addItem = function(Link, ImgSrc, Icon1, Icon2 ){
		var itmX = {Link : "", ImgSrc : "", DefIcon : "", OvrIcon : ""};
		itmX.Link = Link;
		itmX.ImgSrc = ImgSrc;
		itmX.DefIcon = Icon1;
		itmX.OvrIcon = Icon2;
		this.ListItem[this.ListItem.length] = itmX;
	}
	//== ¼öµ¿ º¯°æ 
	this.alterImage = function(index){
		var icons = document.getElementsByName(this.Thumbnail);
		if(this.Index == index) return;
		if(this.ListItem[this.Index].DefIcon !="") icons[this.Index].src = this.ListItem[this.Index].DefIcon;

		this.Index = index;
		this.imgTrans();
		clearTimeout(this.tmRotate);
		this.tmRotate = null;
		this.tmRotate = setTimeout("window.xwzRollObject['" + this.Name + "'].rotateTrans()" , this.nInterval);

	}

	// ¸µÅ© Å¬¸¯
	this.goLink = function(){
		var name = this.getAttribute('name');
		var xwzRoll = window.xwzRollObject[name];
		clearTimeout(xwzRoll.tmRotate);
		xwzRoll.tmRotate = null;

		if(xwzRoll.ListItem[xwzRoll.Index].Link.indexOf("gundamshop.co.kr") == -1 || xwzRoll.ListItem[xwzRoll.Index].Link.indexOf("gundamshop.co.kr/banner_") > 1){
			window.open(xwzRoll.ListItem[xwzRoll.Index].Link, "_blank");
		}else{
			window.location.href=xwzRoll.ListItem[xwzRoll.Index].Link;
		}
	}

	//==
	this.rotateTrans = function(){
		var icons = document.getElementsByName(this.Thumbnail);
		var itmX = this.ListItem[this.Index];
		if(itmX.DefIcon !="") icons[this.Index].src = itmX.DefIcon;

		this.Index +=1;
		if(this.Index >= this.ListItem.length) this.Index = 0;

		this.imgTrans();
		
		clearTimeout(this.tmRotate);
		this.tmRotate = null;
		this.tmRotate = setTimeout("window.xwzRollObject['" + this.Name + "'].rotateTrans()" , this.nInterval);
	}

	//==
	this.imgTrans = function(){
		var icons = document.getElementsByName(this.Thumbnail);
		var itmX = this.ListItem[this.Index];
		if(itmX.OvrIcon !=null  && itmX.OvrIcon !="") icons[this.Index].src = itmX.OvrIcon;
		try{
			document.images[this.Name].filters[0].apply();
			document.images[this.Name].src = itmX.ImgSrc;
			document.images[this.Name].filters[0].play();
		}catch(e){
			document.images[this.Name].src = itmX.ImgSrc;
		}
	}
}

//******************************************//
//							ÀÌ¹ÌÁö ·ÎÅ×ÀÌÆ®	 						//
//*****************************************//

//***************************************************************************//
//***************************	»ó´Ü ÀÎ±â °Ë»ö¾î ½ºÅ©¸³Æ®	************************//
//***************************************************************************//

function pausescroller(content, divId, divClass, delay){
this.content=content //message array content
this.tickerid=divId //ID of ticker div to display information
this.delay=delay //Delay between msg change, in miliseconds.
this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over scroller (and pause it if it is)
this.hiddendivpointer=1 //index of message array for hidden div
document.write('<div id="'+divId+'" class="'+divClass+'" style="position: relative; overflow: hidden;z-index:10;"><div class="innerDiv" style="position: absolute; width: 100%" id="'+divId+'1">'+content[0]+'</div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="'+divId+'2">'+content[1]+'</div></div>')
var scrollerinstance=this
if (window.addEventListener) //run onload in DOM2 browsers
window.addEventListener("load", function(){scrollerinstance.initialize()}, false)
else if (window.attachEvent) //run onload in IE5.5+
window.attachEvent("onload", function(){scrollerinstance.initialize()})
else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec
setTimeout(function(){scrollerinstance.initialize()}, 500)
}

pausescroller.prototype.initialize=function(){
this.tickerdiv=document.getElementById(this.tickerid)
this.visiblediv=document.getElementById(this.tickerid+"1")
this.hiddendiv=document.getElementById(this.tickerid+"2")
this.visibledivtop=parseInt(pausescroller.getCSSpadding(this.tickerdiv))
//set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2)
this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+"px"
this.getinline(this.visiblediv, this.hiddendiv)
this.hiddendiv.style.visibility="visible"
var scrollerinstance=this
document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1}
document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0}
if (window.attachEvent) //Clean up loose references in IE
window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null})
setTimeout(function(){scrollerinstance.animateup()}, this.delay)
}

pausescroller.prototype.animateup=function(){
var scrollerinstance=this
if (parseInt(this.hiddendiv.style.top)>(this.visibledivtop+5)){
this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-5+"px"
this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-5+"px"
setTimeout(function(){scrollerinstance.animateup()}, 50)
}
else{
this.getinline(this.hiddendiv, this.visiblediv)
this.swapdivs()
setTimeout(function(){scrollerinstance.setmessage()}, this.delay)
}
}

pausescroller.prototype.swapdivs=function(){
var tempcontainer=this.visiblediv
this.visiblediv=this.hiddendiv
this.hiddendiv=tempcontainer
}

pausescroller.prototype.getinline=function(div1, div2){
div1.style.top=this.visibledivtop+"px"
div2.style.top=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px"
}


pausescroller.prototype.setmessage=function(){
var scrollerinstance=this
if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it)
setTimeout(function(){scrollerinstance.setmessage()}, 100)
else{
var i=this.hiddendivpointer
var ceiling=this.content.length
this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1
this.hiddendiv.innerHTML=this.content[this.hiddendivpointer]
this.animateup()
}
}

pausescroller.getCSSpadding=function(tickerobj){ //get CSS padding value, if any
if (tickerobj.currentStyle)
return tickerobj.currentStyle["paddingTop"]
else if (window.getComputedStyle) //if DOM2
return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top")
else
return 0
}



//***************************************************************************//
//***************************	»ó´Ü ÀÎ±â °Ë»ö¾î ½ºÅ©¸³Æ®	************************//
//***************************************************************************//


/*	 ¼ýÀÚ ÄÞ¸¶	*/
function number_format(n){ 
    return Number(String(n).replace(/\..*|[^\d]/g,"")).toLocaleString().slice(0,-3); 
} 
/*	 ¼ýÀÚ ÄÞ¸¶	*/

/*	 ¼ýÀÚ¸¸ ÀÔ·Â	*/
function SetNum(obj){
 val=obj.value;
 re=/[^0-9\/]/gi;
 obj.value=val.replace(re,"");
 //if(parseInt(obj.value)<1||!obj.value) obj.value = 1;
}
/*	 ¼ýÀÚ¸¸ ÀÔ·Â	*/

/*	 ¾ÆÀÌÇÁ·¹ÀÓ »çÀÌÁîÁ¶Á¤	*/
function ResizeiFrame(iframeObj){ 
	var innerBody = iframeObj.contentWindow.document.body; 
	oldEvent = innerBody.onclick; 
	innerBody.onclick = function(){ ResizeiFrame(iframeObj, 1);oldEvent; }; 

	var innerHeight = innerBody.scrollHeight + (innerBody.offsetHeight - innerBody.clientHeight); 
	iframeObj.style.height = innerHeight; 
}
/*	 ¾ÆÀÌÇÁ·¹ÀÓ »çÀÌÁîÁ¶Á¤	*/

function focusChange(current, next, maxSize)
{
 if(current.value.length >= parseInt(maxSize)) {
  next.focus()
 }
}


//***************************************************************************//
//************************	¸ÞÀÎ Áß°£ ½Å»óÇ° ·Ñ¸µ½ºÅ©¸³Æ®************************//
//***************************************************************************//

function fnGoodsMove_Type1() {
	this.GoodsSetTime = null;
	this.BannerCurrent = 0;

	this.GoodsSetting = function() {
		this.ObjBox = document.getElementById(this.DivName);
		this.PrevBtnLink = document.getElementById(this.PrevBtn);
		this.NextBtnLink = document.getElementById(this.NextBtn);
		this.ObjUl = this.ObjBox.getElementsByTagName("ul")[0];
		this.ObjLi = this.ObjUl.getElementsByTagName("li");
		this.ObjLiNum = this.ObjLi.length;
		this.TotalWidth = this.DateWidth * this.ObjLiNum;

		this.ObjBox.style.width = this.TotalWidth + "px";

		if ( this.ObjLiNum % this.DateNum == 0 ) {
			this.BannerEnd = this.TotalWidth - ( this.DateWidth * this.DateNum );
		} else {
			this.BannerEnd = this.TotalWidth - this.DateWidth;
		}

		this.BannerPrevLeft = this.BannerEnd;
		this.BannerNextLeft = this.DateWidth * this.DateNum ;

		this.PrevBtnLink.href = "javascript:" + this.fnName +"._moveFrame(" + this.BannerPrevLeft + ",'prev')";
		this.NextBtnLink.href = "javascript:" + this.fnName +"._moveFrame(" + this.BannerNextLeft + ",'next')";

		this.GoodsSetTime = setTimeout( this.fnName + "._moveFrame('" + this.BannerNextLeft + "','next')" , 3000 );
	}

	this._moveFrame = function(val,fnmove) {
		clearTimeout(this.GoodsSetTime)

		if ( Math.abs(val - this.BannerCurrent) > 6 ) {
			this.BannerCurrent = this.BannerCurrent + ( val - this.BannerCurrent ) * this.Speed;
		} else {
			this.BannerCurrent = val;
		}

		this.ObjUl.style.left = ( -1 * this.BannerCurrent ) + "px";

		if ( this.BannerCurrent != val ) {
			this.GoodsSetTime = setTimeout(this.fnName + "._moveFrame(" + val + ",'" + fnmove + "')",10);
		} else {
			this.CurrentPicNum = this.BannerCurrent / this.DateWidth;

			this.BannerPrevLeft = this.BannerCurrent - ( this.DateWidth * this.DateNum );
			this.BannerNextLeft = this.BannerCurrent + ( this.DateWidth * this.DateNum );

			if ( this.BannerCurrent == 0 ) {
				this.BannerPrevLeft = this.BannerEnd;
			} else if ( this.BannerCurrent == this.BannerEnd ) {
				this.BannerNextLeft = 0;
			}
			this.PrevBtnLink.href = "javascript:" + this.fnName +"._moveFrame(" + this.BannerPrevLeft + ",'prev')";
			this.NextBtnLink.href = "javascript:" + this.fnName +"._moveFrame(" + this.BannerNextLeft + ",'next')";
		}

		this.GoodsSetTime = setTimeout( this.fnName + "._moveFrame('" + this.BannerNextLeft + "','next')" , 3000 );
	}
}


//***************************************************************************//
//************************	¸ÞÀÎ Áß°£ º£½ºÆ®»óÇ° ·Ñ¸µ (09/1/20)******************//
//***************************************************************************//

function fnMenuRolOver_Type1() {
	this.oTrue = null;
	this.MenuImg = new Array();
	this.MenuImg["on"] = new Array();
	this.MenuImg["off"] = new Array();

	this.GoodsSetting = function() {
		this.MenuBox = document.getElementById(this.MenuName);
		this.MenuLi = this.MenuBox.getElementsByTagName("ul")[0].getElementsByTagName("li");
		this.MenuTotal = this.MenuLi.length;
		this.CurrentGoodBox = 0;
		
		for (var i=0 ; i<this.MenuTotal; i++) {
			this.MenuImg["off"][i] = document.createElement("IMG");
			this.MenuImg["off"][i].src = this.MenuLi.item(i).getElementsByTagName("a")[0].getElementsByTagName("img")[0].src;
			this.MenuImg["on"][i] = document.createElement("IMG");
			this.MenuImg["on"][i].src = this.MenuLi.item(i).getElementsByTagName("a")[0].getElementsByTagName("img")[0].src.replace("_off.", "_on.");
		}
		
		if ( this.RandomNum == 1 ) {
			this.RandomNumber = Math.floor(Math.random()*this.MenuTotal);
			
			if ( this.RandomNumber == this.MenuTotal ) {
				this.RandomNumber = this.RandomNumber - 1;
			}
			this.CurrentGoodBox = this.RandomNumber;
		}
		
		
		for ( var i=0; i<this.MenuTotal; i++) {
			this.MenuLink = this.MenuLi.item(i).getElementsByTagName("a")[0];
			this.MenuLinkBtn = this.MenuLink.getElementsByTagName("img")[0];

			if ( i == this.CurrentGoodBox ) {
				document.getElementById(this.DivName + i).style.display = "block";
				this.MenuLinkBtn.src = this.MenuImg["on"][i].src
			} else {
				document.getElementById(this.DivName + i).style.display = "none";
				this.MenuLinkBtn.src = this.MenuImg["off"][i].src
			}
			
			this.MenuLink.BtnNum = i;
			this.MenuLink.BtnBox = this.fnName;
			//this.MenuLink.onclick = function() {
			this.MenuLink.onmouseover = function() {
				eval( this.BtnBox +".fnMouseOver("+this.BtnNum+")");
			}
		}
		
		if ( this.AutoNum == 1 ) {
			if ( this.CurrentGoodBox == this.MenuTotal - 1 ) {
				this.NextNum = 0;
			} else {
				this.NextNum = this.CurrentGoodBox + 1;
			}
			this.oTrue = setTimeout( this.fnName + ".fnMouseOver('" + this.NextNum + "')" , this.ScrollTime );
		}
	}
	
	this.fnMouseOver = function(val) {
		val = parseInt(val);
		if ( this.AutoNum == 1 )  { clearTimeout(this.oTrue) }
		
		for ( var i=0; i<this.MenuTotal; i++) {
			this.MenuLink = this.MenuLi.item(i).getElementsByTagName("a")[0];
			this.MenuLinkBtn = this.MenuLink.getElementsByTagName("img")[0];
			
			if ( i == val ) {
				document.getElementById(this.DivName + i).style.display = "block";
				this.MenuLinkBtn.src = this.MenuImg["on"][i].src
			} else {
				document.getElementById(this.DivName + i).style.display = "none";
				this.MenuLinkBtn.src = this.MenuImg["off"][i].src
			}
		}
		if ( this.AutoNum == 1 ) {
			if ( val == this.MenuTotal - 1 ) {
				this.NextNum = 0;
			} else {
				this.NextNum = val + 1;
			}
			this.oTrue = setTimeout( this.fnName + ".fnMouseOver('" + this.NextNum + "')" , this.ScrollTime );
		}
	}
}
