 /******************************************************************************
* 이미지 롤링 변환 효과
* Last update : 2006.
* Copyright (c) 2006, By Lee N.THU
* e-Mail : <support@x-wiz.com>
* 역시나 사람이 아닌 경우에는 이 소스를 사용할 수 없습니다. 사람이라면 누구나 쓸 수 있지만 제작자는 표기해주시기를 바랍니다.

<img src="" name=TargetImageName>

<img src="" name=ButtonImageName>
<img src="" name=ButtonImageName>

var roll = new xwzRollingImageTrans(TargetImageName,  ButtonImageName, [Event=['over']], [TagetWindowName]);

roll.addItem(Link, ImageSrc, DefaultIconSrc, ActiveIconSrc);
roll.addItem(Link, ImageSrc, DefaultIconSrc, ActiveIconSrc);
roll.nInterval = 3000;
roll.install();

****************************************************************************** */
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.winTarget == '' || xwzRoll.winTarget == null){
			window.location.href=xwzRoll.ListItem[xwzRoll.Index].Link;
		}else{
			window.open(xwzRoll.ListItem[xwzRoll.Index].Link, xwzRoll.winTarget);
		}
	}

	//==
	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;
		}
	}
}

 /******************************************************************************
* 실시간검색 순위
* Last update : 2006.
* Copyright (c) 2006, By Lee N.THU
* e-Mail : <support@x-wiz.com>
* 이소스 역시 사람이 아닌 경우에는 이 소스를 사용할 수 없습니다. 사람이라면 누구나 쓸 수 있지만 제작자는 표기해주시기를 바랍니다.
****************************************************************************** */
function verticalWheel(sById, sTableById ,height, nSec ){
	if(window.xwzWheelMarq == null) window.xwzWheelMarq = new Array(0);
	xwzWheelMarq[sById]  = {
		install : function(sById, sTableById,height, nSec){
			this.id = sById;
			this.div = document.getElementById(sById);
			this.table = document.getElementById(sTableById);
			if(this.div == null) return;
			this.div.style.height = height;
			this.div.style.overflow='hidden';
			this.div.style.position='relative';
			this.div.style.cursor='pointer';
			this.div.style.clip='rect(0 auto '+this.height+'px 0)';
			this.div.parentNode.style.position='relative'
			this.div.parentNode.onmouseover=function(){xwzWheelMarq[sById].table.style.visibility ='visible';	xwzWheelMarq[sById].nPause=true;}
			this.div.parentNode.onmouseout= function(){xwzWheelMarq[sById].table.style.visibility ='hidden';xwzWheelMarq[sById].nPause=false;}

			this.index =0;
			this.height = height;
			this.items = new Array(0);
			this.tmID = null;
			this.nPause = false;
			this.nSec = nSec;
			var rows =this.table.tBodies[0].rows;
			for(var i = 0; i < rows.length; i++){
				this.items[i] = document.createElement("DIV");
				this.items[i].innerHTML=rows[i].innerHTML;
				this.items[i].style.padding="3";
				this.items[i].style.width="100%";
				this.items[i].style.height=this.height ;
				this.items[i].style.position="absolute";
				this.items[i].style.top = this.height*i;
				this.div.appendChild(this.items[i]);

				rows[i].cells[0].style.cssText="padding-left:5px;border-bottom:#CACACA 1px dotted;";
				rows[i].onmouseover=function(){this.style.backgroundColor="#FDF1F0";}
				rows[i].onmouseout=function(){this.style.backgroundColor="";}
				if(i >= rows.length -1){rows[i].cells[0].style.border="";}
			}
		},
		doWheel : function(){
			var itmN = this.items[this.index];
			var nSleep= 50;
			var nIndex= this.index+1 >=  this.items.length ? 0 :  this.index+1;
			clearTimeout(this.tmID); this.tmID = null;
			if(this.nPause != true){
				for(var i = 0; i < this.items.length; i++){
					this.items[i].style.top = parseInt(this.items[i].style.top)-1;
				}
				if(parseInt(itmN.style.top) <= this.height*-1){
					itmN.style.top = this.height*(this.items.length-1);
					this.index = this.index+1 >=  this.items.length ? 0 :  this.index+1;
					nSleep= this.nSec;
				}
			}else{
				if(parseInt(itmN.style.top) < (this.height/2)*-1){
					itmN.style.top = this.height*(this.items.length-1);
					this.index = this.index+1 >=  this.items.length ? 0 :  this.index+1;
				}

				for(var i = 0; i < this.items.length; i++){
					this.items[i].style.top =  this.height * (  (this.items.length -  this.index + i ) % this.items.length );
				}
				nSleep = 10;
			}


			this.tmID = setTimeout("xwzWheelMarq['" + this.id + "'].doWheel()", nSleep);
		}
	}

	xwzWheelMarq[sById].install(sById, sTableById, height, nSec);
	xwzWheelMarq[sById].tmID = setTimeout("xwzWheelMarq['" +sById + "'].doWheel()", nSec);
}

