
// Æ÷Ä¿½º ¾ø¾Ö±â
function allblur(){
for (i = 0; i < document.links.length; i++)
document.links[i].onfocus = document.links[i].blur;
}
window.onload=allblur
// Æ÷Ä¿½º ¾ø¾Ö±â



// ¼­ºê¸Þ´º
function SubChange(str){
document.all.sub01.style.display="none"
document.all.sub02.style.display="none"
document.all.sub03.style.display="none"
document.all.sub04.style.display="none"
document.all.sub05.style.display="none"
document.all.sub06.style.display="none"
document.all.sub07.style.display="none"

subdivs = eval("document.all." + str)
subdivs.style.display = "inline"

}
// ¼­ºê¸Þ´º


// ¿À´ÃÀÇ »ýÈ° Áö¼ö //
function WeatherChange(str){

document.all.weather01.style.display = "none"
document.all.weather02.style.display = "none"
document.all.weather03.style.display = "none"

weather = eval("document.all." + str);
weather.style.display = "inline"

}
// ¿À´ÃÀÇ »ýÈ° Áö¼ö //


// Áö¿ªº° ³¯¾¾ //
function AreaChange(str){

document.all.area01.style.display = "none"
document.all.area02.style.display = "none"
document.all.area03.style.display = "none"
document.all.area04.style.display = "none"
document.all.area05.style.display = "none"
document.all.area06.style.display = "none"
document.all.area07.style.display = "none"
document.all.area08.style.display = "none"
document.all.area09.style.display = "none"
document.all.area10.style.display = "none"
document.all.area11.style.display = "none"

area = eval("document.all." + str);
area.style.display = "inline"

}
// Áö¿ªº° ³¯¾¾ //

// °í¼Óµµ·Î ³¯¾¾ //
function HighwayChange(str){

document.all.area01.style.display = "none"
document.all.area02.style.display = "none"
document.all.area03.style.display = "none"
document.all.area04.style.display = "none"
document.all.area05.style.display = "none"
document.all.area06.style.display = "none"
document.all.area07.style.display = "none"
document.all.area08.style.display = "none"
document.all.area09.style.display = "none"
document.all.area10.style.display = "none"

area = eval("document.all." + str);
area.style.display = "inline"

}
// °í¼Óµµ·Î ³¯¾¾ //


// ½ºÆ÷Ã÷ ³¯¾¾ //
function SportsChange(str){

document.all.sports01.style.display = "none"
document.all.sports02.style.display = "none"
document.all.sports03.style.display = "none"
document.all.sports04.style.display = "none"
document.all.sports05.style.display = "none"
document.all.sports06.style.display = "none"
document.all.sports07.style.display = "none"
document.all.sports08.style.display = "none"
document.all.sports09.style.display = "none"

sports = eval("document.all." + str);
sports.style.display = "inline"

}
// ½ºÆ÷Ã÷ ³¯¾¾ //


// ÆøÇ³ÁÖÀÇº¸ ÇØÁ¦ //
function DiagramChange(str){

document.all.diagram01.style.display = "none"
document.all.diagram02.style.display = "none"
document.all.diagram03.style.display = "none"
document.all.diagram04.style.display = "none"
document.all.diagram05.style.display = "none"
document.all.diagram06.style.display = "none"
document.all.diagram07.style.display = "none"

diagram = eval("document.all." + str);
diagram.style.display = "inline"

}
// ÆøÇ³ÁÖÀÇº¸ ÇØÁ¦ //





// ¿À¹ö //
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

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_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; }
}

// ¿À¹ö //


// ÆË¾÷
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
// ÆË¾÷


function OpenPopUp(url,tit,wid,hei){
    var tp = (window.screen.Height-hei)/2;
    var lt = (window.screen.Width-wid)/2;

    openWindow = window.open(url,'tit','scrollbars=no,width='+wid+',height='+hei+',top='+tp+',left='+lt);
    openWindow.focus();

    return;
}

function memo_delete(obj) {
	if (obj.userpw.value.length < 4) {
		alert("ºñ¹Ð¹øÈ£´Â 4ÀÚ¸® ÀÌ»óÀÌ¾î¾ß ÇÕ´Ï´Ù.");
		return false;
	}
	obj.submit();
        return;
}

