
var clickAreaCheck = false;

function close_divs(){
	if(document.getElementById("qMenu_service")) {
		divDisplay ("qMenu_service", "none");
		divDisplay ("qMenu_list", "none");
		if(document.getElementById('dir_to_home').className == 'over'){
			document.getElementById('dir_to_home').className = 'out';
		}
		if(document.getElementById('blog_friend_list').className == 'over'){
			document.getElementById('blog_friend_list').className = 'out';
		}
	}
}

// 이미지 롤오버
function rollOverImg(obj, src) {
	obj.src = src;
}

// 절대 높이 계산
function getAbsoluteTop(oNode){
	var oCurrentNode=oNode;
	var iTop=0;
	if(document.all){
		while(oCurrentNode != null && (oCurrentNode.tagName.toUpperCase()!="BODY" || oCurrentNode.tagName.toUpperCase()!="HTML") ){
			iTop+=oCurrentNode.offsetTop;
			oCurrentNode=oCurrentNode.offsetParent;
		}
	}
	else{
		while(oCurrentNode != null && (oCurrentNode.tagName.toUpperCase()!="BODY" || oCurrentNode.tagName.toUpperCase()!="HTML")){
			iTop+=oCurrentNode.offsetTop;
			oCurrentNode=oCurrentNode.offsetParent;
		}
	}
	//alert("top:"+iTop);
	return iTop;
}
// 절대 좌측 계산
function getAbsoluteLeft(oNode){
	var oCurrentNode=oNode;
	var iLeft=0;
	if(document.all){
		while(oCurrentNode != null && (oCurrentNode.tagName.toUpperCase()!="BODY" || oCurrentNode.tagName.toUpperCase()!="HTML")){
			iLeft+=oCurrentNode.offsetLeft;
			oCurrentNode=oCurrentNode.offsetParent;
		}
	}
	else{
		while(oCurrentNode != null && (oCurrentNode.tagName.toUpperCase()!="BODY" || oCurrentNode.tagName.toUpperCase()!="HTML")){
			iLeft+=oCurrentNode.offsetLeft;
			oCurrentNode=oCurrentNode.offsetParent;
		}
	}
	//alert("left:"+iLeft);
	return iLeft;
}

var old_div = '';
function divDisplay(objId, act, check) {
	clickAreaCheck = true;
	if(old_div != '' && document.getElementById(old_div) && (document.getElementById(old_div).style.display == 'block' || document.getElementById(old_div).style.display == 'inline')){
		document.getElementById(old_div).style.display = 'none';
		if(document.getElementById('dirArr') && document.getElementById('dirArr').className != 'miniArrDown')
			document.getElementById('dirArr').className = 'miniArrDown';
		if(document.getElementById('tongArr') && document.getElementById('tongArr').className != 'miniArrDown')
			document.getElementById('tongArr').className = 'miniArrDown';
	}
	if (objId != '' && document.getElementById(objId)) {
		document.getElementById(objId).style.display = act;
	}
	if(check == true){
		old_div = objId;
	}
}

function popUp(url, width, height) {
	var winObj = window.open(url, "blogPopUp", "scrollbars=no, resiable=yes, width="+width+", height="+height);
	winObj.focus();
}

function getDocHeight(doc) {
	var docHt = 0, sh, oh;

	if (doc.height) docHt = doc.height;
	if (doc.body) {
		if (doc.body.scrollHeight) docHt = sh = doc.body.scrollHeight;
		if (doc.body.offsetHeight) docHt = oh = doc.body.offsetHeight;
		if (sh && oh) docHt = Math.max(sh, oh);
	}
	return docHt;
}

function setIframeHeight(iframeName, setTop, setHide) {

  var iframeWin = window.frames[iframeName];
  var iframeEl = document.getElementById? document.getElementById(iframeName): document.all? document.all[iframeName]: null;
  if ( iframeEl && iframeWin ) {
	if ( setTop )
		iframeEl.style.height = "auto"; // helps resize (for some) if new doc shorter than previous
	if (setHide)
		iframeEl.style.display = "none";
	var docHt = getDocHeight(iframeWin.document);
	// need to add to height to be sure it will all show
	if (docHt) iframeEl.style.height = docHt + 0 + "px";
  }
}

function chg_class_pos(target, div_id ){
	var divid = document.getElementById(div_id);
	
	if(divid && divid.style.display != 'block'){
		if(div_id){
			if(!divid.style.top){
				divid.style.top = (target.offsetTop - divid.parentNode.offsetTop + target.offsetHeight + 5) + "px";
				divid.style.left = (target.offsetLeft -target.parentNode.offsetLeft+15) + "px";
			}
			divDisplay (div_id, 'block', true);
		}
	}
	else{
		if(div_id){
			divDisplay (div_id, 'none');
		}
	}
}

function chg_class(target, val, div_id, imgId){
	var divid = document.getElementById(div_id);
	if(divid && divid.style.display != 'block'){
		if(imgId){
			document.getElementById(imgId).className = 'miniArrUp';
		}
		if(div_id){
			divDisplay (div_id, 'block', true);
		}
	}
	else{
		if(imgId){
			document.getElementById(imgId).className = 'miniArrDown';
		}
		if(div_id){
			divDisplay (div_id, 'none');
		}
	}
	if(val){
		target.className = val;
	}
}

function profileImgResize (img) {
	if (img.width > 150) {
		img.width=150;
//		img.reload();
	}
}

function returnBytes(obj, charCnt, textlimitName){
	
    var strCount = 0;
    var tempStr, tempStr2;

    strCount = obj.value.bytes();
    if (strCount > charCnt){
        alert("최대 " + charCnt + "byte이므로 초과된 글자수는 자동으로 삭제됩니다.");
        obj.value = obj.value.cut(charCnt, '');
        strCount = obj.value.bytes();
    }
    if(textlimitName != "")
        document.getElementById(textlimitName).innerHTML = strCount;
     
}
var rval="";
var timer=null;
function checker(obj,count,textlimitName){
	if(rval != obj.value){
		if(textlimitName){
			document.getElementById(textlimitName).innerHTML = obj.value.bytes();
		}
		rval = obj.value;
	}
	if (obj.value.bytes() > count){
        alert("최대 " + count + "byte이므로 초과된 글자수는 자동으로 삭제됩니다.");
        obj.value = obj.value.cut(count, '');
    }
	if(textlimitName){
		timer = setTimeout(function(){checker(obj,count,textlimitName)},10);
	}
	else{
		timer = setTimeout(function(){checker(obj,count)},10);
	}
}
function stopchecker(){
	clearTimeout(timer);
}
function findPosX(obj){
		var curleft = 0;
		if(obj != null && obj.offsetParent){
				while(obj.offsetParent){
						curleft +=obj.offsetLeft;
						obj = obj.offsetParent;
				}
		}else if(obj !=null && obj.x){
				curleft += obj.x;
		}
		return curleft;
}
function findPosY(obj){
		var curtop = 0;

		if(obj != null && obj.offsetParent){
				while(obj.offsetParent){
						curtop +=obj.offsetTop;
						obj = obj.offsetParent;
				}
		}else if(obj != null && obj.y){
				curtop += obj.y;
		}
		return curtop;
}
function replaceHTML(val){
	var x = val.replace(/&nbsp;/g," ").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");
	x = x.replace(/<BR>\n/g,"\n");
	x = x.replace(/<br>\n/g,"\n");
	x = x.replace(/<BR>/g,"\n");
	x = x.replace(/<br>/g,"\n");
	return x;
}
function checkItemNum(frm){
	var j = 0;
	for( i=0; i< frm.length; i++){
		e=frm.elements[i];
		if (e.type=='checkbox' && e.name != 'allBox' && e.checked) j++
	}
	return j;
}
var allChecked = false;
function checkItemAll(frm, chkName){
	if( chkName == null ) {
		chkName = 'itemBox';
	}
	if (allChecked == false){
		for( i=0; i< frm.length; i++){
			e=frm.elements[i];
			if(e.name == chkName) e.checked = true;
			if(e.name == chkName+"1") e.checked = true;
		}
		allChecked = true;
	}else{
		for( i=0; i< frm.length; i++){
			e=frm.elements[i];
			if(e.name == chkName) e.checked = false;
			if(e.name == chkName+"1") e.checked = false;			
		}
		allChecked = false;
	}
}
function addDaumBookmark(url, title, tag) {
	//var openWindow=window.open('http://bookmark.daum.net/bookmark/edit.do?decorator=popup&url='+encodeURIComponent(url)+'&title='+encodeURIComponent(title)+'&tag='+encodeURIComponent(tag),'pop_bookmark','width=486,height=340');
	var openWindow=window.open('/_blog/bookmark/bookmarkRegisterForm.do?link='+encodeURIComponent(url)+'&title='+encodeURIComponent(title)+ '&tag='+encodeURIComponent(tag), 'bookmark', 'scrollbars=yes,status=no,toolbar=no,resizable=1,location=no,menu=no,width=530,height=350');
	openWindow.focus();
}

function clickDssArticle2(no,folderid,sourceetc) {
	document.scrapform.data_id.value = no;
	document.scrapform.folder_id.value = folderid;
	var title = document.getElementById("title_"+no).innerHTML;
    document.scrapform.title.value = title;
    document.scrapform.source_etc.value = sourceetc;
}

		
// Image Upload For One File 

var nUploadType = 1; // 1이면 프로파일, 2이면 마이콘, 3이면 배경이미지, 4면 사이드바 배경
	
function getFhandle(url) {
	var		startIdx = url.indexOf('http://');
	if( startIdx != 0 ) {
		return '';
	}
	startIdx = 7;
	var 	endIdx = url.indexOf('/', startIdx);
	if( endIdx < 0 ) {
		return '';
	}
	var 	domain = url.substring(startIdx, endIdx);
	if( domain.indexOf('c') == 0 ) {
		domain = domain.substring(1);
	}
	
	startIdx = url.indexOf('/', endIdx+1);
	if( startIdx < 0 ) {
		return '';
	}
	var		path = url.substring( startIdx );
	return domain+path;
}
		
function browse_flash(type) {
	nUploadType = type;
	try {
		getMovieName("flash_direct_uploader").browse_flash();
	} catch (e) {
		alert('아직 플래쉬를 로딩중입니다. 잠시후 사용해 주십시요');
	}
}
    
function getMovieName(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
            return window.document[movieName];
    } else {
            return document[movieName];
    }
}

	function submit_flash(params) {
		try {
			if( params == 1 ) {
				getMovieName("flash_direct_uploader").activation_flash();
			} else if( params == 2 ) {
				getMovieName("flash_direct_uploader2").activation_flash();
			} else if( params == 3 ) {
				getMovieName("flash_direct_uploader").activation_flash();
			} else if( params == 4 ) {
				getMovieName("flash_direct_uploader2").activation_flash();
			} else if( params == 5 ) {
				getMovieName("flash_direct_uploader3").activation_flash();
			} else if( params == 6 ) {
				getMovieName("flash_direct_uploader4").activation_flash();
			}
		} catch (e) {
		}
	}
	
function sendData(info, params) {
	if( params == 1 ) {
		var	oProfileImage = document.getElementById("profileimage");
		var	oProfileImageName = document.getElementById("profileimagename");
		var	oProfileImageHandler = document.getElementById("profileimagehandler");
		oProfileImage.value = info[1]+"&filename="+info[6];
		oProfileImageName.value = info[6];
		oProfileImageHandler.value = getFhandle(info[1]);
		var	oPimgdel = document.getElementById("pimgdel");
		oPimgdel.value = "N";
		setImg(0, oProfileImage);
		var oDelBtn = document.getElementById("delBtn");
		oDelBtn.style.display = "block";
	} else if( params == 2 ) {
		var	oMyconImage = document.getElementById("Myconimage");
		var	oMyconImageName = document.getElementById("Myconimagename");
		var	oMyconImageHandler = document.getElementById("Myconimagehandler");
		previewImageReady(info[1]+"&width=21&height=21&type=FORCE&filename="+info[6]);
		oMyconImage.value = info[1]+"&filename="+info[6];
		oMyconImageName.value = info[6];
		oMyconImageHandler.value = getFhandle(info[1]);
		UpMycon(0, oMyconImage, info[6]);
	} else if( params == 3 ) {
		if( ImageUloader != null ) {
			ImageUloader.setUploadedImage('bgImg', info[0]+'&filename='+info[6], info[6]);
		}
	} else if( params == 4 ) {
		if( ImageUloader != null ) {
			ImageUloader.setUploadedImage('menuTitleImg', info[0]+'&filename='+info[6], info[6]);
		}
	} else if( params == 5 ) {
		if( ImageUloader != null ) {
			ImageUloader.setUploadedImage('blogTitleImg', info[0]+'&filename='+info[6], info[6]);
		}
	} else if( params == 6 ) {
		var	bookmarkUploadFile = document.getElementById("bookmarkUploadFile");
		var	bookmarkUploadFileName = document.getElementById("bookmarkUploadFileName");
		var	bookmarkUploadFileHandler = document.getElementById("bookmarkUploadFileHandler");
		bookmarkUploadFile.value = info[1]+"&filename="+info[6];
		//UpMycon(0, bookmarkUploadFile, 'mycon_ic');
	}else {
		alert('잘못된 요청이 들어왔습니다.');
	}
}

function	previewImageReady(url) {
	var oPreviewFrame = document.getElementById("previewFrame");
	if( oPreviewFrame != null ) {
		oPreviewFrame.src = url;
	}
}

function errorMessage(str) {
	alert(str);
}
var moreFriendAjax = null;
function showFriendList(blogid, target, val, div_id, imgId){
	var divid = document.getElementById(div_id);
   	if(divid.style.display != 'block'){
   		moreFriendAjax = new AjaxObject("moreFriendAjax", "qMenu_list", "contents");
   		moreFriendAjax.load("/_blog/friendListAjax.ajax?blogid=" + blogid, true);
		if(imgId){
			document.getElementById(imgId).className = 'miniArrUp';
		}
   		if(div_id){
   			divDisplay (div_id, 'block', true);
   		}
		document.getElementById("qMenu_list").style.display="block";
   	}
   	else{
		if(imgId){
			document.getElementById(imgId).className = 'miniArrDown';
		}
   		if(div_id){
   			divDisplay (div_id, 'none');
   		}
		document.getElementById("qMenu_list").style.display='none';
   	}
   	if(val){
   		target.className = val;
   	}
	clickAreaCheck = true; // 수정0918
}

function callbackFriendList(responseData, targetArea, isSuccess, url, finalProcess){
    	if(isSuccess == true){
           var dest = document.getElementById(targetArea);
           dest.innerHTML = responseData;
       }
}

function addFriend( url ){
			window.open(url, 'addfriend', 'width=400, height=300');
}
// for photolist
function hidden_img_detail(){
	divDisplay ('image_view', 'none');
}

/* Key Event Manager 
 * Because Asysnc and Muti Event Attach - By Hopeserver
 */
var KeyManager = {
	mKeyAction: {
		"keydown": new Array(),
		"click": new Array()
	},
	addAction: function(sName, fAction) {
		if(this.mKeyAction[sName]) {
			this.mKeyAction[sName].push(fAction);
		}
	},
	attachEvent: function() {
		document.onkeydown = function(eEvent) {
			if(window.event) {
				eEvent = window.event;
			}
			KeyManager.execEvent("keydown", eEvent);
		}
		
		document.onclick = function(eEvent) {
			if(window.event) {
				eEvent = window.event;
			}
			KeyManager.execEvent("click", eEvent);
		    if (!clickAreaCheck) {
				divDisplay(old_div, 'none');
		    }
			else {
		        clickAreaCheck = false;
			}
		}
	},
	execEvent: function(sName, eEvent) {
		for(var i=0; i<this.mKeyAction[sName].length; i++) {
			this.mKeyAction[sName][i](eEvent);
		}
	}
}
function getLength(str) {
		var i = 0;
		for ( var i=0; i < str.length; i++ ) {
			if( str.charCodeAt(i) < 127 )
				i++;
			else
				i = i + 2;
		}
		return i;	
}

/* 컨텐츠 이미지 리사이징  */
var imgResizeTimer;
function resizeCcontentImg(){
	var cont = document.getElementById('cContent').getElementsByTagName("img");
	for(var i=0; i <cont.length; i++){
		if(cont[i].offsetWidth > sContentWidth){
			cont[i].style.width = sContentWidth + 'px';
		}
	}
	clearTimeout(imgResizeTimer);
}

/*본 댓글이 텍스티콘인지 확인 0MIN*/
var TexticonCheck = {
	isTexticon: function(comment) {				// 텍스티콘인가 확인합니다.
	
		if (comment.indexOf("script") > 0 || comment.indexOf(".js") > 0 || comment.indexOf("iframe") > 0) {
			return false;
		}
	 
		if (comment.indexOf("/texticon") > 0 || comment.indexOf("/ttc") > 0) {
			return true;
		} 
	
		return false;
	},
	checkedComments: function (textHTML){		// 텍스티콘을 평범한 text로 변환 (수정일때만 사용) 
	 	var textHTML = textHTML.replaceAll("&lt;", "<").replaceAll("&gt;", ">");	 	
		sReg = /<IMG.+?value\s*=\s*([\"']?)(.*?)([\"']).*?>/i;
	
		var count; 
		while (count = textHTML.match(/(<IMG)/gi)) {
			matchArr = textHTML.match(sReg);				
			textHTML = textHTML.replace(matchArr[0], matchArr[2]);
		}	
		textHTML = textHTML.replace(/<BR>\n/g,"\n");
		textHTML = textHTML.replace(/<br>\n/g,"\n");
		textHTML = textHTML.replace(/<BR>/g,"\n");
		textHTML = textHTML.replace(/<br>/g,"\n");
		textHTML = textHTML.replace(/&nbsp;/g," "); 								
					
		return 	textHTML;
	}, 
	texticonContent: function(divid, comment) {	// 텍스티콘아닌것에 대한 html tag로 전환 (댓글 볼때 사용) 
		var scComment;
		
		if (TexticonCheck.isTexticon(comment)) {
			scComment = comment;		
		} else {
			scComment =  comment.replaceAll("<", "&lt;").replaceAll(">", "&gt;");		 	
		} 
		document.getElementById(divid).innerHTML = scComment;		
	}, 
	textCutString: function(divid, comment, maxleng) {	// 텍스티콘을 평범한 text로 바꾸고 cutString (수정일때 사용) 
		var scComment;		
		if (TexticonCheck.isTexticon(comment)) {
			scComment = TexticonCheck.checkedComments(comment);
		} else {
			scComment =  comment.replaceAll("<", "&lt;").replaceAll(">", "&gt;");;
		}	
		
		if (maxleng > 0 && scComment.length > maxleng) {
			scComment = scComment.substring(0, maxleng);			
		}		
		document.getElementById(divid).innerHTML = scComment;		
	}  
}

String.prototype.replaceAll = function( searchStr, replaceStr ){
	return this.replace(new RegExp(searchStr, "g"), replaceStr);
}


function fixPNG(curObj) {
	var pNode = curObj.parentNode;

	if(navigator.userAgent.toLowerCase().indexOf("msie 6") != -1){
		pNode.style.backgroundImage = "none";
		pNode.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ curObj.src +"',sizingMethod='scale');"
	}
	else{
		pNode.style.backgroundImage = 'url(' + curObj.src + ')';
		pNode.style.backgroundColor = "transparent";
	}
	pNode.style.width = curObj.offsetWidth + 'px';
	pNode.style.height = curObj.offsetHeight + 'px';
	pNode.style.margin = '0 auto';
	curObj.style.display = 'none';
}

// UploadFarm direct uploader
function getSWF(movieName){
  return (navigator.appName.indexOf("Microsoft") != -1)?window[movieName]:document[movieName];
}

Coca = {
	//function은 수정 금지

	//function : upload 시작
	upload: function(ctx){
  		getSWF("coca").browse();
	},
	//function : activate 시작(현재는 모든 업로드 서버 -php, 업로드팜- 들이 바로 activation 하기 때문에 호출할 필요가 없다. 
	activate: function(ctx){
		getSWF("coca").activate();
	},
	//function : remove 파일 삭제 key 는 attach type url을 집어 넣는다.
	remove: function(key, ctx){
		return getSWF("coca").remove(key);//return remain count
	},

	//callback은 서비스에서 알아서 오버라이드
	//ctx 는 한 페이지 안에 여러 플래시 업로더 인스턴스가 있을 때 구분하기 위한 용도, ctx를 따로 주지 않는 경우 빈 문자열을 반환한다. 

	//callback : 에러 발생 시 호출
	on_error: function(msg, ctx){
		//alert(ctx+"_error:"+msg);
	},
	//callback : 파일 브라우저 창에서 취소 할 때 호출
	on_browse_cancel: function(hasError, ctx){
		//alert(ctx+"_browse_cancel");
	},
	//callback : 파일 브라우저에서 파일 선택 후 확인 시 호출
	on_upload_start: function(ctx){
	},
	//callback : 파일 업로드가 시작 될 때 호출 - 파일을 3개 선택했으면 3번 호출
	on_upload_open: function(name, size, type, ctx){
	},
	//callback : 전체 선택 파일의 업로드 량 변화 시 호출 - 퍼센트
	on_upload_progress: function(percent, ctx){
	},
	//callback : 파일 업로드가 끝났을 때 호출 - result 는 이전 카페 php 모듈의 리턴값과 동일, 파일 3개를 올렸으면 3번 호
	on_upload_complete: function(result, ctx){
		var info = result.split('|');
		if( ctx == "1" ) {
			var	oProfileImage = document.getElementById("profileimage");
			var	oProfileImageName = document.getElementById("profileimagename");
			var	oProfileImageHandler = document.getElementById("profileimagehandler");
			oProfileImage.value = info[2];//+"&filename="+info[0];
			oProfileImageName.value = info[0];
			oProfileImageHandler.value = getFhandle(info[2]);
			var	oPimgdel = document.getElementById("pimgdel");
			oPimgdel.value = "N";
			setImg(0, oProfileImage, null, null, info[0]);
			var oDelBtn = document.getElementById("delBtn");
			oDelBtn.style.display = "block";
		} else if( ctx == "2" ) {
			var	oMyconImage = document.getElementById("Myconimage");
			var	oMyconImageName = document.getElementById("Myconimagename");
			var	oMyconImageHandler = document.getElementById("Myconimagehandler");
			info[2] = info[2].replace("attach", "M21x21");
			//previewImageReady(info[1]+"&width=21&height=21&type=FORCE&filename="+info[6]);
			oMyconImage.value = info[2];//+"&filename="+info[0];
			oMyconImageName.value = info[0];
			oMyconImageHandler.value = getFhandle(info[2]);
			UpMycon(0, oMyconImage, info[0]);
		} else if( ctx == "3" ) {
			if( ImageUloader != null ) {
				var	size = parseInt(info[6]);
				if( size > 1024*1024 ) {
					alert('선택된 이미지가 허용된 용량을 초과하였습니다.');
				} else {
					ImageUloader.setUploadedImage('userBg', info[2], info[0]);
				}
			}
		} else if( ctx == "4" ) {
			if( ImageUloader != null ) {
				var	size = parseInt(info[6]);
				if( size > 1024*1024 ) {
					alert('선택된 이미지가 허용된 용량을 초과하였습니다.');
				} else {
					ImageUloader.setUploadedImage('userTitleBg', info[2], info[0]);
				}
			}
		} else if( ctx == "5_1" ) {
			if( ImageUloader != null ) {
				var	size = parseInt(info[6]);
				if( size > 1024*1024 ) {
					alert('선택된 이미지가 허용된 용량을 초과하였습니다.');
				} else {
					ImageUloader.setUploadedImage('userSidebar', info[2], info[0], 'userSideTopBg');
				}
			}
		} else if( ctx == "5_2" ) {
			if( ImageUloader != null ) {
				var	size = parseInt(info[6]);
				if( size > 1024*1024 ) {
					alert('선택된 이미지가 허용된 용량을 초과하였습니다.');
				} else {
					ImageUloader.setUploadedImage('userSidebar', info[2], info[0], 'userSideMidBg');
				}
			}
		} else if( ctx == "5_3" ) {
			if( ImageUloader != null ) {
				var	size = parseInt(info[6]);
				if( size > 1024*1024 ) {
					alert('선택된 이미지가 허용된 용량을 초과하였습니다.');
				} else {
					ImageUloader.setUploadedImage('userSidebar', info[2], info[0], 'userSideBotBg');
				}
			}
		} else if( ctx == "6" ) {
			var	bookmarkUploadFile = document.getElementById("bookmarkUploadFile");
			var	bookmarkUploadFileName = document.getElementById("bookmarkUploadFileName");
			var	bookmarkUploadFileHandler = document.getElementById("bookmarkUploadFileHandler");
			bookmarkUploadFile.value = info[2]+"&filename="+info[0];
			oMyconImageName.value = info[0];
			oMyconImageHandler.value = getFhandle(info[2]);
		}else {
			alert('잘못된 요청이 들어왔습니다.');
		}
	},
	//callback : 모든 업로드가 끝났을 때 호출
	on_upload_finish: function(ctx){
	},
	//callback : 파일 액티베이트가  끝났을 때 호출 - 현재 파일서버들은 자동 액티베이트 방식이기 때문에 호출되지 않는다.
	on_activate_complete: function(result, ctx){
		//alert(ctx+"_upload_complete:\n"+result);
	},
	//callback : 파일 액티베이트가  모두 끝났을 때 호출 - 현재 파일서버들은 자동 액티베이트 방식이기 때문에 호출되지 않는다.
	on_activate_finish: function(ctx){
		//alert(ctx+"_activate_finish");
	},
	//callback : 설정해놓은 파일 사이즈보다  큰 파일을 선택했을 경우
	on_over_filesize: function(filenames, maxsize, ctx){
		//alert(ctx+"_oversize:"+filenames+","+maxsize);
	},
	//callback : 설정해놓은 파일 개수보다  많이  파일을 선택했을 경우
	on_over_filecount: function(overcount, maxcount, ctx){
		//alert(ctx+"_overcount:"+overcount+","+maxcount);
	},
	//callback : 설정해놓은 전체 파일 사이즈 파일를 넘게 선택했을 경우
	on_over_filequota: function(overquota, maxquota, ctx){
		//alert(ctx+"_overquota:"+overquota+","+maxquota);
	},
	//callback : 용량이나 개수 제한이 업로드 도중 넘을 경우 해당 파일은 SKIP
	on_upload_skip: function(name, size, type, ctx){
		//alert(ctx+"_upload_skip:"+name);
	}
};

function skipid(id) {
	if(document.getElementById(id)){
		document.getElementById(id).focus();
	}
}

function clone(obj, deep) {
    if(obj == null) return null;
    var objectClone = new obj.constructor();
    for(var property in obj){
        if(!deep){
            objectClone[property] = obj[property];
        }else if (typeof obj[property] == 'object'){
            objectClone[property] = arguments.callee(obj[property], deep);
        }else{
            objectClone[property] = obj[property];
        }
    }
    return objectClone;
}

// 게시글 플래시 뷰어용 minidaum.vm 으로 이동
//var articleTitleVer = '$Globals.getVersion("articleTitle_ver")';
var params = {
	allowscriptaccess: 'always',
	quality: 'high',
	wmode: 'transparent',
	base: 'http://cafeimg.daum-img.net/cf_img4/affogato/'
}

ArticleViewerManager = function(flashid, flashvars) {
	if (typeof flashid =="undefined" || typeof flashvars != "object") return;
	
	this.flashid = flashid;
	this.flashvars = flashvars;

	this.generateFlashViewer();
}

ArticleViewerManager.prototype = {
	generateFlashViewer: function() {
		var attributes = {
			id: this.flashid,
			name: this.flashid
		}
		swfobject.embedSWF('http://cafeimg.daum-img.net/cf_img4/affogato/articletitle.swf?'+ articleTitleVer, this.flashid, this.flashvars.width, '20', '9.0.124', false, this.flashvars, params, attributes);
	},
	resizeFlashViewer: function(width, height, title) {
		var textid = this.flashid.replace('Flash', 'Text');
		
		document.getElementById(textid).style.display = "none";
		//document.getElementById(this.flashid).style.width = width+"px";
		document.getElementById(this.flashid).style.height = height+"px";
		document.getElementById(this.flashid).style.display = "block";
		if(title) document.getElementById(this.flashid).title = title;
	}
}

function rewriteStylesheet(styleTagId, cssText){
    var styleEl = document.getElementById(styleTagId);
    if(styleEl.styleSheet){// IE
        styleEl.styleSheet.cssText = cssText;
    }else{// the world
		styleEl.innerText = cssText;
    }
}

function purge(d, depth) {
	depth = depth || 1;
	if(depth > 6) return ; // follow only Nth depth...
	
    var a = d.attributes, i, l, n;
    if (a) {
        l = a.length;
        for (i = 0; i < l; i += 1) {
            n = a[i].name;
            if (typeof d[n] === 'function') {
                d[n] = null;
            }
        }
    }
    a = d.childNodes;
    if (a) {
        l = a.length;
        for (i = 0; i < l; i += 1) {
            purge(d.childNodes[i], depth + 1);
        }
    }
    //setTimeout("daum.Event.GC()", 1000);
}

var templateCache =  {};
function getTemplateString(path, contextObject){
	if(templateCache[path]){
		return templateCache[path].process(contextObject);
	}else{
		var templateContentStr = Ajax.getTemplate(path);
		templateCache[path] = TrimPath.parseTemplate(templateContentStr);
		return templateCache[path].process(contextObject);
	}	
}

Ajax = {
	getRequest: function(){
		var xmlhttp;
		try{ //to get the mozilla httprequest object
			xmlhttp = new XMLHttpRequest();
		}catch(e){
			try{ //to get MS HTTP request object
				xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
			}catch(e){
				try{ //to get MS HTTP request object
					xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
				}catch(e){
					throw "Unable to get an HTTP request object";
				}
			}
		}
		return xmlhttp;
	},
	sendRequest: function(url){
		var xmlhttp = this.getRequest();
		try{
			xmlhttp.open("GET", url, false);
			xmlhttp.send(null);
		}catch(e){ }
	},
	getText: function(url, callback, failCallback) {
		var xmlhttp = this.getRequest();
		try{
			xmlhttp.open("GET", url, false);
			xmlhttp.send(null);
			if(xmlhttp.readyState == 4 && xmlhttp.status == 200 || xmlhttp.status == 304){
				callback(xmlhttp.responseText);
			}else if(xmlhttp.readyState == 4){
				if(typeof failCallback=="function") failCallback();
			}
		}catch(e){}
	},
	getJson: function(url, callback, failCallback) {
		var xmlhttp = this.getRequest();
		try{
			xmlhttp.open("GET", url, false);
			xmlhttp.send(null);
			if(xmlhttp.readyState == 4 && xmlhttp.status == 200 || xmlhttp.status == 304){
				callback(daum.jsonToObject(xmlhttp.responseText));
			}else if(xmlhttp.readyState == 4){
				if(typeof failCallback=="function") failCallback();
			}
		}catch(e){}
	},
	getScript: function(url, isXml) {
		var xmlhttp = this.getRequest();
		try{
			xmlhttp.open("GET", url, false);
			xmlhttp.send(null);
			if(xmlhttp.readyState == 4 && xmlhttp.status == 200 || xmlhttp.status == 304){
			if(isXml){
				var response = xmlhttp.responseXML;
			}else{
				var response = xmlhttp.responseText;
			}
				return response;
			}
		}catch(e){
			throw "Unable to load script, URL: "+url;
		}
	},
	getTemplate: function(path){
		if(typeof jstTemplates=="undefined") jstTemplates = {};
		if(!jstTemplates[path]){
			var url = "/UX-JS_2008/jst/"+path+"?dummy="+new Date().getTime();
			jstTemplates[path] = this.getScript(url);
		}
		return jstTemplates[path];
	}
}

/**
 * yyyy년 MM월 dd일 hh시 mm분 ss초 tt밀리세컨드
 * @param {Object} format
 */
Date.prototype.format = function(format) {
    var result = "";
	var str = "";
    for (var i = 0; i < format.length; i++) {
		if(str=="") str = format.charAt(i);
		if(i+1<format.length && format.charAt(i)==format.charAt(i+1)){
			str += format.charAt(i+1);
		}else{
			result += this.change(str.charAt(0),str.length);
			str = "";
		}			
    }
    return result;
}

Date.prototype.change = function(ch, len) {
	var str = "";
	var delim = "0";
    switch (ch){
	    case "y":
	        str = this.getFullYear();
			break;
		case "M":
	        str = this.getMonth()+1;
			break;
		case "d":
			str = this.getDate();
			break;
		case "h":
			str = this.getHours();
			break;
		case "m":
			str = this.getMinutes();
			break;
		case "s":
			str = this.getSeconds();
			break;
		case "t":
			str = this.getMilliseconds();
			break;
	    default:
	        str = ch;
			delim = ch;
			break;
    }
	return str.toString().lpad(delim,len);
}

String.prototype.lpad = function(ch, len){
	var gap =  this.length-len;
	var str = this;
	if(gap==0) return this;
	if(gap>0){
		if(this.length==4){
			return this.substring(gap,this.length);	
		}else{
			return this;
		}		
	}else{
		while(gap<0){
			str = ch+str;
			gap++;
		}
		return str;
	}
}

String.prototype.escapeHtml = function(){
	var str = this;
	str = str.replace(/&/g,"&amp;");
	str = str.replace(/</g,"&lt;");
	str = str.replace(/>/g,"&gt;");
	str = str.replace(/'/g,"&#39;");
	str = str.replace(/"/g,'&#34;');
	return str;
}

String.prototype.unescapeHtml = function(){
	var str = this;
	str = str.replace(/&amp;/g,"&");
	str = str.replace(/&lt;/g,"<");
	str = str.replace(/&gt;/g,">");
	str = str.replace(/&#39;/g,"'");
	str = str.replace(/&#34;/g,'"');
	return str;
}

var Effect = function(effectKind, option){
    this.effectKind = effectKind;
    this.timer = null;
    this.work = true;
    this.option = {perTime: 30, speed: 2};
    this.option = daum.extend(this.option, option, true);
    var me = this;
    switch(this.effectKind){
		case "SCROLL_TOP":
			if(!window.EFFECT_SCROLL_TOP){
				window.EFFECT_SCROLL_TOP = [];
			}else if(window.EFFECT_SCROLL_TOP[me.option.target]){
				window.EFFECT_SCROLL_TOP[me.option.target].clearTimer();
			}
			window.EFFECT_SCROLL_TOP[me.option.target] = me;
			this.target = $E(this.option.target);
			this.top = this.option.top;
			this.effectTop = this.target.scrollTop;
			this.timer = setInterval(me.scrollTop.bind(me),me.option.perTime);
			break;
	}
}

Effect.prototype = {
	scrollTop: function(){
		var top = this.effectTop;
		var gap = this.top - top;
		var perGap = 0;
		if((Math.abs(gap)>1) && this.work){
			perGap = parseInt(Math.sqrt(Math.abs(gap))*this.option.speed);
			perGap = perGap*((gap>0)?1:-1);
			top = top + perGap;
			this.effectTop = top;
			this.target.scrollTop = top;
		}else{
			this.target.scrollTop = this.top;
			this.clearTimer();
		}
	},
	clearTimer: function(){
		this.work = false;
		if(this.timer){
			clearInterval(this.timer);
			this.timer = null;
		}
	}
}

var RestrictedTextArea = function(el, config) {
		this.textArea = $E(el);
		if (!this.textArea) return;
		
		this.defaultHeight = (daum.Browser.ie) ? 32 : 30;
		this.rowHeight = 15;
		this.maxRows = 5;
		this.limitBytes = 40;
		this.isUseLimitBytes = false;
		this.flashViewer = null;
		if (typeof config != "undefined") daum.extend(this, config, true);
		this.maxHeight = this.rowHeight * this.maxRows;

		this.textArea.style.overflow = "hidden";
		this.textArea.style.fontSize = "12px";
		this.textArea.style.lineHeight = this.rowHeight.px();

		this.setTextBoxHeight();
		if (this.isUseLimitBytes) this.generateBytesMarkup();

		this.registKeyEvent();
	}

RestrictedTextArea.prototype = {
	registKeyEvent: function() {
		daum.Event.addEvent(this.textArea, 'focus', this.checkTextAreaContent.bind(this));
		daum.Event.addEvent(this.textArea, 'blur', this.outTextArea.bind(this));
		daum.Event.addEvent(this.textArea, 'keydown', this.onDownTextArea.bindAsEventListener(this));
		if (daum.Browser.op) {
			daum.Event.addEvent(this.textArea, 'keypress', this.onDownTextArea.bindAsEventListener(this));
			daum.Event.addEvent(this.textArea, 'keyup', this.onDownTextArea.bindAsEventListener(this));
		}
		if (!daum.Browser.ff && this.flashViewer) daum.Event.addEvent(this.textArea, 'keyup', this.onChangeFlashViewer.bindAsEventListener(this)); 
	},
	generateBytesMarkup: function() {
		var bytesMarkup = '<p><span id="'+ this.textArea.id +'_byte">0</span>/'+ this.limitBytes +'bytes</p>';
		var bytesTextTag = $E(new daum.Template(bytesMarkup).toElement());

		this.textArea.parentNode.appendChild(bytesTextTag);
	},
	checkTextAreaContent: function() {
		if (daum.Browser.cr) { // 텍스트박스 높이값
			var textScrollHeight =  this.textArea.scrollHeight - 4;
		} else {
			var textScrollHeight =  this.textArea.scrollHeight;
		}
		this.changeTextBoxHeight(textScrollHeight);
		if (this.isUseLimitBytes) this.checkTextLength();
		
		var textObj = this;
		this.checkTimer = setTimeout(textObj.checkTextAreaContent.bind(textObj), 10);
	},
	setTextBoxHeight: function() {
		if (this.textArea.value.indexOf('\n')>-1) {
			var rows = parseInt(this.textArea.value.match(/\n/g).length)+1;
			if (daum.Browser.ie) {
				this.textArea.style.height = ((rows*this.rowHeight) + 2).px();
			} else {
				this.textArea.style.height = (rows*this.rowHeight).px();
			}
		}
	},
	changeTextBoxHeight: function(textScrollHeight) {
		// 텍스트박스 높이값 체크
		if ((!daum.Browser.ie && textScrollHeight > this.maxHeight) || (daum.Browser.ie && textScrollHeight > this.maxHeight+4)) {
			if (daum.Browser.ie) {
				this.textArea.style.height = (textScrollHeight-(this.rowHeight+1)).px();
			} else {
				this.textArea.style.height = (textScrollHeight-this.rowHeight).px();
			}

			this.textArea.blur();
			this.textArea.value = this.textArea.value.substr(0, this.textArea.value.length-1);
		}  else {
			if (this.textArea.value.indexOf('\n')==-1 && textScrollHeight <= this.defaultHeight) { // 줄바꿈이 없다면
				this.textArea.style.height = this.defaultHeight.px();
			} else { // 평소에는 그냥 체크해서 변경
				this.textArea.style.height = textScrollHeight.px();
			}
		}
	},
	checkTextLength: function() {
		if(!this.tmpStr) this.tmpStr = ""; 
		var str = this.textArea.value;

		if(this.tmpStr != str){
			if (str.bytes() > this.limitBytes){
				this.textArea.blur();
				this.textArea.value = this.textArea.value.cut(this.limitBytes, '');
				$(this.textArea.id +'_byte').innerHTML = this.textArea.value.bytes();
			     alert("최대 " + this.limitBytes + "bytes이므로 초과된 글자수는 자동으로 삭제됩니다.");
				 if (this.flashViewer) this.onChangeFlashViewer();
		     } else {
				$(this.textArea.id +'_byte').innerHTML = str.bytes();
			}		
			this.tmpStr = this.textArea.value;
			if (daum.Browser.ff && this.flashViewer) this.onChangeFlashViewer();
		}
	},
	outTextArea: function() {
		if (this.textArea.value.trim()=="") {
			//alert('설명을 입력해주세요.');
			this.onChangeFlashViewer();
			if (typeof this.outEventFunc != "undefined") this.outEventFunc();
		}
		clearTimeout(this.checkTimer);
	},
	onDownTextArea: function(ev) {
		// 줄수 체크
		if (ev.keyCode=="13" && this.textArea.value.indexOf('\n')>-1) { // enter
			if (this.textArea.value.match(/\n/g).length == this.maxRows-1)  {
				daum.Event.stopEvent(ev);
				return;
			}
		}

		if ((ev.keyCode=="8" || ev.keyCode=="46") &&  this.textArea.value.indexOf('\n')>-1) { // backspace or delete
			if (this.textArea.value.indexOf('\n')>-1 && this.textArea.value.match(/\n/g).length > 1) {
				var height = (this.textArea.value.match(/\n/g).length+1) * this.rowHeight;
				if (daum.Browser.ie) {
					this.textArea.style.height = (height+2).px();
				} else {
					this.textArea.style.height = height.px();	
				}
			}
		}
	},
	onChangeFlashViewer: function(){
		if (this.textArea.value.trim() == "") {
			$E(this.flashViewer).setWidth(1);
			$E(this.flashViewer).setHeight(1);
		} else {
			if (typeof $(this.flashViewer).updateDisplay == "function") {
				$(this.flashViewer).updateDisplay({
					'text': this.textArea.value
				});
			}
		}
	}
}

// Ultimate client-side JavaScript client sniff. Version 3.03
// (C) Netscape Communications 1999-2001.  Permission granted to reuse and distribute.
// Revised 17 May 99 to add is_nav5up and is_ie5up (see below).
// Revised 20 Dec 00 to add is_gecko and change is_nav5up to is_nav6up
//                      also added support for IE5.5 Opera4&5 HotJava3 AOLTV
// Revised 22 Feb 01 to correct Javascript Detection for IE 5.x, Opera 4, 
//                      correct Opera 5 detection
//                      add support for winME and win2k
//                      synch with browser-type-oo.js
// Revised 26 Mar 01 to correct Opera detection
// Revised 02 Oct 01 to add IE6 detection

// Everything you always wanted to know about your JavaScript client
// but were afraid to ask. Creates "is_" variables indicating:
// (1) browser vendor:
//     is_nav, is_ie, is_opera, is_hotjava, is_webtv, is_TVNavigator, is_AOLTV
// (2) browser version number:
//     is_major (integer indicating major version number: 2, 3, 4 ...)
//     is_minor (float   indicating full  version number: 2.02, 3.01, 4.04 ...)
// (3) browser vendor AND major version number
//     is_nav2, is_nav3, is_nav4, is_nav4up, is_nav6, is_nav6up, is_gecko, is_ie3,
//     is_ie4, is_ie4up, is_ie5, is_ie5up, is_ie5_5, is_ie5_5up, is_ie6, is_ie6up, is_hotjava3, is_hotjava3up,
//     is_opera2, is_opera3, is_opera4, is_opera5, is_opera5up
// (4) JavaScript version number:
//     is_js (float indicating full JavaScript version number: 1, 1.1, 1.2 ...)
// (5) OS platform and version:
//     is_win, is_win16, is_win32, is_win31, is_win95, is_winnt, is_win98, is_winme, is_win2k
//     is_os2
//     is_mac, is_mac68k, is_macppc
//     is_unix
//     is_sun, is_sun4, is_sun5, is_suni86
//     is_irix, is_irix5, is_irix6
//     is_hpux, is_hpux9, is_hpux10
//     is_aix, is_aix1, is_aix2, is_aix3, is_aix4
//     is_linux, is_sco, is_unixware, is_mpras, is_reliant
//     is_dec, is_sinix, is_freebsd, is_bsd
//     is_vms
//
// See http://www.it97.de/JavaScript/JS_tutorial/bstat/navobj.html and
// http://www.it97.de/JavaScript/JS_tutorial/bstat/Browseraol.html
// for detailed lists of userAgent strings.
//
// Note: you don't want your Nav4 or IE4 code to "turn off" or
// stop working when new versions of browsers are released, so
// in conditional code forks, use is_ie5up ("IE 5.0 or greater") 
// is_opera5up ("Opera 5.0 or greater") instead of is_ie5 or is_opera5
// to check version in code which you want to work on future
// versions.

    // convert all characters to lowercase to simplify testing
    var agt=navigator.userAgent.toLowerCase();
    // *** BROWSER VERSION ***
    // Note: On IE5, these return 4, so use is_ie5up to detect IE5.
    var is_major = parseInt(navigator.appVersion);
    var is_minor = parseFloat(navigator.appVersion);

    // Note: Opera and WebTV spoof Navigator.  We do strict client detection.
    // If you want to allow spoofing, take out the tests for opera and webtv.
    var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
                && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
    var is_nav2 = (is_nav && (is_major == 2));
    var is_nav3 = (is_nav && (is_major == 3));
    var is_nav4 = (is_nav && (is_major == 4));
    var is_nav4up = (is_nav && (is_major >= 4));
    var is_navonly      = (is_nav && ((agt.indexOf(";nav") != -1) ||
                          (agt.indexOf("; nav") != -1)) );
    var is_nav6 = (is_nav && (is_major == 5));
    var is_nav6up = (is_nav && (is_major >= 5));
    var is_gecko = (agt.indexOf('gecko') != -1);

	var is_safari = (agt.indexOf('safari') != -1);
	
    var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
    var is_ie3    = (is_ie && (is_major < 4));
    var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
    var is_ie4up  = (is_ie && (is_major >= 4));
    var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
    var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
    var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
    var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
    var is_ie6    = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
    var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);
	var is_ie7 = (is_ie && (is_major == 4) && (agt.indexOf("msie 7.")!=-1));

    // KNOWN BUG: On AOL4, returns false if IE3 is embedded browser
    // or if this is the first browser window opened.  Thus the
    // variables is_aol, is_aol3, and is_aol4 aren't 100% reliable.
    var is_aol   = (agt.indexOf("aol") != -1);
    var is_aol3  = (is_aol && is_ie3);
    var is_aol4  = (is_aol && is_ie4);
    var is_aol5  = (agt.indexOf("aol 5") != -1);
    var is_aol6  = (agt.indexOf("aol 6") != -1);

    var is_opera = (agt.indexOf("opera") != -1);
    var is_opera2 = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1);
    var is_opera3 = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1);
    var is_opera4 = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1);
    var is_opera5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1);
    var is_opera5up = (is_opera && !is_opera2 && !is_opera3 && !is_opera4);

    var is_webtv = (agt.indexOf("webtv") != -1); 

    var is_TVNavigator = ((agt.indexOf("navio") != -1) || (agt.indexOf("navio_aoltv") != -1)); 
    var is_AOLTV = is_TVNavigator;

    var is_hotjava = (agt.indexOf("hotjava") != -1);
    var is_hotjava3 = (is_hotjava && (is_major == 3));
    var is_hotjava3up = (is_hotjava && (is_major >= 3));

    // *** JAVASCRIPT VERSION CHECK ***
    var is_js;
    if (is_nav2 || is_ie3) is_js = 1.0;
    else if (is_nav3) is_js = 1.1;
    else if (is_opera5up) is_js = 1.3;
    else if (is_opera) is_js = 1.1;
    else if ((is_nav4 && (is_minor <= 4.05)) || is_ie4) is_js = 1.2;
    else if ((is_nav4 && (is_minor > 4.05)) || is_ie5) is_js = 1.3;
    else if (is_hotjava3up) is_js = 1.4;
    else if (is_nav6 || is_gecko) is_js = 1.5;
    // NOTE: In the future, update this code when newer versions of JS
    // are released. For now, we try to provide some upward compatibility
    // so that future versions of Nav and IE will show they are at
    // *least* JS 1.x capable. Always check for JS version compatibility
    // with > or >=.
    else if (is_nav6up) is_js = 1.5;
    // NOTE: ie5up on mac is 1.4
    else if (is_ie5up) is_js = 1.3

    // HACK: no idea for other browsers; always check for JS version with > or >=
    else is_js = 0.0;

    // *** PLATFORM ***
    var is_win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
    // NOTE: On Opera 3.0, the userAgent string includes "Windows 95/NT4" on all
    //        Win32, so you can't distinguish between Win95 and WinNT.
    var is_win95 = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1));

    // is this a 16 bit compiled version?
    var is_win16 = ((agt.indexOf("win16")!=-1) || 
               (agt.indexOf("16bit")!=-1) || (agt.indexOf("windows 3.1")!=-1) || 
               (agt.indexOf("windows 16-bit")!=-1) );  

    var is_win31 = ((agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("win16")!=-1) ||
                    (agt.indexOf("windows 16-bit")!=-1));

    var is_winme = ((agt.indexOf("win 9x 4.90")!=-1));
    var is_win2k = ((agt.indexOf("windows nt 5.0")!=-1));

    // NOTE: Reliable detection of Win98 may not be possible. It appears that:
    //       - On Nav 4.x and before you'll get plain "Windows" in userAgent.
    //       - On Mercury client, the 32-bit version will return "Win98", but
    //         the 16-bit version running on Win98 will still return "Win95".
    var is_win98 = ((agt.indexOf("win98")!=-1) || (agt.indexOf("windows 98")!=-1));
    var is_winnt = ((agt.indexOf("winnt")!=-1) || (agt.indexOf("windows nt")!=-1));
    var is_win32 = (is_win95 || is_winnt || is_win98 || 
                    ((is_major >= 4) && (navigator.platform == "Win32")) ||
                    (agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1));

    var is_os2   = ((agt.indexOf("os/2")!=-1) || 
                    (navigator.appVersion.indexOf("OS/2")!=-1) ||   
                    (agt.indexOf("ibm-webexplorer")!=-1));

    var is_mac    = (agt.indexOf("mac")!=-1);
    // hack ie5 js version for mac
    if (is_mac && is_ie5up) is_js = 1.4;
    var is_mac68k = (is_mac && ((agt.indexOf("68k")!=-1) || 
                               (agt.indexOf("68000")!=-1)));
    var is_macppc = (is_mac && ((agt.indexOf("ppc")!=-1) || 
                                (agt.indexOf("powerpc")!=-1)));

    var is_sun   = (agt.indexOf("sunos")!=-1);
    var is_sun4  = (agt.indexOf("sunos 4")!=-1);
    var is_sun5  = (agt.indexOf("sunos 5")!=-1);
    var is_suni86= (is_sun && (agt.indexOf("i86")!=-1));
    var is_irix  = (agt.indexOf("irix") !=-1);    // SGI
    var is_irix5 = (agt.indexOf("irix 5") !=-1);
    var is_irix6 = ((agt.indexOf("irix 6") !=-1) || (agt.indexOf("irix6") !=-1));
    var is_hpux  = (agt.indexOf("hp-ux")!=-1);
    var is_hpux9 = (is_hpux && (agt.indexOf("09.")!=-1));
    var is_hpux10= (is_hpux && (agt.indexOf("10.")!=-1));
    var is_aix   = (agt.indexOf("aix") !=-1);      // IBM
    var is_aix1  = (agt.indexOf("aix 1") !=-1);    
    var is_aix2  = (agt.indexOf("aix 2") !=-1);    
    var is_aix3  = (agt.indexOf("aix 3") !=-1);    
    var is_aix4  = (agt.indexOf("aix 4") !=-1);    
    var is_linux = (agt.indexOf("inux")!=-1);
    var is_sco   = (agt.indexOf("sco")!=-1) || (agt.indexOf("unix_sv")!=-1);
    var is_unixware = (agt.indexOf("unix_system_v")!=-1); 
    var is_mpras    = (agt.indexOf("ncr")!=-1); 
    var is_reliant  = (agt.indexOf("reliantunix")!=-1);
    var is_dec   = ((agt.indexOf("dec")!=-1) || (agt.indexOf("osf1")!=-1) || 
           (agt.indexOf("dec_alpha")!=-1) || (agt.indexOf("alphaserver")!=-1) || 
           (agt.indexOf("ultrix")!=-1) || (agt.indexOf("alphastation")!=-1)); 
    var is_sinix = (agt.indexOf("sinix")!=-1);
    var is_freebsd = (agt.indexOf("freebsd")!=-1);
    var is_bsd = (agt.indexOf("bsd")!=-1);
    var is_unix  = ((agt.indexOf("x11")!=-1) || is_sun || is_irix || is_hpux || 
                 is_sco ||is_unixware || is_mpras || is_reliant || 
                 is_dec || is_sinix || is_aix || is_linux || is_bsd || is_freebsd);

    var is_vms   = ((agt.indexOf("vax")!=-1) || (agt.indexOf("openvms")!=-1));


var isIEVersion = ((navigator.userAgent.toLowerCase().indexOf("msie") != -1) && (navigator.userAgent.toLowerCase().indexOf("opera") == -1));

	function sendSubscriber(formObj, flag) {
//		alert("준비중인 기능입니다.");
//		return;
		formObj.flag.value = flag;
		formObj.submit();

		/** GET 방식으로 보낼 경우 */
		/*
		var page = formObj.action+"?";
		page += "blogid="+formObj.blogid.value;
		page += "&flag="+formObj.flag.value;
		page += "&applymail="+formObj.applymail.value;
		page += "&terminatemail="+formObj.terminatemail.value;
		self.location.href = page;
		*/
	}

	function copyTrackback(str) {
		if(copyclipboard(str)) {
			alert("엮인글 주소가 클립보드에 복사되었습니다.");
		}
	}

	function goArticleView(blogID, articleNo){	
//		location.href="/_blog/ArticleView.do?blogID="+blogID+"&articleNo="+articleNo;
//		location.href="/_blog/ArticleView.do?blogid=$BLOGID&articleNo="+articleNo;
		location.href="/_blog/BlogView.do?blogid="+blogID+"&articleno="+articleNo;
	}

	function clickArticle(no) {
		scrapform.articleno.value = no;
		var title = document.getElementById("title_"+no).innerHTML;
		scrapform.title.value = title;
	}

    function clickDssArticle(no,folderid) {
        scrapform.data_id.value = no;
        scrapform.folder_id.value = folderid;
        var title = document.getElementById("title_"+no).innerHTML;
        scrapform.title.value = title;
    }

	function goScrapPlanet() {
		winOpenPlanet(scrapform.url.value,scrapform.blogid.value,scrapform.articleno.value,scrapform.title.value,scrapform.goplanet.value, scrapform.source2.value, scrapform.blogtitle.value, scrapform.blogdaumname.value);
	}
	function goScrapCafe() {
		winOpen(scrapform.blogid.value,scrapform.articleno.value,scrapform.gocafe.value);
	}
	function goScrapBlog() {
		scrapOpen(scrapform.blogid.value, scrapform.articleno.value, scrapform.flag.value, scrapform.goblog.value);
	}
	function goDssPlanet() {
		var oScrapForm = document.scrapform;
        scrapDssOpen(oScrapForm.location_id.value,oScrapForm.folder_id.value,oScrapForm.data_id.value,oScrapForm.source_location_code.value,oScrapForm.source_etc.value, oScrapForm.goplanet.value);
    }
	function goDssCafe() {
		var oScrapForm = document.scrapform;
        scrapDssOpen(oScrapForm.location_id.value,oScrapForm.folder_id.value,oScrapForm.data_id.value,oScrapForm.source_location_code.value,oScrapForm.source_etc.value, oScrapForm.gocafe.value);
    }
    function goDssBlog() {
    	var oScrapForm = document.scrapform;
        scrapDssOpen(oScrapForm.location_id.value,oScrapForm.folder_id.value,oScrapForm.data_id.value,oScrapForm.source_location_code.value,oScrapForm.source_etc.value, oScrapForm.goblog.value);
    }
    function goDssMail() {
    	var oScrapForm = document.scrapform;
        scrapDssOpen(oScrapForm.location_id.value,oScrapForm.folder_id.value,oScrapForm.data_id.value,oScrapForm.source_location_code.value,oScrapForm.source_etc.value, oScrapForm.gomail.value);
    }
    function goDssYozm(title,imgurl,videokey) {
		var oScrapForm = document.scrapform;
		var tvpotKey = videokey;
		var imageUrl = "";
		
		if(tvpotKey != null && tvpotKey.length > 0){
			imageUrl = "&meta=DTV&imgurl="+encodeURIComponent(imgurl)+"&key="+tvpotKey;
		}else{
			if(imgurl != null && imgurl.indexOf('http://') > -1){
				imageUrl = "&meta=IMG&imgurl="+encodeURIComponent(imgurl);
			}
		}
		window.open(oScrapForm.goyozm.value+'&link='+encodeURIComponent('http://blog.daum.net/'+BLOGNAME+'/'+oScrapForm.data_id.value)+imageUrl+'&prefix='+encodeURIComponent(title)+'&callback=successScrapToYozm&crossdomain=1', 'yozmSend', 'width=466, height=356');
    }
    
    function successScrapToYozm(daumid, yozmid){
		var oScrapForm = document.scrapform;
		loadXMLDocWithParam("GET","/_blog/yozmSend.ajax?blogid="+oScrapForm.location_id.value+"&articleno="+oScrapForm.data_id.value+"&scrapdaumid="+daumid+"&yozmid="+yozmid,null,"afterDssYozm",null,null);
	}
    function afterDssYozm(xmlhttp,obj){
		xmlhttp = null;
	}
	function commOpen(url, params) {
		var page = url;
		if(params != '') {
			page = url+"?"+params;
		}
		//var opts = "scrollbars=yes,status=no,toolbar=no,resizable=1,location=no,menu=no,width=600,height=600";
		//window.open(page,"winopen",opts);


		clickAreaCheck = true;
	    var str = "<div class='secret'><div style='padding:7px 5px 0px;'><font style='font-size:12px; color:#161615;'>비밀번호를 입력해주세요.&nbsp;</font><br /><br style='font-size:2px;'>";
	    str += "<input type=password id=password2 name=password2 class=box style='width:143px;' onkeydown='clickAreaCheck = true' onfocus='clickAreaCheck = true'><br />";
	    str += "<a href=\"javascript:del('"+deltype+"','"+boardno+"');\"><img src='http://pimg.daum-img.net/blog/p_img/b_layer_ok.gif' width='34' height='16' align='absmiddle' title='확인' vspace='5'></a> <a href='#'><img src='http://pimg.daum-img.net/blog/p_img/b_layer_cancel.gif' width='34' height='16' align='absmiddle' title='취소' vspace='5'></a><br /></div></div>";

	    setNameLayersPosition(curObj, str);
	}

	function goCmmtPwdDel(blogid, atno, no, url, open, curObj, cntdt){

		frm = document.cmmtform;
		frm.blogid.value=blogid;
		frm.articleno.value=atno;
		frm.no.value=no;
		frm.mode.value="D";
		frm.open.value=open;
		frm.regdt.value=cntdt;
		frm.action=url;

		clickAreaCheck = true;
	    var str = "<div class='secret'><div style='padding:7px 5px 0px;'><font style='font-size:12px; color:#161615;'>비밀번호를 입력해주세요.&nbsp;</font><br /><br style='font-size:2px;'>";
	    str += "<input type=password id="+atno+no+" name=cmmtpwd class=box style='width:143px;' onkeydown='clickAreaCheck = true' onfocus='clickAreaCheck = true'><br />";
	    str += "<a href=\"javascript:gocmmtcheck("+atno+no+");\"><img src='http://pimg.daum-img.net/blog/p_img/b_layer_ok.gif' width='34' height='16' align='absmiddle' title='확인' vspace='5'></a> <a href='#'><img src='http://pimg.daum-img.net/blog/p_img/b_layer_cancel.gif' width='34' height='16' align='absmiddle' title='취소' vspace='5'></a><br /></div></div>";

	    setNameLayersPosition(curObj, str);

	}
	function gocmmtcheck(cmmtpwd){
		if(document.getElementById(cmmtpwd).value==""){
			alert("비밀번호를 입력해주세요");
			return;
		}
		document.cmmtform.password.value=document.getElementById(cmmtpwd).value;
		document.cmmtform.submit();
	}

	function goCmmtAdminDel(blogid, atno, no, url, open, cntdt){
		frm = document.cmmtform;
		frm.blogid.value=blogid;
		frm.articleno.value=atno;
		frm.no.value=no;
		frm.mode.value="C";
		frm.regdt.value=cntdt;
		frm.open.value=open;
		frm.action=url;
		frm.submit();
	}
	function goCmmtLoginDel(blogid, atno, no, url, open, cntdt, euserid){
		frm = document.cmmtform;
		frm.blogid.value=blogid;
		frm.articleno.value=atno;
		frm.no.value=no;
		frm.mode.value="C";
		frm.regdt.value=cntdt;
		frm.open.value=open;
		frm.euserid.value=euserid;

		frm.action=url;

		frm.submit();
	}

	function scrapOpen(blogid, atno, flag, url) {
		var params = 'blogid='+blogid+'&articleno='+atno+'&scrapflag='+flag;
		var page = url;
		if(params != '') {
			page = url+"?"+params;
		}
		var opts = "scrollbars=yes,status=no,toolbar=no,resizable=1,location=no,menu=no,width=530,height=350";
		window.open(page,"winopen",opts);

	}

    function scrapDssOpen(location_id, folder_id, data_id, source_location_code, source_etc, url) {
        var params = 'location_id='+location_id+'&folder_id='+folder_id+'&data_id='+data_id+'&source_location_code='+source_location_code+'&source_etc='+source_etc;
        var page = url;
        if(params != '') {
            page = url+"&"+params;
        }
        var opts = "scrollbars=no,status=no,toolbar=no,resizable=1,location=no,menu=no,width=530,height=350";
        window.open(page,"dssOpen",opts);
    }
	function winOpen(blogid, atno, url) {
		var page = url + '?blogid='+blogid+'&articleno='+atno;
		var opts = "scrollbars=yes,status=no,toolbar=no,resizable=1,location=no,menu=no,width=530,height=350";

		window.open(page,"winopen",opts);
	}

	function winOpenPlanet(url, blogid, atno, title, url, source2, blogtitle, blogdaumname) {
		var page = url + '?url='+url+'&blogid='+blogid+'&articleno='+atno+'&title='+title+'&source2='+source2+'&blogtitle='+blogtitle+'&blogdaumname='+blogdaumname;
		var opts = "scrollbars=yes,status=no,toolbar=no,resizable=1,location=no,menu=no,width=530,height=350";

		window.open(page,"winopen",opts);
	}

	function winTrackback(blogid, atno, url, tag) {
		var page = url + '?blogid='+blogid+'&articleno='+atno+'&tagname='+tag;
		var opts = "scrollbars=yes,status=no,toolbar=no,resizable=1,location=no,menu=no,width=530,height=350";

		window.open(page,"winopen",opts);
	}

	function delOpen(blogid, atno, no, url,open) {
		commOpen(url, 'blogid='+blogid+'&articleno='+atno+'&no='+no+'&mode=C&open='+open);
	}

	function delTrackback(obj, blogId, atno, tbno, cntdt){
		var page = '/_blog/TrackbackDelete.do?blogid=' + blogId
		page += '&articleno=' + atno;
		page += '&no=' + tbno;
		page += '&regdt=' + cntdt;
		loadDynamicContent(page);
		alert('엮인글이 삭제되었습니다.');
		goArticleView(blogId, atno);
	}

	function hideTemplate(blogid, listid, flag, menuname, action, pos) {
		var url = action+"?blogid="+blogid+"&listid="+listid+"&openflag="+flag;
		hideframe.location.href = url;
		deleteTemplate(menuname, pos);
	}

	function sendData(){
		frm = document.dataInfo;
		frm.submit();
	}
	function showDeleteVisitLayer(blogid, no) {
		document.getElementById('deleteVisitLayer').style.display = 'block';
		document.getElementById('regBlackList').checked = false;
		var frm = document.deleteVisitForm;
		frm.delBlogId.value = blogid;
		frm.delNo.value = no;
		if (typeof(requestAjaxCheck) == 'function') {
			requestAjaxCheck("action=showDeleteVisitLayer&blogid="+blogid);
		}
	}
	function deleteVisitConfirm() {
		var frm = document.deleteVisitForm;
		deleteVisit(frm.delBlogId.value, frm.delNo.value, '/_blog/VisitDelete.ajax', document.getElementById('regBlackList').checked);
		document.getElementById('deleteVisitLayer').style.display = 'none';
	}
	function deleteVisit(blogid, no, action, isBlackList) {
		var url = action+"?blogid="+blogid+"&no="+no+"&isBlackList="+isBlackList;
	    loadXMLDoc("GET",url, null ,"deleteVisitName","");
	}
	function deleteVisitName(xmlhttp ){
		var xmldoc = getXMLDocument(xmlhttp);
		var items = xmldoc.getElementsByTagName('contents');
		var no =items[0].firstChild.nodeValue;
		var t = document.getElementById("visit_"+no);
		var p = document.getElementById("visit_blogger");
		p.removeChild(t);
	}
	function updateMenu(blogid, listid, flag, action) {
		viewMenu(listid, flag);
		var url = action+"?blogid="+blogid+"&listid="+listid+"&openflag="+flag;
		hideframe.location.href = url;
	}

	function viewMenu(id, flag) {
		if(flag == 'Y') {
			eval('document.all.'+id+'.style.visibility = "visible";');
			eval('document.all.'+id+'.style.display = "block";');
		}
		else {
			eval('document.all.'+id+'.style.visibility = "hidden";');
			eval('document.all.'+id+'.style.display = "none";');
		}
	}

	function moreMenu(id1, id2, id3, flag) {
		if(flag == 'Y') {
			eval('document.all.'+id1+'.style.visibility = "visible";');
			eval('document.all.'+id2+'.style.visibility = "hidden";');
			eval('document.all.'+id3+'.style.visibility = "visible";');
			eval('document.all.'+id1+'.style.display = "block";');
			eval('document.all.'+id2+'.style.display = "none";');
			eval('document.all.'+id3+'.style.display = "block";');
		}
		else {
			eval('document.all.'+id1+'.style.visibility = "hidden";');
			eval('document.all.'+id2+'.style.visibility = "visible";');
			eval('document.all.'+id3+'.style.visibility = "hidden";');
			eval('document.all.'+id1+'.style.display = "none";');
			eval('document.all.'+id2+'.style.display = "block";');
			eval('document.all.'+id3+'.style.display = "none";');
		}
	}

	function submitComment(cmmtObj, loopObj, n, atcno) {
		var cmt = document.getElementById("cmmtcheck"+n).value;

		if(cmt==undefined){
			cmmtObj.articleno.value	= atcno;
			cmmtObj.name.value 		= loopObj.cmmtname.value;
			cmmtObj.open.value 		= loopObj.cmmtopen.value;
			cmmtObj.password.value 	= loopObj.cmmtpwd.value;
			cmmtObj.contents.value 	= loopObj.cmmttext.value;
			if(loopObj.cmmttext.value==""){
				alert("의견을 입력해주세요.");
				return;
			}
			if( loopObj.cmmtopen.checked ) {
				//alert('체크됨');
				cmmtObj.open.value = 'N';
			} else {
				cmmtObj.open.value = 'Y';
			}

			var key = loopObj.cmmtcheck.value;
			var bflag = false;
			if(key != '' && key != '둘 중에 하나만 입력하세요.') {

				if( key.indexOf("@") > 0 && key.indexOf("/") < 0 ) {
					cmmtObj.cmmtmail.value = key;
					bflag = true;
				} else if( key.indexOf("/") > 0 && key.indexOf(".") > 0 && key.indexOf("@") < 0) {

					if(key.indexOf("http://")<0)
						key = "http://"+key;
					cmmtObj.cmmtblog.value = key;
					bflag = true;
				}
			}
			if(bflag) {

				/** GET 방식으로 보낼 경우 */
				/*
				var page = cmmtObj.action+"?";
				page += "blogid="+cmmtObj.blogid.value;
				page += "&articleno="+cmmtObj.articleno.value;
				page += "&name="+cmmtObj.name.value;
				page += "&open="+cmmtObj.open.value;
				page += "&password="+cmmtObj.password.value;
				page += "&cmmtblog="+cmmtObj.cmmtblog.value;
				page += "&cmmtmail="+cmmtObj.cmmtmail.value;
				page += "&contents="+cmmtObj.contents.value;
				self.location.href = page;
				*/

				cmmtObj.submit();
			}else{
				alert("블로그/이메일 형태가 잘못되었습니다.");
				return;
			}
		}else{

			cmmtObj.articleno.value	= atcno;
			cmmtObj.name.value 		= document.getElementById("cmmtname"+n).value;
			cmmtObj.open.value 		= document.getElementById("cmmtopen"+n).value;
			cmmtObj.password.value 	= document.getElementById("cmmtpwd"+n).value;
			cmmtObj.contents.value 	= document.getElementById("cmmttext"+n).value;

			if(cmmtObj.contents.value==""){
				alert("의견을 입력해주세요.");
				return;
			}

			if( document.getElementById("cmmtopen"+n).checked ) {
				//alert('체크됨');
				cmmtObj.open.value = 'N';
			} else {
				cmmtObj.open.value = 'Y';
			}

			var key = document.getElementById("cmmtcheck"+n).value;
			var bflag = false;

			if(key != '' && key != '둘 중에 하나만 입력하세요.') {

				if( key.indexOf("@") > 0 ) {
					cmmtObj.cmmtmail.value = key;
					bflag = true;
				} else if( key.indexOf(".") >0 ){

					if(key.indexOf("http://")<0)
						key = "http://"+key;

					cmmtObj.cmmtblog.value = key;
					bflag = true;
				}
			}

			if(bflag) {

				/** GET 방식으로 보낼 경우 */
				/*
				var page = cmmtObj.action+"?";
				page += "blogid="+cmmtObj.blogid.value;
				page += "&articleno="+cmmtObj.articleno.value;
				page += "&name="+cmmtObj.name.value;
				page += "&open="+cmmtObj.open.value;
				page += "&password="+cmmtObj.password.value;
				page += "&cmmtblog="+cmmtObj.cmmtblog.value;
				page += "&cmmtmail="+cmmtObj.cmmtmail.value;
				page += "&contents="+cmmtObj.contents.value;
				self.location.href = page;
				*/

				cmmtObj.submit();
			}else{
				alert("블로그/이메일 형태가 잘못되었습니다.");
				return;
			}
		}
	}

	function init_text(loopObj, n) {
		if(document.getElementById("cmmtcheck"+n).value=="둘 중에 하나만 입력하세요.")
			document.getElementById("cmmtcheck"+n).value="";
	}

	function goBlog(pagelink) {
		self.location.href=pagelink;
	}

	function goBlackListRegPopup(url) {
		var win = window.open("about:blank", 'blackPopup', 'width=400, height=190');
		var frm = document.forms["blackInfo"];
		if(frm) {
			frm.action = "/_blog/BlackListRegisterConfirm.do";
			frm.jobKind.value="U0703";
			frm.blackConf.value=url;
			frm.blackKind.value="U0604";
			frm.target = 'blackPopup';
			frm.submit();
		}
	}
	
	function goBlackListRegT(loop){
		frm = document.loopform;
		document.blackInfo.jobKind.value=eval("frm.jobKind_"+loop+".value");
		document.blackInfo.blackConf.value=eval("frm.blackConf_"+loop+".value");
		document.blackInfo.blackKind.value="U0602";
		document.blackInfo.submit();
	}
	function goBlackListRegC(loop,cmmtloop){
		frm = document.loopform;

		document.blackInfo.jobKind.value=document.getElementById("jobKind_"+loop+"_"+cmmtloop).value;
		document.blackInfo.blackConf.value=document.getElementById("blackConf_"+loop+"_"+cmmtloop).value;
		document.blackInfo.blackKind.value="U0601";
		document.blackInfo.submit();
	}
	function goBlackListRegC2(loop,cmmtloop){
		frm = document.loopform;
		for(var i=0;i<frm.length;i++){
			if(frm[i].name=="jobKind_"+loop+"_"+cmmtloop){
				document.blackInfo.jobKind.value=frm[i].value;
			}
			if(frm[i].name=="blackConf_"+loop+"_"+cmmtloop){
				document.blackInfo.blackConf.value=frm[i].value;
			}
		}
		document.blackInfo.blackKind.value="U0601";
		document.blackInfo.submit();
	}
	function goBlackListRegB(loop){
		frm = document.loopform;
		document.blackInfo.jobKind.value=eval("frm.jobKind_"+loop+".value");
		document.blackInfo.blackConf.value=eval("frm.blackConf_"+loop+".value");
		document.blackInfo.blackKind.value="U0603";
		document.blackInfo.submit();
	}

	function goBlackListRegV(url){
		var frm = document.forms["blackInfo"];
		if(frm) {
			frm.jobKind.value="U0703";
			frm.blackConf.value=url;
			frm.blackKind.value="U0604";
			frm.submit();
		}
	}

	function goCommentVerify(verifyID,verifyEmail,verifyBlog,articleno){
		frm = document.verifyInfo;
		frm.verifyID.value=verifyID;
		frm.verifyEmail.value=verifyEmail;
		frm.verifyBlog.value=verifyBlog;
		frm.articleno.value=articleno;
		frm.submit();
	}

	// 블로그가 없을 경우는 만드는 팝업으로 유도 해 줍시다요.
	function makeBlogPopup( menuName, blogid ) {
		var		url = "/_blog/proposeMakeBlog.do?blogid="+blogid+"&menu="+menuName;
		window.open(url, 'addfriend', 'width=400, height=190');
	}


// 전체선택, 전체해제
function setChkboxForm(form,fld) {
	form = eval("document."+form);

	for(i = 0; i < form.elements.length; i++){
		if(form.elements[i].type == "checkbox" && form.elements[i].name == fld){
			if(form.elements[i].checked == true){
				form.elements[i].checked = false;
			}else{
				form.elements[i].checked = true;
			}
		}
	}
}

//공백제거(양쪽)

function both_trim(a)
{
	var search = 0

    a = a.replace(/\r\n$/, "");
    while ( a.charAt(search) == " ")
		search = search + 1

	a = a.substring(search, (a.length))
    search = a.length - 1
   	while (a.charAt(search) ==" ")
		search = search - 1

	return a.substring(0, search + 1)
}

//글자바이트수 제한 체크
function cal_byte(aquery,value)
{    var tmpStr;
    var temp=0;
    var onechar;
    var tcount;
    tcount = 0;

    tmpStr = new String(aquery);
    temp = tmpStr.length;

    for (k=0;k<temp;k++)
    {
        onechar = tmpStr.charAt(k);
        if (escape(onechar) =='%0D') { } else if (escape(onechar).length > 4) { tcount += 2; } else { tcount++; }
    }

    if(tcount>value) {
        reserve = tcount-value;
        return false;
    }

    return true;
}

function goFileUpload(){
	editor_focus();
	curSelection = getSelect();
	var contents = "article";
	if(curEditor == "e_H_L_body"){
		contents = "longArticle";
	}
	var dest = "/_blog/fileUploadPop.do?filePathField=blogFilePath&contents=" + contents;
	var width = "500";
	var height = "320";
	newWin = window.open(dest, "win", "scrollbars=yes,toolbar=no,location=no,directories=no,width="+width+",height="+height+",resizable=no,mebar=no,left=250,top=65");
	newWin.focus();
}

function goFileUploadWithBlogid(blogid){
	editor_focus();
	curSelection = getSelect();
	var contents = "article";
	if(curEditor == "e_H_L_body"){
		contents = "longArticle";
	}
	var dest = "/_blog/fileUploadPop.do?blogid="+blogid+"&filePathField=blogFilePath&contents=" + contents;
	var width = "500";
	var height = "320";
	newWin = window.open(dest, "win", "scrollbars=yes,toolbar=no,location=no,directories=no,width="+width+",height="+height+",resizable=no,mebar=no,left=250,top=65");
	newWin.focus();
}

function openImageUploader( blogid ){
	var agt=navigator.userAgent.toLowerCase();
/*
	오직 explore 인 경우 ie 가 true
*/
	var ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
/*
	window 개열중 win95와 win98이 아닌경우 compatibleOS가 true(win2000 or xp)
*/
	var compatibleOS = ((agt.indexOf("win") != -1) && (agt.indexOf("98") == -1) && (agt.indexOf("95") == -1));
	var oneshot = (ie && compatibleOS);
	editor_focus();
	curSelection = getSelect();
	var contents = "article";
	if(curEditor == "e_H_L_body"){
		contents = "longArticle";
	}
	var dest = "/_blog/OpenImageUploader.do?blogid="+blogid+"&filePathField=blogFilePath&contents=" + contents + "&oneshot=" + oneshot;
	var width = "500";
	var height = "320";
	newWin = window.open(dest, "win", "scrollbars=yes,toolbar=no,location=no,directories=no,width="+width+",height="+height+",resizable=no,mebar=no,left=250,top=65");
	newWin.focus();
}

	function openMovieUploader(){
	    var agt=navigator.userAgent.toLowerCase();
	    var ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
	    var compatibleOS = ((agt.indexOf("win") != -1) && (agt.indexOf("98") == -1) && (agt.indexOf("95") == -1));
	    var oneshot = (ie && compatibleOS);
	    editor_focus();
	    curSelection = getSelect();
	    var contents = "article";
	    if(curEditor == "e_H_L_body"){
	        contents = "longArticle";
	    }
	    var dest = "http://blog.daum.net/uploader.html";
	    var width = "470";
	    var height = "270";
	    newWin = window.open(dest, "win", "scrollbars=no,toolbar=no,location=no,directories=no,width="+width+",height="+height+",resizable=no,mebar=no,left=250,top=65");
	    newWin.focus();
	}

function getCurEditor(){
	return curEditor;
}

function goMultimedia( blogid ){
	editor_focus();
	curSelection = getSelect();
	var dest = "/_blog/MediaLink.do?blogid="+blogid;
	var width = "500";
	var height = "250";
	newWin = window.open(dest, "win", "scrollbars=yes,toolbar=no,location=no,directories=no,width="+width+",height="+height+",resizable=no,mebar=no,left=250,top=65");
	newWin.focus();
	//alert("준비중인 기능입니다.");
	//return;

}

function copyUrl(str) {
	if(copyclipboard(str)) {
		alert('클립보드에 주소가 복사되었습니다.');
	}
}

function copyclipboard(intext) {
	if (window.clipboardData) {
		window.clipboardData.setData("Text", intext);
			return true;
	}
	alert("이 브라우저에서는 주소 복사 기능을 제공하지 않습니다.\n아래 주소를 직접 드래그하여 복사해주세요.\n\n"+intext);
	return false;
}

/* clipboard copy flash call back */
function onClipBoard(isSuccess, title, url){
	
	if(isSuccess) {
		if(/(rss|atom)/gi.test(url)){
			if(/(rss)/gi.test(url)){
				url=url+"/view";
			}
			window.open(url);
		}
		alert(title + " 주소가 복사되었습니다.");
	}
	else { alert(title + " 주소가 복사되지 않았습니다.\n아래 주소를 직접 드래그하여 복사해주세요.\n\n" + url); }
}

function articleopeninit(formname){
	frm = eval("document."+formname);
	for(var i=0;i<frm.articleOpen.length;i++){
		frm.articleOpen[i].disabled=false;
	}
}
function blogopen(formname,open){
	frm = eval("document."+formname);

	if(open!=""){
		articleopeninit(formname);
		if(open=="B0602"){
			frm.articleOpen[0].checked=false;
			frm.articleOpen[0].disabled=true;
		}else if(open=="B0603"){
			frm.articleOpen[0].checked=false;
			frm.articleOpen[0].disabled=true;
			frm.articleOpen[1].checked=false;
			frm.articleOpen[1].disabled=true;
		}
	}
}
function initcmmtwrite(formname){
	frm = eval("document."+formname);
	for(var i=0;i<frm.commentOpen.length;i++){
		frm.commentOpen[i].disabled=false;
	}
}
function initscrapprmt(formname){
	frm = eval("document."+formname);
	for(var i=0;i<frm.scrapPrmtKind.length;i++){
		frm.scrapPrmtKind[i].disabled=false;
	}
}
function openchange(formname){
	frm = eval("document."+formname);
	var article="";
	for(var i=0;i<frm.articleOpen.length;i++){
		if(frm.articleOpen[i].checked==true)
			article = frm.articleOpen[i].value;
	}

	if(article!=""){
		if(article=="B0301"){
			initcmmtwrite(formname);
			initscrapprmt(formname);
			frm.trackBackPrmt.disabled=false;
			frm.searchPrmt.disabled=false;
			if( typeof frm.newsLetterKind != "undefined") {
				frm.newsLetterKind.disabled=false;
			}
			if( typeof frm.allblog != "undefined"){
				frm.allblog.disabled=false;
			}
		}else if(article=="B0302"){
			initcmmtwrite(formname);
			initscrapprmt(formname);
			frm.trackBackPrmt.disabled=false;

			frm.searchPrmt.checked=false;
			frm.searchPrmt.disabled=true;
			if( typeof frm.allblog != "undefined"){
			frm.allblog.disabled=true;
			}
			if( typeof frm.newsLetterKind != "undefined"){
				frm.newsLetterKind.disabled=false;
			}
			if( typeof frm.mediadaum != "undefined"){
				frm.mediadaum.checked=false;
			}
			
			if( typeof frm.mappostCheck != "undefined"){
				frm.mappostCheck.checked=false;
			}

			if( typeof frm.tourService != "undefined"){
				frm.tourService.checked=false;
				document.getElementById('tourServicePanel').style.display = "none";
			}			
			
		}else{
			initcmmtwrite(formname);
			initscrapprmt(formname);

			frm.scrapPrmtKind[2].checked=true;
			frm.scrapPrmtKind[0].disabled=true;
			frm.scrapPrmtKind[1].disabled=true;

			frm.trackBackPrmt.checked=false;
			frm.trackBackPrmt.disabled=true;
			frm.searchPrmt.checked=false;
			frm.searchPrmt.disabled=true;
			if( typeof frm.newsLetterKind != "undefined"){
				frm.newsLetterKind.checked=false;
				frm.newsLetterKind.disabled=true;
			}
			if( typeof frm.allblog != "undefined"){
			frm.allblog.disabled=true;
			}
			if( typeof frm.mediadaum != "undefined"){
				frm.mediadaum.checked=false;
			}
			
			if( typeof frm.mappostCheck != "undefined"){
				frm.mappostCheck.checked=false;
			}
			
			if( typeof frm.tourService != "undefined"){
				frm.tourService.checked=false;
				document.getElementById('tourServicePanel').style.display = "none";
			}			
			
		}

	}

}

function submitComment22(cmmtObj, loopObj, n, pcmmtno, atcno) {
		//http://pimg.daum-img.net/blog/library/common.js 으로 수정해서 넣기!!!

		if(document.getElementById("cmmtcheck"+n)==undefined || document.getElementById("cmmtcheck"+n).value==undefined){
			cmmtObj.articleno.value	= atcno;
			cmmtObj.pcmmtno.value 	= pcmmtno;
			cmmtObj.cmmtno.value 	= n;
			cmmtObj.name.value 		= document.getElementById("setcmmtname" + n).value;
			cmmtObj.open.value 		= document.getElementById("setcmmtopen" + n).value;
			cmmtObj.texticon.value 		= document.getElementById("setcmmtexticon"+n).value;			
			cmmtObj.password.value 	= document.getElementById("setcmmtpwd" + n).value;
			cmmtObj.contents.value 	= document.getElementById("setcmmttext" + n).value;

			if(document.getElementById("setcmmtopen" + n).checked == true){
				cmmtObj.open.value = "N";
			}else{
				cmmtObj.open.value = "Y";
			}

			if(document.getElementById("setcmmtexticon" + n).checked == true){
				cmmtObj.texticon.value = "Y";
			}else{
				cmmtObj.texticon.value = "N";
			}					
			
			if(cmmtObj.name.value=="" || cmmtObj.name.value=="이름") {
				alert("이름을 입력해주세요.");
				return;
			}
			if(document.getElementById("setcmmtpwd"+n).type!="hidden" && (cmmtObj.password.value=="" || cmmtObj.password.value=="****")){
				alert("비밀번호를 입력해주세요.");
				return;
			}



			var key = document.getElementById("setcmmtcheck"+n).value;

			var bflag = false;
			if(key != '' && key != '블로그 또는 이메일 주소') {
				if( key.indexOf("@") > 0 && key.indexOf("/") < 0 ) {
					cmmtObj.cmmtmail.value = key;
					bflag = true;
				} else if(  key.indexOf(".") > 0 && key.indexOf("@") < 0) {

					if(key.indexOf("http://")<0)
						key = "http://"+key;
					cmmtObj.cmmtblog.value = key;
					bflag = true;
				}
			}else{
				alert("블로그 또는 이메일 주소를 입력해주세요");
				return;
			}

			if(bflag) {
				if(actType=="MOD"){
					cmmtObj.isModify.value = "Y";
					cmmtObj.action = "/_blog/CommentCreate.do";
				}else if(actType=="REP"){
					cmmtObj.action = "/_blog/CommentCreate.do";
				}

			}else{
				alert("블로그/이메일 형태가 잘못되었습니다.");
				return;
			}
			if(cmmtObj.contents.value=="" || cmmtObj.contents.value=="내용") {
				alert("내용을 입력해주세요.");
				return;
			}else{
				cmmtObj.submit();
			}
		}else{
			cmmtObj.articleno.value	= atcno;
			cmmtObj.name.value 		= document.getElementById("cmmtname"+n).value;
			cmmtObj.open.value 		= document.getElementById("cmmtopen"+n).value;
			cmmtObj.texticon.value 		= document.getElementById("cmmtexticon"+n).value;			
			cmmtObj.password.value 	= document.getElementById("cmmtpwd"+n).value;
			cmmtObj.contents.value 	= document.getElementById("cmmttext"+n).value;
			
			if( document.getElementById("cmmtopen"+n).checked ) {
				cmmtObj.open.value = 'N';
			} else {
				cmmtObj.open.value = 'Y';
			}

			//텍스티콘에 대한 설정 여부 확인 
			if( document.getElementById("cmmtexticon"+n).checked ) {
				cmmtObj.texticon.value = 'N';
			} else {
				cmmtObj.texticon.value = 'Y';
			}		
			
			//비로그인시 글남길때 비밀번호 기입여부 체크
			if(document.getElementById("cmmtpwd"+n).type !="hidden" && cmmtObj.password.value ==""){
				alert("비밀번호를 입력해주세요");
				return;
			}
			//비로그인시 글남길때 비밀번호 기입여부 체크
			if(document.getElementById("cmmtpwd"+n).type !="hidden" && cmmtObj.password.value =="****"){
				alert("비밀번호를 입력해주세요");
				return;
			}

			//비로그인시 글남길때 이름 기입여부 체크
			if(document.getElementById("cmmtname"+n).type !="hidden" && cmmtObj.name.value ==""){
				alert("이름을 입력해주세요");
				return;
			}
			//비로그인시 글남길때 이름 기입여부 체크
			if(document.getElementById("cmmtname"+n).type !="hidden" && cmmtObj.name.value =="****"){
				alert("이름을 입력해주세요");
				return;
			}

			if(cmmtObj.contents.value=="" || cmmtObj.contents.value=="내용") {
				alert("내용을 입력해주세요.");
				return;
			}
			if(cmmtObj.name.value=="" ){
				alert("비밀번호를 입력해주세요.");
				return;
			}


			var key = document.getElementById("cmmtcheck"+n).value;
			var bflag = false;


			if(key != '' && key != '둘 중에 하나만 입력하세요.') {

				if( key.indexOf("@") > 0 ) {
					cmmtObj.cmmtmail.value = key;
					bflag = true;
				} else if( key.indexOf(".") >0 ){

					if(key.indexOf("http://")<0)
						key = "http://"+key;

					cmmtObj.cmmtblog.value = key;
					bflag = true;
				}
			}

			if(bflag) {
				cmmtObj.submit();
			}else{
				alert("블로그/이메일 형태가 잘못되었습니다.");
				return;
			}
		}
	}

function submitComment_reply(cmmtObj, loopObj, n, pcmmtno, atcno) {
	cmmtObj.articleno.value = atcno;
    cmmtObj.contents.value  = document.getElementById("cmmttext"+n).value;
    cmmtObj.cmmtloginyn.value=  document.getElementById("cmmtloginyn"+n).value;
     if( document.getElementById("cmmtopen"+n).checked ) {
                cmmtObj.open.value = 'N';
            } else {
                cmmtObj.open.value = 'Y';
     }
     cmmtObj.submit();
}

function calcBytes(obj, charCnt){
    var strCount = 0;
    var tempStr, tempStr2;

    strCount = obj.value.bytes();

    if (strCount > charCnt)
        return false;
    else
        return true;
}

function returnBytes(obj, charCnt, textlimitName){
    var strCount = 0;
    var tempStr, tempStr2;

    strCount = obj.value.bytes();
    if (strCount > charCnt){
        alert("최대 " + charCnt + "byte이므로 초과된 글자수는 자동으로 삭제됩니다.");
        obj.value = obj.value.cut(charCnt, '');
        strCount = obj.value.bytes();
    }
    if(textlimitName != "")
        document.getElementById(textlimitName).innerHTML = strCount;
}

function calcBytesHtml(obj, charCnt){
    var strCount = 0;
    var tempStr, tempStr2;

    var htmlConvert = obj.value.convertHtml();
    strCount = htmlConvert.bytes();

    if (strCount > charCnt)
        return false;
    else
        return true;
}

function returnBytesHtml(obj, charCnt, textlimitName){
    var strCount = 0;
    var tempStr, tempStr2;
    var htmlConvert = obj.value.convertHtml();
    strCount = htmlConvert.bytes();
    if (strCount > charCnt){
        alert("최대 " + charCnt + "byte이므로 초과된 글자수는 자동으로 삭제됩니다.");
        tempStr2 = htmlConvert.cutConvertedHtml(charCnt, '');
        obj.value = tempStr2.reformHtml();
        strCount = tempStr2.bytes();
    }
    if(textlimitName != "")
        document.getElementById(textlimitName).innerHTML = strCount;
}

function isNumberic(str) {
    var pattern = /^[0-9]+$/;
    return (pattern.test(str)) ? true : false;
}

function isValidEmail(value) {
    var pattern = /^[_a-zA-Z0-9-\.]+@[\.a-zA-Z0-9-]+\.[a-zA-Z]+$/;
    return (pattern.test(value)) ? true : false;
}

function addSelectObj(obj, text, value, label){
	var newOpt = new Option(text, value, label);
	newOpt.text = text;
	newOpt.value = value;
	newOpt.label = label;
	obj.options.add(newOpt);
}

function removeAllOption(obj){
	for (var i=0;i<obj.options.length;i++){
		obj.remove(i);
		i--;
	}
}

function removeSelectedOption(obj){
	for (var i=0;i<obj.options.length;i++){
		if(obj.options[i].selected){
    		obj.remove(i);
    		i--;
		}
	}
}



function viewDivAL2(linkobj, event, topmrg, leftmrg) {
	var xpos=0;
	var ypos=0;
	var mousex=0;
	var mousey=0;
	if(linkobj !=null){
		xpos =findPosX(linkobj);
		ypos =findPosY(linkobj);
		if(window.event){
			mousex = event.clientX;
			mousey = event.clientY;
		}else{
			mousex = event.pageX-document.body.scrollLeft;
			mousey = event.pageY;
		}
		var docX = document.body.clientWidth;
		var docY = document.body.clientHeight;
	}
	var obj = document.getElementById("dashboard");
	if(mousex + leftmrg + 300 > docX) xpos = xpos - (mousex + leftmrg + 300 - docX);
	show_dashboard();
	obj.style.left = xpos + leftmrg;
	var temp = docY - document.getElementById('resultarea').offsetHeight;
	var temp2 = ypos + topmrg;
	if(mousey > temp){
		obj.style.top = temp2 - document.getElementById('resultarea').offsetHeight - 20;
	} else{
		obj.style.top = ypos + topmrg;
	}
}

    function show_post(linkobj, target_id, event, topmrg, leftmrg) {
    	var resultDiv = document.getElementById('resultarea');
    	var content =document.getElementById('source_' + target_id).innerHTML;
    	resultDiv.innerHTML = content;
		viewDivAL2(linkobj,event, topmrg, leftmrg);
    }

	var thumbnum = 0;
	var selthumbno = 0;
	var isthumbovered = false;
	function init_recent_thumbnail(maxnum) {
		thumbnum = maxnum-1;
		show_recent_random_thumbnail();
//		setInterval("show_recent_random_thumbnail()", 3000);
	}

	function hide_recent_thumbnail() {
		var dis_div = 'recent_thumb_' + selthumbno;
		if(document.getElementById(dis_div)) {
    		document.getElementById(dis_div).style.display = 'none';
		}
	}

	function show_recent_thumbnail() {
		var dis_div = 'recent_thumb_' + selthumbno;
		if(document.getElementById(dis_div)) {
    		document.getElementById(dis_div).style.display = 'block';
		}
	}

	function show_recent_random_thumbnail() {
		if(isthumbovered) return;
		hide_recent_thumbnail();
		try {
			selthumbno = Math.round(Math.random() * (thumbnum));
		}catch(e){
			selthumbno = 0;
		}
		show_recent_thumbnail();
	}

    function chg_recent_thumbnail_pre(){
		hide_recent_thumbnail();
    	if(selthumbno == 0){
    		selthumbno = thumbnum;
    	} else {
    		selthumbno--;
    	}
    	show_recent_thumbnail();
    }

    function chg_recent_thumbnail_next(){
    	hide_recent_thumbnail();
    	if(selthumbno == thumbnum){
    		selthumbno = 0;
    	} else {
    		selthumbno++;
    	}
    	show_recent_thumbnail();
    }

	function show_dashboard(){
    	var obj = document.getElementById("dashboard");
    	obj.style.display="block";
    	viewLayer = true;
    }

	function hide_dashboard(){
    	var obj = document.getElementById("dashboard");
    	obj.style.display="none";
    	viewLayer = false;
    }

	var loadedDynamicContent = new Array();
	// 20050509	textMapping data	by boss
	var textMapping = new Array();

	// 20070130 profile image size check & resize	by An Do Young
	// used in commonMenu.vm && shortInfo.vm && basicInfo.vm 
	// Do not resize when img.width is greater than 150px
	function profileImgResize (img) {
		img.style.display = "none";
		if (img.width > 150) {
			img.width=150;
		}
		img.style.display = "";
	}
	
	function loadAct() {

		// 20050509 set default text input data by boss
		ConvertTVKIT();
		setDefaultText();
	}
	function ConvertTVKIT(){
		var elem = document.getElementsByName("TVKIT");
		if(elem !=null){
			for(var i=0 ; i < elem.length;i++){
				if(elem[i].nodeName=="P"){
					var url = elem[i].title;
					var str='<OBJECT ID="TVkitPlayCtrl" CLASSID="CLSID:38923956-29D8-4573-A549-2366D5610325" codebase="TVkitPlay.cab#version=0,0,0,1">';
					str+='<param name=movie value="'+url+'">';
					str+='</OBJECT>';
					elem[i].innerHTML=str;
				}
			}
		}
	}
	function deleteTemplate(objId, pos) {
		document.getElementById(objId).style.display = 'none';
		if(pos == "prev"){
			if(document.getElementById(objId).previousSibling) {
				var tagName = "";
				var obj = document.getElementById(objId).previousSibling;
				while(obj.tagName != "DIV" && obj.className != "right_line_n"){
					obj = obj.previousSibling;
				}
				obj.style.display = 'none';
			}
		}else{
			if(document.getElementById(objId).nextSibling) {
				var tagName = "";
				var obj = document.getElementById(objId).nextSibling;
				while(obj.tagName != "DIV" && obj.className != "right_line_n"){
					obj = obj.nextSibling;
				}
				obj.style.display = 'none';
			}

		}
	}

	function isLoadedContent(target, num) {
		for(i = 0;i < loadedDynamicContent.length;i++) {
			if(loadedDynamicContent[i] == target + num) {
				return true;
			}
		}
		return false;
	}

	function setLoadedContent(target, num) {
		loadedDynamicContent[loadedDynamicContent.length] = target + num;
	}

	function loadDynamicContent(source) {
		if(navigator.userAgent.toLowerCase().indexOf('msie') > -1) {
			if(document.getElementById("dynamicContent")) {
				document.getElementById("dynamicContent").setAttribute("src", source);				
			} else {
				document.write("<script type='text/javascript' id='dynamicContent'" + " src='" + source + "'><" + "/script>");
			}
		} else {
			sc = document.createElement("script");
			sc.src = source;
			document.body.appendChild(sc);
		}
	}

	function skin_sizeFix() {
		var max_w = 0;
		if (document.getElementById("cT_wrap"))
			max_w = parseInt(document.getElementById("cT_wrap").style.left) + document.getElementById("cT_wrap").offsetWidth;
		else if (document.getElementById("cMainBody")) 
			max_w = 25 + document.getElementById("cMainBody").offsetWidth;

		if (max_w > document.body.offsetWidth)
			document.getElementById("top_skin_img").style.width = max_w;
		else {
			if (document.all)
				document.getElementById("top_skin_img").style.width = document.body.offsetWidth - 20;
			else
				document.getElementById("top_skin_img").style.width = document.body.offsetWidth;
		}
	}

	function fixLargeSizeElements() {

		if(navigator.userAgent.indexOf("MSIE") ==-1 && document.getElementsByTagName) {
			imgElements = document.getElementsByTagName("img");
				
			for(var j = 0;j < imgElements.length;j++) {
				imgElements[j].onload = fixSize(imgElements[j]);
			}
		}
	}

	function fixSize(img) {
		while(img.src.indexOf("pimg.daum-img.net") == -1 && img.name != 'titleImage' && img.width > 546) {
			img.width = 546;
		}	
	}

// 20050509	input box set default data		by boss
	function setDefaultText() {
		var obj;
		if (typeof(textMapping) != "undefined") {
			for (var i in textMapping) {
				if (document.getElementById(i)) {
					obj = document.getElementById(i);
					if (obj.value == "") {
						obj.value = textMapping[i];
						if(i.indexOf("pwd") > -1) {
							obj.onfocus = focusPasswdBox;
							obj.onblur = blurPasswdBox;
						}else{
							obj.onfocus = focusCommentBox;
							obj.onblur = blurCommentBox;
						}
					}
				}
			}
		}
	}
// 20050509	focused input box delete default data	by boss
	function delDefaultText() {
		if (this.value == textMapping[this.id]) {
			this.value = "";
		}
	}
	
	function focusCommentBox() {
		var obj;
		if(textMapping == null) return;
		if(textMapping[this.id] == null) return;
		if((obj = document.getElementById(this.id))) {
			if (obj.value == textMapping[this.id]) {
				obj.value = "";
			}
		}
	}
	
	function blurCommentBox(id) {
		var obj;
		if(textMapping == null) return;
		if(textMapping[this.id] == null) return;
		if((obj = document.getElementById(this.id))) {
			if (obj.value == "") {
				obj.value = textMapping[this.id];
			}
		}
	}
	
	function focusPasswdBox() {
		var obj;
		if(textMapping == null) return;
		if(textMapping[this.id] == null) return;
		if((obj = document.getElementById(this.id))) {
			if (obj.value == "") {
				obj.style.background = "#ffffff";
			}
		}
	}
	
	function blurPasswdBox(id) {
		var obj;
		if(textMapping == null) return;
		if(textMapping[this.id] == null) return;
		if((obj = document.getElementById(this.id))) {
			if (obj.value == "") {
				obj.style.background = "url(http://pimg.daum-img.net/blog3/f_pass_1.gif) no-repeat #FFF";
			}
		}
	}
	
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// ajax common
/////////////////////////////////////////////////////////////////////////////////////////////////////////
var blogMainAjax=null;
var submitAjax=null;
var messageAjax=null;
var onloadMapping = new Array();
var onUnLoadMapping = new Array();
var historyIndex=0;
var arrHistoryUrl = new Array();
function historySetUrl(idx, url){
	arrHistoryUrl[idx] = url;
}
function historyGetUrl(idx){
	return arrHistoryUrl[idx];
}	

function createCommonAjax(target, loadingArea){
	if(!is_ie3 && !is_ie4){
		onUnLoadExecute();
		
		onloadMapping = null;
		onloadMapping = new Array();
		onUnLoadMapping = null;
		onUnLoadMapping = new Array();
		if(target == null) target="contentArea";
		checkTargetArea(target);
		checkTargetArea(loadingArea);
				
		blogMainAjax = new AjaxObject("blogMainAjax", target, "contents");
		if(loadingArea != null) blogMainAjax.msgArea = loadingArea;
		blogMainAjax.finalProcessFunc = finalLoadAjax;
	}
}

function createMainAjax(target, bNotContentInit){
	if(typeof(ContentViewer) != 'undefined') {
		if( bNotContentInit != null && typeof( bNotContentInit ) && 'undefined' && bNotContentInit == true ) {
			;// Content 초기화가 필요없음
		} else {
			ContentViewer.movePage();
		}
	}
	createCommonAjax(target, "ajax_layer_load");
}

function sendSubmitAjax(formRef, finalFunc, target, paramValues, isMessageAlert){
	if(!is_ie3 && !is_ie4){
		if(target ==null) target="ajax_submit_layer";
		checkTargetArea(target);
		document.getElementById(target).style.display = "none";
		
		submitAjax = new AjaxObject("submitAjax", target, "contents", null);
		if(isMessageAlert != null) submitAjax.isMessageAlert = isMessageAlert;
		if(finalFunc != null) submitAjax.finalProcessFunc = finalFunc;
		if(paramValues!= null) submitAjax.paramValues = paramValues;
		submitAjax.submit(formRef, true);
	}
}

function sendMessageAjax(url, finalFunc, target, paramValues, isMessageAlert){
	if(!is_ie3 && !is_ie4){
		if(target ==null) target="ajax_message_layer";
		checkTargetArea(target);
		document.getElementById(target).style.display = "none";
		
		messageAjax = new AjaxObject("messageAjax", target, "contents", null);
		if(isMessageAlert != null) messageAjax.isMessageAlert = isMessageAlert;
		if(finalFunc != null) messageAjax.finalProcessFunc = finalFunc;
		if(paramValues!= null) messageAjax.paramValues = paramValues;
		messageAjax.message(url, true);
	}
}

function checkTargetArea(target){
	if(!document.getElementById(target)){
		var targetDiv = document.createElement("DIV");
		targetDiv.id = target;
		document.body.appendChild(targetDiv);
	}
}

function addOnUnLoadMapping(param){
	onUnLoadMapping[onUnLoadMapping.length] = param;
}

function addOnLoadMapping(param){
	onloadMapping[onloadMapping.length] = param;
}

function onUnLoadExecute(){
	for(var i=0; i<onUnLoadMapping.length; i++){
		eval(onUnLoadMapping[i]);
	}
}

function onloadExecute(){
	for(var i=0; i<onloadMapping.length; i++){
		eval(onloadMapping[i]);
	}
}
var ftop=0;
function finalLoadAjax(isSuccess, url){

	if(isSuccess || isSuccess == "true"){
		onloadExecute();
//		loadAct();
//		historyInsert(url);
		if( (url.indexOf('ArticleCateList') < 0 || url.indexOf('refequery=') < 0) && url.indexOf('&scroll=no') < 0 ) {
			window.scrollTo(0, ftop);
		}
	}else{
		if(url && url.indexOf(".ajax")>0){
			url = url.substr(0, url.indexOf(".ajax")) + ".do" + url.substr(url.indexOf("?"));
			document.location.href = url;
		}

	}	
}
function historyInitailize(){
	try {
		dhtmlHistory.initialize();
		dhtmlHistory.addListener(historyChange);
	
		if (dhtmlHistory.isFirstLoad()) {
			dhtmlHistory.add("ajax_history_home", location);
		} 		
	}catch(e) {}
}

function historyInsert(url){
	if (url && url.indexOf("&___historyGo__daumBlog") < 0){
		if (dhtmlHistory.isFirstLoad()) {
			historySetUrl(historyIndex, url);
			dhtmlHistory.add("ajax_history_"+historyIndex, "historyGetUrl("+historyIndex+")");
			historyIndex++;
		}
	}
}

function historyChange(newLocation, historyData){
	if(newLocation == 'ajax_history_home') {
		var firstURL = historyStorage.get("ajax_history_home");
		if(firstURL==document.location.href){
			document.location.reload();
		}
	}else if(historyData != null){
		var url = eval(historyData);
		if(url != undefined){ 
			createMainAjax();	
			locationAjax(blogMainAjax, url + "&___historyGo__daumBlog");
			window.scrollTo(0, 0);
		}
	}
}


// 히스토리에는 들어가지 않으나 PV가 잡혀야 할 경우 사용

function PvGenerator(sCheckUrl) {
	this.defaultGeneratorHtml = "/_hdn/action.html";
	this.sCheckUrl = "";
	if( sCheckUrl != null && sCheckUrl.length > 0 ) {
		this.sCheckUrl = sCheckUrl
	}
	else {
		this.sCheckUrl = this.defaultGeneratorHtml;
	}
	document.write("<iframe style='border: 0px; width: 0px; "
						+ "height: 0px; position: absolute; bottom: 0px; "
						+ "right: 0px; visibility: visible;' "
						+ "name='PVGenFrame' id='PVGenFrame' "
						+ "src=''>"
						+ "</iframe>");
}

PvGenerator.prototype.setCheckUrl = function( sCheckUrl ) {
	if( sCheckUrl != null && sCheckUrl.length > 0 ) {
		this.sCheckUrl = sCheckUrl
	}
	else {
		this.sCheckUrl = this.defaultGeneratorHtml;
	}
}

PvGenerator.prototype.generate = function( sRequestQuery, sCheckUrl ) {
	try {
		var sUrl = "";
		if( sCheckUrl != null && sCheckUrl.length > 0 ) {
			sUrl = sCheckUrl;
		}
		else {
			sUrl = this.sCheckUrl;
		}
		if( this.oIframeArea == null ) this.oIframeArea = document.getElementById("PVGenFrame");
		if (this.oIframeArea != null) this.oIframeArea.src = sUrl+"?" + sRequestQuery;		
	} catch( e ) {
	}
}

function	requestAjaxCheck( sRequestQuery, sCheckUrl ) {
	if( oPvGen != null ) {
		oPvGen.generate( sRequestQuery, sCheckUrl );
	}
}

var		oPvGen = new PvGenerator();

function ResizeLoadImage(obj, maxwidth, maxheight) {

	var oTmpImg = new Image();
	if( is_ie ) {
		oTmpImg.onreadystatechange = function() {
			if(this.readyState == "complete") {
				if( this.width < maxwidth && this.height < maxheight ) {
					obj.width = this.width;
					obj.height = this.height;
				}else {
					heightEst = maxwidth*this.height/this.width;
					widthEst = maxheight*this.width/this.height;
					if( heightEst <= maxheight ) {
						obj.width = maxwidth;
						obj.height = heightEst;
					}
					else {
						obj.width = widthEst;
						obj.height = maxheight;
					}
				}
			}
		};
	} else {
		oTmpImg.onload = function() {
			if( this.width < maxwidth && this.height < maxheight ) {
				obj.width = this.width;
				obj.height = this.height;
			}else {
				heightEst = maxwidth*this.height/this.width;
				widthEst = maxheight*this.width/this.height;
				if( heightEst <= maxheight ) {
					obj.width = maxwidth;
					obj.height = heightEst;
				}
				else {
					obj.width = widthEst;
					obj.height = maxheight;
				}
			}
		};
	}
	oTmpImg.src = obj.src;
}

var fade_timer;
var opacity = 0.2;
function fade_effect(){
	clearTimeout(fade_timer);
	var viewObj = document.getElementById('image_view');
	if( viewObj == null ) {
		return;
	}
	viewObj.style.filter = "alpha(opacity:"+opacity*100+")";
	viewObj.style.opacity = opacity;
	if( opacity < 1 ){
		opacity += 0.2;
		fade_timer = setTimeout(fade_effect, 10)
	}
	else{
		opacity = 0.2;
	}
}
GetX = function(object) {
	if(object == null) return 0;
	var nLeft = 0;
    do {
      nLeft += object.offsetLeft || 0;
	  if(object == document.body) break;
      object = GetOffsetParent(object);
    } while(object);
	return nLeft;
};

GetY = function(object) {
	if(object == null) return 0;
	var nTop = 0;
    do {
      nTop += object.offsetTop || 0;
	  if(object == document.body) break;
      object = GetOffsetParent(object);
    } while(object);
    return nTop;
};


GetOffsetParent = function(object)
{
	try{
		if(object.offsetParent)
			return object.offsetParent;
	}catch(e){ return document.body; }

	if (object == document.body) return object;

	while ((object = object.parentNode) && object != document.body) {
		try{
		if (object.style.position == "absolute" || object.style.position == "relative")
			return object;
		}catch(e){ return document.body; }
	}
	return document.body;
};

function goListImage(isNext) {
	var	f = document.getElementById("moreRequest");
	var blogid = f.blogid.value;
	var categoryid = f.categoryid.value;
	var minseq = f.minseq.value;
	var minarticleno = f.minarticleno.value;
	var minregdt = f.minregdt.value;
	var maxseq = f.maxseq.value;
	var maxarticleno = f.maxarticleno.value;
	var maxregdt = f.maxregdt.value;
	
	createCommonAjax("preview_list_box", null);
	
	if( isNext ) {
		var currentPage = f.currentPage.value;
		var beforePage = parseInt(currentPage)-1;
		locationAjax(blogMainAjax, "/_blog/photoList.do?blogid="+blogid+"&isSlide=1&categoryid="+categoryid+"&currentPage="+currentPage+"&beforePage="+beforePage+"&minseq="+minseq+"&minarticleno="+minarticleno+"&minregdt="+minregdt+"&___historyGo__daumBlog");
		if( typeof(requestAjaxCheck) == 'function' ) {
			requestAjaxCheck("action=photoList&blogid="+blogid+"&currentPage="+currentPage);
		}
	}
	else {
		var beforePage = f.beforePage.value;
		var currentPage = parseInt(beforePage)-1;
		locationAjax(blogMainAjax, "/_blog/photoList.do?blogid="+blogid+"&isSlide=1&categoryid="+categoryid+"&currentPage="+currentPage+"&beforePage="+beforePage+"&maxseq="+maxseq+"&maxarticleno="+maxarticleno+"&maxregdt="+maxregdt+"&___historyGo__daumBlog");
		if( typeof(requestAjaxCheck) == 'function' ) {
			requestAjaxCheck("action=photoList&blogid="+blogid+"&currentPage="+currentPage);
		}
	}
}

/* MSN messenger */
function chgMsnSkin(code){
	document.getElementById('MSNL').style.backgroundImage = 'url(http://pimg.daum-img.net/blog3/admin/msn_' + code + '01.gif)'
	document.getElementById('MSNR').style.backgroundImage = 'url(http://pimg.daum-img.net/blog3/admin/msn_' + code + '03.gif)'
	document.getElementById('innerMSN').style.backgroundImage = 'url(http://pimg.daum-img.net/blog3/admin/msn_' + code + '02.gif)'
	document.getElementById('innerpMSN').style.backgroundImage = 'url(http://pimg.daum-img.net/blog3/admin/msn_' + code + '01.gif)'		
	document.msnForm.color.value=code;
}

// Copyright (c) Microsoft Corporation. All rights reserved.
function Microsoft_Live_Messenger_PresenceButton_startConversation(conversationUrl)
{
	window.open(conversationUrl, '_blank', 'height=300px,width=300px');
}

function Microsoft_Live_Messenger_PresenceButton_onStyleChange(element) {
	if (element && element.presence) {
		Microsoft_Live_Messenger_PresenceButton_onPresence(element.presence);
	}
}

function Microsoft_Live_Messenger_PresenceButton_onPresence(presence)
{
	var idx = presence.id.indexOf('@');
	if (idx >= 0) {
	
		var msnTitle = 	cutStr(presence.displayName,20);
		
		if(!presence.statusText || presence.statusText == '' || presence.statusText == 'Offline' || presence.statusText == '오프라인') {
			msnTitle = "로그아웃 상태입니다.";
		}
	
		if(document.all) {
			document.getElementById("nameid").innerText =  msnTitle;
		} else {
			document.getElementById("nameid").innerHTML =  msnTitle;
		}
		document.getElementById("msnIconImg").src = presence.icon.url;
	}
}



/** 
   Copyright (c) 2005, Brad Neuberg, bkn3@columbia.edu
   http://codinginparadise.org
   
   Permission is hereby granted, free of charge, to any person obtaining 
   a copy of this software and associated documentation files (the "Software"), 
   to deal in the Software without restriction, including without limitation 
   the rights to use, copy, modify, merge, publish, distribute, sublicense, 
   and/or sell copies of the Software, and to permit persons to whom the 
   Software is furnished to do so, subject to the following conditions:
   
   The above copyright notice and this permission notice shall be 
   included in all copies or substantial portions of the Software.
   
   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 
   OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 
   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 
   OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 
   THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   
   The JSON class near the end of this file is
   Copyright 2005, JSON.org
*/

/** An object that provides DHTML history, history data, and bookmarking 
    for AJAX applications. */
window.dhtmlHistory = {
   /** Initializes our DHTML history. You should
       call this after the page is finished loading. */
   /** public */ initialize: function() {
      // only Internet Explorer needs to be explicitly initialized;
      // other browsers don't have its particular behaviors.
      // Basicly, IE doesn't autofill form data until the page
      // is finished loading, which means historyStorage won't
      // work until onload has been fired.
      if (this.isInternetExplorer() == false) {
         return;
      }
         
      // if this is the first time this page has loaded...
      if (historyStorage.hasKey("DhtmlHistory_pageLoaded") == false) {
         this.fireOnNewListener = false;
         this.firstLoad = true;
         historyStorage.put("DhtmlHistory_pageLoaded", true);
      }
      // else if this is a fake onload event
      else {
         this.fireOnNewListener = true;
         this.firstLoad = false;   
      }
   },
             
   /** Adds a history change listener. Note that
       only one listener is supported at this
       time. */
   /** public */ addListener: function(callback) {
      this.listener = callback;
      
      // if the page was just loaded and we
      // should not ignore it, fire an event
      // to our new listener now
      if (this.fireOnNewListener == true) {
         this.fireHistoryEvent(this.currentLocation);
         this.fireOnNewListener = false;
      }
   },
   
   /** public */ add: function(newLocation, historyData) {
      // most browsers require that we wait a certain amount of time before changing the
      // location, such as 200 milliseconds; rather than forcing external callers to use
      // window.setTimeout to account for this to prevent bugs, we internally handle this
      // detail by using a 'currentWaitTime' variable and have requests wait in line
      var self = this;
      var addImpl = function() {
         // indicate that the current wait time is now less
         if (self.currentWaitTime > 0)
            self.currentWaitTime = self.currentWaitTime - self.WAIT_TIME;
            
         // remove any leading hash symbols on newLocation
         newLocation = self.removeHash(newLocation);
         
         // IE has a strange bug; if the newLocation
         // is the same as _any_ preexisting id in the
         // document, then the history action gets recorded
         // twice; throw a programmer exception if there is
         // an element with this ID
         var idCheck = document.getElementById(newLocation);
         if (idCheck != undefined || idCheck != null) {
            var message = 
               "Exception: History locations can not have "
               + "the same value as _any_ id's "
               + "that might be in the document, "
               + "due to a bug in Internet "
               + "Explorer; please ask the "
               + "developer to choose a history "
               + "location that does not match "
               + "any HTML id's in this "
               + "document. The following ID "
               + "is already taken and can not "
               + "be a location: " 
               + newLocation;
               
            throw message; 
         }
         
         // store the history data into history storage
         historyStorage.put(newLocation, historyData);
         
         // indicate to the browser to ignore this upcomming 
         // location change
         self.ignoreLocationChange = true;
 
         // indicate to IE that this is an atomic location change
         // block
         this.ieAtomicLocationChange = true;
                 
         // save this as our current location
         self.currentLocation = newLocation;
         
         // change the browser location
         window.location.hash = newLocation;
         
         // change the hidden iframe's location if on IE
         if (self.isInternetExplorer()){
            self.iframe.src = "/blank.html?" + newLocation;
		}
            
         // end of atomic location change block
         // for IE
         this.ieAtomicLocationChange = false;
      };

      // now execute this add request after waiting a certain amount of time, so as to
      // queue up requests
      window.setTimeout(addImpl, this.currentWaitTime);
   
      // indicate that the next request will have to wait for awhile
      this.currentWaitTime = this.currentWaitTime + this.WAIT_TIME;
   },
   
   /** public */ isFirstLoad: function() {
      if (this.firstLoad == true) {
         return true;
      }
      else {
         return false;
      }
   },
   
   /** public */ isInternational: function() {
      return false;
   },
   
   /** public */ getVersion: function() {
      return "0.05";
   },
   
   /** Gets the current hash value that is in the browser's
       location bar, removing leading # symbols if they are present. */
   /** public */ getCurrentLocation: function() {
      var currentLocation = this.removeHash(window.location.hash);
         
      return currentLocation;
   },
   
   
   
   
   
   /** Our current hash location, without the "#" symbol. */
   /** private */ currentLocation: null,
   
   /** Our history change listener. */
   /** private */ listener: null,
   
   /** A hidden IFrame we use in Internet Explorer to detect history
       changes. */
   /** private */ iframe: null,
   
   /** Indicates to the browser whether to ignore location changes. */
   /** private */ ignoreLocationChange: null,
 
   /** The amount of time in milliseconds that we should wait between add requests. 
       Firefox is okay with 200 ms, but Internet Explorer needs 400. */
   /** private */ WAIT_TIME: 200,

   /** The amount of time in milliseconds an add request has to wait in line before being
       run on a window.setTimeout. */
   /** private */ currentWaitTime: 0,
   
   /** A flag that indicates that we should fire a history change event
       when we are ready, i.e. after we are initialized and
       we have a history change listener. This is needed due to 
       an edge case in browsers other than Internet Explorer; if
       you leave a page entirely then return, we must fire this
       as a history change event. Unfortunately, we have lost
       all references to listeners from earlier, because JavaScript
       clears out. */
   /** private */ fireOnNewListener: null,
   
   /** A variable that indicates whether this is the first time
       this page has been loaded. If you go to a web page, leave
       it for another one, and then return, the page's onload
       listener fires again. We need a way to differentiate
       between the first page load and subsequent ones.
       This variable works hand in hand with the pageLoaded
       variable we store into historyStorage.*/
   /** private */ firstLoad: null,
   
   /** A variable to handle an important edge case in Internet
       Explorer. In IE, if a user manually types an address into
       their browser's location bar, we must intercept this by
       continiously checking the location bar with an timer 
       interval. However, if we manually change the location
       bar ourselves programmatically, when using our hidden
       iframe, we need to ignore these changes. Unfortunately,
       these changes are not atomic, so we surround them with
       the variable 'ieAtomicLocationChange', that if true,
       means we are programmatically setting the location and
       should ignore this atomic chunked change. */
   /** private */ ieAtomicLocationChange: null,          
   
   /** Creates the DHTML history infrastructure. */
   /** private */ create: function() {
      // get our initial location
      var initialHash = this.getCurrentLocation();
      
      // save this as our current location
      this.currentLocation = initialHash;
      
      // write out a hidden iframe for IE and
      // set the amount of time to wait between add() requests
      if (this.isInternetExplorer()) {
         document.write("<iframe style='border: 0px; width: 0px; "
                               + "height: 0px; position: absolute; bottom: 0px; "
                               + "right: 0px; visibility: visible;' "
                               + "name='DhtmlHistoryFrame' id='DhtmlHistoryFrame' "
                               + "src='/blank.html?" + initialHash + "'>"
                               + "</iframe>");
         // wait 400 milliseconds between history
         // updates on IE, versus 200 on Firefox
         this.WAIT_TIME = 400;
      }
      
      // add an unload listener for the page; this is
      // needed for Firefox 1.5+ because this browser caches all
      // dynamic updates to the page, which can break some of our 
      // logic related to testing whether this is the first instance
      // a page has loaded or whether it is being pulled from the cache
      var self = this;
      window.onunload = function() {
         self.firstLoad = null;
      };
      
      // determine if this is our first page load;
      // for Internet Explorer, we do this in 
      // this.iframeLoaded(), which is fired on
      // page load. We do it there because
      // we have no historyStorage at this point
      // in IE, which only exists after the page
      // is finished loading for that browser
      if (this.isInternetExplorer() == false) {
         if (historyStorage.hasKey("DhtmlHistory_pageLoaded") == false) {
            this.ignoreLocationChange = true;
            this.firstLoad = true;
            historyStorage.put("DhtmlHistory_pageLoaded", true);
         }
         else {
            // indicate that we want to pay attention
            // to this location change
            this.ignoreLocationChange = false;
            // For browser's other than IE, fire
            // a history change event; on IE,
            // the event will be thrown automatically
            // when it's hidden iframe reloads
            // on page load.
            // Unfortunately, we don't have any 
            // listeners yet; indicate that we want
            // to fire an event when a listener
            // is added.
            this.fireOnNewListener = true;
         }
      }
      else { // Internet Explorer
         // the iframe will get loaded on page
         // load, and we want to ignore this fact
         this.ignoreLocationChange = true;
      }
      
      if (this.isInternetExplorer()) {
            this.iframe = document.getElementById("DhtmlHistoryFrame");
      }                                                              

      // other browsers can use a location handler that checks
      // at regular intervals as their primary mechanism;
      // we use it for Internet Explorer as well to handle
      // an important edge case; see checkLocation() for
      // details
      var self = this;
      var locationHandler = function() {
         self.checkLocation();
      };
      setInterval(locationHandler, 100);
   },
   
   /** Notify the listener of new history changes. */
   /** private */ fireHistoryEvent: function(newHash) {
      // extract the value from our history storage for
      // this hash
      var historyData = historyStorage.get(newHash);

      // call our listener      
      this.listener.call(null, newHash, historyData);
   },
   
   /** Sees if the browsers has changed location.  This is the primary history mechanism
       for Firefox. For Internet Explorer, we use this to handle an important edge case:
       if a user manually types in a new hash value into their Internet Explorer location
       bar and press enter, we want to intercept this and notify any history listener. */
   /** private */ checkLocation: function() {
      // ignore any location changes that we made ourselves
      // for browsers other than Internet Explorer
      if (this.isInternetExplorer() == false
         && this.ignoreLocationChange == true) {
         this.ignoreLocationChange = false;
         return;
      }
      
      // if we are dealing with Internet Explorer
      // and we are in the middle of making a location
      // change from an iframe, ignore it
      if (this.isInternetExplorer() == false
          && this.ieAtomicLocationChange == true) {
         return;
      }
      
      // get hash location
      var hash = this.getCurrentLocation();
      
      // see if there has been a change
      if (hash == this.currentLocation)
         return;
         
      // on Internet Explorer, we need to intercept users manually
      // entering locations into the browser; we do this by comparing
      // the browsers location against the iframes location; if they
      // differ, we are dealing with a manual event and need to
      // place it inside our history, otherwise we can return
      this.ieAtomicLocationChange = true;
      
      if (this.isInternetExplorer()
          && this.getIFrameHash() != hash) {
         this.iframe.src = "/blank.html?" + hash;
      }
      else if (this.isInternetExplorer()) {
         // the iframe is unchanged
         return;
      }
         
      // save this new location
      this.currentLocation = hash;
      
      this.ieAtomicLocationChange = false;
      
      // notify listeners of the change
      this.fireHistoryEvent(hash);
   },  

   /** Gets the current location of the hidden IFrames
       that is stored as history. For Internet Explorer. */
   /** private */ getIFrameHash: function() {
      // get the new location
      var historyFrame = document.getElementById("DhtmlHistoryFrame");
      var doc = historyFrame.contentWindow.document;
      var hash = new String(doc.location.search);

      if (hash.length == 1 && hash.charAt(0) == "?")
         hash = "";
      else if (hash.length >= 2 && hash.charAt(0) == "?")
         hash = hash.substring(1); 
    
    
      return hash;
   },          
   
   /** Removes any leading hash that might be on a location. */
   /** private */ removeHash: function(hashValue) {
      if (hashValue == null || hashValue == undefined)
         return null;
      else if (hashValue == "")
         return "";
      else if (hashValue.length == 1 && hashValue.charAt(0) == "#")
         return "";
      else if (hashValue.length > 1 && hashValue.charAt(0) == "#")
         return hashValue.substring(1);
      else
         return hashValue;     
   },          
   
   /** For IE, says when the hidden iframe has finished loading. */
   /** private */ iframeLoaded: function(newLocation) {
      // ignore any location changes that we made ourselves
      if (this.ignoreLocationChange == true) {
         this.ignoreLocationChange = false;
         return;
      }
      
      // get the new location
      var hash = new String(newLocation.search);
      if (hash.length == 1 && hash.charAt(0) == "?")
         hash = "";
      else if (hash.length >= 2 && hash.charAt(0) == "?")
         hash = hash.substring(1);
      
      // move to this location in the browser location bar
      // if we are not dealing with a page load event
      if (this.pageLoadEvent != true) {
         window.location.hash = hash;
      }

      // notify listeners of the change
      this.fireHistoryEvent(hash);
   },
   
   /** Determines if this is Internet Explorer. */
   /** private */ isInternetExplorer: function() {
      var userAgent = navigator.userAgent.toLowerCase();
      if (document.all && userAgent.indexOf('msie')!=-1) {
         return true;
      }
      else {
         return false;
      }
   }
};












/** An object that uses a hidden form to store history state 
    across page loads. The chief mechanism for doing so is using
    the fact that browser's save the text in form data for the
    life of the browser and cache, which means the text is still
    there when the user navigates back to the page. See
    http://codinginparadise.org/weblog/2005/08/ajax-tutorial-saving-session-across.html
    for full details. */
window.historyStorage = {
   /** If true, we are debugging and show the storage textfield. */
   /** public */ debugging: false,
   
   /** Our hash of key name/values. */
   /** private */ storageHash: new Object(),
   
   /** If true, we have loaded our hash table out of the storage form. */
   /** private */ hashLoaded: false, 
   
   /** public */ put: function(key, value) {
       this.assertValidKey(key);
       
       // if we already have a value for this,
       // remove the value before adding the
       // new one
       if (this.hasKey(key)) {
         this.remove(key);
       }
       
       // store this new key
       this.storageHash[key] = value;
       
       // save and serialize the hashtable into the form
       this.saveHashTable(); 
   },
   
   /** public */ get: function(key) {
      this.assertValidKey(key);
      
      // make sure the hash table has been loaded
      // from the form
      this.loadHashTable();
      
      var value = this.storageHash[key];

      if (value == undefined)
         return null;
      else
         return value; 
   },
   
   /** public */ remove: function(key) {
      this.assertValidKey(key);
      
      // make sure the hash table has been loaded
      // from the form
      this.loadHashTable();
      
      // delete the value
      delete this.storageHash[key];
      
      // serialize and save the hash table into the 
      // form
      this.saveHashTable();
   },
   
   /** Clears out all saved data. */
   /** public */ reset: function() {
      this.storageField.value = "";
      this.storageHash = new Object();
   },
   
   /** public */ hasKey: function(key) {
      this.assertValidKey(key);
      
      // make sure the hash table has been loaded
      // from the form
      this.loadHashTable();
      
      if (typeof this.storageHash[key] == "undefined")
         return false;
      else
         return true;
   },
   
   /** Determines whether the key given is valid;
       keys can only have letters, numbers, the dash,
       underscore, spaces, or one of the 
       following characters:
       !@#$%^&*()+=:;,./?|\~{}[] */
   /** public */ isValidKey: function(key) {
      // allow all strings, since we don't use XML serialization
      // format anymore
      return (typeof key == "string");
      
      /*
      if (typeof key != "string")
         key = key.toString();
      
      
      var matcher = 
         /^[a-zA-Z0-9_ \!\@\#\$\%\^\&\*\(\)\+\=\:\;\,\.\/\?\|\\\~\{\}\[\]]*$/;
                     
      return matcher.test(key);*/
   },
   
   
   
   
   /** A reference to our textarea field. */
   /** private */ storageField: null,
   
   /** private */ init: function() {
      // write a hidden form into the page
      var styleValue = "position: absolute; top: -1000px; left: -1000px;";
      //var styleValue = "top:-1000px; left:-1000px; visible:hidden";
      if (this.debugging == true) {
         styleValue = "width: 30em; height: 30em;";
      }   
     
      var newContent =
         "<form id='historyStorageForm' " 
               + "method='GET' >"
            + "<textarea id='historyStorageField' "
                      + "style='" + styleValue + "'"
                              + "left: -1000px;' "
                      + "name='historyStorageField'></textarea>"
         + "</form>";
      document.write(newContent);
      
      this.storageField = document.getElementById("historyStorageField");
   },
   
   /** Asserts that a key is valid, throwing
       an exception if it is not. */
   /** private */ assertValidKey: function(key) {
      if (this.isValidKey(key) == false) {
         throw "Please provide a valid key for "
               + "window.historyStorage, key= "
               + key;
       }
   },
   
   /** Loads the hash table up from the form. */
   /** private */ loadHashTable: function() {
      if (this.hashLoaded == false) {
         // get the hash table as a serialized
         // string
         var serializedHashTable = this.storageField.value;
         
         if (serializedHashTable != "" &&
             serializedHashTable != null) {
            // destringify the content back into a 
            // real JavaScript object
            this.storageHash = eval('(' + serializedHashTable + ')');  
         }
         
         this.hashLoaded = true;
      }
   },
   
   /** Saves the hash table into the form. */
   /** private */ saveHashTable: function() {
      this.loadHashTable();
      // serialized the hash table
      var serializedHashTable = JSON.stringify(this.storageHash);

      // save this value
      this.storageField.value = serializedHashTable;
   }   
};










/** The JSON class is copyright 2005 JSON.org. */
//Array.prototype.______array = '______array';

var JSON = {
    org: 'http://www.JSON.org',
    copyright: '(c)2005 JSON.org',
    license: 'http://www.crockford.com/JSON/license.html',

    stringify: function (arg) {
        var c, i, l, s = '', v;

        switch (typeof arg) {
        case 'object':
            if (arg) {
				/*
                if (arg.______array == '______array') {
                    for (i = 0; i < arg.length; ++i) {
                        v = this.stringify(arg[i]);
                        if (s) {
                            s += ',';
                        }
                        s += v;
                    }
                    return '[' + s + ']';
                } else */if (typeof arg.toString != 'undefined') {
                    for (i in arg) {
                        v = arg[i];
                        if (typeof v != 'undefined' && typeof v != 'function') {
                            v = this.stringify(v);
                            if (s) {
                                s += ',';
                            }
                            s += this.stringify(i) + ':' + v;
                        }
                    }
                    return '{' + s + '}';
                }
            }
            return 'null';
        case 'number':
            return isFinite(arg) ? String(arg) : 'null';
        case 'string':
            l = arg.length;
            s = '"';
            for (i = 0; i < l; i += 1) {
                c = arg.charAt(i);
                if (c >= ' ') {
                    if (c == '\\' || c == '"') {
                        s += '\\';
                    }
                    s += c;
                } else {
                    switch (c) {
                        case '\b':
                            s += '\\b';
                            break;
                        case '\f':
                            s += '\\f';
                            break;
                        case '\n':
                            s += '\\n';
                            break;
                        case '\r':
                            s += '\\r';
                            break;
                        case '\t':
                            s += '\\t';
                            break;
                        default:
                            c = c.charCodeAt();
                            s += '\\u00' + Math.floor(c / 16).toString(16) +
                                (c % 16).toString(16);
                    }
                }
            }
            return s + '"';
        case 'boolean':
            return String(arg);
        default:
            return 'null';
        }
    },
    parse: function (text) {
        var at = 0;
        var ch = ' ';

        function error(m) {
            throw {
                name: 'JSONError',
                message: m,
                at: at - 1,
                text: text
            };
        }

        function next() {
            ch = text.charAt(at);
            at += 1;
            return ch;
        }

        function white() {
            while (ch != '' && ch <= ' ') {
                next();
            }
        }

        function str() {
            var i, s = '', t, u;

            if (ch == '"') {
outer:          while (next()) {
                    if (ch == '"') {
                        next();
                        return s;
                    } else if (ch == '\\') {
                        switch (next()) {
                        case 'b':
                            s += '\b';
                            break;
                        case 'f':
                            s += '\f';
                            break;
                        case 'n':
                            s += '\n';
                            break;
                        case 'r':
                            s += '\r';
                            break;
                        case 't':
                            s += '\t';
                            break;
                        case 'u':
                            u = 0;
                            for (i = 0; i < 4; i += 1) {
                                t = parseInt(next(), 16);
                                if (!isFinite(t)) {
                                    break outer;
                                }
                                u = u * 16 + t;
                            }
                            s += String.fromCharCode(u);
                            break;
                        default:
                            s += ch;
                        }
                    } else {
                        s += ch;
                    }
                }
            }
            error("Bad string");
        }

        function arr() {
            var a = [];

            if (ch == '[') {
                next();
                white();
                if (ch == ']') {
                    next();
                    return a;
                }
                while (ch) {
                    a.push(val());
                    white();
                    if (ch == ']') {
                        next();
                        return a;
                    } else if (ch != ',') {
                        break;
                    }
                    next();
                    white();
                }
            }
            error("Bad array");
        }

        function obj() {
            var k, o = {};

            if (ch == '{') {
                next();
                white();
                if (ch == '}') {
                    next();
                    return o;
                }
                while (ch) {
                    k = str();
                    white();
                    if (ch != ':') {
                        break;
                    }
                    next();
                    o[k] = val();
                    white();
                    if (ch == '}') {
                        next();
                        return o;
                    } else if (ch != ',') {
                        break;
                    }
                    next();
                    white();
                }
            }
            error("Bad object");
        }

        function num() {
            var n = '', v;
            if (ch == '-') {
                n = '-';
                next();
            }
            while (ch >= '0' && ch <= '9') {
                n += ch;
                next();
            }
            if (ch == '.') {
                n += '.';
                while (next() && ch >= '0' && ch <= '9') {
                    n += ch;
                }
            }
            if (ch == 'e' || ch == 'E') {
                n += 'e';
                next();
                if (ch == '-' || ch == '+') {
                    n += ch;
                    next();
                }
                while (ch >= '0' && ch <= '9') {
                    n += ch;
                    next();
                }
            }
            v = +n;
            if (!isFinite(v)) {
                error("Bad number");
            } else {
                return v;
            }
        }

        function word() {
            switch (ch) {
                case 't':
                    if (next() == 'r' && next() == 'u' && next() == 'e') {
                        next();
                        return true;
                    }
                    break;
                case 'f':
                    if (next() == 'a' && next() == 'l' && next() == 's' &&
                            next() == 'e') {
                        next();
                        return false;
                    }
                    break;
                case 'n':
                    if (next() == 'u' && next() == 'l' && next() == 'l') {
                        next();
                        return null;
                    }
                    break;
            }
            error("Syntax error");
        }

        function val() {
            white();
            switch (ch) {
                case '{':
                    return obj();
                case '[':
                    return arr();
                case '"':
                    return str();
                case '-':
                    return num();
                default:
                    return ch >= '0' && ch <= '9' ? num() : word();
            }
        }

        return val();
    }
};

/** Initialize all of our objects now. */
window.historyStorage.init();
window.dhtmlHistory.create();



// AjaxObject /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var isdebug = false;
var currentPageURL = window.location.href;
var arrAjaxObject = new Array();

AjaxRequest=function(name){
	this.xmlRequest=null;
	this.iframeRequest=null;
	window._ifr_buf_count |= 0;
	this.iframeID = 'iframebuffer' + window._ifr_buf_count++ + "_" + name;
	this.iframeUrl=null;
	
	if (window.XMLHttpRequest){ // if Mozilla, Safari etc
		this.xmlRequest=new XMLHttpRequest()
		if (this.xmlRequest.overrideMimeType)
			this.xmlRequest.overrideMimeType('text/xml')
	}else if (window.ActiveXObject){ // if IE
	//}else if (window.ActiveXObject && !isdebug){ // if IE
			
		try {
			this.xmlRequest=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e){
			try{
				this.xmlRequest=new ActiveXObject("Microsoft.XMLHTTP");
			}catch (e){}
		}
	}
	
	if(!this.xmlRequest){
		this.createIframe();	
	}
	return this;
}

AjaxRequest.prototype.createIframe=function(){
	if(isdebug) alert("create iframe");
	if (document.createElement && document.documentElement &&
	   (window.opera || navigator.userAgent.indexOf('MSIE 5.0') == -1)){
		var ifr = document.createElement('iframe');
		ifr.setAttribute('id', this.iframeID);
		ifr.setAttribute('name', this.iframeID);
		ifr.style.visibility = 'hidden';
		ifr.style.position = 'absolute';
		ifr.style.width = ifr.style.height = ifr.borderWidth = '500px';
		ifr.src = "/_hdn/blank_ajax.html";
		this.iframeRequest = document.getElementsByTagName('body')[0].appendChild(ifr);

	}else if (document.body && document.body.insertAdjacentHTML){
		document.body.insertAdjacentHTML('beforeEnd', '<iframe name="' + this.iframeID +   '" id="' + this.iframeID + '" style="display: none" src="/_hdn/blank_ajax.html"></iframe>');
	}

	
	if (window.frames && window.frames[this.iframeID]) this.iframeRequest = window.frames[this.iframeID];

	
	this.iframeRequest.name = this.iframeID;


}

AjaxObject=function(name, targetArea, elementID, msgArea){
	this.name = name;
	this.ajaxReq=new AjaxRequest(name);
	this.elementID=elementID;
	this.targetArea=targetArea;
	this.msgArea=msgArea;
	this.responseData;
	this.callbackFunc;
	this.finalProcessFunc;
	this.loadingURI;
	this.useIframe;
	this.paramValues;
	this.tailAjax = true;
	this.isMessageAlert = true;
	
	arrAjaxObject[name] = this;	
}

AjaxObject.prototype.load=function(url, useiframe){
	this.useIframe=useiframe;
	if (!url || (!this.ajaxReq.xmlRequest && !this.ajaxReq.iframeRequest)) return false;
	if (this.tailAjax && url.indexOf(".ajax") < 0){
		if(isdebug)alert("url must be .ajax");	
		document.location.href=url;
		return true;
	}
	
	if(!this.callbackFunc){
		this.callbackFunc=callbackLoad;
	}
	
	if (this.msgArea){
		document.getElementById(this.msgArea).style.display = "";
	}
	
	if (this.ajaxReq.xmlRequest){
		//if(isdebug) alert("xml request");
		try{
			return this.setXmlResponse(url, null, useiframe);
		}catch(e){
			
		}
	}else{
		if(useiframe && this.ajaxReq.iframeRequest){
			if(isdebug) alert("iframe request");
			return this.setIframeResponse(url, null);
		}else{
			return false;
		}
	}
}

AjaxObject.prototype.submit=function(formRef, useiframe){
	this.useIframe=useiframe;
	var method = formRef.getAttribute('method'), url = formRef.getAttribute('action');
	if (!url || (!this.ajaxReq.xmlRequest && !this.ajaxReq.iframeRequest)) return false;
	if (this.tailAjax && url.indexOf(".ajax") < 0){
		if(isdebug)alert("url must be .ajax");	
		document.location.href=url;
		return true;
	}

	if(!this.callbackFunc){
		this.callbackFunc=callbackSubmit;
	}

	if (this.msgArea){
		document.getElementById(this.msgArea).style.display = "block";
	}

	if (method && method.toLowerCase() == 'post') {
		if (this.ajaxReq.xmlRequest){
			this.setXmlResponse(url, parseForm(formRef), false);
			return false;
		}else if (this.ajaxReq.iframeRequest){
			return this.setIframeResponse(url, formRef);
		}else{
			return false;
		}
	 } else {
		  return this.load(url + (url.indexOf('?') == -1 ? '?' : '&') + parseForm(formRef));
	 }

}

AjaxObject.prototype.message=function(url, useiframe){
	this.useIframe=useiframe;
	if (!url || (!this.ajaxReq.xmlRequest && !this.ajaxReq.iframeRequest)) return false;
	if (this.tailAjax && url.indexOf(".ajax") < 0){
		if(isdebug)alert("url must be .ajax");	
		document.location.href=url;
		return true;
	}
	
	if(!this.callbackFunc){
		this.callbackFunc=callbackMessage;
	}
	
	if (this.msgArea){
		document.getElementById(this.msgArea).style.display = "";
	}
	
	if (this.ajaxReq.xmlRequest){
		//if(isdebug) alert("xml request");
		try{
			return this.setXmlResponse(url, null, true);
		}catch(e){
		}
	}else if(this.ajaxReq.iframeRequest){
			if(isdebug) alert("iframe request");
			return this.setIframeResponse(url, null);
	}else{
		return false;
	}
	
}


AjaxObject.prototype.setXmlResponse=function(url, formStr, isRetryParseResult){

	var ajaxObj=this;	
	var ajaxReqObj=this.ajaxReq;
	var xmlReqObj=this.ajaxReq.xmlRequest;
	var elementID=this.elementID;
	var url=url + (url.indexOf('?') == -1 ? '?' : '&') + "___ajaxcachebust="+new Date().getTime();
	var callbackFunc=this.callbackFunc;
	var finalProcessFunc=this.finalProcessFunc;
	var targetArea=this.targetArea;
	var msgArea=this.msgArea;
	var paramValues=this.paramValues;
	var isMessageAlert=this.isMessageAlert;

	xmlReqObj.onreadystatechange=function() {
		var resultContent="";
		var isSuccess=true;
		if (xmlReqObj.readyState == 4){ //if request of file completed

			if (msgArea){
				document.getElementById(msgArea).style.display = "none";
			}
			
			if (isdebug) showDebug(url, formStr);

			if (xmlReqObj.status==200 || window.location.href.indexOf("http")==-1){ //if request was successful or running script locally
				try{	
					var doc;
					var is_ie = ((navigator.userAgent.toLowerCase().indexOf("msie") != -1) && (navigator.userAgent.toLowerCase().indexOf("opera") == -1));
					if (!is_ie){
						doc = (new DOMParser()).parseFromString(xmlReqObj.responseText, "text/xml");
					}else{
						doc = xmlReqObj.responseXML;
					}					
					
					resultContent = getContent(doc, elementID);
					if(elementID){
						isSuccess = checkSuccess(doc);
					}
				}catch(e){
					isSuccess = false;
					if(isRetryParseResult){	
						
						//xmlResponse받을때 오류가 있다면 iframeRequest를 보낸다.
						ajaxReqObj.createIframe();
						ajaxReqObj.iframeUrl = url;
						if(isdebug) alert("iframe request");
						return;
					}
				
				}
				if(isSuccess == null) isSuccess = true;
				
				callbackFunc(resultContent, targetArea, isSuccess, url, finalProcessFunc, paramValues, isMessageAlert);
			}else{
				isSuccess = false;
				callbackFunc("", targetArea, isSuccess, url, finalProcessFunc, paramValues, isMessageAlert);
			}
		}

	};
	xmlReqObj.open(formStr ? 'POST' : 'GET', url, true);
	if (formStr ) {
	   	xmlReqObj.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8');
	   	xmlReqObj.setRequestHeader("Connection", "close");
		xmlReqObj.send(formStr);
	}else{
		xmlReqObj.send(null);	
	}


	return true;
}

AjaxObject.prototype.setIframeResponse=function(url, formRef){
															
	var iframeReqObj=this.ajaxReq.iframeRequest;
	var url=url + (url.indexOf('?') == -1 ? '?' : '&') + "___ajaxreq=iframe&___ajaxcachebust="+new Date().getTime();
	if (!document.readyState) return false;
	if (document.getElementById) var o = document.getElementById(this.ajaxReq.iframeID).offsetWidth;

	// Either route the form submission to the IFRAME (easy!)...
	if (formRef) formRef.setAttribute('target', this.ajaxReq.iframeID);
	// ...or load the provided URI in the IFRAME, checking for browser bugs:
	// 1) Safari only works well using 'document.location'.
	// 2) Opera needs the 'src' explicitly set!
	// 3) Konqueror 3.1 seems to think ifrDoc's location = window.location, so watch that too.
	var ifrDoc = iframeReqObj.contentDocument || iframeReqObj.document;

	if (!window.opera && ifrDoc.location &&	 ifrDoc.location.href != location.href) ifrDoc.location.replace(url);
	else iframeReqObj.src = url;
	// Either way, set the loading flag and start the readyState checking loop.
	// Opera likes a longer initial timeout with multiple frames running...
	this.loadingURI = url;

	//setTimeout(this.name+".checkIframeRequest()", (window.opera ? 250 : 100));
}

AjaxObject.prototype.checkIframeRequest=function(){
	var iframeReqObj=this.ajaxReq.iframeRequest;
	// Called after a timeout, periodically calls itself until the load is complete.
	// Get a reference to the loaded document, using either W3 contentDocument or IE's DOM.

	doc = iframeReqObj.contentDocument || iframeReqObj.document;
	// Check the IFRAME's .readyState property and callback() if load complete.
	// IE4 only seems to advance to 'interactive' so let it proceed from there.
	var il = iframeReqObj.location, dr = doc.readyState;
	var ilhref = "";
	var loadurl = "";
	if(il && il.href){
		ilhref = il.href.indexOf("http://") < 0 ? il.href : il.href.substr(7);
		ilhref = ilhref.substr(ilhref.indexOf("/"));
		loadurl= this.loadingURI.indexOf("http://") < 0 ? this.loadingURI : this.loadingURI.substr(7);
		loadurl= loadurl.substr(loadurl.indexOf("/"));
	}
	 if (ilhref == loadurl &&
	(dr == 'complete' || (!document.getElementById && dr == 'interactive')))
	{
		this.responseData = getContent((doc.documentElement || doc), this.elementID);
		this.callbackFunc(this.responseData, this.targetArea, true, loadurl, this.finalProcessFunc, this.paramValues, this.isMessageAlert);
		this.loadingURI = '';
		if (this.msgArea){
				document.getElementById(this.msgArea).style.display = "none";
		}
	}
	else setTimeout(this.name + '.checkIframeRequest()', 50);
}

// AjaxObject End/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

parseForm = function(form) { with (this)
{
 // Parses a form DOM reference to an escaped string suitable for GET/POSTing.

 var str = '', gE = 'getElementsByTagName', inputs = [
  (form[gE] ? form[gE]('input') : form.all ? form.all.tags('input') : []),
  (form[gE] ? form[gE]('select') : form.all ? form.all.tags('select') : []),
  (form[gE] ? form[gE]('textarea') : form.all ? form.all.tags('textarea') : [])
 ];

 // Loop through each list of tags, constructing our string.
 for (var i = 0; i < inputs.length; i++)
  for (j = 0; j < inputs[i].length; j++)
   if (inputs[i][j])
   {
	if(inputs[i][j].type == "checkbox" && !inputs[i][j].checked) continue;
	else if(inputs[i][j].type == "button") continue;	
	else if(inputs[i][j].type == "image") continue;	
	else if(inputs[i][j].type == "reset") continue;	
	else if(inputs[i][j].type == "submit") continue;	
    
	var plus = '++'.substring(0,1); // CodeTrim fix.
    str += encodeURIComponent(inputs[i][j].getAttribute('name')).replace(plus, '%2B') +
     '=' + encodeURIComponent(inputs[i][j].value).replace(plus, '%2B') + '&';
   }

 // Strip trailing ampersand, because we can :)
 return str.substring(0, str.length - 1);
}};


getContent=function(domDoc, elementID){
	// This copies the <body> content of the loaded DOM document into an element in the
	// current page with a specified ID.

	// Retrieve references to the loaded BODY. You might want to modify this so that you
	// load content from <div id="content"> within the loaded document perhaps?
	var src = domDoc.body?  domDoc.body : (domDoc.getElementsByTagName('body')[0] ? domDoc.getElementsByTagName('body')[0] : domDoc);
	// innerHTML is still a little more reliable than importNode across browsers.
	if (src.innerHTML){
		return src.innerHTML;
	}else {
		if(elementID){
			return domDoc.documentElement.getElementsByTagName(elementID)[0].firstChild.nodeValue;
		}else{
			return domDoc;
		}
	}
}

checkSuccess=function(domDoc){
	return domDoc.documentElement.getAttribute("success");
}

document.writeln=function(str) {document.write(str+"\n");};
var oldWriteMethod = document.write;

function evalInDiv(js, target) {
	target.innerHTML = "";
	document.write = function(str){
		target.innerHTML += str;
	};
	eval(js);
	document.write = oldWriteMethod;
}


function srcInDiv(jsObj, src, target) {
	try {
		target.innerHTML = "";
		document.write = function(str){
			target.innerHTML += str;
		};
		jsObj.setAttribute("src", src);
	} catch(e) { }
}

var embedScriptArr = null;
var embedScriptIdx = 0;
scriptParse=function(obj){
     try {
        tmpEmbedScriptArr = obj.getElementsByTagName("SCRIPT");
        if( tmpEmbedScriptArr != null ) {
                embedScriptArr = new Array();
                for( i=0; i<tmpEmbedScriptArr.length; i++ ) {
                        embedScriptArr[i] = tmpEmbedScriptArr[i];
                }
        }
        if (embedScriptArr != null) {
            embedScriptIdx = 0;
            executeScript();
        }
    }catch(e){}
};


try {
	var	jsWriteDiv = document.createElement("DIV");
	jsWriteDiv.style.cssText = "display:none;";
}catch(e){ }
var _agent = navigator.userAgent.toLowerCase();
executeScript=function(){
    try {
            if(embedScriptIdx >= embedScriptArr.length)
                return;

            if(embedScriptArr[embedScriptIdx].src != ""){
            	var	embedJsObject = embedScriptArr[embedScriptIdx];
                var source = embedJsObject.src;
                if(navigator.userAgent.toLowerCase().indexOf('msie') > -1) {
                	try {
	                	srcInDiv(document.getElementById("dynamicContent"), source, jsWriteDiv);
			            dynamicContent.onreadystatechange = function(){
			            	document.write = oldWriteMethod;
			            	for( var i=0; i<jsWriteDiv.childNodes.length; i++ ) {
			            		embedJsObject.parentNode.insertBefore(jsWriteDiv.childNodes[i], embedJsObject);
			            	}
	                        embedScriptIdx++;
	                        executeScript();
	                    }
                	} catch(e) { }
                } else {
                    var sss  = document.createElement("script");
                    sss.src = source;
                    sss.onload = function(){
                        embedScriptIdx++;
                        executeScript();
                    };
                    document.body.appendChild(sss);
                    if(_agent.indexOf("safari")>-1 && _agent.indexOf("419") >-1){ // when safari ver 2.0
                    	embedScriptIdx++;
                        executeScript();
                    } 
                }
            }else{
            	if( embedScriptArr[embedScriptIdx].innerHTML.indexOf("write") > -1 ) {
            		try {
	            		var	embedJsObject = embedScriptArr[embedScriptIdx];
	                	evalInDiv(embedScriptArr[embedScriptIdx].innerHTML, jsWriteDiv);
	                	for( var i=0; i<jsWriteDiv.childNodes.length; i++ ) {
			            	embedJsObject.parentNode.insertBefore(jsWriteDiv.childNodes[i], embedJsObject);
			            }
            		}catch(e) { }
            	}
            	else {
	                eval(embedScriptArr[embedScriptIdx].innerHTML);
            	}
                embedScriptIdx++;
                executeScript();
            }
    }catch(e){
    }
};


viewContent=function(doc, destId){
	var dest = document.getElementById ? document.getElementById(destId) :  (document.all ? document.all[destId] : null);
	var src = this.getContent(doc, "contents");
	dest.innerHTML = src;

}

callbackLoad=function(responseData, targetArea, isSuccess, url, finalProcess, paramValues){
	try{
		if(isSuccess == true || isSuccess == "true"){
			var dest = document.getElementById ? document.getElementById(targetArea) :  (document.all ? document.all[targetArea] : null);
			if (dest != null) {
				if(dest.style.display == "none")	{
					dest.style.display = "block";
				}
				if (navigator.userAgent.indexOf("Safari") > 0 && navigator.userAgent.indexOf("Chrome") <= 0 && navigator.userAgent.indexOf("Netscape") <= 0 ) {
					window.scrollTo(0, 0);	// for Safari Display Bug.
				}
				dest.innerHTML = responseData;
				//debugTool.write(responseData);
				scriptParse(dest);
			}
		}else{
			url = url.replace(".ajax", ".do");
			document.location.href = url;
		}
			
		if(finalProcess) finalProcess(isSuccess, url, paramValues);	
	}catch(e){
		url = url.replace(".ajax", ".do");
		document.location.href = url;
	}
}


callbackMessage=function(responseData, targetArea, isSuccess, url, finalProcess, paramValues, isMessageAlert){
	if(isSuccess == false || isSuccess == "false"){
		if(isMessageAlert){
			alert("현재 사용자가 많아 정상적으로 데이터를 읽지 못했습니다. 잠시 후 다시 시도해주시기 바랍니다.");
		}
	}else{
		var dest = document.getElementById ? document.getElementById(targetArea) :  (document.all ? document.all[targetArea] : null);
		dest.innerHTML = responseData;
		scriptParse(dest);
	}
		
	if(finalProcess) finalProcess(isSuccess, url, paramValues);	
		
}


callbackSubmit=function(responseData, targetArea, isSuccess, url, finalProcess, paramValues, isMessageAlert){
	if(isSuccess == false || isSuccess == "false"){
		if(isMessageAlert){
			alert("현재 사용자가 많아 정상적으로 데이터를 읽지 못했습니다. 잠시 후 다시 시도해주시기 바랍니다.");
		}
	}else{
		var dest = document.getElementById ? document.getElementById(targetArea) :  (document.all ? document.all[targetArea] : null);
		dest.innerHTML = responseData;
		scriptParse(dest);
	}
		
	if(finalProcess) finalProcess(isSuccess, url, paramValues);	
		
}

locationAjax=function(objAjax, url, callback){
	if(objAjax){
		var isSuccess = false;	
		var orgUrl = url;
		try{	
			if(!document.getElementById(objAjax.targetArea)){
				if(isdebug) alert("no target exist!");
				location.href=url;
				return;
			}	
			url = url.replace(".do", ".ajax");

			window.isAjax=true;
			historyInsert(url);
			isSuccess = objAjax.load(url, false);
			if(isSuccess){
				currentPageURL = orgUrl;
			}else{
				if(isdebug)alert("ajax fail!");
				location.href=orgUrl;
			}
			
		}catch(e){
			if(isdebug)alert("ajax fail!-exception "+e);
			location.href=orgUrl;
		}

	}else{
		if(isdebug)alert("ajax object not exist!");
		location.href=url;
	}

}

showDebug=function(url, formStr){
	url = url.replace(".ajax", ".do");
	var _winDebugSrc = window.open(url, "_winDebugSrc");
	//_winDebugSrc.focus();

}




function goPage(page){
	if(document.getElementsByName("cateList").length>0 ){
		goCatePage(page);
	}else if(document.getElementsByName("articleTypeList").length>0){
		goTypeMainPage(page);
	}else if(document.getElementsByName("lastList").length>0){
		goLastPage(page);
	}else if(document.getElementsByName("boardList").length>0 ){
		goBoardPage(page);
	}else if(document.getElementsByName("themeList").length>0){
		goThemePage(page);
	}else if(document.getElementsByName("articleList").length>0){
		goAllPage(page);
	}else if(document.getElementsByName("movieList").length>0){
		goMoviePage(page);
	}else if(document.getElementsByName("photoList").length>0){
		goPhotoPage(page);
	}else if(document.getElementsByName("articleTemp").length>0){
		goTempPage(page);
	}else if(document.getElementsByName("referList").length>0){
		goReferSearchPage(page);
	}else if(document.getElementsByName("search_result").length>0){
		goSearchPage(page);
	}else{
		goAllPage(page);
	}
}

	function goSearchPage(page){
		createMainAjax();
		loadedDynamicContent = new Array();
		var obj;
		var f = document.frm;

    		f.page.value=page;
    		obj = getForm(f);

		locationAjax(blogMainAjax,"/_blog/search.do?"+ obj);
	}


function goPageAjax(url){
		createMainAjax();
		loadedDynamicContent = new Array();
		locationAjax(blogMainAjax, url);
		setLastPageUrl(url);
}
	
function goBoardPage(page){
    	createMainAjax();
    	var search ="";
    	var sword = document.getElementById("boardsearchword");
		var is_boardcnt_exist = false;
		if(document.getElementById("boardcount")){
			is_boardcnt_exist = true;
		}
		if (typeof(page) == "undefined") {
			is_boardcnt_exist = false;
			page = 0;
		}
		if (page == 0){
    		if(sword !=null)  document.getElementById("boardsearchword").innerHTML="";
    		page =1;
    	}
    	if( sword !=null){
    		var swsw = sword.innerHTML;
    		var pot = swsw.indexOf("=");
    		swk = swsw.substring(0,pot);
    		sww = swsw.substring(pot+1)
    		search = "&"+swk+"="+encodeURIComponent(sww);
    	}
    	if (is_boardcnt_exist){
    		var count = document.getElementById("boardcount").innerHTML;
	    	locationAjax(blogMainAjax, "/_blog/BoardView.do?currentPage="+page+"&blogid="+BLOGID+"&totalcount="+count+search);
		}else{
			locationAjax(blogMainAjax, "/_blog/BoardView.do?currentPage="+page+"&blogid="+BLOGID+search);
		}
}

function goThemePage(page){
		createMainAjax();
		loadedDynamicContent = new Array();
		if(document.getElementsByName("themeList").length>0){
    	 	frm = document.themeList;
    		frm.currentPage.value=page;
    		//var totcnt = document.getElementById("totT").innerHTML;
    		var obj = getForm(frm);//+"&totalcnt="+totcnt;
		}
		locationAjax(blogMainAjax, "/_blog/ThemeList.do?"+obj);
}

function goTempPage(page){
		createMainAjax();
		loadedDynamicContent = new Array();
		if(document.getElementsByName("articleTemp").length>0){
    	 	frm = document.articleTemp;
    		var blogid = frm.blogid.value;
			locationAjax(blogMainAjax, "/_blog/ArticleTempList.do?blogid="+blogid);
		}

}

function goCatePage(page){
		createMainAjax();
		loadedDynamicContent = new Array();
		if(document.getElementsByName("cateList").length>0){
    	 	frm = document.cateList;
    		frm.currentPage.value=page;
    		var cate = frm.CATEGORYID.value
				if(cate == "0") { 
					cate = ""; 
				}     		
   			var totcnt = document.getElementById("totC"+cate).innerHTML;
			frm.articleno.value = "";
			frm.regdt.value = "";
    		var obj = getForm(frm)+"&totalcnt="+totcnt;
		}
		locationAjax(blogMainAjax,"/_blog/ArticleCateList.do?"+ obj);
}

function goMoviePage(page){
		createMainAjax();
		loadedDynamicContent = new Array();
		var obj;
		frm = document.movieList;
		
		if(document.getElementsByName("movieList").length>0){
    		frm.currentPage.value=page;
    		if(document.getElementById("totC")!=null)
    		var totcnt = document.getElementById("totC").innerHTML;
    		var categoryid = document.getElementById("categoryid") ? document.getElementById("categoryid").innerHTML : "";
    		var obj = getForm(frm)+"&totalcnt="+totcnt+"&categoryid="+categoryid;
		}else{
			obj = "blogid="+BLOGID+"&categoryid="+categoryid;
		}
		locationAjax(blogMainAjax,"/_blog/movieList.do?"+ obj);
}

function goPhotoPage(page){
		createMainAjax();
		loadedDynamicContent = new Array();
		var obj;
		frm = document.photoList;
		if(document.getElementsByName("photoList").length>0){
    		frm.currentPage.value=page;
    		if(document.getElementById("totC")!=null){
	    		var totcnt = document.getElementById("totC").innerHTML;
	    	}
    		if(document.getElementById("categoryid")!=null){
    			var categoryid = document.getElementById("categoryid").innerHTML;
    		}
    		var obj = getForm(frm)+"&totalcnt="+totcnt+"&categoryid="+categoryid;
		}else{
			obj = "blogid="+BLOGID+"&categoryid="+categoryid;
		}
		locationAjax(blogMainAjax,"/_blog/photoList.do?"+ obj);
}

// neouser 
function goReferSearchPage(page, init){
	var count = 1;
	if (page != null) { count = page; } 

	document.referList.dispkind.value="B2204";
	
	createMainAjax("bC_refer_search_list_box", true);
 	loadedDynamicContent = new Array();
	var obj;
	frm = document.referList;
	if(document.getElementsByName("referList").length>0){
	 	frm.currentPage.value=count;
		obj = getForm(frm);
	}
	else{
		obj = "blogid="+BLOGID;
	}
	if( init != null ) {
		locationAjax(blogMainAjax, "/_blog/hdn/ArticleCateList.do?"+obj);
		window.isAjax=false;
	} else {
		locationAjax(blogMainAjax, "/_blog/ArticleCateList.do?"+obj);
		if( typeof(requestAjaxCheck) == 'function' ) {
			requestAjaxCheck("action=ArticleCateList&"+obj);
		}
	}
}

function goAllPage(page){
		createMainAjax();
		loadedDynamicContent = new Array();
		var obj;
		frm = document.articleList;
    		
		if(document.getElementsByName("articleList").length>0){
    	 	frm.currentPage.value=page;
    		if(document.getElementById("totC")!=null)
    		var totcnt = document.getElementById("totC").innerHTML;
    		obj = getForm(frm)+"&totalcnt="+totcnt;
		} 
		else{
			obj = "blogid="+BLOGID;
		}
		locationAjax(blogMainAjax, "/_blog/blogMain.do?"+obj);
}

function goTypeMainPage(page){
		createMainAjax();
		loadedDynamicContent = new Array();
		var obj;
		frm = document.articleTypeList;
		if(document.getElementsByName("articleTypeList").length>0){
    	 	frm.currentPage.value=page;
    		if(document.getElementById("totC")!=null){
    			var cate = frm.CATEGORYID.value
				if(cate == "0"){ cate = ""; }    		
    			var totcnt = document.getElementById("totC"+cate).innerHTML;
    		}
			if(page != 0){
				frm.articleno.value = "";
				frm.regdt.value = "";
			}
    		obj = getForm(frm)+"&totalcnt="+totcnt;
		} 
		else{
			obj = "blogid="+BLOGID;
		}
		locationAjax(blogMainAjax, frm.action+"?"+obj);
}

function goLastPage(page){
		createMainAjax();
		loadedDynamicContent = new Array();
		if(document.getElementsByName("lastList").length>0 ){
    	 	frm = document.lastList;
    		frm.currentPage.value=page;
    		var totcnt = 0;// document.getElementById("totC"+frm.CATEGORYID.value).innerHTML;
    		var obj = getForm(frm)+"&totalcnt="+totcnt;
		}
		locationAjax(blogMainAjax,"/_blog/ArticleLastList.do?"+ obj);
}

function goListInView(page) {
		createMainAjax("bC_article_list_box", true);
	 	loadedDynamicContent = new Array();
		if(document.getElementsByName("inViewList").length>0){
    	 	frm = document.inViewList;
    		frm.currentPage.value=page;
    		var obj = getForm(frm);
		}
		locationAjax(blogMainAjax, "/_blog/ArticleListInView.do?"+obj+"&___historyGo__daumBlog");
		if( typeof(requestAjaxCheck) == 'function' ) {
			requestAjaxCheck("action=ArticleListInView&"+obj);
		}
}

function goListTitle(page){
			if(document.getElementsByName("cateList").length>0 ){
				document.cateList.dispkind.value="B2202";
			}
			else if(document.getElementsByName("lastList").length>0 ){
				document.lastList.dispkind.value="B0802";
			}
			else if(document.getElementsByName("articleTypeList").length > 0){
				document.articleTypeList.viewKind.value="T";
				document.articleTypeList.dispkind.value="B2202";
				document.articleTypeList.action="/_blog/ArticleCateList.do";
			}
			else if(document.getElementsByName("articleList").length > 0){
				document.articleList.dispkind.value="B0802";
			}
					
			if(page==0) {
				goPage(0);
			} else { 
				goPage(1);
			}
}

function goListBody(page){
			if(document.getElementsByName("cateList").length>0){
				document.cateList.dispkind.value="B2201";
			}else if(document.getElementsByName("lastList").length>0 ){
				document.lastList.dispkind.value="B0802";
			}else if(document.getElementsByName("articleTypeList").length > 0){
				document.articleTypeList.viewKind.value="V";
				document.articleTypeList.dispkind.value="B2201";
				document.articleTypeList.action="/_blog/ArticleCateList.do";
			}else if(document.getElementsByName("articleList").length > 0){
				document.articleList.dispkind.value="B0801";
			}
			if(page==0) {
				goPage(0);
			} else { 
				goPage(1);
			}
}

function goListWebzine(page){
			if(document.getElementsByName("cateList").length>0){
				document.cateList.dispkind.value="B2203";
			}else if(document.getElementsByName("lastList").length>0 ){
				document.lastList.dispkind.value="B0802";
			}else if(document.getElementsByName("articleTypeList").length > 0){
				document.articleTypeList.viewKind.value="S";
				document.articleTypeList.dispkind.value="B2203";
				document.articleTypeList.action="/_blog/ArticleCateList.do";
			}else if(document.getElementsByName("articleList").length > 0){
				document.articleList.dispkind.value="B0803";
			}
			if(page==0) {
				goPage(0);
			} else { 
				goPage(1);
			}
}

function openerReloadSelfClose(reloadUrl, popWin){
	createMainAjax();
	blogMainAjax.finalProcessFunc = function (){if(popWin){popWin.close();}};
	locationAjax(blogMainAjax, reloadUrl);	
}

function viewAjaxCateArticle(link, cate, menuIndex){
		// change title menu item class
		if (typeof changeMenuOn == "function" && typeof menuIndex != "undefined") changeMenuOn(menuIndex);
		createMainAjax();
	 	loadedDynamicContent = new Array();
	 	
	 	if(cate=="0"){ cate = ""; }
	 	
		if(document.getElementById("totC"+cate)){
    		var totcnt = document.getElementById("totC"+cate).innerHTML;
    		link+="&totalcnt="+totcnt;
		}

		locationAjax(blogMainAjax, link);
		if(document.getElementById("linkCategory_"+cate)){
			if(document.getElementById("linkCategory_"+cate).style)
			document.getElementById("linkCategory_"+cate).style.textDecoration="underline";
			addOnUnLoadMapping("document.getElementById(\"linkCategory_"+cate+"\").style.textDecoration=\"\";");
		}
}

function viewAjaxArticle(link, curObj, menuIndex){
		// change title menu item class
		if (typeof changeMenuOn == "function" && typeof menuIndex != "undefined") changeMenuOn(menuIndex);
		
		createMainAjax();
	 	loadedDynamicContent = new Array();
		if(document.getElementById("totC")){
    		var totcnt = document.getElementById("totC").innerHTML;
    		link+="&totalcnt="+totcnt;
		}
		locationAjax(blogMainAjax, link);
		if(curObj){
			if(curObj.style)
			curObj.style.textDecoration="underline";
			addOnUnLoadMapping("document.getElementById(\""+curObj.id+"\").style.textDecoration=\"\";");
		}
}

function viewAjaxThemeList(link,count,cate, menuIndex){
		// change title menu item class
		if (typeof changeMenuOn == "function" && typeof menuIndex != "undefined") changeMenuOn(menuIndex);
		
		createMainAjax();
	 	loadedDynamicContent = new Array();
		link+="&totalcnt="+count;
		locationAjax(blogMainAjax, link);
		if(document.getElementById("linkCategory_"+cate)){
			if(document.getElementById("linkCategory_"+cate).style)
			document.getElementById("linkCategory_"+cate).style.textDecoration="underline";
			addOnUnLoadMapping("document.getElementById(\"linkCategory_"+cate+"\").style.textDecoration=\"\";");
		}
}

function viewLastDayAjaxArticle(link, menuIndex){
		// change title menu item class
		if (typeof changeMenuOn == "function" && typeof menuIndex != "undefined") changeMenuOn(menuIndex);
		
		createMainAjax();
	 	loadedDynamicContent = new Array();
		//var totcnt = document.getElementById("totC").innerHTML;
		//link+="&totalcnt="+totcnt;
		locationAjax(blogMainAjax, link);
}

var lastPageUrl;
function setLastPageUrl(link){
	lastPageUrl = link;
}
function getLastPageUrlEncoded(){
	return encodeURIComponent(lastPageUrl);
}

var lastElementId;
function viewAjaxCollection(link, elementId){
		createMainAjax();

		locationAjax(blogMainAjax, link);
		setLastPageUrl(link);
		if(document.getElementById(lastElementId)){			
			document.getElementById(lastElementId).style.textDecoration ="none";
		}
		if(document.getElementById(elementId)){				
			document.getElementById(elementId).style.textDecoration ="underline";
			lastElementId = elementId;
		}
}
function ToogleListInView(bIsHelpClose) {
		var oOpenAnchor = document.getElementById("open_list");
		var oInViewDiv = document.getElementById("bC_article_list_box");

		if( oOpenAnchor == null || oInViewDiv == null ) {
			return;
		}

		if(oOpenAnchor.className == 'closed_list'){
			oOpenAnchor.className = 'open_list';
			oInViewDiv.style.display = 'block';
			goListInView("");
			oOpenAnchor.innerHTML = "목록닫기" ;
		}
		else{
			if( typeof(bIsHelpClose) != 'undefined' && bIsHelpClose  ) {
				return ;
			}
			oOpenAnchor.className = 'closed_list';
			oInViewDiv.style.display = 'none';
			oOpenAnchor.innerHTML = "목록열기" ;
		}
}
/*
메뉴 (photo/movie/theme) 클릭했을때 언더라인 그어 주는 펑션 
*/
function toggleunderline(type){
	var omenuphoto = document.getElementById("cate_photo");
	var omenumovie = document.getElementById("cate_movie");
	var omenutheme = document.getElementById("cate_theme");
	if(omenuphoto == null || omenumovie == null || omenutheme == null){
		return ;
	}
	if(type == 'P'){
	  omenuphoto.childNodes[0].className = "under";
	  omenumovie.childNodes[0].className = "";
	  omenutheme.childNodes[0].className = "";
	}else if (type=="M"){
	  omenuphoto.childNodes[0].className = "";
	  omenumovie.childNodes[0].className = "under";
	  omenutheme.childNodes[0].className = "";
	}else{
	  omenuphoto.childNodes[0].className = "";
	  omenumovie.childNodes[0].className = "";
	  omenutheme.childNodes[0].className = "under";
	}
}
function loadXMLDoc(method,url,data,func,funcfail, isSync) {
    var xmlhttp=null;
    var vf = function(){
      if (xmlhttp.readyState==4) {
        if (xmlhttp.status==200) {
        	if(func !=null)
          		eval(func+'(xmlhttp)');
        } else {
        	if(funcfail !=null)
          		eval(funcfail+'(xmlhttp)');
        }
      }
    }
	try{
    	if (window.XMLHttpRequest) {
        	xmlhttp=new XMLHttpRequest();
    	} else if (window.ActiveXObject) {
        	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    	}
	}catch(err){
		return false;
	}
	if(xmlhttp!=null){
		if(isSync == null) {
			isSync = true;
		}
		try{
    		xmlhttp.onreadystatechange=vf;
    		if(method=="POST" && (data !=null || data !="")){
      			xmlhttp.open("POST",url,isSync);
	  			xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
	  			xmlhttp.setRequestHeader("Content-Length", data.length);
	  			xmlhttp.setRequestHeader("Connetion","close");
      			xmlhttp.send(data);
    		}else{
      			xmlhttp.open("GET",url,isSync);
      			xmlhttp.send(null);
    		}
		}catch(e){
			return false;
		}
		return true;
	}else{
		return false;
	}
}
function loadXMLDocWithParam(method,url,data,func,funcfail,obj) {
    var xmlhttp=null;
    var vf = function(){
      if (xmlhttp.readyState==4) {
        if (xmlhttp.status==200) {
        	if( func != null )
          		eval(func+'(xmlhttp,obj)');
        } else {
        	if(funcfail !=null)
          		eval(funcfail+'(xmlhttp)');
        }
      }
    }
	try{
    	if (window.XMLHttpRequest) {
        	xmlhttp=new XMLHttpRequest();
    	} else if (window.ActiveXObject) {
        	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    	}
	}catch(err){
		return false;
	}
	if(xmlhttp!=null){
		try{
    		xmlhttp.onreadystatechange=vf;
    		if(method=="POST" && (data !=null || data !="")){
      			xmlhttp.open("POST",url,true);
	  			xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
	  			xmlhttp.setRequestHeader("Content-Length", data.length);
	  			xmlhttp.setRequestHeader("Connetion","close");
      			xmlhttp.send(data);
    		}else{
      			xmlhttp.open("GET",url,true);
      			xmlhttp.send(null);
    		}
		}catch(e){
			return false;
		}
		return true;
	}else{
		return false;
	}
}
var tsleep = 0;
var mopac=0;
var viewLayer = false;
var lastClickUrl="";
function sleep(){
	var obj = document.getElementById("dashboard");
	if(!viewLayer){
		if(mopac<100){
			mopac+=30;
			obj.style.filter="alpha(opacity="+mopac+")";
			obj.style.MozOpacity= mopac*0.05;
		}else{
			clearTimeout(tsleep);
			tsleep=0;
			mopac=100;
			viewLayer = true;
		}
	}else{
		if(mopac> 0){
			mopac-=30;
			obj.style.filter="alpha(opacity="+mopac+")";
			obj.style.MozOpacity= mopac*0.05;
		}else{
			clearTimeout(tsleep);
			tsleep=0;
			mopac=0;
			viewLayer = false;
			obj.style.display="none";	
		}
	}
	
}
function sleep2(){
	var obj = document.getElementById("dashboard");
	if(!viewLayer){
		obj.style.display="block";
		viewLayer = true;
	}else{
		obj.style.display="none";
		viewLayer = false;
	}
}
function fncom_chk_strlength_cut(vn_maxlength, vn_str) {
	var vn_sumlength=0;
	var vn_restr='';
	for(var i= 0;i < vn_str.length; i++) {
		if( escape(vn_str.charAt(i)).length > 3 ) { vn_length = 2; }
		else if (vn_str.charAt(i) == '<' || vn_str.charAt(i) == '>') { vn_length = 4; }
		else { vn_length = 1 ; }
		if ( vn_maxlength < (vn_sumlength + vn_length) ) { break; }
		vn_sumlength += vn_length;
		vn_restr += vn_str.charAt(i);
	}
	return (vn_restr);
}
function cutStr(str,limit){ 
  var tmpStr = str; 
  var byte_count = 0; 
  var len = str.length; 
  var dot = ""; 
   
  for(var i=0; i<len; i++){ 
    byte_count += chr_byte(str.charAt(i)); 
    if(byte_count == limit-1){ 
      if(chr_byte(str.charAt(i+1)) == 2){ 
        tmpStr = str.substring(0,i+1); 
        dot = "..."; 
      }else { 
        if(i+2 != len) dot = ".."; 
        tmpStr = str.substring(0,i+2); 
      } 
      break; 
    }else if(byte_count == limit){ 
      if(i+1 != len) dot = ".."; 
      tmpStr = str.substring(0,i+1); 
      break; 
    } 
  } 
  return (tmpStr+dot); 
  //return true; 
} 
function chr_byte(chr){ 
  if(escape(chr).length > 4) 
    return 2; 
  else 
    return 1; 
} 

function viewDiv(linkobj,event){
	var xpos=0;
	var ypos=0;
	var mousex=0;
	var mousey=0;
	if(linkobj !=null){
		xpos =findPosX(linkobj);
		ypos =findPosY(linkobj);
		if(window.event){
			mousex = event.clientX;
			mousey = event.clientY;
		}else{
 			mousex = event.pageX-document.body.scrollLeft;
        //    mousey = event.pageY-document.body.scrollTop;
            mousey = event.pageY;
		}
		var docX = document.body.clientWidth;
		var docY = document.body.clientHeight;
	}
	var obj = document.getElementById("dashboard");
	if(!viewLayer){
		if(mousex+200 > docX) xpos= xpos - 300;
		if(mousey+200 > docY) ypos= ypos - 200;
		obj.style.top = ypos;
		obj.style.left = xpos+100;
	//	obj.style.MozOpacity= 0;
		obj.style.display="block";	
	}
sleep2();
//	if(tsleep==0)
//		tsleep  = setInterval("sleep()", 50); 
}
function checkOut(e){
		if(!e) var e = window.event;
		var tg = (window.event)? e.srcElement:e.target;
		var reltg = (e.relatedTarget) ? e.relatedTarget : e.toElement;
		if(tg.nodeName !='DIV') return;
		while( reltg != tg && reltg.nodeName !='BODY'){
				reltg = reltg.parentNode;
				if(reltg == tg) return;
		}
		if(reltg.nodeName=='BODY'){
				viewDiv(null,null);
		}
}
function findPosX(obj){
		var curleft = 0;
		if(obj != null && obj.offsetParent){
				while(obj.offsetParent){
						curleft +=obj.offsetLeft;
						obj = obj.offsetParent;
				}
		}else if(obj !=null && obj.x){
				curleft += obj.x;
		}
		return curleft;
}
function findPosY(obj){
		var curtop = 0;

		if(obj != null && obj.offsetParent){
				while(obj.offsetParent){
						curtop +=obj.offsetTop;
						obj = obj.offsetParent;
				}
		}else if(obj != null && obj.y){
				curtop += obj.y;
		}
		return curtop;
}
function viewBlogList(linkobj,url,event){
		if(url.indexOf("http://blog.daum.net") > -1){
			url = url.substring(url.lastIndexOf("/")+1);
		}
		if(lastClickUrl != url){ // .. .....
			viewLayer = false;
		}
		lastClickUrl = url;
		if(!viewLayer){
			clickAreaCheck = true;
			var rtn = false;
			document.getElementById("resultarea").innerHTML = "<BR><BR><BR><CENTER><B> RSS를 읽는 중입니다.<br /> 잠시만 기다려 주세요</B></CENTER>";
			viewDiv(linkobj,event);
			rtn = loadXMLDoc("GET","/xml/rss/"+url,null,"WriteRSS","RSSFAIL");
			if(rtn ==false){
				RSSFAIL(null);
				return ;
			}
		}else{
			viewDiv(null,null);
			clickAreaCheck = false;
		}
}
function RSSFAIL(xmlhttp){
	xmlhttp = null;
	if(lastClickUrl.indexOf("http://")>-1){
		location.href=lastClickUrl;
	}else{
		location.href="/"+lastClickUrl;
	}
}
function WriteRSS(xmlhttp) {
	if ( xmlhttp ) {
		try{
			var xmldoc = getXMLDocument(xmlhttp);

			resultDiv = document.getElementById("resultarea");
			var items = xmldoc.getElementsByTagName('item');
			var channel = xmldoc.getElementsByTagName('channel');
			var webmaster = channel[0].getElementsByTagName('webMaster')[0].firstChild.nodeValue;
			var bloglink = channel[0].getElementsByTagName('link')[0].firstChild.nodeValue;
			var blogtitle = channel[0].getElementsByTagName('title')[0].firstChild.nodeValue;
			blogtitle =cutStr(blogtitle,26);	
			var head="<table width='200' border='0' cellpadding='0' cellspacing='0' background='http://pimg.daum-img.net/blog/p_img/visit_box_top_new.gif'><tr><td height=28>";
			head+="<a href='"+bloglink+"' class='bd_12_161615' style='margin:0 2 0 7' target='_top'>"+blogtitle+"</td></tr> </table>";
			var content="<table width='200' border='0' cellpadding='0' cellspacing='0' background='http://pimg.daum-img.net/blog/p_img/visit_box_bg_new.gif'><tr> <td height='10'></td></tr>";
			if(items.length> 10)
					tlen = 10;
			else
					tlen = items.length;
			for(var i = 0; i < tlen; i++) {
				var title = items[i].getElementsByTagName('title')[0];
				var title_text = title.firstChild.nodeValue
				var link = items[i].getElementsByTagName('link')[0];
				var link_text = link.firstChild.nodeValue;
				title_text = cutStr(title_text,26);
				content = content + "<tr><td><img src=http://pimg.daum-img.net/blog/p_img/visit_dot.gif align=absmiddle style='margin:0 4 0 7'><a href='" + link_text + "' class='d_12_6D6765' target='_blank'>" + title_text + "</a></td></tr><tr><td height='4'></td></tr>";
			}
			content+="<tr><td height='10'></td></tr></table><table width='200' border='0' cellpadding='0' cellspacing='0' background='http://pimg.daum-img.net/blog/p_img/visit_box_bottom_new.gif'><tr><td height='1'></td></tr></table>";
			resultDiv.innerHTML = head+content;
		}catch(e){
			location.href="/"+lastClickUrl;
		}
		xmlhttp = null;
	}
}

function getForm(frm){
		var len = frm.length;
		
		var obj="";
		for(i = 0 ; i < len; i++){
			if(frm[i].type =="radio" && !frm[i].checked)
				continue;
			if(frm[i].type =="checkbox" && !frm[i].checked)
				continue;
			if(frm[i].tagName =="SELECT") {
				for( j=0; j < frm[i].length; j++ ) {
					if( frm[i][j].selected ) {
						obj+="&"+frm[i].name+"="+encodeURIComponent(frm[i][j].value);
					}
				}
			} else {
				try {
					obj+="&"+frm[i].name+"="+encodeURIComponent(frm[i].value);
				}catch(e) {
					obj+="&"+frm[i].name+"="+frm[i].value;
				}
			}
		}
		return obj.substr(1);
}
function getSimpleResponse(oXmlHttp){
	var oXmlDoc = getXMLDocument(oXmlHttp);

	var items = oXmlDoc.getElementsByTagName('contents');
	if(items !=null)
		return items[0].firstChild.nodeValue;
	else
		return "";
}

function getXMLDocument(xmlhttp){
	var response;
	try{
		var is_ie = ((navigator.userAgent.toLowerCase().indexOf("msie") != -1) && (navigator.userAgent.toLowerCase().indexOf("opera") == -1));
		if (!is_ie){
			response = (new DOMParser()).parseFromString(xmlhttp.responseText, "text/xml");
		}else{
			response = xmlhttp.responseXML;
		}
	}catch(e){}	
	return response;
}
/* 관리를 위한 암전 */
var DarkLayer = {
	initDarkLayer: function() {
		this.isInit = false;
		this.isDark = false;

		this.oPopLayer = null;
		this.oDarkNode = document.createElement("DIV");
		this.oDarkNode.id = "darkLayer";
		this.oDarkNode.className = "inBright";
		this.nReloadStat = 0; // 0이 바꾼것 없음, 1이면 카테고리, 2면 전체 리로드
		
		this.sLastUrl = "";

		var oBody = document.getElementsByTagName("body").item(0);
		if( oBody != null ) {
			oBody.appendChild(this.oDarkNode);
		}
		else {
			document.write(this.oDarkNode.outerHTML);
		}

		this.nDarkWidth = 0;
		this.nDarkHeight = 0;

		this.oInterval = null;
		this.nCheckTime = 1000;
		
		this.aCheckList = new Array();

		KeyManager.addAction("keydown", function(eEvent) {
			if(!DarkLayer.isDark) return;
			if(eEvent.keyCode == 27) {
				if( typeof( hideAdmin ) != null && typeof( hideAdmin ) !='undefined' ) {
					hideAdmin();
				}
			}
		});
	},
	showDark: function(oPopLayer, fAction, isWidget) {
		if(!this.isInit) {
			this.initDarkLayer();
			this.isInit = true;
		}
		this.aCheckList.length = 0; //페이지변경시마다 초기화
		this.initCheckBoxs("object");
		this.initCheckBoxs("embedt");
		this.initCheckBoxs("select");
		if(!isWidget){
			this.initCheckBoxs("iframe");
		}
		this.oPopLayer = oPopLayer;
		this.change(true, fAction);
	},
	showDarkDeco: function(oPopLayer, fAction, isWidget) {
		if(!this.isInit) {
			this.initDarkLayer();
			this.isInit = true;
		}
		this.aCheckList.length = 0; //페이지변경시마다 초기화
		this.initCheckBoxs("select");
		if(!isWidget){
			this.initCheckBoxs("iframe");
		}
		this.oPopLayer = oPopLayer;
		this.change(true, fAction);
	},
	hideDark: function() {
		this.change(false);
	},
	initCheckBoxs: function(sTagName) {
		var aCheckList = document.getElementsByTagName(sTagName);
		for(var i=0; i<aCheckList.length; i++) {
			if( aCheckList.item(i).getAttribute("id") != "adminFrame" ) { // Admin 를 위한 프레임은 제외
				this.aCheckList.push(aCheckList.item(i));
			}
		}
	},
	getHeight: function() {
		var nHeight = 0;

		if (window.innerHeight && window.scrollMaxY) {
			nHeight = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){
			nHeight = document.body.scrollHeight;
		} else {
			nHeight = document.body.offsetHeight;
		}
		
		var nWHeight;
		if (self.innerHeight) {
			nWHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.scrollHeight && document.documentElement.clientHeight ) { 
			if( document.documentElement.scrollHeight > document.documentElement.clientHeight ) {
				nWHeight = document.documentElement.scrollHeight;
			}
			else {
				nWHeight = document.documentElement.clientHeight;
			}
		} else if (document.body) {
			nWHeight = document.body.clientHeight;
		}	

		if(nHeight < nWHeight){
			return nWHeight;
		} else { 
			return nHeight;
		}
	},
	getWidth: function() {
		var nWidth = 0;

		if (window.innerWidth && window.scrollMaxX) {
			nWidth = window.innerWidth + window.scrollMaxX;
		} else if (document.body.scrollWidth > document.body.offsetWidth){
			nWidth = document.body.scrollWidth;
		} else {
			nWidth = document.body.offsetWidth;
		}
		
		var nWWidth;
		if (self.innerWidth) {
			nWWidth = self.innerWidth;
		} else if (document.documentElement && document.documentElement.scrollWidth && document.documentElement.clientWidth ) { 
			if( document.documentElement.scrollWidth > document.documentElement.clientWidth ) {
				nWWidth = document.documentElement.scrollWidth;
			}
			else {
				nWWidth = document.documentElement.clientWidth;
			}
		} else if (document.body) {
			nWWidth = document.body.clientWidth;
		}	

		if(nWidth < nWWidth){
			return nWWidth;
		} else { 
			return nWidth;
		}
	},
	change: function(isDark, fAction) {
		if( this.isDark == isDark ) {
			return;
		}
		if( isDark ) {
			this.nDarkWidth = this.getWidth();
			this.nDarkHeight = this.getHeight();
			this.oDarkNode.style.width = this.nDarkWidth+"px";
			this.oDarkNode.style.height = this.nDarkHeight+"px";
			this.oDarkNode.className = "inDark";
			this.oPopLayer.className = "inDark";

			if(fAction != null) {
				fAction();
			}
			this.hideCheckBox();
			this.startCheckingResize();
		} else {
			clearInterval(this.oInterval);
			
			this.oDarkNode.className = "inBright";
			this.oPopLayer.className = "inBright";

			this.showCheckBox();
			this.stopCheckingResize();
		}
		this.isDark = isDark;
	},
	hideCheckBox: function() {
		for(var i=0; i<this.aCheckList.length; i++) {
			this.aCheckList[i].style.visibility = "hidden";
		}
	},
	showCheckBox: function() {
		for(var i=0; i<this.aCheckList.length; i++) {
			this.aCheckList[i].style.visibility = "visible";
		}
	},
	startCheckingResize: function() {
		this.oInterval = setInterval("DarkLayer.checkResize()", this.nCheckTime);
	},
	stopCheckingResize: function() {
		clearInterval(this.oInterval);
	},
	checkResize: function() {
		if(!this.isDark) return;

		var nDarkWidth = this.getWidth();
		var nDarkHeight = this.getHeight();
		
		if(!((navigator.userAgent.toLowerCase().indexOf("msie") != -1) && (navigator.userAgent.toLowerCase().indexOf("opera") == -1)) ) {
			nDarkWidth -= 16;
			nDarkHeight -= 16;
		}
		
		var nDarkWidth_diff = Math.abs(nDarkWidth - this.nDarkWidth);
		var nDarkHeight_diff = Math.abs(nDarkHeight - this.nDarkHeight);
		if( nDarkWidth_diff > 1 || nDarkHeight_diff > 1 ) {
			this.nDarkWidth = nDarkWidth;
			this.nDarkHeight = nDarkHeight;
			this.oDarkNode.style.width = this.nDarkWidth+"px";
			this.oDarkNode.style.height = this.nDarkHeight+"px";
		}
	},
	setLastUrl: function(sLastUrl) {
		this.sLastUrl = sLastUrl;
	},
	getLastUrl: function() {
		return this.sLastUrl;
	},
	setReloadStat: function(nReloadStat) {
		this.nReloadStat = nReloadStat;
	}
}

var blogSheetRemove = false;
function showAdmin(type) {
	var oViewFrame = document.getElementById("adminLayer");
	oViewFrame.style.left = (document.documentElement.scrollWidth/2 - 315) + 'px';
	if(document.all && document.documentElement.offsetHeight > 630){
		oViewFrame.style.top = document.documentElement.scrollTop + (document.documentElement.offsetHeight - 630)/2 + 'px'
	}
	else{
		oViewFrame.style.top = (document.documentElement.scrollTop + 20) + 'px';
	}
	if(!document.all){
		document.getElementById('AdminLayerShadow').style.background = "url(http://pimg.daum-img.net/blog3/admin/admin_bg.png) no-repeat";
	}

	DarkLayer.showDark(document.getElementById("adminLayer"), function() {
		var	oViewFrame = document.getElementById("adminFrame");
		if( type == null || typeof(type)=='undefined' || type == 0) {
			oViewFrame.src = "/_blog/adminTop.do?blogid="+BLOGID;
		} else if( type == 1 ) { //bloginfo
			oViewFrame.src = "/_blog/basicInfo.do?blogid="+BLOGID;
		} else if( type == 2 ) { //category
			oViewFrame.src = "/_blog/menuCategory.do?blogid="+BLOGID;
		} else if( type == 3 ) { //ccl
			oViewFrame.src = "/_blog/protectAdmin.do?blogid="+BLOGID;
		} else if( type == 4 ) { //즐겨찾기
			oViewFrame.src = "/_blog/bookmark/bookmarkFolderManageForm.do?blogid="+BLOGID;
		} else if( type == 5 ) { //배경음악
			oViewFrame.src = "/_blog/adminBlogBgm.do?blogid="+BLOGID;
		} else if( type == 6 ) { //배경음악
			oViewFrame.src = "/_blog/adminCafeBanner.do?blogid="+BLOGID;
		} else if( type == 7 ) { //댓글관리 
			oViewFrame.src = "/_blog/contentOpinion.do?blogid="+BLOGID;
		} else if( type == 8 ) { //친구 블로그 
			oViewFrame.src = "/_blog/friendList.do?blogid="+BLOGID;
		} else if( type == 9 ) { //방문자 
			oViewFrame.src = "/_blog/visitorCount.do?blogid="+BLOGID;	
		}else if( type == 10 ) { //나를 즐겨찾기 한 사람 
			oViewFrame.src = "/_blog/adminYourFavorite.do?blogid="+BLOGID;	
		}else if( type == 11 ) { //RSS
			oViewFrame.src = "/_blog/rss/ManagerFolderUpdateForm.do?blogid="+BLOGID;	
		}else if( type == 12 ) { //글보내기
			oViewFrame.src = "/_blog/feedingAdmin.do?blogid="+BLOGID;	
		}else if( type == 13 ) { //엮인글
			oViewFrame.src = "/_blog/contentTrackback.do?blogid="+BLOGID;	
		}else if( type == 14 ) { //친구 신청관리
			oViewFrame.src = "/_blog/friendCallList.do?blogid="+BLOGID;
		}else if( type == 15) { // 글 관리
			oViewFrame.src = "/_blog/contentViewManage.do?blogid="+BLOGID;
		}else if( type == 16) { // 프로필
			oViewFrame.src = "/_blog/basicProfileInfo.do?blogid="+BLOGID;
		}
	});
	try {
		if(navigator.userAgent.indexOf("MSIE")!=-1){
			for(var i=0;i<document.styleSheets.length;i++){
				if(document.styleSheets[i].href.indexOf("blog_basic.css")!=-1){
					blogSheet = document.styleSheets[i];
					break;
				}
			}
			if(blogSheet !=null && blogSheet != "undefined"){
				for (i=0; i<blogSheet.rules.length; i++){
					if (blogSheet.rules[i].selectorText.toLowerCase()=="html"){
						blogSheet.removeRule(i);
						blogSheetRemove = true;
						break;
					}
					if(i>5) break;
				}
			}
			document.body.scroll = 'no';
			document.body.style.marginRight = 18 + "px";
		}else{
			//thinking
		}
	}catch( e ) {
	}
}

function showWidgetControl(retUrl) {
/* 임시 봉인
	if(navigator.userAgent.indexOf("MSIE")!=-1){
		var blogSheet=document.styleSheets[0]
		for (i=0; i<blogSheet.rules.length; i++){
			if (blogSheet.rules[i].selectorText.toLowerCase()=="html"){
				blogSheet.removeRule(i);
				break;
			}
			if(i>5) break;
		}
		document.body.scroll = 'no';
		document.body.style.marginRight = 18 + "px";
	}else{
		//thinking
	}
*/
	var oViewFrame = document.getElementById("displayWidget");
	oViewFrame.style.display = 'block';
	oViewFrame.style.left = (document.documentElement.scrollWidth/2 - 315) + 'px';
	if(document.all && document.documentElement.offsetHeight > 630){
		oViewFrame.style.top = document.documentElement.scrollTop + (document.documentElement.offsetHeight - 630)/2
	}
	else{
		oViewFrame.style.top = (document.documentElement.scrollTop + 20) + 'px';
	}
	if(!document.all){
		document.getElementById('widgetLayerShadow').style.background = "url(http://pimg.daum-img.net/blog3/admin/widget_bg.png) no-repeat";
	}
	DarkLayer.showDark(document.getElementById("displayWidget"), function() {
		document.getElementById("displayWidgetF").src = retUrl;
	}, true);
}

function setReloadStat(nReloadStat) {
	if( DarkLayer != null ) {
		if( DarkLayer.nReloadStat < nReloadStat ) {
			DarkLayer.setReloadStat(nReloadStat);
		}
	}
}

function hideAdmin(bIsReload) {
	DarkLayer.setLastUrl("");
	if( bIsReload == null || bIsReload == true ) {		
		var url = top.location.href;
		if(url.indexOf("admin=4") > 0) {
			DarkLayer.nReloadStat = 0;
			url = url.replace("&admin=4", "");
			setTimeout(function (){top.location.href = url}, 10);
		} else if( DarkLayer.nReloadStat == 1 ) {
			DarkLayer.nReloadStat = 0;
			var obj = new Object();
			obj.blogid = BLOGID;
			UcateCallbackDelay(null, obj);
		} else if( DarkLayer.nReloadStat == 2 ) {
			DarkLayer.nReloadStat = 0;
			setTimeout(function (){top.location.href = url}, 10);
		} else if( DarkLayer.nReloadStat == 3 ) {
			DarkLayer.nReloadStat = 0;
			setTimeout(function (){top.location.href = url}, 10);
		}
	}	
	
	DarkLayer.hideDark();
	
	try {
		if(navigator.userAgent.indexOf("MSIE")!=-1){
			if(blogSheetRemove == true){
				document.styleSheets[0].addRule("html", "overflow: scroll;	overflow-x: auto;")
			}
			document.body.scroll = 'yes';
			document.body.style.marginRight = 0 + "px";
		}else{
			//thinking
		}
	} catch( e ) {
	}
}

function hideWidgetControl() {
/* 임시봉인
	if(navigator.userAgent.indexOf("MSIE")!=-1){
		document.styleSheets[0].addRule("html", "overflow: scroll;	overflow-x: auto;")
		document.body.scroll = 'yes';
		document.body.style.marginRight = 0 + "px";
	}else{
		//thinking
	}
*/
	DarkLayer.hideDark();
}

function setDrakLastUrl(sLastUrl) {
	if( DarkLayer != null ) {
		DarkLayer.setLastUrl(sLastUrl);
	}
}

function getDarkLastUrl() {
	if( DarkLayer != null ) {
		return DarkLayer.getLastUrl();
	} else {
		return "";
	}
}
function daumActiveX(obj,div){
	// generate html code
	// for ie obejct
	var html = '<object ';
	if (!obj.id && !obj.name){
		var r = Math.round(Math.random()*100);
		html += 'id="daumActiveXObject'+r+'" name="daumActiveXObject'+r+'" ';
	} else {
		if (obj.id) html += 'id="'+obj.id+'" ';
		else html += 'id="'+obj.name+'" ';
		if (obj.name) html += 'name="'+obj.name+'" ';
		else html += 'name="'+obj.id+'" ';
	}
	if (obj.type) html += 'type="'+obj.type+'" ';
	if (obj.classid) html += 'classid="'+obj.classid+'" ';
	if (obj.width) html += 'width="'+obj.width+'" ';
	if (obj.height) html += 'height="'+obj.height+'" ';
	if (obj.codebase) html += 'codebase="'+obj.codebase+'" ';
	// append events
	for (var i in obj.events){
		if (obj.events[i]){
			html += obj.events[i][0]+'="'+obj.events[i][1]+'" ';
		}
	}
	// end of object tag
	html += '>\n';
	// append params
	for (var i in obj.param){
		html += '<param name="'+obj.param[i][0]+'" value="'+obj.param[i][1]+'"/>\n';
	}

	// for ns embed
	html += '<embed ';
	if (!obj.id && !obj.name){
		var r = Math.round(Math.random()*100);
		html += 'id="daumActiveXObject'+r+'" name="daumActiveXObject'+r+'" ';
	} else {
		if (obj.id) html += 'id="'+obj.id+'" ';
		if (obj.name) html += 'name="'+obj.name+'" ';
	}
	if (obj.type) html += 'type="'+obj.type+'" ';
	if (obj.width) html += 'width="'+obj.width+'" ';
	if (obj.height) html += 'height="'+obj.height+'" ';
	// append params
	for (var i in obj.param){
		if (obj.param[i]){
			if (obj.param[i][0]=='movie' || obj.param[i][0]=='src'){
				var _src = obj.param[i][1];
			}
			html += obj.param[i][0]+'="'+obj.param[i][1]+'" ';
		}
	}
	html += '/>\n';
	html += '</object>';

	var isIE = (document.all)?true:false;
	if (isIE){
		if( document.getElementById(div) != null ) {
			document.getElementById(div).innerHTML = html;
		}
	} else if (obj.type=='application/x-shockwave-flash' || obj.classid=='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'){
		// ie외의 브라우저에서 activex가 flash인 경우만 노출
		if( document.getElementById(div) != null ) {
			document.getElementById(div).innerHTML = html;
		}
	}
}



// 한페이지에 한종류의 activeX가 복수개 삽입되는 경우 하단과 같이 function을 만들어서 사용
function daumFlash_general(src,width,height,div){	//카페탑 - 실시간 급등 정보카페	
	var obj = new Object();
	obj.type = 'application/x-shockwave-flash';
	obj.classid = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000';
	obj.codebase = 'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,23,0';
	obj.wmode = 'transparent';
	obj.width = width;
	obj.height = height;

	var param = [
		['movie',src],
		['src',src],
		['quality','high'],
		['wmode','transparent'],
		['allowScriptAccess', 'always'],
		['allowFullScreen', 'true'],
		['bgcolor','#FFFFFF'],
		['pluginspage','http://www.macromedia.com/go/getflashplayer'],
	];
	obj.param = param;

	var events = [
		['onmouseover','test1()'],
		['onmouseout','test2()'],
	];
	obj.events = events;

	daumActiveX(obj,div);
}

function daumFlash_general_forMovie(src,width,height,div){	//카페탑 - 실시간 급등 정보카페	
	var obj = new Object();
	obj.type = 'application/x-shockwave-flash';
	obj.classid = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000';
	obj.codebase = 'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,23,0';
	obj.wmode = 'transparent';
	obj.width = width;
	obj.height = height;

	var param = [
		['movie',src],
		['src',src],
		['quality','high'],
		['allowScriptAccess', 'always'],
		['allowFullScreen', 'true'],
		['bgcolor','#FFFFFF'],
		['pluginspage','http://www.macromedia.com/go/getflashplayer'],
	];
	obj.param = param;

	var events = [
		['onmouseover','test1()'],
		['onmouseout','test2()'],
	];
	obj.events = events;

	daumActiveX(obj,div);
}

function test1(){
//	alert(1);
}
function test2(){
//	alert(2);
}

function LoadThemeListImage(listWidth, listHeight, imgNode, src) {
	var oTmpImg = new Image();
	oTmpImg.onreadystatechange = function() {
		if(this.readyState == "complete") {
			width = this.width;
			height = this.height;
			if( width < listWidth && height < listHeight ) {
			} else if( width < height) {
				heightEst = listHeight;
				widthEst = listHeight*(width/height);
				imgNode.height = heightEst;
				imgNode.width = widthEst;
			} else {
				widthEst = listWidth;
				heightEst = listWidth*(height/width);
				imgNode.height = heightEst;
				imgNode.width = widthEst;
			}
			oTmpImg = null;
		}
	}
	oTmpImg.src = src;
}

function goPrintArticle(articleno) {
	var clintAgent = navigator.userAgent;
	//if ( clintAgent.indexOf("MSIE") != -1 ) {
		window.open("/printView.html?articlePrint_"+articleno, "", "width=815, height=680, scrollbars=yes, resizable=no");
	//}else {
	//	window.open("/printViewF.html?articlePrint_"+articleno, "", "width=604, height=680, scrollbars=yes, resizable=no");
	//}
}
function articleFix(blogid,curartno,articleno, blogMainUrl){
	var obj = new Object();
	obj.curatno=curartno;
	obj.blogid=blogid;
	if(blogMainUrl.indexOf("BlogTypeView.do") > -1){
		loadXMLDocWithParam("GET","/_blog/ArticleFix.ajax?blogid="+blogid+"&articleno="+articleno,null,"newAfterFix",null,obj);
	}else{
		loadXMLDocWithParam("GET","/_blog/ArticleFix.ajax?blogid="+blogid+"&articleno="+articleno,null,"afterFix",null,obj);
	}
	if (articleno == 0) {
		alert ("이 글의 대문 등록이 해제되었습니다.");
	} else {
		alert ("이 글이 대문으로 등록되었습니다.");
	}
	window.location.href = blogMainUrl;
}
function newAfterFix(xmlhttp,obj){
	var code =  getSimpleResponse(xmlhttp);
	code = both_trim(code);
	
	if(code.indexOf("true") > 0) {
		viewAjaxArticle("/_blog/BlogTypeView.do?blogid="+obj.blogid+"&articleno="+obj.curatno);
	}
	xmlhttp=null;
}
function afterFix(xmlhttp,obj){
	var code =  getSimpleResponse(xmlhttp);
	code = both_trim(code);
	
	if(code.indexOf("true") > 0) {
		viewAjaxArticle("/_blog/BlogView.do?blogid="+obj.blogid+"&articleno="+obj.curatno);
	}
	xmlhttp=null;
}


/* theme action */
	function Star(blogid, articleno, score) {
		loadDynamicContent("/_blog/LoginCheck.do?type=theme&score="+score);
		loadXMLDoc("GET","/_blog/ThemeScoreSave.do?blogid="+blogid+"&articleno="+articleno+"&score="+score,null,"ScoreSave","ScoreFail");
	}
	
	function sendDataSubmitTheme(isLoginCheck, score){
		if(isLoginCheck){
		} else {
			if(confirm('로그인하셔야 별점 평가를 이용하실 수 있습니다.')) {
				var curl = 	window.location.href;
				this.location.href='http://www.daum.net/Mail-bin/login.html?daumauth=1&category=blog&url=' + escape(curl);

			};
		}
	}

	function ShowStar(point, img_id)
	{
		var img_obj = document.getElementById(img_id);
		img_obj.style.backgroundImage = "url('http://pimg.daum-img.net/blog/theme/star0"+point+".gif')";
	}

	function ShowDefaultStar(img_id)
	{
		var img_obj = document.getElementById(img_id);
		img_obj.style.backgroundImage = "url('http://pimg.daum-img.net/blog/theme/star00.gif')";
	}

	function ScoreFail(){
	}

	function ScoreSave(xmlhttp) {
		if ( xmlhttp ) {
			xmldoc = getXMLDocument(xmlhttp);

			var channel = xmldoc.getElementsByTagName('channel');
			var articleno = channel[0].getElementsByTagName('articleno')[0].firstChild.nodeValue;
			var score = channel[0].getElementsByTagName('score')[0].firstChild.nodeValue;
			var myscore = channel[0].getElementsByTagName('myscore')[0].firstChild.nodeValue;
			var count = channel[0].getElementsByTagName('count')[0].firstChild.nodeValue;
			var content ='전체평가('+score+'점) : <img src="http://pimg.daum-img.net/blog/theme/star0'+ Math.round(score) +'.gif" style="vertical-align:middle; margin-bottom:3px;">';
			resultDiv = document.getElementById("iLLStar_" + articleno);
			var content2 ='<img src="http://pimg.daum-img.net/blog/theme/star0'+ Math.round(myscore) +'.gif" style="vertical-align:middle; margin-bottom:3px;">';
			resultDiv2 = document.getElementById("vote_img_" + articleno);

			if (score == 0) {
				alert('이미 평가를 하셨습니다.');
			} else {
				alert('평가하셨습니다.');
				resultDiv.innerHTML = content;
				resultDiv2.innerHTML = content2;
			}

			xmlhttp = null;
		}
	}
	
	function viewScrapHistory(bid, ano) {
		var scpwin = window.open("/_blog/ScrapHistoryList.do?blogid="+bid+"&articleno="+ano, "_scraphistory", "width=530, height=430, scrollbars=1");
		scpwin.focus();
	}
	
	/* 동영상 관련 스크립트 */
	function copyMovieUrl(blogid, key) {
		BgmPlayManager.allStop();
        var winObj = window.open("/_blog/CopyMovieUrl.do?blogid="+blogid+"&key="+key, "", "scrollbars=no, resizable=no, top=0, left=0,width=450,height=240");
        winObj.focus();
    }
	function openMovie(blogid, key, isEnableScrap) {
		BgmPlayManager.allStop();
		if( typeof(isEnableScrap) != 'undefined' && isEnableScrap != null && isEnableScrap ) {
			var winObj = window.open("http://tvpot.daum.net/clip/ClipViewBigByVid.do?vid="+key+"&scrapable=no", "", "scrollbars=no, resizable=no, top=0, left=0,width=775,height=625");
		}
		else
		{
			var winObj = window.open("http://tvpot.daum.net/clip/ClipViewBigByVid.do?vid="+key, "", "scrollbars=no, resizable=no, top=0, left=0,width=850,height=650");
		}
        winObj.focus();
    }
    
    function goRegist() {
    	if( confirm('엮인글을 보내시려면 다음 블로그를 개설해야 합니다. 개설하시겠습니까?')) {
    		top.location.href = "/_blog/redirect.do?redirect=register";
    	}
    }
    
    function goTrackbackSend2(blogid, turl) {
    	window.open("/_blog/ArticleRegisterEnter2.do?blogid="+blogid+"&turl="+turl);
    }
    
    function toUcc(blogid, articleid) {
		var params = 'blogid='+blogid+'&articleno='+articleid;
		var page = '/_blog/hdn/sendUcc.do';
		if(params != '') {
		        page = page+"?"+params;
		}
		var opts = "scrollbars=no,status=no,toolbar=no,resizable=1,location=no,menu=no,width=530,height=350";
		window.open(page,"winopen",opts);
	}
	
	function setViralAdComment(blogid, articleno){
		var urlpath = "/_blog/viralAdComment.ajax?blogid="+blogid+"&articleNo="+articleno;
		loadXMLDocWithParam("GET",urlpath,null,"afterViralAdComment","failViralAdComment",null);
	}

	function afterViralAdComment(xmlhttp,obj){
		var oXmlDoc = getXMLDocument(xmlhttp);
		var content = getXmlContent(oXmlDoc, 'contents');
		var url = getXmlContent(oXmlDoc, 'url');
		var articleno = getXmlContent(oXmlDoc, 'articleno');

		var tmp = document.getElementById("viral_ad_comment_" + articleno);
		
		if (tmp && content != null && content != "") {
			tmp.innerHTML = '<div><a target="_blank" href="'+ url +'" class="" style="text-decoration:none;"><span>' + content + '</span> 에 참여한 글입니다.</a></div>';
		}
		xmlhttp = null;
	}

	function failViralAdComment (){
		xmlhttp = null;
	}
	
	function getXmlContent(oXmlDoc,tagname){
		var content = oXmlDoc.getElementsByTagName(tagname);
		var res = "";
		if(content !=null && content[0] != null){
			return content[0].firstChild.nodeValue;
		}else{
			return "";
		}
	}
    
var BgmPlayManager = {
	existArticleBgm: false,
    init: function() {
        if(is_ie) {
            KeyManager.addAction("keydown", function(eEvent) {
                if(eEvent.keyCode == 27) {
                    BgmPlayManager.allStop();
                }
            });
        }
    },
    allStop: function() {  
        BlogBgm.stop();
        ArticleBgm.stop();
    },
    movePage: function() {
        ArticleBgm.stop();
    }
}

function BlogBGMPlayList(bgmno) {
    var owin = window.open("/_blog/BgmPlayList.do?blogid="+BLOGID+"&bgmno="+bgmno+"&ayn=N", "bgmplaylist",     "width=525,height=331,scrolling=no,resize=no");
    owin.focus();
}

function ArticleBGMPlayList(bgmno) {
    var owin = window.open("/_blog/BgmPlayList.do?blogid="+BLOGID+"&bgmno="+bgmno+"&ayn=Y", "bgmplaylist", "width=515,height=331,scrolling=no,resize=no");
    owin.focus();
}

var LastPlayState_STOP = 0;
var LastPlayState_PLAY = 1;		

var BlogBgm = {
    isPlaying: false,
    init: function() {
        this.mTtlLyr = document.getElementById("bgmTitle");
        this.mBtnLyr = document.getElementById("bgmPlayStop");
        this.mBgmFrm = parent.frames["BlogTop"];
        this.isRepeat = false;
    },
    load: function(bgmNo, existArticleBgm) {
    
        if(!is_ie) return;
        if(!parent.document.getElementById('BlogTop')) return;
        this.init();
        
		if(BgmPlayManager.existArticleBgm) { //게시글 배경음악 재생
        	if(parent.document.getElementById('BlogTop').src == "") {
				parent.document.getElementById('BlogTop').src = "/_blog/hdn/BlogBgm.do?blogid=" + BLOGID + "&blogUseYn=Y&BgmNo=" + bgmNo + "&blogbgm=N";
			}
		} else {
        	if(!this.mBgmFrm.isPlaying){
				this.stop();
			}
			if(parent.document.getElementById('BlogTop').src == "") {
			    this.isPlaying = true;
				parent.document.getElementById('BlogTop').src = "/_blog/hdn/BlogBgm.do?blogid=" + BLOGID + "&blogUseYn=Y&BgmNo=" + bgmNo + "&blogbgm=Y";
			} else {
		        var bgmctrl = this.mBgmFrm.getBGMCtrl();    
		        if(bgmctrl.LastPlayState == '1'){
					this.changeTitle(this.mBgmFrm.GetTitle());
					if(this.mBgmFrm.isStopByArti == true){
						this.play();
						this.mBgmFrm.isStopByArti = false;
					}
				}else{
					this.stop();
					this.mBgmFrm.isStopByArti = false;
			        if(this.mTtlLyr) {
			            this.mTtlLyr.innerHTML = "<marquee direction=\"left\" behavior=\"scroll\" scrollamount=\"10\" scrolldelay=\"400\" class=\"new_bgm_marquee\">다시 음악을 들으시려면  ▶ 을 눌러주세요.</marquee>";
			        }
					return;
				}
			}
			if(this.mBtnLyr) {
//				this.mBtnLyr.src = "http://pimg.daum-img.net/blog3/btn_music_pause.gif";
				this.mBtnLyr.className = "btn_bgm_06 hand";
				this.mBtnLyr.alt = "멈춤";
				document.getElementById('btn_bgmPlayList_dim').style.display = 'none';
				document.getElementById('btn_bgmPlayList').style.display = 'block';
			}
		}
		form_widget_amount_slider('slider_target',document.formBGM1.vol,42,0,100,"BlogBgm.setVolume()",5,12);
		
		try{
			BlogBgm.initVolume(this.mBgmFrm.getVolume());
		}catch(e) {
//			window.setTimeout("BlogBgm.initVolume(30)",10);
		}
    },
	setVolume: function() {
		var vol = document.formBGM1.vol.value.replace(/[^\d]/,'');
        this.mBgmFrm.BGMSetVol(vol);
	},
	initVolume: function(value) {
		this.mBgmFrm.BGMSetVol(value);
		document.getElementById('slider_handle1').style.left = (36 * value/100) + 'px';
		window.setTimeout("BlogBgm.initVolumeBg('"+value+"')",10);
	},
	initVolumeBg: function(value) {
		document.getElementById('slider_slider1').style.width = (36 * value/100) + 'px';
	},
    play: function() {
        if(!is_ie) return;
        if(this.isPlaying) {
            return;
        }
        this.isPlaying = true;
        ArticleBgm.stop();
			var bgmctrl = this.mBgmFrm.getBGMCtrl();
        this.mBgmFrm.BGMPlay();
        if(this.mBtnLyr) {
//			this.mBtnLyr.src = "http://pimg.daum-img.net/blog3/btn_music_pause.gif";
            this.mBtnLyr.className = "btn_bgm_06 hand";
			this.mBtnLyr.alt = "멈춤";
			document.getElementById('btn_bgmPlayList_dim').style.display = 'none';
			document.getElementById('btn_bgmPlayList').style.display = 'block';
        }
        //changeTitle <- this.mBgmFrm에서 실행
    },
    stop: function() {	    
        if(!is_ie) return;
        if(!this.isPlaying) {
            return;
        }
        this.isPlaying = false;
		var bgmctrl = this.mBgmFrm.getBGMCtrl();
        this.mBgmFrm.BGMStop();
        if(this.mBtnLyr) {
//			this.mBtnLyr.src = "http://pimg.daum-img.net/blog3/btn_music_play.gif";
            this.mBtnLyr.className = "btn_bgm_03 hand";
			this.mBtnLyr.alt = "재생";
        }
        if(this.mTtlLyr) {
            this.mTtlLyr.innerHTML = "<marquee direction=\"left\" behavior=\"scroll\" scrollamount=\"10\" scrolldelay=\"400\" class=\"new_bgm_marquee\">다시 음악을 들으시려면  ▶ 을 눌러주세요.</marquee>";
        }
    },
    ArtiStop: function() {	    
        if(!is_ie) return;

        if(this.mBgmFrm){
			var bgmctrl = this.mBgmFrm.getBGMCtrl();
        	this.mBgmFrm.BGMStop2();
        	this.isPlaying = false;
        	this.mBgmFrm.isStopByArti = true;
        }
        
       if(this.mBtnLyr) {
//			this.mBtnLyr.src = "http://pimg.daum-img.net/blog3/btn_music_play.gif";
            this.mBtnLyr.className = "btn_bgm_03 hand";
			this.mBtnLyr.alt = "재생";
        }
        if(this.mTtlLyr) {
            this.mTtlLyr.innerHTML = "<marquee direction=\"left\" behavior=\"scroll\" scrollamount=\"10\" scrolldelay=\"400\" class=\"new_bgm_marquee\">다시 음악을 들으시려면  ▶ 을 눌러주세요.</marquee>";
        }
        
    },
    repeat: function(no) {
        if(!is_ie) return;
        this.isPlaying = true;
        ArticleBgm.stop();
        this.mBgmFrm.BGMRepeat(no);
    },
    playNstop: function() {
        if(!is_ie) return;
        if(this.isPlaying) {
            this.stop();
        } else {
            this.play();
        }
    },
    playPrev: function() {
        if(!is_ie) return;
        ArticleBgm.stop();
        this.isPlaying = true;
        this.mBgmFrm.BGMPrev();
        if(this.mBtnLyr) {
            this.mBtnLyr.className = "btn_bgm_06 hand";
			this.mBtnLyr.alt = "멈춤";
        }
    },
    playNext: function() {
        ArticleBgm.stop();
        this.isPlaying = true;
        this.mBgmFrm.BGMNext();
        if(this.mBtnLyr) {
            this.mBtnLyr.className = "btn_bgm_06 hand";
			this.mBtnLyr.alt = "멈춤";
        }
    },
    playGoto: function(songId) {
	    if(!is_ie) return;
        this.isPlaying = true;
        this.mBgmFrm.BGMPlayGoto(songId);
        if(this.mBtnLyr) {
            this.mBtnLyr.className = "btn_bgm_06 hand";
			this.mBtnLyr.alt = "멈춤";
        }
    },
    changeTitle: function(sBgmTitle) {   
        if(this.mTtlLyr == null) return;
        var bgmctrl = this.mBgmFrm.getBGMCtrl();    
        
        if(bgmctrl.LastPlayState == '1') {
       		this.mTtlLyr.innerHTML = "<marquee direction=\"left\" behavior=\"scroll\" scrollamount=\"10\" scrolldelay=\"400\" class=\"new_bgm_marquee\">" + sBgmTitle + "</marquee>"
  		} else {
  		 	this.stop();
 		}
    }
}
var oldBgmNo = '';
var ArticleBgm = {
    isPlaying: false,
    init: function(bgmNo, frmId) {
        this.mBgmNo = bgmNo;
		this.isRepeat = false;
        
        this.mTtlLyr = document.getElementById(frmId).contentWindow.document.getElementById("abgm"+bgmNo+"Title");
        this.mPlay = document.getElementById(frmId).contentWindow.document.getElementById("playBtn"+bgmNo);
		this.Bslider = document.getElementById(frmId).contentWindow.document.getElementById("slider_target"+bgmNo);
		this.Tslider = document.getElementById(frmId).contentWindow.document.getElementById("big_slider_slider"+bgmNo);
		this.big_handleImg = document.getElementById(frmId).contentWindow.document.getElementById("big_slider_handle"+bgmNo);
		this.eventF = document.getElementById(frmId).contentWindow;
		
		this.playerA = document.getElementById(frmId).contentWindow.document.getElementById("abgm"+bgmNo);
		this.playerD = document.getElementById(frmId).contentWindow.document.getElementById("abgmImg"+bgmNo);
		this.playBox = document.getElementById(frmId).contentWindow.document.getElementById("playerBox"+bgmNo);
		this.mBgmFrm = document.frames["ArticleBgmPlay"];
		this.artNo = '';
		this.frmId = '';
    },
    play: function(artNo, bgmNo, frmId) {
        if(!is_ie) return;
        BlogBgm.ArtiStop();
        if(this.mBgmNo != bgmNo) {
            if(this.isPlaying) {
                this.stop();
            }
            this.init(bgmNo, frmId);
    	    if(oldBgmNo != '' && document.getElementById(frmId).contentWindow.document.getElementById("abgm"+oldBgmNo)){
				document.getElementById(frmId).contentWindow.document.getElementById("abgm"+oldBgmNo).style.display = 'none';
				document.getElementById(frmId).contentWindow.document.getElementById("abgmImg"+oldBgmNo).style.display = 'block';
			}
            this.isPlaying = true;
            document.getElementById('ArticleBgmPlay').src = "/_blog/hdn/ArticleBgm.do?blogid="+BLOGID+"&articleno="+artNo+"&bgmno="+bgmNo;
	        this.playerA.style.display = 'block';
    	    this.playerD.style.display = 'none';
    	    oldBgmNo = bgmNo;
        } else {
            if(this.isPlaying) {
                return;
            }
            this.init(bgmNo, frmId);
            this.isPlaying = true;
            this.mBgmFrm.BGMPlay();
	        this.playerA.style.display = 'block';
    	    this.playerD.style.display = 'none';
        }
        
        //play button
        this.mPlay.className = 'playerOff';
        this.mPlay.alt = '멈춤';
        this.mPlay.onclick = new Function('ArticleBgm.stop('+ bgmNo + ')');

		//volume slider
		this.eventF.form_widget_amount_slider_big('slider_target' + bgmNo,document.formBGM2.vol,40,0,100,"setVolume2()",9,13,bgmNo);
		try{
			ArticleBgm.initVolume(this.mBgmFrm.getVolume());
		}catch(e) {
			ArticleBgm.initVolumeBg(30);
		}

		this.artNo = artNo;
		this.frmId = frmId;
    },
    stop: function(bgmNo) {
        if(bgmNo == null) {
            bgmNo = this.mBgmNo;
            if(bgmNo == null) {
                return;
            }
        }
        if(this.mBgmNo != bgmNo) {
            return;
        } else {
            if(!this.isPlaying) {
                return;
            }
            this.isPlaying = false;
            this.mBgmFrm.BGMStop();
            if(this.mTtlLyr) {
                this.mTtlLyr.innerHTML = "<marquee behavior=\"scroll\" direction=\"left\" scrollamount=\"2\"></marquee>";;
            }
            this.mPlay.className = 'playerOn';
            this.mPlay.alt = '재생';
            this.mPlay.onclick = new Function('ArticleBgm.play("' + this.artNo + '","' + bgmNo + '", "' + this.frmId +'")');
            
	        this.playerA.style.display = 'none';
    	    this.playerD.style.display = 'block';
		}
    },
    playPrev: function() {
        if(!is_ie) return;
        this.isPlaying = true;
        this.mBgmFrm.BGMPrev();
    },
    playNext: function() {
	    if(!is_ie) return;
        this.isPlaying = true;
        this.mBgmFrm.BGMNext();
    },
    playGoto: function(songId) {
	    if(!is_ie) return;
        this.isPlaying = true;
        this.mBgmFrm.BGMPlayGoto(songId);
    },
    changeTitle: function(sBgmTitle) {
        if(this.mTtlLyr == null) return;
        this.mTtlLyr.innerHTML = "<marquee behavior=\"scroll\" direction=\"left\" scrollamount=\"2\">" + sBgmTitle + "</marquee>";
    },
	setVolume: function() {
		var vol = document.formBGM2.vol.value.replace(/[^\d]/,'');
        this.mBgmFrm.BGMSetVol(vol);
	},
	initVolume: function(value) {
		this.mBgmFrm.BGMSetVol(value);
		this.big_handleImg.style.left = (27 * value/100) + 'px';
		window.setTimeout("ArticleBgm.initVolumeBg('"+value+"')",10);
	},
	initVolumeBg: function(value) {
		this.Tslider.style.width = (27 * value/100) + 'px';
	}
}

BgmPlayManager.init();


var form_widget_amount_slider_handle = 'http://pimg.daum-img.net/blog4/skin/common/img_blank.gif';
var slider_handle_image_obj = false;
var sliderObjectArray = new Array();
var slider_counter = 0;
var slideInProgress = false;
var handle_start_x;
var event_start_x;
var currentSliderIndex;

function form_widget_cancel_event(){
	return false;
}

function getImageSliderHeight(){
	if(!slider_handle_image_obj){
		slider_handle_image_obj = new Image();
		slider_handle_image_obj.src = form_widget_amount_slider_handle;
	}
	if(slider_handle_image_obj.width>0){
		return;
	}else{
		setTimeout('getImageSliderHeight()',50);
	}
}

function positionSliderImage(e,theIndex){
	if(!theIndex)theIndex = this.getAttribute('sliderIndex');
	var theValue = sliderObjectArray[theIndex]['formTarget'].value;
	if(!theValue.match(/^[0-9]*$/g))theValue=sliderObjectArray[theIndex]['min'] +'';
	if(theValue/1>sliderObjectArray[theIndex]['max'])theValue = sliderObjectArray[theIndex]['max'];
	if(theValue/1<sliderObjectArray[theIndex]['min'])theValue = sliderObjectArray[theIndex]['min'];
	sliderObjectArray[theIndex]['formTarget'].value = theValue;
	var handleImg = document.getElementById('slider_handle' + theIndex);
	var ratio = sliderObjectArray[theIndex]['width'] / (sliderObjectArray[theIndex]['max']-sliderObjectArray[theIndex]['min']);
	var currentValue = sliderObjectArray[theIndex]['formTarget'].value-sliderObjectArray[theIndex]['min'];
	handleImg.style.left = Math.round(currentValue * ratio) + 'px';
	document.getElementById('slider_slider1').style.width = Math.round(currentValue * ratio) + 'px';
}

function adjustFormValue(theIndex){
	var handleImg = document.getElementById('slider_handle' + theIndex);
	var ratio = sliderObjectArray[theIndex]['width'] / (sliderObjectArray[theIndex]['max']-sliderObjectArray[theIndex]['min']);
	var currentPos = handleImg.style.left.replace('px','');
	sliderObjectArray[theIndex]['formTarget'].value = Math.round(currentPos / ratio) + sliderObjectArray[theIndex]['min'];
}

function initMoveSlider(e){
	if(document.all)e = event;
	slideInProgress = true;
	event_start_x = e.clientX;
	handle_start_x = this.style.left.replace('px','');
	currentSliderIndex = this.id.replace(/[^\d]/g,'');
	return false;
}

function startMoveSlider(e){
	if(document.all)e = event;
	if(!slideInProgress)return;
	var leftPos = handle_start_x/1 + e.clientX/1 - event_start_x;
	if(leftPos<0)leftPos = 0;
	if(leftPos/1>sliderObjectArray[currentSliderIndex]['width'])leftPos = sliderObjectArray[currentSliderIndex]['width'];
	document.getElementById('slider_handle' + currentSliderIndex).style.left = leftPos + 'px';
	document.getElementById('slider_slider1').style.width = leftPos + 'px';

	adjustFormValue(currentSliderIndex);
	if(sliderObjectArray[currentSliderIndex]['onchangeAction']){
		eval(sliderObjectArray[currentSliderIndex]['onchangeAction']);
	}
}

function stopMoveSlider(){
	slideInProgress = false;
}

function form_widget_amount_slider(targetElId,formTarget,width,min,max,onchangeAction,sliderHandleWidth,sliderHeight){
	if(!slider_handle_image_obj){
		getImageSliderHeight();
	}

	slider_counter = slider_counter +1;
	sliderObjectArray[slider_counter] = new Array();
	sliderObjectArray[slider_counter] = {"width":width - sliderHandleWidth,"min":min,"max":max,"formTarget":formTarget,"onchangeAction":onchangeAction};

	formTarget.setAttribute('sliderIndex',slider_counter);
	formTarget.onchange = positionSliderImage;

	var handleImg = document.createElement('IMG');
	handleImg.style.position = 'absolute';
	handleImg.style.left = '0';
	handleImg.style.top = '0';
	handleImg.style.zIndex = 5;
	handleImg.src = slider_handle_image_obj.src;
	handleImg.id = 'slider_handle' + slider_counter;
	handleImg.className = "ic_bgmControl hand";
	handleImg.onmousedown = initMoveSlider;

	if(document.body.onmouseup){
		if(document.body.onmouseup.toString().indexOf('stopMoveSlider')==-1){
			//alert('You allready have an onmouseup event assigned to the body tag');
		}
	}else{
		document.body.onmouseup = stopMoveSlider;
		document.body.onmousemove = startMoveSlider;
	}
	handleImg.ondragstart = form_widget_cancel_event;
	document.getElementById(targetElId).appendChild(handleImg);
	positionSliderImage(false,slider_counter);

	document.getElementById(targetElId).style.width = document.getElementById('slider_slider1').offsetWidth + 'px';			
}
// Tag
var isIEVersion = ((navigator.userAgent.toLowerCase().indexOf("msie") != -1) && (navigator.userAgent.toLowerCase().indexOf("opera") == -1));

function tagAdd( articleno) {
	if(document.getElementById("tagListEdit_"+articleno).style.display == 'block') {
		document.getElementById("tagListLayer_"+articleno).style.display='block';
		document.getElementById("tagAddLayer_"+articleno).style.display='block';
		document.getElementById("tagListEdit_"+articleno).style.display='none';
	}
	else {
		document.getElementById("tagListLayer_"+articleno).style.display='none';
		document.getElementById("tagAddLayer_"+articleno).style.display='none';
		document.getElementById("tagListEdit_"+articleno).style.display='block';
		document.getElementById("tagname_"+articleno).focus();
	}
}
function tagCancel(blogid, articleno) {
	document.getElementById("tagListEdit_"+articleno).style.display='none';
	document.getElementById("tagListLayer_"+articleno).style.display='block';
	document.getElementById("tagAddLayer_"+articleno).style.display='block';
}
function tagAddSave(blogid, articleno) {
	var tagname = document.getElementById("tagname_"+articleno).value;
	var arr = tagname.split(",");
	var strLength = 0;

	for(var i=0; i < arr.length;i++){
		strLength = 0;

		for ( var j = 0; j < arr[i].length ; j++) {
			if (escape(arr[i].charAt(i)).length > 3) {
				strLength +=2;
			} else {
				strLength++;
			}
		}
		
		if(strLength > 40) {
			alert(arr[i]+"의 태그가 너무 깁니다. 40bytes 이하로 해주세요 ");
			return;
		}
	}


	var tagObj = new Object();
	tagObj.articleno = articleno;
	tagObj.blogid = blogid;
	tagObj.tagname = tagname;

	loadXMLDocWithParam("POST","/_blog/ArticleTagRegister.do","blogid="+blogid+"&articleno="+articleno+"&tagname="+encodeURIComponent(tagname),"TagCallBack","",tagObj);
}
function TagCallBack(xmlhttp, tagObj) {
	xmlhttp = null;
	loadTagList("/_blog/ArticleTagAjax.ajax?blogid="+tagObj.blogid+"&articleno="+tagObj.articleno, tagObj.articleno);
}

function loadTagList(url, articleno){
	var tagAddAjax;
	tagAddAjax = new AjaxObject("tagAddAjax", "tagListLayer_"+articleno, "contents", "ajax_layer_load");
	tagAddAjax.load(url, true);
	tagCancel(null, articleno);
}

function submitEnterTag(e, blogid, articleno) {

    var keycode;
    if (window.event) keycode = window.event.keyCode;
    else if (e) keycode = e.which;
    else return true;

    if (keycode == 13)
    {
        tagAddSave(blogid, articleno)
        return false;
    }
    else return true;
}

function trackBackCancel(blogid, articleno) {
	document.getElementById("trackBackListLayer_"+articleno).style.display="none";
}
function trackBackDelete(blogid, articleno, seq) {
	var tbObj = new Object();
	tbObj.articleno = articleno;
	tbObj.blogid = blogid;
	tbObj.seq = seq;

	loadXMLDocWithParam("POST","/_blog/ArticleTrackBackDelete.do","blogid="+blogid+"&articleno="+articleno+"&seq="+seq,"TrackBackCallBack","",tbObj);
}
function trackBackAddSave(blogid, articleno) {
	var trackbackurl = document.getElementById("trackbackurl_"+articleno).value;
	if(trackbackurl.indexOf("http") < 0){
		alert("잘못된 엮인글 주소입니다") ;
		return ;
	}

	var tbObj = new Object();
	tbObj.articleno = articleno;
	tbObj.blogid = blogid;
	tbObj.trackbackurl = trackbackurl;

	loadXMLDocWithParam("POST","/_blog/ArticleTrackBackRegister.do","blogid="+blogid+"&articleno="+articleno+"&trackbackurl="+trackbackurl,"TrackBackCallBack",null,tbObj);
}
function TrackBackCallBack(xmlhttp, tbObj) {
	loadTrackBackList("/_blog/ArticleTrackBackAjax.ajax?blogid="+tbObj.blogid+"&articleno="+tbObj.articleno, tbObj.articleno);
	xmlhttp = null;
}
function TrackBackHist(blogid, articleno) {
	if(document.getElementById("trackBackListLayer_"+articleno).style.display=="none")
		loadTrackBackList("/_blog/ArticleTrackBackAjax.ajax?blogid="+blogid+"&articleno="+articleno, articleno);
	else
		document.getElementById("trackBackListLayer_"+articleno).style.display="none";
}
var trackBackAddAjax;
function loadTrackBackList(url, articleno){
	trackBackAddAjax = new AjaxObject("trackBackAddAjax", "trackBackListLayer_"+articleno, "contents", "ajax_layer_load");
	trackBackAddAjax.load(url, true);
}

// 태그로 섹션 검색 조회
function tagsearch(tagName) {
	//window.open("/_search/searchTop.do?coll_range=0&query1=" + tagName + "&searchtype=1");
	window.open("http://search.daum.net/search?w=blog&m=tag&lpp=10&DocType=100&q=" + tagName + "&_top_daumsearh=search&f=section");
}
function goTagOrder(tagOrder, type) {
	var blogid = document.getElementById("blogid").value;
	var url="/_blog/tagTotalList.do?blogid="+blogid+"&tagOrder="+ tagOrder + "&navigationType=" + type;
	viewAjaxArticle(url);
}
function goTagArticleList(tagName){
	var blogid = document.getElementById("blogid").value;
	var url ="/_blog/tagArticleList.do?blogid="+blogid+"&tagName="+tagName;
	viewAjaxArticle(url);
}

function tagNameSearch(tag, blogId){
	parent.location.href = "/_blog/tagArticleList.do?blogid=" + blogId + "&tagName=" + encodeURIComponent(tag);
}

var tagResult = "";
var tagResultNum = 0;
var exitLastInput = 1;
function checkover(){
	//alert('checkover()');
}
function changeCheckBox(str)
{}
function checkValidation()
{
	tagResult  = "";
	tagResultNum = 0;
	var tagNum = document.getElementById("articleTag").instance.tagList.childNodes.length;
	var validBlank = true;
	var temp = "";
	var ccount = 0;
	for(var j = 0; j < tagNum; j++){

		validBlank = true;
		var targetChild = document.getElementById("articleTag").instance.tagList.childNodes[j].innerHTML;

		if(targetChild.toUpperCase().substring(0,6)!="<INPUT"){
			temp = targetChild;
			for(var i = 0; i < targetChild.length; i++)
			{
				var chr = targetChild.substr(i,1);

				if(chr == ' '){
					if(!validBlank){
						temp = temp.substr(0,i-ccount) + temp.substr(i-ccount+1);
						ccount = ccount + 1;
					}
					validBlank = false;
				}else{
					validBlank = true;
				}
/*
				if(isSpecialCharacter(chr)){
					alert("특수 문자를 입력하실 수 없습니다.");
					return false;
				}
 */
			}

		document.getElementById("articleTag").instance.tagList.childNodes[j].innerHTML = temp;
		tagResult = tagResult + temp + ",";
		tagResultNum = tagResultNum + 1;
		}
	}
	//alert("tagResult : " + tagResult);

	return true;
}

function isSpecialCharacter(chr){
	if((chr != '.') &&(chr != '~') &&(chr != '!') &&(chr != '@') &&(chr != '^') &&(chr != '*')
		&&(chr != '(')&&(chr != ')')&&(chr != '-')&&(chr != '+')&&(chr != '=')&&(chr != '|')
		&& (chr != ' ') && (chr < '0' || chr > '9') && (chr < 'a' || chr > 'z')
		&& (chr < 'ㄱ' || chr > '힣') && (chr < 'A' || chr > 'Z'))
	{
		return true;
	}
}

function checkSpecialCharacter(str){
	for(var i = 0; i < str.length; i++){
		var chr = str.substr(i,1);
		if(isSpecialCharacter(chr)){
			alert("특수 문자를 입력하실 수 없습니다.");
			return false;
		}
	}

	return true;
}

function getTagResult(){
	return tagResult;
}

function deleteCommonTag(str)
{

	var kids = document.getElementById("articleTag").instance.tagList.childNodes;
	var tagNum = document.getElementById("articleTag").instance.tagList.childNodes.length;

	for(var j = 0; j < tagNum; j++){

		validBlank = true;
		var targetChild = document.getElementById("articleTag").instance.tagList.childNodes[j].innerHTML;

		if(document.getElementById("articleTag").instance.tagList.childNodes[j].innerHTML != null){
			if(targetChild == str){
				document.getElementById("articleTag").instance.tagList.removeChild(kids[j]);
				changeCheckBox(false);
				break;
			}
		}

	}

}
function insertCommonTag(str, isInit)
{
	var strLength = 0;
	for ( var i = 0; i < str.length ; i++) {
		if (escape(str.charAt(i)).length > 3) {
			strLength +=2;
		} else {
			strLength++;
		}
	}

	if(strLength > 41){
		alert('태그의 길이를 줄여주세요. (40 bytes)');
		document.getElementById("articleTag").instance.isSettingValue = false;
		return;
	}
	if(document.getElementById("articleTag").instance.isSettingValue)
		return;
	else
		document.getElementById("articleTag").instance.isSettingValue = true;
	document.getElementById("articleTag").instance.hideSuggestion();
	if(document.getElementById("articleTag").instance.isTemporaryEditing())
	{//이미 입력한 중간 테그를 다시 변경할때
		document.getElementById("articleTag").instance.inputTemporary.parentNode.onclick = this.tagListMouseClick;
		if(str.trim() == ""){
			document.getElementById("articleTag").instance.inputTemporary.parentNode.parentNode.removeChild(this.inputTemporary.parentNode);
			changeCheckBox(false);
		}else{
			document.getElementById("articleTag").instance.inputTemporary.parentNode.innerHTML = str;
		}
		document.getElementById("articleTag").instance.typingText = "";
		document.getElementById("articleTag").instance.inputTemporary = null;
	}
	else if(str.trim() != "")
	{

		var inputContainer = document.getElementById("articleTag").instance.tagList.lastChild;
		inputContainer.className = "";
		var listItem = document.createElement("li");
		listItem.onclick = document.getElementById("articleTag").instance.tagListMouseClick;
		listItem.appendChild(document.createTextNode(str));
		document.getElementById("articleTag").instance.tagList.removeChild(inputContainer);
		changeCheckBox(false);
		document.getElementById("articleTag").instance.tagList.appendChild(listItem);
		//	document.getElementById("articleTag").instance.tagList.children(0).insertAdjacentElement("BeforeBegin",listItem);
		if(document.getElementById("articleTag").instance.tagList.childNodes.length >= 20 ){
			if(!isInit){
				alert('최대 20개까지 입력가능합니다.');
			}
			changeCheckBox(true);
			document.getElementById("articleTag").instance.isSettingValue = false;
			return;
		}
		document.getElementById("articleTag").instance.tagList.appendChild(inputContainer);
		document.getElementById("articleTag").instance.typingText = "";
		document.getElementById("articleTag").instance.inputOnLast.value = "";
		document.getElementById("articleTag").instance.focusOnInput();

	}

	document.getElementById("articleTag").instance.tagList.firstChild.className = "firstChild";

	document.getElementById("articleTag").instance.isSettingValue = false;

}


// 입력창을 10ms마다 체크하면서 값이 변했으면 request를 보낸다.
// 파이어폭스에서는 한글을 입력할때 keydown 이벤트가 발생하지 않기 때문에
// 값이 변하는지 계속 보고있어야 한다.
function raputaTagFunction_WatchInputBox(id)
{
	try
	{
		var instance = document.getElementById(id).instance;
		var input = instance.getInput();

		// 값이 달라졌는지 체크
		if(input.value != instance.typingText)
		{
			//alert('!=');
			instance.typingText = input.value;
			instance.requestSuggestion();
		}
	}
	catch(e) { }

}

// 서버에서 보내오는 필터로 로컬 tag suggestion
function raputaTagFunction_showLocalSuggestion(id, cursor, filter)
{
	return true;
//	alert('id : ' + id); //articleTag
	// Container의 ID를 통해 instance를 가져온다
	try {
		var instance = document.getElementById(id).instance;
	}
	catch(e) { return; }

	//alert('instance : ' + instance);
	// 보내온 cursor와 현재 cursor가 같지 않으면 필요없는 데이터이므로 버린다
	// 텍스트 박스를 벗어난 후에 도착한 데이터도 버린다
	var input = instance.getInput();

	var xmlhttp = createHttp();
	if(xmlhttp)
	{
		xmlhttp.open("GET", "http://bookmark.daum.net/tag_suggest?q=" + instance.getInput().value, true);
		xmlhttp.onreadystatechange = function()
		{
			if(xmlhttp.readyState == 4)
			{
				try {
					var doc;
					
					doc = getXMLDocument(xmlhttp);
					
					var root = doc.getElementsByTagName("items")[0];

					var instance = document.getElementById(id).instance;
					if(instance.cursor == cursor)
					{
						var tags = new Array();

						var tagItems = root.getElementsByTagName("item")
						if(!instance.allowRaputaSuggestion && tagItems.length == 0) {
							instance.hideSuggestion();
							return;
						}
						for(var i=0; i<tagItems.length; i++)
							tags[tags.length] = tagItems[i].firstChild.nodeValue;

						var htmlText = new StringBuffer();

						for(var i=0; i<tags.length; i++)
						{
							htmlText.append("<li onmouseover=\"this.className='hover'\" onmouseout=\"this.className=''\" onmousedown=\"this.parentNode.instance.suggestionMouseClick(this)\" ><strong>");
							htmlText.append(tags[i].substring(0, input.value.length).htmlspecialchars().replaceAll("&amp;", "&"));
							htmlText.append("</strong>");
							htmlText.append(tags[i].substring(input.value.length).htmlspecialchars().replaceAll("&amp;", "&"));
							htmlText.append("</li>");
						}

						if(instance.allowRaputaSuggestion){
							htmlText.append(instance.suggestion.innerHTML);
						}
						instance.suggestion.innerHTML = htmlText.toString();
						htmlText = new StringBuffer();

							instance.suggestBox.style.left = getOffsetLeft(input) + "px";
							//alert('instance.suggestBox.style.left  : ' + instance.suggestBox.style.left );
							instance.suggestBox.style.top = getOffsetTop(input) + input.offsetHeight + "px";
							//alert('instance.suggestBox.style.top  : ' + instance.suggestBox.style.top );
							instance.suggestBox.style.display = "block";

							instance.suggestion.style.left = getOffsetLeft(input) + "px";
							//alert('instance.suggestion.style.left : ' + instance.suggestion.style.left);
							instance.suggestion.style.top = getOffsetTop(input) + input.offsetHeight + "px";
							//alert('instance.suggestion.style.top : ' + instance.suggestion.style.top);
							instance.suggestion.style.zindex = "9999999";
							instance.suggestion.style.display = "block";
							instance.isSuggestionShown = true;

							try { document.getElementById("fileList").style.visibility = "hidden"; } catch(e) { }
							try { document.body.removeChild(instance.suggestion) } catch(e) { };
							/*
							document.body.appendChild(instance.suggestBox);
							document.body.appendChild(instance.suggestion);
							*/
							//this.suggestBox.appendChild(this.suggestion);
							//this.container.appendChild(this.suggestBox);

							instance.suggestBoxScroll.appendChild(instance.suggestion);
							instance.suggestBox.appendChild(instance.suggestBoxScroll);
							document.body.appendChild(instance.suggestBox);

							//document.getElementById('suggestBoxScroll').onmousedown = instance.requestSuggestion();
							//document.getElementById('suggestBoxScroll').onmousedown = "";

						while(instance.suggestion.childNodes.length > 6)
							instance.suggestion.removeChild(instance.suggestion.childNodes[instance.suggestion.childNodes.length-1]);

					}
				} catch(e) { }
			}
		}
		xmlhttp.send(null);
		delete xmlhttp;
	}
}


function Tag(container, language, disable)
{
	this.name = "Raputa Tag Object";

	this.allowRaputaSuggestion = (typeof(disable) == "undefined") ? false : !disable;

	this.isSettingValue = false;	// setValue가 짧은 시간에 여러번 실행될때 Safari가 죽어버리는 문제 해결

	this.instance = this;	// requestSuggestion() 함수에서 참조한다
	this.cursor = 0;		// 비동기로 전송되는 스크립트의 짝을 맞추기 위한 커서

	this.isTyping = false;			// input box에 포커스가 있는지 여부
	this.isSuggestionShown = false;	// suggest window가 보여지고 있는지의 여부

	this.typingText = "";			// raputaTagFunction_WatchInputBox에서 input box의 값을 감시하기 위한 변수

	this.inputClassName = "";

	this.language = "ko";
	if(typeof language != "undefined")
		this.language = language;

	this.container = container;		// tag list가 들어갈 container
	this.container.instance = this;

	// suggestion window ^^
	this.suggestBox = document.createElement("div");
	this.suggestBox.instance = this;
	this.suggestBox.className = "raputaSuggestBox";
	this.suggestBox.style.position = "absolute";
	this.suggestBox.style.zIndex = "9999";

	this.suggestBoxScroll = document.createElement("div");
	this.suggestBoxScroll.id = "suggestBoxScroll";;
	this.suggestBoxScroll.instance = this;
	this.suggestBoxScroll.className = "raputaSuggestBoxScroll";
	this.suggestBoxScroll.style.zIndex = "9999";

	this.suggestion = document.createElement("ul");
	this.suggestion.instance = this;
	this.suggestion.selectedIndex = 0;
	this.suggestion.className = "raputaSuggest";
	this.suggestion.style.listStyleType = "none";
	this.suggestion.className = "raputaSuggest";
	this.suggestion.style.zIndex = "99999";

	//this.suggestBox.appendChild(this.suggestion);
	//this.container.appendChild(this.suggestBox);

//	this.suggestBox.appendChild(this.suggestion);
	// 10ms마다 input box의 값이 변했는지 체크
	setInterval("raputaTagFunction_WatchInputBox('" + this.container.id + "')", 10);

	// 마지막 노드에 들어가는 input box
	this.inputOnLast = this.createSuggestInput();
	this.inputTemporary = null;

	// tag list
	this.tagList = document.createElement("ul");
	this.tagList.instance = this;
	this.tagList.id = "tagul";

	// tag list first child
	var listItem = document.createElement("li");
	listItem.className = "firstChild"
	listItem.appendChild(this.inputOnLast);
	this.tagList.appendChild(listItem);
	this.container.appendChild(this.tagList);
	//document.getElementById("tttt").instance.focusOnInput();
	this.inputOnLast.focus();
}

// 마지막노드의 input box를 편집중인지 중간의 list item을 눌러 편집중인지를 리턴
Tag.prototype.isTemporaryEditing = function()
{
	return (this.inputTemporary != null);
}

Tag.prototype.setInputClassName = function(str)
{
	this.inputClassName = str;
	this.inputOnLast.className = str;
	if(this.inputTemporary) this.inputTemporary.className = str;
}

// 현재 편집중인 input box
Tag.prototype.getInput = function()
{
	return (this.inputTemporary == null) ? this.inputOnLast : this.inputTemporary;
}

// cross browser event
Tag.prototype.adjustEventCompatibility = function(event)
{
	if(navigator.appName == "Microsoft Internet Explorer")
	{
		event = window.event;
		event.target = event.srcElement;
	}

	return event;
}

// input box를 생성한다
Tag.prototype.createSuggestInput = function()
{
	var input = document.createElement("input");
	input.instance = this;
	input.className = this.inputClassName;
	input.setAttribute("autocomplete", "off");
	input.onblur = function() {
		var instance = this.instance;

		instance.isTyping = false;
		instance.hideSuggestion();
		instance.setValue(this.value);
	}
	//input.onclick = this.requestSuggestion; //input box click시 서제스트 나오는거 hidden
	input.onkeydown = function(event) {
		var instance = this.instance;

		instance.isTyping = true;

		event = instance.adjustEventCompatibility(event);
		switch(event.keyCode)
		{
//			case 37:		// pre
//				ControlRangeSelect();
//				var curCursor = instance.getCurCursor(document.tagtag.tag); //현재 커서의 위치index
//				var curCursor = instance.getCurCursor(this); //현재 커서의 위치index
//				if(curCursor == 0){
//					instance.moveBack();
//				}else
//					return event.keyCode;
//				break;
			case 8:		// BackSpace
				if(this.value != "")
					return event.keyCode;
				else
					instance.moveBack();
				break;
			case 13:	// Enter
				instance.setValue(this.value);
				break;
			case 188:	// ,
			//	instance.setValue(this.value);
				break;
			case 27:	// ESC
				instance.hideSuggestion();
				break;
			case 38:	// Key Up
				instance.moveUp();
				break;
			case 40:	// Key Down
				instance.moveDown();
				break;
			default:
				return event.keyCode;
		}

		event.returnValue = false;
		event.cancelBubble = true;

		try { event.preventDefault(); } catch(e) { }

		return false;
	}
	input.onkeyup = function(event) {
		var instance = this.instance;

		instance.isTyping = true;

		event = instance.adjustEventCompatibility(event);
		switch(event.keyCode)
		{
			case 13:	// Enter
				break;
			case 188:	// ,
				instance.setValue(this.value);
				break;
			case 27:	// ESC
				break;
			case 38:	// Key Up
				break;
			case 40:	// Key Down
				break;
			default:
				return event.keyCode;
		}

		event.returnValue = false;
		event.cancelBubble = true;

		try { event.preventDefault(); } catch(e) { }

		return false;
	}

	input.onkeypress = function(event) {
		var instance = this.instance;

		instance.isTyping = true;

		event = instance.adjustEventCompatibility(event);
		switch(event.keyCode)
		{
			case 8:		// BackSpace
				if(this.value == "")
					instance.moveBack();
				else
					return event.keyCode;
				break;
			case 13:	// Enter
				break;
			case 188:	// ,
				//instance.setValue(this.value);
				break;
			case 44:	// ,
				instance.setValue(this.value);
				break;
			case 27:	// ESC
				break;
			case 38:	// Key Up
				break;
			case 40:	// Key Down
				break;
			default:
				return event.keyCode;
		}

		event.returnValue = false;
		event.cancelBubble = true;

		try { event.preventDefault(); } catch(e) { }

		return false;
	}

	return input;
}

// suggestion window의 항목을 클릭하면 값을 세팅한다
Tag.prototype.suggestionMouseClick = function(obj)
{
	var input = this.getInput();
	this.hideSuggestion();
	this.setValue(obj.innerHTML.replace(new RegExp("</?strong>", "gi"), "").replaceAll("&amp;", "&"));
}

// script의 src를 변경해 서버로부터 tag 리스트를 전송받는다
Tag.prototype.requestSuggestion = function()
{

	var instance = this.instance;

	instance.isTyping = true;
	instance.cursor++;
	raputaTagFunction_showLocalSuggestion(instance.container.getAttribute("id"), instance.cursor, "name like '" + instance.getInput().value + "%'")
	return;
	debug("Request " + instance.cursor);

}

// tag list의 이전 항목으로 이동
Tag.prototype.moveBack = function()
{
	var prevNode = this.getInput().parentNode.previousSibling;

	if(this.tagList.childNodes.length > 1 && prevNode)
	{
		this.hideSuggestion();

		var text = prevNode.innerHTML.unhtmlspecialchars();

		prevNode.parentNode.removeChild(prevNode);
		changeCheckBox(false);
		this.tagList.firstChild.className = "firstChild";
		this.getInput().value = text;
		updatetime();
	}
}

// suggestion window 커서를 위로 이동
Tag.prototype.moveUp = function()
{
	if(this.isSuggestionShown)
	{
		this.cursor++;
		this.suggestion.selectedIndex--;

		if(this.suggestion.selectedIndex < 1)
			this.suggestion.selectedIndex = this.suggestion.childNodes.length;

		this.highlightRow();
	}
}

// suggestion window 커서를 아래로 이동
Tag.prototype.moveDown = function()
{
	if(this.isSuggestionShown)
	{
		this.cursor++;
		this.suggestion.selectedIndex++;

		if(this.suggestion.selectedIndex > this.suggestion.childNodes.length)
			this.suggestion.selectedIndex = 1;

		this.highlightRow();
	}
}

// 이동 후에 현재 열의 style class를 변경한다
Tag.prototype.highlightRow = function()
{
	// suggest window가 보이지 않는 상태거나 전송받은 내용이 없으면 제낌
	if(this.isSuggestionShown && this.suggestion.childNodes[0].className != "disabled")
	{
		for(var i=0; i<this.suggestion.childNodes.length; i++)
			this.suggestion.childNodes[i].className = (i == this.suggestion.selectedIndex - 1) ? "hover" : "";

		// 선택된 열의 값을 input box에 채운다
		this.getInput().value = this.typingText = this.suggestion.childNodes[this.suggestion.selectedIndex-1].innerHTML.replace(new RegExp("</?strong>", "gi"), "").unhtmlspecialchars();
	}
}

// 노드의 값을 배열로 반환한다
Tag.prototype.getValues = function()
{
	var values = new Array();

	for(var i=0; i<this.tagList.childNodes.length-1; i++)
		values[i] = this.tagList.childNodes[i].innerHTML.trim().unhtmlspecialchars();

	return values;
}
Tag.prototype.getCurCursor = function(input)
{
    return getCursorPos(input);
}
// 마지막 노드의 input box에 값을 추가하거나 임시 input box의 값을 tag list에 세팅한다
Tag.prototype.setValue = function(str)
{ //important
	str = this.deleteComma(str);


	var strLength = 0;
	for ( var i = 0; i < str.length ; i++) {
		if (escape(str.charAt(i)).length > 3) {
			strLength +=2;
		} else {
			strLength++;
		}
	}

	if(strLength > 40){
		//alert('최대 40 byte이므로 초과된 글자수는 자동으로 삭제됩니다.');
		strCount = 0;
		var tempStr2 = "";
		var tempStr = "";
		for(i = 0; i < str.length; i++)
		{
			tempStr = str.charAt(i);
			if(escape(tempStr).length > 4) strCount += 2;
			else strCount += 1 ;
			if (strCount > 40)
			{
				if(escape(tempStr).length > 4) strCount -= 2;
				else strCount -= 1 ;
				break;
			}
			else tempStr2 += tempStr;
		}
		str = tempStr2;
		//document.writeForm.mentents.value = tempStr2;

		//this.isSettingValue = false;
		//return;
	}
	if(this.isSettingValue)
		return;
	else
		this.isSettingValue = true;
	this.hideSuggestion();
	if(this.isTemporaryEditing())
	{//이미 입력한 중간 테그를 다시 변경할때

		/*if(exitLastInput == 1 ){
			this.tagList.removeChild(this.tagList.lastChild);
			exitLastInput = 0;
		}*/
		this.inputTemporary.parentNode.onclick = this.tagListMouseClick;
		if(str.trim() == ""){
			this.inputTemporary.parentNode.parentNode.removeChild(this.inputTemporary.parentNode);
		}else{
			this.inputTemporary.parentNode.innerHTML = str;
		}
		this.typingText = "";
		this.inputTemporary = null;
		if(exitLastInput == 0  && this.tagList.childNodes.length < 10 ){
			// 마지막 노드에 들어가는 input box
			this.inputOnLast = this.createSuggestInput();
			this.inputTemporary = null;
			// tag list first child
			var listItem = document.createElement("li");
			listItem.className = "firstChild"
			listItem.appendChild(this.inputOnLast);
			this.tagList.appendChild(listItem);
			//this.container.appendChild(this.tagList);
			exitLastInput = 1;
			changeCheckBox(false);
		}
	}
	else if(str.trim() != "")
	{

		var inputContainer = this.tagList.lastChild;
		inputContainer.className = "";
		var listItem = document.createElement("li");
		listItem.onclick = this.tagListMouseClick;
		listItem.appendChild(document.createTextNode(str));
		this.tagList.removeChild(inputContainer);
		//alert('b'); //몽땅 사라짐.
		this.tagList.appendChild(listItem);
		//alert('c');  //글자.
		if(this.tagList.childNodes.length >= 20 ){
			exitLastInput = 0;
			alert('최대 20개까지 입력가능합니다.');
			changeCheckBox(true);
			this.typingText = "";
			this.inputOnLast.value = "";
			this.suggestBox.style.display = "none";
			this.tagList.firstChild.className = "firstChild";
			this.isSettingValue = false;
			return;
		}
		updatetime();
		//alert('a'); //input박스 없어집
		this.tagList.appendChild(inputContainer);
		//alert('b'); //input박스 안에 앞에 입력한거
		this.typingText = "";
		//alert('c');
		this.inputOnLast.value = "";
		//alert('d');//input박스 안에 공백
		this.focusOnInput();
		exitLastInput = 1;

	}else if(str.trim() == ""){
		this.inputOnLast.value = "";
	}

	this.suggestBox.style.display = "none";
	this.tagList.firstChild.className = "firstChild";

	this.isSettingValue = false;
	if(strLength > 40){
		alert('최대 40byte이므로 초과된 글자수는 자동으로 삭제됩니다');
	}

}

// tag list를 마우스로 클릭하면 input box로 변신시키기 위한 이벤트 핸들러
Tag.prototype.tagListMouseClick = function()
{
	var instance = this.parentNode.instance;
	instance.inputTemporary = instance.createSuggestInput();
	instance.inputTemporary.value = this.innerHTML.unhtmlspecialchars();
	instance.typingText = this.innerHTML;
	this.innerHTML = "";
	this.onclick = null;
	this.appendChild(instance.inputTemporary);
	//tag modification시 마지막 inputbox삭제. start
	//alert(this.parentNode.childNodes.length + ' : ' +this.parentNode.instance.tagList.childNodes.length + ' : ' + this.parentNode.instance);
	if(this.parentNode.childNodes.length < 10 && exitLastInput == 1){
		this.parentNode.removeChild(this.parentNode.lastChild);
		exitLastInput = 0;
	}
	//tag modification시 마지막 inputbox삭제. end
	instance.focusOnInput();
	instance.requestSuggestion();

}

// suggestion window를 숨긴다
Tag.prototype.hideSuggestion = function()
{
	this.isSuggestionShown = false;
	this.suggestion.style.display = "none";
	this.suggestion.selectedIndex = 0;

	/* TODO : temporary code */
	try {
		if(document.getElementById("fileList") 
		&& document.getElementById("fileList").style
		&& document.getElementById("fileList").style.visibility){
			document.getElementById("fileList").style.visibility = "visible";
		}
	} catch(e) { }
}

// 적절한 input box로 포커스를 이동시킨다
Tag.prototype.focusOnInput = function()
{
	this.getInput().focus();
	this.getInput().select();
}

Tag.prototype.deleteComma = function(str)
{
	var tempStr1 = ""
	var tempStr3 = ""
	for(var i = 0; i < str.length; i++)
	{
		tempStr1 = str.substr(i,1);

		if(tempStr1 == ','){
				tempStr3 += "";
		}else{
			 tempStr3 += tempStr1;
		}
	}
	str = tempStr3;
	return str;
}

// 이하 잡 유틸들

function getOffsetTop(obj)
{ return obj ? obj.offsetTop + getOffsetTop(obj.offsetParent) : 0; }

function getOffsetLeft(obj)
{ return obj ? obj.offsetLeft + getOffsetLeft(obj.offsetParent) : 0; }

var StringBuffer = function()
{ this.buffer = new Array(); }

StringBuffer.prototype.append=function(str)
{ this.buffer[this.buffer.length] = str; }

StringBuffer.prototype.toString = function()
{ return this.buffer.join(""); }

if(!String.prototype.trim) {
	String.prototype.trim = function()
	{ return this.replace(new RegExp("(^\\s*)|(\\s*$)", "g"), ""); }
}

if(!String.prototype.htmlspecialchars) {
	String.prototype.htmlspecialchars = function()
	{ return this.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll("<", "&gt;"); }
}

if(!String.prototype.unhtmlspecialchars) {
	String.prototype.unhtmlspecialchars = function()
	{ return this.replaceAll("&amp;", "&").replaceAll("&lt;", "<").replaceAll("&gt;", ">"); }
}
function prepareTag(tagname, frm) {
	//var orginal_tagname = frm.tagName.value;
	//var sep = "";
	//if(orginal_tagname != "") sep =", ";
	//frm.tagName.value = orginal_tagname + sep + tagname;

	insertCommonTag(tagname, false);
	updatetime();
}

function blogtaginit(){

	var originTag = document.dataInfo.tagName.value;
	var preIndex = -1;
	var count = 0;
	for(var i = 0; i < originTag.length; i++)
	{
		var chr = originTag.substr(i,1);
		if(chr == ','){
			insertCommonTag(originTag.substr(preIndex+1,count), true);
			preIndex = i;
			count = 0;
		}else{
			count = count + 1;
		}

		if(originTag.length == i+1){
			insertCommonTag(originTag.substr(preIndex+1,count), true);
			preIndex = i;
			count = 0;
		}

	}
}

var x=0;
function debug(s){try{document.getElementById("debug").innerHTML=++x+")"+s+"<br />"+document.getElementById("debug").innerHTML}catch(e){}}

function limitTagCount(obj) {
	var str = obj.value;

	if(str.split(",").length >= 20) {
		alert('최대 20개까지 입력가능합니다.');
		obj.value = str.substring(0, str.length-1);
		return;
	}
}







var actType="";
var hidden_cmtopen="";
var hidden_pcmmtno="";
var hidden_Desc="";
var commentMaxLength = 4000;

function regComment(cmmtObj, n, pcmmtno, atcno) {
	//http://pimg.daum-img.net/blog/library/common_v2.0.js 으로 수정해서 넣기!!!
	if(document.getElementById("setcmmtcheck"+n) == null){
		// 여기는 이미 있는 그냥 댓글을 달때 호출됩니다.
		cmmtObj.articleno.value	= atcno;
		cmmtObj.name.value 		= document.getElementById("cmmtname"+n).value;
		cmmtObj.open.value 		= document.getElementById("cmmtopen"+n).value;
		cmmtObj.texticon.value 		= document.getElementById("cmmtexticon"+n).value;
		cmmtObj.password.value 	= document.getElementById("cmmtpwd"+n).value;
		cmmtObj.contents.value 	= document.getElementById("cmmttext"+n).value;

		// 댓글 max는 1300으로 제한되어있습니다.
		if (cmmtObj.contents.value.length > commentMaxLength) {
			alert ("댓글은 "+commentMaxLength+"자 까지 작성하실 수 있습니다.");
			return false;
		} 

		if( document.getElementById("cmmtopen"+n).checked ) {
			cmmtObj.open.value = 'N';
		} else {
			cmmtObj.open.value = 'Y';
		}

		//텍스티콘에 대한 설정 여부 확인 
		if( document.getElementById("cmmtexticon"+n).checked ) {
			cmmtObj.texticon.value = 'Y';
		} else {
			cmmtObj.texticon.value = 'N';
		}		
		

		//비로그인시 글남길때 이름 기입여부 체크
		if(document.getElementById("cmmtname"+n).type != "hidden" 
		&& ( cmmtObj.name.value == "" || cmmtObj.name.value == "이름" || cmmtObj.name.value == "****" || cmmtObj.name.value.replace(/(^\s*)|(\s*$)/g, "")=="") ){
			alert("이름을 입력해주세요");
			return;
		}

		//비로그인시 글남길때 비밀번호 기입여부 체크
		if(document.getElementById("cmmtpwd"+n).type != "hidden" 
		&& (cmmtObj.password.value=="" || cmmtObj.password.value=="****" || cmmtObj.password.value.replace(/(^\s*)|(\s*$)/g, "")=="")){
			alert("비밀번호를 공백이 아닌 값으로 입력해주세요");
			return;
		}

		if(cmmtObj.contents.value== "" || cmmtObj.contents.value== "내용") {
			alert("내용을 입력해주세요.");
			return;
		}

		var key = document.getElementById("cmmtcheck"+n).value;
		var bflag = false;

		// 비로긴 상태에서 블로그 주소를 입력했을 경우에 아래와 같이 처리한다.
		if(document.getElementById("cmmtcheck"+n).type != "hidden") {
			if( key.indexOf("blog.daum.net/") == 0 ) {
				alert("Daum블로그 주소는 입력할 수 없습니다. \nDaum블로그 이용자께서는 로그인 후 사용해 주세요.	");
				return;
			}
		}

		if(key != '' && key != '블로그 또는 이메일 주소') {

			if( key.indexOf("@") > 0 ) {
				cmmtObj.cmmtmail.value = key;
				bflag = true;
			} else if( key.indexOf(".") > 0 ){

				if(key.indexOf("http://")<0)
					key = "http://"+key;

				cmmtObj.cmmtblog.value = key;
				bflag = true;
			}
		}

		if(bflag) {
			cmmtObj.pcmmtno.value = "";
			cmmtObj.isModify.value = "N";

			cmmtObj.action = "/_blog/CommentCreate.ajax";

//			document.getElementById("stop"+n).style.display = "none";
			var obj = new Object();
			obj.articleno=atcno;
			obj.blogid=cmmtObj.blogid.value;
			obj.commentType = 2;
			obj.commentNumber = n;
	        obj.currentPage= documentValueCheck(document.getElementById("cmtCurrentPage").value, "");
	        obj.prevPage= documentValueCheck(document.getElementById("cmtPrevPage").value, "");
	        obj.maxParentno= documentValueCheck(document.getElementById("cmtMaxParentno").value, "");
	        obj.minParentno= documentValueCheck(document.getElementById("cmtMinParentno").value, "");
					
			loadXMLDocWithParam("POST",cmmtObj.action,getForm(cmmtObj),"afterCommentInsert",null,obj);
			if (typeof(requestAjaxCheck) == 'function') {
				requestAjaxCheck("action=regComment&blogid="+obj.blogid);
			}
		}else{
			alert("블로그/이메일 형태가 잘못되었습니다.");
			return;
		}
	}
	else if(document.getElementById("setcmmtcheck"+n)!= undefined || document.getElementById("setcmmtcheck"+n).value != undefined){
		// 여기는 이미 있는 댓글에 답글을 달때 호출됩니다. 
		cmmtObj.articleno.value	= atcno;
		cmmtObj.pcmmtno.value 	= pcmmtno;
		cmmtObj.cmmtno.value 	= n;
		cmmtObj.name.value 		= document.getElementById("setcmmtname" + n).value;
		cmmtObj.open.value 		= document.getElementById("setcmmtopen" + n).value;
		cmmtObj.texticon.value 		= document.getElementById("setcmmtexticon"+n).value;	
		cmmtObj.password.value 	= document.getElementById("setcmmtpwd" + n).value;
		cmmtObj.contents.value 	= document.getElementById("setcmmttext" + n).value;

		// 댓글 max는 1300으로 제한되어있습니다.
		if (cmmtObj.contents.value.length > commentMaxLength) {
			alert ("댓글은 "+commentMaxLength+"자 까지 작성하실 수 있습니다.");
			return false;
		} 

		if(document.getElementById("setcmmtopen" + n).checked == true){
			cmmtObj.open.value = "N";
		}else{
			cmmtObj.open.value = "Y";
		}

		if(document.getElementById("setcmmtexticon" + n).checked == true){
			cmmtObj.texticon.value = "Y";
		}else{
			cmmtObj.texticon.value = "N";
		}		
		
		if(document.getElementById("setcmmtname"+n).type != "hidden" 
		&& (cmmtObj.name.value == "" || cmmtObj.name.value == "이름" || cmmtObj.name.value == "****" || cmmtObj.name.value.replace(/(^\s*)|(\s*$)/g, "")=="") ) {
			alert("이름을 입력해주세요.");
			return;
		}
		
		if(document.getElementById("setcmmtpwd"+n).type!="hidden" 
		&& (cmmtObj.password.value=="" || cmmtObj.password.value=="****" || cmmtObj.password.value.replace(/(^\s*)|(\s*$)/g, "")=="")){
			alert("비밀번호를 공백이 아닌 값으로 입력해주세요.");
			return;
		}

		var key = document.getElementById("setcmmtcheck"+n).value;

		var bflag = false;
		if(key != '' && key != '블로그 또는 이메일 주소') {
			if( key.indexOf("@") > 0 && key.indexOf("/") < 0 ) {
				cmmtObj.cmmtmail.value = key;
				bflag = true;
			} else if(  key.indexOf(".") > 0 && key.indexOf("@") < 0) {

				if(key.indexOf("http://")<0)
					key = "http://"+key;
				cmmtObj.cmmtblog.value = key;
				bflag = true;
			}
		}else{
			alert("블로그 또는 이메일 주소를 입력해주세요");
			return;
		}

		if(bflag) {
			if(actType=="MOD"){
				cmmtObj.isModify.value = "Y";
				cmmtObj.action = "/_blog/CommentCreate.ajax";
			}else if(actType=="REP"){
				cmmtObj.isModify.value = "N";
				cmmtObj.action = "/_blog/CommentCreate.ajax";
			}

		}else{
			alert("블로그/이메일 형태가 잘못되었습니다.");
			return;
		}
					
		if(cmmtObj.contents.value=="" || cmmtObj.contents.value=="내용") {
			alert("내용을 입력해주세요.");
			return;
		}else{
			var obj = new Object();
			obj.articleno=atcno;
			obj.blogid=cmmtObj.blogid.value;
			obj.commentType = 1;
			obj.commentNumber = n;
			
	        obj.currentPage= documentValueCheck (document.getElementById("cmtCurrentPage").value, "");
	        obj.prevPage= documentValueCheck (document.getElementById("cmtPrevPage").value, "");
	        obj.maxParentno= documentValueCheck (document.getElementById("cmtMaxParentno").value, "");
	        obj.minParentno= documentValueCheck (document.getElementById("cmtMinParentno").value, "");
			
			if(actType=="MOD"){
				loadXMLDocWithParam("POST",cmmtObj.action,getForm(cmmtObj),"afterCommentModify",null,obj);

			} else {
				loadXMLDocWithParam("POST",cmmtObj.action,getForm(cmmtObj),"afterCommentInsert",null,obj);
			}
		}
	}else{
	}
}

function conditionalValueClear(oInput, isChecked, defaultValue) {
	if( oInput != null && typeof(oInput) != 'undefined' && oInput.type != "hidden" ) {
		if( isChecked ) {
			oInput.checked = false;
		} else {
			oInput.value = defaultValue;
		}
	}
}

function clearCommentInput(type, n)
{
	var header = "";
	if( type == 1 ) {
		header = "set";
	}
	
	conditionalValueClear(document.getElementById(header+"cmmtname"+n), false, "이름");
	conditionalValueClear(document.getElementById(header+"cmmtopen"+n), true, "");
	conditionalValueClear(document.getElementById(header+"cmmtexticon"+n), false, "");
	var oPasswd = document.getElementById(header+"cmmtpwd"+n);
	conditionalValueClear(oPasswd, false, "");
	if( oPasswd != null && typeof(oPasswd) != 'undefined' && oPasswd.type != 'hidden' ) {
		oPasswd.style.background = "url(http://pimg.daum-img.net/blog3/f_pass_1.gif) no-repeat #FFF";
	}
	conditionalValueClear(document.getElementById(header+"cmmttext"+n), false, "");
	conditionalValueClear(document.getElementById(header+"cmmtexticon" + n), true, "");
	conditionalValueClear(document.getElementById(header+"cmmtcheck"+n), false, "블로그 또는 이메일 주소");
}

//댓글 등록후 해줘야되는것들
function afterCommentInsert(xmlhttp,obj){
	var res = getSimpleResponse(xmlhttp);
	var tmp = document.createElement("DIV");
	tmp.innerHTML=res;
	var script = tmp.getElementsByTagName("SCRIPT");
	
	if(script.length>0){
		eval(script[0].innerHTML);
	} else {
		articleno = obj.articleno;
		currentPage = obj.currentPage;
		prevPage = obj.prevPage;
		maxParentno = obj.maxParentno;
		minParentno = obj.minParentno;
		
		var returnUrl ="";
		// obj.commentType = 1은 댓글의 답글, 2는 그냥 댓글 
		if ((currentPage=="" && prevPage =="") || obj.commentType == 2) {
			returnUrl = '/_blog/commentList.ajax?blogid='+obj.blogid+'&articleno='+articleno;
		} else {
			returnUrl = '/_blog/commentList.ajax?blogid='+obj.blogid+'&articleno='+articleno+'&prevPage='+prevPage+'&minParentno='+minParentno+'&maxParentno='+maxParentno+'&currentPage='+currentPage;
		}
	    loadCommentList(returnUrl, articleno);
	    
		cmtcnt = document.getElementById("cmmtcnt"+articleno).innerHTML;
		cmtcnt++;
		document.getElementById("cmmtcnt"+articleno).innerHTML=cmtcnt;
		document.getElementById("newcmmt"+articleno).innerHTML=" <img src=http://pimg.daum-img.net/blog/p_img/b_new.gif width=8 height=9>";
		if( typeof(requestAjaxCheck) == 'function' ) {
			requestAjaxCheck("action=commentList");
		}
	}
	
	tmp=null;
	
	flgSpace = "";
	flgMode = "";

	type = obj.commentType;
	n = obj.commentNumber;
	
	// success = reserved 면 금칙어로, 아래 댓글을 비우는 부분은 처리하지 않는다.
	if (xmlhttp.responseText.indexOf("success=\"reserved\"") < 0) {
		if (type == 1) {
			if(document.getElementById('setcmmttext' + n)) {
				document.getElementById('setcmmttext' + n).style.height = '34px';
				clearCommentInput(type, n);
			}
		} else if (type == 2) {
			if(document.getElementById('cmmttext' + n)) {
				document.getElementById('cmmttext' + n).style.height = '34px';
				clearCommentInput(type, n);
			}
		}
		if( document.loopform != null ) {
			document.loopform.reset();
		}
	}
	
	xmlhttp = null;
}
//댓글목록을 불러온다
function loadCommentList(url,atno){
	commentAjax = new AjaxObject("commentAjax", "commentListBlock_"+atno, "contents", "ajax_layer_load");
	commentAjax.load(url, true);
}

// 주인이 글을 지운다.
function deleteCommentAjax(blogid, atno, cmmtno, url, open, cntdt) {
	if(confirm("삭제하시겠습니까?	")){
       	var frm = document.delFrm;
		frm.blogid.value = blogid;
		frm.articleno.value = atno;
        frm.cmmtno.value = cmmtno;
		frm.mode.value = "D";
        frm.open.value = open;
        frm.regdt.value= cntdt;

        if(document.getElementById("password2") && document.getElementById("password2").value !=""){
        	frm.password.value=document.getElementById("password2").value;
        }
        var obj = new Object();
        obj.articleno=atno;
        obj.blogid= blogid;
        obj.currentPage= documentValueCheck (document.getElementById("cmtCurrentPage").value, "");
        obj.prevPage= documentValueCheck (document.getElementById("cmtPrevPage").value, "");
        obj.maxParentno=documentValueCheck (document.getElementById("cmtMaxParentno").value, "");
        obj.minParentno=documentValueCheck (document.getElementById("cmtMinParentno").value, "");
        
        loadXMLDocWithParam("POST","/_blog/CommentDelete.ajax",getForm(frm),"afterCommentDelete",null,obj);
        if( typeof(requestAjaxCheck) == 'function' ) {
			requestAjaxCheck("action=deleteCommentAjax&blogid="+blogid);
		}
	}
}

// 주인이 아닌 로그인 사용자의 댓글을 지운다.
function goCmmtLoginDelAjax(blogid, atno, cmmtno, url, open, cntdt, euserid){
    var frm = document.delFrm;
    frm.blogid.value=blogid;
    frm.articleno.value=atno;
    frm.cmmtno.value=cmmtno;
    frm.mode.value="D";
    frm.regdt.value=cntdt;
    frm.open.value=open;
    frm.euserid.value=euserid;
    var obj = new Object();
    obj.articleno=atno;
    obj.blogid= blogid;
    obj.currentPage=documentValueCheck (document.getElementById("cmtCurrentPage").value, "");
    obj.prevPage=documentValueCheck (document.getElementById("cmtPrevPage").value, "");
    obj.maxParentno=documentValueCheck (document.getElementById("cmtMaxParentno").value, "");
    obj.minParentno=documentValueCheck (document.getElementById("cmtMinParentno").value, "");
    
    loadXMLDocWithParam("POST","/_blog/CommentDelete.ajax",getForm(frm),"afterCommentDelete",null,obj);
}
//댓글 삭제후 해줘야되는것들
function afterCommentDelete(xmlhttp,obj){
	articleno = obj.articleno;
	currentPage = obj.currentPage;
	prevPage = obj.prevPage;
	maxParentno = obj.maxParentno;
	minParentno = obj.minParentno;
    
   //	if(isSuccess == true || isSuccess == "true"){
		var returnUrl ="";
		if (currentPage=="" && prevPage =="") {
			returnUrl = '/_blog/commentList.ajax?blogid='+obj.blogid+'&articleno='+articleno;
		} else {
			returnUrl = '/_blog/commentList.ajax?blogid='+obj.blogid+'&articleno='+articleno+'&prevPage='+prevPage+'&minParentno='+minParentno+'&maxParentno='+maxParentno+'&currentPage='+currentPage;
		}
	    loadCommentList(returnUrl, articleno);
	    
		cmtcnt = document.getElementById("cmmtcnt"+articleno).innerHTML;
		cmtcnt--;
		document.getElementById("cmmtcnt"+articleno).innerHTML=cmtcnt;

		if(cmtcnt == 0) document.getElementById("newcmmt"+articleno).innerHTML="";
   	//}
	flgMode = "";
	xmlhttp=null;
}
//댓글 답변화면
function board_reply(mentNum, pmentNum, popen, articleNo) {

	if(document.getElementById("Text"+mentNum).style.display == 'none'){
		document.getElementById("Text"+mentNum).style.display = 'block';
	}
	
	actType="REP";
	var mode = "reply";
	
	writeTemplateSetting(mentNum, pmentNum, popen, articleNo, mode);

	if(popen=="N")
		document.getElementById("setcmmtopen"+mentNum).disabled=true ;
	else
		document.getElementById("setcmmtopen"+mentNum).disabled=false ;

	inSpaceDisplay(mentNum,actType);
}
//패스워드 기반으로 댓글 수정 패스워드 입력창을 보여준다.
function goCmmtModi(blogid,articleno,cmmtno,pnum,cmtopen,curObj,YN,obj){
	hidden_open = cmtopen;
	hidden_pcmmtno = pnum;
	    clickAreaCheck = true;
	    var str = "<div style='background:#FFFFFF; border:1px solid #999999;'><div style='margin:10px 10px 6px 10px; text-align:right;'>비밀번호를 입력해주세요.<br />";
	    str += "<input type=password id=password2 id=password2 name=password2 class='box passbg' style='width:139px; margin-bottom:5px;' onkeydown='clickAreaCheck = true' onfocus='clickAreaCheck = true;this.className = \"box\";'><br />";
	    str += "<a href=\"javascript:;\" onclick=\"checkCommentpasswd('"+blogid+"','"+articleno+"','"+cmmtno+"');\"><img src='http://pimg.daum-img.net/blog/p_img2/btn_ok.gif' width='32' height='18' alt='확인'></a> <a href='javascript:;' ><img src='http://pimg.daum-img.net/blog/p_img2/btn_cancle03.gif' width='32' height='18' alt='취소'></a><br /></div></div>";
	    setNameLayersPosition(obj, str);

}

function goCmmtDel(blogid,atno,no,url,open,curObj,cntdt){
	actType="DEL";
	frm = document.cmmtform;
	frm.blogid.value=blogid;
	frm.articleno.value=atno;
	frm.no.value=no;
	frm.mode.value="D";
	frm.open.value=open;
	frm.regdt.value=cntdt;
	frm.action=url;
    clickAreaCheck = true;
    var str = "<div style='background:#FFFFFF; border:1px solid #999999;' id='pwdinput'><div style='margin:10px 10px 6px 10px; text-align:right;'>비밀번호를 입력해주세요.<br />";
    str += "<input type=password id=password2 name=password2 class='box passbg' style='width:139px; margin-bottom:5px;' onkeydown='clickAreaCheck = true' onfocus='clickAreaCheck = true;this.className = \"box\";'><br>";
    str += "<a href=\"javascript:;\" onClick=\"checkCommentpasswd('"+blogid+"','"+atno+"','"+no+"');\"><img src='http://blogimg.daum-img.net/blog/p_img2/btn_ok.gif' width='32' height='18' alt='확인'></a> <a href='javascript:;' ><img src='http://blogimg.daum-img.net/blog/p_img2/btn_cancle03.gif' width='32' height='18' alt='취소'></a><br></div></div>";
    setNameLayersPosition(curObj, str);
}


//입력받은 패스워드 체크
function checkCommentpasswd(blogid,articleno,cmmtno){
	var passwd = document.getElementById("password2").value;
	if(passwd==""){
		alert("비밀번호를 입력해주세요!");
		return;
	}
	clickAreaCheck=false;
	var qry = "/_blog/CommentCheckPwd.ajax?type=2&blogid="+blogid+"&articleno="+articleno+"&cmmtno="+cmmtno+"&password="+passwd;
	loadXMLDocWithParam("GET",qry,null,"checkedCommentPasswd",null,null);
}
//패스워드 검사후 해줘야되는것들
function checkedCommentPasswd(xmlhttp,obj){
	var res = getSimpleResponse(xmlhttp);
	eval(res);
	xmlhttp=null;
}
//수정뒤에 해줘야될것들
function afterCommentModify(xmlhttp,obj){
	articleno = obj.articleno;
	currentPage = obj.currentPage;
	prevPage = obj.prevPage;
	maxParentno = obj.maxParentno;
	minParentno = obj.minParentno;
    
	var returnUrl ="";
	if (currentPage=="" && prevPage =="") {
		returnUrl = '/_blog/commentList.ajax?blogid='+obj.blogid+'&articleno='+articleno;
	} else {
		returnUrl = '/_blog/commentList.ajax?blogid='+obj.blogid+'&articleno='+articleno+'&prevPage='+prevPage+'&minParentno='+minParentno+'&maxParentno='+maxParentno+'&currentPage='+currentPage;
	}
    loadCommentList(returnUrl, articleno);
    
	cmtcnt = document.getElementById("cmmtcnt"+articleno).innerHTML;
	document.getElementById("cmmtcnt"+articleno).innerHTML=cmtcnt;

	flgSpace = "";
	flgMode = "";
	xmlhttp=null;
}

//수정화면
function board_modify(mentNum, pmentNum, cmmt_open, articleNo, commitYn) {
		if(commitYn=="Y" && document.getElementById("Text"+mentNum).style.display == 'none'){
			document.getElementById("Text"+mentNum).style.display = 'block';
		}
		else{
			if(actType!="DEL"){
				document.getElementById("Text"+mentNum).style.display = 'none';
			}
		}

		hidden_cmtopen="";
		hidden_pcmmtno="";

		if(actType=="DEL"){
			frm = document.cmmtform;
			blogid=frm.blogid.value;
			atno=frm.articleno.value;
			cmmtno = frm.no.value;
			copen = frm.open.value;
			cntdt = frm.regdt.value;
			deleteCommentAjax(blogid, atno, cmmtno, '/_blog/CommentDelete.ajax', copen, cntdt);
			actType="";
			return;
		}

		actType="MOD";
		var mode = "modify";

		writeTemplateSetting(mentNum, pmentNum, cmmt_open, articleNo, mode);

	    if(mentNum != pmentNum){
			var obj = document.getElementById("open"+pmentNum);
			if(obj){
				if(obj.innerText=="N"){
					if(document.getElementById("setcmmtopen"+mentNum)){
						document.getElementById("setcmmtopen"+mentNum).checked=true ;
						document.getElementById("setcmmtopen"+mentNum).disabled=true ;
					}
				}
			}
		}

		if(navigator.userAgent.toLowerCase().indexOf('msie')>-1){
			if(document.getElementById("Text"+mentNum)){
				document.getElementById("setcmmttext"+mentNum).value =  TexticonCheck.checkedComments(document.getElementById("Text"+mentNum).innerHTML);
				document.getElementById("setcmmttext"+mentNum).style.background = '#fff';
			}
			else
				document.getElementById("setcmmttext"+mentNum).value = replaceHTML(hiddenDesc);
			document.getElementById("setcmmtname"+mentNum).value =  document.getElementById("uname"+mentNum).innerText;
			if(document.getElementById("password2")){
				document.getElementById("setcmmtpwd"+mentNum).value =  document.getElementById("password2").value;
				document.getElementById("setcmmtpwd"+mentNum).style.background='#FFFFFF';
			}
			if(document.getElementById("setcmmtcheck"+mentNum))
			document.getElementById("setcmmtcheck"+mentNum).value =  document.getElementById("emailblog"+mentNum).name;
		}else{
			if(document.getElementById("Text"+mentNum))
				document.getElementById("setcmmttext"+mentNum).value =  TexticonCheck.checkedComments(document.getElementById("Text"+mentNum).innerHTML);
			else
				document.getElementById("setcmmttext"+mentNum).value =replaceHTML( hiddenDesc);
			document.getElementById("setcmmtname"+mentNum).value =  document.getElementById("uname"+mentNum).innerHTML;
			if(document.getElementById("password2")){
				document.getElementById("setcmmtpwd"+mentNum).value =  document.getElementById("password2").value;
				document.getElementById("setcmmtpwd"+mentNum).style.background='#FFFFFF';
			}
			if(document.getElementById("setcmmtcheck"+mentNum))
			document.getElementById("setcmmtcheck"+mentNum).value =  document.getElementById("emailblog"+mentNum).getAttribute("name");
		}
		inSpaceDisplay(mentNum, actType);

		hiddenDesc="";
		window.setTimeout("resizeArea(document.getElementById('setcmmttext'+" + mentNum + "), '34', '1000')", 10);
		resizeArea(document.getElementById("setcmmttext"+mentNum), '34', '1000');
}

function innertxt(mentNum, pmentNum, cmmt_open, articleNo, mode,islogin){
		var innerWrite = "";

		var cmtopen = document.getElementById("commentOpen_"+articleNo).innerHTML;
    	var onlyloginuser = "N";
    	if(cmtopen =="B0402" && USERINFO.islogin=="N"){
    		onlyloginuser = "Y"
    	}
    	innerWrite = innerWrite + "<table class=\"writeTable\"><colgroup><col /><col width=\"70\" /></colgroup><tr><td class=\"textareaBlock\">";
		if( onlyloginuser == "Y"){

		}else if( USERINFO.isHidden == "N"){
            innerWrite = innerWrite + " <input type=\"text\" size=\"15\" name=\"setcmmtname\" id=\"setcmmtname"+mentNum+"\" value=\""+USERINFO.blogname+"\" class=\"box\" onfocus=\"if(this.value=='이름')this.value=''\"> &nbsp;";
            innerWrite = innerWrite + " <input type=\"password\" size=\"12\" name=\"setcmmtpwd\" id=\"setcmmtpwd"+mentNum+"\" value=\"\" class=\"box passbg\" onfocus=\"this.style.background='#FFFFFF'\"> &nbsp;";
            innerWrite = innerWrite + " <input type=\"text\" name=\"setcmmtcheck\" id=\"setcmmtcheck"+mentNum+"\" size=\"27\" value=\""+USERINFO.blogCheck+"\" class=\"box\" onfocus=\"if(this.value=='블로그 또는 이메일 주소')this.value=''\"><br style=\"font-size:3px;\">";
		}else{
		    innerWrite = innerWrite + " <input type=\"hidden\" name=\"setcmmtname\" id=\"setcmmtname"+mentNum+"\" value=\""+USERINFO.blogname+"\" class=\"box\">";
            innerWrite = innerWrite + " <input type=\"hidden\" name=\"setcmmtpwd\" id=\"setcmmtpwd"+mentNum+"\"  value=\""+USERINFO.blogPwd+"\" class=\"box\">";
            innerWrite = innerWrite + " <input type=\"hidden\" name=\"setcmmtcheck\" id=\"setcmmtcheck"+mentNum+"\"  value=\""+USERINFO.blogCheck+"\" class=\"box\" value=\"\">";
		}
		if( onlyloginuser == "Y" ){
        	innerWrite = innerWrite + " <textarea rows=\"3\" cols=\"57\" name=\"setcmmttext\" id=\"setcmmttext"+mentNum+"\" class=\"box\" style=\"\"  disabled>Daum 회원에게만 댓글을 허용하고 있습니다.</textarea>";
		}else{
        	innerWrite = innerWrite + " <textarea rows=\"3\" cols=\"57\" name=\"setcmmttext\" id=\"setcmmttext"+mentNum+"\"  class=\"box\" style=\"\" onkeyup=\"resizeArea(this, '34', '1000')\" onfocus=\"if(this.value=='내용')this.value=''\">내용</textarea>";
		}
		if(onlyloginuser == "N"){
			innerWrite = innerWrite + "</td><td class=\"buttonBlock\"><a href=\"#\" onclick=\"regComment(document.cmmtform,  '" + mentNum + "', '" + pmentNum + "', '"+articleNo+"'); return false;\" class=\"gbButton sSubmitBtn\">등록</a>";
			innerWrite = innerWrite + "<a href=\"#\" onclick=\"board_reply('" + mentNum + "', '" + pmentNum + "', '" + cmmt_open + "', '"+articleNo+"'); return false;\" class=\"gbButton sCancelBtn\">취소</a></td></tr></table>";
		}
		innerWrite = innerWrite + "<div style=\"height:25px; margin:3px 0 0 0;\">";
		var checkOption = "";
		var checkOptionicon = "";

		if(cmmt_open == "N"){
			checkOption = "checked";
		}
		if (TexticonCheck.isTexticon(document.getElementById("Text"+mentNum).innerHTML)) {
			checkOptionicon = "checked";
		}	

		if(onlyloginuser == "Y"){

		}else if(USERINFO.islogin == "Y"){
	        innerWrite = innerWrite + "<div class=\"fl p11\"><input type=\"checkbox\" name=\"setcmmtopen\" id=\"setcmmtopen"+mentNum+"\" value=\"N\" class=\"checkbox\" " + checkOption + " style=\"vertical-align: middle; margin-bottom: 2px\"> 비공개";
			innerWrite = innerWrite + "<input type=\"checkbox\" name=\"setcmmtexticon\" id=\"setcmmtexticon"+mentNum+"\" value=\"Y\" class=\"checkbox\" " + checkOptionicon + " style=\"vertical-align: middle; margin-bottom: 2px\"> 텍스티콘";
			innerWrite = innerWrite + "<a href=\"javascript:popUp('/_help/popup_texticon.html', '520', '516')\"><img src=\"http://pimg.daum-img.net/blog/theme/btn_question02.gif\" width=\"12\" height=\"11\" alt=\"텍스티콘\" style=\"margin-bottom: 1px; vertical-align: middle;\" /></a>";
			if(cmtopen == "B0403")
				innerWrite+="<font class='p11'>(등록 후 승인으로 설정되어 있습니다. 블로그 주인이 승인하면 글이 보입니다.)</font>";

			innerWrite +="</div>";

		}else{
	        innerWrite = innerWrite + "<div class=\"fl\"><input type=\"hidden\" name=\"setcmmtopen\" id=\"setcmmtopen"+mentNum+"\" value=\"N\" class=\"checkbox\" style=\"vertical-align: middle; margin-bottom: 2px\">";
			innerWrite = innerWrite + "<input type=\"checkbox\" name=\"setcmmtexticon\" id=\"setcmmtexticon"+mentNum+"\" value=\"Y\" class=\"checkbox\" " + checkOptionicon + " style=\"vertical-align: middle; margin-bottom: 2px\">텍스티콘";
			innerWrite = innerWrite + "<a href=\"javascript:popUp('/_help/popup_texticon.html', '520', '516')\"><img src=\"http://pimg.daum-img.net/blog/theme/btn_question02.gif\" width=\"12\" height=\"11\" alt=\"텍스티콘\" style=\"margin-bottom: 1px; vertical-align: middle;\" /></a>";	        
			if(cmtopen == "B0403")
				innerWrite+="<font class='p11'>(등록 후 승인으로 설정되어 있습니다. 블로그 주인이 승인하면 글이 보입니다.)</font>";
			innerWrite +="</div>";
		}

		innerWrite = innerWrite + "</div></div>";
		return(innerWrite);
}
	var flgSpace = "";
	var flgMode = "";

	function inSpaceDisplay(mentNum, actType){

		var viewOff = document.getElementById("inWrite"+flgSpace);
		var viewOn = document.getElementById("inWrite"+mentNum);

		if(flgSpace != mentNum){

			if(flgSpace != ""){

				viewOff.style.display = "none";
				if(navigator.userAgent.toLowerCase().indexOf('msie')>-1){
					viewOff.innerHTML =  null;
				}else{
					viewOff.innerHTML =  null;
				}
			}

			viewOn.style.display="";
			flgSpace = mentNum;
			flgMode = actType;

		}else{

			if(flgMode == actType){
				viewOn.style.display="none";
			}else{
				viewOn.style.display="";
			}
			if(flgMode==""){
				viewOn.style.display="none";
			}

			flgSpace="";
			flgMode="";
		}
	}

	function writeTemplateSetting(mentNum, pmentNum, cmmt_open, articleNo, mode) {
		var writeTemplate = document.getElementById("inWrite"+mentNum);	
		writeTemplate.innerHTML = innertxt(mentNum, pmentNum, cmmt_open, articleNo, mode);
	}

function setNameLayersPosition(curObj, str) {
	var name = "nameLayer";
	if (!document.getElementById(name)) {
        var cElement = document.createElement("DIV");
        cElement.id = name;
        cElement.style.position = 'absolute';
		cElement.style.zIndex = 50;
        document.body.appendChild(cElement);
	}
	document.getElementById(name).style.top = (getAbsoluteTop(curObj) + curObj.offsetHeight + 3)+"px";
	document.getElementById(name).style.left = getAbsoluteLeft(curObj)+"px";
	document.getElementById(name).innerHTML = str;
	divDisplay(name, 'block');
}
function checkChild(key){
		var obj = document.getElementById("parent_"+key);

		if(obj){
			alert("답글이 달린글은 삭제 할 수 없습니다.");
			return false;
		}
		y= confirm('삭제하시겠습니까?');
		if(y)
		return true;
		else
		return false;
}
function gocmmtcheck(cmmtpwd){
		if(document.getElementById(cmmtpwd).value==""){
			alert("비밀번호를 입력해주세요");
			return;
		}
		document.cmmtform.password.value=document.getElementById(cmmtpwd).value;
		document.cmmtform.submit();
}
var showContentAjax;
var oldTarget = '';
var oldTargetId = '';
function showContent(target, articleNum, blogId, isSingleView) {
	if(!isSingleView && !isLoadedContent(target, articleNum) && target != 'A') {
		showContentAjax = new AjaxObject("showContentAjax", null, null, "ajax_layer_load");
		var sAction = "";
		if(target == "O") {
			showContentAjax.callbackFunc = printComment;
			source = "/_blog/commentList.do?blogid=" + blogId + "&articleno=" + articleNum + "&contentid=commentListBlock_"+articleNum;
			sAction = "commentList";
		} else if(target == "T"){
			showContentAjax.callbackFunc = printTrackback;
			source = "/_blog/getTrackbacks.do?blogid=" + blogId + "&articleno=" + articleNum + "&contentid=" + "iL"+target+"_"+articleNum;
			sAction = "getTrackbacks";
		}
		setLoadedContent(target, articleNum);
		source = source.replace(".do",".ajax");
		//loadXMLDoc("GET",source,null,func,"CommentFail");
		showContentAjax.load(source, true);
		if( typeof(requestAjaxCheck) == 'function' ) {
			requestAjaxCheck("action="+sAction);
		}
	}else{
		var cstate = document.getElementById("iL"+target+"_"+articleNum).style.display;
		if(cstate == "block"){
			document.getElementById("iL"+target+"_"+articleNum).style.display="none";
		}else{
			document.getElementById("iL"+target+"_"+articleNum).style.display="block";
		}
	}
	makebold('i'+target+'Text'+articleNum, 'cB_Amp');
	if(oldTargetId == articleNum && document.getElementById("iL"+oldTarget+"_"+articleNum).style.display=='none'){
		makebold('i'+oldTarget+'Text'+articleNum, '');
	}else if(oldTarget != target && document.getElementById("iL"+oldTarget+"_"+articleNum)){
		document.getElementById("iL"+oldTarget+"_"+articleNum).style.display='none';
		makebold('i'+oldTarget+'Text'+articleNum, '');
	}
	oldTarget = target;
	oldTargetId = articleNum;
}
//댓글 출력
function printComment(xmldoc){
		if(xmldoc !=null){
			var lastloadObject = loadedDynamicContent[loadedDynamicContent.length-1];
			var num = lastloadObject.substring(1);
			var obj = document.getElementById("commentListBlock_"+num);
            document.getElementById("iLO_"+num).style.display='block';
			if (typeof(xmldoc) != "string"){
				var items = xmldoc.getElementsByTagName('contents');
	            obj.innerHTML=items[0].firstChild.nodeValue;
			}else{
				obj.innerHTML=xmldoc;
			}            
			var commentScript = document.getElementById ? document.getElementById("commentScriptParse"+num) :  (document.all ? document.all["commentScriptParse"+num] : null)
			commentScript.innerHTML = obj.innerHTML;
			 //스크립트 실행
	        scriptParse(commentScript);
		}
}
//엮인글 출력
function printTrackback(xmldoc){
		if(xmldoc !=null){
			var lastloadObject = loadedDynamicContent[loadedDynamicContent.length-1];
			var num = lastloadObject.substring(1);
			var obj = document.getElementById("trackbackListBlock_"+num);
		    document.getElementById("iLT_"+num).style.display='block';
			if (typeof(xmldoc) != "string"){
				var items = xmldoc.getElementsByTagName('contents');
	            obj.innerHTML=items[0].firstChild.nodeValue;
			}else{
				obj.innerHTML=xmldoc;
			}            

		}
}
function makebold(target, cName){
	if(document.getElementById(target)){
		document.getElementById(target).className = cName;
		if(cName == 'cB_Amp'){
			document.getElementById(target).parentNode.className = 'bold';
		}else{
			document.getElementById(target).parentNode.className = '';
		}
	}
}


/* 댓글 리사이징 */
function resizeArea(curObj, min, max){
	if (navigator.userAgent.indexOf("Chrome") > 0 || navigator.userAgent.indexOf("Safari") > 0) {
		var scrollheight = curObj.scrollHeight - 4;
	} else {
		var scrollheight = curObj.scrollHeight;
	}

	if (scrollheight < min) {
		curObj.style.height = min + 'px';
		curObj.style.overflowY = "hidden";
	} else if(scrollheight > max) {
		curObj.style.overflowY = "auto";
	} else if (parseInt(curObj.style.height) != scrollheight) {
		curObj.style.height = scrollheight + 'px';
		curObj.style.overflowY = "hidden";
	}
}

	function documentValueCheck(objValue, defValue) {
		if (typeof(objValue) != 'undefined') {	
			return objValue;
		} else {
			return defValue;
		}
	}

/* loginForComment */
function loginForComment(blogname, articleno) {
	top.location.href = "http://www.daum.net/Mail-bin/login.html?url=http://blog.daum.net/"+blogname+"/"+articleno+"&category=blog";
}

/* loginForProfileComment */
function loginForProfileComment(blogid) {
	top.location.href = "http://www.daum.net/Mail-bin/login.html?url=http://blog.daum.net/_blog/ProfileView.do%3Fblogid="+blogid+"&category=blog";
}

/* loginForBoard */
function loginForBoard(blogid) {
	top.location.href = "http://www.daum.net/Mail-bin/login.html?url=http://blog.daum.net/_blog/BoardView.do%3FcurrentPage=1%26blogid="+blogid+"&category=blog";
}
/**
이게 뭐냐면 .. 뭔 줄 알지?

주인으로 로그인 했을때 목록보기 형태에서 체크박스로 선택한 글의 공개 설정이나 / 카테고리 변경할때 쓰이는거지..
속성이 변경되면 메뉴의 카테고리 정보도 한번 갱신을 해줘..  
**/
var newWin = null;
function cate_select_open_old(type) {
	var form = document.titleviewloop;
	if(checkItemNum(form) == 0) {
		alert("선택하신 항목이 없습니다. ");
		return;
	}
	var obj = getForm(form);
	var dest = "/_blog/popupCategoryChangeForm.do?"+obj+"&type="+type;
	var width = "466";
	var height = "300";
	newWin = window.open(dest, "win", "scrollbars=yes,toolbar=no,location=no,directories=no,width="+width+",height="+height+",resizable=no,mebar=no,left=250,top=65");
	newWin.focus();
}

function checkSelectRestrictedArticle(){
	var chkRest = document.getElementsByName("chkRestrictArticle");
	var itemBoxes = document.getElementsByName("itemBox");
	var countRest = 0;
	
	for(i = 0 ; i < chkRest.length ; i++){
		if(chkRest[i].value == "1" && itemBoxes[i].checked == true){
			itemBoxes[i].checked = false;
			countRest++;
		}
	}
	return countRest;
} 

function cate_select_open(type) {
   	var form = document.titleviewloop;
   	if(checkItemNum(form) == 0) {
   		alert(" 선택하신 항목이 없습니다");
   		return;
   	}
	
	var countRest = checkSelectRestrictedArticle();
	if(countRest > 0){
		alert("선택한 글 중 규제된 "+ countRest + "개의 글은 카테고리를 이동할 수 없으므로 해제됩니다.");
	}
	
	if(checkItemNum(form) == 0){
		return;
	}
	
	var width = "466";
   	var height = "300";
	
	// post 방식
	form.action = "/_blog/popupCategoryChangeForm.do";
	// post 라면서.. method 빼먹은 사람은 뉴규?
	form.method = "post";
   	newWin = window.open('about:blank', "win", "scrollbars=yes,toolbar=no,location=no,directories=no,width="+width+",height="+height+",resizable=no,mebar=no,left=250,top=65");
	form.target = "win";
	form.submit();
	newWin.focus();
}


function cate_select() {
		var inx = document.titleviewloop.hidCategory.selectedIndex;
		if(inx !=0){
			updateCate(document.titleviewloop);
		}
}
function open_select() {
		var inx= document.titleviewloop.hidOpen.selectedIndex;
		if(inx !=0 ){
			updateOpen(document.titleviewloop);
		}
}

function open_select_open(type) {
	var form = document.titleviewloop;
	if(checkItemNum(form) == 0) {
		alert(" 선택하신 항목이 없습니다. ");
		return;
	}
	
	var width = "466";
	var height = "300";
	
	// get 방식
	/*var obj = getForm(form);
	var dest = "/_blog/popupConfigChangeForm.do?"+obj+"&type="+type;
	newWin = window.open(dest, "win", "scrollbars=yes,toolbar=no,location=no,directories=no,width="+width+",height="+height+",resizable=no,mebar=no,left=250,top=65");
	newWin.focus();*/
	
	// post 방식
	form.action = "/_blog/popupConfigChangeForm.do";
   	form.target = "win";
	newWin = window.open('', "win", "scrollbars=yes,toolbar=no,location=no,directories=no,width="+width+",height="+height+",resizable=no,mebar=no,left=250,top=65");
	newWin.focus();
	form.submit();
}
	
function updateCate(form){
	if(checkItemNum(form) == 0) {
		alert(" 선택하신 항목이 없습니다. ");
		return;
	}
	if(confirm("선택된  글을  해당 카테고리로 변경 하시겠습니까?")){
		var obj = getForm(form);
		var param = new Object();
		param.blogid = form.blogid.value;
		loadXMLDocWithParam("POST","/_blog/contentStmtPopUpdate.do",obj,"UcateCallback","CommentFail",param);
	}
}
function UcateCallback(xmlhttp,obj){
		return UcateCallbackById(xmlhttp, obj.blogid);
}
function UcateCallbackById(xmlhttp,blogid){
	 	var link ="/_blog/hdn_categorylist.ajax?blogid="+blogid;
		loadXMLDoc("GET",link,null,"refreshMenu","CommentFail");
		xmlhttp = null;
		return true;
}
function UcateCallbackByIdNoReload(xmlhttp,blogid){
	 	var link ="/_blog/hdn_categorylist.ajax?blogid="+blogid;
		loadXMLDoc("GET",link,null,"refreshMenuNoReload","CommentFail");
		xmlhttp = null;
		return true;
}
function UcateCallbackDelay(xmlhttp,obj){
	xmlhttp = null;
	setTimeout("UcateCallbackByIdNoReload(null, '"+obj.blogid+"')", (window.opera ? 2500 : 1000));
}

function refreshMenu(xmlhttp){
	if(xmlhttp !=null){
			goPage(1);
			var menu =getSimpleResponse(xmlhttp);
			var obj = document.getElementById("Category");
		    obj.innerHTML=menu;
		   
		xmlhttp = null;	
	}
}
function refreshMenuNoReload(xmlhttp){
	if(xmlhttp !=null){
			var menu =getSimpleResponse(xmlhttp);
			var obj = document.getElementById("Category");
			if(obj){
		    	obj.innerHTML=menu;
		    }
		   
		xmlhttp = null;	
	}
}
function updateOpen(form){
	if(checkItemNum(form) == 0) {
		alert(" 선택하신 항목이 없습니다. ");
		return;
	}

	if(confirm("선택된 글의 공개설정을 변경 하시겠습니까?")){
		var obj = getForm(form);
		loadXMLDoc("POST","/_blog/contentStmtPopUpdate.ajax",obj,"UopenCallback","CommentFail");
	}
}
function UopenCallback(xmlhttp){
		xmlhttp= null;
		goPage(1);
}
function alertBeforeDelete(form){
	if(checkItemNum(form) == 0) {
		alert(" 선택하신 항목이 없습니다. ");
		return;
	}

	if(confirm("선택하신 글을 삭제하시겠습니까?\r\n글을 삭제하시면 댓글과 엮인글도 함께 삭제됩니다.")){
		var param = new Object();
		param.blogid=form.blogid.value;
		var obj = getForm(form);
		loadXMLDocWithParam("POST","/_blog/contentStmtDelete.ajax",obj,"UcateCallback","CommentFail",param);
	}
}
function removeTemp(form){
	if(checkItemNum(form) == 0) {
		alert(" 선택하신 항목이 없습니다. ");
		return;
	}
	if(confirm("선택하신 임시저장 글을 삭제하시겠습니까?")){
		var param = new Object();
		param.blogid=form.blogid.value;
		var obj = getForm(form);
		loadXMLDocWithParam("POST","/_blog/ArticleTempDel.ajax",obj,"UcateCallback","CommentFail",param);
	}
}

var disappearNewsArticleGuideDiv = false;
function setOpenOpt(blogid, sOpenDivName, sArticleno, sOpenKind, newsarticleid, ismappost) {
	disappearNewsArticleGuideDiv = false;
	if(newsarticleid > 0 && sOpenKind != "B0301"){
		if(!confirm("공개 설정을 전체 공개로 하지 않으시면 Daum view에 송고된 글이 삭제됩니다. 계속하시겠습니까?")){
			return;
		}
		disappearNewsArticleGuideDiv = true;
	}else if(ismappost == "Y" && sOpenKind != "B0301"){
		if(!confirm("공개 설정을 전체 공개로 하지 않으시면 Daum 지도에 포스트 된것이 삭제됩니다. 계속하시겠습니까?")){
			return;
		}
	}
	
	var param = new Object();
	param.blogid=blogid;
	param.divName=sOpenDivName;
	param.openKind=sOpenKind;
	var data = "blogid="+blogid;
	data += "&itemBox="+sArticleno+">"+sOpenKind+">0";
	data += "&type=1";
	data += "&articleOpen="+sOpenKind;
	
	loadXMLDocWithParam("POST","/_blog/popupConfigChange.ajax",data,"OpenOptSuccess","OpenOptFail",param);}

function CommentFail(){
	loadedDynamicContent[loadedDynamicContent.length]=null;
}

function OpenOptSuccess(xmlhttp, obj) {
	var oDiv = document.getElementById(obj.divName);
	if( obj.openKind == "B0301" ) {
		oDiv.innerHTML = "공개";
	} else if( obj.openKind == "B0302" ) {
		oDiv.innerHTML = '친구 블로그';
	} else if( obj.openKind == "B0303" ) {
		oDiv.innerHTML = '비공개';
	}
	
	if(disappearNewsArticleGuideDiv){
		document.getElementById("div_news_article_guide").style.display = "none";
		document.getElementById("div_news_article_image").style.display = "none";
	}
	xmlhttp = null;
}

function OpenOptFail(){
	alert('공개 여부 설정중 오류가 발생하였습니다.');
}
//Global BLOGID, BLOGNAME

//Article Contents Iframe View
var ContentViewer = {
	initViewer: function(iArticleStyle) {
		this.aLoadedDoc = [];
		this.aContents = {};
		this.iArticleStyle = iArticleStyle;
		
		this.sBodyTags = "<script type=\"text/javascript\" language=\"javascript\" src=\"" + iArticleStyle.sViewJs + "\"><\/script>";
	},
	movePage: function() {
		if(typeof(BgmPlayManager) != 'undefined') {
			BgmPlayManager.movePage();
		}
		try {
			for(var s=0; s<this.aLoadedDoc.length; s++) {
				this.aLoadedDoc[s].body.innerHTML = "";
			}
			this.aLoadedDoc.length = 0;
		} catch(e) {}
		
	},
	setParameter_frame: function(sContentId,sDocInx) {
		var oFrameDoc = document.getElementById("if_" + sContentId).contentWindow.document;
		if(oFrameDoc) {
			this.aContents[sContentId] = { //For Js Parsing Sync & Frame Resize
				sContentId: sContentId,
				oFrameDoc: oFrameDoc,
				aScript: null,
				nScriptInx: 0,
				sDocInx: sDocInx,
				nDocHeight: 0,
				nResizeNum: 0,
				nConfirmNum: 0,
				nResizeImageNum: 0,
				isWorking: false
			};
		}
		this.aLoadedDoc.push(oFrameDoc);
	},
	drawContent: function(sContentId, sDocInx, reCall) {
		var oFrameDoc = document.getElementById("if_" + sContentId).contentWindow.document;
		if (oFrameDoc) {
			this.setParameter_frame(sContentId, sDocInx);
			if(is_ie) { 
				var sContent = document.getElementById("pa_" + sContentId).innerHTML;
				if( sContent.length == 0 ) {
					if( reCall == 'undefined' || reCall == null || reCall < 100) {
						if( reCall == 'undefined' || reCall == null ) {
							reCall = 0 ;
						}
						reCall = reCall+1;
						setTimeout("ContentViewer.drawContent('" + sContentId + "', '" + sDocInx + "', "+reCall+")", 100); // 다시 시도
						return;
					}
				}
				
				sContent = sContent.replace(/<textarea style="display:none" start>/g,"");
				sContent = sContent.replace(/<\/textarea end>/g,"");

				sContent = "<s"+"cript></s"+"cript>" + sContent;
				sContent = sContent.split("<SCRIPT").join("<pre class=\"scripts\"").split("</SCRIPT").join("</pre");
				sContent = sContent.split("<script").join("<pre class=\"scripts\"").split("</script").join("</pre");
				
				var appendHTML = sContent + "<div style=\"clear:both;\"></div><script type=\"text/javascript\">parent.ContentViewer.parseScript('" + sContentId + "');<\/script>";
				oFrameDoc.body.insertAdjacentHTML("afterBegin", appendHTML);
				//ContentViewer.parseScript(sContentId);
				//scriptParse(oFrameDoc.body);
				
				setTimeout(function() { ContentViewer.confirmResize.apply(ContentViewer, [sContentId]); }, 1); //혹시나 리사이즈 안되었을까봐..
 
				//this.fDocWrite = oFrameDoc.write;
			} else {
				var oXml = document.getElementById("pa_" + sContentId);
				var sContent = "";
				if( oXml.childNodes.length < 2 ) {
					if( reCall == 'undefined' || reCall == null || reCall < 100) {
						if( reCall == 'undefined' || reCall == null ) {
							reCall = 0 ;
						}
						reCall = reCall+1;
						setTimeout("ContentViewer.drawContent('" + sContentId + "', '" + sDocInx + "', "+reCall+")", 100); // 다시 시도
						return;
					}
				}
				var aContents = oXml.childNodes[1].childNodes;
				var nContLen = aContents.length;
				for(var k=0; k<nContLen; k++) {
					sContent += aContents[k].nodeValue;
				}
				
				//var appendHTML = sContent + "<script type=\"text/javascript\">setTimeout(function(){parent.ContentViewer.sizeFrame('" + sContentId + "','999');}, 0);<\/script>";
				var appendHTML = sContent + "<div style=\"clear:both;\"></div><script type=\"text/javascript\">parent.ContentViewer.sizeFrame('" + sContentId + "','999');<\/script>";
				
				var r = oFrameDoc.body.ownerDocument.createRange();
				r.setStartBefore(oFrameDoc.body);
				var f = r.createContextualFragment(appendHTML);
				oFrameDoc.body.appendChild(f);
				if(is_safari){ // when browser is safari 
					var func = document.getElementById("if_" + sContentId).contentWindow.scriptParseBody;
					setTimeout(func,500);
				}
				//scriptParse(oFrameDoc.body);
				
			}
		}
	},
	parseScript: function(sContentId) {
		var iContent = this.aContents[sContentId];
		if(iContent == null) return;
		if(iContent.aScript == null) {
			iContent.isWorking = true;
			var aScript = new Array();
			var aDescendants = iContent.oFrameDoc.body.getElementsByTagName("pre");
			for(var i=0; i<aDescendants.length; i++) {
				if(aDescendants[i].className == "scripts") {
					aScript.push(aDescendants[i]);
				}
			}
			iContent.aScript = aScript;
		}

		if(iContent.nScriptInx >= iContent.aScript.length) {
			ContentViewer.sizeFrame(sContentId, iContent.sDocInx);
			return;
		}

		var oWrapDiv = iContent.oFrameDoc.createElement("DIV");
		iContent.oFrameDoc.write = function(str){
			oWrapDiv.innerHTML += str;
		};
		
		var oScript = iContent.aScript[iContent.nScriptInx];
		var oDynamic = iContent.oFrameDoc.createElement("SCRIPT");
		if(oScript.src && oScript.src.length > 0) {
			if(oScript.src.indexOf("http://") < 0) { //절대경로아니면...
				oDynamic = null;
				iContent.nScriptInx++;
				ContentViewer.parseScript(sContentId);
			} else {
				try {
					oDynamic.onreadystatechange = function() {
						if(this.readyState == "loaded") {
							iContent.oFrameDoc.write = ContentViewer.fDocWrite;
							if(oScript.parentNode) {
								oScript.parentNode.replaceChild(oWrapDiv, oScript);// ??? why
							}
							oDynamic.onreadystatechange = null;
							iContent.nScriptInx++;
							ContentViewer.parseScript(sContentId);
						}
					};
					oDynamic.type = "text/javascript";
					oScript.parentNode.insertBefore(oDynamic, oScript);
					oDynamic.src = oScript.src;
				} catch(e) {
					oDynamic = null;
					iContent.nScriptInx++;
					ContentViewer.parseScript(sContentId);
				}
			}
		} else {
			try {
				oDynamic.onreadystatechange = function() {
					if(this.readyState == "complete") {  
						iContent.oFrameDoc.write = ContentViewer.fDocWrite;
						if(oScript.parentNode) {
							oScript.parentNode.replaceChild(oWrapDiv, oScript);// ??? why
						}
						oDynamic.onreadystatechange = null;
						iContent.nScriptInx++;
						ContentViewer.parseScript(sContentId);
					}
				};
				oDynamic.type = "text/javascript";
				oScript.parentNode.insertBefore(oDynamic, oScript);
				
				oDynamic.text = getScriptText(oScript);
			} catch(e) {
				oDynamic = null;
				iContent.nScriptInx++;
				ContentViewer.parseScript(sContentId);
			}
		}
	},
	sizeFrame: function(sContentId, sDocInx) {
		this.resizeImage(sContentId); //컨텐츠 이미지 리사이징
		this.resizeFrame(sContentId);
		this.redefineLink(sContentId);
		if(is_ie && sDocInx != "999") { //배경음악
			this.redefineBgm(sContentId, sDocInx);
		}
	},
	resizeFrame: function(sContentId) {
		var iContent = this.aContents[sContentId];
		if(iContent == null) return;

		if(iContent.oFrameDoc == null) {
			ContentViewer.aContents[sContentId] = null;
		}
		try{
			var nFrameHeight = 0;
			if( iContent != null && typeof(iContent) != 'undefined' &&
				iContent.oFrameDoc != null && typeof(iContent.oFrameDoc) != 'undefined' &&
				iContent.oFrameDoc.body != null && typeof(iContent.oFrameDoc.body) != 'undefined' ) {
				if(is_ie){
					nFrameHeight = iContent.oFrameDoc.body.scrollHeight;
				}
				else{
					nFrameHeight = iContent.oFrameDoc.body.offsetHeight;
					if(iContent.oFrameDoc.body.scrollHeight > iContent.oFrameDoc.body.offsetHeight){
						nFrameHeight = iContent.oFrameDoc.body.scrollHeight
					}
				}
			} else {
				return;
			}
		}catch(e){
			return;
		}		
		
		if(iContent.nResizeNum > 20)  return; //10번이상 돌리지마라 height:100% 경우
		
		if(iContent.nDocHeight == nFrameHeight && iContent.nDocHeight > 0) {
			if( iContent.nConfirmNum > 2 ) {
				// may be load complete
				//oDebug.innerHTML += "may be complete : ["+sContentId+"]["+iContent.nConfirmNum+"]["+iContent.nResizeNum+"]<br />\n";
				ContentViewer.aContents[sContentId] = null;
			} else {
				//oDebug.innerHTML += "retry complete size : ["+sContentId+"]["+iContent.nConfirmNum+"]["+iContent.nResizeNum+"]<br />\n";
				iContent.nConfirmNum++;
				setTimeout("ContentViewer.resizeFrame('" + sContentId + "')", 1000);
			}
		} else {
			iContent.nConfirmNum = 0;
			var oFrame = document.getElementById("if_" + sContentId);
			if( oFrame != null && typeof(oFrame) != 'undefined'){
				oFrame.style.height = nFrameHeight + "px";
				iContent.nDocHeight = nFrameHeight;
				iContent.nResizeNum++;
				setTimeout("ContentViewer.resizeFrame('" + sContentId + "')", 1000); //컨텐츠 이미지 리사이징
			}
		}
	},
	resizeImage: function(sContentId) {
		/* 컨텐츠 이미지 리사이징  <- util.js */
		try{
			if(document.getElementById("if_" + sContentId)){
				var oFrameDoc = document.getElementById("if_" + sContentId).contentWindow.document;
				var aImage = oFrameDoc.getElementsByTagName("img");
				
				var iContent = this.aContents[sContentId];
				var resizeRecall = false;
				for(var i=0; i<aImage.length; i++){
					if(aImage[i].offsetWidth < sContentWidth && iContent != null && iContent.nResizeImageNum < 5){
						resizeRecall = true;
					}
					
					if(aImage[i].src.indexOf("http://blogimg.daum-img.net/") > -1 || aImage[i].src.indexOf("http://pimg.daum-img.net/") > -1 || aImage[i].src.indexOf("http://cafeimg.daum-img.net") > -1) {
					} else {
						if (aImage[i].className == "tx-daum-image") { //NOTE: inserted by daum editor
							var _imageWidth = aImage[i].style.width || aImage[i].width;
							var _actualWidth = aImage[i].getAttribute("actualwidth");
							if (_imageWidth) {
								if (aImage[i].offsetWidth > sContentWidth) {
									aImage[i].style.width = (sContentWidth) + 'px';
								}
							} else {
								var realWidth = aImage[i].offsetWidth;
								var realHeight = aImage[i].offsetHeight;
								if( _actualWidth < sContentWidth ) {
									aImage[i].style.width = _actualWidth + 'px';
									aImage[i].style.height = (realHeight * _actualWidth)/realWidth + 'px';
								} else {
									aImage[i].style.width = (sContentWidth) + 'px';
									aImage[i].style.height = (realHeight * (sContentWidth))/realWidth + 'px';
								}
							}
							var setOnclick = false;
							if (!aImage[i].getAttribute("isset")) {
								setOnclick = true;
							}else if(iContent.nResizeImageNum == 0){	// 게시글을 바로 복사해서 붙여넣기로 글을 등록했을때에 해당 그림을 클릭할 수 있도록 
								setOnclick = true;
							}
							if(setOnclick){
								aImage[i].setAttribute("isset", "true");
								if(!aImage[i].getAttribute("popup") || aImage[i].getAttribute("popup") != "no") {
									aImage[i].style.cursor = "pointer";
									aImage[i].onclick = function(){
										realImgView(this.src.replace("/image/", "/original/"));
									};
								}
							}
						} else {
							if (aImage[i].offsetWidth > sContentWidth - 5) {
								aImage[i].style.width = (sContentWidth - 5) + 'px';
							}
//							찬찬히 살펴보자							
//							var realWidth = aImage[i].offsetWidth;
//							var realHeight = aImage[i].offsetHeight;
//							if( _actualWidth < sContentWidth ) {
//								aImage[i].style.width = _actualWidth + 'px';
//								aImage[i].style.height = (realHeight * _actualWidth)/realWidth + 'px';
//							} else {
//								aImage[i].style.width = (sContentWidth) + 'px';
//								aImage[i].style.height = (realHeight * (sContentWidth))/realWidth + 'px';
//							}
						}
					}
				}
			}
						
			if(resizeRecall){
				iContent.nResizeImageNum++;
				setTimeout("ContentViewer.resizeImage('" + sContentId + "')", 1000); //컨텐츠 이미지 리사이징
			}
		}catch(e){}
	},
	redefineLink: function(sContentId) {
		var oFrameDoc = document.getElementById("if_" + sContentId).contentWindow.document;
		
		var _search_new_url = "http://search.daum.net/search?w=tot&q=";
		var _search_old_url = "http://search.daum.net/cgi-bin/nsp/search.cgi?q=";
		var redefineLinkHandler = function(elLink, useTargetBoundary) {
			var sLinkUrl = elLink.getAttribute("href");
			if (!sLinkUrl) {
				return;
			} 
			if (sLinkUrl.indexOf("javascript") > -1 || sLinkUrl.indexOf("#footnote_link_") > -1) {
				return;
			}
			if (elLink.id && elLink.id.indexOf("footnote_") > -1) {
				return;
			}
			if (is_ie&& !is_ie7) { //IE6 search encoding
				var sQuery = null;
				if(sLinkUrl.indexOf(_search_new_url) > -1) {
					sQuery = sLinkUrl.substring(_search_new_url.length);
				} else if(sLinkUrl.indexOf(_search_old_url) > -1) {
					sQuery = sLinkUrl.substring(_search_old_url.length);
				}
				if(sQuery) {
					elLink.setAttribute("href", _search_new_url + encodeURIComponent(sQuery.replace(/\(.+\)/g, "").replace(/\+/g, " ")));
				}
			}
			var sLinkTarget = elLink.getAttribute("target");
			if(sLinkTarget) {
				if(sLinkTarget.indexOf("_top") > -1) {
					return;
				}
				if(sLinkTarget.indexOf("_parent") > -1) {
					elLink.setAttribute("target", "_top");
					return;
				}
			}
			if(useTargetBoundary && sLinkUrl.indexOf("blog.daum.net") > -1) {
				elLink.setAttribute("target", "_parent");
			} else {
				elLink.setAttribute("target", "_blank");
			}
		};
		
		var aLinks = oFrameDoc.getElementsByTagName("a");
		for(var i=0; i<aLinks.length; i++) {
			redefineLinkHandler(aLinks[i], false);
		}
		aLinks = oFrameDoc.getElementsByTagName("area");
		for(var i=0; i<aLinks.length; i++) {
			redefineLinkHandler(aLinks[i], true);
		}
	},
	redefineBgm: function(sContentId, sDocInx) { 
		var oFrameDoc = document.getElementById("if_" + sContentId).contentWindow.document;
		var aBgmImgs = oFrameDoc.getElementsByName("abgmact");
		if(aBgmImgs != null) {
			for(var i=0; i<aBgmImgs.length; i++){
				var fClick = aBgmImgs[i].getAttributeNode("onclick");
				if(fClick != null && fClick.nodeValue != null) {
					var sClick = fClick.nodeValue.split("@FRAME@").join("if_" + sContentId).split("parent.").join("");
					aBgmImgs[i].onclick = new Function(sClick);
					if((sDocInx == "" || sDocInx == "0") && (i == 0)) { //첫번째글의 sDocInx 0, ''일때만 자동 재생
						aBgmImgs[i].className = 'playerOff';
						aBgmImgs[i].onclick = new Function('ArticleBgm.stop()');
						setTimeout("eval(" + sClick + ")", 100); // 다시 시도
//						eval(sClick);
					}
					else{
						aBgmImgs[i].className = 'playerOn';
					}
				}
			}
		}
	},
	confirmResize: function(sContentId) {
		var iContent = this.aContents[sContentId];
		if(iContent == null) return;
		if(iContent.isWorking) return;

		iContent.oFrameDoc.body.onload = function() { return false; };
		this.parseScript(sContentId);
	}, 
	articleFileViewGeneration: function(sContentId) {
		//첨부파일화된 본문에서 파일미리보기 지원 koyoungmin
		try{			
			var articleno = sContentId.substring(2,sContentId.length);			
			var oFrameDoc = document.getElementById("if_" + sContentId).contentWindow.document;
			var aLinks = oFrameDoc.getElementsByTagName("a");

			if(document.getElementById("if_" + sContentId)){
				for(var i=0; i < aLinks.length; i++) {

					var aLinkString = aLinks[i].innerHTML;
					var aLinkStringLow = aLinkString.toLowerCase();
					
					// 본문에 첨부아이콘 중앙에 위치시키기 
					if (aLinkStringLow.indexOf("http://blogimg.daum-img.net/") > -1 
							|| aLinkStringLow.indexOf("http://pimg.daum-img.net/") > -1
							|| aLinkStringLow.indexOf("http://icon.daum-img.net") > -1) {

						oFrameDoc.getElementsByTagName("a")[i].setAttribute("target", "");
						
						if (oFrameDoc.getElementsByTagName("a")[i].parentNode.getElementsByTagName("img").length > 0) {
							oFrameDoc.getElementsByTagName("a")[i].parentNode.getElementsByTagName("img")[0].style.verticalAlign="middle";
						}
					}

					// 진본 파일 URL을 가져옵니다.
					var orgFileUrl = oFrameDoc.getElementsByTagName("a")[i].getAttributeNode("href").nodeValue;

					if (aLinkStringLow.indexOf("p_jpg_s.gif") > -1 || aLinkStringLow.indexOf("p_gif_s.gif") > -1 
							|| aLinkStringLow.indexOf("p_png_s.gif") > -1 ) {
//						alert ("img :"+aLinkString +"::"+BLOGID +"::"+orgFileUrl);
						var aLinkAdd =oFrameDoc.getElementsByTagName("a")[i].parentNode.innerHTML 
									+" <img src=\"http://cafeimg.hanmail.net/cf_img2/bbs2/btn_imageview.gif\" alt=\"첨부이미지 미리보기\" style=\"vertical-align:middle;cursor:pointer;\" onclick=\"PhotoImagePopup('"+BLOGID+"', '"+orgFileUrl+"');\">";					
						oFrameDoc.getElementsByTagName("a")[i].parentNode.innerHTML =aLinkAdd;
					} 
					// 첨부된 파일은 파일 미리 보기 등록 
					else if(aLinkStringLow.indexOf(".ppt<") > -1 || aLinkStringLow.indexOf(".doc<") > -1 
							 || aLinkStringLow.indexOf(".xls<") > -1 || aLinkStringLow.indexOf(".pptx<") > -1 
							 || aLinkStringLow.indexOf(".docx<") > -1  || aLinkStringLow.indexOf(".xlsx<") > -1
							 || aLinkStringLow.indexOf(".hwp<") > -1) {
//						alert ("doc :"+aLinkString +"::"+BLOGID +"::"+orgFileName);
						
						if (orgFileUrl.indexOf(".daum.net") > -1) {		// onlyDaumService
							oFrameDoc.getElementsByTagName("a")[i].setAttribute("href", "javascript:fileFilterViewer_dc('"+orgFileUrl+"','"+orgFileUrl+"','','"+BLOGID+"','"+articleno+"');");
							oFrameDoc.getElementsByTagName("a")[i].setAttribute("class", "p11");
						}						
					} 
				}
			}
		} 
		catch(e){ }
	}
}

function getScriptText(oScript) {
	if(oScript == null) return "";
	var aContents = new Array();
	var oChilds = oScript.childNodes;
	var nChildLen = oChilds.length;
	for(var j=0; j<nChildLen; j++) {
		if(oChilds[j].nodeType == 3) { //Element
			aContents.push(oChilds[j].nodeValue);
		} else {
			aContents.push(oChilds[j].outerHTML.replace(/\n/,"").replace(/\r/,""));
		}
	}
	return aContents.join("");
}


/* Layer Show/Hide */
function showSubLayer(sTarget) {
	var oArea = document.getElementById(sTarget+'Area');
	if(oArea == null) return;
	var oIcon = document.getElementById(sTarget+'Icon');
	if(oArea.style.display != 'none') {
		oArea.style.display = 'none';
		oIcon.className = 'alimListPlus';
	} else {
		oArea.style.display = 'block';
		oIcon.className = 'alimListMinus';
	}
}

function togglePlusMinus(sTarget) {
	var	oImage = document.getElementById(sTarget+'Icon');
	
	if( oImage.src == "http://pimg.daum-img.net/blog3/ic_plus.gif" ) {
		document.getElementById(sTarget+'Area').style.display = 'block';
		oImage.src = "http://pimg.daum-img.net/blog3/ic_minus.gif" ;
	} else {
		document.getElementById(sTarget+'Area').style.display = 'none';
		oImage.src = "http://pimg.daum-img.net/blog3/ic_plus.gif" ;
	}
}

function showPostLayer(oAnchor, sCntsId, event) {
	var oResultDiv = document.getElementById('resultarea');
	oResultDiv.innerHTML = (document.getElementById(sCntsId)? document.getElementById(sCntsId).innerHTML : "");
	
	if(oAnchor == null) return;
	var position = getPosition(oAnchor);
	var nAncX = position.x;
	var nAncY = position.y;
	var nAncWidth = oAnchor.offsetWidth;
	var nAncHeight = oAnchor.offsetHeight;

	var nDocX =  (document.documentElement.clientWidth || document.body.clientWidth);
	var nDocY = (document.documentElement.scrollHeight || document.body.scrollHeight);

	var oDashBoard = document.getElementById("dashboard");
	oDashBoard.style.display = "block";


	var nDashX = nAncX;
	var nDashY = nAncY;
	var nCntsHeight = oResultDiv.offsetHeight;
	var oResultBox = document.getElementById('resultBox');
	if(nAncX > nDocX/2) { //right
		nDashX -= 309 + 3;
		if(nAncY > nDocY - 200) { //예상 bot
			nDashY -= nCntsHeight + Math.ceil(nAncHeight/2);
			oResultBox.className = "rightbot";
		} else { //top
			nDashY += Math.ceil(nAncHeight/2);
			oResultBox.className = "righttop";
		}
	} else { //left
		nDashX += nAncWidth + 3;
		if(nAncY > nDocY - 200) { //예상 bot
			nDashY -= nCntsHeight + Math.ceil(nAncHeight/2);
			oResultBox.className = "leftbot";
		} else { //top
			nDashY += Math.ceil(nAncHeight/2);
			oResultBox.className = "lefttop";
		}
	}
	
	oDashBoard.style.left = (nDashX) + "px";
	oDashBoard.style.top = (nDashY) + "px";
}
	
function showDashBoard(){
	var obj = document.getElementById("dashboard");
	obj.style.display="block";
	viewLayer = true;
}

function hideDashBoard(){
	var obj = document.getElementById("dashboard");
	obj.style.display="none";
	viewLayer = false;
}

/****************** 메인타이틀 높이 계산 *****************************************************************/
function getStyle(oLayer, sStyle) {
	var sValue = null;
	if (document.defaultView && document.defaultView.getComputedStyle) {
		var oCss = document.defaultView.getComputedStyle(oLayer, null);
		sValue = oCss ? oCss[sStyle] : null;
	} else if (oLayer.currentStyle) {
		sValue = oLayer.currentStyle[sStyle];
	}
	return sValue;
}
function setMainTitleHeight() {

	var oMainTitle = document.getElementById("mainTitle");
	var nDocHeight = getStyle(oMainTitle, "height");
	if(nDocHeight != null) {
		if(is_nav && nDocHeight != "79px") { //FF
			return;
		} else if(!is_nav && nDocHeight.indexOf("px") > -1) {
			return;
		}
	}

	var sBackImage;
	if(is_ie && !is_ie7) { //IE6 why filter
		sBackImage = getStyle(oMainTitle, "filter");
		if(sBackImage == null || sBackImage.length < 5) { //기본높이
			oMainTitle.style.height = "107px"; 
			return;
		} 
		sBackImage = sBackImage.substring(sBackImage.indexOf("src='")+5);
		if(sBackImage.indexOf("\'") > -1) {
			sBackImage = sBackImage.substring(0, sBackImage.indexOf("\'"));
		}
		
	} else {
		sBackImage = getStyle(oMainTitle, "backgroundImage");
		if(sBackImage == null || sBackImage.length < 5) { //기본높이
			oMainTitle.style.height = "107px"; 
			return;
		} 
		sBackImage = sBackImage.substring(4, sBackImage.length-1);
		if(sBackImage.indexOf("\"") > -1) {
			sBackImage = sBackImage.substring(1, sBackImage.length-1);
		}
	}
	var oTmpImg = new Image();
	if(is_ie) {
		oTmpImg.onreadystatechange = function() {
			if(this.readyState == "complete") {
				oMainTitle.style.height = this.height + "px"; 
				oTmpImg = null;
			}
		}
	} else {
		oTmpImg.onload= function () { 
			oMainTitle.style.height = this.height + "px"; 
			oTmpImg = null;
		}
	}
	oTmpImg.src = sBackImage;
}


/***************** Navi, Menu *******************************************************************/
/***************** Menu Fold *****************************************************************/
function foldMenuBoxTitle(targetId){
	foldMenuBox(document.getElementById(targetId));
}
function foldMenuBox(oFlodBtn){
	var sFoldCss = oFlodBtn.className;
	var oMenuBody = oFlodBtn.parentNode;
	while((oMenuBody = oMenuBody.nextSibling)) {
		if(oMenuBody.className && oMenuBody.className == "menuBody") {
			if(sFoldCss == "arrowdown") {
				oMenuBody.style.display = "block";
			} else {
				oMenuBody.style.display = "none";
			}
		} else if(oMenuBody.className && oMenuBody.className.indexOf("menuFooter") > -1) {
			if(sFoldCss == "arrowdown") {
				oMenuBody.style.display = "block";
			} else {
				oMenuBody.style.display = "none";
			}
		} 
	}
	if(sFoldCss == "arrowdown") {
		oFlodBtn.className = "arrowup";
	} else {
		oFlodBtn.className = "arrowdown";
	}
}

function folderToggle(sGrpId) {
	var aGrpUl = document.getElementById("folderGrp_"+sGrpId);
	var oArrowInput = document.getElementById("arrow_"+sGrpId);
	if( aGrpUl !=  null && oArrowInput != null ) {
		if( aGrpUl.style.display != "none" ) {
			aGrpUl.style.display = "none" ;
			oArrowInput.className = "arrowdown sideListClr";
		} else {
			aGrpUl.style.display = "block" ;
			oArrowInput.className = "arrowup sideListClr";
		}
	}
}

/***************** Image Size *****************************************************************/
function myconImgResize (img) {
	img.style.display = "none";
	if (img.width > 20) {
		img.width = 20;
		if (img.height > 21) {
			img.height = 21;
		}
	}
	img.style.display = "";
}

function LoadPhotoSlideImage(listWidth, listHeight, imgNode, src, exif) {
	var oTmpImg = new Image();
	if( is_ie ) {
		oTmpImg.onreadystatechange = function() {
			if(this.readyState == "complete") {
				width = this.width;
				height = this.height;
				if( width < listWidth && height < listHeight ) {
				} else {
					heightEst = listHeight;
					widthEst = listHeight*(width/height);
					if( widthEst > listWidth) {
						widthEst = listWidth;
						heightEst = listWidth*(height/width);
					}
					imgNode.height = heightEst;
					imgNode.width = widthEst;
				}
				imgNode.src = src;
				oTmpImg = null;
			}
		}
	} else {
		oTmpImg.onload = function() {
			width = this.width;
			height = this.height;
			if( width < listWidth && height < listHeight ) {
			} else {
				heightEst = listHeight;
				widthEst = listHeight*(width/height);
				if( widthEst > listWidth) {
					widthEst = listWidth;
					heightEst = listWidth*(height/width);
				}
				imgNode.height = heightEst;
				imgNode.width = widthEst;
			}
			imgNode.src = src;
			oTmpImg = null;
		}
	}
	oTmpImg.src = src;
	if( document.getElementById('pvframe') != null ) {
		document.getElementById('pvframe').src="/photoslide.html?type=photolist&src="+src;
	}
	if(exif != null && exif != "") {
		loadXMLDoc("GET", exif, null,"loadImageExif","failImgeExif", true);
	}
}

function LoadFixHeightImage(listWidth, listHeight, imgNode, src) {
	var oTmpImg = new Image();
	oTmpImg.onreadystatechange = function() {
		if(this.readyState == "complete") {
			var widthEst, heightEst;
			var width = this.width;
			var height = this.height;
			if( width < listWidth && height < listHeight ) {
			} else {
				heightEst = listHeight;
				widthEst = listHeight*(width/height);
				if( widthEst > listWidth) {
					widthEst = listWidth;
					heightEst = listWidth*(height/width);
				}
				imgNode.height = heightEst;
				imgNode.width = widthEst;
			}
			oTmpImg = null;
		}
	}
	oTmpImg.src = src;
}

/******************* 최근글 ************************************************************/
function loadRecentImage(listWidth, listHeight, imgNode, src) {
	var oTmpImg = new Image();
	if(is_ie) {
		oTmpImg.onreadystatechange = function() {
			if(this.readyState == "complete") {
				var widthEst, heightEst;
				var width = this.width;
				var height = this.height;
				if( width < listWidth && height < listHeight ) {
				} else if( width < height) {
					heightEst = listHeight;
					widthEst = listHeight*(width/height);
					imgNode.height = heightEst;
					imgNode.width = widthEst;
				} else {
					widthEst = listWidth;
					heightEst = listWidth*(height/width);
					imgNode.height = heightEst;
					imgNode.width = widthEst;
				}
				oTmpImg = null;
			}
		}
	} else {
		oTmpImg.onload = function() {
			var widthEst, heightEst;
			var width = this.width;
			var height = this.height;
			if( width < listWidth && height < listHeight ) {
			} else if( width < height) {
				heightEst = listHeight;
				widthEst = listHeight*(width/height);
				imgNode.height = heightEst;
				imgNode.width = widthEst;
			} else {
				widthEst = listWidth;
				heightEst = listWidth*(height/width);
				imgNode.height = heightEst;
				imgNode.width = widthEst;
			}
			oTmpImg = null;
		}
	}
	oTmpImg.src = src;
}

var thumbnum = 0;
var selthumbno = 0;
var isthumbovered = false;
function initRecentThumbnail(maxnum) {
	thumbnum = maxnum-1;
	showRecentRandomThumbnail();
}

function hideRecentThumbnail() {
	var dis_div = 'recent_thumb_' + selthumbno;
	if(document.getElementById(dis_div)) {
		document.getElementById(dis_div).style.display = 'none';
	}
}

function showRecentThumbnail() {
	var dis_div = 'recent_thumb_' + selthumbno;
	if(document.getElementById(dis_div)) {
		document.getElementById(dis_div).style.display = 'block';
	}
}

function showRecentRandomThumbnail() {
	if(isthumbovered) return;
	hideRecentThumbnail();
	try {
		selthumbno = Math.round(Math.random() * (thumbnum));
	}catch(e){
		selthumbno = 0;
	}
	showRecentThumbnail();
}

function chgRecentThumbnailPre(){
	hideRecentThumbnail();
	if(selthumbno == 0){
		selthumbno = thumbnum;
	} else {
		selthumbno--;
	}
	showRecentThumbnail();
}

function chgRecentThumbnailNext(){
	hideRecentThumbnail();
	if(selthumbno == thumbnum){
		selthumbno = 0;
	} else {
		selthumbno++;
	}
	showRecentThumbnail();
}

/**********************  알리미  ******************************************/
function alarmyFail(){ }

function goAlarmy(blogurl){
	var form = document.alarmyForm;
	form.action = blogurl;
	form.method = "POST";
	form.target = "_blank";
	form.submit();
}

function writeAlarmyNew(oXmlHttp) {
    if ( oXmlHttp ) {
        try{
            var oXmlDoc;
            
			oXmlDoc = getXMLDocument(oXmlHttp);
            var oResultDiv = document.getElementById("cAlim0AreaContent_list");

            var items = oXmlDoc.getElementsByTagName('item');
            var channel = oXmlDoc.getElementsByTagName('channel');
            var webmaster = channel[0].getElementsByTagName('webMaster')[0].firstChild.nodeValue;
            var bloglink = channel[0].getElementsByTagName('link')[0].firstChild.nodeValue;
            var blogtitle = channel[0].getElementsByTagName('title')[0].firstChild.nodeValue;
            var content = new Array();
            var nn = parseInt(getNow());
            var newItem = false;
		    for(var i = 0; i < items.length; i++) {
                var title = items[i].getElementsByTagName('title')[0];
                var title_text_org = title.firstChild.nodeValue;
                var link = items[i].getElementsByTagName('link')[0];
                var imgurl = items[i].getElementsByTagName('enclosure')[0].getAttributeNode("url").nodeValue;
                var link_text = link.firstChild.nodeValue;
                var wdate = items[i].getElementsByTagName('pubDate')[0].firstChild.nodeValue;
                var author = items[i].getElementsByTagName('author')[0].firstChild.nodeValue;
                var desc = items[i].getElementsByTagName('description')[0].firstChild.nodeValue;
            
              	var tag = "";
              	var dts = desc.split("<!--|-->");
         		var ats  = author.split("<!--|-->");
         		tag = dts[0];
         		desc = dts[1];
                var blogtitle = ats[0];
                author = ats[1];
               
                desc=parseAlamyData(desc);
              
                if(author=="null") author="";
                else author+="<br />";
                wn  = parseInt(wdate);
                
                if( (nn-wn) < 10000000) newItem = true;
                wdate = wdate.substring(0,4)+"."+wdate.substring(4,6)+"."+wdate.substring(6,8)+" "+wdate.substring(8,10)+":"+wdate.substring(10,12);
                var title_text = cutStr(title_text_org,20);
				
				var url = "'"+link_text+"'";
                content.push('<li><span class="txt_bul sideListClr">&bull;</span><a style="cursor:pointer;" onclick="goAlarmy('+url+');" target="alarmyArticle" onmouseover="showPostLayer(this, \'rss_'+i+'\',event);" onmouseout="hideDashBoard()" class="sideListClr">'+ title_text + '</a></li>');
                var url = link_text.substring(0, link_text.indexOf("/",7));
                var site_img="noti_i_etc.gif";
                if(url.indexOf(".daum.")>0){ site_img="noti_i_daum.gif";
                }else if(url.indexOf(".naver.")>0){ site_img="noti_i_naver.gif";
                }else if(url.indexOf(".blo.")>0){ site_img="noti_i_blo.gif";
                }else if(url.indexOf(".blogin.")>0){ site_img = "noti_i_blogin.gif";
                }else if(url.indexOf(".empas.")>0){ site_img="noti_i_empas.gif";
                }else if(url.indexOf(".egloos.")>0){ site_img="noti_i_egloos.gif";
                }else if(url.indexOf(".intizen.")>0){ site_img="noti_i_intizen.gif";
                }else if(url.indexOf(".nate.")>0){ site_img="noti_i_nate.gif";
                }else if(url.indexOf(".onblog.")>0){ site_img="noti_i_onblog.gif";
                }else if(url.indexOf(".yahoo.")>0){ site_img="noti_i_yahoo.gif";
                }
                content.push('<div id="rss_'+i+'" style="display:none">');
                content.push('<div class="previewContent">');
                content.push('<img src="http://pimg.daum-img.net/blog/p_img/'+site_img+'" align="middle" alt="" style="margin-bottom:6px;" /> '+blogtitle);
                content.push('<div style="padding-bottom:3px;"><b>'+title_text_org+'</b></div>');
                if(imgurl!="")
                    content.push('<img src="'+imgurl+'" width="110" height="83" align="right" alt="" style="margin:0 0 0 5px;">');
	         	content.push(cutStr(desc,150));
         		content.push(tag);
                content.push("<div style='clear:both; padding-top:4px;' class='p11 g_999'>"+wdate+" - " + author +"</div></div></div>");
            }
            if(newItem){
                aim2 = document.getElementById("alim0new");
                aim2.innerHTML='<img src="http://pimg.daum-img.net/blog/p_img/b_new.gif" alt="" />';
            }
            if(items.length > 0 ){
                oResultDiv.innerHTML = content.join("");
                //showSubLayer('cAlim0');
            }else{
                content.push('<li class="sideListClr">새로운 글이 없습니다.</li>');
                oResultDiv.innerHTML = content.join("");
                //showSubLayer('cAlim1');
            }
        }catch(e){

        }
        oXmlHttp = null;
    }
}

function writeAlarmyCMT(oXmlHttp, fAfter) {
	if ( oXmlHttp ) {
		try{
			var oXmlDoc = getXMLDocument(oXmlHttp);
			
			var oResultDiv = document.getElementById("cAlim2AreaContent_list");
			var items = oXmlDoc.getElementsByTagName('item');
			var channel = oXmlDoc.getElementsByTagName('channel');
			var webmaster = channel[0].getElementsByTagName('webMaster')[0].firstChild.nodeValue;
			var bloglink = channel[0].getElementsByTagName('link')[0].firstChild.nodeValue;
			var blogtitle = channel[0].getElementsByTagName('title')[0].firstChild.nodeValue;
			var content = new Array();
			var nn = parseInt(getNow());
			var newItem = false;

			for(var i = 0; i < items.length; i++) {
				var title = items[i].getElementsByTagName('title')[0];
				var title_text_org = title.firstChild.nodeValue
				var link = items[i].getElementsByTagName('articleno')[0];
				var link_text = link.firstChild.nodeValue;
				var wdate = items[i].getElementsByTagName('pubDate')[0].firstChild.nodeValue;
				var writer = items[i].getElementsByTagName('author')[0].firstChild.nodeValue;
				var desc = items[i].getElementsByTagName('description')[0].firstChild.nodeValue;
				wn  = parseInt(wdate);
				if( (nn-wn) < 10000) newItem = true;
				wdate = wdate.substring(0,4)+"."+wdate.substring(5,7)+"."+wdate.substring(8,10)+" "+wdate.substring(11,13)+":"+wdate.substring(14,16);

				var title_text=title_text_org.replace(/<[\\/\\!]*?[^<>]*?>|&nbsp;/, "");
				var title_text_sum = cutStr(title_text,4);
				var ctype="";
				if(items[i].getElementsByTagName('type')[0].firstChild.nodeValue == "T"){
					ctype="[엮인글]";
				} else if(items[i].getElementsByTagName('type')[0].firstChild.nodeValue == "C") {
					ctype="[댓글]";
				} else if(items[i].getElementsByTagName('type')[0].firstChild.nodeValue == "B"){
					ctype="[방명록]";
				} else {
					ctype="[친구신청]";
				}
				var url;
				if(ctype=="[방명록]"){
					content.push('<li><span class="txt_bul sideListClr">&bull;</span><a href="/_blog/BoardView.do?blogid='+BLOGID+'" target="alarmyArticle" onmouseover="showPostLayer(this, \'rss_my_'+i+'\',event);" onmouseout="hideDashBoard()" class="sideListClr">'+ctype+' '+ title_text_sum + '</a>');
				} else if(ctype=="[댓글]"){
					title_text_sum = cutStr(desc,10);
					url = "'http://blog.daum.net/"+BLOGNAME+"/"+link_text+"'";
					content.push('<li><span class="txt_bul sideListClr">&bull;</span><a style="cursor:pointer;" onclick="goAlarmy('+url+');" target="alarmyArticle" onmouseover="showPostLayer(this, \'rss_my_'+i+'\',event);" onmouseout="hideDashBoard()" class="sideListClr">'+ctype+' '+ title_text_sum + '</a>');
				} else if(ctype=="[엮인글]"){
					title_text_sum = cutStr(writer,10);
					url = "'http://blog.daum.net/"+BLOGNAME+"/"+link_text+"'";
					content.push('<li><span class="txt_bul sideListClr">&bull;</span><a style="cursor:pointer;" onclick="goAlarmy('+url+');"  target="alarmyArticle" onmouseover="showPostLayer(this, \'rss_my_'+i+'\',event);" onmouseout="hideDashBoard()" class="sideListClr">'+ctype+' '+ title_text_sum + '</a>');
				} else {
					title_text_sum = cutStr(writer,8);
					content.push('<li><span class="txt_bul sideListClr">&bull;</span><a href="'+link_text+' " onmouseover="showPostLayer(this, \'rss_my_'+i+'\',event);" onmouseout="hideDashBoard()" class="sideListClr">'+ctype+' '+ title_text_sum + '</a>');
				}
				content.push('<div id="rss_my_'+i+'" style="display:none">');
				content.push('<div class="previewContent">');
				title_text=title_text.replace(/\n/, "<br />");
				content.push('<font class="p11 txt_point1">'+ctype+'</font> '+title_text_org+' <font class="p11"></font><br /> '+desc+' <div style="padding-top:3px;" class="p11 g_666">'+wdate+' - ' +writer+'</div></div></div>');
			}
			if(newItem){
				aim2 = document.getElementById("alim2new");
				aim2.innerHTML=' <img src="http://pimg.daum-img.net/blog/p_img/b_new.gif" alt="" />';
			}
			if(items.length > 0 ){
				content.push("");
				oResultDiv.innerHTML = content.join("");
			}else{
				content.push('<li class="sideListClr">반응이 없습니다.</li>');
				oResultDiv.innerHTML = content.join("");
		  }
		}catch(e){}
		oXmlHttp = null;
		if(fAfter != null && (typeof fAfter == 'function')) {
			fAfter();
		}
	}
}

function parseAlamyData(data){
	data=data.replace(/</g, "&lt;" );
	data=data.replace(/>/g, "&gt;" );
	return data;
}

function getNow(){
	var str="";
	now = new  Date();
	year = now.getYear();
	if(year < 2000) year=year+1900;
	str+=""+year;
	month = now.getMonth()+1;
	day = now.getDate();
	hour= now.getHours();
	min= now.getMinutes();
	sec= now.getSeconds();
	str+=getVa(month);
	str+=getVa(day);
	str+=getVa(hour);
	str+=getVa(min);
	str+=getVa(sec);
	return str;
}

function getVa(val){
  if(val<10)
    return "0"+val;
  else
    return val;
}

/**********************  지난글들  ******************************************/
/* calendar 시작  */
var lastday= new Array(31,28,31,30,31,30,31,31,30,31,30,31);
var lunarInfo=new Array(
	0x4bd8,0x4ae0,0xa570,0x54d5,0xd260,0xd950,0x5554,0x56af,0x9ad0,0x55d2,
	0x4ae0,0xa5b6,0xa4d0,0xd250,0xd295,0xb54f,0xd6a0,0xada2,0x95b0,0x4977,
	0x497f,0xa4b0,0xb4b5,0x6a50,0x6d40,0xab54,0x2b6f,0x9570,0x52f2,0x4970,
	0x6566,0xd4a0,0xea50,0x6a95,0x5adf,0x2b60,0x86e3,0x92ef,0xc8d7,0xc95f,
	0xd4a0,0xd8a6,0xb55f,0x56a0,0xa5b4,0x25df,0x92d0,0xd2b2,0xa950,0xb557,
	0x6ca0,0xb550,0x5355,0x4daf,0xa5b0,0x4573,0x52bf,0xa9a8,0xe950,0x6aa0,
	0xaea6,0xab50,0x4b60,0xaae4,0xa570,0x5260,0xf263,0xd950,0x5b57,0x56a0,
	0x96d0,0x4dd5,0x4ad0,0xa4d0,0xd4d4,0xd250,0xd558,0xb540,0xb6a0,0x95a6,
	0x95bf,0x49b0,0xa974,0xa4b0,0xb27a,0x6a50,0x6d40,0xaf46,0xab60,0x9570,
	0x4af5,0x4970,0x64b0,0x74a3,0xea50,0x6b58,0x5ac0,0xab60,0x96d5,0x92e0,
	0xc960,0xd954,0xd4a0,0xda50,0x7552,0x56a0,0xabb7,0x25d0,0x92d0,0xcab5,
	0xa950,0xb4a0,0xbaa4,0xad50,0x55d9,0x4ba0,0xa5b0,0x5176,0x52bf,0xa930,
	0x7954,0x6aa0,0xad50,0x5b52,0x4b60,0xa6e6,0xa4e0,0xd260,0xea65,0xd530,
	0x5aa0,0x76a3,0x96d0,0x4afb,0x4ad0,0xa4d0,0xd0b6,0xd25f,0xd520,0xdd45,
	0xb5a0,0x56d0,0x55b2,0x49b0,0xa577,0xa4b0,0xaa50,0xb255,0x6d2f,0xada0,
	0x4b63,0x937f,0x49f8,0x4970,0x64b0,0x68a6,0xea5f,0x6b20,0xa6c4,0xaaef,
	0x92e0,0xd2e3,0xc960,0xd557,0xd4a0,0xda50,0x5d55,0x56a0,0xa6d0,0x55d4,
	0x52d0,0xa9b8,0xa950,0xb4a0,0xb6a6,0xad50,0x55a0,0xaba4,0xa5b0,0x52b0,
	0xb273,0x6930,0x7337,0x6aa0,0xad50,0x4b55,0x4b6f,0xa570,0x54e4,0xd260,
	0xe968,0xd520,0xdaa0,0x6aa6,0x56df,0x4ae0,0xa9d4,0xa4d0,0xd150,0xf252,
	0xd520);

function lYearDays(y) {
	var i, sum = 348;
	for(var i=0x8000; i>0x8; i>>=1) sum += (lunarInfo[y-1900] & i)? 1: 0;
	return(sum+leapDays(y));
}

function leapDays(y) {
	if(leapMonth(y)) return( (lunarInfo[y-1899]&0xf)==0xf? 30: 29);
	else return(0);
}

function leapMonth(y) {
	var lm = lunarInfo[y-1900] & 0xf;
	return(lm==0xf?0:lm);
}

function monthDays(y,m) {
	return( (lunarInfo[y-1900] & (0x10000>>m))? 30: 29 );
}

function Lunar(objDate) {
	var i, leap=0, temp=0;
	var offset = (Date.UTC(objDate.getFullYear(),objDate.getMonth(),objDate.getDate()) - ( -2206396800000))/86400000;
	for(i=1900; i<2100 && offset>0; i++) { temp=lYearDays(i); offset-=temp; }
	if(offset<0) { offset+=temp; i--; }
	this.year = i;
	leap = leapMonth(i); //윤몇月
	this.isLeap = false;
	for(i=1; i<13 && offset>0; i++) {
		//윤月
		if(leap>0 && i==(leap+1) && this.isLeap==false) {
			--i; this.isLeap = true; temp = leapDays(this.year);
		}
		else {
			temp = monthDays(this.year, i);
		}

		//解除윤月
		if(this.isLeap==true && i==(leap+1)) {
			this.isLeap = false;
		}
		offset -= temp;
	}

	if(offset==0 && leap>0 && i==leap+1) {
		if(this.isLeap) {
			this.isLeap = false;
		}
		else {
			this.isLeap = true; --i;
		}
	}

	if(offset<0) {
		offset += temp; --i;
	}

	this.month = i;
	this.day = offset + 1;
}

function holiday(month,day,comment,lunar){
	this.month=month;
	this.day=day;
	this.comment=comment;
	this.lunar = lunar;
}

var Holidays = new Array();
Holidays[0] = new holiday(1,1,"신정",false);
Holidays[1] = new holiday(3,1,"삼일절",false);
Holidays[2] = new holiday(5,5,"어린이날",false);
Holidays[3] = new holiday(6,6,"현충일",false);
Holidays[4] = new holiday(7,17,"제헌절",false);
Holidays[5] = new holiday(8,15,"광복절",false);
Holidays[6] = new holiday(10,3,"개천절",false);
Holidays[7] = new holiday(12,25,"크리스마스",false);
Holidays[8] = new holiday(1,1,"설날",true);
Holidays[9] = new holiday(1,2,"설날",true);
Holidays[10] = new holiday(4,8,"부처님오신날",true);
Holidays[11] = new holiday(8,14,"추석" ,true);
Holidays[12] = new holiday(8,15,"추석" ,true);
Holidays[13] = new holiday(8,16,"추석" ,true);

function checkHolyDay(year,month){
	var obj = new Lunar(new Date(year,month,1));
	l_year = obj.year;
	l_month = obj.month;
	var startday =obj.day;
	var l_month_len=monthDays(l_year,l_month);
	var hday = new Array();
	l_day=startday;
	for(i=1 ; i< lastday[month];i++){
		if(l_day > l_month_len){
			if(l_month==12){
				l_month=1;
				l_year++;
			}else{
				l_month++;
			}
			l_day=1;
		}	
		for(h=0;h<Holidays.length;h++){
			var obj = Holidays[h];
			if(month+1==obj.month && i==obj.day && obj.lunar==false ){
				hday[i]=obj;
			}else if(l_month==obj.month && l_day ==obj.day && obj.lunar==true ){
				if(l_month==1 && l_day==1){
					hday[i-1]=obj;
				}hday[i]=obj;
			}
		}
		l_day++;
	}
	return hday;
}

/*
CALENDAR FOR MENU
*/
function drawCalendar(year,month){
	month--;
	var maxday=0;
	if(month !=1){
		maxday = lastday[month];
	}else{
		if(((year % 4==0)) || ( year%400==0) ){
		  maxday=29;
		} else{
		  maxday=28;
		}
	}
	var currday=1;
	var day = new Date(year,month, 1);
	var hday = checkHolyDay(year,month);
	var startday = day.getDay();
	var isHday = false;
	var HdayComment="";
	var today = new Date();
	var today_day = today.getDate();
	var isToday = false;
	if(day.getYear()==today.getYear() && day.getMonth() == today.getMonth()) {
	   isToday=true;
	}
	var cont = new Array();
	cont.push('<table cellspacing="0" cellpadding="0" border="0" id="tab_cal">');
	cont.push('<tr><th class="sideListClr">일</th><th class="sideListClr">월</th><th class="sideListClr">화</th><th class="sideListClr">수</th><th class="sideListClr">목</th><th class="sideListClr">금</th><th class="sideListClr">토</th></tr>');
	for(var i =0 ; i< 6;i++){
		if(i !=0 && currday > maxday) break;
		cont.push('<tr>');
		for(var j=0 ; j < 7 ; j++){
			if(j==0){
		 		isHday = true;
			}
			if( hday[currday] !=null){
				isHday = true;
				HdayComment=hday[currday].comment;
			}
			ubs="";
			ube="";	
			if(i==0 && j < startday || currday > maxday){
				cont.push('<td></td>');
			}else{
				if(isToday && currday == today_day){
					ubs="<font class='under'>";
					ube="</font>";				
				}
				cont.push('<td id="cM'+currday+'" class="sideListClr');
				if(isToday && currday == today_day) {
					cont.push(' under');
				}
				cont.push('" title="'+HdayComment+'">');
				cont.push(''+currday+'');
				cont.push('</td>');
				currday++;
			}
	    	isHday = false;
	    	HdayComment="";
		}
		cont.push('</tr>');
	}
	cont.push('</table>');
	document.getElementById("calendar").innerHTML = cont.join("");
}

function goMonthList(){
	divDisplay('cCal', 'none'); divDisplay('cMCal', 'block');
}

function goDayList(){
	divDisplay('cMCal', 'none'); divDisplay('cCal', 'block');
}

function viewCalendar(s_year, s_month) {
	var arrow_icon = '&nbsp;<img src="http://pimg.daum-img.net/blog3/admin/ic_fulldown_arrow.gif" width="5" height="4" alt="arrow" />';
	if(document.getElementById('calSelYear')){
		document.getElementById('calSelYear').innerHTML = s_year + arrow_icon;
		document.getElementById('calSelMonth').innerHTML = ((s_month<10)?"0":"") + s_month + arrow_icon;
		drawCalendar(s_year,s_month);
	
		var url = "/_blog/hdn/ArticleWriteDayList_V2.do?blogid="+BLOGID+"&date="+s_year+"-"+((s_month<10)?"0":"")+s_month;
	 	loadXMLDoc("GET",url,null,"WriteDayList","alarmyFail", true);
	
		divDisplay('cCal', 'block'); 
		divDisplay('cMCal', 'none');
	}
}

function WriteDayList(oXmlHttp, fAfter) {
	if ( oXmlHttp ) {
		var WriteDayArray = new Array();
		var WriteMonthArray = new Array();
		try{
			var oXmlDoc;
			oXmlDoc = getXMLDocument(oXmlHttp);

			var pubDate = oXmlDoc.getElementsByTagName('pubDate');
			for(var i = 0; i < pubDate.length; i++) {
				WriteDayArray[parseFloat((pubDate[i].firstChild.nodeValue).substring(8,10))]={
					date: pubDate[i].firstChild.nodeValue.substring(0, 10)
				};
			}
			var archive = oXmlDoc.getElementsByTagName('item');
			for(i = 0 ; i < archive.length ; i++){
				WriteMonthArray.push({
					month: archive[i].getElementsByTagName('month')[0].firstChild.nodeValue,
					monthV: archive[i].getElementsByTagName('monthV')[0].firstChild.nodeValue,
					count: archive[i].getElementsByTagName('count')[0].firstChild.nodeValue
				});
			}
		}catch(e){}
		updateCalendar(WriteDayArray);
		drawArchive(WriteMonthArray);
		oXmlHttp = null;
		if(fAfter != null && (typeof fAfter == 'function')) {
			fAfter();
		}
	}
}

function drawArchive(WriteMonthArray) {
	var monthdata = new Array();
	if(WriteMonthArray.length == 0) {
		monthdata.push("<br /><br style='line-height:9px;'><span class='sideListClr'>지난 글들이 아직 없습니다.</span>");
	} else {
		for(var i=0; i<WriteMonthArray.length; i++){
			monthdata.push('<li class="withCount">');
			monthdata.push('<a href="javascript:viewLastDayAjaxArticle(\'/_blog/ArticleLastList.do?blogid='+BLOGID+'&date='+WriteMonthArray[i].month+'\')" class="sideListClr">');
			monthdata.push(WriteMonthArray[i].monthV+'</a>');
			monthdata.push('<span class="p11 sideListClr bold">'+WriteMonthArray[i].count+'</span></li>');
		}		
	}
	var alist = document.getElementById("archivelist");
	alist.innerHTML = monthdata.join("");
}

function updateCalendar(WriteDayArray) {
	var dateBoxs = document.getElementById("calendar").getElementsByTagName("td");
	var boxId, currday, writeDate;
	for(var i =0 ; i< dateBoxs.length;i++){
		boxId = dateBoxs[i].id;
		if(boxId) {
			currday = parseInt(boxId.substring(2));
			if(WriteDayArray[currday]) {
				writeDate = WriteDayArray[currday].date;
				dateBoxs[i].innerHTML = '<a href="javascript:viewLastDayAjaxArticle(\'/_blog/ArticleLastList.do?blogid='+BLOGID+'&date='+writeDate+'&calview='+writeDate+'\')" class="b '+dateBoxs[i].className+'">'+currday+'</a>';
			}
		}
	}
}

function cal_selY(s_year) {
	divDisplay('calYearList', 'none');
	viewCalendar(parseInt(s_year), parseFloat(document.getElementById('calSelMonth').innerHTML));
}

function cal_selM(s_month){
	if(document.getElementById('calSelYear')){
		divDisplay('calMonthList', 'none');
		viewCalendar(parseInt(document.getElementById('calSelYear').innerHTML), parseFloat(s_month));
	}
}

function bookmark(blogname, blogtitle){
	createBookmark('/_blog/bookmark/bookmarkRegisterForm.do', blogname, blogtitle);
}

function createBookmark(action, blogname, blogtitle) {
		var url = action+"?link=" + encodeURIComponent("http://blog.daum.net/" + blogname) + "&title=" + encodeURIComponent(blogtitle);
		var opts = "scrollbars=yes,status=no,toolbar=no,resizable=1,location=no,menu=no,width=530,height=350";
		window.open(url, "bookmark", opts);
}

/****Header***************************************************************************/


function show_div_select(divId){
	document.getElementById(divId).style.visibility = 'visible';
}
function hide_div_select(divId){
	if ( document.getElementById(divId) ){
		document.getElementById(divId).style.visibility = 'hidden';
	}
}

function div_select(value, ahref, id, target){

	document.loop.hidCategory.value = value;
	var temp = ahref.childNodes[0].innerHTML;
	if ( temp.length > 7 ){
		temp = temp.substring(0, 7) + '..';
	}
	document.getElementById(id).innerHTML = temp;
	hide_div_select(target);
}

function realImgView(img) {
	PhotoImagePopup(BLOGID,img);
}

function showList(curObj, targetObj){
	var listUL = document.getElementById(targetObj);
	var articleNo = targetObj.substring(targetObj.indexOf("_")+1,targetObj.length);

	if (document.getElementById("tagname_"+articleNo) != "undefined" 
				&& document.getElementById("tagname_"+articleNo) != null) {
		document.getElementById("tagname_"+articleNo).style.position="static";
	}
	
	if(listUL.style.display == 'none'){
		listUL.style.display = 'block';
	} else {
		listUL.style.display = 'none';
	}
	
	if (document.getElementById("tagname_"+articleNo) != "undefined" 
				&& document.getElementById("tagname_"+articleNo) != null) {	
		document.getElementById("tagname_"+articleNo).style.position="relative";
	}
}   

function getExtImg(ext) {
	switch(ext) {
		case "doc": return "http://icon.daum-img.net/editor/p_word_s.gif";
		case "xls": return "http://icon.daum-img.net/editor/p_xls_s.gif";
		case "ppt": return "http://icon.daum-img.net/editor/p_ppt_s.gif";
		case "pdf": return "http://icon.daum-img.net/editor/p_pdf_s.gif";
		case "txt": return "http://icon.daum-img.net/editor/p_txt_s.gif";
		case "hwp": return "http://icon.daum-img.net/editor/p_hwp_s.gif";
		case "jpg": return "http://icon.daum-img.net/editor/p_jpg_s.gif";
		case "gif": return "http://icon.daum-img.net/editor/p_gif_s.gif";
		case "png": case "bmp": return "http://icon.daum-img.net/editor/p_png_s.gif";
		case "zip": case "alz": return "http://icon.daum-img.net/editor/p_zip_s.gif";
		case "mp3": case "wav": return "http://icon.daum-img.net/editor/p_mp3_s.gif";
		case "avi": case "mpeg": case "wmv": return "http://icon.daum-img.net/editor/p_movie_s.gif";
		case "swf": return "http://icon.daum-img.net/editor/p_swf_s.gif";
		case "html": return "http://icon.daum-img.net/editor/p_html_s.gif";
		default: return "http://icon.daum-img.net/editor/p_etc_s.gif";
	}
}

// 첨부파일 이미지 아이콘 출력
function setFileTypeImg(filename, idx, articleno) {
	var firstpos = filename.lastIndexOf('.')
	var ext = '';

	if (firstpos != -1) {
		ext = filename.substring(firstpos + 1);
		ext = ext.toLowerCase();
	}

	var imgUrl = getExtImg(ext);
	document.getElementById('fileExt_'+ idx+'_'+articleno).style.backgroundImage = 'url(' + imgUrl + ')';
}

function PhotoImagePopup(blogid,imageurl) {
	var winObj = window.open("/_blog/photoImage.do?blogid="+blogid+"&imgurl="+imageurl, "b_img_viewer", "width=800px, height=744px, resizable=yes, scrollbars=yes");
	winObj.focus();
}

var viewObj = '';
function show_img_detail(obj, seq, title, cpage, bminseq, bmaxseq, bminarticleno, bmaxarticleno, bminregdt, bmaxregdt, categoryid, bpage, blogid, articleno , regdt){

	if(viewObj == ''){
		viewObj = document.createElement('div');
		viewObj.id = 'image_view';
		document.body.appendChild(viewObj);
	}
	divDisplay ('image_view', 'block', true);
	var viewObj = document.getElementById('image_view');
	var html = '';
	var url = '/_blog/BlogTypeView.do?blogid='+blogid +'&articleno='+articleno+"&categoryId="+categoryid+"&regdt="+regdt;
	var oncl = "viewAjaxCateArticle('"+url+"','"+categoryid+"');return false;";
	html = '<div id=\"image_view_img\" align=\"center\"><a href=\"javascript:PhotoImagePopup(\''+blogid+'\', \''+obj.src+'\');\"><img id=\"viewObjimg_src\" src=\"' + obj.src + '\"/></a></p>';
	html += '<p id=\"imgview_title\"><a href=\"'+ url +'\" onclick=\"'+oncl+'\"><b class=\"g_333\">' + title + '</b></a><a href=\"'+ url +'\" onclick=\"'+oncl+'\" class=\"p11\" style=\"color:#666;\">[글보기]</a></p>';
	html += '<p class=\"sDateTime\" style=\"color:#999;\">'+regdt+'</p>';
	viewObj.innerHTML = html;
	var viewObjimg_src = document.getElementById('viewObjimg_src');
	ResizeImage2(240, 240, viewObjimg_src);

	var posParent = getPosition(obj.parentNode.parentNode.parentNode);
	var posSelf = getPosition(obj);
	viewObj.style.left = posParent.x - 50 + 'px';
	if(viewObjimg_src.height < 285){
		viewObj.style.top = (posSelf.y - (viewObjimg_src.offsetHeight/2) + 40) + 'px';
	}
	else{
		viewObj.style.top = (posSelf.y - (viewObjimg_src.offsetHeight/2)*0.5 - 30) + 'px';
	}
	fade_effect();

}
function ResizeImage2( maxwidth, maxheight, obj){
	if( obj.width < obj.height) {
		heightEst = maxheight;
		widthEst = maxheight*(obj.width/obj.height);
		obj.height = heightEst;
		obj.width = widthEst;
	}
	else {
		widthEst = maxwidth;
		heightEst = maxwidth*(obj.height/obj.width);
		obj.height = heightEst;
		obj.width = widthEst;
	}
}

function photoviewBycategory(categoryid,maxseq){
	location.href = "/_blog/photoList.do?blogid="+BLOGID+"&isSlide=1&isSelect=1&categoryid="+categoryid+"&selSeq="+maxseq;
}
function draw_img(src, title, articleno){
	document.getElementById('ori_img_src').src = src;
	if( document.getElementById('pvframe') != null ) {
		document.getElementById('pvframe').src="/photoslide.html?type=photolist&src="+src;
	}
}

function goArticleLink(articleno) {
	var link = "/"+BLOGNAME+"/"+articleno;
	window.open(link, "articlelink", "");
}

function getPosition(object) {
  var valueT = 0, valueL = 0;
    do {
      valueT += object.offsetTop  || 0;
      valueL += object.offsetLeft || 0;
      object = object.offsetParent;
      if (object) {
        if(object.tagName.toUpperCase()=='BODY') break;
      }
    } while (object);
    return {x: valueL, y:valueT};
}

var		oSelImg = null;
var		nOverSeq = 0;
var		oOverSmallImg = null;

function show_ori_img(ori_img, title, articleno, seq, regdt, exif){
	document.getElementById('articlelink').innerHTML = '<a href="/'+BLOGNAME+'/'+articleno+'" class="g_fff"><b class="g_fff">\''+title+'\' </b>[글보기]</a>&nbsp;&nbsp;';
	document.getElementById('articleregdt').innerHTML = regdt;
	LoadPhotoSlideImage(500, 500, document.getElementById('ori_img_src'),ori_img, exif);
	if( oSelImg != null ) {
		oSelImg.className = 'out';
		oSelImg = null;
	}
	if( oOverSmallImg != null ) {
		oOverSmallImg.className = 'over';
		oSelImg = oOverSmallImg;
	}
	var str = HOST+"/"+BLOGNAME+"/"+articleno+"/"+seq;
	//document.getElementById('perm').innerHTML ='<a href=\"javascript:copyUrl(\''+str+'\');\" id=\"imgPostUrl\" class=\"t11\">'+str+'</a> <a href=\"javascript:copyUrl(\''+str+'\');\"><img src=\"http://pimg.daum-img.net/blog3/btn_copy.gif\" width=\"22\" height=\"13\" alt=\"복사\" style=\"vertical-align:middle;  margin:0 0 1px 0\" /></a>';
	document.getElementById('perm').innerHTML = '<span style="color:#999;">' + str + '</span> <embed id="imgCopyPostUrl" style="vertical-align:middle;" height="13" width="22" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" allowscriptaccess="always" wmode="transparent" id="UrlCopyButton$!{article.articleNo}" flashvars="url=' + str +'&amp;urlName=이미지" src="http://cafecj.daum-img.net/flash/copyClipboard.swf" />';
}

function bigger_img(img_obj, nSeq){
	if( is_ie ) {
    	oOverDiv = document.getElementById('overDiv');
    	oOverImg = document.getElementById('overImg');

    	var pos = getPosition(img_obj);
    	oPreviewDiv = document.getElementById("preview_list_box");
    	scrollOffset = oPreviewDiv.scrollLeft;
    	
    	oOverDiv.style.top = (pos.y-5) + "px";
    	if( scrollOffset > 0 ) {
    		oOverDiv.style.left = (pos.x-scrollOffset-10) + "px";
    	}
    	else {
    		oOverDiv.style.left = (pos.x-10) + "px";
    	}
    	oOverImg.src = img_obj.src;
    	oOverImg.onclick = img_obj.onclick;
    	oOverImg.alt = img_obj.alt;	
    	oOverDiv.style.display = "block";
		oOverSmallImg = img_obj;
		nOverSeq = nSeq;
	}
	else {
		img_obj.className = 'over';
	}
}

function smaller_img(img_obj){
	img_obj.className = 'out';
	oOverDiv = document.getElementById('overDiv');
	oOverDiv.style.display = "none";
}

function resize_viewer(main_div){
	var Wsize = document.body.offsetHeight;
	main_div.style.height = Wsize - 143;
	document.getElementById('ori_img_view').style.height = Wsize - 148;
	oMainFrame = document.getElementById("main_frame");
	oMainFrame.style.width = (document.body.offsetWidth - 30) + "px";
}

function smaller_img2(img_obj){
	if( !is_ie ) {
		img_obj.className = 'out';
	}
}

function goSort(sort) {
	createMainAjax();
	var themecode;
	if(document.getElementsByName("themeList").length>0 ){

    	frm = document.themeList;
		themecode = frm.themecode.value;
    	frm.sorttype.value = sort;
	}
	locationAjax(blogMainAjax, "/_blog/ThemeList.do?blogid="+BLOGID+"&themecode="+themecode+"&sorttype="+sort);

}

function goThemeCate(theme, categoryid) {
	if(categoryid ==null){
		categoryid = "";
	}
	createMainAjax();

	var link = "/_blog/ThemeList.do?blogid="+BLOGID+"&themecode="+theme+"&totalcnt=0&categoryid="+categoryid;
	if(document.getElementById("totT")){
    	var totcnt = document.getElementById("totT").innerHTML;
    	link="/_blog/ThemeList.do?blogid="+BLOGID+"&themecode="+theme+"&totalcnt="+totcnt+"&categoryid=";
	}
	locationAjax(blogMainAjax, link);

}
function failImgeExif() {
}
function loadImageExif(oXmlHttp) {
	if ( oXmlHttp ) {
		try{
			var oXmlDoc = getXMLDocument(oXmlHttp);
			var aItems = oXmlDoc.getElementsByTagName('item');
			var aExif = aItems[0].getElementsByTagName('exif');
			var aProperty = aExif[0].getElementsByTagName('property');
			var oAttrVal;
			var sMaker = "", sModel = "", sExposureTime = "", sFNumber = "", sISOSpeedRating = "";
			for(var i=0; i<aProperty.length;i++) {
				oAttrVal = aProperty[i].getAttributeNode("name").nodeValue
				if(oAttrVal == "Maker" || oAttrVal=="Manufacturer") {
					sMaker = aProperty[i].firstChild.nodeValue;
					if (sMaker.indexOf("http://") > -1 || sMaker == null || sMaker=='' || sMaker == "undefined")
						sMaker = "&nbsp;";
				} else if(oAttrVal == "Model") {
					sModel = aProperty[i].firstChild.nodeValue;
					if (sModel.indexOf("http://") > -1 || sModel == null || sModel=='')
						sModel = "&nbsp;";
				} else if(oAttrVal == "ExposureTime" || oAttrVal=="Exposure Time") {
					if( aProperty[i].firstChild.nodeValue.indexOf("sec") > -1 ) {
						sExposureTime = aProperty[i].firstChild.nodeValue;
					}  else {
						sExposureTime = "1/"+parseInt(1/eval(aProperty[i].firstChild.nodeValue))+"s";
					}
					if (sExposureTime.indexOf("http://") > -1 || sExposureTime == null || sExposureTime=='')
						sExposureTime = "&nbsp;";
				} else if(oAttrVal == "ApertureFNumber" || oAttrVal == "FNumber") {
					sFNumber = aProperty[i].firstChild.nodeValue;
					if (sFNumber.indexOf("http://") > -1 || sFNumber == null || sFNumber=='')
						sFNumber = "&nbsp;";
				} else if(oAttrVal == "ISO Speed Ratings" || oAttrVal == "ISOSpeedRatings") {
					sISOSpeedRating = aProperty[i].firstChild.nodeValue;
					if (sISOSpeedRating.indexOf("http://") > -1 || sISOSpeedRating == null || sISOSpeedRating=='')
						sISOSpeedRating = "&nbsp;";
				} else if(oAttrVal == "DateTimeOriginal" || oAttrVal == "Date and Time (original)") {
					sDate = aProperty[i].firstChild.nodeValue;
					if (sDate.indexOf("http://") > -1 || sDate == null || sDate=='')
						sDate = "&nbsp;";
				} 
			}
		}catch(e){ }
		oXmlHttp = null;
		if(typeof sMaker == "undefined"){ sMaker ="";}
		if(typeof sModel == "undefined"){ sModel ="";}
		if(typeof sExposureTime == "undefined"){ sExposureTime ="";}
		if(typeof sFNumber == "undefined"){ sFNumber ="";}
		if(typeof sISOSpeedRating == "undefined"){ sISOSpeedRating ="";}
		if(typeof sDate == "undefined"){ sDate ="";}
		document.getElementById("exifMaker").innerHTML = sMaker;
		document.getElementById("exifModel").innerHTML = sModel;
		document.getElementById("exifExposureTime").innerHTML = sExposureTime;
		document.getElementById("exifFNumber").innerHTML = sFNumber;
		document.getElementById("exifISOSpeedRating").innerHTML = sISOSpeedRating;
		if (sDate != '') {
			if (sDate.indexOf(":") == 4)
				sDate = sDate.replace(":","."); // 년
			if (sDate.indexOf(":") == 7)
				sDate = sDate.replace(":","."); // 월
		}
		document.getElementById("exif").innerHTML = sDate;
	}
}
// 교감게시판

	var boardActType="";
    var boardno=0;
    var boardHiddenThread=0;
    var boardInNum=0;
    var boardModiNum=0;
    var boardHiddenDesc="";
	var commentMaxLength = 4000;
	var orgBoardActType = "";

    function boardResetVariable(){
        boardActType="";
		orgBoardActType = boardActType;
        boardno=0;
        boardHiddenThread=0;
        boardInNum=0;
    	boardModiNum=0;
        boardHiddenDesc="";
    }

	function boardSendData(seqnum){
		var vblogid = document.getElementById("vblogid").value.trim();		//방문자의 로그인 여부 체크??
		var blogid = document.getElementById("blogid").value.trim();		//Ajax 호출시 필요한 값
		var myblogid = document.getElementById("myblogid").value.trim(); 	//''
		var isSearch = document.getElementById("isSearch").value.trim(); 	//''
		
		frm = document.boardList;
		
		var writerNameId = "writername";
		var passId = "password";
		var blogemailId = "blogemail";
		var boardDescId = "boarddesc";
		var openKindId = "X_openkind";
		if(seqnum != null)
		{
			writerNameId = "add" + writerNameId + "_" + seqnum;
			passId = "add" + passId + "_" + seqnum;
			blogemailId = "add" + blogemailId + "_" + seqnum;
			boardDescId = "add" + boardDescId + "_" + seqnum;
			openKindId = "addopenkind"+ "_" + seqnum;
			if(boardActType=="REP")
			{
				writerNameId = "Re" + writerNameId;
				passId = "Re" + passId;
				blogemailId = "Re" + blogemailId;
				boardDescId = "Re" + boardDescId;
				openKindId = "Re" + openKindId;
			}
		}
		var chkOpenKind = document.getElementById(openKindId);
		if(chkOpenKind && chkOpenKind.checked){
			if(boardActType=="INSERT") { frm.openkind.value="N"; }
			else { frm.mr_openkind.value="N"; }
		}
		else
		{
			frm.openkind.value="";
			frm.mr_openkind.value="";
		}

		//이름, 패스워드, 이메일은  로그인안했거나, 블로그 없을 때만..
		if(!vblogid) {
			var txtWriterName = document.getElementById(writerNameId);
			var txtPass;
				if(boardActType=="INSERT") txtPass = eval("frm."+passId);
				else txtPass = document.getElementById(passId);
			var txtBlogemail = document.getElementById(blogemailId);
			var errMsg = "";
			var errField = null;
			if(txtWriterName.value.trim() == "" || txtWriterName.value.trim() == "이름")
			{
				errMsg = "이름을";
				errField = txtWriterName;
			}
			else if(txtPass.value.trim() == "" || txtPass.value.trim() == "비밀번호")
			{
				errMsg = "비밀번호를";
				errField = txtPass;
			}
			else if(txtBlogemail.value.trim() == "" || txtBlogemail.value.trim() == "블로그 또는 이메일 주소")
			{
				errMsg = "블로그/이메일 둘 중에 하나를";
				errField = txtBlogemail;
			}
			
			if(errMsg != "")
			{
				alert(errMsg + " 입력해주세요!");
				errField.value="";
				errField.focus();
				return;
			}
			// 이메일인지 블로그주소인지를 구분한다.
			var be = txtBlogemail.value;
			if( be.indexOf("@") > 0 ){
				frm.writeremail.value=be;
			}else{
				if(be.indexOf("http://")<0)	be = "http://"+be;
				frm.writerblog.value=be;
			}
		}
	
		//내용
		var txtBoardDesc = document.getElementById(boardDescId);
		if(txtBoardDesc.value=="" ||  txtBoardDesc.value=="내용"){
    		alert("내용을 입력해주세요!");
    		txtBoardDesc.focus();
			if(boardActType=="INSERT")	boardActType = orgBoardActType;
    		return;
		}
		
		/* 전송 부분 */
		var obj = {};
		obj.blogid = blogid;
		obj.myblogid = myblogid;
		obj.isSearch = isSearch;

		// 이메일인지 블로그주소인지를 구분한다.
		if (!vblogid) {
			frm.writeremail.value = txtBlogemail.value;
			var be = txtBlogemail.value;
			if (be.indexOf("@") > 0) {
				frm.writeremail.value = be;
			}
			else {
				if (be.indexOf("http://") < 0) 
					be = "http://" + be;
				frm.writerblog.value = be;
			}
		}
	   	if(boardActType=="INSERT"){
	   		obj.currentPage = 1;
			loadXMLDocWithParam("POST","/_blog/BoardRegister.ajax",getForm(frm),"after",null,obj);
    	}else{
    		obj.currentPage = frm.currentPage.value;
    		frm.boardno.value=seqnum;
    		if(!vblogid){
	    		frm.writername.value= txtWriterName.value;
				frm.password.value=txtPass.value;
//				frm.writeremail.value= txtBlogemail.value;
    		}
    		frm.boarddesc.value = txtBoardDesc.value;
    	} 
    	if(boardActType=="MOD"){
			loadXMLDocWithParam("POST","/_blog/BoardModify.ajax",getForm(frm),"afterModify",null,obj);

        }else if(boardActType=="REP") {
			loadXMLDocWithParam("POST","/_blog/BoardReplyRegister.ajax",getForm(frm),"after",null,obj);
    	}
    }

	// 방명록등록과 댓글등록
	function after(xmlhttp,obj) {
    	var res = getSimpleResponse(xmlhttp);
    	var tmp = document.createElement("DIV");
		tmp.innerHTML=res;
		var script = tmp.getElementsByTagName("SCRIPT");
		if(script.length>0){
			eval(script[0].innerHTML);
		}else{		
			if (obj.myblogid == "" && obj.isSearch=="N") {
				loadBoardView('/_blog/BoardView.ajax?blogid='+obj.blogid+'&currentPage='+obj.currentPage);
			} else {
				loadBoardView('/_blog/BoardView.ajax?blogid='+obj.blogid+'&currentPage='+obj.currentPage+'&myblogid='+obj.myblogid+'&isSearch='+obj.isSearch);
			}
		}
		xmlhttp = null;
	}

	function afterModify(xmlhttp,obj) {
    //	var res = getSimpleResponse(xmlhttp);		
		if (obj.myblogid == "" && obj.isSearch =="N") {
			loadBoardView('/_blog/BoardView.ajax?blogid='+obj.blogid+'&currentPage='+obj.currentPage);
		} else {
			loadBoardView('/_blog/BoardView.ajax?blogid='+obj.blogid+'&currentPage='+obj.currentPage+'&myblogid='+obj.myblogid+'&isSearch='+obj.isSearch);
		}
		xmlhttp=null;
	}

	function loadBoardView(url) {
		boardAjax = new AjaxObject("boardAjax", "contentArea", "contents", "ajax_layer_load");
    	boardAjax.load(url, true);
    }

	function searchboard() {
		var blogid = document.getElementById("blogid").value;
		var val = document.getElementById("sword").value;
		if(val=="" || val=="블로그 별명") {
		 	 alert("블로그 별명을 넣어주세요");
		 	 return false;
		}else{
			document.location="/_blog/BoardView.do?blogid="+blogid+"&nickname="+encodeURIComponent(val);
		}
	}

	function pressedenter(){
		var keyValue = event.keyCode ;
		if(keyValue == 13){
			searchboard();
		}
	}

	function boardModifyView(objNum,thread) {
		var isReply = false;
		if(objNum != thread){
			isReply = true;
		}
		var vblogid = document.getElementById("vblogid").value;
		boardWriteTemplateSettingModi(objNum);
		boardActType="MOD";
		orgBoardActType = boardActType;
		boardno=objNum;
		if(!vblogid || vblogid == "") {
		/*
			if(document.getElementById("addpassword"))
				document.getElementById("addpassword").value = document.boardList.pass.value;*/
			document.getElementById("addpassword_"+objNum).value = hiddenDesc;
			document.getElementById("addwritername_"+objNum).value = document.getElementById("cContentWriterName_"+objNum).innerHTML.trim();
			document.getElementById("addblogemail_"+objNum).value = document.getElementById("cContentBlogEmail_"+objNum).innerHTML.trim();
		}
///		if(document.getElementById("addboardtitle_"+objNum))
///			document.getElementById("addboardtitle_"+objNum).value =  replaceHTML(document.getElementById("cContentTitle_"+objNum).innerHTML);
		if(boardHiddenDesc ==""){
			if(isReply){
				document.getElementById("addboarddesc_"+objNum).value =  replaceHTML(document.getElementById("cContentBody_"+objNum).innerHTML.trim());
			}else{
				document.getElementById("addboarddesc_"+objNum).value =  replaceHTML(document.getElementById("cContentBodyReal_"+objNum).innerHTML.trim());
				document.getElementById("addboarddesc_"+objNum).style.background = '#fff';
			}
		}else{
			document.getElementById("addboarddesc_"+objNum).value =  replaceHTML(boardHiddenDesc);
			boardHiddenDesc="";
		}
		if(document.getElementById("cContentOpenKind_"+objNum).innerHTML.trim()=="N"){
			document.getElementById("addopenkind_"+objNum).checked =  true;
		}
		if(objNum != thread){
			if(document.getElementById("cContentOpenKind_"+thread).innerHTML.trim()=="N" && document.getElementById("addopenkind_"+objNum) ){
				document.getElementById("addopenkind_"+objNum).checked =  true;
				document.getElementById("addopenkind_"+objNum).disabled =  true;
			}
		}else{
			//document.getElementById("title_"+objNum).style.display="block";
		}
		window.setTimeout("resizeArea(document.getElementById('addboarddesc_'+" + objNum + "), '34', '1000')", 10);
		resizeArea(document.getElementById("addboarddesc_"+objNum), '34', '1000');
	}

	function boardWriteTemplateSettingModi(objNum) {
    	if(boardModiNum > 0 && boardModiNum != objNum){
    		document.getElementById("cWriteLayer_modi_"+boardModiNum).style.display='none';
    		document.getElementById("cContentBody_"+boardModiNum).style.display='block';
    	}
    	var writeTemplate = document.getElementById("cWriteLayer_modi_"+objNum);
    	var writeTemplateText = document.getElementById("cContentBody_"+objNum);
    	if(writeTemplate.style.display =='block'){
    		writeTemplate.style.display = 'none';
    		writeTemplateText.style.display = 'block';
    	}else{
    		writeTemplate.style.display = 'block';
    		writeTemplateText.style.display = 'none';
    	}
    	boardModiNum = objNum;

		//답글쓰기도 지움
		if(document.getElementById("cWriteLayer_"+boardInNum)){
			document.getElementById("cWriteLayer_"+boardInNum).style.display = 'none';
		}
	}

    function boardReplyView(objNum, boardOpenKind) {
		var vblogid = document.getElementById("vblogid").value;
    	boardWriteTemplateSetting(objNum);
    	boardActType="REP";
		orgBoardActType = boardActType;
    	boardno=objNum;
    	if(document.getElementById("title_"+objNum))
    		document.getElementById("title_"+objNum).style.display="none";
    	if(document.getElementById("Readdboarddesc_"+objNum)){
    		if(document.getElementById("Readdboarddesc_"+objNum).disabled==false)
    		document.getElementById("Readdboarddesc_"+objNum).value ="";
    	}

    	if(document.getElementById("cContentOpenKind_"+objNum).innerHTML=="N"){

    		document.getElementById("Readdopenkind_"+objNum).checked =  true;

    		document.getElementById("Readdopenkind_"+objNum).disabled =  true;

    	}
    	if(!vblogid || vblogid == "") {
	    	if(boardOpenKind != "B0402"){
	    		document.getElementById("Readdwritername_"+objNum).value="이름";
	    		document.getElementById("Readdpassword_"+objNum).value="";
	    		document.getElementById("Readdblogemail_"+objNum).value="블로그 또는 이메일 주소";
	    	}
    	}
	}

	function boardWriteTemplateSetting(objNum) {

    	if(boardInNum > 0 && boardInNum != objNum){
    		document.getElementById("cWriteLayer_"+boardInNum).style.display='none';
    	}
    	var writeTemplate = document.getElementById("cWriteLayer_"+objNum);
    	if(writeTemplate.style.display =='block'){
    		writeTemplate.style.display = 'none';
    	}else{
    		writeTemplate.style.display = 'block';
    	}
    	boardInNum = objNum;

    	//수정폼도 지움
    	if(document.getElementById("cWriteLayer_modi_"+boardModiNum)){

        	writeTemplate = document.getElementById("cWriteLayer_modi_"+boardModiNum);
        	//var writeTemplateText = document.getElementById("pCont_comm_cont02_"+boardModiNum);
        	if(writeTemplate.style.display =='block'){
        		writeTemplate.style.display = 'none';
        	//	writeTemplateText.style.display = 'block';
        	}else{
        	//	writeTemplate.style.display = 'block';
        	//	writeTemplateText.style.display = 'none';
        	}
    	}
    }

	function replaceHTML(val){
		var x = val.replace(/&nbsp;/g," ").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");
		x = x.replace(/<BR>\n/g,"\n");

		x = x.replace(/<br>\n/g,"\n");

		x = x.replace(/<BR>/g,"\n");
		x = x.replace(/<br>/g,"\n");
		return x;
	}

	
	//주인이 자신의 스팸함에 스팸필터를 설정합니다.	/ 댓글  
	function blackListReg601Ajax(blogid, atno, cmmtno, url, open, cntdt, jobkind, blackConf) {
		if(confirm("선택하신 글의 작성자를 차단된 사람에 등록하시겠습니까?")){
	       	var frm = document.blackListRegFrm;
	        frm.jobKind.value=jobkind;
	        frm.blackConf.value=blackConf;
	        frm.comment.value="블로그에서 차단";

	        var obj = new Object();
	        obj.blogid= blogid;
	        obj.atno=atno;
	        obj.cmmtno=cmmtno;
	        obj.url=url;
	        obj.open=open;
	        obj.cntdt=cntdt;
	        obj.blackKind="U0601";
	        loadXMLDocWithParam("POST","/_blog/blackListReg.ajax",getForm(frm),"afterblackListReg",null,obj);
		}
	}

	//주인이 자신의 스팸함에 스팸필터를 설정합니다.	/ 엮인글   
	function blackListReg602Ajax(objThis, blogId, atno, tbno, cntdt, jobkind, blackConf) {
		if(confirm("선택하신 글의 작성자를 차단된 사람에 등록하시겠습니까?")){
	       	var frm = document.blackListRegFrm;
	        frm.jobKind.value=jobkind;
	        frm.blackConf.value=blackConf;
	        frm.comment.value="블로그에서 차단";

	        var obj = new Object();
	        obj.objThis= objThis;
	        obj.blogId=blogId;
	        obj.atno=atno;
	        obj.tbno=tbno;
	        obj.cntdt=cntdt;
	        obj.blackKind="U0602";
	        loadXMLDocWithParam("POST","/_blog/blackListReg.ajax",getForm(frm),"afterblackListReg",null,obj);
		}
	}
	
	//주인이 자신의 스팸함에 스팸필터를 설정합니다.	/ 방명록 (교감게시판)  
	function blackListReg603Ajax(boardno,type,currentPage, jobkind, blackConf) {
		if(confirm("선택하신 글의 작성자를 차단된 사람에 등록하시겠습니까?")){
	       	var frm = document.blackListRegFrm;
	        frm.jobKind.value=jobkind;
	        frm.blackConf.value=blackConf;
	        frm.comment.value="블로그에서 차단";

	        var obj = new Object();
	        obj.boardno=boardno;
	        obj.type=type;
	        obj.currentPage=currentPage;
	        obj.blackKind="U0603";
	        loadXMLDocWithParam("POST","/_blog/blackListReg.ajax",getForm(frm),"afterblackListReg",null,obj);
		}
	}
	
	//주인이 자신의 스팸함에 스팸필터를 설정합니다.	/ 프로필 댓글
	function blackListReg605Ajax(cmmtNo, prntNo,jobkind, blackConf) {
		if(confirm("선택하신 글의 작성자를 차단된 사람에 등록하시겠습니까?")){
	       	var frm = document.blackListRegFrm;
	        frm.jobKind.value=jobkind;
	        frm.blackConf.value=blackConf;
	        frm.comment.value="블로그에서 차단";
        
	        var obj = new Object();
	        obj.cmmtNo=cmmtNo;
	        obj.prntNo=prntNo;
	        obj.blackKind="U0605";
	        loadXMLDocWithParam("POST","/_blog/blackListReg.ajax",getForm(frm),"afterblackListReg",null,obj);
		}
	}
	
	function afterblackListReg(xmlhttp,obj){
		var res = getSimpleResponse(xmlhttp);
		
		if (res.indexOf('success') > -1) {
			alert ("블랙리스트에 추가 되었습니다.");
		} else if (res.indexOf('dup') > -1) {
			alert ("이미 추가된 사용자 입니다.");			
		} else {
			alert ("죄송합니다 블랙리스트로 추가가시키지 못했습니다.");
			return;
		}

		if (obj.blackKind == "U0601") {
			deleteCommentAjax (obj.blogid, obj.atno, obj.cmmtno, obj.url, obj.open, obj.cntdt);
		} else if (obj.blackKind == "U0602") {
			if(confirm("역인글을 삭제 하시겠습니까?")){
				delTrackback(obj.objThis, obj.blogId, obj.atno, obj.tbno, obj.cntdt);	// common_v2.0.js 에 선언되어 있습니다.
			}
		} else if (obj.blackKind == "U0603") {
			boardGoAdminDel (obj.boardno, obj.type, obj.currentPage);
		} else if (obj.blackKind == "U0605") {			
			profileShowCommentDelete(obj.cmmtNo, obj.prntNo);
		}		
		xmlhttp=null;
	}
	
	function boardGoAdminDel(boardno,type, currentPage) {
		var blogid = document.getElementById("blogid").value;
		var myblogid = document.getElementById("myblogid").value;
		var isSearch = document.getElementById("isSearch").value;		
		var chk = document.getElementById("hasChild_"+boardno);

    	if(chk!=null){
    		alert("답글이 있는 게시글은 삭제할 수 없습니다.");
    		return;
    	}
    	if(type==0)
    		y = confirm("해당 게시글을 삭제  하시겠습니까?");
    	else
    		y = confirm("해당 답글을 삭제 하시겠습니까?");
    	if(y) {
    		frm = document.boardList;

    		frm.blogid.value=blogid;
    		frm.boardno.value=boardno;

    		var obj = new Object();
    	    obj.boardno=boardno;
    	    obj.blogid=blogid;
    	    obj.currentPage=currentPage;
    	    obj.myblogid = myblogid;
    	    obj.isSearch = isSearch;
    		
    		loadXMLDocWithParam("POST","/_blog/BoardDelete.do",getForm(frm),"afterDelete",null,obj);
    		if (typeof(requestAjaxCheck) == 'function') {
    			requestAjaxCheck("action=boardGoAdminDel&blogid="+blogid);
    		}
    	}
    }

	function afterDelete(xmlhttp,obj) {
		boardno = obj.boardno;
		if ((obj.myblogid == undefined || obj.myblogid == "") && (obj.isSearch == undefined || obj.isSearch == "N")) {
			loadBoardView('/_blog/BoardView.ajax?blogid='+obj.blogid+'&currentPage='+obj.currentPage);
		} else {
			loadBoardView('/_blog/BoardView.ajax?blogid='+obj.blogid+'&currentPage='+obj.currentPage+'&myblogid='+obj.myblogid+'&isSearch='+obj.isSearch);
		}		
		
		xmlhttp= null;
	}

	function loadBoardList(url){
		boardAjax = new AjaxObject("boardAjax", "contentArea", "contents", "ajax_layer_load");
		boardAjax.load(url, true);
	}

    function boardGoModi(deltype,boardno,thread,curObj){
		var blogid = document.getElementById("blogid").value;
		boardHiddenThread = thread;
		frm = document.boardList;
		var currentPage = frm.currentPage.value;
		var url = "/_blog/BoardDelete.do?blogid="+blogid+"&currentPage="+currentPage+"&boardno="+boardno;
		//	if(deltype=="T") {
		//		location.href=url;
		//	}	else {
		//		url = "/_blog/BoardPwdDelete.do?blogid=$!BLOGID&currentPage="+currentPage+"&boardno="+boardno;
		clickAreaCheck = true;
		var str = "<div onclick='clickAreaCheck = true' style='background:#FFFFFF; border:1px solid #999999;'><div style='margin:10px 10px 6px 10px; text-align:right;'>비밀번호를 입력해주세요.<br />";
		str += "<input type=password id=password2 id=password2 name=password2 class=box maxlength='10' style='width:139px; margin-bottom:5px;' onkeydown='clickAreaCheck = true' onfocus='clickAreaCheck = true'><br />";
		str += "<a href=\"#\" onclick=\"boardModi('"+deltype+"','"+boardno+"');\"><img src='http://pimg.daum-img.net/blog/p_img2/btn_ok.gif' width='32' height='18' alt='확인'></a> <a href='javascript:;'><img onclick=\"divDisplay('nameLayer', 'none')\" src='http://pimg.daum-img.net/blog/p_img2/btn_cancle03.gif' width='32' height='18' alt='취소'></a><br /></div></div>";
		setNameLayersPosition(curObj, str);
		var passField = document.getElementById("password2");
		if(passField && passField.focus){ passField.focus(); }
		//   }
	}

	function boardModi(deltype,boardno) {
		if(document.getElementById("password2").value==""){
	    	alert("비밀번호를 입력해주세요!");
	    	return;
		}
		document.boardList.pass.value=document.getElementById("password2").value;
		clickAreaCheck = false;
		var qry = "?blogid="+document.getElementById("blogid").value+"&boardno="+boardno+"&password="+document.getElementById("password2").value;
		loadDynamicContent("/_blog/BoardCheckPassword.do"+qry);
		divDisplay('nameLayer', 'none');
	}

	function boardGoDel(deltype,boardno,type,curObj, currentPage) {
		var blogid = document.getElementById("blogid").value;
		var chk = document.getElementById("hasChild_"+boardno);
		if(chk!=null){
			alert("답글이 있는 게시글은 삭제할 수 없습니다.");
			return;
		}
		frm = document.boardList;
		var url = "/_blog/BoardDelete.do?blogid="+blogid+"&currentPage="+currentPage+"&boardno="+boardno;

		if(deltype=="T") {
			location.href=url;
		}	else {
	    	//		url = "/_blog/BoardPwdDelete.do?blogid="+board+"&currentPage="+currentPage+"&boardno="+boardno;
	    	clickAreaCheck = true;
	    	var str = "<div onclick='clickAreaCheck = true' style='background:#FFFFFF; border:1px solid #999999;'><div style='margin:10px 10px 6px 10px; text-align:right;'>비밀번호를 입력해주세요.<br />";
	    	str += "<input type=password id=password2 name=password2 class=box maxlength='10' style='width:139px; margin-bottom:5px;' onkeydown='clickAreaCheck = true' onfocus='clickAreaCheck = true'><br />";
	    	str += "<a href=\"#\" onclick=\"javascript:boardDel('"+blogid+"','"+boardno+"');\"><img src='http://pimg.daum-img.net/blog/p_img2/btn_ok.gif' width='32' height='18' alt='확인'></a> <a href='javascript:;'><img onclick=\"divDisplay('nameLayer', 'none')\" src='http://pimg.daum-img.net/blog/p_img2/btn_cancle03.gif' width='32' height='18' alt='취소'></a><br /></div></div>";
	    	setNameLayersPosition(curObj, str);
		}
	}

	function boardDel(blogid, boardno) {
		var password = document.getElementById("password2").value;

    	if(password == "") {
        	alert("비밀번호를 입력해주세요");
        	return;
		}
 		clickAreaCheck = false;
		var qry = "?blogid="+document.getElementById("blogid").value+"&boardno="+boardno+"&password="+password+"&boardacttype=DEL";
		loadDynamicContent("/_blog/BoardCheckPassword.do"+qry);
		divDisplay('nameLayer', 'none');
	}
	
	function boardDel2(blogid, boardno) {
		var password = document.getElementById("password2").value;

    	if(password == "") {
        	alert("비밀번호를 입력해주세요");
        	return;
		}
    	frm = document.boardList;
    	frm.blogid.value=blogid;
    	frm.boardno.value=boardno;
    	frm.pass.value=password;

    	var obj = new Object();
    	obj.blogid = blogid;
		obj.currentPage = frm.currentPage.value;
		
    	if( document.getElementById("nameLayer") ) {
    		document.getElementById("nameLayer").style.display="none";
    	}

    	loadXMLDocWithParam("POST","/_blog/BoardPwdDelete.do",getForm(frm),"afterDelete",null,obj);
	}

	//패스워드 검사후 해줘야되는것들
	function checkedPasswd(xmlhttp, obj) {
		var res = getSimpleResponse(xmlhttp);
		eval(res);
		xmlhttp=null;
	}

	function boardGoVerifyRegister(vemail,vblog,vid){
		var blogid = document.getElementById("blogid").value;
		frm = document.boardList;
		var board_param = "blogid="+blogid+"&currentPage="+frm.currentPage.value;
		board_param += "&verifyBlog="+encodeURIComponent(vblog)+"&verifyEmail="+encodeURIComponent(vemail)+"&verifyID="+vid;
		location.href="/_blog/VerifyRegister.do?"+board_param;
	}

	// 일단 board.js 에 붙혀 놓고 댓글쪽이랑 공용으로 빼자.
	function setNameLayersPosition(curObj, str) {
		var name = "nameLayer";

		if (!document.getElementById(name)) {
	        var cElement = document.createElement("DIV");
	        cElement.id = name;
	        cElement.style.position = 'absolute';
			cElement.style.zIndex = 50;
	        document.body.appendChild(cElement);
		}

		document.getElementById(name).style.top = (getAbsoluteTop(curObj) + curObj.offsetHeight + 3)+"px";
		document.getElementById(name).style.left = getAbsoluteLeft(curObj)+"px";

		document.getElementById(name).innerHTML = str;

		divDisplay(name, 'block',  true);
	}

	/** 블로그명 클릭하면 나오는 레이어 기능은 2008년8월1일부터 빠집니다. YM
	function showNameLayer(curObj, link1, link2, link3) {
		clickAreaCheck = true;
		needTargetTop = false;

		if(link2 == "") {
			needTargetTop = true;
			link2 = link3;
			var copyList = new Array("바로가기", "차단하기");
		} else {
			link1 = link2;
			link2 = link3;
			var copyList = new Array("친구등록", "차단하기");
		}

		var str = "<div class='name'><img src=\"http://pimg.daum-img.net/blog/p_img/im_layerbg_01.gif\" width=\"85\" height=\"1\"><br />";
		str += "<ul>";
		for (var i=0; i < copyList.length; i++) {

			str += "<li onclick='clickAreaCheck = true'>";
			if (eval("link"+Number(i+1)) != "") {
				if( needTargetTop && i==0 )
					str += "<a href="+eval("link"+Number(i+1))+" target=\"_top\" class=\"cLayerLink\">" + copyList[i] + "</a>";
				else
					str += "<a href="+eval("link"+Number(i+1))+" class=\"cLayerLink\">" + copyList[i] + "</a>";
			}else {
				str += copyList[i];
			}
			if (i + 1 < copyList.length)
				str += "<li class=\"line\" onclick='clickAreaCheck = true'>";
		}
		str += "</ul><img src=\"http://pimg.daum-img.net/blog/p_img/im_layerbg_01.gif\" width=\"85\" height=\"1\"><br /></div>";

		setNameLayersPosition(curObj, str);
	}
**/

//////////////////////////////////////////////////////////////////////////////////////////
// 프로필
//////////////////////////////////////////////////////////////////////////////////////////
	var profileIsCommentLoaded = false;
	var profileCommentAjax;
	function profileShowComment(blogid){	
		if(document.getElementById("pCont_comm").style.display == 'none')
		{
		
			if(!profileIsCommentLoaded)
			{
				//loadDynamicContent("/_blog/ProfileCommentsList.do?blogid="+blogid);
				profileCommentAjax = new AjaxObject("profileCommentAjax", "pCont_comm_list", "contents", "ajax_layer_load");
				profileCommentAjax.load("/_blog/ProfileCommentsList.ajax?blogid="+blogid, true);
				document.getElementById("profileCommentTitle").style.fontWeight = "bold";
				document.getElementById("profileCommentCnt").className = "cB_Amp";
			}

			document.getElementById("pCont_comm").style.display = 'block';

		}else
		{
			document.getElementById("pCont_comm").style.display = 'none';
			document.getElementById("profileCommentTitle").style.fontWeight = "";
				document.getElementById("profileCommentCnt").className = "";
		}
	}

	function profileInit(blogid){
		if(!confirm("초기화를 하면 이전에 프로필에 입력했던 정보가 모두 삭제됩니다. 정말 초기화 하시겠습니까?")) return;
		if(document.getElementById("hideframe")) {
			document.getElementById("hideframe").src = "/_blog/ProfileInit.do?blogid="+blogid;
		}
	}

	function profmod(cmmtNo){
		var cmmtUpdForm = document.cmmtUpdForm;
		var cmmtopen = document.getElementById("profile.getCommentOpen").innerHTML;
		var authority = document.getElementById("authority").innerHTML;
		if(document.getElementById("_open"+cmmtNo)){
			if(document.getElementById("_open"+cmmtNo).checked)
				cmmtUpdForm.cmmtopen.checked=true;
		}
		if(document.getElementById("_txticon"+cmmtNo)){
			if(document.getElementById("_txticon"+cmmtNo).checked)
				cmmtUpdForm.cmmtexticon.checked=true;
		}		
		cmmtUpdForm.cmmtname.value = document.getElementById("_name"+cmmtNo).value;
		cmmtUpdForm.cmmtcheck.value = document.getElementById("_check"+cmmtNo).value;
		cmmtUpdForm.cmmtcomment.value = document.getElementById("_comment"+cmmtNo).value;
				
		if (cmmtUpdForm.cmmtcomment.value.length > commentMaxLength) {
			alert ("댓글은 "+commentMaxLength+"자 까지 작성하실 수 있습니다.");
			return;
		}						
				
		var rtn =profileCheckComment(cmmtUpdForm,authority,cmmtopen);
		if(rtn)
			cmmtUpdForm.submit();
	}
	var preCmmtObj;
	var preCommtHide;
	function profileShowCommentEditForm(cmmtNo, prntNo, cmmtPwd, parentIsLock){

		var cmmtObj = document.getElementById("pLayerCmmtMod"+cmmtNo);
		if(cmmtObj == null) return;

		if(preCmmtObj == cmmtObj){
				cmmtObj.style.display = 'none';
				cmmtObj.innerHTML = '';
				preCommtHide.style.display='block';
				preCmmtObj =null;
				preCommtHide=null;
				return;
		}else{
			if(preCommtHide !=null)
				preCommtHide.style.display='block';
			preCommtHide = document.getElementById("pDataCmmtContent"+cmmtNo);
			preCommtHide.style.display='none';
			 if(preCmmtObj !=null){
			 	preCmmtObj.style.display="none";
			 }
		}

		if(cmmtObj.style.display == 'none')	{
			var cmmtUpdForm = document.cmmtUpdForm;
			cmmtUpdForm.cmmtno.value = cmmtNo;
			cmmtUpdForm.prntno.value = prntNo;
			cmmtUpdForm.cmmtname.value = document.getElementById("pDataCmmtName"+cmmtNo).innerHTML;
			cmmtUpdForm.cmmtcheck.value = document.getElementById("pDataCmmtUrl"+cmmtNo).innerHTML;
			cmmtUpdForm.cmmtcomment.value = document.getElementById("pDataCmmtContent"+cmmtNo).innerHTML;
			cmmtUpdForm.mode.value="M";


			if(cmmtPwd != null)
				document.cmmtUpdForm.cmmtpwd.value = cmmtPwd;

			if( typeof(document.cmmtUpdForm.cmmtopen) != 'undefined' ) {
				if(parentIsLock=="Y"){
		    		document.cmmtUpdForm.cmmtopen.checked = true;
		    		document.cmmtUpdForm.cmmtopen.disabled = true;
				}else{
					document.cmmtUpdForm.cmmtopen.checked = false;
		    		document.cmmtUpdForm.cmmtopen.disabled = false;
				}
				if(cmmtUpdForm.cmmtopen)
					cmmtUpdForm.cmmtopen.checked = ((document.getElementById("pDataCmmtOpen"+cmmtNo).innerHTML == "Y")? false : true);
			}
			cmmtObj.innerHTML=profileCommentModiForm(cmmtNo,parentIsLock);
			cmmtObj.style.display = 'block';

		}else{
			cmmtObj.style.display = 'none';
			cmmtObj.innerHTML = '';
		}
		preCmmtObj = cmmtObj;
		window.setTimeout("resizeArea(document.getElementById('_comment'+" + cmmtNo + "), '60', '1000')", 10);
		resizeArea(document.getElementById("_comment"+cmmtNo), '60', '1000');
	}


	function profileShowCommentReplyForm(cmmtNo, parentIsLock){
		if(preCommtHide !=null){
				preCommtHide.style.display='block';
				preCommtHide = null;
		}
		if(cmmtObj !=null){
			cmmtObj.style.display="none";
		}
		var cmmtObj = document.getElementById("pLayerCmmtReply"+cmmtNo);
		if(cmmtObj == null) return;

		if(preCmmtObj != null && preCmmtObj != cmmtObj)
		{
			if(preCmmtObj.style.display != 'none')
			{
				preCmmtObj.style.display = 'none';
				preCmmtObj.innerHTML = '';
			}
		}

		if(cmmtObj.style.display == 'none')
		{
			var cmmtReplyForm = document.cmmtReplyForm;
			if(document.cmmtReplyForm[0].prntno){
				cmmtReplyForm = cmmtReplyForm[0];
			}

			cmmtReplyForm.prntno.value = cmmtNo;
			cmmtObj.innerHTML = document.getElementById("pLayerReplyOrg").innerHTML;

			cmmtObj.style.display = 'block';
			document.cmmtReplyForm[0].cmmtcomment.focus();
			if(parentIsLock=="Y"){
	    		document.cmmtReplyForm[0].cmmtopen.checked = true;
	    		document.cmmtReplyForm[0].cmmtopen.disabled = true;
			}
		}else
		{
			cmmtObj.style.display = 'none';
			cmmtObj.innerHTML = '';
		}
		preCmmtObj = cmmtObj;
	}

	function profileShowCommentDelete(cmmtNo, prntNo, cmmtPwd)
	{
		if(!confirm('삭제하시겠습니까?'))
			return;
		if(profileHasChild(cmmtNo, prntNo))
		{
			alert("답글이 달린글은 삭제 할 수 없습니다.");
			return;
		}
		document.cmmtDelForm.cmmtno.value = cmmtNo;
		if(cmmtPwd != null)
			document.cmmtDelForm.cmmtpwd.value = cmmtPwd;
		document.cmmtDelForm.submit();
	}

	function profileHasChild(cmmtNo, prntNo)
	{
		if(cmmtNo != prntNo) return false;
		if(document.getElementById("pDataCmmtPrnt"+prntNo))
			return true;
		return false;
	}

	function profileCheckComment(frmCmmt, authority, commentOpen)
	{
		if(authority=="D"){
			if(commentOpen == "B0402"){
				return false;
			}else{
	    		if(frmCmmt.cmmtname.value == "" || frmCmmt.cmmtname.value == "이름")
	    		{
	    			alert("이름을 넣어 주세요");
	        		return false;
	    		}

	    		if(frmCmmt.cmmtpwd.value == "")
	    		{
	    			alert("비밀번호를 넣어 주세요");
	        		return false;
	    		}

	    	}
		}
		if(frmCmmt.cmmtcheck.value != "" && frmCmmt.cmmtcheck.value != "블로그 또는 이메일 주소")
		{
			if(isValidEmail(frmCmmt.cmmtcheck.value)){
				frmCmmt.checkkind.value = "E";
			}else if(isValidUrl(frmCmmt.cmmtcheck.value)){
				frmCmmt.checkkind.value = "B";
			}else {
				alert("블로그 또는 이메일 주소를 올바르게 넣어 주세요");
	    		return false;
			}
		}
		if(commentOpen == "B0403"){//자체인증
	    	if(frmCmmt.cmmtcheck.value == "" || frmCmmt.cmmtcheck.value == "블로그 또는 이메일 주소")
	    	{
	    		alert("블로그 또는 이메일 주소를  넣어 주세요");
	    		return false;
	    	}
		}
		if(frmCmmt.cmmtcomment.value == "" || frmCmmt.cmmtcomment.value == "내용")
		{
			alert("내용을 넣어 주세요");
			return false;
		}
	
		if (frmCmmt.cmmtcomment.value.length > commentMaxLength) {
			alert ("댓글은 "+commentMaxLength+"자 까지 작성하실 수 있습니다.");
			return false;
		}		

		if(frmCmmt.cmmtopen && frmCmmt.cmmtopen.checked){
			frmCmmt.mr_openkind.value="N";
		}

		if(frmCmmt.cmmtexticon && frmCmmt.cmmtexticon.checked){
			frmCmmt.mr_texticon.value="Y";
		}
		 
		return true;
	}

	/*
	function isValidEmail(email) {
		var chkExp = /^\s*[\w\-\.]+\@[\w\-]+(\.[\w\-]+)+\s*$/g;
		return chkExp.test(email);
	}*/

	function isValidUrl(urls)
	{
		var chkExp = /http:\/\/([\w\-]+\.)+/g;
		return chkExp.test(urls);
	}

	var profilePrePasswdObj;
	function profileShowPasswdForm(e,cmmtno, mode, parentIsLock)
	{
		var passwdObj = document.getElementById("cLayerPwd");
		if(profilePrePasswdObj != null && profilePrePasswdObj != passwdObj)
		{
			if(profilePrePasswdObj.style.display != 'none')
				profilePrePasswdObj.style.display = 'none';
		}

		if(passwdObj.style.display == 'none')
		{
			var plinkObj = (navigator.userAgent.toLowerCase().indexOf('msie') > -1) ? window.event.srcElement : e.target;
			if(plinkObj == null) return;
			
			clickAreaCheck = true;
			var str = "<div style='background:#FFFFFF; border:1px solid #999999;' id='profilepw'><div style='margin:10px 7px 6px 0px; text-align:right;'>비밀번호를 입력해주세요.<br />";
	        str += "<input type=password id=password2 name=password2 class=box maxlength='10' style='width:132px; margin-bottom:5px;' onkeydown='clickAreaCheck = true' onfocus='clickAreaCheck = true'><br />";
	        str += "<a href=\"javascript:profileChkPasswd('" + USERINFO.blogid + "', '" + cmmtno + "', '" + mode + "', '" + parentIsLock + "');\"><img src='http://pimg.daum-img.net/blog/p_img2/btn_ok.gif' width='32' height='18' alt='확인'></a>";
	    	str += " <a href=\"javascript:;\" onclick=\"profileShowPasswdForm('" + cmmtno + "', '" + mode + "')\"><img src='http://pimg.daum-img.net/blog/p_img2/btn_cancle03.gif' width='32' height='18' alt='취소'></a><br /></div></div>";
			setNameLayersPosition(e, str);
			passwdObj.style.display = '';
		}else{
			passwdObj.style.display = 'none';
			passwdObj.innerHTML = '';
		}
	  	profilePrePasswdObj = passwdObj;
	}

	function profileChkPasswd(blogid, cmmtno, mode, parentIsLock)
	{
	  	if(document.getElementById("password2").value == "")
		{
	        alert("비밀번호를 입력해주세요!");
	        return;
	  	}
	  	var qry = "?mode=" + mode + "&blogid=" + blogid + "&cmmtno=" + cmmtno + "&cmmtpwd=" + document.getElementById("password2").value + "&parentIsLock=" + parentIsLock;
		loadXMLDoc ('GET','/_blog/ProfileCommentCheckPwd.ajax'+qry, null, "aftercheckpw", 'dummy');
	}
	function aftercheckpw(xmlhttp){
		var res = getSimpleResponse(xmlhttp);
		var tmp = document.createElement("DIV");
		tmp.innerHTML=res;
		var script = tmp.getElementsByTagName("SCRIPT");
		if(script.length>0){
			eval(script[0].innerHTML);
		}
		xmlhttp = null;
	}
	function profileDefImgResize(imgObj)
	{
		var nImg = new Image();
		nImg.src = imgObj.src;
		imgObj.width = (nImg.width > 566)? 566: nImg.width;
	}

	/** 차단하기 서비스 
function boardGoBlackListReg(blogid,count){
	frm = document.boardList;
	var jobKind = document.getElementById("jobKind_0_"+count).value;
	var blackConf = document.getElementById("blackConf_0_"+count).value;
	if(confirm("차단하시겠습니까?"))
		location.href="/_blog/BlackListRegister.do?blogid="+blogid+"&jobKind="+jobKind+"&blackKind=U0603&blackConf="+blackConf;
}
	**/
function boardGoFriendApp(count,blogid){
	frm = document.boardList;
	var friendBlogID = eval("frm.friendBlogID_"+count+".value");
	addFriend('/_blog/FriendApp.do?blogid='+blogid+'&friendBlogID='+friendBlogID);
}


function profileCommentModiForm(cno,IsLock){

		var popen = document.getElementById("profile.getCommentOpen").innerHTML;
		var frm = document.cmmtUpdForm;
		cmmtno = frm.cmmtno.value ;
		prntno =frm.prntno.value ;
		cmmtname= frm.cmmtname.value;
		cmmtcheck=frm.cmmtcheck.value;
		cmmtcomment= frm.cmmtcomment.value;
		
		var checkOptionicon;
		if (TexticonCheck.isTexticon(cmmtcomment)) {
			checkOptionicon = "checked";
		}	
		
		html='<div class="profileCommentWritefrm" style="margin:0px;padding:5 0 8 0px"><div style="margin-left:0px;">';
    		if(USERINFO.islogin=="N"){
        		html+=	'<input type="text" size="15" id="_name'+cno+'" value="'+cmmtname+'" class="box" onfocus="this.value = ((this.value == \'이름\')? \'\' : this.value);" onblur="this.value = ((this.value == \'\')? \'이름\' : this.value);" /> &nbsp;';
        		html+=	'<input type="password" size="12" maxlength="10" id="_pwd'+cno+'" value="" class="box passbg" onfocus="this.className = \'box\';" onblur="this.className = ((this.value == \'\')? \'box2\' : \'box\');" /> &nbsp;';
        		html+=	'<input type="text" id="_check'+cno+'" size="27" class="box" value="'+cmmtcheck+'" onfocus="this.value = ((this.value == \'블로그 또는 이메일 주소\')? \'\': this.value);" onblur="this.value = ((this.value == \'\')? \'블로그 또는 이메일 주소\' : this.value);" />';
    		}else{
    			html+=	'<input type="hidden" id="_name'+cno+'" value="'+cmmtname+'" /><input type="hidden" id="_check'+cno+'" value="'+cmmtcheck+'" />';
    		}
    		html+='<div style="width:100%"><textarea rows="3" name="comment" id="_comment'+cno+'" class="box" style="margin-top:3px; margin-bottom:5px;" onkeyup="resizeArea(this, \'60\', \'1000\')" onfocus="this.value = ((this.value == \'내용\')? \'\': this.value);" onblur="this.value = ((this.value == \'\')? \'내용\' : this.value);">';
    		html+=TexticonCheck.checkedComments(cmmtcomment);
    		html+='</textarea></div>';
    		html+='<div class="fl">';
			if(USERINFO.islogin=="Y"){
				if(IsLock=="Y"){
					html+='<input type="checkbox" id="_open'+cno+'" value="N" checked disabled style="vertical-align: middle; margin-bottom: 2px" >비공개';
    			}else{
	    			html+='<input type="checkbox" id="_open'+cno+'" value="N" ';
    				if(document.cmmtUpdForm.cmmtopen.checked){
		    			html+=' checked ';
		    			if(document.cmmtUpdForm.cmmtopen.disabled){
		    				html+=' disabled ';
		    			}
	    			}
	    			html+=' style="vertical-align: middle; margin-bottom: 2px" >비공개';
    			}
    				html+='<input type="checkbox" name="cmmtexticon"  id="_txticon'+cno+'" value="Y"  '+checkOptionicon+' style="vertical-align: middle; margin-bottom: 2px" />텍스티콘';
    				html+=' <a href="javascript:popUp(\"/_help/popup_texticon.html\", \"520\", \"516\")"><img src="http://pimg.daum-img.net/blog/theme/btn_question02.gif" width="12" height="11" alt="텍스티콘" style="margin-bottom: 1px; vertical-align: middle;" /></a>';
    		}
    		html+='</div><div class="fr"><a href="javascript:profmod('+cno+')"><img src="http://pimg.daum-img.net/blog/p_img2/btn_modify.gif" style="width:34px; height:18px" alt="수정" /></a></div></div></div>';
    		return html;
}








/************* jun *****************************************/
String.prototype.chop = function() {
	return this;
}

String.prototype.nl2br = function() {
	return this.split('\n').join('<br \/>\n');
}

String.prototype.replace2 = function(find,replace) {
	return this.split(find).join(replace);
}

String.prototype.convertHtml= function() {
	return this.replace('&', '&amp;').replace('"', '&quot;').replace('<', '&lt;').replace('>', '&gt;');
}

String.prototype.reformHtml = function() {
	return this.replace('&amp;', '&').replace('&quot;', '"').replace('&lt;', '<').replace('&gt;', '>');
}

String.prototype.escapeForDisplay = function() {
	return this.replace('<', '&lt;');
}

String.prototype.space2nbsp = function() {
    return this.replace2('  ', ' &nbsp;');
}

String.prototype.convertHtml2 = function() {
    return this.replace2('&', '&amp;').replace2('"', '&quot;').replace2('<', '&lt;').replace2('>', '&gt;');
}

String.prototype.truncate_with_ellipses = function(chars_allowed) {
	var t = this;
	if (t.length > chars_allowed-3) {
		t = t.substr(0, chars_allowed-3)+'...'
	}
	return t;
}

String.prototype.cut = function(len, tail) 
{
	if(tail == null){tail = '...'}
    var str = this;
    var l = 0;
    for (var i=0; i<str.length; i++) 
    {
        l += (escape(str.charAt(i)).charAt(1) == "u")? 2 : 1;
        if (l > len) return str.substring(0,i) + tail;
    }
    return str;
}

String.prototype.cutConvertedHtml = function(len, tail) 
{
    var str = this;
    var l = 0;
	var compareStr = "";
	var compareIdx = 0;
	
    for (var i=0; i<str.length; i++) 
    {
        l += (str.charCodeAt(i) > 128) ? 2 : 1;
		
        if (l > len) {
			if(compareIdx > 0){
    			compareStr = str.substring(compareIdx, compareIdx + 5);	
                if(compareStr == '&amp;')
                	return str.substring(0, compareIdx) + tail;
    				
    			compareStr = str.substring(compareIdx, compareIdx + 6);	
                if(compareStr == '&quot;')
                	return str.substring(0, compareIdx) + tail;
    
    			compareStr = str.substring(compareIdx, compareIdx + 4);					
                if(compareStr == '&lt;')
                	return str.substring(0, compareIdx) + tail;
                else if(compareStr == '&gt;')
                	return str.substring(0, compareIdx) + tail;
			}else{
            	return str.substring(0, i) + tail;
			}
		}
		
		if(str.charCodeAt(i) == 38){ //&
			compareIdx = i;
		}else if(str.charCodeAt(i) == 59){ //;
			compareIdx = -1;
		}
		  
		  
    }
    return str;
}

String.prototype.bytes = function() 
{
    var str = this;
    var l = 0;
    for (var i=0; i<str.length; i++) 
        l += (str.charCodeAt(i) > 128) ? 2 : 1;

    return l;
}

String.prototype.trim = function()
{
    return this.replace(/(^\s*)|(\s*$)/g, ""); 
}

/******Blog Common String/Number**************************************************************************************/
String.prototype.trim = function() {
	return this.replace(/(^\s*)|(\s*$)/g, ""); 
};

String.sSpaces = " \t\r\n"+String.fromCharCode(160);
String.prototype.trimPerfect = function() {
	var sTrs = this;
	while(sTrs.length > 0 && String.sSpaces.indexOf(sTrs.charAt(sTrs.length-1)) > -1)
		sTrs = sTrs.substring(0, sTrs.length-1);
	while(sTrs.length > 0 && String.sSpaces.indexOf(sTrs.charAt(0)) > -1)
		sTrs = sTrs.substring(1);
	return sTrs;
};

String.prototype.changeBlank = function() {
	return this.replace(String.fromCharCode(160), " ");
};

String.prototype.toNumber = function() {
	return (isNaN(this)? 0: parseInt(this));
};

String.prototype.parsePx = function() {
	if(this == null || this.length == 0)
		return 0;
	else if(this.indexOf("px") > -1)
		return this.substring(0, this.indexOf("px")).toNumber();
	else
		return this.toNumber();
};

String.prototype.toPx = function() {
	if(this.indexOf("px") > -1) {
		return this + "";
	} else {
		return this + "px";
	}
};

String.prototype.getRealLength = function() {
	var nLen = this.length;
	for(var i=0; i<this.length; i++) {
		if(escape(this.charAt(i)).charAt(1) == "u")
			nLen++;
	}
	return nLen;
};

String.prototype.calTextWidth = function() {
	var nWidth = this.length;
	for(var i=0; i<this.length; i++) {
		if(escape(this.charAt(i)).charAt(1) == "u") {
			nWidth += 2;
		} else if("|!if'\".,^()/?`".indexOf(this.charAt(i)) == -1) {
			nWidth++;
		} else {
		}
	}
	return nWidth;
}

String.prototype.cutRealLength = function(len) {
    var str = this;
    var idx = 0;
    for (var i=0; i<str.length; i++) {
        idx += (escape(str.charAt(i)).charAt(1) == "u")? 2 : 1;
        if(idx > len) {return str.substring(0, i);}
    }
    return str;
}

String.prototype.replaceAll = function(sFrom, sTo) { 
	return this.replace(new RegExp(sFrom, "g"), sTo); 
};

String.prototype.paddingZero = function(nLen) {
	var sStr = "";
	var nMax = Math.min(nLen, this.length);
	for(var i=0; i<nMax; i++) {
		sStr.concat("0");
	}
	return sStr.concat(this);
}

Number.prototype.toPx = function() {
	return this.toString() + "px";
};

Number.prototype.parsePx = function() {
	return this;
};

Number.prototype.toNumber = function() {
	return this;
};

/******Blog Common Array**************************************************************************************/
Array.prototype.shiftElement = function() {
	if(this.length == 0) return;
    for(var i=0; i<this.length-1; i++)
      this[i] = this[i+1];
    this.length--;
};

Array.prototype.last = function() {
	return this[this.length-1];
};

Array.prototype.isEmpty = function() {
	return (this.length == 0);
};

 /***Blog Append*******************************************************************************************************/
 if (!window.Element) var Element = new Object();
  Element.selectChild = function(element, tagname, classname) {
    if(!(element = element.firstChild)) return null;
    while(element && (element.nodeType != 1 || element.tagName.toLowerCase() != tagname || (classname != null && element.className.indexOf(classname) < 0))) element = element.nextSibling;
    if(element && element.nodeType == 1 && element.tagName.toLowerCase() == tagname && (classname == null || element.className.indexOf(classname) > -1)) return element;
    return null;
  }

  Element.selectSibling = function(element, tagname, classname) {
	if(!(element = element.nextSibling)) return null;
    while(element && (element.nodeType != 1 || element.tagName.toLowerCase() != tagname || (classname != null && element.className.indexOf(classname) < 0))) element = element.nextSibling;
    if(element && element.nodeType == 1 && element.tagName.toLowerCase() == tagname && (classname == null || element.className.indexOf(classname) > -1)) return element;
    return null;
  }

  Element.selectDescendants = function(element, tagname, classname) {
  	if (typeof element == "undefined" || !element) return [];
	var descendants = new Array();
	var alldescendants = element.getElementsByTagName(tagname);
	for(var i=0; i<alldescendants.length; i++) {
		if(classname == null || alldescendants[i].className.indexOf(classname) > -1) {
			descendants.push(alldescendants[i]);
		}
	}
	return descendants;
  }

if(typeof(HTMLElement) != "undefined") {
	HTMLElement.prototype.innerText;
	HTMLElement.prototype.__defineSetter__("innerText", function(sText) {
		this.textContent = sText;
	});
	HTMLElement.prototype.__defineGetter__("innerText", function() {
		try{
			return this.textContent;
		}catch(e){
			return "";
		}
	});
}