var Navigation = function() { var me = this; var args = arguments; var self = { c: { navItems: '#navigation .home, #navigation .services, #navigation .portfolio, #navigation .about, #navigation .contact', navSpeed: ($.browser.safari ? 600 : 350), snOpeningSpeed: ($.browser.safari ? 400 : 250), snOpeningTimeout: 150, snClosingSpeed: function() { if (self.subnavHovered()) return 123450; return 150; }, snClosingTimeout: 700 }, init: function() { $('.level_1', this.c.navItems).css({ 'opacity': 0 }); this.initHoverFades(); //this.initSubmenus(); }, subnavHovered: function() { var hovered = false; $(self.c.navItems).each(function() { if (this.hovered /* && $('.level_1', this).length > 0*/) hovered = true; }); return hovered; }, initHoverFades: function() { $('#navigation .main').append(''); $('#navigation .hover').css('opacity', 0); /*$('#navigation .home, #navigation .contact,#logotype').hover(function() {*/ $('#navigation .main,#subnavigation a').hover(function() { self.fadeNavIn.apply(this); }, function() { var el = this; setTimeout(function() { if (!el.open) self.fadeNavOut.apply(el); }, 10); }); }, fadeNavIn: function() { $('.hover', this).stop().animate({ 'opacity': 1 }, self.c.navSpeed); }, fadeSubnavIn: function() { var el = this; $('.level_1', this) .stop() .css('display', 'block') .animate({ 'top': '80px', 'opacity': 1 }, self.c.snOpeningSpeed, function() { el.open = true; }); }, fadeNavOut: function() { $('.hover', this).stop().animate({ 'opacity': 0 }, self.c.navSpeed); }, fadeSubnavOut: function() { $('.level_1', this) .stop() .animate({ /*'top': '70px',*/ 'opacity': 0 }, self.c.snClosingSpeed(), function() { $(this).css({'top': '70px', 'display': 'none'}); }); }, initSubmenus: function() { $(this.c.navItems).hover(function() { $(self.c.navItems).not(this).each(function() { self.fadeNavOut.apply(this); self.fadeSubnavOut.apply(this); }); this.hovered = true; if ($('.level_1', this).length == 0) return; var el = this; self.fadeNavIn.apply(el); clearTimeout(el.level1); el.level1 = setTimeout(function() { self.fadeSubnavIn.apply(el); }, self.c.snOpeningTimeout); }, function() { this.hovered = false; if ($('.level_1', this).length == 0) return; var el = this; clearTimeout(el.level1); if (!el.open) self.fadeNavOut.apply(el); el.level1 = setTimeout(function() { el.open = false; self.fadeSubnavOut.apply(el); self.fadeNavOut.apply(el); }, self.c.snClosingTimeout); }); } }; self.init.apply(self); return self; }; function d(s) { // $('body').append ('
' + s + '
'); } $(function(){ new Navigation(); });/* Codename Rainbow */ function initGradients(s) { $(function() { $(s).each(function() { var el = this; // Parse the inputs var from = '#ffffff', to = '#000000'; var fR = parseInt(from.substring(1, 3), 16), fG = parseInt(from.substring(3, 5), 16), fB = parseInt(from.substring(5, 7), 16), tR = parseInt(to.substring(1, 3), 16), tG = parseInt(to.substring(3, 5), 16), tB = parseInt(to.substring(5, 7), 16); var h = $(this).height() * 1.5; var html; if (this.initHTML) html = this.initHTML; else html = this.innerHTML; this.initHTML = html; this.innerHTML = ''; for (var i = 0; i < h; i++) { var c = '#' + (Math.floor(fR * (h - i) / h + tR * (i / h))).toString(16) + (Math.floor(fG * (h - i) / h + tG * (i / h))).toString(16) + (Math.floor(fB * (h - i) / h + tB * (i / h))).toString(16); $('' + html + '').appendTo(this); } $('' + html + '').appendTo(this); $('' + html + '').appendTo(this); }); }); } initGradients('.rainbows');$(function() { initTooltips({ timeout: 3000 }); }); function initTooltips(o) { //alert($.browser.safari) var showTip = function() { var el = $('.tt', this).css('display', 'block')[0]; var ttHeight = $(el).height(); var ttOffset = el.offsetHeight; var ttTop = ttOffset + ttHeight; $('.tt', this) .stop() .css({ 'opacity': 0, 'top': 10 - ttOffset }) .animate({ 'opacity': 1, 'top': 5 - ttOffset }, 250); }; var hideTip = function() { var self = this; var el = $('.tt', this).css('display', 'block')[0]; var ttHeight = $(el).height(); var ttOffset = el.offsetHeight; var ttTop = ttOffset + ttHeight; // alert(label.height()); // el.hiding = true; $('.tt', this) .stop() .animate({ 'opacity': 0, 'top': 10 - ttOffset }, 250, function() { el.hiding = false; $(this).css('display', 'none'); }); }; $('.tip .tt').hover( function() { return false; }, function() { return true; } ); $('.tip').hover( function(){ var self = this; showTip.apply(this); if (o.timeout) this.tttimeout = setTimeout(function() { hideTip.apply(self) } , o.timeout); }, function() { clearTimeout(this.tttimeout); hideTip.apply(this); } ); } Object.extend = function(destination, source) { for (property in source) { destination[property] = source[property]; } return destination; }; var Class = { create: function() { return function() { this.initialize.apply(this, arguments); } } }; var Helper = { setCookie: function(name, value) { var expires = new Date(); expires.setTime(expires.getTime() + 365 * 24 * 60 * 60 * 1000); var curCookie = name + '=' + escape(value) + '; expires=' + expires.toGMTString(); document.cookie = curCookie; }, getCookie: function(name) { var dc = document.cookie; var prefix = name + '='; var begin = dc.indexOf('; ' + prefix); if (begin == -1) { begin = dc.indexOf(prefix); if (begin != 0) return null; } else begin += 2; var end = document.cookie.indexOf(';', begin); if (end == -1) end = dc.length; return unescape(dc.substring(begin + prefix.length, end)); } }; String.prototype.format = function() { var params = String.prototype.format.arguments; var toReturn = this; for (var i = 0; i < params.length; i++) { var regex = new RegExp('\{[' + i + ']\}', 'g'); toReturn = toReturn.replace(regex, params[i]); } return toReturn; }; RegExp.escape = function(text) { if (!arguments.callee.sRE) { var specials = [ '/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\' ]; arguments.callee.sRE = new RegExp( '(\\' + specials.join('|\\') + ')', 'g' ); } return text.replace(arguments.callee.sRE, '\\$1'); }; // Elastic var ElasticLayout = Class.create(); ElasticLayout.prototype = { initialize: function(options) { var dOptions = { small: 1, large: 980, cSmall: 'anorexia', cLarge: 'whale' }; this.options = Object.extend(dOptions, options); this.addResizeHandler(); this.checkWidth(); }, addResizeHandler: function() { var self = this; $(window).resize( function() { self.checkWidth.apply(self); }); }, checkWidth: function() { var winWidth = this.getWidth(); var changeTo; switch(true) { case winWidth >= this.options.large: changeTo = this.options.cLarge; break; case winWidth >= this.options.small: changeTo = this.options.cSmall; break; } if (changeTo != this.curClass) this.changeClass(changeTo); }, getWidth: function() { if (window.innerWidth) return window.innerWidth; if (document.documentElement && document.documentElement.clientWidth != 0) return document.documentElement.clientWidth; if (document.body) return document.body.clientWidth; return 0; }, changeClass: function(cName) { $('body') .removeClass(this.options.cSmall) .removeClass(this.options.cLarge) .addClass(cName); } }; // Visit Couner var VisitCounter = Class.create(); VisitCounter.prototype = { initialize: function(options) { var dOptions = { bounds: [0, 1, 4, 5555], classnames: ['freshman', 'senior', 'professor'] }; this.options = Object.extend(dOptions, options); this.check(); }, check: function() { var visits = Helper.getCookie('visits'); if (!visits) visits = 1; for (var i = 0; i < this.options.bounds.length - 1; i++) { if ((visits > this.options.bounds[i]) && (visits <= this.options.bounds[i + 1])) { $('body').addClass(this.options.classnames[i]); break; } } visits++; Helper.setCookie('visits', visits); } }; // 5,4,3,1 OFFBLAST!! $(document).ready( function() { new VisitCounter(); });$(function() { // Body .safari class if ($.browser.safari) $('body').addClass('safari'); $('body').addClass('mocha'); /* Hover effects */ var fadeSpeed = ($.browser.safari ? 600 : 450); $('#logotype, ul.features a,#notice a').append(''); $('.hover').css('opacity', 0); /*$('#navigation .home, #navigation .contact,#logotype').hover(function() {*/ $('.hover').parent().hover(function() { $('.hover', this).stop().animate({ 'opacity': 1 }, fadeSpeed); }, function() { $('.hover', this).stop().animate({ 'opacity': 0 }, fadeSpeed); }); /* Side Subnavigation */ $('#subnavigation a').each(function() { // Each var html = this.innerHTML; $(this).html('' + html + ''); }); /* Building Trailer */ $('#trailer').html('