/**
 * @author xfun
 */
/* yahoo */
var YAHOO = window.YAHOO ||
{};
YAHOO.namespace = function(_1){
    if (!_1 || !_1.length) {
        return null;
    }
    var _2 = _1.split(".");
    var _3 = YAHOO;
    for (var i = (_2[0] == "YAHOO") ? 1 : 0; i < _2.length; ++i) {
        _3[_2[i]] = _3[_2[i]] ||
        {};
        _3 = _3[_2[i]];
    }
    return _3;
};
YAHOO.namespace("util");
YAHOO.namespace("widget");
YAHOO.namespace("example");
/* connection */
YAHOO.util.Connect = {
    _msxml_progid: ['MSXML2.XMLHTTP.5.0', 'MSXML2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP'],
    _http_header: {},
    _has_http_headers: false,
    _isFormSubmit: false,
    _sFormData: null,
    _poll: [],
    _polling_interval: 50,
    _transaction_id: 0,
    setProgId: function(id){
        this.msxml_progid.unshift(id);
    },
    setPollingInterval: function(i){
        if (typeof i == 'number' && isFinite(i)) {
            this._polling_interval = i;
        }
    },
    createXhrObject: function(transactionId){
        var obj, http;
        try {
            http = new XMLHttpRequest();
            obj = {
                conn: http,
                tId: transactionId
            };
        } 
        catch (e) {
            for (var i = 0; i < this._msxml_progid.length; ++i) {
                try {
                    http = new ActiveXObject(this._msxml_progid[i]);
                    if (http) {
                        obj = {
                            conn: http,
                            tId: transactionId
                        };
                        break;
                    }
                } 
                catch (e) {
                }
            }
        }
        finally {
            return obj;
        }
    },
    getConnectionObject: function(){
        var o;
        var tId = this._transaction_id;
        try {
            o = this.createXhrObject(tId);
            if (o) {
                this._transaction_id++;
            }
        } 
        catch (e) {
        }
        finally {
            return o;
        }
    },
    asyncRequest: function(method, uri, callback, postData){
        var o = this.getConnectionObject();
        if (!o) {
            return null;
        }
        else {
            if (this._isFormSubmit) {
                if (method == 'GET') {
                    uri += "?" + this._sFormData;
                }
                else 
                    if (method == 'POST') {
                        postData = this._sFormData;
                    }
                this._sFormData = '';
                this._isFormSubmit = false;
            }
            o.conn.open(method, uri, true);
            if (postData) {
                this.initHeader('Content-Type', 'application/x-www-form-urlencoded');
            }
            if (this._has_http_headers) {
                this.setHeader(o);
            }
            this.handleReadyState(o, callback);
            postData ? o.conn.send(postData) : o.conn.send(null);
            return o;
        }
    },
    handleReadyState: function(o, callback){
        var oConn = this;
        try {
            this._poll[o.tId] = window.setInterval(function(){
                if (o.conn && o.conn.readyState == 4) {
                    window.clearInterval(oConn._poll[o.tId]);
                    oConn._poll.splice(o.tId);
                    oConn.handleTransactionResponse(o, callback);
                }
            }, this._polling_interval);
        } 
        catch (e) {
            window.clearInterval(oConn._poll[o.tId]);
            oConn._poll.splice(o.tId);
            oConn.handleTransactionResponse(o, callback);
        }
    },
    handleTransactionResponse: function(o, callback){
        if (!callback) {
            this.releaseObject(o);
            return;
        }
        var httpStatus;
        var responseObject;
        try {
            httpStatus = o.conn.status;
        } 
        catch (e) {
            httpStatus = 13030;
        }
        if (httpStatus >= 200 && httpStatus < 300) {
            responseObject = this.createResponseObject(o, callback.argument);
            if (callback.success) {
                if (!callback.scope) {
                    callback.success(responseObject);
                }
                else {
                    callback.success.apply(callback.scope, [responseObject]);
                }
            }
        }
        else {
            switch (httpStatus) {
                case 12002:
                case 12029:
                case 12030:
                case 12031:
                case 12152:
                case 13030:
                    responseObject = this.createExceptionObject(o, callback.argument);
                    if (callback.failure) {
                        if (!callback.scope) {
                            callback.failure(responseObject);
                        }
                        else {
                            callback.failure.apply(callback.scope, [responseObject]);
                        }
                    }
                    break;
                default:
                    responseObject = this.createResponseObject(o, callback.argument);
                    if (callback.failure) {
                        if (!callback.scope) {
                            callback.failure(responseObject);
                        }
                        else {
                            callback.failure.apply(callback.scope, [responseObject]);
                        }
                    }
            }
        }
        this.releaseObject(o);
    },
    createResponseObject: function(o, callbackArg){
        var obj = {};
        var headerObj = {};
        try {
            var headerStr = o.conn.getAllResponseHeaders();
            var header = headerStr.split("\n");
            for (var i = 0; i < header.length; i++) {
                var delimitPos = header[i].indexOf(':');
                if (delimitPos != -1) {
                    headerObj[header[i].substring(0, delimitPos)] = header[i].substring(delimitPos + 1);
                }
            }
            obj.tId = o.tId;
            obj.status = o.conn.status;
            obj.statusText = o.conn.statusText;
            obj.getResponseHeader = headerObj;
            obj.getAllResponseHeaders = headerStr;
            obj.responseText = o.conn.responseText;
            obj.responseXML = o.conn.responseXML;
            if (typeof callbackArg !== undefined) {
                obj.argument = callbackArg;
            }
        } 
        catch (e) {
        }
        finally {
            return obj;
        }
    },
    createExceptionObject: function(tId, callbackArg){
        var COMM_CODE = 0;
        var COMM_ERROR = 'communication failure';
        var obj = {};
        obj.tId = tId;
        obj.status = COMM_CODE;
        obj.statusText = COMM_ERROR;
        if (callbackArg) {
            obj.argument = callbackArg;
        }
        return obj;
    },
    initHeader: function(label, value){
        if (this._http_header[label] === undefined) {
            this._http_header[label] = value;
        }
        else {
            this._http_header[label] = value + "," + this._http_header[label];
        }
        this._has_http_headers = true;
    },
    setHeader: function(o){
        for (var prop in this._http_header) {
            o.conn.setRequestHeader(prop, this._http_header[prop]);
        }
        delete this._http_header;
        this._http_header = {};
        this._has_http_headers = false;
    },
    setForm: function(formId){
        this._sFormData = '';
        if (typeof formId == 'string') {
            var oForm = (document.getElementById(formId) || document.forms[formId]);
        }
        else 
            if (typeof formId == 'object') {
                var oForm = formId;
            }
            else {
                return;
            }
        var oElement, oName, oValue, oDisabled;
        var hasSubmit = false;
        for (var i = 0; i < oForm.elements.length; i++) {
            oDisabled = oForm.elements[i].disabled;
            oElement = oForm.elements[i];
            oName = oForm.elements[i].name;
            oValue = oForm.elements[i].value;
            if (!oDisabled) {
                switch (oElement.type) {
                    case 'select-one':
                    case 'select-multiple':
                        for (var j = 0; j < oElement.options.length; j++) {
                            if (oElement.options[j].selected) {
                                this._sFormData += encodeURIComponent(oName) + '=' + encodeURIComponent(oElement.options[j].value || oElement.options[j].text) + '&';
                            }
                        }
                        break;
                    case 'radio':
                    case 'checkbox':
                        if (oElement.checked) {
                            this._sFormData += encodeURIComponent(oName) + '=' + encodeURIComponent(oValue) + '&';
                        }
                        break;
                    case 'file':
                    case undefined:
                    case 'reset':
                    case 'button':
                        break;
                    case 'submit':
                        if (hasSubmit == false) {
                            this._sFormData += encodeURIComponent(oName) + '=' + encodeURIComponent(oValue) + '&';
                            hasSubmit = true;
                        }
                        break;
                    default:
                        this._sFormData += encodeURIComponent(oName) + '=' + encodeURIComponent(oValue) + '&';
                        break;
                }
            }
        }
        this._isFormSubmit = true;
        this._sFormData = this._sFormData.substr(0, this._sFormData.length - 1);
    },
    abort: function(o){
        if (this.isCallInProgress(o)) {
            window.clearInterval(this._poll[o.tId]);
            this._poll.splice(o.tId);
            o.conn.abort();
            this.releaseObject(o);
            return true;
        }
        else {
            return false;
        }
    },
    isCallInProgress: function(o){
        if (o.conn) {
            return o.conn.readyState != 4 && o.conn.readyState != 0;
        }
        else {
            return false;
        }
    },
    releaseObject: function(o){
        o.conn = null;
        o = null;
    }
};
/* dom */
YAHOO.util.Dom = function(){
    var ua = navigator.userAgent.toLowerCase();
    var isOpera = (ua.indexOf('opera') != -1);
    var isIE = (ua.indexOf('msie') != -1 && !isOpera);
    var id_counter = 0;
    return {
        get: function(el){
            if (typeof el != 'string' && !(el instanceof Array)) {
                return el;
            }
            if (typeof el == 'string') {
                return document.getElementById(el);
            }
            else {
                var collection = [];
                for (var i = 0, len = el.length; i < len; ++i) {
                    collection[collection.length] = this.get(el[i]);
                }
                return collection;
            }
            return null;
        },
        getStyle: function(el, property){
            var f = function(el){
                var value = null;
                var dv = document.defaultView;
                if (property == 'opacity' && el.filters) {
                    value = 1;
                    try {
                        value = el.filters.item('DXImageTransform.Microsoft.Alpha').opacity / 100;
                    } 
                    catch (e) {
                        try {
                            value = el.filters.item('alpha').opacity / 100;
                        } 
                        catch (e) {
                        }
                    }
                }
                else 
                    if (el.style[property]) {
                        value = el.style[property];
                    }
                    else 
                        if (el.currentStyle && el.currentStyle[property]) {
                            value = el.currentStyle[property];
                        }
                        else 
                            if (dv && dv.getComputedStyle) {
                                var converted = '';
                                for (var i = 0, len = property.length; i < len; ++i) {
                                    if (property.charAt(i) == property.charAt(i).toUpperCase()) {
                                        converted = converted + '-' + property.charAt(i).toLowerCase();
                                    }
                                    else {
                                        converted = converted + property.charAt(i);
                                    }
                                }
                                if (dv.getComputedStyle(el, '') && dv.getComputedStyle(el, '').getPropertyValue(converted)) {
                                    value = dv.getComputedStyle(el, '').getPropertyValue(converted);
                                }
                            }
                return value;
            };
            return this.batch(el, f, this, true);
        },
        setStyle: function(el, property, val){
            var f = function(el){
                switch (property) {
                    case 'opacity':
                        if (isIE && typeof el.style.filter == 'string') {
                            el.style.filter = 'alpha(opacity=' + val * 100 + ')';
                            if (!el.currentStyle || !el.currentStyle.hasLayout) {
                                el.style.zoom = 1;
                            }
                        }
                        else {
                            el.style.opacity = val;
                            el.style['-moz-opacity'] = val;
                            el.style['-khtml-opacity'] = val;
                        }
                        break;
                    default:
                        el.style[property] = val;
                }
            };
            this.batch(el, f, this, true);
        },
        getXY: function(el){
            var f = function(el){
                if (el.parentNode === null || this.getStyle(el, 'display') == 'none') {
                    return false;
                }
                var parent = null;
                var pos = [];
                var box;
                if (el.getBoundingClientRect) {
                    box = el.getBoundingClientRect();
                    var scrollTop = Math.max(document.documentElement.scrollTop, document.body.scrollTop);
                    var scrollLeft = Math.max(document.documentElement.scrollLeft, document.body.scrollLeft);
                    return [box.left + scrollLeft, box.top + scrollTop];
                }
                else 
                    if (document.getBoxObjectFor) {
                        box = document.getBoxObjectFor(el);
                        var borderLeft = parseInt(this.getStyle(el, 'borderLeftWidth'));
                        var borderTop = parseInt(this.getStyle(el, 'borderTopWidth'));
                        pos = [box.x - borderLeft, box.y - borderTop];
                    }
                    else {
                        pos = [el.offsetLeft, el.offsetTop];
                        parent = el.offsetParent;
                        if (parent != el) {
                            while (parent) {
                                pos[0] += parent.offsetLeft;
                                pos[1] += parent.offsetTop;
                                parent = parent.offsetParent;
                            }
                        }
                        if (ua.indexOf('opera') != -1 || (ua.indexOf('safari') != -1 && this.getStyle(el, 'position') == 'absolute')) {
                            pos[0] -= document.body.offsetLeft;
                            pos[1] -= document.body.offsetTop;
                        }
                    }
                if (el.parentNode) {
                    parent = el.parentNode;
                }
                else {
                    parent = null;
                }
                while (parent && parent.tagName != 'BODY' && parent.tagName != 'HTML') {
                    pos[0] -= parent.scrollLeft;
                    pos[1] -= parent.scrollTop;
                    if (parent.parentNode) {
                        parent = parent.parentNode;
                    }
                    else {
                        parent = null;
                    }
                }
                return pos;
            };
            return this.batch(el, f, this, true);
        },
        getX: function(el){
            return this.getXY(el)[0];
        },
        getY: function(el){
            return this.getXY(el)[1];
        },
        setXY: function(el, pos, noRetry){
            var f = function(el){
                var style_pos = this.getStyle(el, 'position');
                if (style_pos == 'static') {
                    this.setStyle(el, 'position', 'relative');
                    style_pos = 'relative';
                }
                var pageXY = YAHOO.util.Dom.getXY(el);
                if (pageXY === false) {
                    return false;
                }
                var delta = [parseInt(YAHOO.util.Dom.getStyle(el, 'left'), 10), parseInt(YAHOO.util.Dom.getStyle(el, 'top'), 10)];
                if (isNaN(delta[0])) {
                    delta[0] = (style_pos == 'relative') ? 0 : el.offsetLeft;
                }
                if (isNaN(delta[1])) {
                    delta[1] = (style_pos == 'relative') ? 0 : el.offsetTop;
                }
                if (pos[0] !== null) {
                    el.style.left = pos[0] - pageXY[0] + delta[0] + 'px';
                }
                if (pos[1] !== null) {
                    el.style.top = pos[1] - pageXY[1] + delta[1] + 'px';
                }
                var newXY = this.getXY(el);
                if (!noRetry && (newXY[0] != pos[0] || newXY[1] != pos[1])) {
                    var retry = function(){
                        YAHOO.util.Dom.setXY(el, pos, true);
                    };
                    setTimeout(retry, 0);
                }
            };
            this.batch(el, f, this, true);
        },
        setX: function(el, x){
            this.setXY(el, [x, null]);
        },
        setY: function(el, y){
            this.setXY(el, [null, y]);
        },
        getRegion: function(el){
            var f = function(el){
                return new YAHOO.util.Region.getRegion(el);
            };
            return this.batch(el, f, this, true);
        },
        getClientWidth: function(){
            return this.getViewportWidth();
        },
        getClientHeight: function(){
            return this.getViewportHeight();
        },
        getElementsByClassName: function(className, tag, root){
            var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)');
            var method = function(el){
                return re.test(el['className']);
            };
            return this.getElementsBy(method, tag, root);
        },
        hasClass: function(el, className){
            var f = function(el){
                var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)');
                return re.test(el['className']);
            };
            return this.batch(el, f, this, true);
        },
        addClass: function(el, className){
            var f = function(el){
                if (this.hasClass(el, className)) {
                    return;
                }
                el['className'] = [el['className'], className].join(' ');
            };
            this.batch(el, f, this, true);
        },
        removeClass: function(el, className){
            var f = function(el){
                if (!this.hasClass(el, className)) {
                    return;
                }
                var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)', 'g');
                var c = el['className'];
                el['className'] = c.replace(re, ' ');
            };
            this.batch(el, f, this, true);
        },
        replaceClass: function(el, oldClassName, newClassName){
            var f = function(el){
                this.removeClass(el, oldClassName);
                this.addClass(el, newClassName);
            };
            this.batch(el, f, this, true);
        },
        generateId: function(el, prefix){
            prefix = prefix || 'yui-gen';
            var f = function(el){
                el = el ||
                {};
                if (!el.id) {
                    el.id = prefix + id_counter++;
                }
                return el.id;
            };
            return this.batch(el, f, this, true);
        },
        isAncestor: function(haystack, needle){
            haystack = this.get(haystack);
            if (!haystack || !needle) {
                return false;
            }
            var f = function(needle){
                if (haystack.contains && ua.indexOf('safari') < 0) {
                    return haystack.contains(needle);
                }
                else 
                    if (haystack.compareDocumentPosition) {
                        return !!(haystack.compareDocumentPosition(needle) & 16);
                    }
                    else {
                        var parent = needle.parentNode;
                        while (parent) {
                            if (parent == haystack) {
                                return true;
                            }
                            else 
                                if (parent.tagName == 'HTML') {
                                    return false;
                                }
                            parent = parent.parentNode;
                        }
                        return false;
                    }
            };
            return this.batch(needle, f, this, true);
        },
        inDocument: function(el){
            var f = function(el){
                return this.isAncestor(document.documentElement, el);
            };
            return this.batch(el, f, this, true);
        },
        getElementsBy: function(method, tag, root){
            tag = tag || '*';
            root = this.get(root) || document;
            var nodes = [];
            var elements = root.getElementsByTagName(tag);
            if (!elements.length && (tag == '*' && root.all)) {
                elements = root.all;
            }
            for (var i = 0, len = elements.length; i < len; ++i) {
                if (method(elements[i])) {
                    nodes[nodes.length] = elements[i];
                }
            }
            return nodes;
        },
        batch: function(el, method, o, override){
            el = this.get(el);
            var scope = (override) ? o : window;
            if (!el || el.tagName || !el.length) {
                return method.call(scope, el, o);
            }
            var collection = [];
            for (var i = 0, len = el.length; i < len; ++i) {
                collection[collection.length] = method.call(scope, el[i], o);
            }
            return collection;
        },
        getDocumentHeight: function(){
            var scrollHeight = -1, windowHeight = -1, bodyHeight = -1;
            var marginTop = parseInt(this.getStyle(document.body, 'marginTop'), 10);
            var marginBottom = parseInt(this.getStyle(document.body, 'marginBottom'), 10);
            var mode = document.compatMode;
            if ((mode || isIE) && !isOpera) {
                switch (mode) {
                    case 'CSS1Compat':
                        scrollHeight = ((window.innerHeight && window.scrollMaxY) ? window.innerHeight + window.scrollMaxY : -1);
                        windowHeight = [document.documentElement.clientHeight, self.innerHeight || -1].sort(function(a, b){
                            return (a - b);
                        })[1];
                        bodyHeight = document.body.offsetHeight + marginTop + marginBottom;
                        break;
                    default:
                        scrollHeight = document.body.scrollHeight;
                        bodyHeight = document.body.clientHeight;
                }
            }
            else {
                scrollHeight = document.documentElement.scrollHeight;
                windowHeight = self.innerHeight;
                bodyHeight = document.documentElement.clientHeight;
            }
            var h = [scrollHeight, windowHeight, bodyHeight].sort(function(a, b){
                return (a - b);
            });
            return h[2];
        },
        getDocumentWidth: function(){
            var docWidth = -1, bodyWidth = -1, winWidth = -1;
            var marginRight = parseInt(this.getStyle(document.body, 'marginRight'), 10);
            var marginLeft = parseInt(this.getStyle(document.body, 'marginLeft'), 10);
            var mode = document.compatMode;
            if (mode || isIE) {
                switch (mode) {
                    case 'CSS1Compat':
                        docWidth = document.documentElement.clientWidth;
                        bodyWidth = document.body.offsetWidth + marginLeft + marginRight;
                        winWidth = self.innerWidth || -1;
                        break;
                    default:
                        bodyWidth = document.body.clientWidth;
                        winWidth = document.body.scrollWidth;
                        break;
                }
            }
            else {
                docWidth = document.documentElement.clientWidth;
                bodyWidth = document.body.offsetWidth + marginLeft + marginRight;
                winWidth = self.innerWidth;
            }
            var w = [docWidth, bodyWidth, winWidth].sort(function(a, b){
                return (a - b);
            });
            return w[2];
        },
        getViewportHeight: function(){
            var height = -1;
            var mode = document.compatMode;
            if ((mode || isIE) && !isOpera) {
                switch (mode) {
                    case 'CSS1Compat':
                        height = document.documentElement.clientHeight;
                        break;
                    default:
                        height = document.body.clientHeight;
                }
            }
            else {
                height = self.innerHeight;
            }
            return height;
        },
        getViewportWidth: function(){
            var width = -1;
            var mode = document.compatMode;
            if (mode || isIE) {
                switch (mode) {
                    case 'CSS1Compat':
                        width = document.documentElement.clientWidth;
                        break;
                    default:
                        width = document.body.clientWidth;
                }
            }
            else {
                width = self.innerWidth;
            }
            return width;
        }
    };
}();
YAHOO.util.Region = function(t, r, b, l){
    this.top = t;
    this[1] = t;
    this.right = r;
    this.bottom = b;
    this.left = l;
    this[0] = l;
};
YAHOO.util.Region.prototype.contains = function(region){
    return (region.left >= this.left && region.right <= this.right && region.top >= this.top && region.bottom <= this.bottom);
};
YAHOO.util.Region.prototype.getArea = function(){
    return ((this.bottom - this.top) * (this.right - this.left));
};
YAHOO.util.Region.prototype.intersect = function(region){
    var t = Math.max(this.top, region.top);
    var r = Math.min(this.right, region.right);
    var b = Math.min(this.bottom, region.bottom);
    var l = Math.max(this.left, region.left);
    if (b >= t && r >= l) {
        return new YAHOO.util.Region(t, r, b, l);
    }
    else {
        return null;
    }
};
YAHOO.util.Region.prototype.union = function(region){
    var t = Math.min(this.top, region.top);
    var r = Math.max(this.right, region.right);
    var b = Math.max(this.bottom, region.bottom);
    var l = Math.min(this.left, region.left);
    return new YAHOO.util.Region(t, r, b, l);
};
YAHOO.util.Region.prototype.toString = function(){
    return ("Region {" + "t: " + this.top + ", r: " + this.right + ", b: " + this.bottom + ", l: " + this.left + "}");
};
YAHOO.util.Region.getRegion = function(el){
    var p = YAHOO.util.Dom.getXY(el);
    var t = p[1];
    var r = p[0] + el.offsetWidth;
    var b = p[1] + el.offsetHeight;
    var l = p[0];
    return new YAHOO.util.Region(t, r, b, l);
};
YAHOO.util.Point = function(x, y){
    this.x = x;
    this.y = y;
    this.top = y;
    this[1] = y;
    this.right = x;
    this.bottom = y;
    this.left = x;
    this[0] = x;
};
YAHOO.util.Point.prototype = new YAHOO.util.Region();
/* event */
YAHOO.util.CustomEvent = function(_1, _2){
    this.type = _1;
    this.scope = _2 || window;
    this.subscribers = [];
    if (YAHOO.util.Event) {
        YAHOO.util.Event.regCE(this);
    }
};
YAHOO.util.CustomEvent.prototype = {
    subscribe: function(fn, _4, _5){
        this.subscribers.push(new YAHOO.util.Subscriber(fn, _4, _5));
    },
    unsubscribe: function(fn, _6){
        var _7 = false;
        for (var i = 0, len = this.subscribers.length; i < len; ++i) {
            var s = this.subscribers[i];
            if (s && s.contains(fn, _6)) {
                this._delete(i);
                _7 = true;
            }
        }
        return _7;
    },
    fire: function(){
        for (var i = 0, len = this.subscribers.length; i < len; ++i) {
            var s = this.subscribers[i];
            if (s) {
                var _10 = (s.override) ? s.obj : this.scope;
                s.fn.call(_10, this.type, arguments, s.obj);
            }
        }
    },
    unsubscribeAll: function(){
        for (var i = 0, len = this.subscribers.length; i < len; ++i) {
            this._delete(i);
        }
    },
    _delete: function(_11){
        var s = this.subscribers[_11];
        if (s) {
            delete s.fn;
            delete s.obj;
        }
        delete this.subscribers[_11];
    }
};
YAHOO.util.Subscriber = function(fn, obj, _13){
    this.fn = fn;
    this.obj = obj || null;
    this.override = (_13);
};
YAHOO.util.Subscriber.prototype.contains = function(fn, obj){
    return (this.fn == fn && this.obj == obj);
};
if (!YAHOO.util.Event) {
    YAHOO.util.Event = function(){
        var _14 = false;
        var _15 = [];
        var _16 = [];
        var _17 = [];
        var _18 = [];
        var _19 = [];
        var _20 = [];
        var _21 = [];
        var _22 = 0;
        var _23 = [];
        var _24 = 0;
        var _25 = {};
        return {
            POLL_RETRYS: 200,
            POLL_INTERVAL: 50,
            EL: 0,
            TYPE: 1,
            FN: 2,
            WFN: 3,
            SCOPE: 3,
            ADJ_SCOPE: 4,
            isSafari: (/Safari|Konqueror|KHTML/gi).test(navigator.userAgent),
            isIE: (!this.isSafari && !navigator.userAgent.match(/opera/gi) && navigator.userAgent.match(/msie/gi)),
            addDelayedListener: function(el, _27, fn, _28, _29){
                _16[_16.length] = [el, _27, fn, _28, _29];
                if (_14) {
                    _22 = this.POLL_RETRYS;
                    this.startTimeout(0);
                }
            },
            startTimeout: function(_30){
                var _31 = this;
                var _32 = function(){
                    _31._tryPreloadAttach();
                };
                this.timeout = setTimeout(_32, _30);
            },
            onAvailable: function(_33, _34, _35, _36){
                _23.push({
                    id: _33,
                    fn: _34,
                    obj: _35,
                    override: _36
                });
                _22 = this.POLL_RETRYS;
                this.startTimeout(0);
            },
            addListener: function(el, _37, fn, _38, _39){
                if (!fn || !fn.call) {
                    return false;
                }
                if (this._isValidCollection(el)) {
                    var ok = true;
                    for (var i = 0, len = el.length; i < len; ++i) {
                        ok = (this.on(el[i], _37, fn, _38, _39) && ok);
                    }
                    return ok;
                }
                else {
                    if (typeof el == "string") {
                        var oEl = this.getEl(el);
                        if (_14 && oEl) {
                            el = oEl;
                        }
                        else {
                            this.addDelayedListener(el, _37, fn, _38, _39);
                            return true;
                        }
                    }
                }
                if (!el) {
                    return false;
                }
                if ("unload" == _37 && _38 !== this) {
                    _17[_17.length] = [el, _37, fn, _38, _39];
                    return true;
                }
                var _42 = (_39) ? _38 : el;
                var _43 = function(e){
                    return fn.call(_42, YAHOO.util.Event.getEvent(e), _38);
                };
                var li = [el, _37, fn, _43, _42];
                var _46 = _15.length;
                _15[_46] = li;
                this.mapListener(el, _37, fn, _46);
                if (this.useLegacyEvent(el, _37)) {
                    var _47 = this.getLegacyIndex(el, _37);
                    if (_47 == -1) {
                        _47 = _19.length;
                        _21[el.id + _37] = _47;
                        _19[_47] = [el, _37, el["on" + _37]];
                        _20[_47] = [];
                        el["on" + _37] = function(e){
                            return YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(e), _47);
                        };
                    }
                    _20[_47].push(_46);
                }
                else {
                    if (el.addEventListener) {
                        el.addEventListener(_37, _43, false);
                    }
                    else {
                        if (el.attachEvent) {
                            el.attachEvent("on" + _37, _43);
                        }
                    }
                }
                return true;
            },
            fireLegacyEvent: function(e, _48){
                var ok = true;
                var le = _20[_48];
                for (var i = 0, len = le.length; i < len; ++i) {
                    var _50 = le[i];
                    if (_50) {
                        var li = _15[_50];
                        if (li && li[this.WFN]) {
                            var _51 = li[this.ADJ_SCOPE];
                            var ret = li[this.WFN].call(_51, e);
                            ok = (ok && ret);
                        }
                        else {
                            delete le[i];
                        }
                    }
                }
                return ok;
            },
            getLegacyIndex: function(el, _53){
                var key = this.generateId(el) + _53;
                if (typeof _21[key] == "undefined") {
                    return -1;
                }
                else {
                    return _21[key];
                }
            },
            useLegacyEvent: function(el, _55){
                return ((!el.addEventListener && !el.attachEvent) || (_55 == "click" && this.isSafari));
            },
            removeListener: function(el, _56, fn, _57){
                if (!fn || !fn.call) {
                    return false;
                }
                if (typeof el == "string") {
                    el = this.getEl(el);
                }
                else {
                    if (this._isValidCollection(el)) {
                        var ok = true;
                        for (var i = 0, len = el.length; i < len; ++i) {
                            ok = (this.removeListener(el[i], _56, fn) && ok);
                        }
                        return ok;
                    }
                }
                if ("unload" == _56) {
                    for (i = 0, len = _17.length; i < len; i++) {
                        var li = _17[i];
                        if (li && li[0] == el && li[1] == _56 && li[2] == fn) {
                            delete _17[i];
                            return true;
                        }
                    }
                    return false;
                }
                var _58 = null;
                if ("undefined" == typeof _57) {
                    _57 = this._getCacheIndex(el, _56, fn);
                }
                if (_57 >= 0) {
                    _58 = _15[_57];
                }
                if (!el || !_58) {
                    return false;
                }
                if (el.removeEventListener) {
                    el.removeEventListener(_56, _58[this.WFN], false);
                }
                else {
                    if (el.detachEvent) {
                        el.detachEvent("on" + _56, _58[this.WFN]);
                    }
                }
                delete _15[_57][this.WFN];
                delete _15[_57][this.FN];
                delete _15[_57];
                return true;
            },
            getTarget: function(ev, _60){
                var t = ev.target || ev.srcElement;
                if (_60 && t && "#text" == t.nodeName) {
                    return t.parentNode;
                }
                else {
                    return t;
                }
            },
            getPageX: function(ev){
                var x = ev.pageX;
                if (!x && 0 !== x) {
                    x = ev.clientX || 0;
                    if (this.isIE) {
                        x += this._getScrollLeft();
                    }
                }
                return x;
            },
            getPageY: function(ev){
                var y = ev.pageY;
                if (!y && 0 !== y) {
                    y = ev.clientY || 0;
                    if (this.isIE) {
                        y += this._getScrollTop();
                    }
                }
                return y;
            },
            getXY: function(ev){
                return [this.getPageX(ev), this.getPageY(ev)];
            },
            getRelatedTarget: function(ev){
                var t = ev.relatedTarget;
                if (!t) {
                    if (ev.type == "mouseout") {
                        t = ev.toElement;
                    }
                    else {
                        if (ev.type == "mouseover") {
                            t = ev.fromElement;
                        }
                    }
                }
                return t;
            },
            getTime: function(ev){
                if (!ev.time) {
                    var t = new Date().getTime();
                    try {
                        ev.time = t;
                    } 
                    catch (e) {
                        return t;
                    }
                }
                return ev.time;
            },
            stopEvent: function(ev){
                this.stopPropagation(ev);
                this.preventDefault(ev);
            },
            stopPropagation: function(ev){
                if (ev.stopPropagation) {
                    ev.stopPropagation();
                }
                else {
                    ev.cancelBubble = true;
                }
            },
            preventDefault: function(ev){
                if (ev.preventDefault) {
                    ev.preventDefault();
                }
                else {
                    ev.returnValue = false;
                }
            },
            getEvent: function(e){
                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;
            },
            getCharCode: function(ev){
                return ev.charCode || ((ev.type == "keypress") ? ev.keyCode : 0);
            },
            _getCacheIndex: function(el, _65, fn){
                var key = el.id + _65;
                if (!_25[key]) {
                    return -1;
                }
                else {
                    for (var i = 0, len = _25[key].length; i < len; ++i) {
                        var _66 = _25[key][i];
                        if (_66.fn == fn) {
                            return _66.index;
                        }
                    }
                }
                return -1;
            },
            generateId: function(el){
                var id = el.id;
                if (!id) {
                    id = "yui-event-auto-id-" + (_24++);
                    el.id = id;
                }
                return id;
            },
            mapListener: function(_68, _69, _70, _71){
                var key = this.generateId(_68) + _69;
                if (!_25[key]) {
                    _25[key] = [];
                }
                _25[key].push({
                    fn: _70,
                    index: _71
                });
            },
            _isValidCollection: function(o){
                return (o && o.length && typeof o != "string" && !o.tagName && !o.alert && typeof o[0] != "undefined");
            },
            getEl: function(id){
                return document.getElementById(id);
            },
            clearCache: function(){
            },
            regCE: function(ce){
                _18.push(ce);
            },
            _load: function(e){
                _14 = true;
            },
            _tryPreloadAttach: function(){
                if (this.locked) {
                    return false;
                }
                this.locked = true;
                var _74 = !_14;
                if (!_74) {
                    _74 = (_22 > 0);
                }
                var _75 = [];
                for (var i = 0, len = _16.length; i < len; ++i) {
                    var d = _16[i];
                    if (d) {
                        var el = this.getEl(d[this.EL]);
                        if (el) {
                            this.on(el, d[this.TYPE], d[this.FN], d[this.SCOPE], d[this.ADJ_SCOPE]);
                            delete _16[i];
                        }
                        else {
                            _75.push(d);
                        }
                    }
                }
                _16 = _75;
                notAvail = [];
                for (i = 0, len = _23.length; i < len; ++i) {
                    var _77 = _23[i];
                    if (_77) {
                        el = this.getEl(_77.id);
                        if (el) {
                            var _78 = (_77.override) ? _77.obj : el;
                            _77.fn.call(_78, _77.obj);
                            delete _23[i];
                        }
                        else {
                            notAvail.push(_77);
                        }
                    }
                }
                _22 = (_75.length === 0 && notAvail.length === 0) ? 0 : _22 - 1;
                if (_74) {
                    this.startTimeout(this.POLL_INTERVAL);
                }
                this.locked = false;
            },
            _unload: function(e, me, _80){
                for (var i = 0, len = _17.length; i < len; ++i) {
                    var l = _17[i];
                    if (l) {
                        var _82 = (l[this.ADJ_SCOPE]) ? l[this.SCOPE] : window;
                        l[this.FN].call(_82, this.getEvent(e), l[this.SCOPE]);
                    }
                }
                len = _15.length;
                if (len) {
                    for (i = 0; i < len; ++i) {
                        l = _15[i];
                        if (l) {
                            this.removeListener(l[this.EL], l[this.TYPE], l[this.FN], i);
                        }
                    }
                    this.clearCache();
                }
                for (i = 0, len = _18.length; i < len; ++i) {
                    _18[i].unsubscribeAll();
                    delete _18[i];
                }
                for (i = 0, len = _19.length; i < len; ++i) {
                    delete _19[i];
                }
            },
            _getScrollLeft: function(){
                return this._getScroll()[1];
            },
            _getScrollTop: function(){
                return this._getScroll()[0];
            },
            _getScroll: function(){
                var dd = document.documentElement;
                db = document.body;
                if (dd && dd.scrollTop) {
                    return [dd.scrollTop, dd.scrollLeft];
                }
                else {
                    if (db) {
                        return [db.scrollTop, db.scrollLeft];
                    }
                    else {
                        return [0, 0];
                    }
                }
            }
        };
    }();
    YAHOO.util.Event.on = YAHOO.util.Event.addListener;
    if (document && document.body) {
        YAHOO.util.Event._load();
    }
    else {
        YAHOO.util.Event.on(window, "load", YAHOO.util.Event._load, YAHOO.util.Event, true);
    }
    YAHOO.util.Event.on(window, "unload", YAHOO.util.Event._unload, YAHOO.util.Event, true);
    YAHOO.util.Event._tryPreloadAttach();
}
/* drag and drop */
YAHOO.util.DragDrop = function(id, _2){
    if (id) {
        this.init(id, _2);
    }
};
YAHOO.util.DragDrop.prototype = {
    id: null,
    dragElId: null,
    handleElId: null,
    invalidHandleTypes: null,
    invalidHandleIds: null,
    invalidHandleClasses: null,
    startPageX: 0,
    startPageY: 0,
    groups: null,
    locked: false,
    lock: function(){
        this.locked = true;
    },
    unlock: function(){
        this.locked = false;
    },
    isTarget: true,
    padding: null,
    _domRef: null,
    __ygDragDrop: true,
    constrainX: false,
    constrainY: false,
    minX: 0,
    maxX: 0,
    minY: 0,
    maxY: 0,
    maintainOffset: false,
    xTicks: null,
    yTicks: null,
    primaryButtonOnly: true,
    available: false,
    b4StartDrag: function(x, y){
    },
    startDrag: function(x, y){
    },
    b4Drag: function(e){
    },
    onDrag: function(e){
    },
    onDragEnter: function(e, id){
    },
    b4DragOver: function(e){
    },
    onDragOver: function(e, id){
    },
    b4DragOut: function(e){
    },
    onDragOut: function(e, id){
    },
    b4DragDrop: function(e){
    },
    onDragDrop: function(e, id){
    },
    b4EndDrag: function(e){
    },
    endDrag: function(e){
    },
    b4MouseDown: function(e){
    },
    onMouseDown: function(e){
    },
    onMouseUp: function(e){
    },
    onAvailable: function(){
    },
    getEl: function(){
        if (!this._domRef) {
            this._domRef = this.DDM.getElement(this.id);
        }
        return this._domRef;
    },
    getDragEl: function(){
        return this.DDM.getElement(this.dragElId);
    },
    init: function(id, _6){
        this.initTarget(id, _6);
        YAHOO.util.Event.addListener(this.id, "mousedown", this.handleMouseDown, this, true);
    },
    initTarget: function(id, _7){
        this.DDM = YAHOO.util.DDM;
        this.padding = [0, 0, 0, 0];
        this.groups = {};
        this.id = id;
        this.setDragElId(id);
        this.invalidHandleTypes = {
            A: "A"
        };
        this.invalidHandleIds = {};
        this.invalidHandleClasses = [];
        this.handleElId = id;
        YAHOO.util.Event.onAvailable(id, this.handleOnAvailable, this, true);
        this.addToGroup((_7) ? _7 : "default");
    },
    handleOnAvailable: function(){
        this.available = true;
        this.resetConstraints();
        this.onAvailable();
    },
    setPadding: function(_8, _9, _10, _11){
        if (!_9 && 0 !== _9) {
            this.padding = [_8, _8, _8, _8];
        }
        else {
            if (!_10 && 0 !== _10) {
                this.padding = [_8, _9, _8, _9];
            }
            else {
                this.padding = [_8, _9, _10, _11];
            }
        }
    },
    setInitPosition: function(_12, _13){
        var el = this.getEl();
        if (!this.DDM.verifyEl(el)) {
            return;
        }
        var dx = _12 || 0;
        var dy = _13 || 0;
        var p = YAHOO.util.Dom.getXY(el);
        this.initPageX = p[0] - dx;
        this.initPageY = p[1] - dy;
        this.lastPageX = p[0];
        this.lastPageY = p[1];
        this.setStartPosition(p);
    },
    setStartPosition: function(pos){
        var p = pos || YAHOO.util.Dom.getXY(this.getEl());
        this.startPageX = p[0];
        this.startPageY = p[1];
    },
    addToGroup: function(_19){
        this.groups[_19] = true;
        this.DDM.regDragDrop(this, _19);
    },
    setDragElId: function(id){
        this.dragElId = id;
    },
    setHandleElId: function(id){
        this.handleElId = id;
        this.DDM.regHandle(this.id, id);
    },
    setOuterHandleElId: function(id){
        YAHOO.util.Event.addListener(id, "mousedown", this.handleMouseDown, this, true);
        this.setHandleElId(id);
    },
    unreg: function(){
        YAHOO.util.Event.removeListener(this.id, "mousedown", this.handleMouseDown);
        this._domRef = null;
        this.DDM._remove(this);
    },
    isLocked: function(){
        return (this.DDM.isLocked() || this.locked);
    },
    handleMouseDown: function(e, oDD){
        var EU = YAHOO.util.Event;
        var _22 = e.which || e.button;
        if (this.primaryButtonOnly && _22 > 1) {
            return;
        }
        if (this.isLocked()) {
            return;
        }
        this.DDM.refreshCache(this.groups);
        var pt = new YAHOO.util.Point(EU.getPageX(e), EU.getPageY(e));
        if (this.DDM.isOverTarget(pt, this)) {
            var _24 = EU.getTarget(e);
            if (this.isValidHandleChild(_24) && (this.id == this.handleElId || this.DDM.handleWasClicked(_24, this.id))) {
                this.setStartPosition();
                this.b4MouseDown(e);
                this.onMouseDown(e);
                this.DDM.handleMouseDown(e, this);
                this.DDM.stopEvent(e);
            }
        }
    },
    addInvalidHandleType: function(_25){
        var _26 = _25.toUpperCase();
        this.invalidHandleTypes[_26] = _26;
    },
    addInvalidHandleId: function(id){
        this.invalidHandleIds[id] = id;
    },
    addInvalidHandleClass: function(_27){
        this.invalidHandleClasses.push(_27);
    },
    removeInvalidHandleType: function(_28){
        var _29 = _28.toUpperCase();
        delete this.invalidHandleTypes[_29];
    },
    removeInvalidHandleId: function(id){
        delete this.invalidHandleIds[id];
    },
    removeInvalidHandleClass: function(_30){
        for (var i = 0, len = this.invalidHandleClasses.length; i < len; ++i) {
            if (this.invalidHandleClasses[i] == _30) {
                delete this.invalidHandleClasses[i];
            }
        }
    },
    isValidHandleChild: function(_32){
        var _33 = true;
        var n = (_32.nodeName == "#text") ? _32.parentNode : _32;
        _33 = _33 && !this.invalidHandleTypes[n.nodeName];
        _33 = _33 && !this.invalidHandleIds[n.id];
        for (var i = 0, len = this.invalidHandleClasses.length; _33 && i < len; ++i) {
            _33 = !YAHOO.util.Dom.hasClass(n, this.invalidHandleClasses[i]);
        }
        return _33;
    },
    setXTicks: function(_35, _36){
        this.xTicks = [];
        this.xTickSize = _36;
        var _37 = {};
        for (var i = this.initPageX; i >= this.minX; i = i - _36) {
            if (!_37[i]) {
                this.xTicks[this.xTicks.length] = i;
                _37[i] = true;
            }
        }
        for (i = this.initPageX; i <= this.maxX; i = i + _36) {
            if (!_37[i]) {
                this.xTicks[this.xTicks.length] = i;
                _37[i] = true;
            }
        }
        this.xTicks.sort(this.DDM.numericSort);
    },
    setYTicks: function(_38, _39){
        this.yTicks = [];
        this.yTickSize = _39;
        var _40 = {};
        for (var i = this.initPageY; i >= this.minY; i = i - _39) {
            if (!_40[i]) {
                this.yTicks[this.yTicks.length] = i;
                _40[i] = true;
            }
        }
        for (i = this.initPageY; i <= this.maxY; i = i + _39) {
            if (!_40[i]) {
                this.yTicks[this.yTicks.length] = i;
                _40[i] = true;
            }
        }
        this.yTicks.sort(this.DDM.numericSort);
    },
    setXConstraint: function(_41, _42, _43){
        this.leftConstraint = _41;
        this.rightConstraint = _42;
        this.minX = this.initPageX - _41;
        this.maxX = this.initPageX + _42;
        if (_43) {
            this.setXTicks(this.initPageX, _43);
        }
        this.constrainX = true;
    },
    setYConstraint: function(iUp, _45, _46){
        this.topConstraint = iUp;
        this.bottomConstraint = _45;
        this.minY = this.initPageY - iUp;
        this.maxY = this.initPageY + _45;
        if (_46) {
            this.setYTicks(this.initPageY, _46);
        }
        this.constrainY = true;
    },
    resetConstraints: function(){
        if (this.initPageX || this.initPageX === 0) {
            var dx = (this.maintainOffset) ? this.lastPageX - this.initPageX : 0;
            var dy = (this.maintainOffset) ? this.lastPageY - this.initPageY : 0;
            this.setInitPosition(dx, dy);
        }
        else {
            this.setInitPosition();
        }
        if (this.constrainX) {
            this.setXConstraint(this.leftConstraint, this.rightConstraint, this.xTickSize);
        }
        if (this.constrainY) {
            this.setYConstraint(this.topConstraint, this.bottomConstraint, this.yTickSize);
        }
    },
    getTick: function(val, _48){
        if (!_48) {
            return val;
        }
        else {
            if (_48[0] >= val) {
                return _48[0];
            }
            else {
                for (var i = 0, len = _48.length; i < len; ++i) {
                    var _49 = i + 1;
                    if (_48[_49] && _48[_49] >= val) {
                        var _50 = val - _48[i];
                        var _51 = _48[_49] - val;
                        return (_51 > _50) ? _48[i] : _48[_49];
                    }
                }
                return _48[_48.length - 1];
            }
        }
    },
    toString: function(val, _52){
        return ("YAHOO.util.DragDrop {" + this.id + "}");
    }
};
if (!YAHOO.util.DragDropMgr) {
    YAHOO.util.DragDropMgr = new function(){
        this.ids = {};
        this.handleIds = {};
        this.dragCurrent = null;
        this.dragOvers = {};
        this.deltaX = 0;
        this.deltaY = 0;
        this.preventDefault = true;
        this.stopPropagation = true;
        this.initalized = false;
        this.locked = false;
        this.init = function(){
        };
        this.POINT = 0;
        this.INTERSECT = 1;
        this.mode = this.POINT;
        this._execOnAll = function(_53, _54){
            for (var i in this.ids) {
                for (var j in this.ids[i]) {
                    var oDD = this.ids[i][j];
                    if (!this.isTypeOfDD(oDD)) {
                        continue;
                    }
                    oDD[_53].apply(oDD, _54);
                }
            }
        };
        this._onLoad = function(){
            var EU = YAHOO.util.Event;
            EU.on(document, "mouseup", this.handleMouseUp, this, true);
            EU.on(document, "mousemove", this.handleMouseMove, this, true);
            EU.on(window, "unload", this._onUnload, this, true);
            EU.on(window, "resize", this._onResize, this, true);
            this.initalized = true;
        };
        this._onResize = function(e){
            this._execOnAll("resetConstraints", []);
        };
        this.lock = function(){
            this.locked = true;
        };
        this.unlock = function(){
            this.locked = false;
        };
        this.isLocked = function(){
            return this.locked;
        };
        this.locationCache = {};
        this.useCache = true;
        this.clickPixelThresh = 3;
        this.clickTimeThresh = 1000;
        this.dragThreshMet = false;
        this.clickTimeout = null;
        this.startX = 0;
        this.startY = 0;
        this.regDragDrop = function(oDD, _56){
            if (!this.initialized) {
                this.init();
            }
            if (!this.ids[_56]) {
                this.ids[_56] = {};
            }
            this.ids[_56][oDD.id] = oDD;
        };
        this._remove = function(oDD){
            for (var g in oDD.groups) {
                if (g && this.ids[g][oDD.id]) {
                    delete this.ids[g][oDD.id];
                }
            }
            delete this.handleIds[oDD.id];
        };
        this.regHandle = function(_58, _59){
            if (!this.handleIds[_58]) {
                this.handleIds[_58] = {};
            }
            this.handleIds[_58][_59] = _59;
        };
        this.isDragDrop = function(id){
            return (this.getDDById(id)) ? true : false;
        };
        this.getRelated = function(_60, _61){
            var _62 = [];
            for (var i in _60.groups) {
                for (j in this.ids[i]) {
                    var dd = this.ids[i][j];
                    if (!this.isTypeOfDD(dd)) {
                        continue;
                    }
                    if (!_61 || dd.isTarget) {
                        _62[_62.length] = dd;
                    }
                }
            }
            return _62;
        };
        this.isLegalTarget = function(oDD, _64){
            var _65 = this.getRelated(oDD);
            for (var i = 0, len = _65.length; i < len; ++i) {
                if (_65[i].id == _64.id) {
                    return true;
                }
            }
            return false;
        };
        this.isTypeOfDD = function(oDD){
            return (oDD && oDD.__ygDragDrop);
        };
        this.isHandle = function(_66, _67){
            return (this.handleIds[_66] && this.handleIds[_66][_67]);
        };
        this.getDDById = function(id){
            for (var i in this.ids) {
                if (this.ids[i][id]) {
                    return this.ids[i][id];
                }
            }
            return null;
        };
        this.handleMouseDown = function(e, oDD){
            this.currentTarget = YAHOO.util.Event.getTarget(e);
            this.dragCurrent = oDD;
            var el = oDD.getEl();
            this.startX = YAHOO.util.Event.getPageX(e);
            this.startY = YAHOO.util.Event.getPageY(e);
            this.deltaX = this.startX - el.offsetLeft;
            this.deltaY = this.startY - el.offsetTop;
            this.dragThreshMet = false;
            this.clickTimeout = setTimeout(function(){
                var DDM = YAHOO.util.DDM;
                DDM.startDrag(DDM.startX, DDM.startY);
            }, this.clickTimeThresh);
        };
        this.startDrag = function(x, y){
            clearTimeout(this.clickTimeout);
            if (this.dragCurrent) {
                this.dragCurrent.b4StartDrag(x, y);
                this.dragCurrent.startDrag(x, y);
            }
            this.dragThreshMet = true;
        };
        this.handleMouseUp = function(e){
            if (!this.dragCurrent) {
                return;
            }
            clearTimeout(this.clickTimeout);
            if (this.dragThreshMet) {
                this.fireEvents(e, true);
            }
            else {
            }
            this.stopDrag(e);
            this.stopEvent(e);
        };
        this.stopEvent = function(e){
            if (this.stopPropagation) {
                YAHOO.util.Event.stopPropagation(e);
            }
            if (this.preventDefault) {
                YAHOO.util.Event.preventDefault(e);
            }
        };
        this.stopDrag = function(e){
            if (this.dragCurrent) {
                if (this.dragThreshMet) {
                    this.dragCurrent.b4EndDrag(e);
                    this.dragCurrent.endDrag(e);
                }
                this.dragCurrent.onMouseUp(e);
            }
            this.dragCurrent = null;
            this.dragOvers = {};
        };
        this.handleMouseMove = function(e){
            if (!this.dragCurrent) {
                return;
            }
            if (YAHOO.util.Event.isIE && !e.button) {
                this.stopEvent(e);
                return this.handleMouseUp(e);
            }
            if (!this.dragThreshMet) {
                var _69 = Math.abs(this.startX - YAHOO.util.Event.getPageX(e));
                var _70 = Math.abs(this.startY - YAHOO.util.Event.getPageY(e));
                if (_69 > this.clickPixelThresh || _70 > this.clickPixelThresh) {
                    this.startDrag(this.startX, this.startY);
                }
            }
            if (this.dragThreshMet) {
                this.dragCurrent.b4Drag(e);
                this.dragCurrent.onDrag(e);
                this.fireEvents(e, false);
            }
            this.stopEvent(e);
        };
        this.fireEvents = function(e, _71){
            var dc = this.dragCurrent;
            if (!dc || dc.isLocked()) {
                return;
            }
            var x = YAHOO.util.Event.getPageX(e);
            var y = YAHOO.util.Event.getPageY(e);
            var pt = new YAHOO.util.Point(x, y);
            var _73 = [];
            var _74 = [];
            var _75 = [];
            var _76 = [];
            var _77 = [];
            for (var i in this.dragOvers) {
                var ddo = this.dragOvers[i];
                if (!this.isTypeOfDD(ddo)) {
                    continue;
                }
                if (!this.isOverTarget(pt, ddo, this.mode)) {
                    _74.push(ddo);
                }
                _73[i] = true;
                delete this.dragOvers[i];
            }
            for (var _79 in dc.groups) {
                if ("string" != typeof _79) {
                    continue;
                }
                for (i in this.ids[_79]) {
                    var oDD = this.ids[_79][i];
                    if (!this.isTypeOfDD(oDD)) {
                        continue;
                    }
                    if (oDD.isTarget && !oDD.isLocked() && oDD != dc) {
                        if (this.isOverTarget(pt, oDD, this.mode)) {
                            if (_71) {
                                _76.push(oDD);
                            }
                            else {
                                if (!_73[oDD.id]) {
                                    _77.push(oDD);
                                }
                                else {
                                    _75.push(oDD);
                                }
                                this.dragOvers[oDD.id] = oDD;
                            }
                        }
                    }
                }
            }
            if (this.mode) {
                if (_74.length) {
                    dc.b4DragOut(e, _74);
                    dc.onDragOut(e, _74);
                }
                if (_77.length) {
                    dc.onDragEnter(e, _77);
                }
                if (_75.length) {
                    dc.b4DragOver(e, _75);
                    dc.onDragOver(e, _75);
                }
                if (_76.length) {
                    dc.b4DragDrop(e, _76);
                    dc.onDragDrop(e, _76);
                }
            }
            else {
                var len = 0;
                for (i = 0, len = _74.length; i < len; ++i) {
                    dc.b4DragOut(e, _74[i].id);
                    dc.onDragOut(e, _74[i].id);
                }
                for (i = 0, len = _77.length; i < len; ++i) {
                    dc.onDragEnter(e, _77[i].id);
                }
                for (i = 0, len = _75.length; i < len; ++i) {
                    dc.b4DragOver(e, _75[i].id);
                    dc.onDragOver(e, _75[i].id);
                }
                for (i = 0, len = _76.length; i < len; ++i) {
                    dc.b4DragDrop(e, _76[i].id);
                    dc.onDragDrop(e, _76[i].id);
                }
            }
        };
        this.getBestMatch = function(dds){
            var _82 = null;
            var len = dds.length;
            if (len == 1) {
                _82 = dds[0];
            }
            else {
                for (var i = 0; i < len; ++i) {
                    var dd = dds[i];
                    if (dd.cursorIsOver) {
                        _82 = dd;
                        break;
                    }
                    else {
                        if (!_82 || _82.overlap.getArea() < dd.overlap.getArea()) {
                            _82 = dd;
                        }
                    }
                }
            }
            return _82;
        };
        this.refreshCache = function(_83){
            for (sGroup in _83) {
                if ("string" != typeof sGroup) {
                    continue;
                }
                for (i in this.ids[sGroup]) {
                    var oDD = this.ids[sGroup][i];
                    if (this.isTypeOfDD(oDD)) {
                        var loc = this.getLocation(oDD);
                        if (loc) {
                            this.locationCache[oDD.id] = loc;
                        }
                        else {
                            delete this.locationCache[oDD.id];
                            oDD.unreg();
                        }
                    }
                }
            }
        };
        this.verifyEl = function(el){
            try {
                if (el) {
                    var _85 = el.offsetParent;
                    if (_85) {
                        return true;
                    }
                }
            } 
            catch (e) {
            }
            return false;
        };
        this.getLocation = function(oDD){
            if (!this.isTypeOfDD(oDD)) {
                return null;
            }
            var el = oDD.getEl();
            if (!this.verifyEl(el)) {
                return null;
            }
            var _86 = YAHOO.util.Dom.getXY(el);
            x1 = _86[0];
            x2 = x1 + el.offsetWidth;
            y1 = _86[1];
            y2 = y1 + el.offsetHeight;
            var t = y1 - oDD.padding[0];
            var r = x2 + oDD.padding[1];
            var b = y2 + oDD.padding[2];
            var l = x1 - oDD.padding[3];
            return new YAHOO.util.Region(t, r, b, l);
        };
        this.isOverTarget = function(pt, _91, _92){
            var loc = this.locationCache[_91.id];
            if (!loc || !this.useCache) {
                loc = this.getLocation(_91);
                this.locationCache[_91.id] = loc;
            }
            _91.cursorIsOver = loc.contains(pt);
            _91.overlap = null;
            if (_92) {
                var el = this.dragCurrent.getDragEl();
                var x = pt.x - this.dragCurrent.deltaX;
                var y = pt.y - this.dragCurrent.deltaY;
                var _93 = new YAHOO.util.Region(y, x + el.offsetWidth, y + el.offsetHeight, x);
                var _94 = _93.intersect(loc);
                if (_94) {
                    _91.overlap = _94;
                    return true;
                }
                else {
                    return false;
                }
            }
            else {
                return _91.cursorIsOver;
            }
        };
        this._onUnload = function(e, me){
            this.unregAll();
        };
        this.unregAll = function(){
            if (this.dragCurrent) {
                this.stopDrag();
                this.dragCurrent = null;
            }
            this._execOnAll("unreg", []);
            for (i in this.elementCache) {
                delete this.elementCache[i];
            }
            this.elementCache = {};
            this.ids = {};
        };
        this.elementCache = {};
        this.getElWrapper = function(id){
            var _96 = this.elementCache[id];
            if (!_96 || !_96.el) {
                _96 = this.elementCache[id] = new this.ElementWrapper(document.getElementById(id));
            }
            return _96;
        };
        this.getElement = function(id){
            return document.getElementById(id);
        };
        this.getCss = function(id){
            var css = null;
            var el = document.getElementById(id);
            if (el) {
                css = el.style;
            }
            return css;
        };
        this.ElementWrapper = function(el){
            this.el = el || null;
            this.id = this.el && el.id;
            this.css = this.el && el.style;
        };
        this.getPosX = function(el){
            return YAHOO.util.Dom.getX(el);
        };
        this.getPosY = function(el){
            return YAHOO.util.Dom.getY(el);
        };
        this.swapNode = function(n1, n2){
            if (n1.swapNode) {
                n1.swapNode(n2);
            }
            else {
                var p = n2.parentNode;
                var s = n2.nextSibling;
                n1.parentNode.replaceChild(n2, n1);
                p.insertBefore(n1, s);
            }
        };
        this.getScroll = function(){
            var t, l;
            if (document.documentElement && document.documentElement.scrollTop) {
                t = document.documentElement.scrollTop;
                l = document.documentElement.scrollLeft;
            }
            else {
                if (document.body) {
                    t = document.body.scrollTop;
                    l = document.body.scrollLeft;
                }
            }
            return {
                top: t,
                left: l
            };
        };
        this.getStyle = function(el, _101){
            return YAHOO.util.Dom.getStyle(el, _101);
        };
        this.getScrollTop = function(){
            return this.getScroll().top;
        };
        this.getScrollLeft = function(){
            return this.getScroll().left;
        };
        this.moveToEl = function(_102, _103){
            var _104 = YAHOO.util.Dom.getXY(_103);
            YAHOO.util.Dom.setXY(_102, _104);
        };
        this.getClientHeight = function(){
            return (window.innerHeight) ? window.innerHeight : (document.documentElement && document.documentElement.clientHeight) ? document.documentElement.clientHeight : document.body.offsetHeight;
        };
        this.getClientWidth = function(){
            return (window.innerWidth) ? window.innerWidth : (document.documentElement && document.documentElement.clientWidth) ? document.documentElement.clientWidth : document.body.offsetWidth;
        };
        this.numericSort = function(a, b){
            return (a - b);
        };
        this._timeoutCount = 0;
        this._addListeners = function(){
            if (YAHOO.util.Event && document) {
                this._onLoad();
            }
            else {
                if (this._timeoutCount > 1000) {
                }
                else {
                    setTimeout(YAHOO.util.DDM._addListeners, 10);
                    if (document && document.body) {
                        this._timeoutCount += 1;
                    }
                }
            }
        };
        this.handleWasClicked = function(node, id){
            if (this.isHandle(id, node.id)) {
                return true;
            }
            else {
                var p = node.parentNode;
                while (p) {
                    if (this.isHandle(id, p.id)) {
                        return true;
                    }
                    else {
                        p = p.parentNode;
                    }
                }
            }
            return false;
        };
    }();
    YAHOO.util.DDM = YAHOO.util.DragDropMgr;
    YAHOO.util.DDM._addListeners();
}
YAHOO.util.DD = function(id, _107){
    if (id) {
        this.init(id, _107);
    }
};
YAHOO.util.DD.prototype = new YAHOO.util.DragDrop();
YAHOO.util.DD.prototype.scroll = true;
YAHOO.util.DD.prototype.autoOffset = function(_108, _109){
    var el = this.getEl();
    var _110 = YAHOO.util.Dom.getXY(el);
    var x = _108 - _110[0];
    var y = _109 - _110[1];
    this.setDelta(x, y);
};
YAHOO.util.DD.prototype.setDelta = function(_111, _112){
    this.deltaX = _111;
    this.deltaY = _112;
};
YAHOO.util.DD.prototype.setDragElPos = function(_113, _114){
    var el = this.getDragEl();
    this.alignElWithMouse(el, _113, _114);
};
YAHOO.util.DD.prototype.alignElWithMouse = function(el, _115, _116){
    var _117 = this.getTargetCoord(_115, _116);
    var _118 = [_117.x, _117.y];
    YAHOO.util.Dom.setXY(el, _118);
    this.cachePosition(_117.x, _117.y);
    this.autoScroll(_117.x, _117.y, el.offsetHeight, el.offsetWidth);
};
YAHOO.util.DD.prototype.cachePosition = function(_119, _120){
    if (_119) {
        this.lastPageX = _119;
        this.lastPageY = _120;
    }
    else {
        var _121 = YAHOO.util.Dom.getXY(this.getEl());
        this.lastPageX = _121[0];
        this.lastPageY = _121[1];
    }
};
YAHOO.util.DD.prototype.autoScroll = function(x, y, h, w){
    if (this.scroll) {
        var _124 = this.DDM.getClientHeight();
        var _125 = this.DDM.getClientWidth();
        var st = this.DDM.getScrollTop();
        var sl = this.DDM.getScrollLeft();
        var bot = h + y;
        var _129 = w + x;
        var _130 = (_124 + st - y - this.deltaY);
        var _131 = (_125 + sl - x - this.deltaX);
        var _132 = 40;
        var _133 = (document.all) ? 80 : 30;
        if (bot > _124 && _130 < _132) {
            window.scrollTo(sl, st + _133);
        }
        if (y < st && st > 0 && y - st < _132) {
            window.scrollTo(sl, st - _133);
        }
        if (_129 > _125 && _131 < _132) {
            window.scrollTo(sl + _133, st);
        }
        if (x < sl && sl > 0 && x - sl < _132) {
            window.scrollTo(sl - _133, st);
        }
    }
};
YAHOO.util.DD.prototype.getTargetCoord = function(_134, _135){
    var x = _134 - this.deltaX;
    var y = _135 - this.deltaY;
    if (this.constrainX) {
        if (x < this.minX) {
            x = this.minX;
        }
        if (x > this.maxX) {
            x = this.maxX;
        }
    }
    if (this.constrainY) {
        if (y < this.minY) {
            y = this.minY;
        }
        if (y > this.maxY) {
            y = this.maxY;
        }
    }
    x = this.getTick(x, this.xTicks);
    y = this.getTick(y, this.yTicks);
    return {
        x: x,
        y: y
    };
};
YAHOO.util.DD.prototype.b4MouseDown = function(e){
    this.autoOffset(YAHOO.util.Event.getPageX(e), YAHOO.util.Event.getPageY(e));
};
YAHOO.util.DD.prototype.b4Drag = function(e){
    this.setDragElPos(YAHOO.util.Event.getPageX(e), YAHOO.util.Event.getPageY(e));
};
YAHOO.util.DDProxy = function(id, _136){
    if (id) {
        this.forceCssPosition = false;
        this.init(id, _136);
        this.initFrame();
    }
};
YAHOO.util.DDProxy.prototype = new YAHOO.util.DD();
YAHOO.util.DDProxy.frameDiv = null;
YAHOO.util.DDProxy.dragElId = "ygddfdiv";
YAHOO.util.DDProxy.prototype.borderWidth = 2;
YAHOO.util.DDProxy.prototype.resizeFrame = true;
YAHOO.util.DDProxy.prototype.centerFrame = false;
YAHOO.util.DDProxy.createFrame = function(){
    var THIS = YAHOO.util.DDProxy;
    if (!document || !document.body) {
        setTimeout(THIS.createFrame, 50);
        return;
    }
    if (!THIS.frameDiv) {
        THIS.frameDiv = document.createElement("div");
        THIS.frameDiv.id = THIS.dragElId;
        var s = THIS.frameDiv.style;
        s.position = "absolute";
        s.visibility = "hidden";
        s.cursor = "move";
        s.border = "2px solid #aaa";
        s.zIndex = 999;
        document.body.appendChild(THIS.frameDiv);
    }
};
YAHOO.util.DDProxy.prototype.initFrame = function(){
    YAHOO.util.DDProxy.createFrame();
    this.setDragElId(YAHOO.util.DDProxy.dragElId);
    this.useAbsMath = true;
};
YAHOO.util.DDProxy.prototype.showFrame = function(_138, _139){
    var el = this.getEl();
    var s = this.getDragEl().style;
    if (this.resizeFrame) {
        s.width = (parseInt(el.offsetWidth, 10) - (2 * this.borderWidth)) + "px";
        s.height = (parseInt(el.offsetHeight, 10) - (2 * this.borderWidth)) + "px";
    }
    if (this.centerFrame) {
        this.setDelta(Math.round(parseInt(s.width, 10) / 2), Math.round(parseInt(s.width, 10) / 2));
    }
    this.setDragElPos(_138, _139);
    s.visibility = "";
};
YAHOO.util.DDProxy.prototype.b4MouseDown = function(e){
    var x = YAHOO.util.Event.getPageX(e);
    var y = YAHOO.util.Event.getPageY(e);
    this.autoOffset(x, y);
    this.setDragElPos(x, y);
};
YAHOO.util.DDProxy.prototype.b4StartDrag = function(x, y){
    this.showFrame(x, y);
};
YAHOO.util.DDProxy.prototype.b4EndDrag = function(e){
    var s = this.getDragEl().style;
    s.visibility = "hidden";
};
YAHOO.util.DDProxy.prototype.endDrag = function(e){
    var lel = this.getEl();
    var del = this.getDragEl();
    del.style.visibility = "";
    lel.style.visibility = "hidden";
    YAHOO.util.DDM.moveToEl(lel, del);
    del.style.visibility = "hidden";
    lel.style.visibility = "";
};
YAHOO.util.DDTarget = function(id, _142){
    if (id) {
        this.initTarget(id, _142);
    }
};
YAHOO.util.DDTarget.prototype = new YAHOO.util.DragDrop();
/* animation */
YAHOO.util.Anim = function(el, attributes, duration, method){
    if (el) {
        this.init(el, attributes, duration, method);
    }
};
YAHOO.util.Anim.prototype = {
    doMethod: function(attribute, start, end){
        return this.method(this.currentFrame, start, end - start, this.totalFrames);
    },
    setAttribute: function(attribute, val, unit){
        YAHOO.util.Dom.setStyle(this.getEl(), attribute, val + unit);
    },
    getAttribute: function(attribute){
        return parseFloat(YAHOO.util.Dom.getStyle(this.getEl(), attribute));
    },
    defaultUnit: 'px',
    defaultUnits: {
        opacity: ' '
    },
    init: function(el, attributes, duration, method){
        var isAnimated = false;
        var startTime = null;
        var endTime = null;
        var actualFrames = 0;
        var defaultValues = {};
        el = YAHOO.util.Dom.get(el);
        this.attributes = attributes ||
        {};
        this.duration = duration || 1;
        this.method = method || YAHOO.util.Easing.easeNone;
        this.useSeconds = true;
        this.currentFrame = 0;
        this.totalFrames = YAHOO.util.AnimMgr.fps;
        this.getEl = function(){
            return el;
        };
        this.setDefault = function(attribute, val){
            if (val.constructor != Array && (val == 'auto' || isNaN(val))) {
                switch (attribute) {
                    case 'width':
                        val = el.clientWidth || el.offsetWidth;
                        break;
                    case 'height':
                        val = el.clientHeight || el.offsetHeight;
                        break;
                    case 'left':
                        if (YAHOO.util.Dom.getStyle(el, 'position') == 'absolute') {
                            val = el.offsetLeft;
                        }
                        else {
                            val = 0;
                        }
                        break;
                    case 'top':
                        if (YAHOO.util.Dom.getStyle(el, 'position') == 'absolute') {
                            val = el.offsetTop;
                        }
                        else {
                            val = 0;
                        }
                        break;
                    default:
                        val = 0;
                }
            }
            defaultValues[attribute] = val;
        };
        this.getDefault = function(attribute){
            return defaultValues[attribute];
        };
        this.isAnimated = function(){
            return isAnimated;
        };
        this.getStartTime = function(){
            return startTime;
        };
        this.animate = function(){
            if (this.isAnimated()) {
                return false;
            }
            this.onStart.fire();
            this._onStart.fire();
            this.totalFrames = (this.useSeconds) ? Math.ceil(YAHOO.util.AnimMgr.fps * this.duration) : this.duration;
            YAHOO.util.AnimMgr.registerElement(this);
            var attributes = this.attributes;
            var el = this.getEl();
            var val;
            for (var attribute in attributes) {
                val = this.getAttribute(attribute);
                this.setDefault(attribute, val);
            }
            isAnimated = true;
            actualFrames = 0;
            startTime = new Date();
        };
        this.stop = function(){
            if (!this.isAnimated()) {
                return false;
            }
            this.currentFrame = 0;
            endTime = new Date();
            var data = {
                time: endTime,
                duration: endTime - startTime,
                frames: actualFrames,
                fps: actualFrames / this.duration
            };
            isAnimated = false;
            actualFrames = 0;
            this.onComplete.fire(data);
        };
        var onTween = function(){
            var start;
            var end = null;
            var val;
            var unit;
            var attributes = this['attributes'];
            for (var attribute in attributes) {
                unit = attributes[attribute]['unit'] || this.defaultUnits[attribute] || this.defaultUnit;
                if (typeof attributes[attribute]['from'] != 'undefined') {
                    start = attributes[attribute]['from'];
                }
                else {
                    start = this.getDefault(attribute);
                }
                if (typeof attributes[attribute]['to'] != 'undefined') {
                    end = attributes[attribute]['to'];
                }
                else 
                    if (typeof attributes[attribute]['by'] != 'undefined') {
                        if (start.constructor == Array) {
                            end = [];
                            for (var i = 0, len = start.length; i < len; ++i) {
                                end[i] = start[i] + attributes[attribute]['by'][i];
                            }
                        }
                        else {
                            end = start + attributes[attribute]['by'];
                        }
                    }
                if (end !== null && typeof end != 'undefined') {
                    val = this.doMethod(attribute, start, end);
                    if ((attribute == 'width' || attribute == 'height' || attribute == 'opacity') && val < 0) {
                        val = 0;
                    }
                    this.setAttribute(attribute, val, unit);
                }
            }
            actualFrames += 1;
        };
        this._onStart = new YAHOO.util.CustomEvent('_onStart', this);
        this.onStart = new YAHOO.util.CustomEvent('start', this);
        this.onTween = new YAHOO.util.CustomEvent('tween', this);
        this._onTween = new YAHOO.util.CustomEvent('_tween', this);
        this.onComplete = new YAHOO.util.CustomEvent('complete', this);
        this._onTween.subscribe(onTween);
    }
};
YAHOO.util.AnimMgr = new function(){
    var thread = null;
    var queue = [];
    var tweenCount = 0;
    this.fps = 200;
    this.delay = 1;
    this.registerElement = function(tween){
        if (tween.isAnimated()) {
            return false;
        }
        queue[queue.length] = tween;
        tweenCount += 1;
        this.start();
    };
    this.start = function(){
        if (thread === null) {
            thread = setInterval(this.run, this.delay);
        }
    };
    this.stop = function(tween){
        if (!tween) {
            clearInterval(thread);
            for (var i = 0, len = queue.length; i < len; ++i) {
                if (queue[i].isAnimated()) {
                    queue[i].stop();
                }
            }
            queue = [];
            thread = null;
            tweenCount = 0;
        }
        else {
            tween.stop();
            tweenCount -= 1;
            if (tweenCount <= 0) {
                this.stop();
            }
        }
    };
    this.run = function(){
        for (var i = 0, len = queue.length; i < len; ++i) {
            var tween = queue[i];
            if (!tween || !tween.isAnimated()) {
                continue;
            }
            if (tween.currentFrame < tween.totalFrames || tween.totalFrames === null) {
                tween.currentFrame += 1;
                if (tween.useSeconds) {
                    correctFrame(tween);
                }
                tween.onTween.fire();
                tween._onTween.fire();
            }
            else {
                YAHOO.util.AnimMgr.stop(tween);
            }
        }
    };
    var correctFrame = function(tween){
        var frames = tween.totalFrames;
        var frame = tween.currentFrame;
        var expected = (tween.currentFrame * tween.duration * 1000 / tween.totalFrames);
        var elapsed = (new Date() - tween.getStartTime());
        var tweak = 0;
        if (elapsed < tween.duration * 1000) {
            tweak = Math.round((elapsed / expected - 1) * tween.currentFrame);
        }
        else {
            tweak = frames - (frame + 1);
        }
        if (tweak > 0 && isFinite(tweak)) {
            if (tween.currentFrame + tweak >= frames) {
                tweak = frames - (frame + 1);
            }
            tween.currentFrame += tweak;
        }
    };
};
YAHOO.util.Bezier = new function(){
    this.getPosition = function(points, t){
        var n = points.length;
        var tmp = [];
        for (var i = 0; i < n; ++i) {
            tmp[i] = [points[i][0], points[i][1]];
        }
        for (var j = 1; j < n; ++j) {
            for (i = 0; i < n - j; ++i) {
                tmp[i][0] = (1 - t) * tmp[i][0] + t * tmp[parseInt(i + 1, 10)][0];
                tmp[i][1] = (1 - t) * tmp[i][1] + t * tmp[parseInt(i + 1, 10)][1];
            }
        }
        return [tmp[0][0], tmp[0][1]];
    };
};

