
function MM_findObj(n, d) { //v4.0
  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=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}


function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_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; }
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function goMenu(Val,Sel)
{
	Sel.value = '';
	if (Val) location=Val;

}

function Win_pop(newwin,w,h) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'width='+w+',height='+h+',top='+wint+',left='+winl+',resizable=no,scrollbars=no,status=yes,menu=no';
win = window.open(newwin, "new1", winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

// ÆäÀÌÁö focus blur
function bluring(){
	if (event.srcElement!=null) {
		if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();
	}
}
document.onfocusin=bluring;

// ¹öÆ° ¿À¹ö½Ã ½ºÅ©·Ñ
var sRepeat=null;

function doScrollerIE(dir, src, amount) {
	if (amount==null) amount=10;
	if (dir=="up")
	document.all[src].scrollTop-=amount;
	else
	document.all[src].scrollTop+=amount;
	if (sRepeat==null)
	sRepeat = setInterval("doScrollerIE('" + dir + "','" + src + "'," + amount + ")",100);
	return false
}

window.document.onmouseout = new Function("clearInterval(sRepeat);sRepeat=null");
window.document.ondragstart = new Function("return false");

/*³î·¯°¡±â*/
function GoPlay(no){
  for (i=0; i< golayer.length; i++){
    if (i==no) {
      document.all.golayer[i].style.display="block";
      }else{
      document.all.golayer[i].style.display="none";
      }
    }
}

function RefName()
{
  if(bRefresh == false)
  {
    document.ReplyForm.reWriterName.value = "";
    document.ReplyForm.reWriterName.focus();
    bRefresh = true;
  }
}

var bRefresh = false;
var bRefresh2 = false;

function RefPwd()
{
  if(bRefresh2 == false)
  {
    document.ReplyForm.repasswd.value = "";
    document.ReplyForm.repasswd.focus();
    bRefresh2 = true;
  }
}
function CaOn()
{
	document.getElementById("img_ca").src = document.getElementById("img_ca").src.replace(".gif", "_o.gif");
}

function CaOut()
{
	document.getElementById("img_ca").src = document.getElementById("img_ca").src.replace("_o.gif", ".gif");
}

//ÇÁ·£µå ÆË¾÷
function conthide(no) {
	for (i=0; i<cont.length; i++){
	 	if (i==no) {
			document.all.cont[i].style.display="none";

		} else {
//			document.all.cont[i].style.display="none";
		}
	}
}
function contshow(no) {
	for (i=0; i<cont.length; i++){
	 	if (i==no) {
			document.all.cont[i].style.display="block";

		} else {
//			document.all.cont[i].style.display="none";
		}
	}
}



//ÀÌ¸ðÆ¼ÄÜ
function emotshow() {
	var open = document.all["emo"].style.display;
	var posY = document.body.clientHeight;
	var posX = document.body.clientWidth;

	if (open == "none")
	{
		document.all["emo"].style.top = 183;
		document.all["emo"].style.left = 459;
		document.all["emo"].style.display = "";
	}
	else{
		document.all["emo"].style.display = "none";
	}
}

function setemot(emot) {
	document.comFrm.myemot.width = 20;
	document.comFrm.myemot.height = 20;
	document.comFrm.myemot.src = "http://image.freechal.com/q/emo" + emot + ".gif";
	document.comFrm.emoticon.value =  emot;
	document.all["emo"].style.display = "none";
}


function setpersonaconemot(emot, emoturl)
{
	document.comFrm.myemot.width = 20;
	document.comFrm.myemot.height = 20;
	document.comFrm.myemot.src = "http://image.freechal.com/q/emo" + emoturl + emot + ".gif";
	document.comFrm.emoticon.value = emot;
	document.all["emo"].style.display = "none";
}

//URL
function urlshow() {
	var open = document.all["url"].style.display;
	var posY = document.body.clientHeight;
	var posX = document.body.clientWidth;

	if (open == "none")
	{
		document.all["url"].style.top = 183;
		document.all["url"].style.left = 388;
		document.all["url"].style.display = "";
	}
	else{
		document.all["url"].style.display = "none";
	}
}


//Fontcolor
function fcolorshow() {
	var open = document.all["fcolor"].style.display;
	var posY = document.body.clientHeight;
	var posX = document.body.clientWidth;

	if (open == "none")
	{
		document.all["fcolor"].style.top = 183;
		document.all["fcolor"].style.left = 434;
		document.all["fcolor"].style.display = "";
	}
	else{
		document.all["fcolor"].style.display = "none";
	}
}


// Å×¸¶ - µ¿¿µ»ó ÀüÃ¼ Ä«Å×°í¸®
var on_off="off";
function PlayerCate(){
 if(on_off=="off"){
  category.style.visibility="visible";
  on_off="on";
 }
 else{
  category.style.visibility="hidden";
  on_off="off";
 }
}

// ESC ¹öÆ°½Ã BGM ÁßÁö
document.onkeydown = stopPlayer;
function stopPlayer() {
	if(event.keyCode==27) {
		if(typeof(top.funSplit=="function")) {
			if(top.isButtState == "play") {
				top.userAction = "pause";
				top.funSplit();
			}
		}
	}
}

// ÀÌ¹ÌÁö ¿Â,¿ÀÇÁ Ã³¸®
function imgOnOff(obj, bln_act) {
	var objsrc = obj.src;
	if(bln_act) {
		if(objsrc.indexOf("_on.gif")<0) obj.src = objsrc.replace(".gif", "_on.gif");
	}
	else{
		if(objsrc.indexOf("_on.gif")>0) obj.src = objsrc.replace("_on.gif", ".gif");
	}
}


//ÀÌ¹ÌÁö ¸®»çÀÌÂ¡ ÇÔ¼ö(2War ¿¬µ¿)
//which : ÀÌ¹ÌÁö ÅÂ±× ÀÌ¸§
//max_width : °¡·Î Å©±â¸¦ ±âÁØÀ¸·Î ÇÒ °æ¿ì ÃÖ´ë °¡·Î »çÀÌÁî 
//max_height : ¼¼·Î Å©±â¸¦ ±âÁØÀ¸·Î ÇÒ °æ¿ì ÃÖ´ë ¼¼·Î »çÀÌÁî 
//max_heightÀÌ³ª max_width ÁßÀÇ ÇÏ³ª´Â ²À 0ÀÌ µÇ¾ß ÇÑ´Ù. 
//Usage : onload="resizeImage('imageName', 565, 0);"
function resizeImage(which, max_width, max_height){		 

	imgFile = new Image();
	if(document.getElementById(which)){
		imgFile.src = document.getElementById(which).src;	
		 var width =  imgFile.width;
		 var height = imgFile.height;
		 var temp = 0 ;
		 if(max_height == 0){
			 if (width > max_width){
			  height = height/(width/max_width);
			  eval("document."+which+".width=max_width");
			  eval("document."+which+".height=height");
			 }
		 }else{
			if (height > max_height){
			  width = width/(height/max_height);
			  eval("document."+which+".width=width");
			  eval("document."+which+".height=max_height");
			 }
	 	} 
	 }
}

/* ÇÃ·¡½Ã */
function ObjFlash(src, width, height, param, addParam) {
	param = param || "";
	addParam = addParam || "";
	document.writeln("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\"" + width + "\" height=\"" + height + "\">");
	document.writeln("	<param name=\"movie\" value=\"" + src + "\">");
	document.writeln("	<param name=\"flashVars\" value=\"" + param + "\">");
	document.writeln("  <param name='allowScriptAccess' value='always' />");
	document.writeln("	<param name='quality' value='high' />");
	document.writeln("	<param name='scale' value='noscale' />");
	document.writeln("	<param name='salign' value='lt' />");
	document.writeln("	<param name='menu' value='false' />");
	document.writeln("	<param name='wmode' value='opaque' />");
	document.writeln("	<embed  bgcolor='#000000' wmode='opaque' src=\"" + src + "?" + param + "\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + width + "\" height=\"" + height + "\"></embed>");
	document.writeln("</object>");
}

/* ¸ÞÀÎ Ä¿¹Â´ÏÆ¼ ·¹ÀÌ¾î */
function SelComm(){
	fr = document.getElementById('CommLayer').style.display;	
	if(fr == "none"){
		document.getElementById('CommLayer').style.display = "block";
	}else{
		document.getElementById('CommLayer').style.display = "none";
	}
}


function ShowhidenLayer(LayName) {
	obj = document.getElementById(LayName);
	// ÆîÄ¡±â
  if (obj.style.display == "none") {
      obj.style.display = "block";
  }
  else if (obj.style.display == "block") {
      obj.style.display = "none";
  }
}

function ShownLayer(LayName) {
	obj = document.getElementById(LayName);
	obj.style.display = "none";
	// ÆîÄ¡±â
  if (obj.style.display == "none") {
      obj.style.display = "block";
  }
  else if (obj.style.display == "block") {
      obj.style.display = "none";
  }
}

function HideLayer(LayName) {
	obj = document.getElementById(LayName);
  // ¼û±â±â
  obj.style.display = "none";
}