/* ================================================
페이지 전체가 아래로 내려오는 슬라이딩 배너 스크립트
* Last update : 2006.
* Copyright (c) 2006, By Lee N.THU
* e-Mail : <support@x-wiz.com>
* 여전히 사람이 아닌 경우에는 이 소스를 사용할 수 없습니다. 사람이라면 누구나 쓸 수 있지만 제작자는 표기해주시기를 바랍니다.
================================================ */
var xwzClipEffect = function(sById, nIndex, nVisible, nHeight){
	if(window.xwzClipEffects == null) window.xwzClipEffects = new Array(0);
	window.xwzClipEffects[sById] = this;
	this.id = sById;
	this.tmClip = null;
	this.nClipDeiffHeight = nHeight || 10 ;

	this.objFrame = document.getElementById(sById);
	this.objNode = this.objFrame.getElementsByTagName('div');
	this.install(nIndex, nVisible);
}

xwzClipEffect.prototype.install = function(nIndex, nVisible){
	clearTimeout(this.tmClip);this.tmClip =null;

	if(this.objNode[nIndex].style.visibility=='hidden' || nVisible==true){
		this.objNode[0].style.marginTop = parseInt(this.objNode[0].offsetHeight) * -1;
		this.objNode[1].style.marginTop = parseInt(this.objNode[1].offsetHeight) * -1;
		this.objNode[nIndex].style.visibility = '';
		this.objFrame.style.position='relative';
		this.objFrame.style.overflow='visible';
		this.objFrame.style.marginBottom='4';
	}
	if(nVisible==true){
		this.objNode[nIndex].style.marginTop="0";
		this.objFrame.style.height=parseInt(this.objNode[nIndex].offsetHeight);
	}else{
		var nTop = parseInt(this.objNode[nIndex].style.marginTop);
		nTop += this.nClipDeiffHeight;
		if(nTop > 0){this.objNode[nIndex].style.marginTop="0";this.objFrame.style.height=parseInt(this.objNode[nIndex].offsetHeight);return;}
		this.objNode[nIndex].style.marginTop=nTop;this.objFrame.style.height=parseInt(this.objNode[nIndex].offsetHeight)+nTop;
		this.tmClip=setTimeout(new Function("window.xwzClipEffects['" + this.id + "'].install("+nIndex+")"), 10);
	}
}

xwzClipEffect.prototype.action=function(sAction){
	clearTimeout(this.tmClip);this.tmClip =null;

	var nHgt = parseInt(this.objNode[1].offsetHeight) * -1;
	var nTop = parseInt(this.objNode[0].style.marginTop);
	if(sAction =='up'){
		nTop -= this.nClipDeiffHeight;
		if(nTop < nHgt){
			//try{/*div.filters[0].motion='reverse';*/div.filters[0].apply();this.objNode[0].style.marginTop=parseInt(this.objNode[0].offsetHeight)* -1;this.objNode[1].style.visibility='visible';this.objNode[1].style.marginTop = 0;div.filters[0].play();}
			this.objNode[0].style.marginTop=parseInt(this.objNode[0].offsetHeight) * -1;
			this.objNode[1].style.marginTop = 0;
			this.objNode[1].style.visibility='visible';this.objNode[0].style.visibility='hidden';
			this.objFrame.style.height=parseInt(this.objNode[1].offsetHeight)
			return;
		}
	}else{
		if(nTop < nHgt){
			//try{/*this.objFrame.filters[0].motion='forward';*/this.objFrame.filters[0].apply();nTop = nHgt;this.objNode[1].style.visibility='hidden';this.objNode[1].style.marginTop = nHgt;this.objFrame.filters[0].play();}
			this.objNode[1].style.marginTop = nHgt;
			this.objNode[0].style.visibility='visible';this.objNode[1].style.visibility='hidden';
			nTop = nHgt;
		}
		nTop +=this.nClipDeiffHeight;
		if(nTop > 0){this.objNode[0].style.marginTop = 0;this.objFrame.style.height=parseInt(this.objNode[0].offsetHeight);return;}
	}
	this.objNode[0].style.marginTop = nTop;
	this.objFrame.style.height=parseInt(this.objNode[0].offsetHeight) + nTop ;
	this.tmClip=setTimeout(new Function("window.xwzClipEffects['" + this.id + "'].action('"+sAction+"')"), 10);
}
