//String Trim
function trim_string(urstr)
{ 
	// removes leading and trailing spaces, and returns the shortened string
	var i = 0;
	var j = 0;
	for (i=0; i<urstr.length; i++) 
	{
		if(urstr.charAt(i) != " ") 
		{
			for (j=urstr.length - 1; j > i; j--) 
			{
				if (urstr.charAt(j) != " ") 
				{
					break;
				}
			}
			break;
		}
	}
	if (i > j)
		i = j;
  
	if (urstr.length > 0 && urstr.charAt(j) != " ")
		j++;
	return urstr.substring(i, j);
}

function getNavigatorType() {
	if (navigator.appName == "Netscape") { 
		return "Netscape "+navigator.appVersion.charAt(0);
	} else if ( navigator.appName == "Microsoft Internet Explorer" ) {
		if (navigator.appVersion.charAt(0) == "4") {
			if(navigator.appVersion.indexOf("MSIE 5") != -1) { 
				return "ie 5";
			} else if(navigator.appVersion.indexOf("MSIE 6") != -1) {
				return "ie 6";
			} else if(navigator.appVersion.indexOf("MSIE 7") != -1) {
				return "ie 7";
			} else { 
				return "ie 4";
			} 
		} else if (navigator.appVersion.charAt(0) == "5") { 
			return "ie 5";
		} 
	} else {
		return "";
	}
}
/*******************************************************************

	·Ñ¿À¹ö ¸Þ´º ½ºÅ©¸³Æ®

*******************************************************************/
function MM_swapImgRestore() { //v3.0
	 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; 
		obj.zIndex =1;}

}

function MM_showHideLauncher() { //v6.0

	var i,p,v,obj,args=MM_showHideLauncher.arguments;
	var scroll_pixel = Math.max(document.documentElement.scrollTop, document.body.scrollTop); ;

	for (i=0; i<(args.length-2); i+=3) {

	  	if ((obj=MM_findObj(args[i]))!=null) { 
		  	v=args[i+2];
		    if (obj.style) {
		
		    	obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v;
		
		   	}
			obj.visibility=v; 
			obj.zIndex =1;
			obj.top = scroll_pixel+97;
		}
	}
}

function MM_DishowHideLayers() { //v6.0
  var i,p,v,obj,args=MM_DishowHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'block':(v=='hide')?'none':v; }
    obj.display=v; 
	obj.zIndex =1;}

}
/*******************************************************************
	ÇÃ·¡½Ã ·Îµå ½ºÅ©¸³Æ®
*******************************************************************/

function MakeFlash(Url,Width,Height){
  document.writeln("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\"" + Width + "\" height=\"" + Height + "\">");
  document.writeln("<param name=\"movie\" value=\"" + Url + "\">");
  document.writeln("<param name=\"quality\" value=\"high\">");
  document.writeln("<param name=\"wmode\" value=\"transparent\">");
  document.writeln("<param name=\"allowScriptAccess\" value=\"always\">");
  document.writeln("<embed src=\"" + Url + "\" quality=\"high\" wmode=\"transparent\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + Width + "\"  height=\"" + Height + "\">");
  document.writeln("</object>");
}

function MakeFlash2(Url,ObjWidth,ObjHeight){
	var ObjWidth;
	var ObjHeight;

	if (ObjWidth==''){
		ObjWidth = '100%';
	}

	if (ObjHeight==''){
		ObjHeight = '100%';
	}

	document.writeln("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\"" + ObjWidth + "\" height=\"" + ObjHeight + "\">");
	document.writeln("<param name=\"movie\" value=\"" + Url + "\">");
	document.writeln("<param name=\"quality\" value=\"high\">");
	document.writeln("<param name=\"wmode\" value=\"transparent\">");
	document.writeln("<param name=\"allowScriptAccess\" value=\"always\">");
	document.writeln("<embed src=\"" + Url + "\" quality=\"high\" wmode=\"transparent\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + ObjWidth + "\"  height=\"" + ObjHeight + "\">");
	document.writeln("</object>");
}

