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="#ffffff" 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 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,'dmb_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="";            
}


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

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


//cookie
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 setCookie(cookiename, value, expiredays)
{
	var todayDate = new Date();
	todayDate.setDate(todayDate.getDate() + expiredays);
	document.cookie = cookiename + "= " + value + "; path=/; expires=" + todayDate.toGMTString() +1+ ";";
}

//µ¿¿µ»ó ÇÃ·¹ÀÌ
function movPlay(m, k) // m(ÇÁ·Î±×·¥ID), k(±â»çÄÚµå)
{
	var str = k+"||"+m;

	$("dViewwmv").style.display = "none";
	$("zindex").style.display = "none";
	$("vod_div").style.display = "block";
	$("vod_player").play();

	movLog.location.href = "/_comm/clog.php?m="+m+"&s=M&u="+escape(document.URL)+"&r="+escape(document.referrer);

	// ÀÎ±â VOD
	movLog1.location.href = "/_comm/log_print.php?log_str="+str+"&mode=manyvod";
}

// ³»¿ëÃ¢
function popLive()
{
	var live = window.open('/_comm/fmlive.php', 'ytnfm_live', 'width=360,height=250,status=yes');
	live.moveTo(200, 300)
}


// °øÁö»çÇ× µ¿¿µ»ó ÇÃ·¹ÀÌ
function movPlay2() 
{
	$("dViewwmv").style.display = "none";
	$("zindex").style.display = "none";
	$("vod_div").style.display = "block";
	$("vod_player").play();
}

//À©¹ÌÇÃÃÖ´ëÈ­
function setFullSize(id)
{
	try{
		document[id].DisplaySize = 3;
	}catch(e){
		document[id].DisplaySize = 3;
	}
}

//·Î±×Âï±â
function _L(m,s)
{
	var _u = "/_comm/blog.php?m="+m+"&s="+s+"&u="+escape(document.URL)+"&r="+escape(document.referrer);
	document.write('<iframe id="ifrclog" name="ifrclog" width="0" height="0" frameborder="0" src="'+_u+'"></iframe>');
}

function chkSearch(f)
{
	if(f.q.value=="")
	{
		alert("°Ë»ö¾î¸¦ Àû¾îÁÖ¼¼¿ä!");
		f.q.focus();
		return false;
	}
	return true;
}

//ytndmblog = new Image(1,1);
//ytndmblog.src = "/_comm/dmblog.php?u="+escape(document.URL);


function MediaPlayer(id, name, width, height, showcontrols, autostart, autorewind, autosize, autoresize, transparentatstart, loop, url) {
	document.write("<object id='"+id+"' codeBase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701' style='filter:alpha(Opacity:30)'"); 
	document.write("		type='application/x-oleobject' standby='Loading Microsoft Windows Media Player components...' "); 
	document.write("		width='"+width+"' height='"+height+"' classid='clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95' name='"+name+"'> ");
	document.write("	<param name='ShowControls' value='"+showcontrols+"'> ");
	document.write("	<param name='AutoStart' value='"+autostart+"'> ");
	document.write("	<param name='AutoRewind' value='"+autorewind+"'> ");
	document.write("	<param name='Autosize' value='"+autosize+"'> ");
	document.write("	<param name='AutoResize' value='"+autoresize+"'> ");
	document.write("	<param name='TransparentAtStart' value='"+transparentatstart+"'> ");
	document.write("	<param name='loop' value='"+loop+"'> ");
	document.write("	<param name='Filename' value='"+url+"'> ");
	document.write("	<param name='showtracker' value='0'> ");
	document.write("	<param name='mute' value='0'> ");
	document.write("	<embed enablecontextmenu='0' type='application/x-mplayer2' pluginspage='http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/' "); 
	document.write("		id='"+id+"' name='"+name+"' showpositioncontrols='0' showcontrols='1' autosize='0' autostart='1' showdisplay='0' ");
	document.write("		showstatusbar='0' showtracker='0' loop='1' width='"+width+"'  height='"+height+"' src='"+url+"' enablecontextmenu=0 > ");
	document.write("	</embed> "); 
	document.write("</object> ");
}

