var contcode = "";  //Ä·ÆÛ½º+ º¯¼ö¼±¾ð

function PopUpWindow(Url,windowName,Width,Height,scroll,resize){
   if((scroll==null) || (scroll=="")){
	   scroll = "no";
   }
   if((resize==null) || (resize=="")){
	   resize = "no";
   }
   var win = window.open(Url,windowName,"toolbar=no,location=no,directory=no,status=yes,menubar=no,scrollbars="+ scroll +",resizable=" + resize + ",top=200,left=350,width="+ Width +",height="+ Height);
   win.focus();
}

function getmovieplay(url) {
	var tmp;
	tmp = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="200" height="166" id="audio_player" align="middle">';
	tmp = tmp + '<param name="allowScriptAccess" value="sameDomain" />';
	tmp = tmp + '<param name="movie" value="'+url+'" />';
	tmp = tmp + '<param name="menu" value="false" />';
	tmp = tmp + '<param name="quality" value="high" />';
	tmp = tmp + '<param name="bgcolor" value="#000000" />';
	tmp = tmp + '<embed src="'+url+'" menu="false" quality="high" bgcolor="#000000" width="200" height="166" name="audio_player" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	tmp = tmp + '</object>';

	document.write(tmp);
}

function ch_date(){
        location = "kbo_textGame_B.asp?Syear="+document.dateS.Syear.options[document.dateS.Syear.selectedIndex].value+"&Smonth="+document.dateS.Smonth.options[document.dateS.Smonth.selectedIndex].value+"&Sday="+document.dateS.Sday.options[document.dateS.Sday.selectedIndex].value+" ";
}
 
function openkbo(retv){
 var x = 730 ;
 var y = 730;
 var url = "http://isplusapp.joins.com/kbo/kbo_textgame_P.asp?gmkey="+retv ;
 //alert('ÁØºñÁßÀÔ´Ï´Ù.');
 window.open(url, "textgame", "width="+ x +", height="+ y +", top=0, left=0, scrollbars=0, resizable=1, toolbar=0, menubar= 0, location=0, ectories=0, status=0");
}
 
function openmlb(retv){
 var x = 730 ;
 var y = 730;
 var url = "http://isplusapp.joins.com/mlb/mlb_textgame_P.asp?gmkey="+retv ;
 //alert('ÁØºñÁßÀÔ´Ï´Ù.');
 window.open(url, "textgame", "width="+ x +", height="+ y +", top=0, left=0, scrollbars=0, resizable=1, toolbar=0, menubar= 0, location=0, ectories=0, status=0");
}

function playOpen(myname, fileurl) { 
  var h = 283
  var w = 320
  var scroll = 'no'
  var url = "http://www.funch45.com/Lib/pop.asp?popurl=" + fileurl;
  var winl = (screen.width - w) / 2; 
  var wint = (screen.height - h) / 2;
  winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable' 
  win = window.open(url, myname, winprops)
} 
 
function playOpen2(myname, fileurl,idx) { 
  var h = 450
  var w = 320
  var scroll = 'no'
  var resize = 'no'
 
  var url = "http://www.funch45.com/frame_popup.asp?popurl=" + fileurl;
    url+="&idx="+ idx;
    url+="&myname="+ myname;
 
  var winl = (screen.width - w) / 2; 
  var wint = (screen.height - h) / 2;
  winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable='+resize 
  win = window.open(url, myname, winprops)
} 

//È¨¿¡¼­ ÁÖ±âÀûÀ¸·Î ½ÇÇàµÇ´Â ºÎºÐ body ÅÂ±×¿¡ onLoad·Î È£Ãâ//
function script_play() {
	vjToggle();	
	sports_ad();
	enter_ad();
	life_ad();
}

//ºñÁÖ¾ó ´º½º °¶·¯¸® ¿ÀÇÂ¿ë
function pop_open(url) {
	win = window.open(url , 'gallery' ,"scrollbars=no,width=725,height=707,left=50,top=50");
}

function openwin(url) {
	window.open(url );
}

//ºñÁÖ¾ó ´º½º µ¿¿µ»ó ¿ÀÇÂ¿ë
function pop_movie2(url) {
	win = window.open(url , 'moviepop' ,"scrollbars=no,width=555,height=380,left=50,top=50");
}