YAHOO.util.Easing = new function(){
    this.easeNone = function(t, b, c, d){
        return b + c * (t /= d);
    };
    this.easeIn = function(t, b, c, d){
        return b + c * ((t /= d) * t * t);
    };
    this.easeOut = function(t, b, c, d){
        var ts = (t /= d) * t;
        var tc = ts * t;
        return b + c * (tc + -3 * ts + 3 * t);
    };
    this.easeBoth = function(t, b, c, d){
        var ts = (t /= d) * t;
        var tc = ts * t;
        return b + c * (-2 * tc + 3 * ts);
    };
    this.backIn = function(t, b, c, d){
        var ts = (t /= d) * t;
        var tc = ts * t;
        return b + c * (-3.4005 * tc * ts + 10.2 * ts * ts + -6.2 * tc + 0.4 * ts);
    };
    this.backOut = function(t, b, c, d){
        var ts = (t /= d) * t;
        var tc = ts * t;
        return b + c * (8.292 * tc * ts + -21.88 * ts * ts + 22.08 * tc + -12.69 * ts + 5.1975 * t);
    };
    this.backBoth = function(t, b, c, d){
        var ts = (t /= d) * t;
        var tc = ts * t;
        return b + c * (0.402 * tc * ts + -2.1525 * ts * ts + -3.2 * tc + 8 * ts + -2.05 * t);
    };
};
YAHOO.util.Motion = function(el, attributes, duration, method){
    if (el) {
        this.initMotion(el, attributes, duration, method);
    }
};
YAHOO.util.Motion.prototype = new YAHOO.util.Anim();
YAHOO.util.Motion.prototype.defaultUnits.points = 'px';
YAHOO.util.Motion.prototype.doMethod = function(attribute, start, end){
    var val = null;
    if (attribute == 'points') {
        var translatedPoints = this.getTranslatedPoints();
        var t = this.method(this.currentFrame, 0, 100, this.totalFrames) / 100;
        if (translatedPoints) {
            val = YAHOO.util.Bezier.getPosition(translatedPoints, t);
        }
    }
    else {
        val = this.method(this.currentFrame, start, end - start, this.totalFrames);
    }
    return val;
};
YAHOO.util.Motion.prototype.getAttribute = function(attribute){
    var val = null;
    if (attribute == 'points') {
        val = [this.getAttribute('left'), this.getAttribute('top')];
        if (isNaN(val[0])) {
            val[0] = 0;
        }
        if (isNaN(val[1])) {
            val[1] = 0;
        }
    }
    else {
        val = parseFloat(YAHOO.util.Dom.getStyle(this.getEl(), attribute));
    }
    return val;
};
YAHOO.util.Motion.prototype.setAttribute = function(attribute, val, unit){
    if (attribute == 'points') {
        YAHOO.util.Dom.setStyle(this.getEl(), 'left', val[0] + unit);
        YAHOO.util.Dom.setStyle(this.getEl(), 'top', val[1] + unit);
    }
    else {
        YAHOO.util.Dom.setStyle(this.getEl(), attribute, val + unit);
    }
};
YAHOO.util.Motion.prototype.initMotion = function(el, attributes, duration, method){
    YAHOO.util.Anim.call(this, el, attributes, duration, method);
    attributes = attributes ||
    {};
    attributes.points = attributes.points ||
    {};
    attributes.points.control = attributes.points.control || [];
    this.attributes = attributes;
    var start;
    var end = null;
    var translatedPoints = null;
    this.getTranslatedPoints = function(){
        return translatedPoints;
    };
    var translateValues = function(val, self){
        var pageXY = YAHOO.util.Dom.getXY(self.getEl());
        val = [val[0] - pageXY[0] + start[0], val[1] - pageXY[1] + start[1]];
        return val;
    };
    var onStart = function(){
        start = this.getAttribute('points');
        var attributes = this.attributes;
        var control = attributes['points']['control'] || [];
        if (control.length > 0 && control[0].constructor != Array) {
            control = [control];
        }
        if (YAHOO.util.Dom.getStyle(this.getEl(), 'position') == 'static') {
            YAHOO.util.Dom.setStyle(this.getEl(), 'position', 'relative');
        }
        if (typeof attributes['points']['from'] != 'undefined') {
            YAHOO.util.Dom.setXY(this.getEl(), attributes['points']['from']);
            start = this.getAttribute('points');
        }
        else 
            if ((start[0] === 0 || start[1] === 0)) {
                YAHOO.util.Dom.setXY(this.getEl(), YAHOO.util.Dom.getXY(this.getEl()));
                start = this.getAttribute('points');
            }
        var i, len;
        if (typeof attributes['points']['to'] != 'undefined') {
            end = translateValues(attributes['points']['to'], this);
            for (i = 0, len = control.length; i < len; ++i) {
                control[i] = translateValues(control[i], this);
            }
        }
        else 
            if (typeof attributes['points']['by'] != 'undefined') {
                end = [start[0] + attributes['points']['by'][0], start[1] + attributes['points']['by'][1]];
                for (i = 0, len = control.length; i < len; ++i) {
                    control[i] = [start[0] + control[i][0], start[1] + control[i][1]];
                }
            }
        if (end) {
            translatedPoints = [start];
            if (control.length > 0) {
                translatedPoints = translatedPoints.concat(control);
            }
            translatedPoints[translatedPoints.length] = end;
        }
    };
    this._onStart.subscribe(onStart);
};
YAHOO.util.Scroll = function(el, attributes, duration, method){
    if (el) {
        YAHOO.util.Anim.call(this, el, attributes, duration, method);
    }
};
YAHOO.util.Scroll.prototype = new YAHOO.util.Anim();
YAHOO.util.Scroll.prototype.defaultUnits.scroll = ' ';
YAHOO.util.Scroll.prototype.doMethod = function(attribute, start, end){
    var val = null;
    if (attribute == 'scroll') {
        val = [this.method(this.currentFrame, start[0], end[0] - start[0], this.totalFrames), this.method(this.currentFrame, start[1], end[1] - start[1], this.totalFrames)];
    }
    else {
        val = this.method(this.currentFrame, start, end - start, this.totalFrames);
    }
    return val;
};
YAHOO.util.Scroll.prototype.getAttribute = function(attribute){
    var val = null;
    var el = this.getEl();
    if (attribute == 'scroll') {
        val = [el.scrollLeft, el.scrollTop];
    }
    else {
        val = parseFloat(YAHOO.util.Dom.getStyle(el, attribute));
    }
    return val;
};
YAHOO.util.Scroll.prototype.setAttribute = function(attribute, val, unit){
    var el = this.getEl();
    if (attribute == 'scroll') {
        el.scrollLeft = val[0];
        el.scrollTop = val[1];
    }
    else {
        YAHOO.util.Dom.setStyle(el, attribute, val + unit);
    }
};
var a = new Array();
if (a.push == null) {
    Array.prototype.push = function(new_item){
        this[this.length] = new_item;
    }
}
function addEvent(obj, evType, fn){
    if (obj.addEventListener) {
        obj.addEventListener(evType, fn, false);
        return true;
    }
    else 
        if (obj.attachEvent) {
            var r = obj.attachEvent("on" + evType, fn);
            EventCache.add(obj, evType, fn);
            return r;
        }
        else {
            return false;
        }
}