function memo_notice_popup(memo) {
	url = "/snews/memo_notice.php?memo="+memo;
	url += "&dirnews="+document.TMEMO.dirnews.value;
	url += "&news="+document.TMEMO.news.value;
	url += "&year="+document.TMEMO.year.value;

	OpenPopUp(url,"¸Þ¸ð ½Å°í",248,148);
        return;
}

function memo_delete_popup(memo) {
	url = "/snews/memo_passwd.php?memo="+memo;
	url += "&dirnews="+document.TMEMO.dirnews.value;
	url += "&news="+document.TMEMO.news.value;
	url += "&year="+document.TMEMO.year.value;

	OpenPopUp(url,"¸Þ¸ð »èÁ¦",248,148);
        return;
}

function memo_insert(obj) {
	if (obj.userid.value.length < 1) {
		alert("ÀÛ¼ºÀÚ ÀÌ¸§À» ÀÔ·ÂÇÏ¼¼¿ä");
		obj.userid.focus();
		return;
	}
	if (obj.userpw.value.length < 4) {
		alert("ºñ¹Ð¹øÈ£´Â 4ÀÚ¸® ÀÌ»óÀÌ¾î¾ß ÇÕ´Ï´Ù.");
		obj.userpw.focus();
		return;
	}
	if (obj.body.value.length < 1) {
		alert("ÀÇ°ßÀ» ÀÛ¼ºÇØ ÁÖ¼¼¿ä");
		obj.body.focus();
		return;
	}
	obj.action = '/snews/memoinsert.php';
	obj.submit();
        return;
}


//Ä«Å÷
function cartoonmemo_delete(obj) {
	if (obj.userpw.value.length < 4) {
		alert("ºñ¹Ð¹øÈ£´Â 4ÀÚ¸® ÀÌ»óÀÌ¾î¾ß ÇÕ´Ï´Ù.");
		return false;
	}
	obj.submit();
        return;
}

function cartoonmemo_delete_popup(memo) {
	url = "/scartoon/memo_passwd.php?memo="+memo;
	url += "&dir="+document.TMEMO.dir.value;
	url += "&news="+document.TMEMO.news.value;

	OpenPopUp(url,"¸Þ¸ð »èÁ¦",248,148);
        return;
}

function cartoonmemo_insert(obj) {
	if (obj.userid.value.length < 1) {
		alert("ÀÛ¼ºÀÚ ÀÌ¸§À» ÀÔ·ÂÇÏ¼¼¿ä");
		obj.userid.focus();
		return;
	}
	if (obj.userpw.value.length < 4) {
		alert("ºñ¹Ð¹øÈ£´Â 4ÀÚ¸® ÀÌ»óÀÌ¾î¾ß ÇÕ´Ï´Ù.");
		obj.userpw.focus();
		return;
	}
	if (obj.body.value.length < 1) {
		alert("ÀÇ°ßÀ» ÀÛ¼ºÇØ ÁÖ¼¼¿ä");
		obj.body.focus();
		return;
	}
	obj.action = '/scartoon/memoinsert.php';
	obj.submit();
        return;
}

// ´ñ±Û 
function strlen_check(maxlen,field)
{
	var temp;
	var msglen;
	msglen = maxlen*2;
	var value= field.value;
   
	l =  field.value.length; 
	tmpstr = "" ;

	if (l == 0) { value = maxlen*2; }
	else { 
		for(k=0;k<l;k++) 
		{
			temp =value.charAt(k);
			if (escape(temp).length > 4) msglen -= 2;
			else msglen--;
    
			if(msglen < 0) {
				alert("ÃÑ ¿µ¹® "+(maxlen*2)+"ÀÚ ÇÑ±Û " + maxlen + "ÀÚ ±îÁö º¸³»½Ç¼ö ÀÖ½À´Ï´Ù.");
				field.value= tmpstr;
				break;
			}
			else { tmpstr += temp; }
		}
	}
}

// ÆË¾÷½ºÆ÷Ã÷Áö º¯°æ ÅÇ
function _change_paper(type) {
	if(type == "entertain") {
		l_entertainment.style.display		= 'block';
		l_sports.style.display				= 'none';
		button_enter_on.style.display		= 'block'; 
		button_enter_off.style.display		= 'none'; 
		button_sports_on.style.display		= 'none'; 
		button_sports_off.style.display		= 'block';
		poptypeform.poptype.value			= 'ent';
	} else if(type == "sports") {
		l_entertainment.style.display		= 'none';
		l_sports.style.display				= 'block';
		button_enter_on.style.display		= 'none'; 
		button_enter_off.style.display		= 'block'; 
		button_sports_on.style.display		= 'block'; 
		button_sports_off.style.display		= 'none';
		poptypeform.poptype.value			= 'spo';
	}
}

