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> ");
}


/****************************************************************************
	img_over - ÀÌ¹ÌÁö ·Ñ¿À¹ö
****************************************************************************/

function img_over(img1,name,dir,over){

	if(over=='over')
	{
		img1.src=dir+name+'_on.gif';
	}
	else
	{
		img1.src=dir+name+'.gif';
	}
}

function img_over2(img1,name,dir,over){

	if(over=='over')
	{
		img1.src=dir+name;
	}
	else
	{
		img1.src=dir+name;
	}
}


/****************************************************************************
	showSitemap - »çÀÌÆ®¸Ê _ Å¬¸¯½Ã ÇÏ´Ü ¸Þ´º Ç¥Ãâ
****************************************************************************/

function showSitemap() { 
    if(document.getElementById('Sitemap_Content').style.display=="inline") {
		document.getElementById('Sitemap_Content').style.display="none";

		return false;
    }
    if(document.getElementById('Sitemap_Content').style.display=="none") {
		document.getElementById('Sitemap_Content').style.display="inline";

		return false;
    }
}

/****************************************************************************
	flash - ¸ðµç ¼­ºêÆäÀÌÁö left_menu 
****************************************************************************/
// flash(ÆÄÀÏÁÖ¼Ò, °¡·Î, ¼¼·Î, ¹è°æ»ö, À©µµ¿ì¸ðµå, º¯¼ö, °æ·Î)
function flash(url,w,h,bg,win,vars,base){
	var s=
	"<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+"' align='middle'>"+
	"<param name='allowScriptAccess' value='always' />"+
	"<param name='movie' value='"+url+"' />"+
	"<param name='wmode' value='"+win+"' />"+
	"<param name='menu' value='false' />"+
	"<param name='quality' value='high' />"+
	"<param name='FlashVars' value='"+vars+"' />"+
	"<param name='bgcolor' value='"+bg+"' />"+
	"<param name='base' value='"+base+"' />"+
	"<embed src='"+url+"' base='"+base+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' align='middle' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
	"</object>";
	document.write(s);
}


/***********************
	µ¿¿µ»óÇÃ·¹ÀÌ¾î ¸®½ºÆ®º¸±â 
***************************/
function movie_list() {
		if(document.getElementById('list_view_movie').style.display=="") {
		document.getElementById('list_view_movie').style.display="none";
		document.getElementById('player_bottom_img').style.display="";
		}
    	else {
		document.getElementById('player_bottom_img').style.display="none";
		document.getElementById('list_view_movie').style.display="";
		}
	}


/****************************************************************************
	Popup - ÆË¾÷Ã¢ ¶ç¿ì±â
****************************************************************************/
function Popup(url, width, height, left, top, scrollbars){
	var pop_win;
 		pop_win = window.open(url, "custom", "width=" + width + ",height=" + height + ",left=" +left+",top="+top+",scrollbars=" + scrollbars);
	pop_win.focus();
}

/****************************************************************************
	È­Æó¸¦ ÅëÈ­Ç¥½Ã ÇØÁÖ´Â ÇÔ¼ö 
****************************************************************************/ 
	
function GetFormatMoney(value)
{ 
	var num  = String(value);
	
	re   = /^\$|,/g;
	num   = num.replace(re, "");
	fl   = "";
	
	if(num < 0)
	{
	num  = num*(-1);
	fl  = "-";
	}
	else
	{
	num  = num * 1;
	}

	num   = new String(num);
	
	var temp = "";
	var co  = 3;
	var num_len = num.length;
	
	while (num_len > 0)
	{
	num_len = num_len - co;
	
	if(num_len < 0)
	{
	 co = num_len + co;
	 num_len = 0;
	}
	
	temp = "," + num.substr(num_len,co) + temp;
	}

	return fl+temp.substr(1);
} 

