jQuery.attachShowcase={};jQuery.attachShowcase.init=function(){$(document).ready(function(){$(".attachShowcase li").hover(function(){$(this).find(".control").animate({bottom:"0"},{queue:false,duration:100});$(this).find(".preview img").addClass("hover").attr("title","");},function(){$(this).find(".control").animate({bottom:"-23px"},{queue:false,duration:100});$(this).find(".preview img").removeClass("hover").removeAttr("title");});$(".attachShowcase button").click(function(){return false;});});};jQuery.attachShowcase.init();
registerNS("mediare.article");mediare.article.AttachManager=$extend({attachments:[],filteredAttachments:{},VALUE_TOKEN:"@||@",ATTACH_TYPE:{IMAGE:1,MOVIE:2,AUDIO:3},movieIconUrl:"/image/img_video.gif",audioIconUrl:"/image/img_audio.gif",bindingObj:null,templateObj:null,currentIdx:0,maxAttachment:10,isOpenMoveLayer:false,beforeAttachIdx:-1,add:function(json,autoBinding){this.logger.debug("add called.");this.logger.debug(json);this.attachments.push(json);if(autoBinding)this.bindList();},edit:function(index,json){this.logger.debug("edit called. ["+index+"]");this.logger.debug(json);this.attachments[index]=json;this.bindList();},getNext:function(type){return this.getMove(type,1);},getPrev:function(type){return this.getMove(type,-1);},getMove:function(type,mode){this.logger.debug("getMove called.["+type+","+mode+"]");this.logger.debug(this.filteredAttachments);var arr=this.filteredAttachments[type];if(!arr){this.logger.error("filteredAttachments array not found.");this.logger.error(this.filteredAttachments);return;}
var arrIndex=this.getCurrentFilteredIndex(type);var retval=0;if(mode>0){if(arrIndex+1>=arr.length)
retval=arr[0].idx;else
retval=arr[arrIndex+1].idx;}else{if(arrIndex-1<0)
retval=arr[arr.length-1].idx;else
retval=arr[arrIndex-1].idx;}
this.logger.debug(arr);this.logger.debug("return index -> "+retval);return retval;},getCount:function(type){var total=0;for(var i=0;i<this.attachments.length;i++){if(this.attachments[i].type==type){total++;}}
return total;},getTotalCount:function(){return this.attachments.length;},getCurrentFilteredIndex:function(type){var arr=this.filteredAttachments[type];var arrIndex=null;for(var i=0;i<arr.length;i++){if(arr[i].idx==this.currentIdx){arrIndex=i;}}
return arrIndex;},remove:function(nid){var removed=false;for(var i=0;i<this.attachments.length;i++){var item=this.attachments[i];if(item!=null&&item.nid==nid){this.attachments[i]=null;removed=true;break;}}
if(removed){var newarr=[];for(var i=0;i<this.attachments.length;i++){var item=this.attachments[i];if(item!=null){item.idx=newarr.length;newarr.push(item);}}
this.attachments=newarr;}
this.positionReset();this.bindList();},open:function(t){if(t==this.ATTACH_TYPE.IMAGE){$blockUI.show({template:"SPOT/ATTACH_IMAGE_REGISTER"});}else if(t==this.ATTACH_TYPE.MOVIE){$blockUI.show({template:"SPOT/ATTACH_MOVIE_REGISTER"});}else if(t==this.ATTACH_TYPE.AUDIO){$blockUI.show({template:"SPOT/ATTACH_AUDIO_REGISTER"});}},preview:function(idx){var _self=this;if(this.attachments.length<idx){return false;}else{this.currentIdx=idx;var json=this.attachments[idx];var templatePath=null;if($(".spotdetail").length>0){if(json.type=="010"){var img=new Image();img.src=json.originsrc+"?r="+Common.getRandomInt(1000000,9999999);img.onload=function(){_self.imgSizeCheck({lw:this.width,lh:this.height},json,img);$(".ZeroClipboard").innerHTML="";$(".ZeroClipboard").remove();_self.logger.debug($(".ZeroClipboard"));if($SpotDetailManager.current_spot_trackback_url!=""){$SpotDetailManager.clip1=new ZeroClipboard.Client();$SpotDetailManager.clip1.setText($SpotDetailManager.current_spot_trackback_url);$SpotDetailManager.clip1.addEventListener('complete',$SpotDetailManager.trackbackUrlCopyComplete);$SpotDetailManager.clip1.glue('spot_trackback_url');_self.logger.debug($SpotDetailManager.clip1);}
if($SpotDetailManager.current_spot_origin_trackback_url!=""){$SpotDetailManager.clip2=new ZeroClipboard.Client();$SpotDetailManager.clip2.setText($SpotDetailManager.current_spot_origin_trackback_url);$SpotDetailManager.clip2.addEventListener('complete',$SpotDetailManager.trackbackUrlCopyComplete);$SpotDetailManager.clip2.glue('origin_trackback_url');_self.logger.debug($SpotDetailManager.clip1);}};img.onerror=function(){_self.imgSizeCheck({lw:300,lh:300},json,img);$(".ZeroClipboard").innerHTML="";$(".ZeroClipboard").remove();_self.logger.debug($(".ZeroClipboard"));if($SpotDetailManager.current_spot_trackback_url!=""){$SpotDetailManager.clip1=new ZeroClipboard.Client();$SpotDetailManager.clip1.setText($SpotDetailManager.current_spot_trackback_url);$SpotDetailManager.clip1.addEventListener('complete',$SpotDetailManager.trackbackUrlCopyComplete);$SpotDetailManager.clip1.glue('spot_trackback_url');_self.logger.debug($SpotDetailManager.clip1);}
if($SpotDetailManager.current_spot_origin_trackback_url!=""){$SpotDetailManager.clip2=new ZeroClipboard.Client();$SpotDetailManager.clip2.setText($SpotDetailManager.current_spot_origin_trackback_url);$SpotDetailManager.clip2.addEventListener('complete',$SpotDetailManager.trackbackUrlCopyComplete);$SpotDetailManager.clip2.glue('origin_trackback_url');_self.logger.debug($SpotDetailManager.clip1);}};}else if(json.type=="020"||json.type=="030"){try{_self.movieSizeCheck(json);}catch(e){_self.logger.debug(e.toString());}
$(".ZeroClipboard").innerHTML="";$(".ZeroClipboard").remove();_self.logger.debug($(".ZeroClipboard"));if($SpotDetailManager.current_spot_trackback_url!=""){$SpotDetailManager.clip1=new ZeroClipboard.Client();$SpotDetailManager.clip1.setText($SpotDetailManager.current_spot_trackback_url);$SpotDetailManager.clip1.addEventListener('complete',$SpotDetailManager.trackbackUrlCopyComplete);$SpotDetailManager.clip1.glue('spot_trackback_url');_self.logger.debug($SpotDetailManager.clip1);}
if($SpotDetailManager.current_spot_origin_trackback_url!=""){$SpotDetailManager.clip2=new ZeroClipboard.Client();$SpotDetailManager.clip2.setText($SpotDetailManager.current_spot_origin_trackback_url);$SpotDetailManager.clip2.addEventListener('complete',$SpotDetailManager.trackbackUrlCopyComplete);$SpotDetailManager.clip2.glue('origin_trackback_url');_self.logger.debug($SpotDetailManager.clip1);}}}}},imgSizeCheck:function(data,json,refImg){this.logger.debug("imgSizeCheck called.");var _self=this;refImg.onload=new Function("return false;");var gap={width:52,height:100};data.ww="500";data.wh="260";var retval={width:0,height:0};var resized=false;if(data.lw>data.ww||data.lh>data.wh){if(data.lw>data.ww){data.lh=Math.round((data.lh*data.ww)/data.lw);data.lw=data.ww;}
if(data.lh>data.wh){data.lw=Math.round((data.lw*data.wh)/data.lh);data.lh=data.wh;}
retval.width=data.lw;retval.height=data.lh;}else{retval.width=data.lw;retval.height=data.lh;}
var zoomViewHtml="<a href=\""+refImg.src+"\" onclick=\"window.open(this.href); return false;\">";zoomViewHtml+="<img src=\""+refImg.src+"\" width=\""+retval.width+"\" height=\""+retval.height+"\" alt=\""+json.title+"\" />";zoomViewHtml+="</a>";zoomViewHtml+="<p>"+json.title+"</p>"
$(".zoomViewBox .zoomView").html(zoomViewHtml);$(".zoomViewBox").show();$(".btnNewWin").show();},movieSizeCheck:function(json){this.logger.debug("movieSizeCheck function started.");var _self=this;if(!json.originsrc){this.logger.error("origin src html tags not found.");this.logger.error(json);$msg.alert("동영상 소스가 없습니다.");return;}
var movieObject=$(json.originsrc);var viewContainer=$(".zoomViewBox .zoomView").empty().append(movieObject);if(typeof(movieObject.get(0))!="undefined"){var movieDimension={width:movieObject.width(),height:movieObject.height()};viewContainer.empty();this.logger.debug("previous movieObject dimension -> "+movieObject.width()+" x "+movieObject.height()+" , "+movieObject.outerWidth()+" x "+movieObject.outerHeight());viewContainer.append(movieObject);if(!movieDimension.width)movieDimension.width=360;if(movieObject.attr("width")!=""&&movieObject.attr("height")!=""){try{this.logger.debug(movieObject);this.logger.debug("## movieObject width attribute : "+movieObject.attr("width"));this.logger.debug("## movieObject height attribute : "+movieObject.attr("height"));if(movieObject.attr("width")==undefined&&movieObject.get(0).tagName=="DIV"){this.logger.debug("## movieObject width css : "+movieObject.css("width"));this.logger.debug("## movieObject height css : "+movieObject.css("height"));movieDimension.width=parseInt(movieObject.css("width"),10)>360?360:parseInt(movieObject.css("width"),10);movieObject.attr("width",movieDimension.width);movieDimension.height=parseInt(movieObject.css("height"),10)>260?260:parseInt(movieObject.attr("height"),10);movieObject.attr("height",movieDimension.height);}else{movieDimension.width=parseInt(movieObject.attr("width"),10)>360?360:parseInt(movieObject.css("width"),10);movieObject.attr("width",movieDimension.width);movieDimension.height=parseInt(movieObject.attr("height"),10)>260?260:parseInt(movieObject.attr("height"),10);movieObject.attr("height",movieDimension.height);}
this.logger.debug("## movieObject dimension from attribute -> "+movieDimension.width+" x "+movieDimension.height+" ####");}catch(errorx){this.logger.error(errorx);}}
try{if(parseInt(movieObject.css("width"),10)<=1){movieDimension.width=360;movieObject.width(movieDimension.width);}
if(parseInt(movieObject.css("width"),10)<=1){movieDimension.height=260;movieObject.height(movieDimension.height);}
if(movieDimension.width>360){movieDimension.width=360;movieObject.width(movieDimension.width);}
if(movieDimension.height>260){movieDimension.height=260;movieObject.height(movieDimension.height);}
if(viewContainer.get(0).tagName=="embed"){viewContainer.attr("width",movieDimension.width);viewContainer.attr("height",movieDimension.height);}else if(viewContainer.find("embed").length>0){viewContainer.find("embed").attr("width",movieDimension.width);viewContainer.find("embed").attr("height",movieDimension.height);}else{viewContainer.attr("width",movieDimension.width);viewContainer.attr("height",movieDimension.height);}
this.logger.debug(movieObject);}catch(exception){this.logger.error(exception);}
viewContainer.empty().append(movieObject);_self.logger.debug("#### viewContainer result dimension -> "+viewContainer.find("embed").attr("width")+" x "+viewContainer.find("embed").attr("height")+" ####");_self.logger.debug("#### movieObject result dimension -> "+movieDimension.width+" x "+movieDimension.height+" ####");_self.logger.debug("movieObject dimension -> "+movieObject.attr("width")+" x "+movieObject.attr("height"));$(".zoomViewBox .zoomView").append("<p>"+json.title+"</p>");}else{viewContainer.append("<p>재생 할 수 없는 형식의 파일입니다.</p>")}
$(".zoomViewBox").show();if($$user.isLogin){if($notificationClient){if($notificationClient.getAllowMessage()){$notificationClient.setAllowMessage(false);}}}
this.isOpenMoveLayer=true;$(".btnNewWin").hide();},initialize:function(){this.logger.debug("initialize called.");var _self=this;this.bindingObj=$("#attShowCaseBindingarea").eq(0);this.templateObj=$("#attShowCaseTemplatearea").eq(0);this.logger.debug("bindingObject : "+this.bindingObj.length);this.logger.debug("templateObject : "+this.templateObj.length);this.bindList();},bindList:function(){var _self=this;this.logger.debug("bindList called.");this.logger.debug(this.attachments);_self.filteredAttachments={};try{this.bindingObj.empty();this.logger.debug("filteredAttachments started.");$(this.attachments).each(function(){var item=this;if(!_self.filteredAttachments[item.type])_self.filteredAttachments[item.type]=[];_self.filteredAttachments[item.type].push(item);});this.logger.debug("filteredAttachments finished.");this.logger.info(_self.filteredAttachments);if($(".spotform").length>0){var htmls="";htmls='<ul id="attShowCaseBindingarea">';$(this.attachments).each(function(i){htmls+='<li rowno="'+i+'" id="box'+i+'" class="cursor_pointer">';htmls+='<img src="'+this.src+'" width="48" height="48" alt="'+this.title+'"/>';htmls+='<div class="fileDel" id="close'+i+'" style="display:none;">';htmls+='<a href="#"><span class="ir">파일삭제</span></a>';htmls+='</div>';htmls+='</li>';});htmls+='</ul>';$("#slider").html(htmls);$("#slider").find("li").each(function(i){var jdom=$(this);var rowNo=i;var row=_self.attachments[i];_self.logger.debug("li scan started. ["+i+"]");jdom.find(".fileDel").bind("click",function(e){_self.logger.debug("fileDel click event started.");var type="remove";_self.eventClick(type,row,rowNo);return false;});jdom.bind("click",function(e){_self.logger.debug("image click event started.");var type="modify";_self.eventClick(type,row,rowNo);});jdom.bind("mouseover",function(e){_self.logger.debug("mouseover click event started.");$(this).addClass("hover");$(this).find(".fileDel").show();return false;});jdom.bind("mouseout",function(e){_self.logger.debug("mouseout click event started.");$(this).removeClass("hover");$(this).find(".fileDel").hide();return false;});_self.logger.debug("li scan finished.");});var attach_count=this.getTotalCount();$(".fileTit").find(".txt").html("<strong>"+attach_count+"</strong>개의 첨부자료가 있습니다.");}else if($(".spotdetail").length>0){Common.repeaterBind(this.bindingObj,this.templateObj,this.attachments,function(rowNo,token,row){},function(rowNo,jdom,row){jdom.bind("click",function(e){$("#attShowCaseBindingarea").find("li").each(function(i){if(row.idx!=i){$(this).removeClass("selected");}});var rowObj=$(this);if(_self.beforeAttachIdx!=-1&&_self.beforeAttachIdx==row.idx){rowObj.removeClass("selected");$attachManager.beforeAttachIdx=-1;_self.isOpenMoveLayer=false;$(".zoomViewBox .zoomView").html("");$(".zoomViewBox").hide();$(".ZeroClipboard").innerHTML="";$(".ZeroClipboard").remove();_self.logger.debug($(".ZeroClipboard"));if($SpotDetailManager.current_spot_trackback_url!=""){$SpotDetailManager.clip1=new ZeroClipboard.Client();$SpotDetailManager.clip1.setText($SpotDetailManager.current_spot_trackback_url);$SpotDetailManager.clip1.addEventListener('complete',$SpotDetailManager.trackbackUrlCopyComplete);$SpotDetailManager.clip1.glue('spot_trackback_url');_self.logger.debug($SpotDetailManager.clip1);}
if($SpotDetailManager.current_spot_origin_trackback_url!=""){$SpotDetailManager.clip2=new ZeroClipboard.Client();$SpotDetailManager.clip2.setText($SpotDetailManager.current_spot_origin_trackback_url);$SpotDetailManager.clip2.addEventListener('complete',$SpotDetailManager.trackbackUrlCopyComplete);$SpotDetailManager.clip2.glue('origin_trackback_url');_self.logger.debug($SpotDetailManager.clip1);}}else{_self.beforeAttachIdx=row.idx;rowObj.addClass("selected");_self.isOpenMoveLayer=true;_self.preview(row.idx);}
return false;});});}
if(this.attachments.length<=0){this.bindingObj.hide();$("#attachShowcase").hide();}else{this.bindingObj.show();$("#attachShowcase").show();}}catch(exception){this.logger.error(exception);}
this.setSliderDivWidth("attShowCaseBindingarea");this.showBtnLeftRight("attachNav");},animating:false,moveWidth:58,liWidth:58,MOVE_TYPE:{LEFT:0,RIGHT:1},showBtnLeftRight:function(domName){if(this.getTotalCount()>10){$("."+domName).show();}
else{$("."+domName).hide();}},setSliderDivWidth:function(domName){if(this.getTotalCount()>0)
$("#"+domName).width(this.getTotalCount()*this.liWidth);this.logger.debug("setSliderDivWidth : "+$("#"+domName).width());},moveSlider:function(t){if(this.animating)return;this.logger.debug("moveSlider started. [total item : "+this.getTotalCount()+"]");var itemCnt=this.getTotalCount();var slider=$("#slider");var leftPosStr=slider.css("left").replace(/px/gi,"");if(leftPosStr.trim()=="auto")leftPosStr="4";this.logger.debug("leftPosStr : "+leftPosStr);var currLeft=parseInt(leftPosStr,10);var _self=this;this.logger.debug("currLeft : "+currLeft);if(itemCnt<=this.maxAttachment)return;if(currLeft==4&&t==this.MOVE_TYPE.LEFT)return;if(currLeft==(-1*(this.getTotalCount()-this.maxAttachment)*this.moveWidth)+4&&t==this.MOVE_TYPE.RIGHT)return;this.animating=true;slider.animate({"left":currLeft+(((t==this.MOVE_TYPE.RIGHT)?-1:1)*this.moveWidth)},function(callback){_self.logger.debug("fiinished.");_self.animating=false;});this.logger.debug("moveSlider finnished.");},positionReset:function(t){var slider=$("#slider");slider.css("left","0px");},eventClick:function(type,row,rowNo){this.logger.debug("eventClick called. ["+type+"]");var _self=this;if(type=="modify"){var templatePath=null;if(row.type=="010"){templatePath="SPOT/ATTACH_IMAGE_MODIFY";}else if(row.type=="020"){templatePath="SPOT/ATTACH_MOVIE_MODIFY";}else{templatePath="SPOT/ATTACH_AUDIO_MODIFY";}
$blockUI.show({template:templatePath});this.logger.debug("modify resource ["+rowNo+"]");this.logger.debug(row);pagePartial.modifyLoad(rowNo,row);}else if(type=="remove"){$msg.confirm("선택하신 첨부파일을 정말로 제거하시겠습니까?",function(result){if(result){_self.logger.debug("remove media_nid : "+row.nid);_self.remove(row.nid);}});}},getValue:function(type){this.logger.debug("getValue called.");var type=(type)||"token";var retval={};var nidBuffer=[];var titleBuffer=[];for(var i=0;i<this.attachments.length;i++){var item=this.attachments[i];if(item!=null&&item.nid&&item.src&&item.title){nidBuffer.push(item.nid);titleBuffer.push(item.title);}}
if(type=="token"){retval.nid_list=nidBuffer.join(this.VALUE_TOKEN);retval.title_list=titleBuffer.join(this.VALUE_TOKEN);}else if(type=="array"){retval.nid_list=nidBuffer;retval.title_list=titleBuffer;}
this.logger.info(retval);return retval;},toString:function(){return"mediare.article.AttachManager";}},"$attachManager");$(document).ready(function(){$attachManager.initialize();});
(function($){$.jScrollPane={active:[]};$.fn.jScrollPane=function(settings)
{settings=$.extend({},$.fn.jScrollPane.defaults,settings);var rf=function(){return false;};return this.each(function()
{var $this=$(this);var paneEle=this;var currentScrollPosition=0;var paneWidth;var paneHeight;var trackHeight;var trackOffset=settings.topCapHeight;if($(this).parent().is('.jScrollPaneContainer')){currentScrollPosition=settings.maintainPosition?$this.position().top:0;var $c=$(this).parent();paneWidth=$c.innerWidth();paneHeight=$c.outerHeight();$('>.jScrollPaneTrack, >.jScrollArrowUp, >.jScrollArrowDown, >.jScrollCap',$c).remove();$this.css({'top':0});}else{$this.data('originalStyleTag',$this.attr('style'));$this.css('overflow','hidden');this.originalPadding=$this.css('paddingTop')+' '+$this.css('paddingRight')+' '+$this.css('paddingBottom')+' '+$this.css('paddingLeft');this.originalSidePaddingTotal=(parseInt($this.css('paddingLeft'))||0)+(parseInt($this.css('paddingRight'))||0);paneWidth=$this.innerWidth();paneHeight=$this.innerHeight();var $container=$('<div></div>').attr({'className':'jScrollPaneContainer'}).css({'height':paneHeight+'px','width':paneWidth+'px'});if(settings.enableKeyboardNavigation){$container.attr('tabindex',settings.tabIndex);}
$this.wrap($container);$(document).bind('emchange',function(e,cur,prev)
{$this.jScrollPane(settings);});}
trackHeight=paneHeight;if(settings.reinitialiseOnImageLoad){var $imagesToLoad=$.data(paneEle,'jScrollPaneImagesToLoad')||$('img',$this);var loadedImages=[];if($imagesToLoad.length){$imagesToLoad.each(function(i,val){$(this).bind('load readystatechange',function(){if($.inArray(i,loadedImages)==-1){loadedImages.push(val);$imagesToLoad=$.grep($imagesToLoad,function(n,i){return n!=val;});$.data(paneEle,'jScrollPaneImagesToLoad',$imagesToLoad);var s2=$.extend(settings,{reinitialiseOnImageLoad:false});$this.jScrollPane(s2);}}).each(function(i,val){if(this.complete||this.complete===undefined){this.src=this.src;}});});};}
var p=this.originalSidePaddingTotal;var realPaneWidth=paneWidth-settings.scrollbarWidth-settings.scrollbarMargin-p;if(realPaneWidth<=0){realPaneWidth=0;}
var cssToApply={'height':'auto','width':realPaneWidth+'px','paddingLeft':'0px','paddingRight':'0px'};if(settings.scrollbarOnLeft){cssToApply.paddingLeft=settings.scrollbarMargin+settings.scrollbarWidth+'px';}else{cssToApply.paddingRight=settings.scrollbarMargin+'px';}
$this.css(cssToApply);var contentHeight=$this.outerHeight();var percentInView=paneHeight/contentHeight;if(percentInView<.99){var $container=$this.parent();$container.append($('<div></div>').addClass('jScrollCap jScrollCapTop').css({height:settings.topCapHeight}),$('<div></div>').attr({'className':'jScrollPaneTrack'}).css({'width':settings.scrollbarWidth+'px'}).append($('<div></div>').attr({'className':'jScrollPaneDrag'}).css({'width':settings.scrollbarWidth+'px'}).append($('<div></div>').attr({'className':'jScrollPaneDragTop'}).css({'width':settings.scrollbarWidth+'px'}),$('<div></div>').attr({'className':'jScrollPaneDragBottom'}).css({'width':settings.scrollbarWidth+'px'}))),$('<div></div>').addClass('jScrollCap jScrollCapBottom').css({height:settings.bottomCapHeight}));var $track=$('>.jScrollPaneTrack',$container);var $drag=$('>.jScrollPaneTrack .jScrollPaneDrag',$container);var currentArrowDirection;var currentArrowTimerArr=[];var currentArrowInc;var whileArrowButtonDown=function()
{if(currentArrowInc>4||currentArrowInc%4==0){positionDrag(dragPosition+currentArrowDirection*mouseWheelMultiplier);}
currentArrowInc++;};if(settings.enableKeyboardNavigation){$container.bind('keydown.jscrollpane',function(e)
{switch(e.keyCode){case 38:currentArrowDirection=-1;currentArrowInc=0;whileArrowButtonDown();currentArrowTimerArr[currentArrowTimerArr.length]=setInterval(whileArrowButtonDown,100);return false;case 40:currentArrowDirection=1;currentArrowInc=0;whileArrowButtonDown();currentArrowTimerArr[currentArrowTimerArr.length]=setInterval(whileArrowButtonDown,100);return false;case 33:case 34:return false;default:}}).bind('keyup.jscrollpane',function(e)
{if(e.keyCode==38||e.keyCode==40){for(var i=0;i<currentArrowTimerArr.length;i++){clearInterval(currentArrowTimerArr[i]);}
return false;}});}
if(settings.showArrows){var currentArrowButton;var currentArrowInterval;var onArrowMouseUp=function(event)
{$('html').unbind('mouseup',onArrowMouseUp);currentArrowButton.removeClass('jScrollActiveArrowButton');clearInterval(currentArrowInterval);};var onArrowMouseDown=function(){$('html').bind('mouseup',onArrowMouseUp);currentArrowButton.addClass('jScrollActiveArrowButton');currentArrowInc=0;whileArrowButtonDown();currentArrowInterval=setInterval(whileArrowButtonDown,100);};$container.append($('<a></a>').attr({'href':'javascript:;','className':'jScrollArrowUp','tabindex':-1}).css({'width':settings.scrollbarWidth+'px','top':settings.topCapHeight+'px'}).html('Scroll up').bind('mousedown',function()
{currentArrowButton=$(this);currentArrowDirection=-1;onArrowMouseDown();this.blur();return false;}).bind('click',rf),$('<a></a>').attr({'href':'javascript:;','className':'jScrollArrowDown','tabindex':-1}).css({'width':settings.scrollbarWidth+'px','bottom':settings.bottomCapHeight+'px'}).html('Scroll down').bind('mousedown',function()
{currentArrowButton=$(this);currentArrowDirection=1;onArrowMouseDown();this.blur();return false;}).bind('click',rf));var $upArrow=$('>.jScrollArrowUp',$container);var $downArrow=$('>.jScrollArrowDown',$container);}
if(settings.arrowSize){trackHeight=paneHeight-settings.arrowSize-settings.arrowSize;trackOffset+=settings.arrowSize;}else if($upArrow){var topArrowHeight=$upArrow.height();settings.arrowSize=topArrowHeight;trackHeight=paneHeight-topArrowHeight-$downArrow.height();trackOffset+=topArrowHeight;}
trackHeight-=settings.topCapHeight+settings.bottomCapHeight;$track.css({'height':trackHeight+'px',top:trackOffset+'px'});var $pane=$(this).css({'position':'absolute','overflow':'visible'});var currentOffset;var maxY;var mouseWheelMultiplier;var dragPosition=0;var dragMiddle=percentInView*paneHeight/2;var getPos=function(event,c){var p=c=='X'?'Left':'Top';return event['page'+c]||(event['client'+c]+(document.documentElement['scroll'+p]||document.body['scroll'+p]))||0;};var ignoreNativeDrag=function(){return false;};var initDrag=function()
{ceaseAnimation();currentOffset=$drag.offset(false);currentOffset.top-=dragPosition;maxY=trackHeight-$drag[0].offsetHeight;mouseWheelMultiplier=2*settings.wheelSpeed*maxY/contentHeight;};var onStartDrag=function(event)
{initDrag();dragMiddle=getPos(event,'Y')-dragPosition-currentOffset.top;$('html').bind('mouseup',onStopDrag).bind('mousemove',updateScroll);if($.browser.msie){$('html').bind('dragstart',ignoreNativeDrag).bind('selectstart',ignoreNativeDrag);}
return false;};var onStopDrag=function()
{$('html').unbind('mouseup',onStopDrag).unbind('mousemove',updateScroll);dragMiddle=percentInView*paneHeight/2;if($.browser.msie){$('html').unbind('dragstart',ignoreNativeDrag).unbind('selectstart',ignoreNativeDrag);}};var positionDrag=function(destY)
{$container.scrollTop(0);destY=destY<0?0:(destY>maxY?maxY:destY);dragPosition=destY;$drag.css({'top':destY+'px'});var p=destY/maxY;$this.data('jScrollPanePosition',(paneHeight-contentHeight)*-p);$pane.css({'top':((paneHeight-contentHeight)*p)+'px'});$this.trigger('scroll');if(settings.showArrows){$upArrow[destY==0?'addClass':'removeClass']('disabled');$downArrow[destY==maxY?'addClass':'removeClass']('disabled');}};var updateScroll=function(e)
{positionDrag(getPos(e,'Y')-currentOffset.top-dragMiddle);};var dragH=Math.max(Math.min(percentInView*(paneHeight-settings.arrowSize*2),settings.dragMaxHeight),settings.dragMinHeight);$drag.css({'height':dragH+'px'}).bind('mousedown',onStartDrag);var trackScrollInterval;var trackScrollInc;var trackScrollMousePos;var doTrackScroll=function()
{if(trackScrollInc>8||trackScrollInc%4==0){positionDrag((dragPosition-((dragPosition-trackScrollMousePos)/2)));}
trackScrollInc++;};var onStopTrackClick=function()
{clearInterval(trackScrollInterval);$('html').unbind('mouseup',onStopTrackClick).unbind('mousemove',onTrackMouseMove);};var onTrackMouseMove=function(event)
{trackScrollMousePos=getPos(event,'Y')-currentOffset.top-dragMiddle;};var onTrackClick=function(event)
{initDrag();onTrackMouseMove(event);trackScrollInc=0;$('html').bind('mouseup',onStopTrackClick).bind('mousemove',onTrackMouseMove);trackScrollInterval=setInterval(doTrackScroll,100);doTrackScroll();return false;};$track.bind('mousedown',onTrackClick);$container.bind('mousewheel',function(event,delta){delta=delta||(event.wheelDelta?event.wheelDelta/120:(event.detail)?-event.detail/3:0);initDrag();ceaseAnimation();var d=dragPosition;positionDrag(dragPosition-delta*mouseWheelMultiplier);var dragOccured=d!=dragPosition;return!dragOccured;});var _animateToPosition;var _animateToInterval;function animateToPosition()
{var diff=(_animateToPosition-dragPosition)/settings.animateStep;if(diff>1||diff<-1){positionDrag(dragPosition+diff);}else{positionDrag(_animateToPosition);ceaseAnimation();}}
var ceaseAnimation=function()
{if(_animateToInterval){clearInterval(_animateToInterval);delete _animateToPosition;}};var scrollTo=function(pos,preventAni)
{if(typeof pos=="string"){$e=$(pos,$this);if(!$e.length)return;pos=$e.offset().top-$this.offset().top;}
ceaseAnimation();var maxScroll=contentHeight-paneHeight;pos=pos>maxScroll?maxScroll:pos;$this.data('jScrollPaneMaxScroll',maxScroll);var destDragPosition=pos/maxScroll*maxY;if(preventAni||!settings.animateTo){positionDrag(destDragPosition);}else{$container.scrollTop(0);_animateToPosition=destDragPosition;_animateToInterval=setInterval(animateToPosition,settings.animateInterval);}};$this[0].scrollTo=scrollTo;$this[0].scrollBy=function(delta)
{var currentPos=-parseInt($pane.css('top'))||0;scrollTo(currentPos+delta);};initDrag();scrollTo(-currentScrollPosition,true);$('*',this).bind('focus',function(event)
{var $e=$(this);var eleTop=0;while($e[0]!=$this[0]){eleTop+=$e.position().top;$e=$e.offsetParent();}
var viewportTop=-parseInt($pane.css('top'))||0;var maxVisibleEleTop=viewportTop+paneHeight;var eleInView=eleTop>viewportTop&&eleTop<maxVisibleEleTop;if(!eleInView){var destPos=eleTop-settings.scrollbarMargin;if(eleTop>viewportTop){destPos+=$(this).height()+15+settings.scrollbarMargin-paneHeight;}
scrollTo(destPos);}})
if(location.hash&&location.hash.length>1){setTimeout(function(){scrollTo(location.hash);},$.browser.safari?100:0);}
$(document).bind('click',function(e)
{$target=$(e.target);if($target.is('a')){var h=$target.attr('href');if(h&&h.substr(0,1)=='#'&&h.length>1){setTimeout(function(){scrollTo(h,!settings.animateToInternalLinks);},$.browser.safari?100:0);}}});function onSelectScrollMouseDown(e)
{$(document).bind('mousemove.jScrollPaneDragging',onTextSelectionScrollMouseMove);$(document).bind('mouseup.jScrollPaneDragging',onSelectScrollMouseUp);}
var textDragDistanceAway;var textSelectionInterval;function onTextSelectionInterval()
{direction=textDragDistanceAway<0?-1:1;$this[0].scrollBy(textDragDistanceAway/2);}
function clearTextSelectionInterval()
{if(textSelectionInterval){clearInterval(textSelectionInterval);textSelectionInterval=undefined;}}
function onTextSelectionScrollMouseMove(e)
{var offset=$this.parent().offset().top;var maxOffset=offset+paneHeight;var mouseOffset=getPos(e,'Y');textDragDistanceAway=mouseOffset<offset?mouseOffset-offset:(mouseOffset>maxOffset?mouseOffset-maxOffset:0);if(textDragDistanceAway==0){clearTextSelectionInterval();}else{if(!textSelectionInterval){textSelectionInterval=setInterval(onTextSelectionInterval,100);}}}
function onSelectScrollMouseUp(e)
{$(document).unbind('mousemove.jScrollPaneDragging').unbind('mouseup.jScrollPaneDragging');clearTextSelectionInterval();}
$container.bind('mousedown.jScrollPane',onSelectScrollMouseDown);$.jScrollPane.active.push($this[0]);}else{$this.css({'height':paneHeight+'px','width':paneWidth-this.originalSidePaddingTotal+'px','padding':this.originalPadding});$this[0].scrollTo=$this[0].scrollBy=function(){};$this.parent().unbind('mousewheel').unbind('mousedown.jScrollPane').unbind('keydown.jscrollpane').unbind('keyup.jscrollpane');}})};$.fn.jScrollPaneRemove=function()
{$(this).each(function()
{$this=$(this);var $c=$this.parent();if($c.is('.jScrollPaneContainer')){$this.css({'top':'','height':'','width':'','padding':'','overflow':'','position':''});$this.attr('style',$this.data('originalStyleTag'));$c.after($this).remove();}});}
$.fn.jScrollPane.defaults={scrollbarWidth:10,scrollbarMargin:5,wheelSpeed:18,showArrows:false,arrowSize:0,animateTo:false,dragMinHeight:1,dragMaxHeight:99999,animateInterval:100,animateStep:3,maintainPosition:true,scrollbarOnLeft:false,reinitialiseOnImageLoad:false,tabIndex:0,enableKeyboardNavigation:true,animateToInternalLinks:false,topCapHeight:0,bottomCapHeight:0};$(window).bind('unload',function(){var els=$.jScrollPane.active;for(var i=0;i<els.length;i++){els[i].scrollTo=els[i].scrollBy=null;}});})(jQuery);
registerNS("mediare.article");mediare.article.TrackbackManager=$extend({initialize:function(){this.logger.debug("initialize called.");var _self=this;},getErrorMsg:function(err_code,spot_nid,err_msg){var returnData={title:"",msg:"",content:""};if(err_code=="-300"){returnData.title="Error 300";returnData.content="해당 블로그 포스트에 태그가 없습니다.";}else if(err_code=="-303"){returnData.title="Error 303";returnData.msg="해당 블로그는 지원되지 않는 블로그입니다.";returnData.content="현재 잇글링은 티스토리와 이글루스, 다음, 네이버를 지원하고 있습니다.";}else if(err_code=="-304"){returnData.title="Error 304";returnData.msg="블로그 포스트 URL을 재확인하여 주세요.";returnData.content="블로그 연동을 허용하지 않는 블로그의 경우 잇글등록이 불가합니다.";}else if(err_code=="-305"){returnData.title="Error 305";returnData.content="해당 블로그 포스트는 이미 잇글로 등록되어 있습니다.<br/><a href=\"/spot/"+spot_nid+"\">잇글 보러가기</a>";}else if(err_code=="-307"){returnData.title="Error 307";returnData.content="해당 블로그 포스트는 이미 잇글로 등록되어 있습니다.<br/><a href=\"/spot/"+spot_nid+"\">잇글 보러가기</a>";}else if(err_code=="-308"){returnData.title="Error 308";returnData.content="해당 블로그 포스트는 이미 다른 잇글과 연결되어 있습니다.<br/><a href=\"/spot/"+spot_nid+"\">잇글 보러가기</a>";}else if(err_code=="-313"){returnData.title="Error 313";returnData.content="현재의 잇글과 같은 잇글을 윗글(아랫글)로 지정할 수 없습니다.";}else if(err_code=="-314"){returnData.title="Error 314";returnData.content="잘못된 주소이거나, 비공개 또는 삭제된 글입니다.";}else{returnData.title="Error  "+err_code;returnData.content="블로그 포스트를 연결할 수 없습니다.";}
return returnData;},toString:function(){return"mediare.article.TrackbackManager";}},"$trackbackManager");$(document).ready(function(){$trackbackManager.initialize();});
registerNS("mediare.article");mediare.article.SpotDetailManager=$extend({jsp:null,clip1:null,clip2:null,PA_MEMBER_LIST:new Hashtable(),current_reply_nid:"",MAXREPLYLENGTH:200,page:1,scale:20,current_spot_nid:"",current_spot_status_no:"",current_reply_cnt:0,current_scrap_cnt:0,current_spot_child_spot_cnt:0,current_owner_bool:false,current_spot_trackback_url:"",current_spot_origin_trackback_url:"",current_spot_member_nickname:"",current_spot_member_id:"",current_spot_member_nid:"",current_spot_title:"",current_spot_content:"",current_spot_reg_date:"",current_spot_keyword:"",current_member_status_no:"",current_parent_spot_nid:"",current_parent_member_nid:"",current_post_member_nid:"",current_post_member_id:"",current_spot_trackback_yn:"",prev_parent_member_nid:"",prev_parent_spot_nid:"",current_spot_owner_member_nid:"",referer:"",nickname_search_url:"",modify_parent_bool:false,parent_sort:"",child_sort:"",delete_reply_nid:"",firsttime_reply_open:false,reply_click_count:0,RPCURL:{LIST_SCRAP:"/spot/scraplist",INSERT_SCRAP:"/spot/scrap",DELETE_SCRAP:"/spot/deletescrap",REPLY_LIST:"/spot/replylist",INSERT_REPLY:"/microspot/insert",UPDATE_REPLY:"/microspot/update",DELETE_REPLY:"/microspot/delete",LAYER_PARENT:"/spot/listforparent",SELECT_PARENT_SPOT:"/spot/parent",INSERT_PARENT_SPOT:"/spot/insertparent",DELETE_PARENT_SPOT:"/spot/deleteparent",UPDATE_SPOT:"/spot/modify",DELETE_SPOT:"/spot/delete",CHOOSE_WRITE_TYPE:"/spot/choosetype",LIST_CHILD_SPOT:"/spot/childlist",SENDTRACKBACK:"/trackback/send",BLOGINSERT:"/spot/addCommentToBlogPost"},btnShowScrap:false,btnInsertScrap:false,btnShowReply:false,btnInsertReply:false,BeforeUpdateReplyFormValue:"",isOpenSubMenu:false,isOpenParentChildSpotList:false,initialize:function(){this.logger.debug("initialize called.");var _self=this;if(_self.current_spot_status_no=="1"){$(".rippleInfo li").each(function(){$(this).click(function(e){var tab_name="";tab_name=$(this).attr("id");if(_self.current_spot_status_no!="2"){_self.selectSession(tab_name);}
return false;});});}
$(".standardSpotRe").hide();_self.styleSession();TextUtil.eventCountingText($("#sessionreplyBox .reSizeWrite"),$("#sessionreplyBox #countArea"),_self.MAXREPLYLENGTH);$("#sessionreplyBox .reSizeWrite").bind("focus",function(){if(!$$user.loginCheck())return false;});$("#write_reply"+_self.current_spot_nid).bind("click",function(e){_self.insertReply();return false;});_self.showDeleteButton();if(_self.current_trackback_yn!="y"&&_self.current_post_member_nid!=""&&_self.current_member_status_no=="9"){var mediateBox=$(".mediatedBox");mediateBox.show();var _self=this;mediateBox.find(".mediatedBy2").hover(function(){_self.logger.debug(1);$("#mediateBoxBollon").show();},function(){_self.logger.debug(2);$("#mediateBoxBollon").hide();});mediateBox.find(".mediatedBy2").bind("click",function(){location.href="/"+_self.current_post_member_id;});}
_self.showCCLLayer();$(".viewTxt").find("a").each(function(){$(this).attr("target","_blank");});_self.selectParentSortType();_self.selectChildSortType();$(".btn_PreviewClose").bind("click",function(){$attachManager.beforeAttachIdx=-1;$attachManager.isOpenMoveLayer=false;$(".zoomViewBox .zoomView").html("");$(".zoomViewBox").hide();if($$user.isLogin){if($notificationClient){if(!$notificationClient.getAllowMessage()){$notificationClient.setAllowMessage(true);}}}
return false;});$("#btnNextSpot").click(function(e){_self.showNextSpotList();return false;});if(_self.parent_sort!=""){_self.showNextSpotList();}},showNextSpotList:function(){this.logger.debug("showNextSpotList function started");var _self=this;_self.logger.debug("_self.isOpenParentChildSpotList :: "+_self.isOpenParentChildSpotList);if(!_self.isOpenParentChildSpotList){_self.isOpenParentChildSpotList=true;$("#nextSpotArea").show();}else{_self.isOpenParentChildSpotList=false;$("#nextSpotArea").hide();return false;}
if(document.getElementById('customScroll')!=null){var scHeight=document.getElementById('customScroll').scrollHeight>79?"79px":document.getElementById('customScroll').scrollHeight;$('#customScroll').height(scHeight);_self.jsp=$('.scroll-pane').jScrollPane({showArrows:true,scrollbarWidth:11});var standardItgleBox=$('#customScroll');_self.logger.debug("standardItgleBox.find(\"li\").length :::: "+standardItgleBox.find("li").length);standardItgleBox.find("li").each(function(){$(this).bind("mouseover",function(){$(this).addClass("over");}).bind("mouseout",function(){$(this).removeClass("over");});});standardItgleBox.find('li:first-child').addClass('firstChild');standardItgleBox.find('li:last-child').addClass('lastChild');}
var ranking="";$("#customScroll").find("li").each(function(){if($(this).hasClass("selected")){ranking=$(this).attr("ranking");}});if(ranking!=""){var scrollToHeight=ranking*20;_self.jsp[0].scrollTo(scrollToHeight);}
this.logger.debug("showNextSpotList function ended");return false;},getPositionToCCL:function(){var _self=this;var baseObj=$("#contents");var iconObj=$(".ccl");var iconBody=$(".cclTip");var width=iconBody.width()/2;var height=iconBody.height();var mouseMargin={x:-width,y:-height};Common.getSubPosition(baseObj,iconObj,iconBody,mouseMargin);},showCCLLayer:function(){this.logger.debug("showCCLLayer function started");if($(".ccl")!=null){$(".ccl").hover(function(){$(".cclTip").show();},function(){$(".cclTip").hide();});}
this.logger.debug("showCCLLayer function ended");return false;},nowSelectTab:"",styleSession:function(){this.logger.debug("styleSession function started.");var _self=this;this.logger.debug("_self.current_spot_status_no ::: "+_self.current_spot_status_no);if(_self.current_spot_status_no=="1"){$(".rippleInfo").find("li").each(function(i){$(this).bind("click",function(){$(this).addClass("on");_self.nowSelectTab=$(this).attr("id");$(".rippleInfo").find("li").each(function(j){if(_self.nowSelectTab!=$(this).attr("id")){$(this).removeClass("on");}});});$(this).hover(function(){$(this).addClass("on");},function(){if(_self.nowSelectTab!=$(this).attr("id")){$(this).removeClass("on");}});});}else{$("#session1").removeClass("on");$("#session2").removeClass("on");$("#session3").removeClass("on");$("#session1").html($("#session1").find("a").html());$("#session2").html($("#session2").find("a").html());$("#session3").html($("#session3").find("a").html());}
this.logger.debug("styleSession function ended.");},selectSession:function(tab_name){this.logger.debug("selectSession function started.");var _self=this;if(_self.current_spot_status_no!="1")return false;var tab_id="";if(tab_name=="session1"){tab_id="sessionreplyBox";if(_self.current_reply_nid!=""){_self.getReplyList(true,_self.current_reply_nid);}else{var obj=$("#spotReplyBindingArea");obj.html("");_self.page=1;_self.getReplyList();}}else if(tab_name=="session2"){tab_id="sessionscrapBox";_self.showScrapList();}else if(tab_name=="session3"){tab_id="sessiontrackbackBox";}
$(".standardSpotRe").each(function(){if($(this).attr("id")==tab_id){$(this).toggle();}else{$(this).hide();}});if(tab_name=="session1"){$(".ZeroClipboard").innerHTML="";$(".ZeroClipboard").remove();$(".reSizeWrite").val("");if(_self.current_spot_status_no=="1"&&_self.current_reply_nid!=""){_self.getMoveToReplyList(_self.current_reply_nid);_self.current_reply_nid="";}}else if(tab_name=="session2"){$(".ZeroClipboard").innerHTML="";$(".ZeroClipboard").remove();}else if(tab_name=="session3"){if(_self.current_spot_trackback_url!=""){_self.clip1=new ZeroClipboard.Client();_self.clip1.setText(_self.current_spot_trackback_url);_self.clip1.addEventListener('complete',_self.trackbackUrlCopyComplete);_self.clip1.glue('spot_trackback_url');}
if(_self.current_spot_origin_trackback_url!=""){_self.clip2=new ZeroClipboard.Client();_self.clip2.setText(_self.current_spot_origin_trackback_url);_self.clip2.addEventListener('complete',_self.trackbackUrlCopyComplete);_self.clip2.glue('origin_trackback_url');}}
this.logger.debug("selectSession function ended.");},getMoveToReplyList:function(reply_nid){this.logger.debug("getMoveToReplyList function started.");var _self=this;Common.scrollToAnchorDom(reply_nid,150);$("#gleListRe"+reply_nid).css('background-color','#fff9ba').animate({backgroundColor:'#ffffff'},2000);this.logger.debug("getMoveToReplyList function ended.");},showScrapList:function(){this.logger.debug("listScrap function started.");var _self=this;if(this.btnShowScrap)return false;if(this.current_spot_nid==""){this.logger.error("empty this.current_spot_nid value.");return false;}
postdata={"spot_nid":this.current_spot_nid};$.post(_self.RPCURL.LIST_SCRAP,postdata,function(resultHtml){$("#scrapBox").html(resultHtml);$('.gleScrapBox ul li:last-child').css('background','none');_self.showDeleteButton();_self.btnShowScrap=true;});this.logger.debug("listScrap function finished.");},scrapSpotConfirm:function(){if(!$$user.loginCheck())return false;if(this.current_owner_bool){$msg.alert("자신의 잇글은 스크랩 할 수 없습니다.");return false;}
if(this.current_spot_status_no=="2"){$msg.alert("불량 잇글은 스크랩 할 수 없습니다.");return false;}
$blockUI.show({template:"SPOT/INSERT_SCRAP_CONFIRM"});return false;},scrapSpot:function(){this.logger.debug("scrapSpot function started.");var _self=this;if(_self.btnInsertScrap)return false;_self.btnInsertScrap=true;var postdata={"spot_nid":_self.current_spot_nid,"status_no":"1"};var json=$.postTEXT(_self.RPCURL.INSERT_SCRAP,postdata);if(json){var iMsg=$imsgParser(json);var rtn_code=iMsg.get("err_code");if(rtn_code=="0"){_self.current_scrap_cnt+=1;$("#scrap_cnt").html("(<strong>"+(parseInt(_self.current_scrap_cnt,"10"))+"</strong>)");_self.btnShowScrap=false;_self.showScrapList();}else if(rtn_code=="-2"){$msg.alert("이미 스크랩 하였습니다.");}else{$msg.alert("스크랩을 실패하였습니다.");}
_self.btnInsertScrap=false;};_self.logger.debug("scrapSpot function finished.");return false;},deleteScrapConfirm:function(){if(!$$user.loginCheck())return false;$blockUI.show({template:"SPOT/DELETE_SCRAP_CONFIRM"});return false;},deleteScrap:function(){this.logger.debug("deleteScrap function started.");var _self=this;if(_self.btnInsertScrap)return false;_self.btnInsertScrap=true;var postdata={"spot_nid":_self.current_spot_nid};var json=$.postTEXT(_self.RPCURL.DELETE_SCRAP,postdata);if(json){var iMsg=$imsgParser(json);var rtn_code=iMsg.get("err_code");if(rtn_code=="0"){_self.current_scrap_cnt-=1;$("#scrap_cnt").html("("+(parseInt(_self.current_scrap_cnt,"10"))+")");_self.btnShowScrap=false;_self.showScrapList();}else{$msg.alert("스크랩 삭제를 실패하였습니다.");}
_self.btnInsertScrap=false;};this.logger.debug("deleteScrap function finished.");return false;},trackbackUrlCopyComplete:function(client,text){$msg.alert("트랙백 주소가 복사되었습니다.");return false;},initiallizeReplyList:function(){this.logger.debug("initiallizeReplyList function started.");var _self=this;$("#prevReply").unbind("click");$("#nextReply").unbind("click");$("#prevReply").bind("click",function(e){_self.closeModifyReply();$(this).attr('disabled',true).css({opacity:0.4,cursor:'default'}).after('<span class="loader"><img src="/image/loader_normal.gif" alt="loading..." /></span>').blur();var obj=$("#spotReplyBindingArea");var maximum_nid="";var minimum_nid="";_self.reply_click_count++;_self.logger.debug("_self.reply_click_count"+_self.reply_click_count);if(_self.reply_click_count>=5){obj.find("div").each(function(i){if(i!=0){$(this).remove();}});maximum_nid=obj.find("div").eq(0).attr("reply_nid");minimum_nid=obj.find("div:last-child").attr("reply_nid");obj.find("div").eq(0).remove();_self.reply_click_count=0;}else{maximum_nid=obj.find("div").eq(0).attr("reply_nid");minimum_nid=obj.find("div:last-child").attr("reply_nid");}
_self.logger.debug("maximum_nid ::: "+maximum_nid);_self.logger.debug("minimum_nid ::: "+minimum_nid);_self.getReplyList(true,"","",maximum_nid,minimum_nid,"prev");return false;});$("#nextReply").bind("click",function(e){_self.closeModifyReply();$(this).attr('disabled',true).css({opacity:0.4,cursor:'default'}).after('<span class="loader"><img src="/image/loader_normal.gif" alt="loading..." /></span>').blur();var obj=$("#spotReplyBindingArea");var maximum_nid="";var minimum_nid="";_self.reply_click_count++;_self.logger.debug("_self.reply_click_count"+_self.reply_click_count);if(_self.reply_click_count>=5){obj.find("div").each(function(i){if(i!=obj.find("div").length-2){$(this).remove();}});maximum_nid=obj.find("div").eq(0).attr("reply_nid");minimum_nid=obj.find("div:last-child").attr("reply_nid");obj.find("div").eq(0).remove();_self.reply_click_count=0;}else{maximum_nid=obj.find("div").eq(0).attr("reply_nid");minimum_nid=obj.find("div:last-child").attr("reply_nid");}
_self.logger.debug("maximum_nid ::: "+maximum_nid);_self.logger.debug("minimum_nid ::: "+minimum_nid);_self.getReplyList(false,"","1",maximum_nid,minimum_nid,"next");return false;});this.logger.debug("initiallizeReplyList function ended.");},closeModifyReply:function(){var writeformObj=$("#reWriteModify"+this.BeforeUpdateReplyFormValue);var deliveryObj=$("#deliveryList"+this.BeforeUpdateReplyFormValue);writeformObj.remove();deliveryObj.remove();return false;},getReplyList:function(prevBool,reply_nid,sort_type,maximum_nid,minimum_nid,type){this.logger.debug("getReplyList function started.");var _self=this;if(this.btnShowReply)return false;_self.btnShowReply=true;if(typeof(prevBool)=="undefined")prevBool=true;if(typeof(reply_nid)=="undefined")reply_nid="";if(typeof(type)=="undefined")type="";if(typeof(sort_type)=="undefined")sort_type="2";if(typeof(maximum_nid)=="undefined")maximum_nid="";if(typeof(minimum_nid)=="undefined")minimum_nid="";var bindingObj=$("#spotReplyBindingArea");var templateObj=$("#spotReplyBindingTemplateArea");var postData={page:_self.page,scale:_self.scale,type:type,spot_nid:_self.current_spot_nid,reply_nid:reply_nid,sort_type:sort_type,maximum_nid:maximum_nid,minimum_nid:minimum_nid};var json=$.postTEXT(_self.RPCURL.REPLY_LIST,postData);if(json){var imsg=$imsgParser(json);if(imsg.getDs(0).length==0){_self.getPaJsonData(_self.current_spot_nid);var parentBindingObj=bindingObj.parent();if(reply_nid!=""){_self.page=1;_self.getReplyList();return false;}
if(bindingObj.find("div").length>0){var next_page=imsg.get("nextpage");var prev_page=imsg.get("prevpage");_self.logger.debug(" next_page ::: "+next_page);_self.logger.debug(" prev_page ::: "+prev_page);if(prev_page=="true"){$("#prevReply").show();}else{$("#prevReply").hide();}
if(next_page=="true"){$("#nextReply").show();}else{$("#nextReply").hide();}}
if(parentBindingObj.hasClass("gleReBox")){parentBindingObj.removeClass("gleReBox")
parentBindingObj.addClass("gleReEmptyBox");var emptyHtml="";emptyHtml+="<p class=\"bold\">아직 이 잇글에 달린 댓글이 없습니다.</p>";emptyHtml+="<p>"+_self.current_spot_member_nickname+" 님의 잇글에 댓글을 달아주세요.</p>";parentBindingObj.html(emptyHtml);}}else{var parentBindingObj=$("#replyBox .gleReEmptyBox");if(parentBindingObj.hasClass("gleReEmptyBox")){parentBindingObj.removeClass("gleReEmptyBox")
parentBindingObj.addClass("gleReBox");parentBindingObj.html("");var basicHtml="";basicHtml+="<div class=\"btn_morePrev\">";basicHtml+="<button type=\"button\" id=\"prevReply\"><span>&uarr;더 보기</span></button>";basicHtml+="</div>";basicHtml+="<div id=\"spotReplyBindingArea\">";basicHtml+="</div>";basicHtml+="<div class=\"btn_moreNext\">";basicHtml+="<button type=\"button\" id=\"nextReply\"><span>&uarr;더 보기</span></button>";basicHtml+="</div>";parentBindingObj.html(basicHtml);bindingObj=$("#spotReplyBindingArea");}
_self.initiallizeReplyList();_self.logger.debug(bindingObj.find("div").length);Common.repeaterBind(bindingObj,templateObj,imsg.getDs(0),function(rowNo,token,row){if(token=="reply_class_name"){var returnValue="";returnValue+="class=\"gleListRe\" id=\"gleListRe"+row.reply_nid+"\"";return returnValue;}else if(token=="profile_link_src"){var returnValue="";returnValue+="href=\"#\" onclick=\"$$linker.goMystoryMinitgle('"+row.post_member_id+"', '"+row.post_member_status_no+"', '', '');return false;\"";return returnValue;}else if(token=="profile_link_title"){var returnValue="";returnValue+="title=\"";returnValue+=row.post_member_nickname+" 님 마이스토리 가기";returnValue+="\"";return returnValue;}else if(token=="profile_link_name"){var returnValue="";returnValue+="name=\"";returnValue+=row.reply_nid
returnValue+="\"";return returnValue;}else if(token=="profile_src"){var returnValue="";returnValue+="src=\"";returnValue+=$$fn.getThumbnailFileUrl(row.post_media_src,0,26);returnValue+="\"";return returnValue;}else if(token=="profile_alt"){var returnValue="";returnValue+="alt=\"";returnValue+=row.post_member_nickname;returnValue+="\"";return returnValue;}else if(token=="reply_content"){var returnValue="";returnValue="<span id=\"reply_content\">"+TextUtil.autoLink(row.reply_content)+"</span>"
return returnValue;}else if(token=="reply_member_nickname"){return row.post_member_nickname;}else if(token=="reply_member_class"){var returnValue="";if(row.reg_kind=="1")
returnValue=$$fn.getThumbnailFileUrl("",4,0,0,row.reg_kind);if(returnValue==""){return" ";}
return returnValue;}else if(token=="pa_list"){return row.cc_member_list==""?" ":_self.setReplyCcMemberList(row.cc_member_list);}else if(token=="reg_date"){return $$fn.getDateToString(row.reg_date,"yyyy.mm.dd hh:mi");}else if(token=="modify_tools"){var returnValue="";if(row.tmpl_idx=="1"){returnValue="<span class=\"btn_modify\">";returnValue+="<button type=\"button\" onclick=\"$SpotDetailManager.showUpdateReplyForm('"+row.reply_nid+"');return false;\"><span>수정</span></button>";returnValue+="</span> ";returnValue+="<span class=\"btn_delete\">";returnValue+="<button type=\"button\" onclick=\"$SpotDetailManager.deleteReplyConfirm('"+row.reply_nid+"');return false;\"><span>삭제</span></button>";returnValue+="</span>";}else{returnValue=" ";}
return returnValue;}},function(rowNo,jdom,row){if(row.cc_member_list!=""){var cc_view_count=2;var orginalObject=jdom.find(".paInfo");var domObject=$("<span class=\"paInfo\"><dfn class=\"icon_to\"><span>To</span></dfn></span>");orginalObject.find("span").each(function(i){if(cc_view_count>=i){if(cc_view_count==i){$(this).html($(this).find("a"));}
domObject.append($(this));}else{if((cc_view_count+1)==i){var moreObject=$("<span id=\"moreCCList\" class=\"cursor_pointer\">&nbsp;<a href=\"#\">[...]</a></span>");domObject.append(moreObject);}
$(this).css({"display":"none"});domObject.append($(this));}});orginalObject.html(domObject.html());orginalObject.find("#moreCCList").each(function(){$(this).bind("click",function(e){$(this).parent().find("span").css("display","");$(this).html(", ");return false;});});jdom.find(".paInfo span:last-child").html((jdom.find(".paInfo span:last-child").find("a")));var hiddenHtml="<input type=\"hidden\" id=\"ccmemberlist"+row.reply_nid+"\" value=\""+row.cc_member_list+"\" />";jdom.append(hiddenHtml);}},prevBool,false,true);}
var dsTotalReply=imsg.getDs(1);var reply_cnt=imsg.get("reply_cnt");if(_self.current_reply_cnt!=reply_cnt){_self.current_reply_cnt=reply_cnt;var replyCntHtml="(<strong>"+_self.current_reply_cnt+"</strong>)";$("#reply_cnt").html(replyCntHtml);for(var i=0;i<dsTotalReply.length;i++){var row=dsTotalReply[i];_self.setPaJsonData(row.post_member_nid,row.post_member_id,row.post_member_nickname,row.post_media_src);}
_self.getPaJsonData(_self.current_spot_nid);}else if(!_self.firsttime_reply_open){_self.firsttime_reply_open=true;for(var i=0;i<dsTotalReply.length;i++){var row=dsTotalReply[i];_self.setPaJsonData(row.post_member_nid,row.post_member_id,row.post_member_nickname,row.post_media_src);}
_self.getPaJsonData(_self.current_spot_nid);}
_self.showDeleteButton();var next_page=imsg.get("nextpage");var prev_page=imsg.get("prevpage");$("#prevReply").attr('disabled',false).css({opacity:1.0,cursor:'pointer'}).parent().find(".loader").remove();$("#nextReply").attr('disabled',false).css({opacity:1.0,cursor:'pointer'}).parent().find(".loader").remove();_self.logger.debug(" next_page ::: "+next_page);_self.logger.debug(" prev_page ::: "+prev_page);if(prev_page=="true"){$("#prevReply").show();}else{$("#prevReply").hide();}
if(next_page=="true"){$("#nextReply").show();}else{$("#nextReply").hide();}
if(reply_nid!="")
_self.getMoveToReplyList(reply_nid);_self.btnShowReply=false;};this.logger.debug("getReplyList function ended.");},setReplyCcMemberList:function(cc_member_list){this.logger.debug("setReplyCcMemberList function started.");var _self=this;var returnValue="";var arr_cc_list={};var arr_alone_list={};if(cc_member_list!=""){arr_cc_list=cc_member_list.split(",");returnValue="<span class=\"paInfo\">";}
for(var i=0;i<arr_cc_list.length;i++){var tmp_alone_cc=arr_cc_list[i];var arr_alone_list={};arr_alone_list=tmp_alone_cc.split("/");if(arr_alone_list[0].length>2){returnValue+=" <span><a href=\""+Common.utfDecoding(arr_alone_list[3])+"\" onclick=\"window.open(this.href);return false;\"> ";returnValue+=arr_alone_list[2];returnValue+="</a>, </span> ";}else{returnValue+=" <span><a href=\"#\" onclick=\"$$linker.goMystoryMinitgle('"+arr_alone_list[1]+"', '1', '"+arr_alone_list[3]+"', '');return false;\"> ";returnValue+=arr_alone_list[2];returnValue+="</a>, </span> ";}}
if(cc_member_list!=""){returnValue+="</span>";}
this.logger.debug("setReplyCcMemberList function ended.");return returnValue;},setPaJsonData:function(member_nid,member_id,member_nickname,media_src,blog_user_id,blog_name){this.logger.debug("setPaJsonData function started.");var _self=this;if(typeof(blog_user_id)=="undefined")blog_user_id="";if(typeof(blog_name)=="undefined")blog_name="";if(!_self.PA_MEMBER_LIST.containsKey(member_nid)){var jsonData={"member_nid":member_nid,"member_id":member_id,"member_nickname":member_nickname,"member_src":media_src,"status_no":"1","search":false,"check":false,"blog_content_id":"","blog_user_id":blog_user_id,"blog_name":blog_name};_self.PA_MEMBER_LIST.put(member_nid,jsonData);}
this.logger.debug("setPaJsonData function ended.");},getPaJsonData:function(common_nid){this.logger.debug("getPaJsonData function started.");var _self=this;var keyList=_self.PA_MEMBER_LIST.getKeyList();_self.logger.debug(keyList);for(var i=0;i<keyList.length;i++){var singleData=_self.PA_MEMBER_LIST.get(keyList[i]);_self.logger.debug("singleData");_self.logger.debug(singleData);$pa.makePaListData(common_nid,singleData);}
this.logger.debug("getPaJsonData function ended.");},replyKeyUp:function(){var _self=this;var replyText=$("#reSizeWrite");var limitCount=_self.REPLYMAXLENGTH-replyText.val().trim().length;if(limitCount<=0){replyText.val(replyText.val().substring(0,_self.REPLYMAXLENGTH));}
$("#replyCountByte"+microspot_nid).html(limitCount+"자 남았습니다.");},insertReply:function(){this.logger.debug("insertReply function started.");var _self=this;if(!$$user.loginCheck())return false;if(_self.btnInsertReply)return false;if(_self.current_spot_status_no!="1")return false;var replyInsertForm=$(".reWriteForm").find(".reWriteTxt").find(".reSizeWrite");var microspot_content=replyInsertForm.val().trim();if(microspot_content==""){$msg.alert("댓글을 입력하십시오.");return false;}else if(microspot_content.length>200){$msg.alert("글자수를 초과하였습니다.");return false;}
microspot_content=Common.recoverToHtmlStr(microspot_content);var PA=null;PA=$pa.makePaInfo(_self.current_spot_nid);if(PA==false)return false;var strPaList="";if(PA!=null){strPaList=PA.cc_member_nid;}
var postData={"spot_nid":_self.current_spot_nid,"microspot_content":microspot_content,"post_blog_code":"","post_blog_url":"","cc_member_nid":strPaList,"reg_kind":"0","p_type":"2","spot_title":_self.current_spot_title,"spot_member_nid":_self.current_spot_member_nid,"spot_member_id":_self.current_spot_member_id,"spot_member_nickname":_self.current_spot_member_nickname,"post_member_nid":_self.current_spot_owner_member_nid,"cc_member_list":"","microspot_nid":""}
_self.btnInsertReply=true;var json=$.postTEXT(_self.RPCURL.INSERT_REPLY,postData);if(json){var iMsg=$imsgParser(json);var rtn_code=iMsg.get("err_code");if(rtn_code=="0"){_self.page=1;var bindingObj=$("#spotReplyBindingArea");bindingObj.html("");_self.getReplyList(true,iMsg.get("microspot_nid"));$pa.reInitPa(_self.current_spot_nid,$(".reWriteForm"));replyInsertForm.val("");_self.showDeleteButton();_self.reply_click_count=0;_self.btnInsertReply=false;return false;}else{$msg.alert(iMsg.get("err_msg"));_self.btnInsertReply=false;return false;}}
this.logger.debug("insertReply function ended.");},showUpdateReplyForm:function(reply_nid){this.logger.debug("showUpdateREplyForm function started.");var _self=this;if(_self.BeforeUpdateReplyFormValue!=""){var removeObject=$("#reWriteModify"+_self.BeforeUpdateReplyFormValue);removeObject.innerHTML="";removeObject.remove();}
$pa.reInitPa(_self.current_spot_nid,$(".reWriteForm"));_self.BeforeUpdateReplyFormValue=reply_nid;var UpdateGleListRe=$("#gleListRe"+reply_nid);var cloneReWriteTxt=$(".reWriteTxt").clone();var cloneDeliveryList=$(".deliveryList").clone();var before_cc_member_list="";var ccListObject=null;ccListObject=$("#ccmemberlist"+reply_nid);if(ccListObject.length==1)
before_cc_member_list=ccListObject.attr("value").trim();cloneReWriteTxt.attr("id","reWriteTxt"+reply_nid);cloneDeliveryList.attr("id","deliveryList"+reply_nid);cloneReWriteTxt.addClass("re");var wrapObject=$("<div class=\"reWriteModify\" id=\"reWriteModify"+reply_nid+"\"></div>");UpdateGleListRe.append(wrapObject);wrapObject.append(cloneReWriteTxt);wrapObject.append(cloneDeliveryList);cloneDeliveryList.find(".addBoxSearchForm").find(".input_addBoxSearch").attr("id","txtsearchstr"+reply_nid);cloneDeliveryList.find(".addBoxSearchForm").find("label").attr("for","txtsearchstr"+reply_nid);cloneDeliveryList.find(".addBoxSearchForm").attr("id","addBoxSearchForm"+reply_nid);cloneDeliveryList.find(".toCheckList").attr("id","toCheckList"+reply_nid);cloneDeliveryList.find(".deliveryBox").attr("id","deliveryBox"+reply_nid);cloneDeliveryList.find(".write_reply").attr("id","write_reply"+reply_nid);cloneDeliveryList.find(".addBoxSearchForm").find("label").attr("for","txtsearchstr"+reply_nid);cloneDeliveryList.find(".deliveryFoot").find("label").attr("for","all_check"+reply_nid);cloneDeliveryList.find(".deliveryFoot").find(".ckBox").attr("id","all_check"+reply_nid);cloneDeliveryList.find(".deliveryFoot").find(".friend_add").attr("id","friend_add"+reply_nid);cloneDeliveryList.find(".deliveryTit").find("p").attr("id","paCounter"+reply_nid);cloneDeliveryList.find(".toCheckList").attr("id","toCheckList"+reply_nid);cloneDeliveryList.find(".deliGo").find("label").attr("for","re_check"+reply_nid);cloneDeliveryList.find(".deliGo").find(".ckBox").attr("id","re_check"+reply_nid);cloneDeliveryList.find(".toCheckList").html("");var modifyContent="";modifyContent=UpdateGleListRe.find("#reply_content").html().trim();_self.logger.debug("before :::  "+modifyContent);modifyContent=Common.htmlStrip(modifyContent);modifyContent=Common.recoverToHtmlTag(modifyContent);_self.logger.debug("after :::  "+modifyContent);cloneReWriteTxt.find(".reSizeWrite").val(modifyContent);_self.getPaJsonData(reply_nid);cloneDeliveryList.find(".btn_complete").remove();cloneDeliveryList.find(".deliGo").find("p").append("<span class=\"btn_cancel\"><button type=\"button\"></button></span>");cloneDeliveryList.find(".deliGo").find("p").append("<span class=\"btn_modifyComplete\"><button type=\"submit\"><span>수정 완료</span> </button></span>");cloneDeliveryList.find(".btn_cancel").bind("click",function(){_self.closeModifyReply();return false;});cloneDeliveryList.find(".btn_modifyComplete").bind("click",function(e){_self.updateReply(reply_nid);return false;});$pa.initPa(_self.nickname_search_url,$("#reWriteModify"+reply_nid));_self.logger.debug(cloneReWriteTxt.find(".reSizeWrite"));_self.logger.debug(cloneDeliveryList.find("#countArea"));cloneDeliveryList.find("#countArea").html(_self.MAXREPLYLENGTH);TextUtil.eventCountingText(cloneReWriteTxt.find(".reSizeWrite"),cloneDeliveryList.find("#countArea"),_self.MAXREPLYLENGTH);cloneDeliveryList.find(".re_check").bind("click",function(e){var o=$(this);$pa.togglePaForm(e,o);});$pa.copyPaListData(_self.current_spot_nid,reply_nid,before_cc_member_list);if(before_cc_member_list!=""){$pa.makePaTo(before_cc_member_list,reply_nid);}
this.logger.debug("showUpdateREplyForm function ended.");},updateReply:function(reply_nid){this.logger.debug("updateReply function started.");var _self=this;if(!$$user.loginCheck())return false;if(_self.btnInsertReply)return false;if(_self.current_spot_status_no!="1")return false;var replyUpdateForm=$("#reWriteTxt"+reply_nid).find(".reSizeWrite");var microspot_content=replyUpdateForm.val().trim();if(microspot_content==""){$msg.alert("댓글을 입력하십시오.");return false;}else if(microspot_content.length>200){$msg.alert("글자수를 초과하였습니다.");return false;}
microspot_content=Common.recoverToHtmlStr(microspot_content);var PA=null;var PA=$pa.makePaInfo(reply_nid);if(PA==false)return false;_self.logger.debug(PA);var strPaList="";if(PA!=null){strPaList=PA.cc_member_nid;}
var ccmemberlist="";if(typeof($("#ccmemberlist"+reply_nid).val())!="undefined"){ccmemberlist=$("#ccmemberlist"+reply_nid).val();}
_self.logger.debug("ccmemberlist ::: "+ccmemberlist);var postData={"mode":"U","spot_nid":_self.current_spot_nid,"reply_nid":reply_nid,"microspot_content":microspot_content,"post_blog_code":"","post_blog_url":"","cc_member_nid":strPaList,"old_cc_member_list":ccmemberlist,"reg_kind":"0","p_type":"2","spot_title":_self.current_spot_title,"spot_member_nid":_self.current_spot_member_nid,"spot_member_id":_self.current_spot_member_id,"spot_member_nickname":_self.current_spot_member_nickname};_self.btnInsertReply=true;var json=$.postTEXT(_self.RPCURL.UPDATE_REPLY,postData);if(json){var iMsg=$imsgParser(json);var rtn_code=iMsg.get("err_code");if(rtn_code=="0"){var bindingObj=$("#spotReplyBindingArea");bindingObj.html("");_self.getReplyList(true,iMsg.get("microspot_nid"));$pa.reInitPa(_self.current_spot_nid,$(".reWriteForm"));replyUpdateForm.val("");_self.reply_click_count=0;_self.btnInsertReply=false;return false;}else{$msg.alert(iMsg.get("err_msg"));_self.btnInsertReply=false;return false;}}
this.logger.debug("updateReply function ended.");},deleteReplyConfirm:function(reply_nid){if(!$$user.loginCheck())return false;this.delete_reply_nid=reply_nid;$blockUI.show({template:"SPOT/DELETE_COMMENT_CONFIRM"});return false;},deleteReply:function(){this.logger.debug("deleteReply function started.");var _self=this;if(!$$user.loginCheck())return false;if(_self.btnInsertReply)return false;var postData={"reply_nid":_self.delete_reply_nid,"spot_nid":_self.current_spot_nid,"p_type":"2"};_self.btnInsertReply=true;var json=$.postTEXT(_self.RPCURL.DELETE_REPLY,postData);if(json){var iMsg=$imsgParser(json);var rtn_code=iMsg.get("err_code");if(rtn_code=="0"){var bindingObj=$("#spotReplyBindingArea");bindingObj.find("div").each(function(){if($(this).attr("reply_nid")==_self.delete_reply_nid){$(this).remove();}});$pa.reInitPa(_self.current_spot_nid,$(".reWriteForm"));_self.showDeleteButton();_self.current_reply_cnt=parseInt(_self.current_reply_cnt,"10")-1;$("#reply_cnt").html("(<strong>"+_self.current_reply_cnt+"</strong>)");_self.reply_click_count=0;if(_self.current_reply_cnt==0){_self.getReplyList();}
_self.btnInsertReply=false;return false;}else{$msg.alert(iMsg.get("err_msg"));_self.btnInsertReply=false;return false;}}
this.logger.debug("deleteReply function finished.");return false;},updateSpot:function(){if(!$$user.loginCheck())return false;var url=this.RPCURL.UPDATE_SPOT+"?spot_nid="+this.current_spot_nid;document.location.href=url;},checkDeleteSpot:function(){this.logger.debug("checkDeleteSpot function started.");var _self=this;if(!$$user.loginCheck())return false;if(this.current_reply_cnt!=0||this.current_scrap_cnt!=0&&this.current_spot_child_spot_cnt!=0){$msg.alert("아직 아랫글이나 스크랩글 또는 댓글이 존재 합니다.\n 다시 확인해 주세요.")
return false;}
$blockUI.show({template:"SPOT/DELETE_SPOT_CONFIRM"});this.logger.debug("checkDeleteSpot function ended.");return false;},deleteSpot:function(){this.logger.debug("deleteSpot function started.");var _self=this;if(!$$user.loginCheck())return false;var postdata={"spot_nid":_self.current_spot_nid};var json=$.postTEXT(_self.RPCURL.DELETE_SPOT,postdata);if(json){var iMsg=$imsgParser(json);var rtn_code=iMsg.get("err_code");if(rtn_code=="0"){$blockUI.show({template:"SPOT/DELETE_SPOT_SUCCESS"});return false;}else{$blockUI.show({template:"SPOT/DELETE_SPOT_FAIL"});return false;}};this.logger.debug("deleteSpot function ended.");},insertBadSpot:function(){this.logger.debug("insertBadSpot function started.");var _self=this;if(!$$user.loginCheck())return false;$blockUI.show({template:"SPOT/INSERT_BAD_SPOT"});pagePartial.pageInitialize({title:_self.current_spot_title,nick:_self.current_spot_member_nickname,date:_self.current_spot_reg_date,spot_nid:_self.current_spot_nid});this.logger.debug("insertBadSpot function ended.");},showLayerForInsertParent:function(modify_parent_bool){this.logger.debug("showLayerForInsertParent function started.");this.closeAttachLayer();$blockUI.show({url:this.RPCURL.LAYER_PARENT+"?spot_nid="+this.current_spot_nid+"&current_page=spotdetail",size:{width:400}});$blockUI.reposition();this.modify_parent_bool=modify_parent_bool;this.logger.debug("showLayerForInsertParent function ended.");return false;},insertParentSpot:function(parent_spot_nid,parent_member_nid,trackback_url){this.logger.debug("insertParentSpot function started.");if(!$$user.loginCheck())return false;var _self=this;var postData={"spot_nid":_self.current_spot_nid,"parent_spot_nid":parent_spot_nid,"parent_member_nid":parent_member_nid,"prev_parent_spot_nid":_self.prev_parent_spot_nid,"prev_parent_member_nid":_self.prev_parent_member_nid,"trackback_url":trackback_url};var json=$.postTEXT(_self.RPCURL.INSERT_PARENT_SPOT,postData);if(json){var iMsg=$imsgParser(json);var rtn_code=iMsg.get("err_code");if(rtn_code=="0"){if(trackback_url!="")
_self.sendTrackback(_self.current_spot_nid,_self.current_spot_title,_self.current_spot_content,_self.current_spot_member_nickname,trackback_url);_self.prev_parent_member_nid=parent_member_nid;_self.prev_parent_spot_nid=parent_spot_nid;if(_self.modify_parent_bool){$msg.alert({title:"윗글 변경",content:"윗글 변경이 완료되었습니다."});}else{$msg.alert({title:"윗글 등록",content:"윗글이 등록되었습니다."});}
_self.current_parent_spot_nid=parent_spot_nid;_self.getParentInfo();}else{$msg.alert(iMsg.get("err_msg"));return false;}};this.logger.debug("insertParentSpot function finished.");},sendTrackback:function(spot_nid,spot_title,spot_content,member_nickname,trackback_url){this.logger.debug("sendTrackback function started.");var _self=this;var sendData={"spot_nid":spot_nid,"spot_title":spot_title,"spot_content":Common.htmlStrip(spot_content).replaceAll("\r"," ").replaceAll("\n"," "),"blog_name":member_nickname,"trackback_url":trackback_url};$.postJSON(_self.RPCURL.SENDTRACKBACK,sendData,function(json){});this.logger.debug("sendTrackback function ended.");},getParentInfo:function(){this.logger.debug("getParentInfo function started.");var _self=this;var postdata={"current_page":"spotdetail","parent_spot_nid":_self.current_parent_spot_nid,"spot_nid":_self.current_spot_nid,"sort_type":_self.parent_sort};$.post(_self.RPCURL.SELECT_PARENT_SPOT,postdata,function(resultHtml){$("#parentSpot").html(resultHtml);_self.isOpenParentChildSpotList=false;_self.showNextSpotList();$("#btnNextSpot").click(function(e){_self.showNextSpotList();return false;});_self.selectParentSortType();});this.logger.debug("getParentInfo function started.");},deleteParentSpot:function(parent_spot_nid,parent_member_nid){this.logger.debug("deleteParentSpot function started.");if(!$$user.loginCheck())return false;var _self=this;$msg.confirm("윗글과의 연결을 삭제하시겠습니까?",function(result){if(result){var postdata={"spot_nid":_self.current_spot_nid,"prev_parent_spot_nid":parent_spot_nid,"prev_parent_member_nid":parent_member_nid};var json=$.postTEXT(_self.RPCURL.DELETE_PARENT_SPOT,postdata);if(json){var iMsg=$imsgParser(json);var rtn_code=iMsg.get("err_code");if(rtn_code=="0"){_self.prev_parent_member_nid="";_self.prev_parent_spot_nid="";postdata={"current_page":"spotdetail","parent_spot_nid":""};$.post(_self.RPCURL.SELECT_PARENT_SPOT,postdata,function(resultHtml){_self.logger.debug(resultHtml);$("#parentSpot").html(resultHtml);_self.current_parent_spot_nid="";});}else{$msg.alert("연결된 윗글 삭제를 실패하였습니다.");return false;}};}});this.logger.debug("deleteParentSpot function finished.");return false;},showConntetChildSpotLayer:function(){if(!$$user.loginCheck())return false;this.closeAttachLayer();$blockUI.show({url:this.RPCURL.CHOOSE_WRITE_TYPE+"?parent_spot_nid="+this.current_spot_nid});},insertChildSpot:function(sub_spot_nid,spot_title,excerpt,blog_name){this.logger.debug("insertChildSpot function started.");if(!$$user.loginCheck())return false;var _self=this;var postdata={"spot_nid":sub_spot_nid,"parent_spot_nid":_self.current_spot_nid,"parent_member_nid":_self.current_spot_member_nid};var json=$.postTEXT(_self.RPCURL.INSERT_PARENT_SPOT,postdata);if(json){var iMsg=$imsgParser(json);var rtn_code=iMsg.get("err_code");if(rtn_code=="0"){_self.insertChildSpotCallBack(sub_spot_nid,spot_title,excerpt,blog_name);}else{$msg.alert(iMsg.get("err_msg"));return false;}};this.logger.debug("insertChildSpot function finished.");return false;},insertChildSpotCallBack:function(sub_spot_nid,spot_title,excerpt,blog_name){this.logger.debug("insertChildSpotCallBack function started.");var _self=this;if(_self.current_spot_origin_trackback_url!=""){var trackbackData={"spot_nid":sub_spot_nid,"spot_title":spot_title,"spot_content":Common.htmlStrip(excerpt).replaceAll("\r"," ").replaceAll("\n"," "),"blog_name":blog_name,"trackback_url":_self.current_spot_origin_trackback_url};var json=$.postTEXT(_self.RPCURL.SENDTRACKBACK,trackbackData);if(json){iMsg=$imsgParser(json);rtn_code=iMsg.get("err_code");if(rtn_code=="0"){$msg.alert({title:"아랫글 연결",content:"아랫글 연결이 완료 되었습니다.<br /><a href=\"/spot/4199\" onclick=\"window.open(this.href); return false;\">트랙백을 이용한 윗글 변경</a>"});}else{_self.logger.debug("[TRACKBACK SEND FAIL]");return false;}};}else{$msg.alert({title:"아랫글 연결",content:"아랫글 연결이 완료 되었습니다."});}
_self.current_spot_child_spot_cnt=_self.current_spot_child_spot_cnt+1;_self.showDeleteButton();_self.getChildSpotList();this.logger.debug("insertChildSpotCallBack function ended.");return false;},getChildSpotList:function(){this.logger.debug("getChildSpotList function started.");var _self=this;var postdata={"spot_nid":_self.current_spot_nid,"sort_type":_self.child_sort};$.post(_self.RPCURL.LIST_CHILD_SPOT,postdata,function(resultHtml){$("#childItgleList").html(resultHtml);_self.selectChildSortType();});this.logger.debug("getChildSpotList function started.");},goPreviousPage:function(){var url=(this.referer=="")?"/":this.referer;document.location.href=url;return false;},showDeleteButton:function(){var btnDel=$("#btnDel");this.logger.debug("current_reply_cnt : "+this.current_reply_cnt);this.logger.debug("current_scrap_cnt : "+this.current_scrap_cnt);this.logger.debug("current_spot_child_spot_cnt : "+this.current_spot_child_spot_cnt);if(btnDel.length>0){if(this.current_reply_cnt==0&&this.current_scrap_cnt==0&&this.current_spot_child_spot_cnt==0){btnDel.show();}else{btnDel.hide();}}},closeAttachLayer:function(){this.logger.debug("closeAttachLayer function started.");var _self=this;_self.logger.debug($(".zoomViewBox").length);if($(".zoomViewBox").length>0){$(".zoomViewBox .zoomView").html("");$(".zoomViewBox").hide();$attachManager.beforeAttachIdx=-1;}
$(".ZeroClipboard").innerHTML="";$(".ZeroClipboard").remove();if($SpotDetailManager.current_spot_trackback_url!=""){$SpotDetailManager.clip1=new ZeroClipboard.Client();$SpotDetailManager.clip1.setText($SpotDetailManager.current_spot_trackback_url);$SpotDetailManager.clip1.addEventListener('complete',$SpotDetailManager.trackbackUrlCopyComplete);$SpotDetailManager.clip1.glue('spot_trackback_url');_self.logger.debug($SpotDetailManager.clip1);}
if($SpotDetailManager.current_spot_origin_trackback_url!=""){$SpotDetailManager.clip2=new ZeroClipboard.Client();$SpotDetailManager.clip2.setText($SpotDetailManager.current_spot_origin_trackback_url);$SpotDetailManager.clip2.addEventListener('complete',$SpotDetailManager.trackbackUrlCopyComplete);$SpotDetailManager.clip2.glue('origin_trackback_url');_self.logger.debug($SpotDetailManager.clip1);}
this.logger.debug("closeAttachLayer function ended.");},selectParentSortType:function(){var _self=this;var selectObj=$("#parentSortType");selectObj.bind("click",function(){$(this).find("li").each(function(i){$(this).bind("click",function(e){var sort_name=$(this).find("a").html();$(this).parent().find("p").empty().html(sort_name);selectObj.hide();if($(this).find("a").attr("tabindex")=="1"){_self.setSortType(true,1);}else{_self.setSortType(true,2);}
return false;});});$(this).find(".methodItgleList").toggle();});},selectChildSortType:function(){var _self=this;var selectObj=$("#childSortType");selectObj.bind("click",function(){$(this).find("li").each(function(i){$(this).bind("click",function(e){var sort_name=$(this).find("a").html();$(this).parent().find("p").empty().html(sort_name);selectObj.hide();if($(this).find("a").attr("tabindex")=="1"){_self.setSortType(false,1);}else{_self.setSortType(false,2);}
return false;});});$(this).find(".methodItgleList").toggle();});},goThisPlaceUrl:function(url,parentBool){var _self=this;if(parentBool){if(_self.parent_sort==""){url=url+""+"?parent_sort=1";}else{url=url+""+"?parent_sort="+this.parent_sort;}}else{if(_self.child_sort==""){url=url+""+"?parent_sort=1";}else{url=url+""+"?parent_sort="+this.child_sort;}}
location.href=url;},setSortType:function(parentBool,sortType){this.logger.debug("setSortType function started.");var _self=this;if(parentBool){_self.parent_sort=sortType;_self.getParentInfo();}else{_self.child_sort=sortType;_self.getChildSpotList();}
this.logger.debug("setSortType function ended.");},toString:function(){return"mediare.article.SpotDetailManager";}},"$SpotDetailManager");
var ZeroClipboard={version:"1.0.4",clients:{},moviePath:'/js/ZeroClipboard.swf',nextId:1,$:function(thingy){if(typeof(thingy)=='string')thingy=document.getElementById(thingy);if(!thingy.addClass){thingy.hide=function(){this.style.display='none';};thingy.show=function(){this.style.display='';};thingy.addClass=function(name){this.removeClass(name);this.className+=' '+name;};thingy.removeClass=function(name){this.className=this.className.replace(new RegExp("\\s*"+name+"\\s*")," ").replace(/^\s+/,'').replace(/\s+$/,'');};thingy.hasClass=function(name){return!!this.className.match(new RegExp("\\s*"+name+"\\s*"));}}
return thingy;},setMoviePath:function(path){this.moviePath=path;},dispatch:function(id,eventName,args){var client=this.clients[id];if(client){client.receiveEvent(eventName,args);}},register:function(id,client){this.clients[id]=client;},getDOMObjectPosition:function(obj){var info={left:0,top:0,width:obj.width?obj.width:obj.offsetWidth,height:obj.height?obj.height:obj.offsetHeight};while(obj){info.left+=obj.offsetLeft;info.top+=obj.offsetTop;obj=obj.offsetParent;}
return info;},Client:function(elem){this.handlers={};this.id=ZeroClipboard.nextId++;this.movieId='ZeroClipboardMovie_'+this.id;ZeroClipboard.register(this.id,this);if(elem)this.glue(elem);}};ZeroClipboard.Client.prototype={id:0,ready:false,movie:null,clipText:'',handCursorEnabled:true,cssEffects:true,handlers:null,glue:function(elem){this.domElement=ZeroClipboard.$(elem);var zIndex=99;if(this.domElement.style.zIndex){zIndex=parseInt(this.domElement.style.zIndex)+1;}
var box=ZeroClipboard.getDOMObjectPosition(this.domElement);this.div=document.createElement('div');var style=this.div.style;style.position='absolute';style.left=''+box.left+'px';style.top=''+box.top+'px';style.width=''+box.width+'px';style.height=''+box.height+'px';style.zIndex=zIndex;this.div.className="ZeroClipboard";var body=document.getElementsByTagName('body')[0];body.appendChild(this.div);this.div.innerHTML=this.getHTML(box.width,box.height);},getHTML:function(width,height){var html='';var flashvars='id='+this.id+'&width='+width+'&height='+height;if(navigator.userAgent.match(/MSIE/)){var protocol=location.href.match(/^https/i)?'https://':'http://';html+='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+protocol+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+width+'" height="'+height+'" id="'+this.movieId+'" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+ZeroClipboard.moviePath+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="'+flashvars+'"/><param name="wmode" value="transparent"/></object>';}
else{html+='<embed id="'+this.movieId+'" src="'+ZeroClipboard.moviePath+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="'+width+'" height="'+height+'" name="'+this.movieId+'" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+flashvars+'" wmode="transparent" />';}
return html;},hide:function(){if(this.div){this.div.style.left='-2000px';}},show:function(){this.reposition();},destroy:function(){if(this.domElement&&this.div){this.hide();this.div.innerHTML='';var body=document.getElementsByTagName('body')[0];try{body.removeChild(this.div);}catch(e){;}
this.domElement=null;this.div=null;}},reposition:function(elem){if(elem){this.domElement=ZeroClipboard.$(elem);if(!this.domElement)this.hide();}
if(this.domElement&&this.div){var box=ZeroClipboard.getDOMObjectPosition(this.domElement);var style=this.div.style;style.left=''+box.left+'px';style.top=''+box.top+'px';}},setText:function(newText){this.clipText=newText;if(this.ready)this.movie.setText(newText);},addEventListener:function(eventName,func){eventName=eventName.toString().toLowerCase().replace(/^on/,'');if(!this.handlers[eventName])this.handlers[eventName]=[];this.handlers[eventName].push(func);},setHandCursor:function(enabled){this.handCursorEnabled=enabled;if(this.ready)this.movie.setHandCursor(enabled);},setCSSEffects:function(enabled){this.cssEffects=!!enabled;},receiveEvent:function(eventName,args){eventName=eventName.toString().toLowerCase().replace(/^on/,'');switch(eventName){case'load':this.movie=document.getElementById(this.movieId);if(!this.movie){var self=this;setTimeout(function(){self.receiveEvent('load',null);},1);return;}
if(!this.ready&&navigator.userAgent.match(/Firefox/)&&navigator.userAgent.match(/Windows/)){var self=this;setTimeout(function(){self.receiveEvent('load',null);},100);this.ready=true;return;}
this.ready=true;this.movie.setText(this.clipText);this.movie.setHandCursor(this.handCursorEnabled);break;case'mouseover':if(this.domElement&&this.cssEffects){this.domElement.addClass('hover');if(this.recoverActive)this.domElement.addClass('active');}
break;case'mouseout':if(this.domElement&&this.cssEffects){this.recoverActive=false;if(this.domElement.hasClass('active')){this.domElement.removeClass('active');this.recoverActive=true;}
this.domElement.removeClass('hover');}
break;case'mousedown':if(this.domElement&&this.cssEffects){this.domElement.addClass('active');}
break;case'mouseup':if(this.domElement&&this.cssEffects){this.domElement.removeClass('active');this.recoverActive=false;}
break;}
if(this.handlers[eventName]){for(var idx=0,len=this.handlers[eventName].length;idx<len;idx++){var func=this.handlers[eventName][idx];if(typeof(func)=='function'){func(this,args);}
else if((typeof(func)=='object')&&(func.length==2)){func[0][func[1]](this,args);}
else if(typeof(func)=='string'){window[func](this,args);}}}}};