function Fn_VideoClipWrite(v_url, v_width, v_height, v_auto){

	var VideoStr="<object id='mediaplayer1' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715' classid='CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95' width='"+v_width+"' height='"+v_height+"' type=application/x-oleobject standby=Loading Microsoft?Windows?Media Player components...>\
		<param name='Filename' value='"+v_url+"'>\
		<param name='mute' value='0'>\
		<param name='AutoStart' value='"+v_auto+"'>\
		<param name='AutoSize' value='0'>\
		<param name='AutoResize' value='0'>\
		<param name='AnimationAtStart' value='1'>\
		<param name='TransparentAtStart' value='1'>\
		<param name='AutoRewind' value='1'>\
		<param name='ShowDisplay' value='0'>\
		<param name='ClickToPlay' value='1'>\
		<param name='EnableContextMenu' value='1'>\
		<param name='ShowPositionControls' value='1'>\
		<param name='ShowStatusBar' value='1'>\
		<param name='ShowControls' value='1'>\
		<param name='EnableTracker' value='1'>\
		<param name='Volume' value='1'>\
		<param name='wmode' value='transparent'>\
		</OBJECT>";

	document.write(VideoStr);
}

function Fn_VideoClipWrite2(v_url, v_width, v_height, v_auto){
	var VideoStr2="<object id='mediaplayer2' 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' width='"+v_width+"' height='"+v_height+"' >\
		<param name='Filename' value='"+v_url+"'>\
		<param name='AutoStart' value='"+v_auto+"'>\
		<param name='AnimationAtStart' value='1'>\
		<param name='TransparentAtStart' value='1'>\
		<param name='ClickToPlay' value='1'>\
		<param name='EnableContextMenu' value='1'>\
		<param name='ShowPositionControls' value='1'>\
		<param name='ShowStatusBar' value='1'>\
		<param name='ShowControls' value='1'>\
		<param name='EnableTracker' value='1'>\
		<param name='Volume' value='1'>\
		<param name='wmode' value='transparent'>\
		<embed src='"+v_url+"' wmode='transparent' autostart='"+v_auto+"' showcontrols='true' showstatusbar='1' width='"+v_width+"' height='"+v_height+"'>\
		</object>";
	document.write(VideoStr2);
}

/*******************************************************************
	Click ·Ñ¿À¹ö È¿°ú ½ºÅ©¸³Æ® 
*******************************************************************/
function click_roll(obj_name,total,sel,img,imgtype) {
	var obj_name;
	var obj;
	var objimg;
	var total;
	var sel;
	var img;
	var imgid;
	var imgtype;

    for(var i = 1; i <= total; i++) {
        obj = document.getElementById(obj_name+i);

        if ( sel == i ) {
	        imgid = obj_name+"img"+i;
	        objimg = document.getElementById(imgid);

          	objimg.src = img+i+'_1.'+imgtype;
            obj.style.display = "";

        } else {
	        imgid = obj_name+"img"+i;
	        objimg = document.getElementById(imgid);

          	objimg.src = img+i+'_2.'+imgtype;
            obj.style.display = "none";			
        }
    }
}

/********************************************************
	Div Display Á¦¾î ½ºÅ©¸³Æ®(¿ÀºêÁ§Æ®¸í,¼±ÅÃ°ª,ÃÑ°¹¼ö) 
*********************************************************/
function Fn_Div_Display(obj_name,sel,total,Yt,Dw) {
	var Screen_W;
	var obj_name;
	var obj;
	var total;
	var sel;

	for(var i = 1; i <= total; i++) {
		obj = document.getElementById(obj_name+i);

		if ( sel == i ) {
			if ( obj.style.display == "none" ) {
				obj.style.display = "";

			} else {
				obj.style.display = "none";
			}
		} else {
			obj.style.display = "none";
		}
	}
}

function frm_mc(mid) {
	var mid;
	if(mid.length > 0)
	{
		document.frm.M_ID.value = mid;
		document.frm.action="/matchcenter/fixturesresult.asp";
		document.frm.submit();
	}
}

function frm_cb(mid) {
	var mid;
	if(mid.length > 0)
	{
		document.frm.M_ID.value = mid;
		document.frm.action="/club/club.asp";
		document.frm.submit();
	}
}

function FnDownload(fcate,fidx) {
	var TargetFrm = document.frm_down;

	var fcate;
	var fidx;
	TargetFrm.fcate.value= fcate;
	TargetFrm.fidx.value= fidx;

	TargetFrm.action = "/include/file_download.asp";
	TargetFrm.target = "ifrm_down";
	TargetFrm.submit();

	return false;
	
}

