//***************************************************************************//
// Numeric,English Check - Checking ÇÒ º¯¼ö
//***************************************************************************//
function NumEngCheck(str) {

	var residentValue = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.";
	var string = str;

	var len = string.length;

	for(i=0; i < len; i++) {
		if(residentValue.indexOf(string.substring(i, i+1)) < 0) {
			alert("Çã¿ëµÈ ¹®ÀÚ°¡ ¾Æ´Õ´Ï´Ù. ¼ýÀÚ³ª ¿µ¹®ÀÚ·Î ´Ù½Ã ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À");
			return;
		}
	}
	return true;
}

//***************************************************************************//
// Space Erase - Trim ÇÒ º¯¼ö
//***************************************************************************//
function TrimAll(str) {
	tmpstr = ""
	var chkstr = str;
	if (chkstr == "" ){
		return chkstr;
	}
	for (var i = 0; i < chkstr.length; i++){
		if (chkstr.charAt(i) == " "){
			tmpstr = tmpstr + ""
		}else{
			tmpstr = tmpstr + chkstr.charAt(i)
		}
	}
	return tmpstr;
}

var columnTab01={
	subcontainers:[], last_accessed_tab:null,
	revealsubmenu:function(curtabref){
	this.hideallsubs()
	if (this.last_accessed_tab!=null)
			this.last_accessed_tab.className=""
	if (curtabref.getAttribute("rel"))
	document.getElementById(curtabref.getAttribute("rel")).style.display="block"
	curtabref.className="current"
	this.last_accessed_tab=curtabref
	},

	hideallsubs:function(){
	for (var i=0; i<this.subcontainers.length; i++)
			document.getElementById(this.subcontainers[i]).style.display="none"
	},

	init:function(menuId, selectedIndex){
	var tabItems=document.getElementById(menuId).getElementsByTagName("a")
			for (var i=0; i<tabItems.length; i++){
					if (tabItems[i].getAttribute("rel"))
							this.subcontainers[this.subcontainers.length]=tabItems[i].getAttribute("rel") 
					if (i==selectedIndex){ 
							tabItems[i].className="current"
							this.revealsubmenu(tabItems[i])
				}
			tabItems[i].onmouseover=function(){
			columnTab01.revealsubmenu(this)
			}
		}
	}
}

// ¿À´ÃÀÇ ÁÖ¿ä´º½º
function func_TodayNews(Section){
	if(Section == "B"){
		document.getElementById("BizOn").className = "on";
		document.getElementById("JoyOn").className = "";
		document.getElementById("TvOn").className = "";
		document.getElementById("ImportNewsBiz").style.display = "";
		document.getElementById("ImportNewsJoy").style.display = "none";
		document.getElementById("ImportNewsTv").style.display = "none";
	}else if(Section == "J"){		
		document.getElementById("BizOn").className = "";
		document.getElementById("JoyOn").className = "on";
		document.getElementById("TvOn").className = "";
		document.getElementById("ImportNewsBiz").style.display = "none";
		document.getElementById("ImportNewsJoy").style.display = "";
		document.getElementById("ImportNewsTv").style.display = "none";
	}else if(Section == "T"){
		document.getElementById("BizOn").className = "";
		document.getElementById("JoyOn").className = "";
		document.getElementById("TvOn").className = "on";
		document.getElementById("ImportNewsBiz").style.display = "none";
		document.getElementById("ImportNewsJoy").style.display = "none";
		document.getElementById("ImportNewsTv").style.display = "";
	}
}

// Top·©Å·´º½º
function func_TopRankNews(divno, topn){
	for(i=1;i<=topn;i++){
		if(i == divno){
			document.getElementById("toprankli"+i).className = "on";
			document.getElementById("toprank"+i).style.display = "";
		}else{
			document.getElementById("toprankli"+i).className = "";
			document.getElementById("toprank"+i).style.display = "none";
		}
	}
}

var RightPhotoNews;
RightPhotoNews = 1;

