/**
 * http://ajaxui.nhndesign.com/svn/Jindo_Component/Component/tags/0.2.3/component.js
 * http://ajaxui.nhndesign.com/svn/Jindo_Component/LayerManager/tags/0.4.4/layermanager.js
 * http://ajaxui.nhndesign.com/svn/Jindo_Component/LayerPosition/tags/0.1.5/LayerPosition.js
 * http://ajaxui.nhndesign.com/svn/Jindo_Component/Transition/tags/0.3.1/transition.js
 * http://ajaxui.nhndesign.com/svn/Jindo_Component/Timer/tags/0.3/timer.js
 * http://ajaxui.nhndesign.com/svn/Jindo_Component/Effect/tags/0.3/effect.js
 * http://ajaxui.nhndesign.com/svn/Jindo_Component/ToolTip/tags/0.3.2/tooltip.js
 * http://ajaxui.nhndesign.com/svn/Jindo_Component/DragArea/tags/0.3.4/dragarea.js
 */


﻿
if(typeof jindo=="undefined"){jindo={};jindo.$Class=$Class;jindo.$Event=$Event;jindo.$H=$H;jindo.$Fn=$Fn;}
nhn.Component=jindo.$Class({_eventHandlers:null,_options:null,$init:function(){var ins=this.constructor._instances;if(typeof ins=="undefined"){this.constructor._instances=ins=[];}
ins[ins.length]=this;this._eventHandlers={};this._options={};this._options._setters={};},option:function(sName,sValue){var nameType=(typeof sName);if(nameType=="undefined"){return this._options;}else if(nameType=="string"){if(typeof sValue!="undefined"){this._options[sName]=sValue;if(typeof this._options._setters[sName]=="function"){this._options._setters[sName](sValue);}
return this;}else{return this._options[sName];}}else if(nameType=="object"){try{for(var x in sName){this._options[x]=sName[x];if(typeof this._options._setters[x]=="function"){this._options._setters[x](sName[x]);}}}catch(e){}
return this;}},optionSetter:function(sName,fSetter){var nameType=(typeof sName);if(nameType=="undefined"){return this._options._setters;}else if(nameType=="string"){if(typeof fSetter!="undefined"){this._options._setters[sName]=jindo.$Fn(fSetter,this).bind();return this;}else{return this._options._setters[sName];}}else if(nameType=="object"){try{for(var x in sName){this._options._setters[x]=jindo.$Fn(sName[x],this).bind();}}catch(e){}
return this;}},fireEvent:function(sEvent,oEvent){var oEvent=oEvent?(oEvent instanceof jindo.$Event?oEvent._event:oEvent):{};var inlineHandler=this['on'+sEvent];var handlerList=this._eventHandlers[sEvent];var bHasInlineHandler=typeof inlineHandler=='function';var bHasHandlerList=typeof handlerList!='undefined';if(!bHasInlineHandler&&!bHasHandlerList)return true;handlerList=handlerList.concat();var isRealEvent=(function(oEvent){try{if(oEvent instanceof Event)return true;}catch(x){}
try{if(oEvent instanceof MouseEvent)return true;}catch(x){}
try{if(oEvent instanceof KeyEvent)return true;}catch(x){}
try{if(('cancelBubble'in oEvent||'preventBubble'in oEvent)&&'type'in oEvent)return true;}catch(x){}
return false;})(oEvent);if(!isRealEvent){try{if(typeof oEvent._extends=='undefined'){oEvent._extends=[];oEvent.stop=function(){if(oEvent._extends.length>0){oEvent._extends[oEvent._extends.length-1].canceled=true;}};}
oEvent._extends.push({type:sEvent,canceled:false});oEvent.type=sEvent;}catch(e){isRealEvent=true;}}
if(isRealEvent)oEvent=jindo.$Event(oEvent);var aArg=[oEvent];for(var i=2,len=arguments.length;i<len;i++)
aArg.push(arguments[i]);if(bHasInlineHandler)inlineHandler.apply(this,aArg);if(bHasHandlerList)
for(var i=0,handler;handler=handlerList[i];i++){handler.apply(this,aArg);}
if(isRealEvent)return!oEvent.canceled;var oPopedEvent=oEvent._extends.pop();return!oPopedEvent.canceled;},attach:function(sEvent,fHandler){if(arguments.length==1){jindo.$H(arguments[0]).forEach(jindo.$Fn(function(fHandler,sEvent){this.attach(sEvent,fHandler);},this).bind());return this;}
var handlers=this._eventHandlers[sEvent];if(typeof handlers=='undefined')
handlers=this._eventHandlers[sEvent]=[];handlers.push(fHandler);return this;},detach:function(sEvent,fHandler){if(arguments.length==1){jindo.$H(arguments[0]).forEach($Fn(function(fHandler,sEvent){this.detach(sEvent,fHandler);},this).bind());return this;}
var handlers=this._eventHandlers[sEvent];if(typeof handlers=='undefined')return this;for(var i=0,handler;handler=handlers[i];i++){if(handler===fHandler){handlers=handlers.splice(i,1);break;}}
return this;},detachAll:function(sEvent){var handlers=this._eventHandlers;if(arguments.length){if(typeof handlers[sEvent]=='undefined')return this;delete handlers[sEvent];return this;}
for(var o in handlers){delete handlers[o];}
return this;}});nhn.Component.factory=function(aObject,oOption){var aReturn=[];if(typeof oOption=="undefined")oOption={};for(var i=0;i<aObject.length;i++){try{oInstance=new this(aObject[i],oOption);aReturn[aReturn.length]=oInstance;}catch(e){}}
return aReturn;};nhn.LayerManager=jindo.$Class({_bIsActivating:false,_bIsLayerVisible:false,_bIsHiding:false,_bIsShowing:false,_aLinks:null,_oTimer:null,$init:function(el,oOptions){this.option({checkEvent:'mousedown',showDelay:0,hideDelay:100,visibleCallback:function(){return jindo.$Element(this.getLayer()).visible();}});this.option(oOptions||{});this._el=$(el);this._aLinks=[];this._oTimer=new nhn.Timer();this._wfOnEvent=jindo.$Fn(this._onEvent,this);this.getVisible();this.activate();},isActivating:function(){return this._bIsActivating;},activate:function(){if(this.isActivating()){return;}
this._wfOnEvent.attach(document,this.option('checkEvent'));this._bIsActivating=true;},deactivate:function(){if(!this.isActivating()){return;}
this._wfOnEvent.detach(document,this.option('checkEvent'));this._bIsActivating=false;},getVisible:function(){return this._bIsLayerVisible=this.option('visibleCallback').call(this)?true:false;},_check:function(oEl){var eEl=jindo.$Element(oEl);for(var i=0,oLink;oLink=this._aLinks[i];i++){oLink=jindo.$Element(oLink).$value();if(oLink&&(oEl==oLink||eEl.isChildOf(oLink)))
return true;}
return false;},_find:function(oEl){for(var i=0,oLink;oLink=this._aLinks[i];i++)
if(oLink==oEl)
return i;return-1;},getLayer:function(){return this._el;},setLayer:function(el){this._el=el;},getLinks:function(){return this._aLinks;},setLinks:function(a){this._aLinks=$A(a).unique().$value();return this;},link:function(oEl){if(arguments.length>1){for(var i=0,len=arguments.length;i<len;i++)
this.link(arguments[i]);return this;}
if(this._find(oEl)!=-1)
return this;this._aLinks.push(oEl);return this;},unlink:function(oEl){if(arguments.length>1){for(var i=0,len=arguments.length;i<len;i++)
this.unlink(arguments[i]);return this;}
var nIndex=this._find(oEl);if(nIndex==-1)
return this;this._aLinks.splice(nIndex,1);return this;},show:function(nDelay){if(this.getVisible()){return this;}
var self=this;if(typeof nDelay=='undefined')
nDelay=this.option('showDelay');var fRun=function(){var elLayer=self.getLayer();if(self.fireEvent('beforeshow',{element:elLayer,linkedList:self._aLinks})){jindo.$Element(elLayer).show();self.fireEvent('show',{element:elLayer,linkedList:self._aLinks});self._bIsShowing=false;}
else{return;}
var sGroup=self.option('group');if(!sGroup)
return;var aInstances=self.constructor._instances;for(var i=0,len=aInstances.length;i<len;i++){var oInst=aInstances[i];if(oInst!==self&&oInst.option('group')==sGroup)
oInst.hide();}};this._bIsShowing=true;this._bIsHiding=false;if(nDelay){this._oTimer.start(fRun,nDelay);}else{this._oTimer.abort();fRun();}
return this;},hide:function(nDelay){if(!this.getVisible()){return this;}
var self=this;if(typeof nDelay=='undefined'){nDelay=this.option('hideDelay');}
var fRun=function(){var elLayer=self.getLayer();if(self.fireEvent('beforehide',{element:elLayer,linkedList:self._aLinks})){jindo.$Element(elLayer).hide();self.fireEvent('hide',{element:elLayer,linkedList:self._aLinks});self._bIsHiding=false;}};this._bIsShowing=false;this._bIsHiding=true;if(nDelay){this._oTimer.start(fRun,nDelay);}else{this._oTimer.abort();fRun();}
return this;},toggle:function(nDelay){return this[this.getVisible()?'hide':'show'](nDelay);},_onEvent:function(e){var self=this;setTimeout(function(){if(!self.getVisible()){return;}
var el=e.element;if(self._check(el)){if(!self._bIsHiding||!self._bIsShowing){self.fireEvent("ignore",{event:e});self._oTimer.abort();return;}}
if(typeof el.tagName!="undefined"){self.hide();}},this.option('hideDelay'));}}).extend(nhn.Component);nhn.LayerPosition=jindo.$Class({$init:function(el,elLayer,oOption){this.option({position:"outside-bottom",align:"left",valign:"",top:0,left:0,auto:false});this.option(oOption||{});this.setElement(el);this.setLayer(elLayer);if(el&&elLayer){this.setPosition();}},getElement:function(){return this._el;},setElement:function(el){this._el=jindo.$(el);return this;},getLayer:function(){return this._elLayer;},setLayer:function(elLayer){this._elLayer=jindo.$(elLayer);return this;},getPosition:function(oOption){if(typeof oOption!="object"){var oOption=this.option();}
function isPosition(sPosition){if(oOption.position.indexOf(sPosition)>-1){return true;}
return false;}
function setLeftRight(){if(isPosition("left")){if(isPosition("outside")){oPosition.left-=nLayerWidth;oPosition.left-=oOption.left;}
else{oPosition.left+=oOption.left;}}
else if(isPosition("right")){oPosition.left+=nWidth;if(isPosition("inside")){oPosition.left-=nLayerWidth;oPosition.left-=oOption.left;}
else{oPosition.left+=oOption.left;}}
else{setAlign();}}
function setAlign(){if(oOption.align=="left"){oPosition.left+=oOption.left;}
if(oOption.align=="center"){oPosition.left+=(nWidth-nLayerWidth)/2;}
if(oOption.align=="right"){oPosition.left+=nWidth-nLayerWidth;oPosition.left-=oOption.left;}}
function setVerticalAlign(){if(oOption.valign=="top"){oPosition.top+=oOption.top;}
if(oOption.valign=="middle"){oPosition.top+=(nHeight-nLayerHeight)/2;}
if(oOption.valign=="bottom"){oPosition.top+=nHeight-nLayerHeight;oPosition.top-=oOption.top;}}
var el=this.getElement();var wel=$Element(el);var elLayer=this.getLayer();var welLayer=$Element(elLayer);var oElPos=wel.offset();var nWidth=el.offsetWidth;var nHeight=el.offsetHeight;if(el==document.body){var oClientSize=$Document().clientSize();nWidth=oClientSize.width;nHeight=oClientSize.height;}
var nLayerWidth=elLayer.offsetWidth;var nLayerHeight=elLayer.offsetHeight;nLayerWidth+=parseInt(welLayer.css('marginLeft'))+parseInt(welLayer.css('marginRight'))||0;nLayerHeight+=parseInt(welLayer.css('marginTop'))+parseInt(welLayer.css('marginBottom'))||0;var oPosition={top:0,left:0}
oPosition.top=oElPos.top;oPosition.left=oElPos.left;if(isPosition("center")){oPosition.top+=(nHeight-nLayerHeight)/2;oPosition.top+=oOption.top;oPosition.left+=(nWidth-nLayerWidth)/2;oPosition.left+=oOption.left;return oPosition;}
if(isPosition("top")){if(isPosition("outside")){oPosition.top-=nLayerHeight;oPosition.top-=oOption.top;}
else{oPosition.top+=oOption.top;}
setLeftRight();}
else if(isPosition("bottom")){oPosition.top+=nHeight;if(isPosition("inside")){oPosition.top-=nLayerHeight;oPosition.top-=oOption.top;}
else{oPosition.top+=oOption.top;}
setLeftRight();}
else if(isPosition("left")){if(isPosition("outside")){oPosition.left-=nLayerWidth;oPosition.left-=oOption.left;}
else{oPosition.left+=oOption.left;}
setVerticalAlign();}
else if(isPosition("right")){oPosition.left+=nWidth;if(isPosition("inside")){oPosition.left-=nLayerWidth;oPosition.left-=oOption.left;}
else{oPosition.left+=oOption.left;}
setVerticalAlign();}
return oPosition;},setPosition:function(oPosition){var elLayer=this.getLayer();var welLayer=$Element(elLayer);document.body.appendChild(elLayer);welLayer.css("left","-9999px").css("top","0px");if(!oPosition){var oPosition=this.getPosition();}
if(this.option("auto")){oPosition=this._adjustPosition(oPosition);}
welLayer.css("left",oPosition.left+"px").css("top",oPosition.top+"px");},_isFullyVisible:function(oPosition){if(!oPosition){var oPosition=this.getPosition();}
var elLayer=this.getLayer();var welLayer=jindo.$Element(elLayer);var oScrollPosition=$Document().scrollPosition();var nScrollTop=oScrollPosition.top;var nScrollLeft=oScrollPosition.left;var oClientSize=jindo.$Document().clientSize();var nLayerWidth=elLayer.offsetWidth+(parseInt(welLayer.css('marginLeft'))+parseInt(welLayer.css('marginRight'))||0);var nLayerHeight=elLayer.offsetHeight+(parseInt(welLayer.css('marginTop'))+parseInt(welLayer.css('marginBottom'))||0);if(oPosition.left>=0&&oPosition.top>=0&&oClientSize.width>=oPosition.left-nScrollLeft+nLayerWidth&&oClientSize.height>=oPosition.top-nScrollTop+nLayerHeight){return true;}
return false;},_mirrorHorizontal:function(oOption){var oOption=oOption||this.option();if(oOption.align=="center"||oOption.position=="inside-center"){return;}
var oTempOption={};for(var i in oOption){oTempOption[i]=oOption[i];}
var oPosition=this.getPosition();if(oTempOption.position.indexOf("right")>-1){oTempOption.position=oTempOption.position.replace(/right/,"left");}
else if(oTempOption.position.indexOf("left")>-1){oTempOption.position=oTempOption.position.replace(/left/,"right");}
else if(oTempOption.align=="right"){oTempOption.align="left";}
else if(oTempOption.align=="left"){oTempOption.align="right";}
return oTempOption;},_mirrorVertical:function(oOption){var oOption=oOption||this.option();if(oOption.valign=="middle"||oOption.position=="inside-center"){return;}
var oTempOption={};for(var i in oOption){oTempOption[i]=oOption[i];}
var oPosition=this.getPosition();if(oTempOption.position.indexOf("top")>-1){oTempOption.position=oTempOption.position.replace(/top/,"bottom");}
else if(oTempOption.position.indexOf("bottom")>-1){oTempOption.position=oTempOption.position.replace(/bottom/,"top");}
else if(oTempOption.valign=="top"){oTempOption.valign="bottom";}
else if(oTempOption.valign=="bottom"){oTempOption.valign="top";}
return oTempOption;},_adjustPosition:function(oPosition){if(this._isFullyVisible(oPosition)){return oPosition;}
var oOption=this.option();var aOption=[];aOption.push(this._mirrorHorizontal(oOption));aOption.push(this._mirrorVertical(oOption));aOption.push(this._mirrorVertical(this._mirrorHorizontal(oOption)));for(var i=0;i<aOption.length;i++){oTempPosition=this.getPosition(aOption[i]);if(this._isFullyVisible(oTempPosition)){return oTempPosition;}}
return oPosition;}}).extend(nhn.Component);﻿
nhn.Transition=jindo.$Class({_nFPS:15,_aQueue:null,_oTimer:null,_bIsWaiting:true,_bIsPlaying:false,$init:function(oOptions){this._aQueue=[];this._oTimer=new nhn.Timer();this.option({effect:nhn.Effect.linear,correction:false});this.option(oOptions||{});},fps:function(nFPS){if(arguments.length>0){this._nFPS=nFPS;return this;}
return this._nFPS;},abort:function(){this._aQueue=[];this._oTimer.abort();if(this._bIsPlaying)this.fireEvent('abort');this._bIsWaiting=true;this._bIsPlaying=false;this._oNow=null;},start:function(){this.abort();return this.precede.apply(this,arguments);},pause:function(){if(this._oTimer.abort())
this.fireEvent('pause');},resume:function(){var self=this;if(!this._oNow)return;if(this._bIsWaiting==false&&this._bIsPlaying==true)this.fireEvent('resume');this._goOn();this._bIsWaiting=false;this._bIsPlaying=true;this._oTimer.start(function(){var bEnd=!self._goOn();if(bEnd){self._bIsWaiting=true;setTimeout(function(){self._try();},0);}
return!bEnd;},this._oNow.interval);},precede:function(nDuration,oEl){if(typeof nDuration=='function'){this._aQueue.push(nDuration);}else{var oStuff={duration:nDuration,lists:[]};for(var oArg=arguments,nLen=oArg.length,i=1;i<nLen-1;i+=2){var oValues=[];jindo.$H(oArg[i+1]).forEach(function(sEnd,sKey){if(/^(@|style\.)(\w+)/i.test(sKey))
oValues.push(['csses',RegExp.$2,sEnd]);else
oValues.push(['attrs',sKey,sEnd]);});oStuff.lists.push({element:'tagName'in oArg[i]?jindo.$Element(oArg[i]):oArg[i],values:oValues});}
this._aQueue.push(oStuff);}
this._try();return this;},_dequeue:function(){var oStuff=this._aQueue.shift();if(!oStuff)return;if(typeof oStuff=='function')
return oStuff;var aLists=oStuff.lists;for(var i=0,nLen=aLists.length;i<nLen;i++){var oEl=aLists[i].element;for(var j=0,aValues=aLists[i].values,nJLen=aValues.length;j<nJLen;j++){var sType=aValues[j][0];var fpFunc=aValues[j][2];if(typeof fpFunc!='function'){if(fpFunc instanceof Array)fpFunc=this.option('effect')(fpFunc[0],fpFunc[1]);else fpFunc=this.option('effect')(fpFunc);}
if(fpFunc.setStart){if(oEl instanceof jindo.$Element){switch(sType){case'csses':fpFunc.setStart(oEl.css(aValues[j][1]));break;case'attrs':fpFunc.setStart(oEl.$value()[aValues[j][1]]);break;}}else{fpFunc.setStart(oEl.getter(aValues[j][1]));}}
aValues[j][2]=fpFunc;}}
return oStuff;},_try:function(){var self=this;if(!this._bIsWaiting)return false;var oStuff;do{oStuff=this._dequeue();if(!oStuff){if(this._bIsPlaying){this._bIsPlaying=false;this.abort();this.fireEvent('end');}
return false;}
if(!this._bIsPlaying)this.fireEvent('start');if(typeof oStuff=='function'){this._bIsPlaying=true;oStuff.call(this);}}while(typeof oStuff=='function');var nInterval=1000/this._nFPS;this._oNow={lists:oStuff.lists,ratio:0,interval:nInterval,step:nInterval/oStuff.duration};this.resume();return true;},_goOn:function(){var oNow=this._oNow;var nRatio=oNow.ratio;var aLists=oNow.lists;var oEq={};nRatio=parseFloat(nRatio.toFixed(5));if(nRatio>1)nRatio=1;var bCorrection=this.option('correction');for(var i=0,nLen=aLists.length;i<nLen;i++){var oEl=aLists[i].element;for(var j=0,aValues=aLists[i].values,nJLen=aValues.length;j<nJLen;j++){if(oEl instanceof jindo.$Element){var sKey=aValues[j][1];var sValue=aValues[j][2](nRatio);if(bCorrection){var sUnit=/[0-9]([^0-9]*)$/.test(sValue)&&RegExp.$1||'';if(sUnit){var nValue=parseFloat(sValue);var nFloor;var a=nValue;nValue+=oEq[sKey]||0;nValue=parseFloat(nValue.toFixed(5));if(i==nLen-1){sValue=Math.round(nValue)+sUnit;}else{nFloor=parseFloat(/(\.[0-9]+)$/.test(nValue)&&RegExp.$1||0);sValue=parseInt(nValue)+sUnit;oEq[sKey]=nFloor;}}}
switch(aValues[j][0]){case'csses':oEl.css(sKey,sValue);break;case'attrs':oEl.$value()[sKey]=sValue;break;}}else{oEl.setter(aValues[j][1],aValues[j][2](nRatio));}
this.fireEvent("playing",{element:oEl});}}
oNow.ratio+=oNow.step;return nRatio!=1;}}).extend(nhn.Component);﻿
nhn.Timer=jindo.$Class({_timer:null,_lastest:null,_remained:0,_delay:null,_callback:null,$init:function(){},start:function(fpCallback,nDelay){var self=this;this.abort();this.fireEvent('wait');this._lastest=new Date().getTime();this._remained=0;this._delay=nDelay;this._callback=fpCallback;this.resume();return true;},_clearTimer:function(){var bFlag=false;if(this._timer){clearInterval(this._timer);bFlag=true;}
this._timer=null;return bFlag;},abort:function(){var bRet;if(bRet=this._clearTimer())
this.fireEvent('abort');return bRet;},pause:function(){var nPassed=new Date().getTime()-this._lastest;this._remained=this._delay-nPassed;if(this._remained<0)this._remained=0;return this._clearTimer();},resume:function(){var self=this;if(!this._callback)return false;var fpGo=function(nDelay,bRecursive){self._clearTimer();self._timer=setInterval(function(){self.fireEvent('run');var r=self._callback();self._lastest=new Date().getTime();if(!r){clearInterval(self._timer);self._timer=null;self.fireEvent('end');return;}
self.fireEvent('wait');if(bRecursive)fpGo(self._delay,false);},nDelay);};if(this._remained){fpGo(this._remained,true);this._remained=0;}else{fpGo(this._delay,false);}
return true;}}).extend(nhn.Component);﻿
nhn.Effect=function(fpFunc){if(this instanceof arguments.callee)
throw new Error("You can't create a instance of this");var regnum=/^(\-?[0-9\.]+)(%|px|pt|em)?$/;var regrgb=/^rgb\(([0-9]+)\s?,\s?([0-9]+)\s?,\s?([0-9]+)\)$/i;var reghex=/^#([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;var reg3to6=/^#([0-9A-F])([0-9A-F])([0-9A-F])$/i;var getValue=function(v){var unit;if(regnum.test(v))v=parseFloat(v),unit=RegExp.$2;else if(regrgb.test(v))v=[parseInt(RegExp.$1),parseInt(RegExp.$2),parseInt(RegExp.$3)],unit='color';else if(reghex.test(v=v.replace(reg3to6,'#$1$1$2$2$3$3')))v=[parseInt(RegExp.$1,16),parseInt(RegExp.$2,16),parseInt(RegExp.$3,16)],unit='color';return{value:v,unit:unit};};return function(fixs,fixd){var unit;if(arguments.length>1)fixs=getValue(fixs),fixd=getValue(fixd),unit=fixd.unit;else fixd=getValue(fixs),fixs=null,unit=fixd.unit;if(fixs&&fixd&&fixs.unit!=fixd.unit)throw new Error('unit error');fixs=fixs&&fixs.value;fixd=fixd&&fixd.value;var cacheValue,cacheResult;var fp=function(p){var s=fixs;var d=fixd;var getResult=function(s,d){return(d-s)*fpFunc(p)+s+unit;};if(unit=='color'){var r=parseInt(getResult(s[0],d[0]))<<16;r|=parseInt(getResult(s[1],d[1]))<<8;r|=parseInt(getResult(s[2],d[2]));r=r.toString(16).toUpperCase();for(var i=0;6-r.length;i++)r='0'+r;return'#'+r;}
return getResult(s,d);};if(fixs===null){fp.setStart=function(s){if(isNaN(parseInt(s)))s=0+unit;s=getValue(s);if(s.unit!=unit)throw new Error('unit eror');fixs=s.value;};}
return fp;};};nhn.Effect.linear=nhn.Effect(function(s){return s;});nhn.Effect.easeIn=nhn.Effect(function(s){y=Math.sqrt(1-(s*s));return(1-y);});nhn.Effect.easeOut=nhn.Effect(function(s){y=Math.sqrt((2-s)*s);return y;});nhn.Effect.overphase=nhn.Effect(function(s){s/=0.69643223;y=Math.sqrt((2-s)*s)+0.1;return y.toFixed(7);});nhn.Effect.bounce=nhn.Effect(function(s){if(s<(1/2.75))return(7.5625*s*s);else if(s<(2/2.75))return(7.5625*(s-=(1.5/2.75))*s+.75);else if(s<(2.5/2.75))return(7.5625*(s-=(2.25/2.75))*s+.9375);else return(7.5625*(s-=(2.625/2.75))*s+.984375);});(function(){var b=jindo.$Element.prototype.css;jindo.$Element.prototype.css=function(k,v){if(k=='opacity')return typeof v!='undefined'?this.opacity(parseFloat(v)):this.opacity();return v!='undefined'?b.call(this,k,v):b.call(this,k);};})();﻿
nhn.ToolTip=jindo.$Class({_welLayer:null,_oTransition:null,_oLayerManager:null,_oTempOptions:null,_elEventFired:null,_bResetOpacity:true,$init:function(el,oOptions){var self=this;this._el=el;this._welLayer=jindo.$Element(el);this.option({upper:false,top:0,left:0,opacity:1,showDuration:50,hideDuration:500,checkEvent:'mouseover',showDelay:100,hideDelay:100,visibleCallback:function(){if(self._bOnHiding){return false;}
else if(self._bOnShowing){return true;}
else{var wel=jindo.$Element(this.getLayer());if(wel.visible()){if(wel.opacity()>0){return true;}
else{return false;}}
return false;}}});this.option(oOptions||{});this._oLayerManager=new nhn.LayerManager(this._el,this.option()).attach({beforeshow:function(e){e.stop();self._show();},beforehide:function(e){e.stop();self._hide();}}).link(this._el);this._oTransition=new nhn.Transition().fps(40);this.setTemplate(this.getText());},getLayer:function(){return this._el;},getLayerManager:function(){return this._oLayerManager;},getTransition:function(el){return this._oTransition;},setTemplate:function(sTemplate){this._sTemplate=sTemplate;},getTemplate:function(){return this._sTemplate;},setText:function(oTemplateParam){var oTemplate=jindo.$Template(this.getTemplate());var sParsed=oTemplate.process(oTemplateParam);jindo.$Element(this.getLayer()).html(sParsed);},getText:function(){return jindo.$Element(this.getLayer()).html();},_show:function(){var self=this;var el=this._elEventFired;this.getLayerManager().link(el);if(this._bResetOpacity){this.getLayerManager()._oTimer.abort();this._welLayer.opacity(0);}
this._welLayer.show();var oOptions=this.option();var oTempOptions=this._oTempOptions;new nhn.LayerPosition(this._elEventFired,this._el,this._oTempOptions).setPosition();if(!this.fireEvent('beforeshow',{element:el,layer:self._welLayer.$value()}))return;var nOpacity=typeof oTempOptions.opacity=='undefined'?oOptions.opacity:oTempOptions.opacity;self._bOnShowing=true;self._bOnHiding=false;this.getTransition(el).start(oOptions.showDuration,this._welLayer,{'@opacity':nOpacity}).precede(function(){self._bOnShowing=false;self.fireEvent('show',{element:el,layer:self._welLayer.$value()});});},_hide:function(){var self=this;var el=this.getLayer();if(!this.fireEvent('beforehide',{element:el,layer:el}))return;var oOptions=this.option();self._bOnShowing=false;self._bOnHiding=true;this.getTransition(el).start(oOptions.hideDuration,this._welLayer,{'@opacity':0}).precede(function(){self.getLayerManager().unlink(self._elEventFired);self._welLayer.hide();self._bOnHiding=false;self.fireEvent('hide',{element:el,layer:self._welLayer.$value()});});},show:function(el,oTemplateParam,oOptions){this._oTempOptions=oOptions||{};this._bResetOpacity=this._elEventFired!==el;this._elEventFired=el;var self=this;setTimeout(function(){self.setText(oTemplateParam);self._show();},this.option("showDelay"))},hide:function(){this.getLayerManager().hide();},toggle:function(){}}).extend(nhn.Component);