var EventCache = function(){
    var listEvents = [];
    return {
        listEvents: listEvents,
        add: function(node, sEventName, fHandler, bCapture){
            listEvents.push(arguments);
        },
        flush: function(){
            var i, item;
            for (i = listEvents.length - 1; i >= 0; i = i - 1) {
                item = listEvents[i];
                if (item[0].removeEventListener) {
                    item[0].removeEventListener(item[1], item[2], item[3]);
                }
                /* From this point on we need the event names to be prefixed with 'on" */
                if (item[1].substring(0, 2) != "on") {
                    item[1] = "on" + item[1];
                };
                if (item[0].detachEvent) {
                    item[0].detachEvent(item[1], item[2]);
                }
                item[0][item[1]] = null;
            }
        }
    }
}()
function promotion_rotator_init(){
    var pr = document.getElementById("adr");
    var delay = 3;
    if (pr.getAttribute("delay")) {
        if (!isNaN(pr.getAttribute("delay"))) {
            delay = parseInt(pr.getAttribute("delay"));
            delay = Math.max(0, delay);
        }
    }
    if (!pr) {
        return;
    }
    var dl = pr.getElementsByTagName("dl");
    if (dl.length == 0) {
        return;
    }
    if (dl[0].parentNode != pr) {
        return;
    };
    dl = dl[0];
    var dds;
    function setDDZindex(){
        dds = new Array();
        var dd = dl.getElementsByTagName("dd");
        for (var i = 0; i < dd.length; i++) {
            if (dd[i].parentNode == dl) {
                dd[i].style.left = 0;
                dd[i].style.zIndex = 9999 - dds.length;
                dds[dds.length] = dd[i];
                dd[i].style.position = "absolute";
            }
        }
    }
    setDDZindex();
    if (dds.length <= 1) {
        return;
    };
    pr.transition = function(){
        var opac = 100;
        function applyOpacity(isClear){
            if (isClear == true) {
                dds[0].style.zIndex = 10;
                if (dds[0].runtimeStyle && document.namespaces) {
                    dds[0].runtimeStyle.filter = "";
                }
                else {
                    dds[0].style.top = 0;
                }
            }
            else {
                if (dds[0].runtimeStyle && document.namespaces) {
                    dds[0].runtimeStyle.filter = "alpha(opacity:" + opac + ")";
                }
                else {
                    var py = parseInt(dds[0].style.left);
                    py = pr.offsetHeight * (100 - opac) / 100;
                    dds[0].style.top = py + "px";
                }
            }
        }
        var fader = function(){
            if (opac > 0) {
                var rspeed = (document.body.getBoundingClientRect != null && document.namespaces) ? 20 : 5;
                opac = Math.floor((0 - opac / rspeed) + opac);
                applyOpacity();
                setTimeout(fader, 25);
            }
            else {
                opac = 100;
                dds[0].style.zIndex = 0;
                applyOpacity(true);
                var top_dd = dds[0];
                dds = dds.slice(1, dds.length);
                dds.push(top_dd);
                for (var i = 0; i < dds.length; i++) {
                    dds[i].style.zIndex = 9999 - i;
                }
                setTimeout(fader, delay * 1000);
            }
        }
        setTimeout(fader, delay * 1000);
    }
    pr.transition();
}