// ÆË¾÷½ºÆ÷Ã÷Áö ¿ÀÇÂ
function popupCompanyNewsPaper( company ){
	var comname;
	if(company == "is") comname = "ilgans";
	else if(company == "st") comname = "stoday";
	else if(company == "sc") comname = "schosun";
	else if(company == "ss") comname = "sseoul";
	else if(company == "gd") comname = "goodday";

    var url = "/sports_popup/popmain.php?company=" + company + "&p_eye=news^onl^" + poptypeform.poptype.value + "^new^" + comname;
    var width , height, top, left , optionStr ;
    width = 630;
    height = 746;
    left = (screen.availWidth - width )/2;
    top= (screen.availHeight - height )/2;

    optionStr = "location=yes,menubar=yes, scrollbars=yes, directories=yes, status=yes , resizable=yes,titlebar=yes, toolbar=yes, width="+width+",height="+ height +",top = "+top+", left = " + left;

    companyNewsPager = window.open(url, "companyNewsPager" , optionStr );
}


// ¿À¸¥ÂÊ ½½¶óÀÌµå&Ä«Å÷ º¯°æ ÅÇ
function _change_sporightphoto(type) {
	if(type == "slide") {
		l_slide.style.display		= 'block';
		l_cartoon.style.display				= 'none';
		document.all.slide_on.style.display		= 'block'; 
		document.all.slide_off.style.display		= 'none'; 
		document.all.cartoon_on.style.display		= 'none'; 
		document.all.cartoon_off.style.display		= 'block';
	} else if(type == "cartoon") {
		l_slide.style.display		= 'none';
		l_cartoon.style.display				= 'block';
		document.all.slide_on.style.display		= 'none'; 
		document.all.slide_off.style.display		= 'block'; 
		document.all.cartoon_on.style.display		= 'block'; 
		document.all.cartoon_off.style.display		= 'none';
	}
}

function popupGameday( url ) {
	openWindow = window.open( url, 'gameday','scrollbars=yes,width=829,height=760,top=10,left=50');

	return;
}


function resizeFontSize(val) 
{
	var cbody; 
	cbody = document.getElementById("cbody"); 
	if (val > 0) { 
		if (fontSize <= 18) { 
			fontSize = fontSize + val; 
			cbody.style.fontSize = fontSize + "px"; 
		} 
	} else { 
		if (fontSize > 12) { 
			fontSize = fontSize + val; 
			cbody.style.fontSize = fontSize + "px"; 
		} 
	} 
}
var fontSize = 14;

//////////////////////////////////////////////////////////////////////////////////////
//
// CheckLen
// ±â´É : ÀÔ·ÂÃ¢¿¡ ¸Å°³º¯¼ö·Î ¹ÞÀº lenÀÌÇÏÀÇ ¹®ÀÚ¼ö¸¸ µé¾î°¡µµ·Ï ÇÑ´Ù.
// »ç¿ëÀÌº¥Æ® : onKeyup
// ÁÖÀÇ»çÇ× : checklenÇÔ¼ö¸¦ »ç¿ëÇÏ±â À§ÇØ¼­´Â 
//           º¯¼ö(MaxLen)¿Í ÇÔ¼ö(ReplaceChars,GetLength, CutText)°¡ ÇÊ¿äÇÏ´Ù.
//
//////////////////////////////////////////////////////////////////////////////////////

var MaxLen;