/*ºê¶ó¿ìÀúº° iframe ³ô¿¡ Á¦¾î*/
function ifr_Height(f_height,obj){
	if (getNavigatorType() == "Netscape 5")	 
	{
		var height = document.getElementById(obj).contentWindow.document.body.scrollHeight;
		document.getElementById(obj).height = height;
	}
	else{ // ¸ðÁú¶ó ¾Æ´Ò¶§
		document.getElementById(obj).style.height=f_height; //iframe »çÀÌÁî Á¶Àý
	}
}

/*--------------------- PNG ÀÌ¹ÌÁö ÆÄÀÏ¿ë --------------------------*/
function setPng24(obj) { 
	obj.width=obj.height=1; 
	obj.className=obj.className.replace(/\bpng24\b/i,''); 
	obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');" 
	obj.src='';  
	return ''; 
}


/* ÄíÅ° ¼³Á¤ , @param cookieName ÄíÅ°¸í, @param cookieValue ÄíÅ°°ª,* @param expireType ÄíÅ° À¯È¿Å¸ÀÔ, * @param expireValue ÄíÅ° À¯È¿³¯Â¥ */
function setCookie( cookieName, cookieValue, expireType ,expireValue )
{
	var today = new Date();

	if(expireType=="h") {
		today.setHours(today.getHours() + parseInt( expireValue ));

	}
	else if(expireType=="m") {
		today.setMinutes(today.getMinutes() + parseInt( expireValue ));
	}
	else {
		today.setDate( today.getDate() + parseInt( expireValue ) );
	}

	document.cookie = cookieName + "=" + escape( cookieValue ) + "; path=/; expires=" + today.toGMTString() + ";";
}

/* ÄíÅ°°ª ÃßÃâ * @param cookieName ÄíÅ°¸í */
function getCookie(cookieName)
{
	var cookie = document.cookie;
	var cookie_val ="";

	// ÇöÀç ÄíÅ°°¡ Á¸ÀçÇÒ °æ¿ì
	if( cookie.length > 0 )
	{
		// ÇØ´ç ÄíÅ°¸íÀÌ Á¸ÀçÇÏ´ÂÁö °Ë»öÇÑ ÈÄ Á¸ÀçÇÏ¸é À§Ä¡¸¦ ¸®ÅÏ.
		startIndex = cookie.indexOf(cookieName);

		// ¸¸¾à Á¸ÀçÇÑ´Ù¸é
		if( startIndex != -1 )
		{
			// °ªÀ» ¾ò¾î³»±â À§ÇØ ½ÃÀÛ ÀÎµ¦½º Á¶Àý
			startIndex += cookieName.length;

			// °ªÀ» ¾ò¾î³»±â À§ÇØ Á¾·á ÀÎµ¦½º ÃßÃâ
			endIndex = cookie.indexOf( ";", startIndex );

			// ¸¸¾à Á¾·á ÀÎµ¦½º¸¦ ¸øÃ£°Ô µÇ¸é ÄíÅ° ÀüÃ¼±æÀÌ·Î ¼³Á¤
			if( endIndex == -1) endIndex = cookie.length;

			// ÄíÅ°°ªÀ» ÃßÃâÇÏ¿© ¸®ÅÏ
			cookie_val = unescape( cookie.substring( startIndex + 1, endIndex ) );

			return cookie_val;
		}
		else
		{
			// ÄíÅ° ³»¿¡ ÇØ´ç ÄíÅ°°¡ Á¸ÀçÇÏÁö ¾ÊÀ» °æ¿ì
			cookie_val = "None"
			return cookie_val;
		}
	}
	else
	{
		// ÄíÅ° ÀÚÃ¼°¡ ¾øÀ» °æ¿ì
		return false;
	}
}
/* ÄíÅ°°ª ÃßÃâ(¹è¿­) * @param cookieName ÄíÅ°¸í */
function getCookie2(cookieName)
{
	var cookie = document.cookie;
	var cookie_val ="";

	// ÇöÀç ÄíÅ°°¡ Á¸ÀçÇÒ °æ¿ì
	if( cookie.length > 0 )
	{
		// ÇØ´ç ÄíÅ°¸íÀÌ Á¸ÀçÇÏ´ÂÁö °Ë»öÇÑ ÈÄ Á¸ÀçÇÏ¸é À§Ä¡¸¦ ¸®ÅÏ.
		startIndex = cookie.indexOf(cookieName);

		// ¸¸¾à Á¸ÀçÇÑ´Ù¸é
		if( startIndex != -1 )
		{
			// °ªÀ» ¾ò¾î³»±â À§ÇØ ½ÃÀÛ ÀÎµ¦½º Á¶Àý
			startIndex += cookieName.length;

			// °ªÀ» ¾ò¾î³»±â À§ÇØ Á¾·á ÀÎµ¦½º ÃßÃâ
			endIndex = cookie.indexOf( ";", startIndex );

			// ¸¸¾à Á¾·á ÀÎµ¦½º¸¦ ¸øÃ£°Ô µÇ¸é ÄíÅ° ÀüÃ¼±æÀÌ·Î ¼³Á¤
			if( endIndex == -1) endIndex = cookie.length;

			// ¸¸¾à Á¾·á ÀÎµ¦½º°¡ "&" ÀÏ °æ¿ì
			endIndex = cookie.indexOf( "&", startIndex );
			if( endIndex == -1) endIndex = cookie.length;

			// ÄíÅ°°ªÀ» ÃßÃâÇÏ¿© ¸®ÅÏ
			cookie_val = unescape( cookie.substring( startIndex + 1, endIndex ) );

			return cookie_val;
		}
		else
		{
			// ÄíÅ° ³»¿¡ ÇØ´ç ÄíÅ°°¡ Á¸ÀçÇÏÁö ¾ÊÀ» °æ¿ì
			cookie_val = "None"
			return cookie_val;
		}
	}
	else
	{
		// ÄíÅ° ÀÚÃ¼°¡ ¾øÀ» °æ¿ì
		return false;
	}
}