nhn.DragArea=jindo.$Class({_bIsActivating:false,$init:function(el,oOptions){this.option({className:'dragable',flowOut:true,setCapture:false,threshold:0});this.option(oOptions||{});this._el=el;this.bIsIE=jindo.$Agent().navigator().ie;this._oDragInfo={prepare:false};this._bIsDragging=false;this._wfOnMouseDown=jindo.$Fn(this._onMouseDown,this);this._wfOnMouseMove=jindo.$Fn(this._onMouseMove,this);this._wfOnMouseUp=jindo.$Fn(this._onMouseUp,this);this._wfOnDragStart=jindo.$Fn(this._onDragStart,this);this._wfOnSelectStart=jindo.$Fn(this._onSelectStart,this);this.activate();},_findDraggableElement:function(el){if(cssquery.test(el,"input[type=text]")||el.tagName=="TEXTAREA")return null;var self=this;var sClass='.'+this.option('className');var isParentOf=function(el){if(el==null){return false;}
if(!self._el.tagName||self._el===el)return true;return jindo.$Element(self._el).isParentOf(el);}
var el=cssquery.test(el,sClass)?el:cssquery.getSingle('! '+sClass,el);if(!isParentOf(el))el=null;return el;},isDragging:function(){return this._bIsDragging&&!this._oDragInfo.prepare;},_attachEvent:function(){if(this.isActivating())return;this._wfOnMouseDown.attach(this._el,'mousedown');if(this.bIsIE){this._wfOnDragStart.attach(this._el,'dragstart');this._wfOnSelectStart.attach(this._el,'selectstart');}
this._bIsActivating=true;},_detachEvent:function(){if(!this.isActivating())return;this._wfOnMouseDown.detach(this._el,'mousedown');if(this.bIsIE){this._wfOnDragStart.detach(this._el,'dragstart');this._wfOnSelectStart.detach(this._el,'selectstart');}
this._bIsActivating=false;},attachEvent:function(){this.activate();},detachEvent:function(){this.deactivate();},activate:function(){this._attachEvent();},deactivate:function(){this._detachEvent();},isEventAttached:function(){return this.isActivating();},isActivating:function(){return this._bIsActivating;},_onMouseDown:function(e){if(this._bIsDragging||this._oDragInfo.prepare)return;if(e.mouse().right)return;var el=this._findDraggableElement(e.element);if(!el)return;var oPos=e.pos();this._oDragInfo={prepare:true,button:e._event.button,handle:el,element:el,pageX:oPos.pageX,pageY:oPos.pageY};this.fireEvent('handledown',{handle:el,element:el,event:e});this._wfOnMouseMove.attach(document,'mousemove');this._wfOnMouseUp.attach(document,'mouseup')
this._wfOnMouseUp.attach(document,'contextmenu');e.stop($Event.CANCEL_DEFAULT);},_onMouseMove:function(e){this._bIsDragging=true;var oInfo=this._oDragInfo;var oPos=e.pos();if(oInfo.prepare){var nThreshold=this.option('threshold');var oDiff={pageX:0,pageY:0};if(nThreshold){oDiff.pageX=oPos.pageX-oInfo.pageX;oDiff.pageY=oPos.pageY-oInfo.pageY;var nDistance=Math.sqrt(oDiff.pageX*oDiff.pageX+oDiff.pageY*oDiff.pageY);if(nThreshold>nDistance)return;}
var el=this._findDraggableElement(e.element);if(this.bIsIE&&this.option("setCapture")){this._elSetCapture=(this._el==document)?document.body:el;this._elSetCapture.setCapture(true);}
var oParam={area:this._el,handle:oInfo.handle,element:oInfo.element,diff:oDiff,event:e};if(!this.fireEvent('dragstart',oParam)){this._bIsDragging=false;return;}
var eDrag=jindo.$Element(oParam.element);oInfo.prepare=false;oInfo.handle=oParam.handle;oInfo.element=oParam.element;oInfo.objectX=parseInt(eDrag.css('left'))||0;oInfo.objectY=parseInt(eDrag.css('top'))||0;}
var oGap={x:oPos.pageX-oInfo.pageX,y:oPos.pageY-oInfo.pageY};var oParam={area:this._el,handle:oInfo.handle,element:oInfo.element,event:e,x:oInfo.objectX+oGap.x,y:oInfo.objectY+oGap.y,gapX:oGap.x,gapY:oGap.y};if(!this.fireEvent('beforedrag',oParam))return;if(this.option('flowOut')==false){var oElement=oParam.element;var oParent=cssquery.getSingle('! [@position!=static]',oParam.element);var aSize=[oElement.offsetWidth,oElement.offsetHeight];var oRect=oParent?{width:oParent.clientWidth,height:oParent.clientHeight}:jindo.$Document().clientSize();if(oParam.x!==null){if(oParam.x<0)oParam.x=0;else if(oParam.x+aSize[0]>oRect.width)oParam.x=oRect.width-aSize[0];}
if(oParam.y!==null){if(oParam.y<0)oParam.y=0;else if(oParam.y+aSize[1]>oRect.height)oParam.y=oRect.height-aSize[1];}}
var oDrag=oInfo.element;if(oParam.x!==null)oDrag.style.left=oParam.x+'px';if(oParam.y!==null)oDrag.style.top=oParam.y+'px';if(!this.fireEvent('drag',oParam))return;},_onMouseUp:function(e){if(e.type=="mouseup"&&e.mouse().right)return;if(e.type=="contextmenu"){this._oDragInfo.prepare=false;e.stop();}
this._wfOnMouseMove.detach(document,'mousemove');this._wfOnMouseUp.detach(document,'mouseup');this._wfOnMouseUp.detach(document,'contextmenu');var oInfo=this._oDragInfo;if(!oInfo.prepare&&this._bIsDragging){var oDrag=oInfo.element;var eDrag=jindo.$Element(oDrag);if(!this.fireEvent('dragend',{area:this._el,handle:oInfo.handle,element:oInfo.element,event:e,x:parseInt(eDrag.css('left'))||0,y:parseInt(eDrag.css('top'))||0}))return;}
if(this.bIsIE&&this._elSetCapture){this._elSetCapture.releaseCapture();this._elSetCapture=null;}
this._bIsDragging=false;this._oDragInfo.prepare=false;this.fireEvent('handleup',{handle:oInfo.handle,element:oInfo.element,event:e});},_onDragStart:function(e){e.stop($Event.CANCEL_DEFAULT);},_onSelectStart:function(e){if(this._findDraggableElement(e.element))
e.stop($Event.CANCEL_DEFAULT);}}).extend(nhn.Component);

