/* * Javascript implementations for WhatAMan 2008 website * (c) Papercut Media. No reproduction without permission. Feel free to ask. * Author: Patrick Pittman * Date: October 2007 * Version: 1.0 * Requires: Prototype.js framework, ufo.js for flash loading, Dreamgirl on the other end for AJAXy JSON communication */ var Cookie = { set: function(name, value, daysToExpire) { var expire = ''; if (daysToExpire != undefined) { var d = new Date(); d.setTime(d.getTime() + (86400000 * parseFloat(daysToExpire))); expire = '; expires=' + d.toGMTString(); } return (document.cookie = escape(name) + '=' + escape(value || '') + expire); }, get: function(name) { // alert(document.cookie.inspect()); var cookie = document.cookie.match(new RegExp('(^|;)\\s*' + escape(name) + '=([^;\\s]*)')); return (cookie ? unescape(cookie[2]) : null); }, erase: function(name) { var cookie = Cookie.get(name) || true; Cookie.set(name, '', -1); return cookie; }, accept: function() { if (typeof navigator.cookieEnabled == 'boolean') { return navigator.cookieEnabled; } Cookie.set('_test', '1'); return (Cookie.erase('_test') === '1'); } }; function Papercut() { this.loaderlock = false; this.baseHref = "http://www.eldership.com.au/"; this.ajaxBase = this.baseHref+"js/ajax/"; this.ajaxProgress = document.createElement('img'); this.ajaxProgress.src = this.baseHref+"images/icons/ajax-loader.gif"; this.anchors = $H({}); } Papercut.prototype.init = function(e) { Element.extend(document.body); if ($('musicLaunchBox')) { playerstate = Cookie.get('cbPlayerOpen'); if (playerstate == 'true') { // $('musicLaunchBox').down('img').src = this.baseHref+"images/headings/launch-audio-lg.jpg" } } fixIEPNG(); this.loadPlayer(); if (!document.location.href.match('login') && !document.body.hasClassName('editmode')) { } } Papercut.prototype.loadPlayer = function() { if ($('musicBox')) { var xspf = { movie:this.baseHref+"jc-music-player.swf?DG_RELEASE=live&playlist_url="+this.baseHref+"xspf/Papercut.xspf&autoresume=1&autoplay=1&volume_level=60", id:"xspf", width:"241", height:"271", majorversion:"8", build:"0", allowscriptaccess: "always", wmode: "transparent" }; UFO.create(xspf,'musicBox'); Cookie.set('cbPlayerOpen',true); Event.observe(window,'unload',function(e) { Event.stop(e); if (window.parent) { lb = window.parent.document.getElementById('musicLaunchBox'); if (lb) { // alert('found launch box'); // lb.down('img').src = this.baseHref+"images/headings/launch-audio-lg.jpg"; } } Cookie.erase('cbPlayerOpen'); }); Event.observe(window,'close',function(e) { alert('closing player'); Cookie.erase('cbPlayerOpen'); }); } else { if ($('musicLaunchBox')) { Event.observe($('musicLaunchBox'),'click',function(e){ Event.stop(e); element = Event.element(e); // $('musicLaunchBox').down('img').src = Papercut.baseHref+"images/headings/launch-audio-lg.jpg" popup = window.open(element.up('a').href,'PapercutPlayer','width=250,height=320,resizable=0,scrollbars=no,status=0'); if (window.focus) { popup.focus() }; }); } if ($('splashLink')) { Event.observe($('splashLink'),'click',function(e){ element = Event.element(e); popup = window.open(Papercut.baseHref+"player",'PapercutPlayer','width=305,height=300,resizable=0,scrollbars=no,status=0'); window.focus(); }); } } } function cleanupFP9IELeaks() { __flash_unloadHandler = function() {}; __flash_savedUnloadHandler = function() {}; } function fixIEPNG() { var version = parseFloat(navigator.appVersion.split('MSIE')[1]); if ((version >= 5.5) && (document.body.filters)) { for(var i=0; i" img.outerHTML = strNewHTML i = i-1 } } } } function initPapercut() { Papercut.init(); if (window.setupZoom) { setupZoom(); } } var Papercut = new Papercut(); document.observe('dom:loaded',initPapercut);