/* ÄíÅ° »èÁ¦, @param cookieName »èÁ¦ÇÒ ÄíÅ°¸í */
function deleteCookie( cookieName )
{
	var expireDate = new Date();
	//¾îÁ¦ ³¯Â¥¸¦ ÄíÅ° ¼Ò¸ê ³¯Â¥·Î ¼³Á¤ÇÑ´Ù.
	expireDate.setDate( expireDate.getDate() - 1 );
	document.cookie = cookieName + "= " + "; expires=" + expireDate.toGMTString() + "; path=/";
}


//Textarea Box Message Length Check Start
function length_check(length_limit)
{
	var length = calculate_msglen(document.tailment_form.T_TEXT.value);
//	nbyte.innerText = length;
	if (length > length_limit) {
		alert("ÃÖ´ë " + length_limit + "byteÀÌ¹Ç·Î ÃÊ°úµÈ ±ÛÀÚ¼ö´Â ÀÚµ¿À¸·Î »èÁ¦µË´Ï´Ù.");
		document.tailment_form.T_TEXT.value = document.tailment_form.T_TEXT.value.replace(/\r\n$/, "");
		document.tailment_form.T_TEXT.value = assert_msglen(document.tailment_form.T_TEXT.value, length_limit);
	}
}

function calculate_msglen(message)
{
	var nbytes = 0;

	for (i=0; i<message.length; i++) {
		var ch = message.charAt(i);
		if(escape(ch).length > 4) {
			 nbytes += 2;
		} else if (ch == '\n') {
			 if (message.charAt(i-1) != '\r') {
					 nbytes += 1;
			 }
		} else if (ch == '<' || ch == '>') {
			 nbytes += 4;
		} else {
			 nbytes += 1;
		}
	}

	return nbytes;
}

function assert_msglen(message, maximum)
{
	var inc = 0;
	var nbytes = 0;
	var msg = "";
	var msglen = message.length;

	for (i=0; i<msglen; i++) {
		var ch = message.charAt(i);
		if (escape(ch).length > 4) {
			 inc = 2;
		} else if (ch == '\n') {
			 if (message.charAt(i-1) != '\r') {
					 inc = 1;
			 }
		} else if (ch == '<' || ch == '>') {
			 inc = 4;
		} else {
			 inc = 1;
		}
		if ((nbytes + inc) > maximum) {
			 break;
		}
		nbytes += inc;
		msg += ch;
	}
/*	nbyte.innerText = nbytes; */
	return msg;
}
/*Textarem Box Message Length Check End*/

