﻿var AnimationUtilities={getStyleValue:function(c,a){var b="";if(document.defaultView&&document.defaultView.getComputedStyle)b=document.defaultView.getComputedStyle(c,"").getPropertyValue(a);else if(c.currentStyle){a=a.replace(/\-(\w)/g,function(b,a){return a.toUpperCase()});b=c.currentStyle[a]}return b},convertFromHex:function(a){return parseInt(a,16)},convertToHex:function(b){var a=b.toString(16);if(a.length==1)a="0"+a;return a},rgbToHex:function(b){if(b.indexOf(",")>-1){var a=b.split(","),e=parseInt(a[0].substring(4)),d=parseInt(a[1]),c=parseInt(a[2].substring(0,a[2].length-1));return "#"+this.convertToHex(e)+this.convertToHex(d)+this.convertToHex(c)}else return b},fadeBackgroundToColor:function(b,c,e){var a=this;if(typeof b=="string")b=document.getElementById(b);var r=10,j=.1,d=a.rgbToHex(b.style.backgroundColor),h=a.convertFromHex(d.substring(1,3)),g=a.convertFromHex(d.substring(3,5)),f=a.convertFromHex(d.substring(5,7)),n=a.convertFromHex(c.substring(1,3)),m=a.convertFromHex(c.substring(3,5)),l=a.convertFromHex(c.substring(5,7)),q=n-h,p=m-g,o=l-f;i(0);function i(a){var e=Math.min(Math.max(h+Math.round(q*(a/100)),0),255),d=Math.min(Math.max(g+Math.round(p*(a/100)),0),255),c=Math.min(Math.max(f+Math.round(o*(a/100)),0),255);b.style.backgroundColor="#"+AnimationUtilities.convertToHex(e)+AnimationUtilities.convertToHex(d)+AnimationUtilities.convertToHex(c);if(a<=100)setTimeout(function(){i(a+r)},j);else k()}function k(){b.style.backgroundColor=c;e&&e()}},fadeForegroundToColor:function(b,c,e){var a=this;if(typeof b=="string")b=document.getElementById(b);var r=10,j=.1,d=a.rgbToHex(b.style.color),h=a.convertFromHex(d.substring(1,3)),g=a.convertFromHex(d.substring(3,5)),f=a.convertFromHex(d.substring(5,7)),n=a.convertFromHex(c.substring(1,3)),m=a.convertFromHex(c.substring(3,5)),l=a.convertFromHex(c.substring(5,7)),q=n-h,p=m-g,o=l-f;i(0);function i(a){var e=Math.min(Math.max(h+Math.round(q*(a/100)),0),255),d=Math.min(Math.max(g+Math.round(p*(a/100)),0),255),c=Math.min(Math.max(f+Math.round(o*(a/100)),0),255);b.style.color="#"+AnimationUtilities.convertToHex(e)+AnimationUtilities.convertToHex(d)+AnimationUtilities.convertToHex(c);if(a<=100)setTimeout(function(){i(a+r)},j);else k()}function k(){b.style.color=c;e&&e()}},flash:function(b,d,e){var a=this;if(typeof b=="string")b=document.getElementById(b);var r=1,j=.1,c=a.rgbToHex(b.style.color),i=a.convertFromHex(d.substring(1,3)),h=a.convertFromHex(d.substring(3,5)),g=a.convertFromHex(d.substring(5,7)),n=a.convertFromHex(c.substring(1,3)),m=a.convertFromHex(c.substring(3,5)),l=a.convertFromHex(c.substring(5,7)),q=n-i,p=m-h,o=l-g;f(0);function f(a){var e=Math.min(Math.max(i+Math.round(q*(a/100)),0),255),d=Math.min(Math.max(h+Math.round(p*(a/100)),0),255),c=Math.min(Math.max(g+Math.round(o*(a/100)),0),255);b.style.color="#"+AnimationUtilities.convertToHex(e)+AnimationUtilities.convertToHex(d)+AnimationUtilities.convertToHex(c);if(a<=100)setTimeout(function(){f(a+r)},j);else k()}function k(){b.style.color=c;e&&e()}},fadeOut:function(a,c,b){if(typeof a=="string")a=document.getElementById(a);if(!b)b=.1;var e=.1;d(1);function d(c){a.style.opacity=c;a.style.filter="alpha(opacity="+Math.round(c*100)+");";if(a.style.zoom=="")a.style.zoom="1";if(c>0)setTimeout(function(){d(c-b)},e);else f()}function f(){a.style.opacity="0.00";a.style.filter="alpha(opacity=00);";c&&c()}},rollUp:function(a,d){if(typeof a=="string")a=document.getElementById(a);if(a.animating)return;a.animating=true;var g=.1,b=a.clientHeight;if(a.offsetHeight>b)b=a.offsetHeight;var h=a.style.overflow?a.style.overflow:"auto";a.style.overflow="hidden";var c=0;e(0);function f(c){for(var b=0,a=c;a>0;a--)b+=a;return b}function e(d){if(b-d>0){a.style.height=b-d+"px";a.scrollTop=d}if(b-d>f(c+1))c++;else if(c>1)c--;if(d<b)setTimeout(function(){e(d+c)},g);else i()}function i(){a.style.overflow=h;a.style.height=b+"px";a.animating=null;d&&d()}},rollLeft:function(a,c){if(typeof a=="string")a=document.getElementById(a);if(a.animating)return;a.animating=true;var f=.1,g=a.style.overflow?a.style.overflow:"auto";a.style.overflow="hidden";var b=0;d(0);function e(c){for(var b=0,a=c;a>0;a--)b+=a;return b}function d(c){if(a.offsetWidth-c>=0)a.style.marginLeft="-"+c+"px";if(a.offsetWidth-c>e(b+1))b++;else if(b>1)b--;if(c<a.offsetWidth)setTimeout(function(){d(c+b)},f);else h()}function h(){a.style.overflow=g;a.animating=null;a.style.marginLeft="-"+a.offsetWidth+"px";c&&c()}},rollRight:function(a,c){if(typeof a=="string")a=document.getElementById(a);if(a.animating)return;a.animating=true;var f=.1;a.style.overflow="hidden";var b=0;d(0);function e(c){for(var b=0,a=c;a>0;a--)b+=a;return b}function d(c){if(a.offsetWidth-c>=0)a.style.marginLeft=c+"px";if(a.offsetWidth-c>e(b+1))b++;else if(b>1)b--;if(c<a.offsetWidth)setTimeout(function(){d(c+b)},f);else g()}function g(){a.animating=null;a.style.marginLeft=a.offsetWidth+"px";c&&c()}},rollDown:function(a,d){if(typeof a=="string")a=document.getElementById(a);if(a.animating)return;a.animating=true;var g=.1,c=a.clientHeight;if(a.offsetHeight>c)c=a.offsetHeight;var h=a.style.overflow?a.style.overflow:"auto",b=0;a.style.overflow="hidden";if(a.style.zoom=="")a.style.zoom="1";e(c);function f(c){for(var b=0,a=c;a>0;a--)b+=a;return b}function e(d){a.style.height=c-d+"px";a.scrollTop=d;if(d>f(b+1))b++;else if(b>1)b--;if(d>0)setTimeout(function(){e(d-b)},g);else i()}function i(){a.style.overflow=h;a.style.height="";a.animating=null;d&&d()}},rollUpAndFade:function(a,d){if(typeof a=="string")a=document.getElementById(a);var g=.1,b=a.clientHeight;if(a.offsetHeight>b)b=a.offsetHeight;var h=a.style.overflow?a.style.overflow:"auto";a.style.overflow="hidden";var c=0;e(0);function f(c){for(var b=0,a=c;a>0;a--)b+=a;return b}function e(d){if(b-d>0){a.style.height=b-d+"px";a.scrollTop=d}a.style.opacity=1-Math.round(d/b*100)/100;a.style.filter="alpha(opacity="+(100-Math.round(d/b*100))+");";if(b-d>f(c+1))c++;else if(c>1)c--;if(d<b)setTimeout(function(){e(d+c)},g);else i()}function i(){a.style.overflow=h;a.style.height="0px";d&&d()}},rollDownAndFade:function(a,d){if(typeof a=="string")a=document.getElementById(a);var g=.1,b=a.clientHeight;if(a.offsetHeight>b)b=a.offsetHeight;var h=a.style.overflow?a.style.overflow:"auto",c=0;a.style.overflow="hidden";if(a.style.zoom=="")a.style.zoom="1";e(b);function f(c){for(var b=0,a=c;a>0;a--)b+=a;return b}function e(d){a.style.height=b-d+"px";a.scrollTop=d;a.style.opacity=1-Math.round(d/b*100)/100;a.style.filter="alpha(opacity="+(100-Math.round(d/b*100))+");";if(d>f(c+1))c++;else if(c>1)c--;if(d>0)setTimeout(function(){e(d-c)},g);else i()}function i(){a.style.overflow=h;a.style.height=b+"px";d&&d()}},transitionSlideLeft:function(a,c,d){if(typeof a=="string")a=document.getElementById(a);if(typeof c=="string")c=document.getElementById(c);if(a.animating)return;a.animating=true;var g=.1,h=a.style.overflow?a.style.overflow:"auto";a.style.overflow="hidden";var b=0;e(0);function f(c){for(var b=0,a=c;a>0;a--)b+=a;return b}function e(d){if(a.offsetWidth-d>=0){a.style.marginLeft="-"+d+"px";c.style.marginLeft=a.offsetWidth-d+"px"}if(a.offsetWidth-d>f(b+1))b++;else if(b>1)b--;if(d<a.offsetWidth)setTimeout(function(){e(d+b)},g);else i()}function i(){a.style.overflow=h;a.animating=null;a.style.marginLeft="-"+a.offsetWidth+"px";d&&d()}},transitionSlideRight:function(a,c,d){if(typeof a=="string")a=document.getElementById(a);if(typeof c=="string")c=document.getElementById(c);if(a.animating)return;a.animating=true;var g=.1,h=a.style.overflow?a.style.overflow:"auto";a.style.overflow="hidden";var b=0;e(0);function f(c){for(var b=0,a=c;a>0;a--)b+=a;return b}function e(d){if(a.offsetWidth-d>=0){a.style.marginLeft=d+"px";c.style.marginLeft=d-a.offsetWidth+"px"}if(a.offsetWidth-d>f(b+1))b++;else if(b>1)b--;if(d<a.offsetWidth)setTimeout(function(){e(d+b)},g);else i()}function i(){a.style.overflow=h;a.animating=null;a.style.marginLeft=a.offsetWidth+"px";d&&d()}}},GPAnimation=function(){this.defaultInterval=10;this.defaultAnimationLength=300};GPAnimation.prototype.convertFromHex=function(a){return parseInt(a,16)};GPAnimation.prototype.convertToHex=function(b){var a=b.toString(16);if(a.length==1)a="0"+a;return a};GPAnimation.prototype.rgbToHex=function(b){if(b.indexOf(",")>-1){var a=b.split(","),e=parseInt(a[0].substring(4)),d=parseInt(a[1]),c=parseInt(a[2].substring(0,a[2].length-1));return "#"+this.convertToHex(e)+this.convertToHex(d)+this.convertToHex(c)}else return b};GPAnimation.prototype.getStyleValue=function(c,a){var b="";if(document.defaultView&&document.defaultView.getComputedStyle)b=document.defaultView.getComputedStyle(c,"").getPropertyValue(a);else if(c.currentStyle){a=a.replace(/\-(\w)/g,function(b,a){return a.toUpperCase()});b=c.currentStyle[a]}return b};GPAnimation.prototype.findLeft=function(a){if(typeof a=="string")a=document.getElementById(a);if(a==null)return;var b=0;if(a.offsetParent)while(true){b+=a.offsetLeft;if(!a.offsetParent)break;a=a.offsetParent}else if(a.x)b+=a.x;return b};GPAnimation.prototype.findTop=function(a){if(typeof a=="string")a=document.getElementById(a);if(a==null)return;var b=0;if(a.offsetParent)while(true){if(a.offsetTop)b+=a.offsetTop;if(!a.offsetParent)break;a=a.offsetParent}else if(a.y)b+=a.y;return b};GPAnimation.prototype.slideTop=function(a,d,c,f){var b=this;if(typeof a=="string")a=document.getElementById(a);if(!c)c=b.defaultAnimationLength;a.slideTopTimer&&window.clearInterval(a.slideTopTimer);var j=(new Date).getTime(),e=parseInt(b.getStyleValue(a,"height")),i=d-e,g=b.findTop(a)+d,h=b;a.slideTopTimer=window.setInterval(function(){var b="px",m=(new Date).getTime(),k=m-j;if(k>=c){window.clearInterval(a.slideTopTimer);a.style.height=d+b;a.style.top=g-d+b;f&&f()}else{var l=parseInt(h.easeOut(k,c,i));a.style.height=e+l+b;a.style.top=g-l+b}},b.defaultInterval)};GPAnimation.prototype.slideBottom=function(a,e,c,f){var d=this;if(typeof a=="string")a=document.getElementById(a);if(!c)c=d.defaultAnimationLength;a.slideBottomTimer&&window.clearInterval(a.slideBottomTimer);var i=(new Date).getTime(),b=d.getStyleValue(a,"height");if(b=="auto")b=a.offsetHeight;b=parseInt(b);var h=e-b,g=d;a.slideBottomTimer=window.setInterval(function(){var k=(new Date).getTime(),d=k-i;if(d>=c){window.clearInterval(a.slideBottomTimer);a.style.height=e+"px";a.scrollTop=0;f&&f()}else{var j=parseInt(g.easeOut(d,c,h));a.style.height=b+j+"px";a.scrollTop=a.scrollHeight}},d.defaultInterval)};GPAnimation.prototype.slideLeft=function(a,d,c,g){var b=this;if(typeof a=="string")a=document.getElementById(a);if(!c)c=b.defaultAnimationLength;a.slideLeftTimer&&window.clearInterval(a.slideLeftTimer);var j=(new Date).getTime(),e=parseInt(b.getStyleValue(a,"width")),i=d-e,f=b.findLeft(a)+d,h=b;a.slideLeftTimer=window.setInterval(function(){var b="px",m=(new Date).getTime(),k=m-j;if(k>=c){window.clearInterval(a.slideLeftTimer);a.style.width=d+b;a.style.left=f-d+b;g&&g()}else{var l=parseInt(h.easeOut(k,c,i));a.style.width=e+l+b;a.style.left=f-l+b}},b.defaultInterval)};GPAnimation.prototype.slideRight=function(a,f,b,e){var c=this;if(typeof a=="string")a=document.getElementById(a);if(!b)b=c.defaultAnimationLength;a.slideRightTimer&&window.clearInterval(a.slideRightTimer);var i=(new Date).getTime(),d=parseInt(c.getStyleValue(a,"width")),h=f-d,g=c;a.slideRightTimer=window.setInterval(function(){var k=(new Date).getTime(),c=k-i;if(c>=b){window.clearInterval(a.slideRightTimer);a.style.width=f+"px";e&&e()}else{var j=parseInt(g.easeOut(c,b,h));a.style.width=d+j+"px"}},c.defaultInterval)};GPAnimation.prototype.scrollToTop=function(a,c,b){if(typeof a=="string")a=document.getElementById(a);if(!b)b=this.defaultAnimationLength;this.scrollToPosition(a,0,c,b)};GPAnimation.prototype.scrollToBottom=function(a,c,b){if(typeof a=="string")a=document.getElementById(a);if(!b)b=this.defaultAnimationLength;this.scrollToPosition(a,a.scrollHeight,c,b)};GPAnimation.prototype.scrollToPosition=function(a,c,d,b){if(typeof a=="string")a=document.getElementById(a);if(!b)b=this.defaultAnimationLength;a.scrollToPositionTimer&&window.clearInterval(a.scrollToPositionTimer);var g=(new Date).getTime(),e=parseInt(a.scrollTop),h=c-e,f=this;a.scrollToPositionTimer=window.setInterval(function(){var k=(new Date).getTime(),i=k-g;if(i>=b){window.clearInterval(a.scrollToPositionTimer);a.scrollTop=c;d&&d()}else{var j=parseInt(f.easeOut(i,b,h));a.scrollTop=e+j}},this.defaultInterval)};GPAnimation.prototype.easeOut=function(a,c,b){return -b*((a=a/c-1)*a*a*a-1)};GPAnimation.prototype.easeInOut=function(a,c,b){if((a/=c/2)<1)return b/2*a*a*a*a;else return -b/2*((a-=2)*a*a*a-2)};GPAnimation.prototype.fadeBackgroundToColor=function(b,f,j,c){var a=this;if(typeof b=="string")b=document.getElementById(b);if(!c)c=a.defaultAnimationLength;b.fadeBackgroundToColorTimer&&window.clearInterval(b.fadeBackgroundToColorTimer);var q=(new Date).getTime(),e,i,h,g,m,l,k,p,o,n;e=a.rgbToHex(a.getStyleValue(b,"background-color"));i=a.convertFromHex(e.substring(1,3));h=a.convertFromHex(e.substring(3,5));g=a.convertFromHex(e.substring(5,7));m=a.convertFromHex(f.substring(1,3));l=a.convertFromHex(f.substring(3,5));k=a.convertFromHex(f.substring(5,7));p=m-i;o=l-h;n=k-g;var d=a;b.fadeBackgroundToColorTimer=window.setInterval(function(){var m=(new Date).getTime(),a=m-q,l,k,e;if(a>=c){window.clearInterval(b.fadeBackgroundToColorTimer);b.style.backgroundColor=f;j&&j()}else{l=i+parseInt(d.easeOut(a,c,p));k=h+parseInt(d.easeOut(a,c,o));e=g+parseInt(d.easeOut(a,c,n));b.style.backgroundColor="#"+d.convertToHex(l)+d.convertToHex(k)+d.convertToHex(e)}},a.defaultInterval)};GPAnimation.prototype.iterator=function(e,b,d,c,a){if(!a)a=this.defaultAnimationLength;document.body.iteratorTimer&&window.clearInterval(document.body.iteratorTimer);var h=(new Date).getTime(),g=d-b,f=this;document.body.iteratorTimer=window.setInterval(function(){var k=(new Date).getTime(),i=k-h;if(i>=a){window.clearInterval(document.body.iteratorTimer);e(d);c&&c()}else{var j=parseInt(f.easeOut(i,a,g));e(b+j)}},this.defaultInterval)};var gpAnimation=new GPAnimation