var BlogADTime = 0;
var BlogADIsCountTime = false;
function BlogAD_setDiv(obj,w,h,endFunction){
	YAHOO.example.init = function() {   
		var attributes = {
			width: { to: w }, 
			height: { to: h }
		};
		var anim = new YAHOO.util.Anim(obj, attributes,0.4, YAHOO.util.Easing.backOut);
		anim.animate(); 
		if(endFunction){
			anim.onComplete.subscribe(function(){document.getElementById(obj).style.left=-1000+"px";document.getElementById(obj).style.top=-1000+"px";});
		}
	};
	YAHOO.util.Event.onAvailable(obj, YAHOO.example.init);
}

function BlogADShowBigPanel(obj,txt){
	BlogAD_IsBoard = 1;

	if(BlogAD_IsBoard){
		
		var BlogAD_demo = document.getElementById("BlogAD_Board").style;
		var leftNum,topNum;
		BlogAD_demo.visibility="visible";
		
		document.getElementById("CalContent").innerHTML = txt;
		var _x = BlogADfindObjX(obj);
		var _y = BlogADfindObjY(obj);

		leftNum=19;
		topNum=0;
		
		if( _x>500) {
			document.getElementById("BlogAD_Board").style.left = Number(_x) - Number(BlogADfindObjX(document.getElementById("BlogAD_Board"))) -250-1000 +"px";
		}else{
			document.getElementById("BlogAD_Board").style.left = Number(_x) - Number(BlogADfindObjX(document.getElementById("BlogAD_Board"))) + leftNum-1000 +"px";
		}
		document.getElementById("BlogAD_Board").style.top = Number(_y) - Number(BlogADfindObjY(document.getElementById("BlogAD_Board"))) -topNum-1000  +"px";
	}
}

function BlogADShowBigPanel2(obj,txt){
	BlogAD_IsBoard = 1;

	if(BlogAD_IsBoard){
		
		var BlogAD_demo = document.getElementById("BlogAD_Board").style;
		var leftNum,topNum;
		BlogAD_demo.visibility="visible";
		
		document.getElementById("CalContent").innerHTML = txt;
		var _x = BlogADfindObjX(obj);
		var _y = BlogADfindObjY(obj);

		leftNum=19;
		topNum=0;
		
		document.getElementById("BlogAD_Board").style.left = 9 +"px";
		document.getElementById("BlogAD_Board").style.top = Number(_y) +23 +"px";
	}
}


function BlogADfindObjX(obj){
	var adleft = 0;
	if (obj.offsetParent){
		while (obj.offsetParent){
			adleft += obj.offsetLeft;
			obj = obj.offsetParent;
		}
	}else if (obj.x) adleft += obj.x;
	return adleft;
}

function BlogADfindObjY(obj){
	var adtop = 0;
	if (obj.offsetParent){
		while (obj.offsetParent){
			adtop += obj.offsetTop;
			obj = obj.offsetParent;
		}
	}else if (obj.y)adtop += obj.y;
	return adtop;
}

function GetDomXy(el){
	var ReturnValue;
	var t=el.offsetTop;  
	var l=el.offsetLeft;  
	while(el=el.offsetParent) {  
		t+=el.offsetTop;  
		l+=el.offsetLeft;  
 	}
 	ReturnValue = [l,t];
	return ReturnValue;  
}

function BlogADClosePanel(){
	document.getElementById("BlogAD_Board").style.left=-1000+"px";document.getElementById("BlogAD_Board").style.top=-1000+"px";
	/*BlogADStopTime();
	BlogAD_setDiv("BlogAD_Board",1,1,"yes");*/
}
function BlogADKeepPanel(){
	document.getElementById("BlogAD_Board").style.visibility="visible";
}

/*Yahoo Code*/
if (typeof YAHOO == "undefined") {
YAHOO = {};
}
YAHOO.namespace = function(ns) {

if (!ns || !ns.length) {
return null;
}

var levels = ns.split(".");
var nsobj = YAHOO;

for (var i=(levels[0] == "YAHOO") ? 1 : 0; i<levels.length; ++i) {
        nsobj[levels[i]] = nsobj[levels[i]] || {};
        nsobj = nsobj[levels[i]];
    }

    return nsobj;
};

YAHOO.extend = function(subclass, superclass) {
    var f = function() {};
    f.prototype = superclass.prototype;
    subclass.prototype = new f();
    subclass.prototype.constructor = subclass;
    subclass.superclass = superclass.prototype;
    if (superclass.prototype.constructor == Object.prototype.constructor) {
        superclass.prototype.constructor = superclass;
    }
};

YAHOO.namespace("util");
YAHOO.namespace("widget");
YAHOO.namespace("example");

YAHOO.util.Dom = function() {
   var ua = navigator.userAgent.toLowerCase();
   var isOpera = (ua.indexOf('opera') > -1);
var isSafari = (ua.indexOf('safari') > -1);
var isIE = (window.ActiveXObject);

var id_counter = 0;
var util = YAHOO.util; 
var property_cache = {}; 

var toCamel = function(property) {
var convert = function(prop) {
var test = /(-[a-z])/i.exec(prop);
return prop.replace(RegExp.$1, RegExp.$1.substr(1).toUpperCase());
};

while(property.indexOf('-') > -1) {
property = convert(property);
}

return property;

};

var toHyphen = function(property) {
if (property.indexOf('-') > -1) {
return property;
}

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);
}
}

