//************************************************
//
//
//    ÆíÁýÀÚ : Å©·é
//    ÀÌ¸ÞÀÏ : croon@shuer.com
//    MSN¸Þ½ÅÀú : croon@shuer.com
// 
//    À¥»óÀÇ js¸¦ ¼öÁýÇÏ¿© ÆíÁýÇÏ¿´½À´Ï´Ù
//    ÇÊ¿äÇÑ ¼Ò½º°¡ ÀÖÀ¸½Å ºÐÀº ¾ðÁ¦µçÁö ¸¶À½²¯ 
//    »ç¿ëÇÏ½Ã±â ¹Ù¶ø´Ï´Ù
//
//************************************************

function noticeLoginToTopGUI() {        // »ó´Ü Top GUI Flash Movie¿¡ ÇöÀç ·Î±×ÀÎ µÇ¾úÀ½À» ¾Ë·ÁÁÜ
	window.document.topGUI.SetVariable("getLoginStatus", "nowLogged") ;
}

function noticeFullScreenToTopGUI() {        // »ó´Ü Top GUI Flash Movie¿¡ ÇöÀç ·Î±×ÀÎ µÇ¾úÀ½À» ¾Ë·ÁÁÜ
	window.document.topGUI.SetVariable("fullscreen", "ok") ;
}

function setPng24(obj) { 
    obj.width=obj.height=1; 
    obj.className=obj.className.replace(/\bpng24\b/i,''); 
    obj.style.filter = 
    "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');" 
    obj.src='';  
    return ''; 
} 

function fullScreen(){
		window.open(location.href,'fullscreen','channelmode,scrollbars,')
		document.cookie="fullScreen=ok";
			if(window.name=="fullscreen"){
				opener.document.location.href=location.href;
				self.close();
				document.cookie="fullScreen=";
			}
}

function replace(str,text,by)
{
	var value;
	value = str.toString();

	var strLength=value.length, txtLength=text.length;
	if((strLength == 0) || (txtLength == 0)) return value;

	var z= value.indexOf(text);
	if((!z)&&(text !=value.substring(0,txtLength))) return value;
	if(z == -1) return value;

	var newstr = value.substring(0,z) + by;

	if(z+txtLength < strLength)
		newstr += replace(value.substring(z+txtLength,strLength),text,by);
		return newstr;
}
 


//************************************************
// Å¬¸¯½Ã 1px ¿òÁ÷ÀÌ°Ô ÇÏ´Â ½ºÅ©¸³Æ®
// ÃâÃ³ : miniwini.com
//************************************************


function FX1px()
{
	var el = event.srcElement;
	while(el.tagName != "TD")
		el = el.parentElement;
	el.style.paddingTop = "1px";
}


function DeFX1px()
{
	var el = event.srcElement;
	while(el.tagName != "TD")
		el = el.parentElement;
	el.style.paddingTop = "0px";
}


//************************************************
// ¹Ì´ÏÀ§´Ï ¿¡µðÅÍ °ü·Ã ÇÔ¼ö 
//************************************************

function playMultimediaFile(sUri,obj)
{
	var nPlayState = obj.getAttribute("isPlaying");
	if (nPlayState==0)
	{
		el = obj.previousSibling;
		while (el.tagName!="A")
			el = el.previousSibling;

		var oMedia = document.createElement("EMBED");
		oMedia.style.display = "block";
		oMedia.src = sUri;
		oMedia.autostart = true;
		obj.parentNode.appendChild(oMedia);

		obj.setAttribute("isPlaying",1);
	}
	else
	{
		alert("ÀÌ¹Ì Àç»ýÁßÀÔ´Ï´Ù");
		return;
	}
}




//************************************************
// ShowHide Layer
//************************************************

function findObj(n, d) {
  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=findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function showHideLayers() {
  var i,p,v,obj,args=showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=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; }
}

//************************************************
// showRecomment (Copy from miniwini.com)
//************************************************

function showReCommentForm(s,s2,s3,s4,s5)
{
	alldivs = document.getElementsByTagName("DIV");

	for (i=0;i<alldivs.length;i++)
	{
		if (alldivs[i].id.indexOf("_recomment") > -1 && alldivs[i].id != s.id)
			alldivs[i].style.display = "none";
	}
	
	if (s.innerHTML == "")
	{
		comment_form.outerHTML = "";
        s.style.display = "";
       	s.innerHTML = org;
		document.all.add_Comment.grp.value = s2;
		document.all.add_Comment.depth.value = s3;
		document.all.add_Comment.grp_level.value = s4;
		document.all.add_Comment.reply.value = s5;
		document.all.add_Comment.isFirst.value = "no";
		document.all.add_Comment.comment.focus();
	}
	else
	{
		comment_form_container.innerHTML = org;
		s.style.display = "none";
		s.innerHTML = "";
		document.all.add_Comment.isFirst.value = "yes";
	}
}

var select_obj;
function layerAction(name,status) { 
		var obj=document.all[name];
		var _tmpx,_tmpy, marginx, marginy;
		_tmpx = event.clientX + parseInt(obj.offsetWidth);
		_tmpy = event.clientY + parseInt(obj.offsetHeight);
		_marginx = document.body.clientWidth - _tmpx;
		_marginy = document.body.clientHeight - _tmpy ;
		if(_marginx < 0)
			_tmpx = event.clientX + document.body.scrollLeft + _marginx ;
		else
			_tmpx = event.clientX + document.body.scrollLeft ;
		if(_marginy < 0)
			_tmpy = event.clientY + document.body.scrollTop + _marginy;
		else
			_tmpy = event.clientY + document.body.scrollTop ;
		obj.style.posLeft=_tmpx+0;
		obj.style.posTop=_tmpy+0;
		if(status=='visible') {
			if(select_obj) {
				select_obj.style.visibility='hidden';
				select_obj=null;
			}
			select_obj=obj;
		}else{
			select_obj=null;
		}
		obj.style.visibility=status; 
	}




//************************************************
// IMAGE FILTER
//************************************************

var startopacity = 50;

function fadeIt(obj,direct){ 
if(window.timer) {
clearInterval(timer);
} 
tobj=obj; drct=direct; 
timer=setInterval("flowfilter(tobj,drct);",20);
}

function flowfilter(thing,dct){
if(dct==1) {
if (thing.filters.alpha.opacity<100) {
thing.filters.alpha.opacity+=5;
}
else {
clearInterval(timer);
}
}
if(dct==2) {
if (thing.filters.alpha.opacity>startopacity) {
thing.filters.alpha.opacity-=5;
}
else {
clearInterval(timer);
}
}
}

//style="filter:alpha(opacity=50)" onMouseover="fadeIt(this,1)" onMouseout="fadeIt(this,2)" 
