/* TERMS OF USE - EASING EQUATIONS Open source under the BSD License. Copyright 2001 Robert Penner All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ var userAgent = navigator.userAgent.toLowerCase(); var browser = { version: (userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1], safari: /webkit/.test(userAgent), opera: /opera/.test(userAgent), msie: /msie/.test(userAgent) && !/opera/.test(userAgent), mozilla: /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent) }; var os ={ isXP : /nt 5.1/.test(userAgent), isVista : /nt 6.0/.test(userAgent) } var domHelper = { // Add event handler addEvent : function(elm, evType, fn, useCapture, obj, override) { if (typeof elm == 'string') elm = document.getElementById(elm); var scope = elm; if (override) { if (override === true) scope = obj; else scope = override; } var wrappedFn = function(e) { return fn.call(scope, domHelper.getEvent(e), obj); }; if (elm.addEventListener) elm.addEventListener(evType, wrappedFn, useCapture); else if (elm.attachEvent) elm.attachEvent('on' + evType, wrappedFn); else elm['on' + evType] = wrappedFn; return true; }, removeEvent : function(elm, evType, fn) { }, // getEvent getEvent: function(e, boundEl) { var ev = e || window.event; if (!ev) { var c = this.getEvent.caller; while (c) { ev = c.arguments[0]; if (ev && Event == ev.constructor) break; c = c.caller; } } return ev; }, // Get key getKey : function(e) { if (window.event) return window.event.keyCode; else if (e) return e.which; else return 0; }, // Stop event propagation stopBubble : function(e) { if (window.event && window.event.cancelBubble) { window.event.cancelBubble = true; } if (e && e.stopPropagation) { e.stopPropagation(); } }, // Prevent event default action stopDefault : function(e){ if(window.event && window.event.returnValue){ window.event.returnValue = false; } if (e && e.preventDefault){ e.preventDefault(); } }, // Stop event propagation + Prevent event default action cancelClick : function(e) { if (window.event) { window.event.cancelBubble = true; window.event.returnValue = false; } if (e && e.stopPropagation && e.preventDefault) { e.stopPropagation(); e.preventDefault(); } }, // Get event target getTarget : function(e) { var target = window.event ? window.event.srcElement : e ? e.target : null; if (!target) { return false; } while (target.nodeType != 1 && target.nodeName.toLowerCase() != 'body') { target = target.parentNode; } return target; }, // Get related event target getRelatedTarget : function(e) { var target = window.event ? window.event.fromElement : e ? e.relatedTarget : null; if (!target) { return false; } /* while (target.nodeType != 1 && target.nodeName.toLowerCase() != 'body') { target = target.parentNode; } */ return target; }, // Key related isPrintable : function(key) { return (key >= 32 && key < 127); }, // Dom Element navigation method lastSibling:function(node) { var tempObj=node.parentNode.lastChild; while(tempObj.nodeType!=1 && tempObj.previousSibling!=null){ tempObj=tempObj.previousSibling; } return (tempObj.nodeType==1)?tempObj:false; }, firstSibling:function(node) { var tempObj=node.parentNode.firstChild; while(tempObj.nodeType!=1 && tempObj.nextSibling!=null){ tempObj=tempObj.nextSibling; } return (tempObj.nodeType==1)?tempObj:false; }, getText:function(node){ if(!node.hasChildNodes()){return false;} var reg=/^\s+$/; var tempObj=node.firstChild; while(tempObj.nodeType!=3 && tempObj.nextSibling!=null || reg.test(tempObj.nodeValue)){ tempObj=tempObj.nextSibling; } return tempObj.nodeType==3||tempObj.nodeType==4?tempObj.nodeValue:false; }, setText:function(node,txt){ if(!node.hasChildNodes()){return false;} var reg=/^\s+$/; var tempObj=node.firstChild; while(tempObj.nodeType!=3 && tempObj.nextSibling!=null || reg.test(tempObj.nodeValue)){ tempObj=tempObj.nextSibling; } if(tempObj.nodeType==3){tempObj.nodeValue=txt}else{return false;} }, createLink:function(to,txt){ var tempObj=document.createElement('a'); tempObj.appendChild(document.createTextNode(txt)); tempObj.setAttribute('href',to); return tempObj; }, createTextElm:function(elm,txt){ var tempObj=document.createElement(elm); tempObj.appendChild(document.createTextNode(txt)); return tempObj; }, closestSibling:function(node,direction){ var tempObj; if(direction==-1 && node.previousSibling!=null){ tempObj=node.previousSibling; while(tempObj.nodeType!=1 && tempObj.previousSibling!=null){ tempObj=tempObj.previousSibling; } }else if(direction==1 && node.nextSibling!=null){ tempObj=node.nextSibling; while(tempObj.nodeType!=1 && tempObj.nextSibling!=null){ tempObj=tempObj.nextSibling; } } return tempObj.nodeType==1?tempObj:false; }, // class management cssjs:function(a,o,c1,c2) { switch (a){ case 'swap': o.className=!domHelper.cssjs('check',o,c1)?o.className.replace(c2,c1):o.className.replace(c1,c2); break; case 'add': if(!domHelper.cssjs('check',o,c1)){o.className+=o.className?' '+c1:c1;} break; case 'remove': var rep=o.className.match(' '+c1)?' '+c1:c1; o.className=o.className.replace(rep,''); break; case 'check': var found=false; var temparray=o.className.split(' '); for(var i=0;i 0 && isFinite(tweak)) { if (tween.currentFrame + tweak >= frames) tweak = frames - (frame + 1); tween.currentFrame += tweak; } }; } // options // className : item clasname, default:box_item // container : box container element id, default:parent node // slideWidth : visible slide width, default:container width // leftButton : left sliding button element id, default:slideLeft // rightButton : left sliding button element id, default:slideRight var SlidingBox = function(box, options) { options = options || {}; this.box = box; this.boxEl = document.getElementById(box); this.boxEl.style.position = 'absolute'; this.boxEl.style.left = '0'; this.boxEl.style.top = '0'; this.className = options.className || 'box_item'; this.container = document.getElementById(options.container) || this.boxEl.parentNode; var items = domHelper.getElementsByClassName(this.boxEl, this.className, 'span'); if(items=='') return; this.itemWidth = items[0].offsetWidth; // marginÀº °í·Á¾ÈµÊ this.maxWidth = 0; var selected = -1; // ¼±Åõȳð for (var i = 0; i < items.length; i++) { this.maxWidth += items[i].offsetWidth; // 7 dvi °ø¹é if (domHelper.cssjs('check', items[i], 'selected')) selected = i; } this.boxEl.style.width = this.maxWidth + 'px'; this.movedBy = 0; this.containerSize = Math.floor(this.container.offsetWidth / this.itemWidth); // ¿µ¿ª ³» Ãâ·Â °³¼ö this.slideWidth = 1; // ½½¶óÀ̵ù °³¼ö ¼±Åà // selected if (selected > 0) { var n = parseInt(selected / this.slideWidth); this.boxEl.style.left = -n * this.slideWidth * this.itemWidth + 'px'; //this.slideBy(); this.movedBy += n * this.slideWidth * this.itemWidth; } // event registration var left = options.leftButton ? document.getElementById(options.leftButton) : document.getElementById('slideLeft'); var right = options.rightButton ? document.getElementById(options.rightButton) : document.getElementById('slideRight'); if (left && right) { domHelper.addEvent(left, 'click', function(e) { if (this.anim && this.anim.isAnimated()) { domHelper.cancelClick(e); return; } if (!this.slideLeft()) { domHelper.cssjs('add', left, 'off'); left.setAttribute('abled', 'disabled'); } domHelper.cssjs('remove', right, 'off'); right.removeAttribute('disabled'); domHelper.cancelClick(e); }, false, null, this); domHelper.addEvent(right, 'click', function(e) { if (this.anim && this.anim.isAnimated()) { domHelper.cancelClick(e); return; } if (!this.slideRight()) { domHelper.cssjs('add', right, 'off'); right.setAttribute('abled', 'disabled'); } domHelper.cssjs('remove', left, 'off'); left.removeAttribute('disabled'); domHelper.cancelClick(e); }, false, null, this); } // button initialize if (this.movedBy >= this.slideWidth * this.itemWidth) { domHelper.cssjs('remove', left, 'off'); left.removeAttribute('disabled'); } else { domHelper.cssjs('add', left, 'off'); left.setAttribute('disabled', 'disabled'); } if (this.movedBy < this.maxWidth - this.slideWidth * this.itemWidth) { domHelper.cssjs('remove', right, 'off'); right.removeAttribute('disabled'); } else { domHelper.cssjs('add', right, 'off'); right.setAttribute('disabled', 'disabled'); } } SlidingBox.prototype = { slideBy: function(delta) { this.anim = new Motion(this.boxEl, {points: {by: [delta, 0]}}, 0.5, Easing.easeBoth); this.anim.animate(); }, slideLeft : function() { if (this.movedBy >= this.slideWidth * this.itemWidth) { this.slideBy(this.slideWidth * this.itemWidth); this.movedBy -= this.slideWidth * this.itemWidth; } return (this.movedBy >= this.slideWidth * this.itemWidth); }, slideRight : function() { if (this.movedBy < this.maxWidth - this.slideWidth * this.itemWidth) { this.slideBy(-this.slideWidth * this.itemWidth); this.movedBy += this.slideWidth * this.itemWidth; } return (this.movedBy < this.maxWidth - this.slideWidth * this.itemWidth); } } window.onload=function (){ var slide = new SlidingBox('seriesList'); // main µðÀÚÀÎ/È£½ºÆÃ/µµ¸ÞÀÎ tab ó¸® // var hostingTab=document.getElementById('main_tab2'); // È£½ºÆà »ç¿ëÁßÀΠǥ½Ã (»ç¿ë¾ÈÇϸé none) // if(hostingTab.style.display!='none'){ setMainTab('main_tab2'); } }