return converted;

};
var cacheConvertedProperties = function(property) {
property_cache[property] = {
camel: toCamel(property),
hyphen: toHyphen(property)
};
};

return {
get: function(el) {
if (!el) { return null; } 

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] = util.Dom.get(el[i]);
}

return collection;
}

return null;
},
getStyle: function(el, property) {
var f = function(el) {
var value = null;
var dv = document.defaultView;

if (!property_cache[property]) {
cacheConvertedProperties(property);
}

var camel = property_cache[property]['camel'];
var hyphen = property_cache[property]['hyphen'];

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[camel]) {
value = el.style[camel];
}
else if (isIE && el.currentStyle && el.currentStyle[camel]) {
value = el.currentStyle[camel];
}
else if ( dv && dv.getComputedStyle ) {
var computed = dv.getComputedStyle(el, '');

if (computed && computed.getPropertyValue(hyphen)) {
value = computed.getPropertyValue(hyphen);
}
}

return value;
};

return util.Dom.batch(el, f, util.Dom, true);
},
setStyle: function(el, property, val) {
if (!property_cache[property]) {
cacheConvertedProperties(property);
}

var camel = property_cache[property]['camel'];

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[camel] = val;
}


};

util.Dom.batch(el, f, util.Dom, true);
},
getXY: function(el) {
var f = function(el) {
if (el.offsetParent === null || this.getStyle(el, 'display') == 'none') {
return false;
}

var parentNode = null;
var pos = [];
var box;

if (el.getBoundingClientRect) {
box = el.getBoundingClientRect();
var doc = document;
if ( !this.inDocument(el) && parent.document != document) {
doc = parent.document;

if ( !this.isAncestor(doc.documentElement, el) ) {
return false;
}

}

var scrollTop = Math.max(doc.documentElement.scrollTop, doc.body.scrollTop);
var scrollLeft = Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft);

return [box.left + scrollLeft, box.top + scrollTop];
}
else { 
pos = [el.offsetLeft, el.offsetTop];
parentNode = el.offsetParent;
if (parentNode != el) {
while (parentNode) {
pos[0] += parentNode.offsetLeft;
pos[1] += parentNode.offsetTop;
parentNode = parentNode.offsetParent;
}
}
if (isSafari && this.getStyle(el, 'position') == 'absolute' ) {
pos[0] -= document.body.offsetLeft;
pos[1] -= document.body.offsetTop;
}
}

if (el.parentNode) { parentNode = el.parentNode; }
else { parentNode = null; }

while (parentNode && parentNode.tagName.toUpperCase() != 'BODY' && parentNode.tagName.toUpperCase() != 'HTML')
{
if (util.Dom.getStyle(parentNode, 'display') != 'inline') {
pos[0] -= parentNode.scrollLeft;
pos[1] -= parentNode.scrollTop;
}

if (parentNode.parentNode) { parentNode = parentNode.parentNode; }
else { parentNode = null; }
}


return pos;
};

return util.Dom.batch(el, f, util.Dom, true);
},
getX: function(el) {
var f = function(el) {
return util.Dom.getXY(el)[0];
};

return util.Dom.batch(el, f, util.Dom, true);
},
getY: function(el) {
var f = function(el) {
return util.Dom.getXY(el)[1];
};

return util.Dom.batch(el, f, util.Dom, true);
},
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 = this.getXY(el);
if (pageXY === false) { 
return false;
}

var delta = [
parseInt( this.getStyle(el, 'left'), 10 ),
parseInt( this.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]) ) {
this.setXY(el, pos, true);
}

};

util.Dom.batch(el, f, util.Dom, true);
},
setX: function(el, x) {
util.Dom.setXY(el, [x, null]);
},
setY: function(el, y) {
util.Dom.setXY(el, [null, y]);
},
getRegion: function(el) {
var f = function(el) {
var region = new YAHOO.util.Region.getRegion(el);
return region;
};

return util.Dom.batch(el, f, util.Dom, true);
},
getClientWidth: function() {
return util.Dom.getViewportWidth();
},
getClientHeight: function() {
return util.Dom.getViewportHeight();
},
getElementsByClassName: function(className, tag, root) {
var method = function(el) { return util.Dom.hasClass(el, className) };
return util.Dom.getElementsBy(method, tag, root);
},
hasClass: function(el, className) {
var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)');

var f = function(el) {
return re.test(el['className']);
};

return util.Dom.batch(el, f, util.Dom, true);
},
addClass: function(el, className) {
var f = function(el) {
if (this.hasClass(el, className)) { return; } 


el['className'] = [el['className'], className].join(' ');
};

util.Dom.batch(el, f, util.Dom, true);
},
removeClass: function(el, className) {
var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)', 'g');

var f = function(el) {
if (!this.hasClass(el, className)) { return; } 


var c = el['className'];
el['className'] = c.replace(re, ' ');
if ( this.hasClass(el, className) ) {
this.removeClass(el, className);
}

};

