//document.domain = "ytn.co.kr";

function $(s) { return document.getElementById(s) }
function print_swf(file,width,height,id)
{
	if(!id) id = "swf_"+width;	
	var str = '';
	str += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+width+'" height="'+height+'" id="'+id+'" align="middle">';
	str += '<param name="allowScriptAccess" value="sameDomain" />';
	str += '<param name="movie" value="'+file+'" />';
	str += '<param name="quality" value="high" />';
	str += '<param name=wmode value=transparent>';	
	str += '<embed src="'+file+'" quality="high" bgcolor="#000000" width="'+width+'" height="'+height+'"  name="'+id+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	str += '</object>';
	document.write(str);
}

function _L(m,s)
{
	var _u = "/_comm/ylog.php?m="+m+"&s="+s+"&u="+escape(document.URL)+"&r="+escape(document.referrer);
	document.write('<iframe id="ifrylog" name="ifrylog" width="0" height="0" frameborder="0" src="'+_u+'"></iframe>');
}
// ASP ·Î±×
function aspLog(m)
{
	var _u2 = "/_comm/asplog.php?m="+m;
	document.write('<iframe id="ifrasplog" name="ifrasplog" width="0" height="0" frameborder="0" src="'+_u2+'"></iframe>');
}

function _L(m,s)
{
	var _u = "/_comm/ylog.php?m="+m+"&s="+s+"&u="+escape(document.URL)+"&r="+escape(document.referrer);
	document.write('<iframe id="ifrylog" name="ifrylog" width="0" height="0" frameborder="0" src="'+_u+'"></iframe>');
}


function get_cookie(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){
			var end = document.cookie.indexOf(";",j);
			if(end == -1)
				end = document.cookie.length;
			return unescape(document.cookie.substring(j,end));
		}
		i=document.cookie.indexOf(" ",i)+1;
		if (i==0) break;
	}
	return null;
}

function setPngImg(obj) 
{
  obj.width=obj.height=1;
  obj.className=obj.className.replace(/\bpngimg\b/i,'');
  obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"
  obj.src='';
  return '';
}

// ÇÁ¸°Æ®ÇÏ±â
function popPrint()
{
	url = "/_comm/pop_print.php";
	window.open(url,'print','status=1,scrollbars=1,width=620,height=500'); 
}

function popMovs2(n,mode)
{
	var m="";
	if(mode) m = "&mode="+mode;
	window.open('/_comm/pop_mov_etc.php?n='+n+m, 'movs', 'width=390,height=400,status=yes');
}

// VJÃ¤³Î ÆË¾÷
function popVj()
{
	url = "/vjchannel/vj_live.php";
	window.open(url,'vj','width=960,height=900,status=yes,scrollbars=1'); 
}
//À©¹ÌÇÃÃÖ´ëÈ­
function setFullSize(id)
{
	try{
		document[id].DisplaySize = 3;
	}catch(e){
		document[id].DisplaySize = 3;
	}
}

//½ºÆä¼È ¼­ºê·¹ÀÌ¾î¸Þ´º
var overnum = 0;
var prevnum = 0;
function showSubMenu(num)
{
	var sub="";
	overnum = num;

	if(prevnum)
	{
		$("div_submenu"+prevnum).style.display = "none";
	}	
	prevnum = num;		
	sub = $("div_submenu"+num);		
	//sub.style.top = event.clientY+5;
	//sub.style.left = event.clientX+5;
	sub.style.display = "block";
}
function hideSubMenu(num)
{
	if(overnum=="0")
		$("div_submenu"+num).style.display = "none";
}

function popPrint0401(key)//À§¼ºÅë¿ª½Ç
{
	url = "/_comm/pop_print_0401.php?key="+key;
	window.open(url,'print','status=1,scrollbars=1,width=620,height=500'); 
}