//ºñÁÖ¾ó ´º½º µ¿¿µ»ó ¿ÀÇÂ¿ë
function pop_movie(url,type) {
	if (type=="") {
		win = window.open(url , 'moviepop' ,"scrollbars=no,width=555,height=380,left=50,top=50");
	} 
}

function pop_m(url)
{
	pop_w = 673;
	pop_h = 560;
	pop_x = (screen.width - pop_w)/2;
	pop_y = (screen.height - pop_h)/2;
	
	window.open(url,'pop_m', 'top='+pop_y+', left='+pop_x+', width='+pop_w+', height='+pop_h+', topmargin=0, leftmargin=0, resizable=no, scrollbars=no');
}

function pop_car(code)
{
	pop_w = 670;
	pop_h = 590;
	pop_x = (screen.width - pop_w)/2;
	pop_y = (screen.height - pop_h)/2;
	
	window.open('http://isplussvc.joins.com/gallery/auto_gallery_pop.asp?car_code='+code,'nara2', 'top='+pop_y+', left='+pop_x+', width='+pop_w+', height='+pop_h);

}

//À©µµ¿ì Ã¢ ¿ÀÇÂ
function window_open(url,w,h) {
		win = window.open(url , 'info' ,"scrollbars=no,width="+w+",height="+h+",left=50,top=50");
}

function get_pop(url) {	
		window.open(url , "worldcup", "scrollbars=yes,width=989,height=656,left=50,top=50");
}