addEvent(window, "unload", EventCache.flush);

function initMozTextOverflow(obj){

    function re_render(){
        doMozTextOverflow(obj);
    }
    setTimeout(re_render, 0);
    
}


function doMozTextOverflow(obj){

    function _overflow(e){
        var el = e.currentTarget;
        el.className = "_textOverflow";
    }
    
    
    function _underflow(e){
        var el = e.currentTarget;
        el.className = "_textUnderflow";
    }
    
    
    
    obj.className = "_textUnderflow";
    obj.addEventListener("overflow", _overflow, false);
    obj.addEventListener("underflow", _underflow, false);
    obj.ins = document.createElement("ins");
    obj.ins.innerHTML = "&hellip;";
    obj.appendChild(obj.ins);
    
    
    
    obj.onmousedown = function(e){
        this.selectStartX = e.clientX - document.getBoxObjectFor(this).x;
    }
    
    obj.onmouseup = function(e){
        this.selectStartX = null;
    }
    
    obj.onmousemove = function(e){
        if (this.selectStartX != null) {
            var mx = e.clientX - this.selectStartX;
            var ex = this.offsetWidth - this.selectStartX;
            
            if ((ex - mx) < (this.ins.offsetWidth + 3)) {
                if (this.className != "_textUnderflow") {
                    this.className = "_textUnderflow";
                    this.scrollLeft = 0;
                    var box = document.createElement("input");
                    box.setAttribute("type", "text");
                    box.value = 1111
                    this.appendChild(box);
                    box.select();
                    this.removeChild(box);
                    this.focus();
                }
            }
            else {
                if (this.className != "_textOverflow") {
                    this.className = "_textOverflow"
                }
                
            }
            return false;
        }
    };
    
}