function CheckLen(len)
{
	// µé¾î¿Â ÄÚµå°¡ '³ª"ÀÏ¶§¸¦ ¸·´Â´Ù.
	/*
	if(event.keyCode == 222) { 
		var temp1;
		temp1 = event.srcElement.value;
		temp1 = ReplaceChars("\"","£¢",temp1);
		temp1 = ReplaceChars("'","£§",temp1);
		event.srcElement.value = temp1;
	}
	*/

	MaxLen = parseInt(len);
	templ=GetLength(event.srcElement);
	templ=templ.toString();
	t2=templ.split(",");
	if (t2[0]>MaxLen)
	{
		alert("ÀÔ·Â»óÀÚ¿¡ Çã¿ë ±æÀÌ ÀÌ»óÀÇ ±ÛÀ» ¾²¼Ì½À´Ï´Ù.\nº» ÀÔ·Â»óÀÚ¿¡´Â ÇÑ±Û "+Math.floor(MaxLen/2)+"ÀÚ, ¿µ¹®"+(MaxLen)+"ÀÚ±îÁö¸¸ ¾²½Ç ¼ö ÀÖ½À´Ï´Ù.");
		event.returnValue = '';
		event.srcElement.value=CutText(event.srcElement.value);
		return false;
	}

	return true;
}

function ReplaceChars(out,add,entry) {

	temp = "" + entry; // temporary holder

	while (temp.indexOf(out)>-1) {
		pos= temp.indexOf(out);
		temp = "" + (temp.substring(0, pos) + add + temp.substring((pos + out.length), temp.length));
	}

	return temp;
}

function GetLength(obj)
{
	temp2=obj.value;
	temp4=""
	var l=0;
	for (i=0;i<temp2.length;i++)
	{
		temp3 = temp2.charAt(i);
		
		if (escape(temp3).length > 4)
			l+=2;
		else if (temp3!='\r')
			l++;
	}
	
	if (l>MaxLen) return l+","+i;
	temp=""
	return l;
}

function CutText(aquery)
{
	var tmpStr;
	var temp=0;
	var onechar;
	var tcount;
	tcount = 0;
	tmpStr = new String(aquery);
	l = tmpStr.length;

	for(k=0;k<l;k++)
	{
		onechar = tmpStr.charAt(k);
		
		if(escape(onechar).length > 4) {
			tcount += 2;
		}
		else if(onechar!='\r') {
			tcount++;
		}
		if(tcount>MaxLen) {
			tmpStr = tmpStr.substring(0,k);
			break;
		}
	}

	return tmpStr;
}

//////////////////////////////////////////////////////////////////////////////////////
//
// CheckNum
// ±â´É : ¼ýÀÚ¸¸ ÀÔ·Â¹Þ°Ô ÇÔ.
// »ç¿ëÀÌº¥Æ® : onKeyup
//
//////////////////////////////////////////////////////////////////////////////////////

function CheckNum() {
	var e1  = event.srcElement;
	var num = "0123456789";
	var tmp = "";
	var str_yb = false;
	var first_yb = true;
	
	if (e1.value == "0")
	{
		return;
	}
	for (var i=0;i<e1.value.length;i++) {
		if ((e1.value.charAt(i) == '0') && (first_yb)) {
			 // ¾Õ¿¡ '0'ÀÌ ÀÖÀ¸¸é »èÁ¦
			tmp = tmp+e1.value.charAt(i);
			first_yb = false;
		}else if (-1 == num.indexOf(e1.value.charAt(i))) {
			 // ÇÏ³ªÀÌ»ó ÀÖÀ¸¸é ¸Þ¼¼Áö
			 str_yb = true;
		}else {
			tmp = tmp+e1.value.charAt(i);
			first_yb = false;
		}
	}

	if (str_yb) {
		alert ("¼ýÀÚ¸¸ ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù.");
		e1.value = tmp;
		return false;
	}

	e1.value = tmp;
	return;
}
function popupPimsUserinfo() {
var popupurl = "http://user.paran.com/userAction.do?method=paranChangeBasicInfoForm&reqType=popup";
var param = getCenterWinStr(780, 700);
var registerCPTestWin = window.open(popupurl, "registerCPTest", param+",menubar=no,scrollbars=yes,statusbar=yes");
registerCPTestWin.focus();
}
function getCenterWinStr(width, height) {
var str = "";
str = "height=" + height + ",innerHeight=" + height; 
str += ",width=" + width + ",innerWidth=" + width;
if (window.screen) {
var ah = screen.availHeight - 30;
var aw = screen.availWidth - 10;
var xc = (aw - width) / 2;
var yc = (ah - height) / 2;
str += ",left=" + xc + ",screenX=" + xc;
str += ",top=" + yc + ",screenY=" + yc;
}
return str;
}

function WinOpen(url,name,width,height) {
    window.open(url,name,"width="+width+",height="+height+",scrollbars=yes");
}
