//ÆË¾÷°ü·Ã
function goPopUp(url,width,height,yn){
	window.open(url, "winZip", "left=0,top=0,width="+width+",height="+height+", resizable=no, scrollbars="+yn);
}

//ÆË¾÷°ü·Ã
function goPopUpName(url,name, width,height,yn){
	window.open(url, name, "left=0,top=0,width="+width+",height="+height+", resizable=no, scrollbars="+yn);
}

//ÆË¾÷°ü·Ã
function goPopUpNamePosition(url,name, left, top, width, height,yn){
	window.open(url, name, "left="+left+",top="+top+",width="+width+",height="+height+", resizable=no, scrollbars="+yn);
}

/**************************************************************
 * DESCRIPTION  : ÆË¾÷À» ¶ç¿î´Ù.(°í°´ÀÇ Ã¢Å©±âÀÇ °¡¿îµ¥ Á¤·Ä)
 * ÇÔ¼ö¸í       : openPopMiddle(¹®ÀÚ¿­, ÃÖ¼Ò°ª, ÃÖ´ë°ª)
 * Return Value : ÆË¾÷ °´Ã¼
 **************************************************************/
function openPopMiddle(url, name, pWidth, pHeight, yn) {
	var left = parseInt((screen.availWidth - pWidth)/2); 
	var top = parseInt((screen.availHeight - pHeight)/2);
	var popEl = window.open(url, name, "width="+pWidth+",height="+pHeight+",top="+top+",left="+left+",scrollbars="+yn);
}

/**************************************************************
 * DESCRIPTION  : ¸ðµç ¿É¼ÇÀ¸·Î ÆË¾÷ ¿ÀÇÂ
 * ÇÔ¼ö¸í       : fullOpen(È£½ºÆ® url)
 * Return Value : ÆË¾÷°´Ã¼
 **************************************************************/
function fullOpen(urlStr){
	var width = screen.availWidth;
	var height = screen.availHeight;
	var openObj =  window.open(urlStr,'_blank','scrollbars=yes, toolbar=yes, menubar=yes, resizable=yes, status=yes, titlebar=yes, location=yes, top=0, left=0, width='+width+', height='+height);
}

/**
 * ÇÃ·¡½¬¸¦ »ðÀÔÇÑ´Ù.
 * @param {Object} url - °æ·Î
 * @param {Object} id  - ¾ÆÀÌµð
 * @param {Object} width
 * @param {Object} height
 * @param {Object} styleValue - div ¼Ó¼º°ª
 * IE - paramÀ»ÅëÇØ¼­ °ªÀ» ³Ñ°ÜÁØ´Ù.
 * FF - embedÀ» ÅëÇØ¼­ °ªÀ» ³Ñ°ÜÁØ´Ù. 
 */
function flashLoadSetValue(url, id, width, height, styleValue){
document.write(
  '<div id="'+id+'" style="height:'+height+'px;width:'+width+'px;'+styleValue+'">'
+ '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+width+'" height="'+height+'">'
+ '<param name="movie" value="'+url+'">'
+ '<param name="quality" value="high">'
+ '<param name="wmode" value="transparent">'
+ '<embed src="'+url+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'" wmode="transparent" ></embed>'
+ '</object>'
+ '</div>'
);
}