/*Ajax Function Start */
var XmlLoad={};
XmlLoad.hxr={};
XmlLoad.hxr.Request=function(Xurl,Parms,callback,method,divId,afterAction) {
        this.Xurl=Xurl;
        this.Parms=Parms;
        this.callback=callback;
        this.method=method;
        this.divId=divId;
        this.afterAction=afterAction;
        this.send();
}
XmlLoad.hxr.Request.prototype={
        getXMLHttpRequest: function() {
                if(window.ActiveXObject) {
                        try{
                                return new ActiveXObject("Msxml2.XMLHTTP");
                        } catch(e) {
                                try {
                                        return new ActiveXObject("Microsoft.XMLHTTP");
                                } catch(e1) { return null; }
                        }
                } else if(window.XMLHttpRequest) {
                        return new XMLHttpRequest();
                } else {
                        return null;
                }
        },
        send: function() {
                this.req=this.getXMLHttpRequest();
                var httpMethod=this.method ? this.method : 'GET';
                if(httpMethod!='GET' && httpMethod!='POST') {
                        httpMethod='GET';
                }
                var httpParams=(this.Parms==null || this.Parms=='') ? null : this.Parms;
                var httpUrl = this.Xurl;
                if(httpMethod=='GET' && httpParams!=null) {
                        httpUrl=httpUrl+"?"+httpParams;
                }
                this.req.open(httpMethod,httpUrl,true);
                this.req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
                var request=this;
                this.req.onreadystatechange=function() {
                        request.onStateChange.call(request);
                }
                this.req.send(httpMethod=='POST' ? httpParams:null);
        },
        onStateChange: function() {
                this.callback(this.req,this.Parms,this.divId,this.afterAction);
        }
}

