$(function() { $("ul").each(function(i) { var ul = $(this); ul.find("li:first").addClass("first").end().find("li:last").addClass("last"); }) }); // Easing Plugin /* * jQuery EasIng v1.1.2 - http://gsgd.co.uk/sandbox/jquery.easIng.php * * Uses the built In easIng capabilities added In jQuery 1.1 * to offer multiple easIng options * * Copyright (c) 2007 George Smith * Licensed under the MIT License: * http://www.opensource.org/licenses/mit-license.php */ // t: current time, b: begInnIng value, c: change In value, d: duration jQuery.extend(jQuery.easing, { easeInQuad: function (x, t, b, c, d) { return c*(t/=d)*t + b; }, easeOutQuad: function (x, t, b, c, d) { return -c *(t/=d)*(t-2) + b; }, easeInOutQuad: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t + b; return -c/2 * ((--t)*(t-2) - 1) + b; }, easeInCubic: function (x, t, b, c, d) { return c*(t/=d)*t*t + b; }, easeOutCubic: function (x, t, b, c, d) { return c*((t=t/d-1)*t*t + 1) + b; }, easeInOutCubic: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t + b; return c/2*((t-=2)*t*t + 2) + b; }, easeInQuart: function (x, t, b, c, d) { return c*(t/=d)*t*t*t + b; }, easeOutQuart: function (x, t, b, c, d) { return -c * ((t=t/d-1)*t*t*t - 1) + b; }, easeInOutQuart: function (x, 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; }, easeInQuint: function (x, t, b, c, d) { return c*(t/=d)*t*t*t*t + b; }, easeOutQuint: function (x, t, b, c, d) { return c*((t=t/d-1)*t*t*t*t + 1) + b; }, easeInOutQuint: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; return c/2*((t-=2)*t*t*t*t + 2) + b; }, easeInSine: function (x, t, b, c, d) { return -c * Math.cos(t/d * (Math.PI/2)) + c + b; }, easeOutSine: function (x, t, b, c, d) { return c * Math.sin(t/d * (Math.PI/2)) + b; }, easeInOutSine: function (x, t, b, c, d) { return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; }, easeInExpo: function (x, t, b, c, d) { return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; }, easeOutExpo: function (x, t, b, c, d) { return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; }, easeInOutExpo: function (x, t, b, c, d) { if (t==0) return b; if (t==d) return b+c; if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; }, easeInCirc: function (x, t, b, c, d) { return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; }, easeOutCirc: function (x, t, b, c, d) { return c * Math.sqrt(1 - (t=t/d-1)*t) + b; }, easeInOutCirc: function (x, t, b, c, d) { if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; }, easeInElastic: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; if (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; }, easeOutElastic: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; if (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; }, easeOutCool: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; if (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; }, easeInOutElastic: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); if (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; }, easeInBack: function (x, t, b, c, d, s) { if (s == undefined) s = 1.70158; return c*(t/=d)*t*((s+1)*t - s) + b; }, easeOutBack: function (x, t, b, c, d, s) { if (s == undefined) s = 1.70158; return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; }, easeInOutBack: function (x, t, b, c, d, s) { if (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; }, easeInBounce: function (x, t, b, c, d) { return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b; }, easeOutBounce: function (x, 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; } }, easeInOutBounce: function (x, t, b, c, d) { if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; } }); var section; var navIndices = { 'home': 0, 'media': 1, 'blog': 2, 'about': 3, 'contact': 4, 'login': 5 }; $(function() { section = $('body')[0].className.substring(5); $('body').removeClass('nojs').addClass('js'); if ($.browser.msie) $('body').addClass('ie'); }); function d(title, str) { if (title) title = unescape(title); if (str) str = unescape(str); if (str) $('#debug').prepend('
' + title + ': ' + str + '
'); else if (title == '-') $('#debug').prepend('------
'); else if (title) $('#debug').prepend('' + title + '
'); else $('#debug').prepend('
\n
');
$(this).append('');
$('.grey', this).css('opacity', 1)
$('.shadow', this).css('opacity', shadowDefault)
$('.' + fadingTo, this).css('opacity', 0);
});
//
// Functions for hover on and off
//
var easingImage = 'easeOutBack';
var easingFade = 'easeOutBack';
var easingShadow = 'easeOutExpo';
var easingLabel = 'easeOutSine';
var hovers = [function() {
if (navHoversDisabled) return;
// d('Hovering on: ' + this.id);
// Image
$('a', this).stop().animate({
'height': '108px'
}, 900, easingImage);
// Fade
$('.' + fadingTo, this).stop().animate({
'opacity': 1
}, 800);
// Shadow
$('.shadow', this).stop().animate({
'bottom': '-25px',
'opacity': shadowHover
}, 900, easingShadow);
// Label
$('.label', this).stop().animate({
'bottom': '30px',
'opacity': 1
}, 600, easingLabel);
}, function() {
// Image
$('a', this).stop().animate({
'height': '64px'
}, 900, 'easeOutBack');
// Fade
$('.' + fadingTo, this).stop().animate({
'opacity': 0
}, 900);
// Shadow
$('.shadow', this).stop().animate({
'bottom': '-17px',
'opacity': shadowDefault
}, 900, easingShadow);
// Label
$('.label', this).stop().animate({
'bottom': '10px',
'opacity': 0
}, 700, 'easeOutExpo');
}];
//
// Initialize the hovers either all together or one by one
//
var initHovers = function(n) {
/*
If it's a number:
Positive: Enable just that one
Negative: Enable the rest except for that one
If no argument:
Enable all of them.
*/
// d('Init hover: ' + n);
if (typeof n == 'number')
if (n > -1)
$('#navigation li:eq(' + n + ')')
.one('mouseover', function() { $('#navigation li:eq(' + n + ') a').queue([]).stop(); })
.hover.apply($('#navigation li:eq(' + n + ')'), hovers);
else
$('#navigation li').not(':eq(' + -n + ')')
.one('mouseover', function() { $('#navigation li').not(':eq(' + -n + ') a').queue([]).stop(); })
.hover.apply($('#navigation li').not(':eq(' + -n + ')'), hovers);
else
$('#navigation ul')
// .one('mouseover', function() { $('#navigation li a').queue([]).stop();})
.hover.apply($('#navigation li'), hovers);
};
//
// Call it in the context of the li with n == index of the element
// This bounces an icon down
//
var bounceDown = function(options) {
// d('In bouncedown: ' + this.id);
var self = this;
var itemName = this.id.substring(2);
// if (section == itemName)
// $('.grey', this)[0].src = '../lib/i/sandwich/black/navigation/orbs/grey/' + itemName + '.png'
var e = {
fadeinLength: 600,
pulseLength: 600,
dropLength: 1200,
easing: 'easeOutBack'
}
if (options) e = jQuery.extend(e, options);
$('.shadow', self).animate({
'bottom': '-30px',
'opacity': shadowHover
}, fadeinLength, e.easing);
$('a', self)
.animate({ 'opacity': 1 }, e.fadeinLength, e.easing)
.find('.white')
.animate({ 'opacity': 1 }, e.pulseLength, function() {
if (section == itemName)
$('.grey', self)[0].src = 'http://fselemental.com/lib/i/sandwich/black/navigation/orbs/blue/' + itemName + '.png'
})
.animate({ 'opacity': 0 }, e.pulseLength)
.end()
.animate({ 'height': '64px' }, e.dropLength, e.easing);
// Initialize the hovers at a good point in the animation
setTimeout(function() {
initHovers.apply(self, [navIndices[itemName]]);
}, e.dropLength - 150);
// And animate the shadow too
setTimeout(function() {
$('.shadow', self).animate({
'bottom': '-17px',
'opacity': shadowDefault
}, e.dropLength, e.easing);
}, e.fadeinLength)
};
// If it is not the home page, only drop the active one
if (section != 'home') {
var fadeinLength = 250;
var current = $('#navigation li:eq(' + navIndices[section] + ')')[0];
// Set the defaults
$('a', current).css({
'height': '108px'
});
$('.shadow', current).css({
'bottom': '-30px',
'opacity': shadowHover
});
// Label Show the label
$('.label', current).css({
'bottom': '30px',
'opacity': 1
}, 900, 'easeOutSine');
bounceDown.apply(current, [{ 'fadeinLength': fadeinLength, pulseLength: 0 }])
setTimeout(function() {
// Also fade out the label
$('.label', current).stop().animate({
'bottom': '10px',
'opacity': 0
}, 700, 'easeOutExpo');
}, fadeinLength); // Same time as it takes for the icon to fade in
initHovers(-navIndices[section]);
/*setTimeout(function() {
initHovers(navIndices[section])
}, 600);*/
return;
}
// Bounce them down in a wave on the home page
var timeout = 0;
$('#navigation li').each(function(n) {
var self = this;
// Set the defaults
$('a', this).css({
'height': '128px',
'opacity': 0
});
$('.shadow', this).css({
'bottom': '-30px',
'opacity': 0
});
setTimeout(function() {
// d('self: ' + self);
bounceDown.apply(self);
}, timeout += 100);
});
}
// Version 1:
// Fade in + Animate downwards at once.
/*
setTimeout(function() {
$('a', self)
.animate({ 'opacity': 1 }, { duration: 600, easing: 'easeOutBack', queue: false })
.animate({ 'height': '64px' }, 800, 'easeOutBounce', function() {
// If this is the last element
if (n == 5) initHovers();
});
//setTimeout(function() {
$('.shadow', self).animate({
'bottom': '-17px',
'opacity': shadowDefault
}, 600, 'easeOutBounce');
//}, 500)
}, timeout += 100);
*/
var Class = {
create: function() {
return function() {
this.initialize.apply(this, arguments);
}
}
}
// Apple's browser detector
if(typeof (AC)==="undefined"){AC={}}AC.Detector={getAgent:function(){return navigator.userAgent.toLowerCase()},isMac:function(B){var A=B||this.getAgent();return !!A.match(/mac/i)},isWin:function(B){var A=B||this.getAgent();return !!A.match(/win/i)},isWin2k:function(B){var A=B||this.getAgent();return this.isWin(A)&&(A.match(/nt\s*5/i))},isWinVista:function(B){var A=B||this.getAgent();return this.isWin(A)&&(A.match(/nt\s*6/i))},isWebKit:function(B){if(this._isWebKit===undefined){var A=B||this.getAgent();
this._isWebKit=!!A.match(/AppleWebKit/i);this.isWebKit=function(){return this._isWebKit}}return this._isWebKit},isSafari2:function(C){if(this._isSafari2===undefined){if(!this.isWebKit()){this._isSafari2=false}else{var B=navigator.userAgent.toLowerCase();var A=parseInt(parseFloat(B.substring(B.lastIndexOf("safari/")+7)));this._isSafari2=(A>=419)}this.isSafari2=function(){return this._isSafari2}}return this._isSafari2},isOpera:function(B){var A=B||this.getAgent();return !!A.match(/opera/i)},isIE:function(B){var A=B||this.getAgent();
return !!A.match(/msie/i)},isIEStrict:function(B){var A=B||this.getAgent();return A.match(/msie/i)&&!this.isOpera(A)},isFirefox:function(B){var A=B||this.getAgent();return !!A.match(/firefox/i)},isiPhone:function(B){var A=B||this.getAgent();return this.isMobile(A)},isMobile:function(B){var A=B||this.getAgent();return this.isWebKit(A)&&A.match(/Mobile/i)},isiTunesOK:function(B){var A=B||this.getAgent();return this.isMac(A)||this.isWin2k(A)},isQTInstalled:function(){var A=false;if(navigator.plugins&&navigator.plugins.length){for(var B=0;
B