function login_send_cmt() {
	if (document.frm_login.txtId.value == "")  {
		   alert("È¸¿ø ID¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
		   document.frm_login.txtId.focus();
		   return;
	}
	if (document.frm_login.txtPasswd.value == "")  {
		   alert("È¸¿ø ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
		   document.frm_login.txtPasswd.focus();
		   return;
	}
	document.frm_login.referer.value=window.location;
	document.frm_login.action="http://login.joins.com/LoginMain.asp";
	document.frm_login.submit();
}

//·Î±×ÀÎÃ¢ ¿£ÅÍÅ° Ã³¸®
function login_check() {
	if(window.event.keyCode==13){ 
		login_send_cmt();
	return ; 
	} 
}

//¹®ÀÚÁß°è¿ë °£·«
function castOpen(Url) {
  window.open(Url,"popcast",'left=10,top=10,width=700,height=500,toolbar=no,menubar=no,status=no,scrollbars=no,resizable=no');
}
//·£´ý¼ýÀÚ»ý¼ºÇÏ¿© ·¹ÀÌÃ³Ã³¸®µÈ ºÎºÐ ·£´ýÀ¸·Î º¸ÀÌ±â (total_num:·¹ÀÌ¾î°¹¼ö, area_name:·¹ÀÌ¾î ÀÌ¸§)
function random_view(total_num, area_name) {
	var noticemenu, area_no, i;		
	area_no = Math.round(Math.random()*(total_num-1))+1;				//½ÇÁ¦ id°¡ 1ºÎÅÍ ½ÃÀÛÇÏ¹Ç·Î 1À» ´õÇß´Ù.(2°³¸é 1,2)
	
	for(i=1;i<=total_num;i++){			
		noticemenu = eval("document.all."+area_name + i + ".style");
		if(i == area_no){				
			noticemenu.display = "block";
		}else{
			noticemenu.display = "none";
		}
	}		
}
//·¹ÀÌ¾î°¹¼ö ¹Þ¾Æ ¼ø¼­´ë·Î º¸ÀÌ±â(ÄíÅ°·Î ÀúÀåÇÑ ½ÃÀÛ°ª ÀÐ¾î¿À±â)
function sequence_view(total_num,area_name,cookie_name) {
	var start_num;
	start_num = getCookie(cookie_name);
	if (start_num!=null) {			
	}else{
		start_num = get_random_num(total_num);			
	}
	for(i=1;i<=total_num;i++){			
		noticemenu = eval("document.all."+area_name + i + ".style");
		if(i == start_num){				
			noticemenu.display = "block";
		}else{
			noticemenu.display = "none";
		}
	}

	if (parseInt(start_num) >= total_num) start_num = 0;
	setCookie(cookie_name, parseInt(start_num)+1, 10);
}

//·¹ÀÌ¾î°¹¼ö ¹Þ¾Æ ¼ø¼­´ë·Î º¸ÀÌ±â(·£´ýÀ¸·Î ¹«Á¶°Ç ½ÃÀÛ)
function sequence_view2(total_num,area_name) {
	var start_num;

	start_num = get_random_num(total_num);

	for(i=1;i<=total_num;i++){			
		noticemenu = eval("document.all."+area_name + i + ".style");
		if(i == start_num){				
			noticemenu.display = "block";
		}else{
			noticemenu.display = "none";
		}
	}
	if (parseInt(start_num) >= total_num) start_num = 0;	
}
//·£´ý ¼ýÀÚ »ý¼ºÇÏ±â
function get_random_num(max_num) {
	var rnd_no = Math.round(Math.random()*(max_num-1))+1;				//½ÇÁ¦ id°¡ 1ºÎÅÍ ½ÃÀÛÇÏ¹Ç·Î 1À» ´õÇß´Ù.(2°³¸é 1,2)
	return rnd_no;
}

//============================================================================0
function onWinOpen(Url, Name, Left, Top, Width, Height, Toolbar, Menubar, Statusbar, Scrollbar, Resizable)
{
  Toolbar_str	= Toolbar ? 'yes' : 'no';
  Menubar_str	= Menubar ? 'yes' : 'no';
  Statusbar_str = Statusbar ? 'yes' : 'no';
  Scrollbar_str = Scrollbar ? 'yes' : 'no';
  Resizable_str = Resizable ? 'yes' : 'no';
  window.open(Url,Name,'left='+Left+',top='+Top+',width='+Width+',height='+Height+',toolbar='+Toolbar_str+',menubar='+Menubar_str+',status='+Statusbar_str+',scrollbars='+Scrollbar_str+',resizable='+Resizable_str);
}

function gallery_open(url) 
{
	win = window.open(url , 'gallery' ,"scrollbars=no,width=667,height=650,left=50,top=50").focus();	
}

// ============================ Cookie °ü·Ã ÇÔ¼ö =============================0
function delCookie(name,value,expires,path,domain,secure) {
  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

function setCookie (name,value,expires,path,domain,secure) {
  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}

function getCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break;
  }
  return null;
}

//============================ Cookie °ü·Ã ÇÔ¼ö =============================
//===========================================================================
//============================ Font °ü·Ã ÇÔ¼ö ================================
		
	var article_fontSize = parseInt(getCookie("jes_article_fontSize")); 		

	function initFont() { 
		
		if ( (article_fontSize < 1) || (article_fontSize > 6) || (isNaN(article_fontSize) == true)) {
				article_fontSize = 4;	
		}	
		setFont(article_fontSize);
	}

	function setFont(article_fontSize) { 
		
		document.getElementById("articleBody").className = "article0"+article_fontSize;	

		setFontCookie(article_fontSize);
	}	

	function setFontCookie(article_fontSize) {

		var expiry = new Date();
		var path = "/";
		var domain = ".joins.com";
		var secure = "";


		expiry.setTime(expiry.getTime() + 90 * (24 * 60 * 60 * 1000));

		setCookie("jes_article_fontSize",article_fontSize,expiry,path,domain,secure);
	}	

	function fontPlus() {		        
		if (article_fontSize < 6) {
			article_fontSize = article_fontSize + 1; 
			setFont(article_fontSize); 
		}
	}

	function fontMinus() {
		if (article_fontSize > 1) {
			article_fontSize = article_fontSize - 1; 
			setFont(article_fontSize); 
		}
	}   

// ============================ Font °ü·Ã ÇÔ¼ö =============================
//============================================================================

//========================= Cookie ÀÚµ¿ »èÁ¦ ¹æÁö¸¦ À§ÇØ¼­ È£Ãâ ÇÏ´Â ºÎºÐ(»èÁ¦ ±ÝÁö)===========
	var tmp_login_memtype    = getCookie("Joins_MemType");
	var tmp_login_userName   = getCookie("Joins_MemName");
	var tmp_login_userID     = getCookie("Joins_MemID");
	var tmp_login_Joins_Blog = getCookie("Joins_Blog");

//==============================================================================================



	function searchCheck(frm) {
		if (document.frmBasic.query.style.backgroundImage!="") {
			//document.location.href ="http://find.joins.com/enports/search_list01.asp?query=ÈÄÁöÁ¦·Ï½ºÇÁ¸°ÅÍ½º";
			frmBasic.action = "http://find.joins.com/enports/search_list01.asp?query=ÈÄÁöÁ¦·Ï½ºÇÁ¸°ÅÍ½º";
			frmBasic.submit();
		} else if (frmBasic.query.value=="") {
			alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
			frmBasic.query.focus();
			return false;
		}else{
			frmBasic.action = "http://find.joins.com/enports/search_list01.asp";
			frmBasic.submit();
		}
	}

	function searchCheck2(frm) {
		if (frmBasic.query.value=="") {
			alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
			frmBasic.query.focus();
			return false;
		}else{
			frmBasic.action = "http://find.joins.com/enports/search_list01.asp";
			frmBasic.target="_balnk";
			frmBasic.submit();
		}
	}

	function MM_jumpMenu(sel, targetstr) { 
		var index = sel.selectedIndex; 
		if (sel.options[index].value != '') { 
			if (targetstr == 'blank') {
				window.open(sel.options[index].value, 'win1');    
			} else {			
				document.location = sel.options[index].value;     
			}	
		}
	}

	// ¹®ÀÚ¿­ÀÇ ¹ÙÀÌÆ®¼ö¸¦ ¹ÝÈ¯
	function countByte (pStr) {
		var nCharCount; 	// ¹®ÀÚ¼ö
		var nByteCount; 	// ¹ÙÀÌÆ®¼ö
		var sChar;
		var i;

		nCharCount = 0;
		nByteCount = 0;
		
		// ÇÑ¹®ÀÚ¾¿ Ã¼Å©ÇÏ¸é¼­ ÇÑ±ÛÀº 2¹ÙÀÌÆ® ³ª¸ÓÁö´Â 1¹ÙÀÌÆ®·Î °è»ê
		for (i=0 ; i<pStr.length ; i++) {
			sChar = pStr.substring(i, i+1);
			if (sChar.charCodeAt(0) < 0 || 255 < sChar.charCodeAt(0)) {
				nByteCount += 2;
			} else {
				nByteCount++;
			}
		}
		
		return nByteCount;		// °è»êµÈ ¹ÙÀÌÆ®¼ö¸¦ ¹ÝÈ¯ÇÑ´Ù.
	}

	// 9. ÁÂÃø °ø¹é Á¦°Å ÇÔ¼ö
	function Ltrim(strValue){
		while (strValue.length>0){
		   if(strValue.charAt(0)==' '){
			   strValue=strValue.substring(1,strValue.length);              
		   }
		   else
			  return strValue;	    
		}
		return strValue;
	}

	// 10. ¿ìÃø °ø¹é Á¦°Å ÇÔ¼ö
	function Rtrim(strValue){
		while (strValue.length>0){
		   if(strValue.charAt(strValue.length-1)==' '){
			   strValue=strValue.substring(0,strValue.length-1);              
		   }
		   else
			   return strValue;	    
	   }
	   return strValue;
	}

	// 11. ¾çÂÊ °ø¹é Á¦°Å ÇÔ¼ö
	function Trim(strValue){
	   strValue = Ltrim(strValue);
	   strValue = Rtrim(strValue);
	   return strValue;
	}

	//ºê¶ó¿ìÀú Å¸ÀÔ ´ëÀÀ
	function userAgent() {

		var browserType = "";
		if (navigator.userAgent.indexOf("MSIE") != -1) {
			browserType = "IE";
			return browserType;
		}
		if (navigator.userAgent.indexOf("Firefox") != -1) {
				browserType = "FF";
				return browserType;
		}
		if (navigator.userAgent.indexOf("Mozilla") != -1) {
				browserType = "MZ";
				return browserType;
		}
		if (navigator.userAgent.indexOf("Opera") != -1) {
				browserType = "OP";
				return browserType;
		}
		if (navigator.userAgent.indexOf("Safari") != -1) {
				browserType = "SF";
				return browserType;
		}
		if (navigator.userAgent.indexOf("Mac") != -1) {
				browserType = "MC";
				return browserType;
		}
		browserType = "NG";  // Áö¿øÇÏÁö ¾Ê´Â ºê¶ó¿ìÀú
		return browserType;
	}


	
	// ·¹ÀÌ¾î º¯°æ
	function changeLayer(area_name, total_num, area_no) {
		for(i=1; i<=total_num; i++) {	
			if (area_no==i) {
				document.getElementById(area_name+i).style.display="block";				
			}else{
				document.getElementById(area_name+i).style.display="none";
			}
		}		
	}