function ERR(a, b, c){
    //alert(a + "\n\n" + b + "\n\n" + c  + "\n\n" +ERR.caller);
    return true;
}

//window.onerror = ERR;


function install(){
    var id = $setId();
    document.write('<u id=' + id + '></u>');
    var obj = $id(id).parentNode;
    var name = $attr(obj, "name");
    switch (name) {
        case "search_schlist":
            init_search_schlist(obj);
            break;
        case "song_bb":
            init_song_bb(obj);
            break;
    }
}


/*song_billboard*/
function init_song_bb(el){
    var h4 = $tags("h4", el);
    if (h4.length != 2) {
        return;
    };
    var d = $newNode("div");
    var t = "<table class=ui><tr>";
    for (var i = 0; i < h4.length; i++) {
        t += "<td><div><span onclick='return false;'><a >" + h4[i].innerHTML + "</a></span><ins>&nbsp;</ins></div></td>";
        h4[i].style.display = "none";
        h4[i].bd = getNextObjByTagName(h4[i], "div");
        h4[i].bd.style.display = "none";
    };
    t += "</tr></table>";
    
    d.innerHTML = t;
    el.insertBefore(d, h4[0]);
    
    var tabs = $tags("a", d);
    
    for (var i = 0; i < tabs.length; i++) {
        tabs[i].onclick = song_bb_tab_focus;
        tabs[i].dofocus = song_bb_tab_focus;
        tabs[i].bd = h4[i].bd;
    }
    tabs[1].dofocus();
}

