var app = new function($) { this.root = 'http://flavourscatering.com.au/'; this.init = function() { var self = this; $(function() { self.favourite(); self.writeSlideshow(); self.writeGallery(); }); }; this.favourite = function() { $('.favourite').bind('click', function() { var url = this.root; var title = 'Flavours Catering + Events'; if (document.all) { window.external.AddFavorite(url, title); } else if (window.sidebar) { window.sidebar.addPanel(title, url, ''); } }); }; this.writeSlideshow = function() { var swf = new SWFObject(this.root + 'slideshow.swf', 'single', '250', '146', '7'); swf.addParam('menu', 'false'); swf.addParam('wmode', 'transparent'); swf.addParam('allowscriptaccess', 'always'); swf.addVariable('rp', this.root); swf.write('slideshow'); }; this.writeDate = function() { var now = new Date(); var days = new Array( 'Sunday','Monday','Tuesday', 'Wednesday','Thursday','Friday','Saturday'); var months = new Array( 'January','February','March','April','May', 'June','July','August','September','October', 'November','December'); var date = ((now.getDate() < 10) ? '0' : '')+ now.getDate(); function fourDigits(number) { return (number < 1000) ? number + 1900 : number; } today = days[now.getDay()] + ' ' + date + ' ' + months[now.getMonth()] + ' ' + (fourDigits(now.getYear())); $('#today-date').html(today); }; this.writeGallery = function() { var gallery = { carousel: null, large: null, init: function () { this.carousel = $('#gallery'); this.large = $('#gallery-large'); if (!this.carousel.length) { return; } this.carousel.jcarousel(); this.configure(); }, configure: function() { var self = this; this.carousel.find('a').bind('click', function() { self.load(this.href); return false; }).hover(function() { $(this).css('background', '#f7f7f7').find('img').animate({ opacity: 0.5 }, 300); }, function() { $(this).css('background', '#ffffff').find('img').animate({ opacity: 1 }, 300); }).eq(0).trigger('click'); }, load: function(v) { var self = this; var data = $('