﻿/*
//
//    NTREEV Javascript Freamework @ ver 0.7 (2008.09.10)
//
//    Copyright(C) 2008, Su hyung, park All rights reserved.
//    Su hyung, park / plognote@hotmail.com
//
*/

ui = {name : 'UI Mix',version : '0.6 beta full',debug : false,userApp : navigator.userAgent.toLowerCase(),methods : new Object()
};firefox = /firefox/.test(ui.userApp);safari = /webkit/.test(ui.userApp);opera = /opera/.test(ui.userApp);chrome = /chrome/.test(ui.userApp);msie = /msie/.test(ui.userApp);msie6 = /msie 6.0/.test(ui.userApp);if (msie6) {try{document.execCommand("BackgroundImageCache",false,true);}catch(e){}}
function chkAgent() {return msie || firefox ? 1 : 2;}
window.extend = function(obj,source) {for (var methods in source)
obj[methods] = source[methods];return obj;};window.$ = function() {var a = $A(arguments),obj = getElement(a[0]),objs = [],i,m;if (a.length > 1) {for (i=0;a[i];i++) objs.push($(a[i]));} else if (obj.length && !obj.nodeName) {for (i=0;obj[i];i++) objs.push($(obj[i]));}
if (objs.length) {objs.clear();for (var m in ui.methods) eval("objs[m] = function(){this.each('this."+m+"',arguments);return this}")
return objs;}
return obj.ui ? obj : extend(obj,ui.methods);};window.Document = function() {return safari ? document.body : document.documentElement || document.body;}
extend(window,{onerror : ui.debug ? function(msg,url,line) {var url = url ? 'url : '+url+'\n' : '';var line = line ? 'line : '+line+'\n' : '';var caller = onerror.caller ? onerror.caller.toString().replace(/\t/ig,'    ') : '';for (var i=0,c=caller.split(/\n/);c[i];i++)
c[i] = c[i].length > 60 ? c[i].substr(0,60) + '...     ' : c[i];alert('\n'+ui.name+' error message\n\n[ '+msg+' ]\n\n'+url+line+'\n'+c.join('\n'));} : function() {return true},ready : {add : function() {for (var i=0;arguments[i];i++)
this.list.push($Fn(arguments[i]));if (!this.list[1]) ready.apply();},apply : function() {try {if (!document.body) setTimeout('ready.apply()',100);else ready.list.each('this()').remove();} catch (e) {alert(e);if(this.failed < 2) setTimeout('ready.apply()',500);this.failed++;}
},list : new Array(),failed : 0
},DOM : function() {var a = $A(arguments);tagName = a.shift(),childs = a;var el = $(document.createElement(tagName));for (var i=0;childs[i];i++) {if (typeof childs[i] != 'object')
el.appendChild(document.createTextNode(childs[i]));else
el.appendChild(childs[i]);}
return el;},newText : function(text) {return document.createTextNode(text);},addEvent : function(obj,eventName,func) {if (obj.addEventListener)obj.addEventListener(eventName,eval(func),false);else if (obj.attachEvent)obj.attachEvent("on"+eventName,eval(func));return obj;},removeEvent : function(obj,eventName,func) {if (obj.removeEventListener)obj.removeEventListener(eventName,eval(func),false);else if (obj.detachEvent)obj.detachEvent("on"+eventName,eval(func));return obj;}
});extend(window,{getElement : function(el,par) {if (typeof el != 'string') return el == document ? document.documentElement || document.body : el;var element = par || document,result = [],_tag = el.filter(/\/\w+/,/^./),_id = el.filter(/^\w+|\#\w+/,/^\#/),_name = el.filter(/\@\w+/,/^./),_class = el.filter(/\.\w+/,/^./),_attr = el.filter(/ .+/,/ /).split('=');if (_id) result.push(element.getElementById(_id));if (_tag) {if (_id)
result[0] = RegExp(_tag,'i').test(result[0].nodeName) ? result[0] : false;else
result = element.getElementsByTagName(_tag);}
if (_name) {if (_id || _tag)
for (var i=0,bak=result,result=[];bak[i];i++) {if (bak[i].getAttribute('name') == _name) result.push(bak[i]);}
else
result = element.getElementsByName(_name);}
if (_class) {var bak = _id || _tag || _name ? result : element.all || element.getElementsByTagName('*');for (var i=0,result=[];bak[i];i++) {try {var cls = bak[i].getAttribute('class') || bak[i].className;if (cls) {for (var l=0,c=cls.split(' ');c[l];l++) {if (c[l] == _class) result.push(bak[i]);}
}
} catch(e) {}
}
}
if (_attr[0]) {for (var i=0,bak=result,result=[];bak[i];i++) {if (_attr[1]) {if (bak[i].getAttribute(_attr[0]) == _attr[1]) result.push(bak[i]);} else {if (bak[i].getAttribute(_attr[0])) result.push(bak[i]);}
}
}
return _id ? result[0] || false : result[0] ? result : false;},getOffset : function(el,depth) {try {var par = el.offsetParent && !depth ? true : false,addX = addY = 0;return {left : el.offsetLeft + (par ? getOffset(el.offsetParent,depth).left : 0),top : el.offsetTop + (par ? getOffset(el.offsetParent,depth).top : 0)
}
} catch(e) {return el;}
},getMotion : function() {var result = [],temp,b = 0;for (var a=0,R;arguments[a];a++){R = arguments[a],result[a] = [];var sp = _sp = R[0],ep = R[1],sd = 1.81-(R[2]||0)/100,ac = R[3];var prev = temp = sp;if (ac && sd){for (var c=0;c<3 && b < 500;temp=sp) {sp = $N(sd*(sp-ep)+-0.82*(prev-ep)+ep),prev = temp;if (result[a].last() == ep) c++;result[a].push($P(sp));b++;}
} else {for (var c;(result[a].last() != ep) &&  b < 500;b++) {sp = $N(sp) + $N((ep - sp) / (21 - (R[2] || 20).min(1))).one() || 0;result[a].push($P(sp));}
}
result[a].push(ep)}
return result[1] ? result : result[0];}
})
extend(window,{$P : function(data) {return parseInt($N(data));},$S : function(data) {return String(data||'');},$N : function(data) {return Number(data||0);},$T : function(data) {return $S(data).del(/(^\s*)|(\s*$)/g);},$A : function() {for (var A=new Array(),a=arguments,i=0;a[i];i++)
if(a[i][0]) for (var n=0;a[i][n];n++) A.push(a[i][n]);else A.push(a[i]);return A;},$F : function(name) {var fs = typeof name == 'object' ? getElement(name) : [getElement(name)] || getElement('@'+name);for (var i=0,result=[];fs[i];i++) {if (fs[i].nodeName == 'SELECT') {for (var n=0;fs[i][n];n++) if (fs[i][n].getAttribute('selected')) result.push(fs[i].value);}
else if (/radio|checkbox/i.test(fs[i].getAttribute('type'))) {if (fs[i].getAttribute('checked')) result.push(fs[i].value);}
else result.push(fs[i].value);}
return result.join();},$FF : function() {for (var i=0,quary=[];arguments[i];i++)
quary.push(arguments[i]+'='+escape($F(arguments[i])));return quary.join('&');},$FFF : function(form) {var fs = getElement(typeof form == 'object' ? form : '@'+form)[0],result = [];for(var i=0;fs[i];i++)
if (fs[i].getAttribute('name') && !result.check(fs[i].getAttribute('name'))) result.push(fs[i].getAttribute('name'));return $FF.apply(null,result);},$Fn : function(fn) {var func = fn;if (typeof(func) == 'function') return func;else if (/\(/.test(func)) return function() {eval(func)};else return function() {eval(func+'.apply(this,arguments)')};},$Hex : function(data,cut) {for (var Hex=$P(data).toString(16),Count = cut || 1,i=0;Hex.length < Count;i++)
Hex = '0'+Hex;return Hex;},$Int : function(data) {return parseInt($S(data),16)},$RGB : function(c) {var color = [],r,a = 2,s = [0,2,4];if(/rgb/i.test(c)) {color = c.del(/[a-z\(\)]/ig).split(',');} else {if((r = c.del('#')).length < 6) a = 1,s = [0,1,2];r = [r.substr(s[0],a),r.substr(s[1],a),r.substr(s[2],a)];color[0] = $Int(r[0].length < 2 ? r[0]+r[0] : r[0]);color[1] = $Int(r[1].length < 2 ? r[1]+r[1] : r[1]);color[2] = $Int(r[2].length < 2 ? r[2]+r[2] : r[2]);}
return color || false;},$R : {str : /[\D]+/ig,int : /^[0-9]+$/,eng : /[a-z]+/ig,kr : /[가-힣]+/g,tag :/\<[^\>.]*\>/ig,id : /^[\w]{4,15}$/ig,url : /(?:http[s]?\:\/\/)?[\w-\.]+[\w-\.]+[\/]?[\w\.\/-]+/ig,email : /[\w]+\@[\w-]*\.[\w-]+/ig,phone : /^[0-9]{2,3}-[0-9]{3,4}-[0-9]{4}/g},$JSON : function(Xml) {var childs = Xml.childNodes,_obj = Xml;for (var i=0,result = {};childs[i];i++) {result.attr = function(aname) {return _obj.getAttribute(aname);}
var name = childs[i].nodeName,type = childs[i].nodeType;if (type == 1) {if (!result[name]) result[name] = $JSON(childs[i]);else result[name] = $A(result[name],$JSON(childs[i]));}
if (type == 3) {if (!result['text']) result['text'] = childs[i].nodeValue;else result['text'] += childs[i].nodeValue;}
}
return result;}
});extend(Array.prototype,{each : function() {var val = $A(arguments[1]),fn = arguments[0];for (var i=0;i < this.length;i++){$Fn(fn).apply(this[i],val);}
return this;},inshift : function() {var obj = this;return obj[1] ? obj.shift() : obj[0];},check : function(w) {for (var i=0;this[i];i++)
if (w == this[i]) return true;},last : function() {return this[this.length-1];},remove : function() {this.length = null;},clear : function() {for (var i=0,l=this.length;i < l;i++) {if (this[0]) this.push(this[0]);this.shift();}
return this;},random : function() {return this.sort(function(){return Math.random()*3-2;});}
});extend(String.prototype,{del : function(r) {return this.replace(r,'');},filter : function(r,d) {return $S(this.match(r)).del(d);},size : function() {for (var i=0,bytes = 0;this.charCodeAt(i);i++) bytes += (this.charCodeAt(i) > 128) ? 2 : 1;return bytes;}
});extend(Number.prototype,{range : function(start,end,swc) {var s = $N(Math.min(start,end)),e = $N(Math.max(start,end));return s > this ? swc ? false : s : e < this ? swc ? false : e : this;},max : function(limit,swc) {var l = $N(limit);return l < this ? swc ? false : l : this;},min : function(limit,swc) {var l = $N(limit);return l > this ? swc ? false : l : this;},one : function(no) {var limit = no || $N(1);return (this > 0 && this < limit) ? limit : (this < 0 && this > -limit) ? -limit : this;}
});extend(Function.prototype,{bind : function(obj) {var fn = this,element = obj;return function() {fn.apply(element,arguments)}
}
});('Wheel Click Dblclick Mouseover Mouseout Mousedown Mouseup Mousemove Blur Focus Change Select Submit Load Unload Error Reset Dragdrop Keydown Keypress Keyup Move Resize').split(' ').each(function() {if (this == 'wheel')var evt = window.attachEvent || safari ? 'mousewheel' : 'DOMMouseScroll';else
var evt = this.toLowerCase();eval('ui.methods[\''+this+'\'] = function(F) {return addEvent(this,\''+evt+'\',$Fn(F).bind(this));}');});Ajax = {create : function() {if (window.XMLHttpRequest) {return new XMLHttpRequest();} else {try {return new ActiveXObject("Msxml2.XMLHTTP");}
catch(e) {return new ActiveXObject("Microsoft.XMLHTTP");}
}
},call : function(url,methods,param,callback,failed) {var ajax = Ajax.create();var post = /POST/i.test(methods);var url = !post && param ? url+'?'+param : url;if (Ajax.start) Ajax.start();ajax.onreadystatechange = function() {if (ajax.readyState == 4) {if (ajax.status == (200 || 304)) callback(ajax);delete ajax;if (Ajax.end) Ajax.end();}
}
ajax.open(methods,url,true);ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=UTF-8");ajax.setRequestHeader("Cache-Control","no-store,no-cache,must-revalidate");ajax.setRequestHeader("Pragma","no-cache");ajax.send(post ? param || "" : null);},get : function(url,param,callback,failed) {Ajax.call(url,'GET',param,callback,failed);},post : function(url,param,callback,failed) {Ajax.call(url,'POST',param,callback,failed);}
};Flash = {write : function(file,name,width,height,vars) {document.write(Flash.html(file,name,width,height,vars));},html : function(file,name,width,height,vars) {if(document.getElementById(name)) return alert('중복된 Flash object ID 값 입니다.');var host = /^https/.test(window.location.href) ? 'https' : 'http'; var swf =  ''
 + '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+host+'://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'" id="'+name+'" align="middle">'
 + '<param name="allowScriptAccess" value="always" />'
 + '<param name="movie" value="'+file+'" />'
 + '<param name="quality" value="high" />'
 + '<param name="wmode" value="transparent">'
 + '<param name="showMenu" value="false">'
 + '<param name="Menu" value="false">'
 + '<param name="flashVars" value="'+(vars||'')+'">'
 + '<embed wmode="transparent" src="'+file+'" flashvars="'+(vars||'')+'" quality="high" bgcolor="#ffffff" width="'+width+'" height="'+height+'" name="'+name+'" align="middle" showMenu="false" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="'+host+'://www.macromedia.com/go/getflashplayer" allowScriptAccess="always" swLiveConnect="true" />'
 + '</object>';if (msie) eval("window."+name+" = document.getElementById('"+name+"');");return swf;},get : function(name) {return eval('document.'+name) || window.document[name] || document.getElementById(name);},setValue : function(name,value,vars) {Flash.get(name).SetVariable(value,vars);},getValue : function(name,value) {return Flash.get(name).GetVariable(value);}
}
Skin = {write : function(name,txt) {document.write(this.get(name,txt));},html : function(name,txt) {var word,skin = eval('this.'+$T(name));for(var t in txt) {word = new RegExp('\\[##'+t+'##\]','g');skin = skin.replace(word,txt[t])
}
return skin.replace(/\[##\w+##\]/g,'');},set : function(name,txt) {eval('this.'+$T(name)+' = \''+txt+'\';')
}
};Popup = {open : function(url,name,param) {ready.add(function(){if(Cookie.get('__'+name) == 'null') var pop = window.open(url,name,param);try {var p = pop.window;p.onclose = function(){Popup.onclose(name);p.close();}
} catch(e) {}
})
},inner : function(url,id,param,target) {var param = param || '',tg = target || document.body;ready.add(function(){var top = /top:[^;]+/i.exec(param) || false,left = /left:[^;]+/i.exec(param) || false,_new;if (!Cookie.get('__'+id))
Ajax.get(url,param,function(r){if($(id)) {_new = $(id);_new.css('position:absolute;z-index:100;'+(top||'top:-1000px')+';'+(left||'left:-1000px')+';'+param);} else {_new = DOM('div');_new.css('position:absolute;z-index:100;'+(top||'top:-1000px')+';'+(left||'left:-1000px')+';'+param).attr('mode=inner;id='+id);}
_new.inHTML(r.responseText);tg.appendChild(_new);if(!top) _new.css('top:'+document.getElementsByTagName('html')[0].clientHeight/2+'px;margin-top:'+(Document().scrollTop-(_new.clientHeight/2))+'px;');if(!left) _new.css('left:50%;margin-left:-'+_new.clientWidth/2+'px');})
})
},close : function(target) {for (var t=target;t.parentNode;t=t.parentNode)
if ($(t).attr('mode') == 'inner') {t.remove();return t.id;}
},onclose : function(target) {var target = Popup.close(target) || target;Cookie.set('__'+target,true,1);}
};Cookie = {set : function(name,value,delay) {var today = new Date();var value = value || '';today.setDate(today.getDate()+(delay||1));document.cookie = name+'='+escape(value)+';path=/;'+(delay ? 'expires='+today.toGMTString() : '')+';';},get : function(name) {return unescape($S(RegExp(name+'=[^\s^;]+').exec(document.cookie+';') || '').del(/.+=/));},del : function(name) {Cookie.set(name,'',-1);}
};Event = {evt : function(e) {return e ? e : window.event},pointerX : function(e) {return Event.evt(e).clientX + Document().scrollLeft;},pointerY : function(e) {return Event.evt(e).clientY + Document().scrollTop;},element : function(e) {return Event.evt(e).target || Event.evt(e).srcElement},isLeft : function(e) {return ((Event.evt(e).button && Event.evt(e).button == 1) || (Event.evt(e).which && Event.evt(e).which == 1))},keycode : function(e) {return (Event.evt(e).keyCode || Event.evt(e).which)},keymap : function(e) {return Event.key['_'+Event.keycode(e)] || ''},wheel : function(e,px) {var count = Event.evt(e).wheelDelta || Event.evt(e).detail;if (firefox || opera) count -= count;return count ? count > 1 ? -px || -40 : px || 40 : false;},key : {_81 : 'q',_86 : 'w',_69 : 'e',_82 : 'r',_84 : 't',_89 : 'y',_85 : 'u',_73 : 'i',_79 : 'o',_80 : 'p',_65 : 'a',_83 : 's',_68 : 'd',_70 : 'f',_71 : 'g',_72 : 'h',_74 : 'j',_75 : 'k',_76 : 'l',_90 : 'z',_88 : 'x',_67 : 'c',_86 : 'v',_66 : 'b',_78 : 'n',_77 : 'm',_32 : 'spacebar'
}
}
extend(ui.methods,{ui : true,get : function(el) {return $(getElement(el,this));},display : function() {return this.css('display') == 'none' ? this.show() : this.hide()},show : function() {return this.css('display:block')},hide : function() {return this.css('display:none')},visibility : function() {return this.css('visibility') == 'visible' ? this.visible() : this.visible()},visible : function() {return this.css('visibility:visible')},visible : function() {return this.css('visibility:visible')},disable : function() {this.disabled = true;return this;},enable : function() {this.disabled = false;return this;},check : function() {this.checked = true;return this;},uncheck : function() {this.checked = false;return this;},select : function(no) {this.selected = this.value == no ? true : false;return this;},alpha : function(opacity) {this.style.opacity = opacity/100;this.style.filter = "alpha(opacity="+opacity+")";return this;},getTop : function(depth) {return getOffset(this,depth).top;},getLeft : function(depth) {return getOffset(this,depth).left;},setClass : function(val) {this.className = val;return this},addClass : function(val) {this.className += ' '+val;return this},removeClass : function(val) {var cls = this.className.split(' '),newcls = [];for (var i=0;cls[i];i++) {if(cls[i] != val) newcls.push(cls[i])}
this.className = newcls.join(' ');return this
},inHTML : function(html) {this.innerHTML = html;return this},addHTML : function(html) {this.innerHTML = html + this.innerHTML;return this},pushHTML : function(html) {this.innerHTML += html;return this},inAjax : function(url,fade) {var obj = this,fade = fade;if(fade) obj.alpha(0);Ajax.post(url,'',function(res) {obj.innerHTML = res.responseText;if(fade) obj.fadeTo(100,10);})
return this;},remove : function() {this.parentNode.removeChild(this)},clearChild : function() {return this.inHTML('')},css : function(val) {if (!val) return this;var stylesheet = val.split(';');for (var i=0;stylesheet[i];i++) {try{var styles = /:/.test(stylesheet[i]);stylesheet[i] = stylesheet[i].split(':');if (/-/.test(stylesheet[i][0])) {stylesheet[i][2] = stylesheet[i][0];stylesheet[i][0] = stylesheet[i][0].replace(/-[a-z]/,/-[a-z]/.exec(stylesheet[i][0])[0].replace('-','').toUpperCase())
}
if (styles) eval('this.style.'+stylesheet[i][0]+'="'+stylesheet[i][1]+'"');else if (this.style[stylesheet[i][0]])return this.style[stylesheet[i][0]];else if (this.currentStyle) return eval('this.currentStyle.'+stylesheet[i][0]);else return document.defaultView.getComputedStyle(this,null).getPropertyValue(stylesheet[i][2]);}catch(e){}}
return this;},attr : function(attr) {if (!attr) return this;var param = attr.split(';');for (var i=0;param[i];i++) {param[i] = param[i].split('=');if(param[i].length > 1) {if (param[i][0] == 'id' && getElement(param[i][1]))alert(param[i][1]+' ID overlap');else
this.setAttribute(param[i][0],param[i][1]||'');} else {return this.getAttribute(param[i][0]);}
}
return this;}
});extend(ui.methods,{scrollTo : function(left,top,speed,wheel) {if (this._scroll) clearInterval(this._scroll)
var obj = this,speed = (speed || 20).max(20);if(safari && /html/i.test(obj.nodeName)) obj = document.body;var Tmax = obj.scrollHeight - obj.clientHeight,_top = top < Tmax ? top : Tmax;var Lmax = obj.scrollWidth - obj.clientWidth,_left = left < Lmax ? left : Lmax;var action = function() {obj.scrollTop = obj.scrollTop + $N((_top - obj.scrollTop) / (21 - speed)).one() || 0;obj.scrollLeft = obj.scrollLeft + $N((_left - obj.scrollLeft) / (21 - speed)).one() || 0;if (_top == obj.scrollTop && _left == obj.scrollLeft) clearInterval(obj._scroll);}
obj._scroll = setInterval(function() {action()},10);if(wheel) obj.wheel(function() {clearInterval(obj._scroll)})
},scrollBy : function(left,top,speed) {return this.scrollTo(left+this.scrollLeft,top+this.scrollTop,speed);},fadeTo : function(opacity,speed) {if (this._fade) clearInterval(this._fade);var obj = this,alpha = obj.style.filter ? obj.css('filter').replace(/[a-z|(|=|)|'|"]/ig,'') : obj.css('opacity')*100;var res = new getMotion([alpha,opacity,speed]);var action = function() {if (res.length) obj.alpha(res.shift());else clearInterval(obj._fade);}
this._fade = setInterval(function(){action()},10)
return this;},fadeBy : function(opacity,speed) {var alpha = this.css('filter') ? this.css('filter').replace(/[a-z|(|=|)|'|"]/ig,'') : this.css('opacity')*100 || 100;return this.fadeTo($N(alpha)+opacity,speed)
},zoomTo : function(w,h,speed,accel) {if (this._zoom) clearInterval(this._zoom);var obj = this,tw = this.clientWidth,th = this.clientHeight;var res = new getMotion([tw,w||tw,speed,accel],[th,h||th,speed,accel]);var action = function() {if (res[0][0]||res[1][0]) obj.css('width:'+res[0].shift()+'px;height:'+res[1].shift()+'px;');else clearInterval(obj._zoom);}
this._zoom = setInterval(function(){action()},10);return this;},zoomBy : function(w,h,speed,accel) {return  this.zoomTo(this.clientWidth+w,this.clientHeight+h,speed,accel);},moveTo : function(x,y,speed,accel) {if (this._moveTo) clearInterval(this._moveTo);var obj = this,top = getOffset(this,true).top,left = getOffset(this,true).left;var res = new getMotion([top,y,speed,accel],[left,x,speed,accel]);var action = function() {if (res[0][0]||res[1][0])
obj.css('position:absolute;top:'+res[0].shift()+'px;left:'+res[1].shift()+'px;');else
clearInterval(obj._moveTo);}
this._moveTo = setInterval(function(){action()},10);return this;},moveBy : function(x,y,speed,accel) {return this.moveTo(getOffset(this,true).left+x,getOffset(this,true).top+y,speed,accel);},colorTo : function(style,tc,speed) {if (this._color) clearInterval(this._color);var obj = this,style = style,s = speed,sC = $RGB(this.css(style)),eC = $RGB(tc);var res = new getMotion([$N(sC[0]),$N(eC[0]),s],[$N(sC[1]),$N(eC[1]),1],[$N(sC[2]),$N(eC[2]),1]);var action = function() {if (res[0][1] || res[1][1] || res[0][1])
obj.css(style+':#'+$Hex(res[0].inshift(),2) + $Hex(res[1].inshift(),2) + $Hex(res[2].inshift(),2));else
clearInterval(obj._color);}
this._color = setInterval(function(){action()},10)
return this;}
})
Widget = {rolling : function(obj,child) {var master = $(obj);var list = master ? master.get(child) : false;if(list.length > 1) {var count = list.length - 1,now = 0,prev = 0,timer,ms,dac;var fade = function() {list[prev].show().css('z-index:1').fadeTo(0,3);list[now].show().css('z-index:2').fadeTo(100,3);prev = now;now = now >= count ? 0 : now + 1;}
var scroll = function() {master.scrollBy(0,list[0].clientHeight,1);if(!now) master.scrollTo(0,0);prev = now;now = now >= (count +1) ? 0 : now + 1;}
this.play = function(ac,delay) {dac = ac || 'fade';ms = delay*1000 || 3000;if(ac == 'fade') for(var i=0;list[i];i++) list[i].alpha(0).css('position:absolute;z-index:1');if(ac == 'scroll') master.appendChild(list[prev].cloneNode(true));eval("setTimeout(function() {"+dac+"()},0)")
this.loop();}
this.loop = function() {eval("timer = setInterval(function() {"+dac+"()},ms)")}
this.stop = function() {clearInterval(timer)}
$(obj).onmouseover = this.stop;$(obj).onmouseout = this.loop;} else {this.play = function() {return false;}}
},topbtn : function() {var btn = DOM('img');var fix = DOM('div').css('width:1000px;height:1px;overflow:hidden;');btn.css('cursor:pointer').Click(function(){$(Document()).scrollTo(0,0,18);});btn.limit = function(t,f) {this.t = t || 0;this.f = f || 0}
btn.position = function(x,y,m) {this._x = x || 0;this._y = y || 0;this._m = m || 0;}
btn.init = function(sp) {btn.css('position:absolute;top:'+this._y+';left:'+this._x+';margin:'+this._m+';');btn.load = 0;var speed = sp || 10;var sc = DOM('div',btn,fix).css('visibility:visible;position:absolute;top:0;left:0;width:100%;height:'+Document().clientHeight+'px;z-index:1;');document.body.appendChild(sc);var action = function() {var Top = btn.getTop(1);var nowTop = Document().scrollTop + Document().clientHeight;var maxTop = document.body.scrollHeight - $N(btn.f);var addTop = $N(btn.t) - (Document().scrollTop+Top) > 0 ? $N(btn.t) - (Document().scrollTop+Top) : 0;var addFoot = (maxTop-nowTop < 0) ? maxTop-nowTop : 0;sc.moveTo(0,Document().scrollTop+addTop+addFoot,(btn.load ? speed : 0));btn.load = 1;}
if(!chrome) addEvent(window,'scroll',action);addEvent(window,'resize',function() {sc.css('height:'+Document().clientHeight+'px');action();});action();sc.visible();}
return btn;}
}
Img = {view : function(obj,e) {if(!obj.onmouseout) obj.onmouseout = function() {try{$('FullImageViewer').remove()} catch(e) {}};if(!$('FullImageViewer'))  {var img = DOM('img').attr('src='+obj.src);var div = DOM('div',img).attr('id=FullImageViewer').css('position:absolute;left:-500px;top:-500px;padding:10px;background:#fff;border:1px solid #a1eeff;z-index:10;');document.body.appendChild(div);}
var tg = $('FullImageViewer').show();tg.css('top:'+(Event.pointerY(e)-(tg.clientHeight/2))+'px;left:'+(Event.pointerX(e)-tg.clientWidth-30)+'px;');},resize : function(img,wi,he,zi) {var ts = false,i = img,w = wi,h = he,z = zi;if(i.width) {if(w && (i.width>w)) {i.width = w;ts = true;}
if(h && (i.height>h)) {i.height = h;ts = true;}
if(ts && z) i.onmousemove = function(e) {Img.view(this,e)}
} else {addEvent(window,'load',function() {Img.resize(i,w,h,z)})
}
i.className = '';}
}
function resizeImg(img,w,h) {if(img.width > w) img.width = w;if(img.height > h) img.height = h;}
Nate = {setEmail : function(obj) {obj.css('border-color:#bbb;');obj.onfocus = function(){obj.css('border-color:#bbb;');if(obj.value) emailDiv.show();setOver(E[Cookie.get('NateDefaultEmail') || 0])};obj.Blur(function(){setting()});obj.now = Cookie.get('NateDefaultEmail') || 0;var emails = ['@nate.com','@lycos.co.kr','@netsgo.com'];var style = 'position:absolute;background:#fff;width:'+obj.clientWidth+'px;margin:'+(obj.clientHeight+(msie ? 2 : 1))+'px 0 0 0;z-index:100;border:1px solid #bbb;overflow:hidden;';var E = [DOM('div').attr('no=0').inHTML(emails[0]),DOM('div').attr('no=1').inHTML(emails[1]),DOM('div').attr('no=2').inHTML(emails[2])]
E.each(function(){this
.css('color:#999999;font:normal 11px tahoma;padding:4px 5px;cursor:pointer;overflow:hidden;')
.Mouseover(function(){setOver(this);});})
var setOver = function(o) {for(var d=0;E[d];d++) {E[d].css('color:#888;background:#fff;').removeClass('selected');}
o.css('color:#222;background:#ddd;').setClass('selected');Cookie.set('NateDefaultEmail',o.attr('no'),30);}
var emailDiv = DOM('div',E[0],E[1],E[2]).css(style).hide();obj.parentNode.insertBefore(emailDiv,obj);obj.Keyup(function(e) {for(var i=0;E[i];i++) {var ts = '<span style="color:#4700d8">'+obj.value.del(/[\W].*/g)+'</span>'+emails[i];E[i].inHTML(ts).attr('title='+ts.del($R.tag));}
if(obj.value) emailDiv.show();else emailDiv.hide();})
obj.Keydown(function(e){setOver(E[obj.now]);var code = Event.keycode(e);if(code == 13) return setting();if(code == 40) {obj.now = obj.now > 1 ? 0 : $N(obj.now) + 1;setOver(E[obj.now]);}
if(code == 38) {obj.now = obj.now < 1 ? 2 : $N(obj.now) - 1;setOver(E[obj.now]);}
})
var setting =function() {obj.value = obj.value ? emailDiv.get('/div.selected')[0].innerHTML.del($R.tag,'') : '';obj.css('border-color:#dedede;')
$('PASSWD').focus();emailDiv.hide();return false;}
setOver(E[obj.now]);},msg : function(x,y,val) {var m = DOM('img').css('position:absolute;top:'+y+';left:'+x+';z-index:50;'+val).alpha(0);m.src = '/img/nate/Ex_NateMember.gif';document.body.appendChild(m);m.fadeTo(100,15);setTimeout(function() {m.fadeTo(0,15)},2500)
setTimeout(function() {m.remove()},3000)
},email : function(obj) {var img = DOM('img').alpha(0).css('position:absolute;z-index:50;');img.src = obj.src.replace('.gif','_over.gif');img.Mouseover(function() {this.fadeTo(100,12);}).Mouseout(function() {this.fadeTo(0,15);})
obj.onmouseover = null;obj.parentNode.insertBefore(img,obj);}
}