function song_bb_tab_focus(e){
    var tr = getObjByClass(this, "tr", "");
    var td = this.parentNode.parentNode.parentNode;
    
    if (tr.lastFocus != null && tr.lastFocus != td) {
        tr.lastFocus.className = "";
        tr.lastBD.style.display = "none";
    }
    
    
    tr.lastFocus = td;
    tr.lastBD = this.bd;
    
    td.className = "on";
    this.bd.style.display = "block";
    return false;
}


/*search_box*/
function init_search_schlist(el){
    addClass(el, "search_schlist");
    
    var ls = $tags("label", el);
    var checkedItem = null;
    el.sbd = $tags("div", el)[0]
    el.selectedIndex = 0;
    
    for (var i = 0; i < ls.length; i++) {
        var radio = $tags("input", ls[i])[0];
        radio.radioIndex = i;
        if (radio.checked) {
            checkedItem = radio;
            el.selectedIndex = i;
        };
        
        ls[i].htmlFor = $setId(radio);
        ls[i].onclick = select_search_schlist;
        ls[i].onmouseover = over_search_schlist;
        ls[i].onmouseout = out_search_schlist;
        
    }
    
    
    checkedItem = checkedItem || $tags("input", ls[0])[0];
    
    el.shd = $newNode("div");
    el.shd.className = "shd";
    el.insertBefore(el.shd, el.firstChild);
    el.shd.innerHTML = "<button>&nbsp;</button><b>" + checkedItem.parentNode.firstChild.innerHTML + " </b>";
    $tags("button", el.shd)[0].onclick = show_search_schlist;
    
    hide_search_schlist.target = el;
    addEvent(document, "click", hide_search_schlist);
    init_search_schlist = $null;
}