util.Dom.batch(el, f, util.Dom, true);
},
replaceClass: function(el, oldClassName, newClassName) {
if (oldClassName === newClassName) {
return false;
};

var re = new RegExp('(?:^|\\s+)' + oldClassName + '(?:\\s+|$)', 'g');

var f = function(el) {

if ( !this.hasClass(el, oldClassName) ) {
this.addClass(el, newClassName); 
return; 
}

el['className'] = el['className'].replace(re, ' ' + newClassName + ' ');

if ( this.hasClass(el, oldClassName) ) {
this.replaceClass(el, oldClassName, newClassName);
}
};

util.Dom.batch(el, f, util.Dom, true);
},
generateId: function(el, prefix) {
prefix = prefix || 'yui-gen';
el = el || {};

var f = function(el) {
if (el) {
el = util.Dom.get(el);
} else {
el = {};
}

if (!el.id) {
el.id = prefix + id_counter++;
} 


return el.id;
};

return util.Dom.batch(el, f, util.Dom, true);
},
isAncestor: function(haystack, needle) {
haystack = util.Dom.get(haystack);
if (!haystack || !needle) { return false; }

var f = function(needle) {
if (haystack.contains && !isSafari) { 
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 || parent.tagName.toUpperCase() == 'HTML') {
return false;
}

parent = parent.parentNode;
}
return false;
}
};

return util.Dom.batch(needle, f, util.Dom, true);
},
inDocument: function(el) {
var f = function(el) {
return this.isAncestor(document.documentElement, el);
};

return util.Dom.batch(el, f, util.Dom, true);
},
getElementsBy: function(method, tag, root) {
tag = tag || '*';
root = util.Dom.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) {
var id = el;
el = util.Dom.get(el);

var scope = (override) ? o : window;

if (!el || el.tagName || !el.length) {
if (!el) {
return false;
}
return method.call(scope, el, o);
}

var collection = [];

for (var i = 0, len = el.length; i < len; ++i) {
if (!el[i]) {
id = id[i];
}
collection[collection.length] = method.call(scope, el[i], o);
}

return collection;
},
getDocumentHeight: function() {
var scrollHeight=-1,windowHeight=-1,bodyHeight=-1;
var marginTop = parseInt(util.Dom.getStyle(document.body, 'marginTop'), 10);
var marginBottom = parseInt(util.Dom.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(util.Dom.getStyle(document.body, 'marginRight'), 10);
var marginLeft = parseInt(util.Dom.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;
break;

default: 
bodyWidth = document.body.clientWidth;
docWidth = document.body.scrollWidth;
break;
}
} else { 
docWidth = document.documentElement.clientWidth;
bodyWidth = document.body.offsetWidth + marginLeft + marginRight;
}

var w = Math.max(docWidth, bodyWidth);
return w;
},
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 {"    +
"top: "       + this.top    +
", right: "   + this.right  +
", bottom: "  + this.bottom +
", left: "    + 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) {
if (x instanceof Array) { 
y = x[1];
x = x[0];
}

this.x = this.right = this.left = this[0] = x;

this.y = this.top = this.bottom = this[1] = y;
};

YAHOO.util.Point.prototype = new YAHOO.util.Region();

YAHOO.util.CustomEvent = function(type, oScope, silent) {

this.type = type;

this.scope = oScope || window;

this.silent = silent;

this.subscribers = [];

if (!this.silent) {
}

};

YAHOO.util.CustomEvent.prototype = {

subscribe: function(fn, obj, bOverride) {

this.subscribers.push( new YAHOO.util.Subscriber(fn, obj, bOverride) );
},

unsubscribe: function(fn, obj) {
var found = false;
for (var i=0, len=this.subscribers.length; i<len; ++i) {
            var s = this.subscribers[i];
            if (s && s.contains(fn, obj)) {
                this._delete(i);
                found = true;
            }
        }

        return found;
    },

    fire: function() {
        var len=this.subscribers.length;
        if (!len && this.silent) {
            return;
        }

        var args = [];

        for (var i=0; i<arguments.length; ++i) {
            args.push(arguments[i]);
        }

        if (!this.silent) {
        }

        for (i=0; i<len; ++i) {
            var s = this.subscribers[i];
            if (s) {
                if (!this.silent) {
                }
                var scope = (s.override) ? s.obj : this.scope;
                s.fn.call(scope, this.type, args, s.obj);
            }
        }
    },

    unsubscribeAll: function() {
        for (var i=0, len=this.subscribers.length; i<len; ++i) {
            this._delete(len - 1 - i);
        }
    },

    _delete: function(index) {
        var s = this.subscribers[index];
        if (s) {
            delete s.fn;
            delete s.obj;
        }

        this.subscribers.splice(index, 1);
    },

    toString: function() {
         return "CustomEvent: " + "'" + this.type  + "', " +
             "scope: " + this.scope;

    }
};

YAHOO.util.Subscriber = function(fn, obj, bOverride) {

    this.fn = fn;

    this.obj = obj || null;

    this.override = (bOverride);
};

YAHOO.util.Subscriber.prototype.contains = function(fn, obj) {
    return (this.fn == fn && this.obj == obj);
};

YAHOO.util.Subscriber.prototype.toString = function() {
    return "Subscriber { obj: " + (this.obj || "")  +
           ", override: " +  (this.override || "no") + " }";
};