function _loadWMP(media_url,width_val,height_val,id)
{
	str = "<object id="+id+" width="+width_val+" height="+height_val+" viewastext style=\"z-index:1\" classid=\"CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95\" codebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701\" standby=\"Loading Microsoft Windows Media Player components...\" type=\"application/x-oleobject\">"
        + "<param name=\"filename\" value=\""+media_url+"\" />"
        + "<param name=\"animationatstart\" value=\"1\" />"
        + "<param name=\"autostart\" value=\"1\" />"
        + "<param name=\"balance\" value=\"0\" />"
        + "<param name=\"currentmarker\" value=\"0\" />"
        + "<param name=\"currentposition\" value=\"0\" />"
        + "<param name=\"displaymode\" value=\"4\" />"
        + "<param name=\"enablecontextmenu\" value=\"0\" />"
        + "<param name=\"enabled\" value=\"1\" />"
        + "<param name=\"fullscreen\" value=\"0\" />"
        + "<param name=\"invokeurls\" value=\"1\" />"
        + "<param name=\"playcount\" value=\"1\" />"
        + "<param name=\"rate\" value=\"1\" />"
        + "<param name=\"showcontrols\" value=\"1\" />"
        + "<param name=\"showstatusbar\" value=\"-1\" />"
        + "<param name=\"stretchtofit\" value=\"1\" />"
        + "<param name=\"transparentatstart\" value=\"1\" />"
        + "<param name=\"uimode\" value=\"FULL\" />"
        + "<param name=\"displaybackcolor\" value=\"0\" />"
		+ "<embed id="+id+" animationatstart='0' autostart='1' displaybackcolor='black' showcontrols='1' showstatusbar='1' showtracker='1' showpositioncontrols='0' pluginspage='http://www.microsoft.com/korea/windows/windowsmedia/'src='"+media_url+"' type='video/x-ms-asf-plugin' height='"+height_val+"' width='"+width_val+"'></embed>"
		+ "</object>"

	document.write(str);
}

function _loadWMP2(media_url,width_val,height_val,id)
{
	str = "<object id="+id+" width="+width_val+" height="+height_val+" viewastext style=\"z-index:1\" classid=\"CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95\" codebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701\" standby=\"Loading Microsoft Windows Media Player components...\" type=\"application/x-oleobject\" loop=true>"
        + "<param name=\"filename\" value=\""+media_url+"\" />"
        + "<param name=\"animationatstart\" value=\"1\" />"
        + "<param name=\"autostart\" value=\"1\" />"
        + "<param name=\"balance\" value=\"0\" />"
        + "<param name=\"currentmarker\" value=\"0\" />"
        + "<param name=\"currentposition\" value=\"0\" />"
        + "<param name=\"displaymode\" value=\"4\" />"
        + "<param name=\"enablecontextmenu\" value=\"0\" />"
        + "<param name=\"enabled\" value=\"1\" />"
        + "<param name=\"fullscreen\" value=\"0\" />"
        + "<param name=\"invokeurls\" value=\"1\" />"
        + "<param name=\"playcount\" value=\"1\" />"
        + "<param name=\"rate\" value=\"1\" />"
        + "<param name=\"showcontrols\" value=\"0\" />"
        + "<param name=\"showstatusbar\" value=\"0\" />"
        + "<param name=\"stretchtofit\" value=\"1\" />"
        + "<param name=\"transparentatstart\" value=\"1\" />"
        + "<param name=\"uimode\" value=\"FULL\" />"
        + "<param name=\"displaybackcolor\" value=\"0\" />"
		+ "<param name='loop' value='true'>"
		+ "<embed id="+id+" animationatstart='0' autostart='1' displaybackcolor='black' showcontrols='1' showstatusbar='1' showtracker='1' showpositioncontrols='0' pluginspage='http://www.microsoft.com/korea/windows/windowsmedia/'src='"+media_url+"' type='video/x-ms-asf-plugin' height='"+height_val+"' width='"+width_val+"' loop=true></embed>"
		+ "</object>"

	document.write(str);
}


function _loadWMP3(media_url,width_val,height_val, id)
{
	str = "<object id="+id+" width="+width_val+" height="+height_val+" viewastext style=\"z-index:1\" classid=\"CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95\" codebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701\" standby=\"Loading Microsoft Windows Media Player components...\" type=\"application/x-oleobject\" loop=true>"
        + "<param name=\"filename\" value=\""+media_url+"\" />"
        + "<param name=\"animationatstart\" value=\"1\" />"
        + "<param name=\"autostart\" value=\"1\" />"
        + "<param name=\"balance\" value=\"0\" />"
        + "<param name=\"currentmarker\" value=\"0\" />"
        + "<param name=\"currentposition\" value=\"0\" />"
        + "<param name=\"displaymode\" value=\"4\" />"
        + "<param name=\"enablecontextmenu\" value=\"0\" />"
        + "<param name=\"enabled\" value=\"1\" />"
        + "<param name=\"fullscreen\" value=\"0\" />"
        + "<param name=\"invokeurls\" value=\"1\" />"
        + "<param name=\"playcount\" value=\"1\" />"
        + "<param name=\"rate\" value=\"1\" />"
        + "<param name=\"showcontrols\" value=\"0\" />"
        + "<param name=\"showstatusbar\" value=\"0\" />"
        + "<param name=\"stretchtofit\" value=\"1\" />"
        + "<param name=\"transparentatstart\" value=\"1\" />"
        + "<param name=\"uimode\" value=\"FULL\" />"
        + "<param name=\"displaybackcolor\" value=\"0\" />"
		+ "<param name='loop' value='true'>"
		+ "<embed id="+id+" animationatstart='0' autostart='1' displaybackcolor='black' showcontrols='1' showstatusbar='1' showtracker='1' showpositioncontrols='0' pluginspage='http://www.microsoft.com/korea/windows/windowsmedia/'src='"+media_url+"' type='video/x-ms-asf-plugin' height='"+height_val+"' width='"+width_val+"' loop=true></embed>"
		+ "</object>"

	return str;
}