nhn.Foggy=jindo.$Class({_elFog:null,_bFogAppended:false,_oExcept:null,_bFogVisible:false,_oTransition:null,$init:function(oOptions){this.option({showDuration:200,showOpacity:nhn.Effect.linear(0.5),hideDuration:200,hideOpacity:nhn.Effect.linear(0),zIndex:32000,fps:15});this.option(oOptions||{});this._elFog=jindo.$('<div>');this._bFogAppended=false;this._oExcept={};this._oTransition=new nhn.Transition().fps(this.option("fps"));this._fOnResize=jindo.$Fn(this._fitFogToDocument,this);this._fOnScroll=jindo.$Fn(this._fitFogToDocumentScrollSize,this);},_appendFog:function(){if(this._bFogAppended)return;document.body.insertBefore(this._elFog,document.body.firstChild);jindo.$Element(this._elFog).opacity(0);this._bFogAppended=true;},_getScroll:function(wDocument){var o={top:0,left:0}
o.top=window.pageYOffset||document[wDocument._docKey].scrollTop;o.left=window.pageXOffset||document[wDocument._docKey].scrollLeft;return o;},_fitFogToDocument:function(){var wDocument=jindo.$Document();this._elFog.style.left=this._getScroll(wDocument).left+'px';this._elFog.style.width=wDocument.clientSize().width+'px';var self=this;clearTimeout(this._nTimer);this._nTimer=null;this._nTimer=setTimeout(function(){var oSize=wDocument.clientSize();self._elFog.style.top=self._getScroll(wDocument).top+'px';self._elFog.style.height=oSize.height+'px';self._elFog.style.left=self._getScroll(wDocument).left+'px';self._elFog.style.width=wDocument.clientSize().width+'px';},100);},_fitFogToDocumentScrollSize:function(){var oSize=jindo.$Document().scrollSize();this._elFog.style.left="0";this._elFog.style.top="0";this._elFog.style.width=oSize.width+'px';this._elFog.style.height=oSize.height+'px';},getFog:function(){return this._elFog;},show:function(elExcept){var self=this;if(this._bFogVisible)return;if(elExcept){this._oExcept.element=elExcept;var sPosition=jindo.$Element(elExcept).css('position');if(sPosition=='static'){this._oExcept.position=elExcept.style.position;elExcept.style.position='relative';}
this._oExcept.zIndex=elExcept.style.zIndex;elExcept.style.zIndex=this.option('zIndex')+1;}
this._elFog.style.zIndex=this.option('zIndex');this._elFog.style.display='none';this._appendFog();this._fitFogToDocument();this._fOnResize.attach(window,"resize");this._fOnScroll.attach(window,"scroll");this._elFog.style.display='block';this._bFogVisible=true;this._oTransition.start(this.option('showDuration'),this._elFog,{'@opacity':this.option('showOpacity')}).precede(function(){self.fireEvent('show');});},hide:function(){var self=this;if(!this._bFogVisible)return;this._bFogVisible=false;this._oTransition.start(this.option('hideDuration'),this._elFog,{'@opacity':this.option('hideOpacity')}).precede(function(){self._elFog.style.display='none';var elExcept=self._oExcept.element;if(elExcept){if(self._oExcept.position)elExcept.style.position=self._oExcept.position;elExcept.style.zIndex=self._oExcept.zIndex;}
this._oExcept={};self._fOnResize.detach(window,"resize");self._fOnScroll.detach(window,"scroll");self.fireEvent('hide');});}}).extend(nhn.Component);