if (!YAHOO.util.Event) {

    YAHOO.util.Event = function() {


        var loadComplete =  false;

        var listeners = [];

        var delayedListeners = [];

        var unloadListeners = [];

        var legacyEvents = [];

        var legacyHandlers = [];

        var retryCount = 0;

        var onAvailStack = [];

        var legacyMap = [];

        var counter = 0;

        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, sType, fn, oScope, bOverride) {
                delayedListeners[delayedListeners.length] =
                    [el, sType, fn, oScope, bOverride];

                if (loadComplete) {
                    retryCount = this.POLL_RETRYS;
                    this.startTimeout(0);
                    
                }
            },

            startTimeout: function(interval) {
                var i = (interval || interval === 0) ? interval : this.POLL_INTERVAL;
                var self = this;
                var callback = function() { self._tryPreloadAttach(); };
                this.timeout = setTimeout(callback, i);
            },

            onAvailable: function(p_id, p_fn, p_obj, p_override) {
                onAvailStack.push( { id:       p_id,
                                     fn:       p_fn,
                                     obj:      p_obj,
                                     override: p_override } );

                retryCount = this.POLL_RETRYS;
                this.startTimeout(0);
               
            },

            addListener: function(el, sType, fn, oScope, bOverride) {

                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],
                                       sType,
                                       fn,
                                       oScope,
                                       bOverride) && ok );
                    }
                    return ok;

                } else if (typeof el == "string") {
                    var oEl = this.getEl(el);

                    if (loadComplete && oEl) {
                        el = oEl;
                    } else {
                        this.addDelayedListener(el,
                                                sType,
                                                fn,
                                                oScope,
                                                bOverride);

                        return true;
                    }
                }

                if (!el) {
                    return false;
                }

                if ("unload" == sType && oScope !== this) {
                    unloadListeners[unloadListeners.length] =
                            [el, sType, fn, oScope, bOverride];
                    return true;
                }

                var scope = (bOverride) ? oScope : el;

                var wrappedFn = function(e) {
                        return fn.call(scope, YAHOO.util.Event.getEvent(e),
                                oScope);
                    };

                var li = [el, sType, fn, wrappedFn, scope];
                var index = listeners.length;
                listeners[index] = li;

                if (this.useLegacyEvent(el, sType)) {
                    var legacyIndex = this.getLegacyIndex(el, sType);
                    if ( legacyIndex == -1 ||
                                el != legacyEvents[legacyIndex][0] ) {

                        legacyIndex = legacyEvents.length;
                        legacyMap[el.id + sType] = legacyIndex;

                        legacyEvents[legacyIndex] =
                            [el, sType, el["on" + sType]];
                        legacyHandlers[legacyIndex] = [];

                        el["on" + sType] =
                            function(e) {
                                YAHOO.util.Event.fireLegacyEvent(
                                    YAHOO.util.Event.getEvent(e), legacyIndex);
                            };
                    }
                    legacyHandlers[legacyIndex].push(li);

               
                } else if (el.addEventListener) {
                    el.addEventListener(sType, wrappedFn, false);
                
                } else if (el.attachEvent) {
                    el.attachEvent("on" + sType, wrappedFn);
                }

                return true;

            },
            fireLegacyEvent: function(e, legacyIndex) {
                var ok = true;

                var le = legacyHandlers[legacyIndex];
                for (var i=0,len=le.length; i<len; ++i) {
                    var li = le[i];
                    if ( li && li[this.WFN] ) {
                        var scope = li[this.ADJ_SCOPE];
                        var ret = li[this.WFN].call(scope, e);
                        ok = (ok && ret);
                    }
                }

                return ok;
            },
            getLegacyIndex: function(el, sType) {
                var key = this.generateId(el) + sType;
                if (typeof legacyMap[key] == "undefined") {
                    return -1;
                } else {
                    return legacyMap[key];
                }
            },
            useLegacyEvent: function(el, sType) {
                if (!el.addEventListener && !el.attachEvent) {
                    return true;
                } else if (this.isSafari) {
                    if ("click" == sType || "dblclick" == sType) {
                        return true;
                    }
                }
                return false;
            },
            removeListener: function(el, sType, fn, index) {

                if (!fn || !fn.call) {
                    return false;
                }

                var i, len;

                
                if (typeof el == "string") {
                    el = this.getEl(el);
               
                } else if ( this._isValidCollection(el)) {
                    var ok = true;
                    for (i=0,len=el.length; i<len; ++i) {
                        ok = ( this.removeListener(el[i], sType, fn) && ok );
                    }
                    return ok;
                }

                if ("unload" == sType) {

                    for (i=0, len=unloadListeners.length; i<len; i++) {
                        var li = unloadListeners[i];
                        if (li &&
                            li[0] == el &&
                            li[1] == sType &&
                            li[2] == fn) {
                                unloadListeners.splice(i, 1);
                                return true;
                        }
                    }

                    return false;
                }

                var cacheItem = null;

              

                if ("undefined" == typeof index) {
                    index = this._getCacheIndex(el, sType, fn);
                }

                if (index >= 0) {
cacheItem = listeners[index];
}

if (!el || !cacheItem) {
return false;
}

if (this.useLegacyEvent(el, sType)) {
var legacyIndex = this.getLegacyIndex(el, sType);
var llist = legacyHandlers[legacyIndex];
if (llist) {
for (i=0, len=llist.length; i<len; ++i) {
                            li = llist[i];
                            if (li &&
                                li[this.EL] == el &&
                                li[this.TYPE] == sType &&
                                li[this.FN] == fn) {
                                    llist.splice(i, 1);
                            }
                        }
                    }

                } else if (el.removeEventListener) {
                    el.removeEventListener(sType, cacheItem[this.WFN], false);
                } else if (el.detachEvent) {
                    el.detachEvent("on" + sType, cacheItem[this.WFN]);
                }

                delete listeners[index][this.WFN];
                delete listeners[index][this.FN];
                listeners.splice(index, 1);

                return true;

            },
            getTarget: function(ev, resolveTextNode) {
                var t = ev.target || ev.srcElement;
                return this.resolveTextNode(t);
            },
            resolveTextNode: function(node) {
                if (node && node.nodeName &&
                        "#TEXT" == node.nodeName.toUpperCase()) {
                    return node.parentNode;
                } else {
                    return node;
                }
            },
            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 this.resolveTextNode(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, sType, fn) {
                for (var i=0,len=listeners.length; i<len; ++i) {
                    var li = listeners[i];
                    if ( li                 &&
                         li[this.FN] == fn  &&
                         li[this.EL] == el  &&
                         li[this.TYPE] == sType ) {
                        return i;
                    }
                }

                return -1;
            },
            generateId: function(el) {
                var id = el.id;

                if (!id) {
                    id = "yuievtautoid-" + counter;
                    ++counter;
                    el.id = id;
                }

                return id;
            },
            _isValidCollection: function(o) {

                return ( o                    && 
                         o.length             && 
                         typeof o != "string" && 
                         !o.tagName           && 
                         !o.alert             && 
                         typeof o[0] != "undefined" );

            },

            elCache: {},

            getEl: function(id) {
                return document.getElementById(id);
            },

            clearCache: function() { },

            _load: function(e) {
                loadComplete = true;
                var EU = YAHOO.util.Event;
                EU._simpleRemove(window, "load", EU._load);
            },

            _tryPreloadAttach: function() {

                if (this.locked) {
                    return false;
                }

                this.locked = true;

                var tryAgain = !loadComplete;
                if (!tryAgain) {
                    tryAgain = (retryCount > 0);
}

var stillDelayed = [];

for (var i=0,len=delayedListeners.length; i<len; ++i) {
                    var d = delayedListeners[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 delayedListeners[i];
                        } else {
                            stillDelayed.push(d);
                        }
                    }
                }

                delayedListeners = stillDelayed;

                
                var notAvail = [];
                for (i=0,len=onAvailStack.length; i<len ; ++i) {
                    var item = onAvailStack[i];
                    if (item) {
                        el = this.getEl(item.id);

                        if (el) {
                            var scope = (item.override) ? item.obj : el;
                            item.fn.call(scope, item.obj);
                            delete onAvailStack[i];
                        } else {
                            notAvail.push(item);
                        }
                    }
                }

                retryCount = (stillDelayed.length === 0 &&
                                    notAvail.length === 0) ? 0 : retryCount - 1;

                if (tryAgain) {
                    this.startTimeout();
                }

                this.locked = false;

                return true;

            },
            purgeElement: function(el, recurse, sType) {
                var elListeners = this.getListeners(el, sType);
                if (elListeners) {
                    for (var i=0,len=elListeners.length; i<len ; ++i) {
                        var l = elListeners[i];
                        this.removeListener(el, l.type, l.fn);
                    }
                }

                if (recurse && el && el.childNodes) {
                    for (i=0,len=el.childNodes.length; i<len ; ++i) {
                        this.purgeElement(el.childNodes[i], recurse, sType);
                    }
                }
            },
            getListeners: function(el, sType) {
                var elListeners = [];
                if (listeners && listeners.length > 0) {
for (var i=0,len=listeners.length; i<len ; ++i) {
                        var l = listeners[i];
                        if ( l  && l[this.EL] === el &&
                                (!sType || sType === l[this.TYPE]) ) {
                            elListeners.push({
                                type:   l[this.TYPE],
                                fn:     l[this.FN],
                                obj:    l[this.SCOPE],
                                adjust: l[this.ADJ_SCOPE],
                                index:  i
                            });
                        }
                    }
                }

                return (elListeners.length) ? elListeners : null;
            },
            _unload: function(e) {

                var EU = YAHOO.util.Event;

                for (var i=0,len=unloadListeners.length; i<len; ++i) {
                    var l = unloadListeners[i];
                    if (l) {
                        var scope = (l[EU.ADJ_SCOPE]) ? l[EU.SCOPE]: window;
                        l[EU.FN].call(scope, EU.getEvent(e), l[EU.SCOPE] );
                        delete unloadListeners[i];
                        l=null;
                    }
                }

                if (listeners && listeners.length > 0) {

var j = listeners.length;
while (j) {
var index = j-1;
l = listeners[index];
if (l) {
EU.removeListener(l[EU.EL], l[EU.TYPE],
l[EU.FN], index);
}

l=null;

j = j - 1;
}

EU.clearCache();
}

for (i=0,len=legacyEvents.length; i<len; ++i) {

delete legacyEvents[i][0];

delete legacyEvents[i];
}

EU._simpleRemove(window, "unload", EU._unload);

},
_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 || dd.scrollLeft)) {
return [dd.scrollTop, dd.scrollLeft];
} else if (db) {
return [db.scrollTop, db.scrollLeft];
} else {
return [0, 0];
}
},
_simpleAdd: function (el, sType, fn, capture) {
if (el.addEventListener) {
el.addEventListener(sType, fn, (capture));
} else if (el.attachEvent) {
el.attachEvent("on" + sType, fn);
}
},
_simpleRemove: function (el, sType, fn, capture) {
if (el.removeEventListener) {
el.removeEventListener(sType, fn, (capture));
} else if (el.detachEvent) {
el.detachEvent("on" + sType, fn);
}
}
};

} ();
YAHOO.util.Event.on = YAHOO.util.Event.addListener;

