// ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| // // Coded by Travis Beckham // http://www.squidfingers.com | http://www.podlob.com // If want to use this code, feel free to do so, but please leave this message intact. // If you do remove this, I will hunt you down :) // // ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| // --- myapi version date: 03/29/02 ------------------------------------------------------ // // --------------------------------------------------------------------------------------- // Several functions added or modified by Scott Upton, Uptonic.com // January 2005 // --------------------------------------------------------------------------------------- Detect = function(){ var agent = navigator.userAgent.toLowerCase(); this._mac = agent.indexOf('mac') != -1; this._win = !this._mac; this._w3c = document.getElementById; this._iex = document.all; this._ns4 = document.layers; } Detect.prototype.getObj = function(name){ if(this._w3c){ return document.getElementById(name); }else if(this._iex){ return document.all[name]; }else if(this._ns4){ return this.getObjNS4(document,name); } } Detect.prototype.getObjNS4 = function(obj, name){ var d = obj.layers; var result,temp; for(var i=0; i time){ this.cancelTween(); }else{ var w = method(this._tweenTime, start[0], end[0]-start[0], time); var h = method(this._tweenTime, start[1], end[1]-start[1], time); this.sizeTo(w,h); } } HTMLobj.prototype.cancelTween = function(){ // cancel the tweenTo method clearInterval(this._timer); this._timer = null; this._tweenRunning = false; this._startFade = true; } // -> Easing Equations by Robert Penner - robertpenner.com - linearTween = function(t, b, c, d){ return c*t/d + b; } easeInQuad = function(t, b, c, d){ t /= d; return c*t*t + b; } easeOutQuad = function(t, b, c, d){ t /= d; return -c * t*(t-2) + b; } easeInOutQuad = function(t, b, c, d){ t /= d/2; if (t < 1) return c/2*t*t + b; t--; return -c/2 * (t*(t-2) - 1) + b; } easeInExpo = function(t, b, c, d){ return c * Math.pow( 2, 10 * (t/d - 1) ) + b; } easeOutExpo = function(t, b, c, d){ return c * ( -Math.pow( 2, -10 * t/d ) + 1 ) + b; } // ------------------------------------------- // Added by SU, Uptonic.com // December 2004 - January 2005 // ------------------------------------------- HTMLobj.prototype.getRandom = function(start,end){ // generate new random number this._randNum= Math.round(start + ((end-start) * Math.random())); return this._randNum; } HTMLobj.prototype.setOpacity = function(opacity){ // set opacity of the element // Fix for math error in some browsers opacity = (opacity == 100)?99.999:opacity; // IE/Windows this._css.filter = "alpha(opacity:"+opacity+")"; // Safari < 1.2, Konqueror this._css.KHTMLOpacity = opacity/100; // Older Mozilla and Firefox this._css.MozOpacity = opacity/100; // Safari 1.2, newer Firefox and Mozilla, CSS3 this._css.opacity = opacity/100; } HTMLobj.prototype.fadeOut = function(opacity, change, speed){ // gradually decrease the opacity of the element // opacity: starting opacity of element // change: the size of the increments between steps // speed: the rate of the animation if (opacity >= 0){ this._fadeRunning = true; this.setOpacity(opacity); opacity -= change; setTimeout(this._obj+'.fadeOut('+opacity+','+change+','+speed+')', speed); } else { this._fadeRunning = false; this.hide(); } } HTMLobj.prototype.fadeIn = function(opacity, change, speed){ // gradually increase the opacity of the element // opacity: starting opacity of element // change: the size of the increments between steps // speed: the rate of the animation if (opacity <= 100){ this.show(); this._fadeRunning = true; this.setOpacity(opacity); opacity += change; setTimeout(this._obj+'.fadeIn('+opacity+','+change+','+speed+')', speed); } else { this._fadeRunning = false; this.setOpacity(100); } } HTMLobj.prototype.displayShow = function(){ // display the element as 'block' this._css.display = 'block'; } HTMLobj.prototype.displayHide = function(){ // do not display the element this._css.display = 'none'; } HTMLobj.prototype.setSrc = function(target){ // set the element's source to target this._el.src = target; } HTMLobj.prototype.setHref = function(target){ // set the element's link to target this._el.href = target; } HTMLobj.prototype.setInnerHtml = function(content){ // set the element's inner HTML to content this._el.innerHTML = content; }