function hide_search_schlist(e){
    e = getEvent(e);
    var el = getObjByClass(e.target, "div", "search_schlist", 6);
    if (el) {
        return stopEvent(e);
    }
    else {
        hide_search_schlist.target.sbd.style.display = "none";
        return true;
    }
    
}


function show_search_schlist(e){
    var el = getObjByClass(this, "div", "search_schlist", 2);
    el.sbd.style.display = "block";
    el.sbd.style.top = this.parentNode.offsetHeight + "px";
    el.sbd.style.width = "auto";
    el.sbd.style.width = Math.max(el.sbd.offsetWidth, this.parentNode.offsetWidth) - 2 + "px";
    var ls = $tags("label", el);
    ls[el.selectedIndex].className = "select";
    return false;
}

function over_search_schlist(e){

    addClass(this, "hover");
    
    
}

function out_search_schlist(e){
    removeClass(this, "hover");
}


function select_search_schlist(e){
    e = getEvent(e);
    if (isTagName(this, "label")) {
        var el = getObjByClass(this, "div", "search_schlist", 5);
        var radio = $tags("input", this)[0];
        radio.checked = true;
        
        var ls = $tags("label", el);
        if (ls[el.selectedIndex] != ls[radio.radioIndex]) {
            ls[el.selectedIndex].className = "";
        }
        
        
        el.selectedIndex = radio.radioIndex;
        $tags("b", el.shd)[0].innerHTML = $tags("span", this)[0].innerHTML;
        el.sbd.style.display = "none";
        return stopEvent(e);
    }
}