// ¿À´ÃÀÇ Æ÷Åä´º½º
function func_PhotoNews(btn){
	if(btn == "P"){
		if(RightPhotoNews > 1){
			RightPhotoNews = RightPhotoNews - 1;
		}else{
			RightPhotoNews = 3;
		}
	}else{
		if(RightPhotoNews < 3){
			RightPhotoNews = RightPhotoNews + 1;
		}else{
			RightPhotoNews = 1
		}
	}

	for(i=1;i<4;i++){
		if(i == RightPhotoNews){
			document.getElementById("TodayPhoto"+i).style.display = "";
		}else{
			document.getElementById("TodayPhoto"+i).style.display = "none";
		}
	}
}

var RightTVNews;
RightTVNews = 1;

// ¿À´ÃÀÇ TV´º½º
function func_TVNews(btn){
	if(btn == "P"){
		if(RightTVNews > 1){
			RightTVNews = RightTVNews - 1;
		}else{
			RightTVNews = 3;
		}
	}else{
		if(RightTVNews < 3){
			RightTVNews = RightTVNews + 1;
		}else{
			RightTVNews = 1
		}
	}

	for(i=1;i<4;i++){
		if(i == RightTVNews){
			document.getElementById("TodayTv"+i).style.display = "";
		}else{
			document.getElementById("TodayTv"+i).style.display = "none";
		}
	}
}

var RightSlideNews;
RightSlideNews = 1;

// ¿À´ÃÀÇ ½½¶óÀÌµå´º½º
function func_SlideNews(btn){
	if(btn == "P"){
		if(RightSlideNews > 1){
			RightSlideNews = RightSlideNews - 1;
		}else{
			RightSlideNews = 3;
		}
	}else{
		if(RightSlideNews < 3){
			RightSlideNews = RightSlideNews + 1;
		}else{
			RightSlideNews = 1
		}
	}

	for(i=1;i<4;i++){
		if(i == RightSlideNews){
			document.getElementById("TodaySlide"+i).style.display = "";
		}else{
			document.getElementById("TodaySlide"+i).style.display = "none";
		}
	}
}

function func_newsFlash(){
	var popup = window.open("/news/newsflash.asp","newsFlash","width=980, height=800");
	if (popup == null) {
		alert('ÆË¾÷Ã¢ÀÌ Â÷´ÜµÇ¾ú½À´Ï´Ù.');
	}
}

function func_slidePhoto(code){
	var popup = window.open("/news/slide.asp?Code="+code,"newsFlash","width=880, height=710, scrollbars=no");
	if (popup == null) {
		alert('ÆË¾÷Ã¢ÀÌ Â÷´ÜµÇ¾ú½À´Ï´Ù.');
	}
}

function GGetCookie(cookieName, itemName) {
	var nameOfCookie = cookieName + "=";
	var x = 0;
	while (x <= document.cookie.length) {
		var y = (x + nameOfCookie.length);
		if (document.cookie.substring(x, y) == nameOfCookie) {
			startOfCookie = document.cookie.indexOf("&"+itemName+"=")+2+itemName.length;
			endOfCookie = document.cookie.indexOf( "&", startOfCookie);
			return unescape(document.cookie.substring(startOfCookie, endOfCookie));
		}
		x = document.cookie.indexOf(" ", x) + 1;
		if (x == 0)
			break;
	}
	return "";
}

function loginPop(url, script) {
	window.open("/member/PopLogin.asp?NextUrl=" + escape(url) + "&script=" + script, "__GONEWSLOGIN__", "toolbar=no, directories=no, status=no resizable=no, width=485,height=230,left=" + (screen.width-470)/2 + ",top=" + (screen.height-250)/2);
}



function GetCookie(cookieName, itemName) {
	var nameOfCookie = cookieName + "=";
	var x = 0;
	while (x <= document.cookie.length) {
		var y = (x + nameOfCookie.length);
		if (document.cookie.substring(x, y) == nameOfCookie) {
			startOfCookie = document.cookie.indexOf("&"+itemName+"=")+2+itemName.length;
			endOfCookie = document.cookie.indexOf( "&", startOfCookie);
			return unescape(document.cookie.substring(startOfCookie, endOfCookie));
		}
		x = document.cookie.indexOf(" ", x) + 1;
		if (x == 0)
			break;
	}
	return "";
}