function LoadInnerHtml(req,Parms,divId,afterAction) {
	if(req.readyState == 4) {
		if(req.status == 200) {
			var divObj = document.getElementById(divId);
			if(divObj) {
				divObj.innerHTML = req.responseText;
				var contents = req.responseText;
				var re = /<\s*script.+?<\/\s*script\s*>/gim;
				contents = contents.replace( /\n/g, "<-newline->" );
				var dataArr = contents.match( re );
				if( dataArr != null ) {
					for( var i = 0; i < dataArr.length; ++i ) {
					        contents = dataArr[i].replace( /<-newline->/g, "\n" );
					        contents = contents.replace( /<\s*\/*script>/gi, "" );
					        eval( contents );
					}
				}
				if(afterAction) eval(afterAction);
			}
		}
	}
}

/*Ajax Function End */

/*ºê¶ó¿ìÀúº° iframe ³ô¿¡ Á¦¾î*/
function ifr_Height(f_height,obj){
	if (getNavigatorType() == "Netscape 5")	 //¾ó¸¶³ª ¸ðÁú¶ó? ÀÏ¶§ ÆÄÀÌ¾îÆø½º
	{
		var height = document.getElementById(obj).contentWindow.document.body.scrollHeight;
		document.getElementById(obj).height = height;
	}
	else{ // ¸ðÁú¶ó ¾Æ´Ò¶§
		document.getElementById(obj).style.height=f_height; //iframe »çÀÌÁî Á¶Àý
	}
}


//ÆÄ¶ó¹ÌÅÍÀÇ °ªÀ» encodeÇÕ´Ï´Ù.
function encodeURL(str){
    var s0, i, s, u;
    s0 = "";                // encoded str
    for (i = 0; i < str.length; i++){   // scan the source
        s = str.charAt(i);
        u = str.charCodeAt(i);          // get unicode of the char
        if (s == " "){s0 += "+";}       // SP should be converted to "+"
        else {
            if ( u == 0x2a || u == 0x2d || u == 0x2e || u == 0x5f || ((u >= 0x30) && (u <= 0x39)) || ((u >= 0x41) && (u <= 0x5a)) || ((u >= 0x61) && (u <= 0x7a))){       // check for escape
                s0 = s0 + s;            // don't escape
            }
            else {                  // escape
                if ((u >= 0x0) && (u <= 0x7f)){     // single byte format
                    s = "0"+u.toString(16);
                    s0 += "%"+ s.substr(s.length-2);
                }
                else if (u > 0x1fffff){     // quaternary byte format (extended)
                    s0 += "%" + (oxf0 + ((u & 0x1c0000) >> 18)).toString(16);
                    s0 += "%" + (0x80 + ((u & 0x3f000) >> 12)).toString(16);
                    s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16);
                    s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
                }
                else if (u > 0x7ff){        // triple byte format
                    s0 += "%" + (0xe0 + ((u & 0xf000) >> 12)).toString(16);
                    s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16);
                    s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
                }
                else {                      // double byte format
                    s0 += "%" + (0xc0 + ((u & 0x7c0) >> 6)).toString(16);
                    s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
                }
            }
        }
    }

    return s0;
}
//Decode

function decodeURL(str){
    var s0, i, j, s, ss, u, n, f;
    s0 = "";                // decoded str
    for (i = 0; i < str.length; i++){   // scan the source str
        s = str.charAt(i);
        if (s == "+"){s0 += " ";}       // "+" should be changed to SP
        else {
            if (s != "%"){s0 += s;}     // add an unescaped char
            else{               // escape sequence decoding
                u = 0;          // unicode of the character
                f = 1;          // escape flag, zero means end of this sequence
                while (true) {
                    ss = "";        // local str to parse as int
                        for (j = 0; j < 2; j++ ) {  // get two maximum hex characters for parse
                            sss = str.charAt(++i);
                            if (((sss >= "0") && (sss <= "9")) || ((sss >= "a") && (sss <= "f"))  || ((sss >= "A") && (sss <= "F"))) {
                                ss += sss;      // if hex, add the hex character
                            } else {--i; break;}    // not a hex char., exit the loop
                        }
                    n = parseInt(ss, 16);           // parse the hex str as byte
                    if (n <= 0x7f){u = n; f = 1;}   // single byte format
                    if ((n >= 0xc0) && (n <= 0xdf)){u = n & 0x1f; f = 2;}   // double byte format
                    if ((n >= 0xe0) && (n <= 0xef)){u = n & 0x0f; f = 3;}   // triple byte format
                    if ((n >= 0xf0) && (n <= 0xf7)){u = n & 0x07; f = 4;}   // quaternary byte format (extended)
                    if ((n >= 0x80) && (n <= 0xbf)){u = (u << 6) + (n & 0x3f); --f;}         // not a first, shift and add 6 lower bits
                    if (f <= 1){break;}         // end of the utf byte sequence
                    if (str.charAt(i + 1) == "%"){ i++ ;}                   // test for the next shift byte
                    else {break;}                   // abnormal, format error
                }
            s0 += String.fromCharCode(u);           // add the escaped character
            }
        }
    }

    return s0;
}

function VodPlay(cid) //µ¿¿µ»ó ÇÃ·¹ÀÌ½Ã
{
	if(cid.length > 0) {

		VodPlayer = open('/MediaCenter/media_popup.asp?cid=' + cid,'VodPlayer','width=760,height=620,scrollbars=no,status=no,resizable=no');
		VodPlayer.focus();
	}
}

function showImgWin(url,p_w,p_h) {
	ref = "/include/pop_photo.asp?src="+url;
	PhotoViewer = open (ref,"PhotoViewer","top=50, toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, width="+p_w+", height="+p_h);
	PhotoViewer.focus();
}

function chkSrhClass() {
	var srhFrm = document.getElementById("srhfrm");
	var srhctgrString = "";

	if(srhFrm.srhstr.value) {
		if(srhFrm.srhctgr1.checked) srhctgrString += "|subject|";
		if(srhFrm.srhctgr2.checked) srhctgrString += "|contents|";
		if(srhFrm.srhctgr3.checked) srhctgrString += "|author|";

		srhFrm.srhctgr.value = srhctgrString;
		srhFrm.submit();
	}
}

var win= null;
function NewWindow(mypage,myname,w,h,wint,winl,scroll){
	var winl = (screen.width-w)/3;
	var wint = (screen.height-h)/3;
	var settings  ='height='+h+',';
	settings +='width='+w+',';
	settings +='top='+wint+',';
	settings +='left='+winl+',';
	settings +='scrollbars='+scroll+',';
	settings +='location=no,statusbar=0,resizable=no,fullscreen=no';
	
	win=window.open(mypage,myname,settings);

	if(parseInt(navigator.appVersion) >= 4){
		win.window.focus();
	}
}