/**
	param : °øÅë¾ÆÀÌµð,ÀüÃ¼°¹¼ö,Ã³À½ È°¼ºÈ­,Ã³À½ ½ÃÀÛ ¹øÈ£
	id : img_{°øÅë¾ÆÀÌµð}_1, div_{°øÅë¾ÆÀÌµð}_1
	ÀÌ¹ÌÁö:{°øÅë¾ÆÀÌµð}1.gif, {°øÅë¾ÆÀÌµð}1_on.gif
*/
function TabMenu(id,num,over,snum)
{
	if(!over) over=1;
	if(!snum) snum=1;
	this.id=id;
	this.num=num;
	this.snum=snum;

	this.over(over);
	
	//ÀÌ¹ÌÁö·Ñ¿À¹öÀÌº¥Æ®
	var self=this;
	var k=0;
	for(var i=1; i<=this.num; i++)
	{
		k = i-1+this.snum;
		$("img_"+this.id+"_"+k).n = k;
		$("img_"+this.id+"_"+k).onmouseover = function() {
			self.over(this.n);
		};
	}
}
TabMenu.prototype.allout = function(n)
{
	var k=0;
	for(var i=1; i<=this.num; i++)
	{
		k = i-1+this.snum;
		$("img_"+this.id+"_"+k).src="/img/comm/"+this.id+k+".gif";
		$("div_"+this.id+"_"+k).style.display="none";
	}
}
TabMenu.prototype.over = function(n)
{
	this.allout();
	$("img_"+this.id+"_"+n).src="/img/comm/"+this.id+n+"_on.gif";
	$("div_"+this.id+"_"+n).style.display="";            
}

//ÅÇ¸Þ´º
function tab(over,num,id)
{
	for(var i=1; i<=num; i++)
	{
		$("div_"+id+"_"+i).style.display="none";
	}
	$("img_"+id).src = "/img/comm/"+id+"_"+over+".gif";
	$("div_"+id+"_"+over).style.display="";

}

// ±â»çº»¹® ÅØ½ºÆ® Å©±â º¯°æ
orisize = 16;
function textSizeChange(n)
{
	if(n == 1)
	{
		if(orisize == 20) return;
		orisize = orisize + 1;
		$("CmAdContent").style.fontSize = orisize+"px";
	}
	if(n == 2)
	{
		if(orisize == 11) return;
		orisize = orisize - 1;
		$("CmAdContent").style.fontSize = orisize+"px";
	}

	setCookie("textsize",orisize,1);
}


// ½ºÅ©·Ñ ´º½º
scrollPixel=613;
scrollWidth = 0;
function scrollNewsMove()
{
	scrollPixel = scrollPixel - 3;
	scrollWidth = $("scrollString").offsetWidth;
	var totalWidth = scrollPixel + scrollWidth;

	$("scrollString").style.left = scrollPixel+"px";
	time = setTimeout(scrollNewsMove,50);

	if(totalWidth < 0) scrollPixel=613;
}
function scrollNewsStop()
{
	clearTimeout(time);
}


//°Ë»ö
function checkSearchQuery(f)
{
	if(f.searchAdUrl.value) // °Ë»ö ±¤°í ÀÖÀ»¶§
	{
		window.open(f.searchAdUrl.value);
		return false;
	}

	if(f.q.value == "" && f.searchAdUrl.value == "")
	{
		alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä!");
		return false;
	}
	return true;
}

// °Ë»ö ±¤°í »ç¶óÁö°Ô...
function searchAdOut()
{
	var searchForm = document.web_search;
	searchForm.q.style.backgroundImage = 'url()';
	searchForm.searchAdUrl.value = "";
}

// ÄíÅ°¸¸µé±â
function setCookie(cookiename, value, expiredays)
{
	var todayDate = new Date();
	todayDate.setDate(todayDate.getDate() + expiredays);
	document.cookie = cookiename + "= " + value + "; path=/; expires=" + todayDate.toGMTString() +1+ ";";
}

//À©¹ÌÇÃÃÖ´ëÈ­
function setFullSize2(id,el)
{
	try{
		$(id).DisplaySize = 3;
	}catch(e){
		$(id).DisplaySize = 3;
	}
	try {ct.call(el)} catch(e) {}
}