function MediaPlayer(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' style='filter:alpha(Opacity:30)'"); 
	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("	<param name='showtracker' value='0'> ");
	document.write("	<param name='mute' value='0'> ");
	document.write("	<embed enablecontextmenu='0' type='application/x-mplayer2' pluginspage='http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/' "); 
	document.write("		id='"+id+"' name='"+name+"' showpositioncontrols='0' showcontrols='1' autosize='0' autostart='1' showdisplay='0' ");
	document.write("		showstatusbar='0' showtracker='0' loop='1' width='"+width+"'  height='"+height+"' src='"+url+"' enablecontextmenu=0 > ");
	document.write("	</embed> "); 
	document.write("</object> ");
}



function play(){
	if ((navigator.userAgent.indexOf('IE') > -1) && (navigator.platform == "Win32")) {
		Player.Play();
	} else {
		document.Player.Play();
	}
}

function stop(){
	if ((navigator.userAgent.indexOf('IE') > -1) && (navigator.platform == "Win32")) {
		Player.Stop();
		Player.CurrentPosition=0;
	} else {
		document.Player.Stop();
		document.Player.CurrentPosition=0;
	}
}

function layerPopUp(divName, frameURL, divWidth, divHeight, divTop, divLeft){
	if(document.getElementById(divName) != null)
		document.body.removeChild(document.getElementById(divName));
	if(divLeft == null)
		divLeft = 222;
	if(divTop == null)
		divTop = 210;		
	var layer = document.createElement("DIV");
	layer.style.cssText = "position:absolute;z-index:100;top:"+divTop+"px;left:"+divLeft+"px;width:"+divWidth+";height:"+divHeight;
	
	var iframe = document.createElement("iframe");
	iframe.src = frameURL;
	iframe.width = divWidth;
	iframe.height = divHeight;
	iframe.frameborder = 0;
	iframe.marginWidth = 0;
	iframe.marginHeight = 0;
	
	layer.appendChild(iframe);
	layer.id = divName;
	
	document.body.appendChild(layer);	
}



//ÇÃ·¡½ÃÆÄÀÏ »ðÀÔÇÏ±â
function flash(c,d,e) {
 var flash_tag = "";
 flash_tag = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ';
 flash_tag +='codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" ';
 flash_tag +='WIDTH="'+c+'" HEIGHT="'+d+'" >';
 flash_tag +='<param name="wmode" value="transparent">'; 
 //ÀÌºÎºÐÀº ÇÃ·¡½¬ ¹è°æÀ» Åõ¸íÀ¸·Î ¼³Á¤ÇÏ´Â ºÎºÐÀ¸·Î ÇÊ¿ä¾ø´Ù¸é »èÁ¦ÇØµµ ¹«¹æÇÔ
 flash_tag +='<param name="movie" value="'+e+'">';
 flash_tag +='<param name="quality" value="high" />';
 flash_tag +='<param name="flashVars" value="xmlPath=/templates/img/link.xml" />';
 flash_tag +='<param name="allowScriptAccess" value="sameDomain" />';
 flash_tag +='<param name="wmode" value="transparent" />';
 flash_tag +='<embed src="'+e+'" quality="high" align="middle" allowScriptAccess="sameDomain" pluginspage="http://www.macromedia.com/go/getflashplayer" ';
 flash_tag +='type="application/x-shockwave-flash"  WIDTH="'+c+'" HEIGHT="'+d+'" wmode="transparent"></embed></object>'
 document.write(flash_tag);
}