if (document && document.body) {
YAHOO.util.Event._load();
} else {
YAHOO.util.Event._simpleAdd(window, "load", YAHOO.util.Event._load);
}
YAHOO.util.Event._simpleAdd(window, "unload", YAHOO.util.Event._unload);
YAHOO.util.Event._tryPreloadAttach();
}

YAHOO.util.Anim = function(el, attributes, duration, method) {
if (el) {
this.init(el, attributes, duration, method);
}
};

YAHOO.util.Anim.prototype = {

toString: function() {
var el = this.getEl();
var id = el.id || el.tagName;
return ("Anim " + id);
},

patterns: { 
noNegatives:      /width|height|opacity|padding/i,
offsetAttribute:  /^((width|height)|(top|left))$/, 
defaultUnit:      /width|height|top$|bottom$|left$|right$/i,
offsetUnit:       /\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i 
},

doMethod: function(attr, start, end) {
return this.method(this.currentFrame, start, end - start, this.totalFrames);
},

setAttribute: function(attr, val, unit) {
if ( this.patterns.noNegatives.test(attr) ) {
val = (val > 0) ? val : 0;
}

YAHOO.util.Dom.setStyle(this.getEl(), attr, val + unit);
},

getAttribute: function(attr) {
var el = this.getEl();
var val = YAHOO.util.Dom.getStyle(el, attr);

if (val !== 'auto' && !this.patterns.offsetUnit.test(val)) {
return parseFloat(val);
}

var a = this.patterns.offsetAttribute.exec(attr) || [];
var pos = !!( a[3] ); 
var box = !!( a[2] ); 


if ( box || (YAHOO.util.Dom.getStyle(el, 'position') == 'absolute' && pos) ) {
val = el['offset' + a[0].charAt(0).toUpperCase() + a[0].substr(1)];
} else { 
val = 0;
}

return val;
},
getDefaultUnit: function(attr) {
if ( this.patterns.defaultUnit.test(attr) ) {
return 'px';
}

return '';
},
setRuntimeAttribute: function(attr) {
var start;
var end;
var attributes = this.attributes;

this.runtimeAttributes[attr] = {};

var isset = function(prop) {
return (typeof prop !== 'undefined');
};

if ( !isset(attributes[attr]['to']) && !isset(attributes[attr]['by']) ) {
return false;
}

start = ( isset(attributes[attr]['from']) ) ? attributes[attr]['from'] : this.getAttribute(attr);


if ( isset(attributes[attr]['to']) ) {
end = attributes[attr]['to'];
} else if ( isset(attributes[attr]['by']) ) {
if (start.constructor == Array) {
end = [];
for (var i = 0, len = start.length; i < len; ++i) {
end[i] = start[i] + attributes[attr]['by'][i];
}
} else {
end = start + attributes[attr]['by'];
}
}

this.runtimeAttributes[attr].start = start;
this.runtimeAttributes[attr].end = end;


this.runtimeAttributes[attr].unit = ( isset(attributes[attr].unit) ) ? attributes[attr]['unit'] : this.getDefaultUnit(attr);
},

init: function(el, attributes, duration, method) {

var isAnimated = false;

var startTime = null;
var actualFrames = 0;
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.isAnimated = function() {
return isAnimated;
};
this.getStartTime = function() {
return startTime;
};

this.runtimeAttributes = {};
this.animate = function() {
if ( this.isAnimated() ) { return false; }

this.currentFrame = 0;

this.totalFrames = ( this.useSeconds ) ? Math.ceil(YAHOO.util.AnimMgr.fps * this.duration) : this.duration;

YAHOO.util.AnimMgr.registerElement(this);
};
this.stop = function() {
YAHOO.util.AnimMgr.stop(this);
};

var onStart = function() {
this.onStart.fire();
for (var attr in this.attributes) {
this.setRuntimeAttribute(attr);
}

isAnimated = true;
actualFrames = 0;
startTime = new Date();
};
var onTween = function() {
var data = {
duration: new Date() - this.getStartTime(),
currentFrame: this.currentFrame
};

data.toString = function() {
return (
'duration: ' + data.duration +
', currentFrame: ' + data.currentFrame
);
};

this.onTween.fire(data);

var runtimeAttributes = this.runtimeAttributes;

for (var attr in runtimeAttributes) {
this.setAttribute(attr, this.doMethod(attr, runtimeAttributes[attr].start, runtimeAttributes[attr].end), runtimeAttributes[attr].unit);
}

actualFrames += 1;
};

var onComplete = function() {
var actual_duration = (new Date() - startTime) / 1000 ;

var data = {
duration: actual_duration,
frames: actualFrames,
fps: actualFrames / actual_duration
};

data.toString = function() {
return (
'duration: ' + data.duration +
', frames: ' + data.frames +
', fps: ' + data.fps
);
};

isAnimated = false;
actualFrames = 0;
this.onComplete.fire(data);
};
this._onStart = new YAHOO.util.CustomEvent('_start', this, true);
this.onStart = new YAHOO.util.CustomEvent('start', this);
this.onTween = new YAHOO.util.CustomEvent('tween', this);
this._onTween = new YAHOO.util.CustomEvent('_tween', this, true);
this.onComplete = new YAHOO.util.CustomEvent('complete', this);
this._onComplete = new YAHOO.util.CustomEvent('_complete', this, true);

this._onStart.subscribe(onStart);
this._onTween.subscribe(onTween);
this._onComplete.subscribe(onComplete);
}
};