function PrintPreview(){
    var s = $tags("link");
    var ns = new Array();
    for (var i = 0; i < s.length; i++) {
        if (s[i] && s[i].getAttribute("rel").toString().toLowerCase() == "stylesheet") {
            if (s[i].getAttribute("media") && s[i].getAttribute("media").toString().toLowerCase() == "print") {
                var cs = s[i].cloneNode(true);
                cs.setAttribute("media", "screen");
                cs.disabled = false;
                ns[ns.length] = cs;
            }
            else {
                s[i].disabled = true;
            }
        }
    }
    var toolbar = $newNode("div");
    toolbar.className = "print_toolbar";
    var h = "";
    h += "<table><tr><td><label disabled=disabled>甇斤�汗�璅∪�嚗�豢���祇 ����</label></td>";
    h += "<td><div class=b1><a href=#  onclick='self.print();return false;'><span>��祇 �</span></a></div></td>";
    h += "<td><div class=b2><a href=#  onclick='location.reload();return false;'><span>餈�</span></a></div></td>";
    h += "</tr><tr><td colspan=5><div class=n1></div></td></tr></table>";
    toolbar.innerHTML = h;
    document.body.insertBefore(toolbar, document.body.firstChild);
    for (var i = 0; i < ns.length; i++) {
        document.body.appendChild(ns[i]);
    };
    return false;
}

if (!self.ykk) 
    addEvent(document, "click", document_click);
function document_click(ev){
    ev = ev || window.event;
    var el = ev.target || ev.srcElement;
    if (el.tagName == null) {
        return true;
    }
    if (el.parentNode == null) {
        return true;
    }
    while (el != document.body && el.tagName.toLowerCase() != "a") {
        if (el.action) 
            return true;
        el = el.parentNode;
        if (el.tagName == null) {
            return true;
        }
        if (el.parentNode == null) {
            return true;
        }
    }
    if (el.tagName.toLowerCase() == 'body') {
        return false;
    };
    if (el.tagName.toLowerCase() != "a") {
        return true;
    }
    else {
        //print preview
        if (el.parentNode.className == "printbtn") {
            stopEvent(ev);
            $id('masthead_logo').src = 'http://tw.yimg.com/i/tw/music/web/music_logo_simple.gif';
            for (i = 0; i < $tags('h2').length; i++) {
                if ($tags('h2')[i].parentNode.className == 'hd') {
                    var arrow_img = document.createElement('img');
                    arrow_img.src = 'http://tw.yimg.com/i/tw/music/web/arti_hd_bg.gif';
                    //$tags('h2')[i].parentNode.appendChild(arrow_img);
                    $tags('h2')[i].parentNode.insertBefore(arrow_img, $tags('h2')[i]);
                }
            }
            return PrintPreview(this);
        }
        return true;
    }
}


function renderAdvertisement(el){
    el.Ads = new Array();
    var adBodies = el.getElementsByTagName('div');
    for (var i = 0; i < adBodies.length; i++) {
        try {
            if (adBodies[i].className == "ad_body") {
                el.Ads[el.Ads.length] = adBodies[i].innerHTML.split("<!--")[1].split("-->")[0];
            }
            
        } 
        catch (e) {
        };
            }
    el.innerHTML = "<div class=advertisement_body></div>";
    el.adBody = el.getElementsByTagName('div')[0];
    el.adBody.style.width = el.offsetWidth + "px";
    el.adBody.style.height = el.offsetHeight + "px";
    el.playIndex = Math.floor(Math.random() * el.Ads.length);
    
    switchAdvertisement.disabled = false;
    el.adBody.onmouseover = stop_switchAdvertisement;
    el.adBody.onmouseout = start_switchAdvertisement;
    switchAdvertisement.M = setTimeout("switchAdvertisement()", 0);
    
}

function start_switchAdvertisement(){
    clearTimeout(switchAdvertisement.M);
    switchAdvertisement.disabled = false;
    switchAdvertisement.M = setTimeout("switchAdvertisement()", 1000);
}

function stop_switchAdvertisement(){
    clearTimeout(switchAdvertisement.M);
    switchAdvertisement.disabled = true;
}


function switchAdvertisement(){
    clearTimeout(switchAdvertisement.M);
    if (switchAdvertisement.disabled == false) {
        var el = $id('adr');
        if (document.all) {
            el.adBody.style.filter = "progid:DXImageTransform.Microsoft.gradientWipe( duration=1, gradientsize=1)";
            el.adBody.filters[0].Apply();
            el.adBody.innerHTML = el.Ads[el.playIndex];
            el.adBody.filters[0].Play();
            el.playIndex++;
        }
        else {
            el.adBody.innerHTML = el.Ads[el.playIndex];
            el.playIndex++;
        }
        if (el.playIndex > (el.Ads.length - 1)) {
            el.playIndex = 0;
        }
        switchAdvertisement.M = setTimeout("switchAdvertisement()", 7000);
    }
    else {
        switchAdvertisement.M = setTimeout("switchAdvertisement()", 1000);
    }
}

YAHOO.namespace('YAHOO.Tw');
YAHOO.namespace('YAHOO.Tw.MusicWeb');
YAHOO.Tw.MusicWeb.SlidePattern = function(){
    var YUA = YAHOO.util.Anim;
    var YUD = YAHOO.util.Dom;
    var YUE = YAHOO.util.Event;
    var YUM = YAHOO.util.Motion;
    var YUDD = YAHOO.util.DD;
    var $ = YUD.get;
    var x = 1;
    return {
        init: function(){
            YUE.on(['move-left', 'move-right'], 'click', this.move);
        },
        move: function(e){
            YUE.stopEvent(e);
            switch (this.id) {
                case 'move-left':
                    if (x === 1) {
                        return;
                    }
                    var attributes = {
                        points: {
                            by: [516, 0]
                        }
                    };
                    x--;
                    break;
                case 'move-right':
                    if (x === 5) {
                        return;
                    }
                    var attributes = {
                        points: {
                            by: [-516, 0]
                        }
                    };
                    x++;
                    break;
            };
            var anim = new YUM('albums', attributes, 0.5, YAHOO.util.Easing.easeOut);
            anim.animate();
        }
    };
}();
YAHOO.util.Event.onAvailable('vdpr', YAHOO.Tw.MusicWeb.SlidePattern.init, YAHOO.Tw.MusicWeb.SlidePattern, true);
