function imgSwap(oImg)
{
   var strOver  = "_on"    // image to be used with mouse over
   var strOff = "_off"     // normal image
   var strImg = oImg.src
   if (strImg.indexOf(strOver) != -1) 
      oImg.src = strImg.replace(strOver,strOff)
   else
      oImg.src = strImg.replace(strOff,strOver)
}
































function setResize() {
	var obj=document.getElementById('sponserBottom');
	obj.style.width=document.body.clientWidth;
	obj.style.top=document.body.clientHeight-71;
	obj.style.left=0;
	obj.style.height=70;
	
	
}
















function naviMenu(idx) {
	var obj=document.getElementById('sponserBottom').style.display="none";
	focusSub();
}
































function hideMenu(idx) {
	focusMain();
	document.getElementById('contentDiv').innerHTML="";
	$('contentDivContentLoading').hide();
	var obj=document.getElementById('sponserBottom').style.display="";
}
















function getFlashMenu(idx) {
	
	return AC_FL_RunContent(
		'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0',
		'width', '100%',
		'height', '110',
		'src', 'menu'+idx,
		'quality', 'best',
		'pluginspage', 'http://www.adobe.com/go/getflashplayer',
		'align', 'middle',
		'play', 'true',
		'loop', 'false',
		'scale', 'noscale',
		'wmode', 'transparent',
		'devicefont', 'false',
		'id', 'menu'+idx,
		'bgcolor', '',
		'name', 'menu'+idx,
		'menu', 'false',
		'allowFullScreen', 'false',
		'allowScriptAccess','sameDomain',
		'movie', 'menu'+idx,
		'salign', 'TL'
	); //end AC code
}
































function focusSub() {
	document.getElementById('contentDiv').style.zIndex=100;
	document.getElementById('mainmenuDiv').style.zIndex=5;
}
function focusMain() {
	document.getElementById('contentDiv').style.zIndex=5;
	document.getElementById('mainmenuDiv').style.zIndex=100;
	
}
















function loadContent(midx,sidx) {
















	if(midx==2) {
		$('contentDivContentLoading').show();
	} else {
		$('contentDivContentLoading').hide();
	}
	var str=getFlashMenu(midx);
	
	new Ajax.Request('loadContent.php',{method:'post',parameters:{midx:midx,sidx:sidx,menuString:str},onSuccess:function(arg2){
		response=arg2.responseText;
//		alert(response);
	
		$('contentDiv').innerHTML=response;
		response.evalScripts();
	}});
}
















function loadContent2(midx,sidx) {
	if(midx==2) {
		$('contentDivContentLoading').show();
	} else {
		$('contentDivContentLoading').hide();
	}
	//$('contentDivContent').hide();
	new Ajax.Request('loadContent2.php',{method:'post',parameters:{midx:midx,sidx:sidx},onSuccess:function(arg2){
		response=arg2.responseText;
//		alert(response);
		$('contentDivContent').innerHTML=response;
		response.evalScripts();
		//$('contentDivContent').appear({duration:0.3});
	}});
}
































































































//flash related
































function getFlashMovie(movieName) {
  var isIE = navigator.appName.indexOf("Microsoft") != -1;
  return (isIE) ? window[movieName] : document[movieName];
 }
















































function goBack() {
















	getFlashMovie("mainmenu").gobackInFlash();
	
}
















function loadComplete() {
	
	$('contentDivContentLoading').hide();
	$('contentDivContent').style.opacity=1;
	
	$('contentDivContent').style.filter="alpha:(opacity=100)";
}
















function displayBCD(bidx, dmode, mode, num) {
		//board content div
















	new Ajax.Request('displayBCD.php',{method:'post',parameters:{bidx:bidx,dmode:dmode,mode:mode,num:num},onSuccess:function(arg2){
		response=arg2.responseText;
//		alert(response);
		$('boardContentDiv'+bidx).hide();
		$('boardContentDiv'+bidx).innerHTML=response;
		$('boardContentDiv'+bidx).appear();
		response.evalScripts();
	}});
































}
































































////board related
















