// ¸ÞÀÎ ÇÃ·¡½ÃÆÄÀÏ »ðÀÔÇÏ±â
function flashMain(d,e) {
 var flash_tag = "";
 flash_tag = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ';
 flash_tag +='codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" ';
 flash_tag +='WIDTH="100%" HEIGHT="'+d+'" >';
 flash_tag +='<param name="wmode" value="transparent">'; 
 //ÀÌºÎºÐÀº ÇÃ·¡½¬ ¹è°æÀ» Åõ¸íÀ¸·Î ¼³Á¤ÇÏ´Â ºÎºÐÀ¸·Î ÇÊ¿ä¾ø´Ù¸é »èÁ¦ÇØµµ ¹«¹æÇÔ
 flash_tag +='<param name="movie" value="'+e+'">';
 flash_tag +='<param name="quality" value="high" />';
 flash_tag +='<param name="flashVars" value="xmlPath=/templates/img/link.xml" />';
 flash_tag +='<param name="allowScriptAccess" value="sameDomain" />';
 flash_tag +='<param name="wmode" value="transparent" />';
 flash_tag +='<embed src="'+e+'" quality="high" align="middle" allowScriptAccess="sameDomain" pluginspage="http://www.macromedia.com/go/getflashplayer" ';
 flash_tag +='type="application/x-shockwave-flash"  WIDTH="100%" HEIGHT="'+d+'" wmode="transparent"></embed></object>'
 document.write(flash_tag);
}

function closeLayer(divName){		
	if(document.getElementById(divName) != null){
		var layerDiv = document.getElementById(divName);
		document.body.removeChild(document.getElementById(divName));
	}		
}

function closeLayerMedia(){	
	var layerDiv = document.getElementById("mediaTd");
	var media = document.getElementById("media");
	try {
		layerDiv.removeNode(media);
		layerDiv.removeChild(media);
	} catch (e) {
		
	}
	parent.closeLayer("layerPopUp");
}


/**
 * text box¿¡¼­ ¼ýÀÚ °ª¸¸ Çã¿ë ÇÑ´Ù.
 **/
function onlyNumber(object){
	if(!isNumber(object.value)){
		object.value = object.value.substr(0, object.value.length - 1) ;	 
	}
}

/**********************************
 * ÀÔ·Â°ªÀÌ ¼ýÀÚÀÎÁö¸¦ È®ÀÎÇÑ´Ù
 * param : sVal ÀÔ·Â½ºÆ®¸µ
 * return : Boolean TrueÀÌ¸é ¼ýÀÚ°ª
 **********************************/
function isNumber(checkStr) {
	var checkOK = "0123456789";
	for (i = 0;  i < checkStr.length;  i++) {
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++) {
			if (ch == checkOK.charAt(j)) {
				break;
			}
		}

		if (j == checkOK.length) {
			return (false);
			break;
		}
	}
	if(checkStr == null || checkStr.length == 0) {
		return (false);
	}
	return (true);
}

/************************************************************
 * ÇöÀç ÄÁÆ®·Ñ°ú MaxLength ¹Þ¾Æ¼­ MaxLength µÇ¸é ´ÙÀ½ ÄÁÆ®·Ñ·Î ÀÌµ¿
 *
 * param : objCurrent, objNext
 *
 * return :
 ************************************************************/
function focusMove(objCurrent, objNext) {
	if ( objCurrent.getAttribute("Maxlength") == objCurrent.value.length) {
		objNext.focus();
	} 
}


function setCookie( name, value, expiredays ){
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}

function getCookie( name ){
	var nameOfCookie = name + "=";
	var x = 0;
	while ( x <= document.cookie.length ) {
		var y = (x+nameOfCookie.length);
		if ( document.cookie.substring( x, y ) == nameOfCookie ) {
			if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 ) endOfCookie = document.cookie.length;
			return unescape( document.cookie.substring( y, endOfCookie ) );
		}
		x = document.cookie.indexOf( " ", x ) + 1;
		if ( x == 0 ) break;
	}
	return "";
}