YAHOO.util.AnimMgr = new function() {

var thread = null;
var queue = [];
var tweenCount = 0;
this.fps = 200;
this.delay = 1;
this.registerElement = function(tween) {
queue[queue.length] = tween;
tweenCount += 1;
tween._onStart.fire();
this.start();
};

this.unRegister = function(tween, index) {
tween._onComplete.fire();
index = index || getIndex(tween);
if (index != -1) { queue.splice(index, 1); }

tweenCount -= 1;
if (tweenCount <= 0) { this.stop(); }
};

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()) {
this.unRegister(tween, i);
}
}
queue = [];
thread = null;
tweenCount = 0;
}
else {
this.unRegister(tween);
}
};
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();
}
else { YAHOO.util.AnimMgr.stop(tween, i); }
}
};

var getIndex = function(anim) {
for (var i = 0, len = queue.length; i < len; ++i) {
if (queue[i] == anim) {
return i; 
}
}
return -1;
};

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] ];

};
};
(function() {
YAHOO.util.ColorAnim = function(el, attributes, duration,  method) {
YAHOO.util.ColorAnim.superclass.constructor.call(this, el, attributes, duration, method);
};

YAHOO.extend(YAHOO.util.ColorAnim, YAHOO.util.Anim);

var Y = YAHOO.util;
var superclass = Y.ColorAnim.superclass;
var proto = Y.ColorAnim.prototype;

proto.toString = function() {
var el = this.getEl();
var id = el.id || el.tagName;
return ("ColorAnim " + id);
};
proto.patterns.color = /color$/i;
proto.patterns.rgb    = /^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i;
proto.patterns.hex    = /^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;
proto.patterns.hex3   = /^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i;
proto.parseColor = function(s) {
if (s.length == 3) { return s; }

var c = this.patterns.hex.exec(s);
if (c && c.length == 4) {
return [ parseInt(c[1], 16), parseInt(c[2], 16), parseInt(c[3], 16) ];
}

c = this.patterns.rgb.exec(s);
if (c && c.length == 4) {
return [ parseInt(c[1], 10), parseInt(c[2], 10), parseInt(c[3], 10) ];
}

c = this.patterns.hex3.exec(s);
if (c && c.length == 4) {
return [ parseInt(c[1] + c[1], 16), parseInt(c[2] + c[2], 16), parseInt(c[3] + c[3], 16) ];
}

return null;
};
proto.getAttribute = function(attr) {
var el = this.getEl();
if (  this.patterns.color.test(attr) ) {
var val = YAHOO.util.Dom.getStyle(el, attr);

if (val == 'transparent') {
var parent = el.parentNode; 
val = Y.Dom.getStyle(parent, attr);

while (parent && val == 'transparent') {
parent = parent.parentNode;
val = Y.Dom.getStyle(parent, attr);
if (parent.tagName.toUpperCase() == 'HTML') {
val = 'ffffff';
}
}
}
} else {
val = superclass.getAttribute.call(this, attr);
}

return val;
};
proto.doMethod = function(attr, start, end) {
var val;

if ( this.patterns.color.test(attr) ) {
val = [];
for (var i = 0, len = start.length; i < len; ++i) {
val[i] = superclass.doMethod.call(this, attr, start[i], end[i]);
}

val = 'rgb('+Math.floor(val[0])+','+Math.floor(val[1])+','+Math.floor(val[2])+')';
}
else {
val = superclass.doMethod.call(this, attr, start, end);
}

return val;
};
proto.setRuntimeAttribute = function(attr) {
superclass.setRuntimeAttribute.call(this, attr);

if ( this.patterns.color.test(attr) ) {
var attributes = this.attributes;
var start = this.parseColor(this.runtimeAttributes[attr].start);
var end = this.parseColor(this.runtimeAttributes[attr].end);

if ( typeof attributes[attr]['to'] === 'undefined' && typeof attributes[attr]['by'] !== 'undefined' ) {
end = this.parseColor(attributes[attr].by);

for (var i = 0, len = start.length; i < len; ++i) {
end[i] = start[i] + end[i];
}
}

this.runtimeAttributes[attr].start = start;
this.runtimeAttributes[attr].end = end;
}
};
})();