function toggleBoard(idx) {
	if($('boardContent_'+idx).style.display=="") {
		$('boardContent_'+idx).hide();
		$('boardBorder_'+idx).hide();
		$('board_'+idx).style.border='0px';
	} else {
		$('boardContent_'+idx).show();
		$('boardBorder_'+idx).show();
		$('board_'+idx).style.borderTop='3px solid #990000';
		$('board_'+idx).style.borderBottom='3px solid #990000';
		$('board_'+idx).style.borderLeft='1px solid #990000';
		$('board_'+idx).style.borderRight='1px solid #990000';
		
		new Ajax.Request('toggleBoard.php',{method:'post',parameters:{idx:idx},onSuccess:function(arg2){
		}});
	}
}
















































function saveBoard(bidx,idx) {
	var html=returnHTML();
	if($('writeTitle').value=="제목" || $('writeTitle').value=="" || html=="" || $('writeName').value=="이름" || $('writeName').value=="" || $('writePw').value=="pass" || $('writePw').value=="") {
		alert("모든 항목이 채워져 있어야 합니다.");
	} else {
		new Ajax.Request('saveBoard.php',{method:'post',parameters:{wtitle:$('writeTitle').value,wname:$('writeName').value,wpw:$('writePw').value,whtml:html,bidx:bidx,idx:idx},onSuccess:function(arg2) {
			displayBCD(bidx,1,0,0);
		}});
	}
}
















function editBoard(bidx,idx) {
	if($('boardEDPw_'+idx).value=="" || $('boardEDPw_'+idx).value=="pass") {
		alert('왼쪽에 비밀번호를 입력해주세요');
	} else {
		new Ajax.Request('checkPw.php',{method:'post',parameters:{bidx:bidx,idx:idx,cpw:$('boardEDPw_'+idx).value,mode:0},onSuccess:function(arg2) {
			response=arg2.responseText;
			response.evalScripts();
		}});
	}
}
































function deleteBoard(bidx,idx) {
	if($('boardEDPw_'+idx).value=="" || $('boardEDPw_'+idx).value=="pass") {
		alert('왼쪽에 비밀번호를 입력해주세요');
	} else {
		if(confirm('정말 이 글을 삭제하시겠습니까?')) {
			new Ajax.Request('checkPw.php',{method:'post',parameters:{bidx:bidx,idx:idx,cpw:$('boardEDPw_'+idx).value,mode:1},onSuccess:function(arg2) {
				response=arg2.responseText;
				response.evalScripts();
			}});
		}
	}
}
































function getReply(idx) {
	new Ajax.Request('getReply.php',{method:'post',parameters:{idx:idx},onSuccess:function(arg2) {
		//alert(idx);
		response=arg2.responseText;
		$('boardReply_'+idx).innerHTML=response;
		response.evalScripts();
	}});
}
















function saveReply(idx) {
	
	
		if($('replyname_'+idx).value!="이름" && $('replyname_'+idx).value && $('replypw_'+idx).value && $('replycontent_'+idx).value) {
			new Ajax.Request('saveReply.php',{method:'post',parameters:{idx:idx,uname:$('replyname_'+idx).value,upw:$('replypw_'+idx).value,ucontent:$('replycontent_'+idx).value},onSuccess:function(arg2) {
				getReply(idx);
				
			}});
		} else {
			alert('모든 항목을 채워주세요');
			
		}
	
	
}
















function deleteReply(idx,mode,pw,eidx) {
	
		new Ajax.Request('deleteReply.php',{method:'post',parameters:{idx:idx,mode:mode,pw:pw,eidx:eidx},onSuccess:function(arg2) {
			response=arg2.responseText;
			response.evalScripts();
			$('loadingReply').value=0;
		}});
	
}
















function addWYSIWYGImage(image) {
	var browserName = navigator.appName;
	if (browserName == "Microsoft Internet Explorer") {
		document.getElementById('wysiwygboardWriteTextarea').contentWindow.document.selection.createRange().pasteHTML(image); 	
	} else {	 
		var div = document.getElementById('wysiwygboardWriteTextarea').contentWindow.document.createElement("span");		 		
		div.innerHTML = image;
		var node = insertNodeAtSelection(div, 'boardWriteTextarea');
	}




	
}




function neverPopUp() {
	new Ajax.Request('neverPopUp.php');
	$('popUpDiv').hide();
}
function closePopUp() {
	$('popUpDiv').hide();
}


