var NS4;
var IE4;

if (document.all)
{
    IE4 = true;
    NS4 = false;
}
else
{
    IE4 = false;
    NS4 = true;
}
isWin = (navigator.appVersion.indexOf("Win") != -1)

/****************************************************************************
	F_viewSwf - ´Ü¼ø FlashÀÏ °æ¿ì
*****************************************************************************	
	- width		: °¡·ÎÅ©±â
	- height	: ¼¼·ÎÅ©±â
	- wmode	: Åõ¸í, Àý´ëÀ§Ä¡µî ·¹ÀÌ¾îÀÇ ±â´É 
	- url			: ÇÃ·¡½¬ ÆÄÀÏÀÇ °æ·Î
*****************************************************************************/

function F_viewSwf(width, height, wmode, url){
	document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' ");
	document.write("		codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' ");
	document.write("		width='"+width+"' height='"+height+"' align='middle'>");
	document.write("	<param name='allowScriptAccess' value='always' /> ");
	document.write("	<param name='movie'				value='"+url+"' /> ");
	document.write("	<param name='quality'			value='high' /> ");
	document.write("	<param name='wmode'				value='"+wmode+"'> ");
	document.write("	<embed src='"+url+"' quality='high' width='"+width+"' height='"+height+"' align='middle' ");
	document.write("		allowScriptAccess='sameDomain' type='application/x-shockwave-flash' ");
	document.write("		pluginspage='http://www.macromedia.com/go/getflashplayer' />");
	document.write("</object>");
}


/***********************************************************************************************************
	F_viewMediaPlayer - Microsoft Windows Media Player Àç»ý
************************************************************************************************************
	¿¹) F_viewMediaPlayer('NSPlay','NSPlay','322','286','true','true','true','false','false','false','false','ÆÄÀÏ¸í');
************************************************************************************************************/
function F_viewMediaPlayer(id, name, width, height, showcontrols, autostart, autorewind, autosize, autoresize, transparentatstart, loop, url) {
	document.write("<object id='"+id+"' codeBase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701' "); 
	document.write("		type='application/x-oleobject' standby='Loading Microsoft Windows Media Player components...' "); 
	document.write("		width='"+width+"' height='"+height+"' classid='clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95' name='"+name+"'> ");
	document.write("	<param name='ShowControls' value='"+showcontrols+"'> ");
	document.write("	<param name='AutoStart' value='"+autostart+"'> ");
	document.write("	<param name='AutoRewind' value='"+autorewind+"'> ");
	document.write("	<param name='Autosize' value='"+autosize+"'> ");
	document.write("	<param name='AutoResize' value='"+autoresize+"'> ");
	document.write("	<param name='TransparentAtStart' value='"+transparentatstart+"'> ");
	document.write("	<param name='loop' value='"+loop+"'> ");
	document.write("	<param name='Filename' value='"+url+"'> ");
	document.write("	<embed type='application/x-mplayer2' pluginspage='http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/' "); 
	document.write("		id='"+id+"' name='"+name+"' showpositioncontrols='0' showcontrols='0' autosize='0' autostart='1' showdisplay='0' ");
	document.write("		showstatusbar='0' showtracker='1' loop='1' width='"+width+"'  height='"+height+"' src='"+url+"'> ");
	document.write("	</embed> "); 
	document.write("</object> ");
}


/****************************************************************************
	bluring - ¸µÅ© Á¡¼± ¾ø¾Ö±â
****************************************************************************/

function bluring(){
	
	if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();
}
document.onfocusin=bluring;


/****************************************************************************
	img_over - ÀÌ¹ÌÁö ·Ñ¿À¹ö
****************************************************************************/

function img_over(img1,name,dir,over){

	if(over=='over')
	{
		img1.src=dir+name+'_on.gif';
	}
	else
	{
		img1.src=dir+name+'.gif';
	}
}


/****************************************************************************
	divView(btnId) - ÄÚ¸àÆ® »ó¼¼º¸±â
****************************************************************************/

function menuctl(no){
	for(i=1; i<=16; i++){
		ob = eval("document.getElementById('n"+i+"')");
		if(i==no){
			if(ob.style.display=="none") ob.style.display = "block";
			else ob.style.display = "none";
		}else{
			ob.style.display = "none";
		}
	}
}


/****************************************************************************
	xwzRollingImageTrans(imageName, thumbnailName, eventName, winName) - MAIN ¹è³Ê ÀÌ¹ÌÁö ·Ñ¸µ
****************************************************************************/

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;
		}
	}
}

var roll1 = new xwzRollingImageTrans("IMGS_ROLL_DETAIL1", "IMGS_ROLL_THUMBNAIL1","over");
roll1.nInterval = 3000;
roll1.addItem("http://www.naver.com", "images/main/banner_img_01.gif", "images/main/banner_nm_01.gif", "images/main/banner_nm_01_on.gif");
roll1.addItem("http://www.naver.com", "images/main/banner_img_01.gif", "images/main/banner_nm_02.gif", "images/main/banner_nm_02_on.gif");
roll1.addItem("http://www.naver.com", "images/main/banner_img_01.gif", "images/main/banner_nm_03.gif", "images/main/banner_nm_03_on.gif"); 