YAHOO.util.Easing = {
easeNone: function (t, b, c, d) {
return c*t/d + b;
},
easeIn: function (t, b, c, d) {
return c*(t/=d)*t + b;
},
easeOut: function (t, b, c, d) {
return -c *(t/=d)*(t-2) + b;
},
easeBoth: function (t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t + b;
return -c/2 * ((--t)*(t-2) - 1) + b;
},
easeInStrong: function (t, b, c, d) {
return c*(t/=d)*t*t*t + b;
},
easeOutStrong: function (t, b, c, d) {
return -c * ((t=t/d-1)*t*t*t - 1) + b;
},
easeBothStrong: function (t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
return -c/2 * ((t-=2)*t*t*t - 2) + b;
},
elasticIn: function (t, b, c, d, a, p) {
if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
if (!a || a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
},
elasticOut: function (t, b, c, d, a, p) {
if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
if (!a || a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
},
elasticBoth: function (t, b, c, d, a, p) {
if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
if (!a || a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
},
backIn: function (t, b, c, d, s) {
if (typeof s == 'undefined') s = 1.70158;
return c*(t/=d)*t*((s+1)*t - s) + b;
},
backOut: function (t, b, c, d, s) {
if (typeof s == 'undefined') s = 1.70158;
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
},
backBoth: function (t, b, c, d, s) {
if (typeof s == 'undefined') s = 1.70158;
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
},
bounceIn: function (t, b, c, d) {
return c - YAHOO.util.Easing.bounceOut(d-t, 0, c, d) + b;
},

bounceOut: function (t, b, c, d) {
if ((t/=d) < (1/2.75)) {
return c*(7.5625*t*t) + b;
} else if (t < (2/2.75)) {
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
} else if (t < (2.5/2.75)) {
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
} else {
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
}
},
bounceBoth: function (t, b, c, d) {
if (t < d/2) return YAHOO.util.Easing.bounceIn(t*2, 0, c, d) * .5 + b;
return YAHOO.util.Easing.bounceOut(t*2-d, 0, c, d) * .5 + c*.5 + b;
}
};

(function() {
YAHOO.util.Motion = function(el, attributes, duration,  method) {
if (el) { 
YAHOO.util.Motion.superclass.constructor.call(this, el, attributes, duration, method);
}
};

YAHOO.extend(YAHOO.util.Motion, YAHOO.util.ColorAnim);


var Y = YAHOO.util;
var superclass = Y.Motion.superclass;
var proto = Y.Motion.prototype;
proto.toString = function() {
var el = this.getEl();
var id = el.id || el.tagName;
return ("Motion " + id);
};

proto.patterns.points = /^points$/i;
proto.setAttribute = function(attr, val, unit) {
if (  this.patterns.points.test(attr) ) {
unit = unit || 'px';
superclass.setAttribute.call(this, 'left', val[0], unit);
superclass.setAttribute.call(this, 'top', val[1], unit);
} else {
superclass.setAttribute.call(this, attr, val, unit);
}
};
proto.getAttribute = function(attr) {
if (  this.patterns.points.test(attr) ) {
var val = [
superclass.getAttribute.call(this, 'left'),
superclass.getAttribute.call(this, 'top')
];
} else {
val = superclass.getAttribute.call(this, attr);
}

return val;
};
proto.doMethod = function(attr, start, end) {
var val = null;

if ( this.patterns.points.test(attr) ) {
var t = this.method(this.currentFrame, 0, 100, this.totalFrames) / 100;
val = Y.Bezier.getPosition(this.runtimeAttributes[attr], t);
} else {
val = superclass.doMethod.call(this, attr, start, end);
}
return val;
};
proto.setRuntimeAttribute = function(attr) {
if ( this.patterns.points.test(attr) ) {
var el = this.getEl();
var attributes = this.attributes;
var start;
var control = attributes['points']['control'] || [];
var end;
var i, len;

if (control.length > 0 && !(control[0] instanceof Array) ) { 
control = [control];
} else { 
var tmp = [];
for (i = 0, len = control.length; i< len; ++i) {
tmp[i] = control[i];
}
control = tmp;
}

if (Y.Dom.getStyle(el, 'position') == 'static') { 
Y.Dom.setStyle(el, 'position', 'relative');
}

if ( isset(attributes['points']['from']) ) {
Y.Dom.setXY(el, attributes['points']['from']); 
}
else { Y.Dom.setXY( el, Y.Dom.getXY(el) ); } 

start = this.getAttribute('points'); 

if ( isset(attributes['points']['to']) ) {
end = translateValues.call(this, attributes['points']['to'], start);

var pageXY = Y.Dom.getXY(this.getEl());
for (i = 0, len = control.length; i < len; ++i) {
control[i] = translateValues.call(this, control[i], start);
}


} else if ( isset(attributes['points']['by']) ) {
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] ];
}
}

this.runtimeAttributes[attr] = [start];

if (control.length > 0) {
this.runtimeAttributes[attr] = this.runtimeAttributes[attr].concat(control);
}

this.runtimeAttributes[attr][this.runtimeAttributes[attr].length] = end;
}
else {
superclass.setRuntimeAttribute.call(this, attr);
}
};

var translateValues = function(val, start) {
var pageXY = Y.Dom.getXY(this.getEl());
val = [ val[0] - pageXY[0] + start[0], val[1] - pageXY[1] + start[1] ];

return val;
};

var isset = function(prop) {
return (typeof prop !== 'undefined');
};
})();
(function() {
YAHOO.util.Scroll = function(el, attributes, duration,  method) {
if (el) { 
YAHOO.util.Scroll.superclass.constructor.call(this, el, attributes, duration, method);
}
};

YAHOO.extend(YAHOO.util.Scroll, YAHOO.util.ColorAnim);
var Y = YAHOO.util;
var superclass = Y.Scroll.superclass;
var proto = Y.Scroll.prototype;
proto.toString = function() {
var el = this.getEl();
var id = el.id || el.tagName;
return ("Scroll " + id);
};
proto.doMethod = function(attr, start, end) {
var val = null;

if (attr == '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 = superclass.doMethod.call(this, attr, start, end);
}
return val;
};
proto.getAttribute = function(attr) {
var val = null;
var el = this.getEl();

if (attr == 'scroll') {
val = [ el.scrollLeft, el.scrollTop ];
} else {
val = superclass.getAttribute.call(this, attr);
}

return val;
};
proto.setAttribute = function(attr, val, unit) {
var el = this.getEl();

if (attr == 'scroll') {
el.scrollLeft = val[0];
el.scrollTop = val[1];
} else {
superclass.setAttribute.call(this, attr, val, unit);
}
};
})();