/////////////////////////////////////////////////////////////////////////////////// rowspan »ý¼º ½ºÅ©¸³Æ®
//tableId :  table id¸¦ ³ÖÀÚ 
//rowIndex : tableÀÇ ½ÃÀÛ row index(0ºÎÅÍ ½ÃÀÛ)
//cellIndex : ÇØ´ç rowÀÇ cell index(0ºÎÅÍ ½ÃÀÛ)
// created by singi(20030611)
///////////////////////////////////////////////////////////////////////////////////
	function cellMergeChk(tableObj, rowIndex, cellIndex)
	{
		//alert("!");
		var rowsCn = tableObj.rows.length;
		
		if(rowsCn-1 > rowIndex)
			cellMergeProcess(tableObj, rowIndex, cellIndex);
	}
	
	function cellMergeProcess(tableObj, rowIndex, cellIndex)
	{
		var rowsCn = tableObj.rows.length;
		var compareCellsLen = tableObj.rows(rowIndex).cells.length;		//½ÃÀÛ row¿¡ cell °³¼ö
		
		//ÃÊ±âÈ­	
		var compareObj = tableObj.rows(rowIndex).cells(cellIndex);
		var compareValue = compareObj.innerHTML;
		var cn = 1;
		var delCells = new Array();
		var arrCellIndex = new Array();
		for(i=rowIndex+1; i < rowsCn; i++)
		{
			var cellsLen = tableObj.rows(i).cells.length;
			var bufCellIndex = cellIndex

			//½ÇÁúÀûÀÎ row¿¡ cellIndex¸¦ ±¸ÇÏÀÚ.			
			if(compareCellsLen != cellsLen) 
			{
				bufCellIndex = bufCellIndex - (compareCellsLen - cellsLen);
			}
			cellObj = tableObj.rows(i).cells(bufCellIndex);
			
			if(compareValue == cellObj.innerHTML)
			{
				delCells[cn-1] = tableObj.rows(i);		//»èÁ¦ÇÒ cellÀÇ row¸¦ ÀúÀåÇÑ´Ù.
				arrCellIndex[cn - 1] = bufCellIndex;	//ÇØ´ç row cell index¸¦ ÀúÀåÇÑ´Ù.
				cn++;
			}
			else
			{
				//º´ÇÕ
				compareObj.rowSpan = cn;
				
				//»èÁ¦
				for(j=0; j < delCells.length; j++)
				{
					delCells[j].deleteCell(arrCellIndex[j]);
				}
				
				//ÃÊ±âÈ­	
				compareObj = cellObj;
				compareValue = cellObj.innerHTML;
				cn = 1;
				delCells = new Array();
				arrCellIndex = new Array();
			}
		}

		//º´ÇÕ		
		compareObj.rowSpan = cn;
		//»èÁ¦
		for(j=0; j < delCells.length; j++)
		{
			delCells[j].deleteCell(arrCellIndex[j]);
		}
	}


/* µû¶ó´Ù´Ï´Â ·¹ÀÌ¾î */
function initMoving(target, topPosition, topLimit, btmLimit) {
if (!target)
return false;

var obj = target;
obj.initTop = topPosition;
obj.topLimit = topLimit;
obj.bottomLimit = document.documentElement.scrollHeight - btmLimit;

obj.style.position = "absolute";
obj.top = obj.initTop;
obj.left = obj.initLeft;
obj.style.top = obj.top + "px";

obj.getTop = function() {
if (document.documentElement.scrollTop) {
return document.documentElement.scrollTop;
} else if (window.pageYOffset) {
return window.pageYOffset;
} else {
return 0;
}
}

obj.move = setInterval(function() {
//pos = obj.getTop() + obj.getHeight() / 2 - 15;
pos = obj.getTop() + topPosition;

if (pos > obj.bottomLimit)
pos = obj.bottomLimit
if (pos < obj.topLimit)
pos = obj.topLimit

interval = obj.top - pos;
obj.top = obj.top - interval / 15;
obj.style.top = obj.top + "px";
}, 20)
}
/* end_µû¶ó´Ù´Ï´Â ·¹ÀÌ¾î */


