//cufon cufon(); // use $j as shortcut for jQuery; $ is used by prototype in WP var $j = jQuery.noConflict(); var fullHeight = jQuery( window ).height() - 55, compactHeight = 230, intermediateHeight = 320, flashMinHeight = 650, pageMinHeight = 705, // flashMinHeight + 55 pixels for footer minWidth = 1006; var notloaded = true; if (jQuery.browser.msie && jQuery.browser.version.substr(0,1)<7) var ie6 = true; else var ie6 = false; (function($) { $.fn.customFadeIn = function(speed, callback) { if(jQuery.browser.msie) { $(this).fadeIn(speed, function(){ $(this).get(0).style.removeAttribute('filter'); if(callback != undefined) callback(); }); } else $(this).animate({opacity:1}, speed, callback); }; $.fn.customFadeOut = function(speed, callback) { if(jQuery.browser.msie) { $(this).fadeOut(speed, function(){ $(this).get(0).style.removeAttribute('filter'); if(callback != undefined) callback(); }); } else $(this).animate({opacity:0}, speed, callback); }; })(jQuery); var flashHeader = { Page_Load: function() { var flashvars = { inwrapper : "true", configpath : template_directory + '/flash/', full : full_flash }; if( jQuery.url.attr("path") != "/" && jQuery.url.attr("anchor") == null ) flashvars.full = false; var params = {}; params.menu = "false"; params.quality = "high"; params.wmode = "opaque"; params.scale = "noscale"; params.salign = "lt"; params.allowscriptaccess = "sameDomain"; params.bgcolor = "#CCCCCC"; var attributes = { id: "flashHeader" }; var flashWidth = (jQuery( window ).width() > minWidth) ? jQuery(window).width() : minWidth; var flashInitialHeight = (jQuery( window ).height() > flashMinHeight) ? fullHeight : flashMinHeight ; swfobject.embedSWF(template_directory + "/flash/Container.swf", "flashHeader", flashWidth, (full_flash?flashInitialHeight:compactHeight), player_version,"", flashvars, params, attributes, noFlash); var hasFlash = (swfobject.getFlashPlayerVersion().major > 0); if(!hasFlash) $j("#container,#htmlHeader").show(); else { //Setup resize handler... $j( window ).resize( flashHeader.resizeFlash ); $j( window ).resize( flashHeader.positionFooter ); flashHeader.resizeFlash(); flashHeader.positionFooter(); flashHeader.hijackLinks(); $j('#container').hide(); //$j('#container').customFadeOut(); } }, jsLoad: function( url, newHeight ) { // Sanitize url if ( url && url.length > 1 ) { if ( url.charAt(url.length - 1) == '/' ) url = url.substr( 0, url.length - 1 ); } if( newHeight != undefined ) { if( newHeight == '100%' ) { $j("#container").customFadeOut(300, function() { $j("#container").hide() } ); $j( '#flashHeaderWrapper' ).animate( { height: fullHeight}, 500, function(){ flashHeader.resizeFlash(); flashHeader.positionFooter(); }); } else { $j( '#flashHeaderWrapper' ).animate( { height: newHeight } ); if(url) { //jQuery('#container').show(); if ( jQuery.browser.msie ) $j('#container').customFadeIn() } } } //console.log( 'loading:' + url); if (String(url) != "false") { if(swfobject.ua.ie) { $j('#container').load( url, function(){ flashHeader.hijackLinks(); stButtons.makeButtons(); if (url.indexOf('goto=comments') > 0) $j('html, body').animate({scrollTop: $j('a[name=comments]').offset().top}); else $j('html, body').animate({scrollTop:0}); }); } else { $j("#container").customFadeOut(null, function() { $j('#container').load( url, function(){ flashHeader.hijackLinks(); stButtons.makeButtons(); if (url.indexOf('goto=comments') > 0) $j('html, body').animate({scrollTop: $j('a[name=comments]').offset().top}); else $j('html, body').animate({scrollTop:0}); }); flashHeader.positionFooter(); }); } notloaded = false; } }, hijackLinks: function(response, status, hxr) { if( status == "error" ) jQuery("#container").html( response ); $j("#container").show(); if(!swfobject.ua.ie && !notloaded) { $j("#container").customFadeIn(); } if(!swfobject.hasFlashPlayerVersion(player_version)) return; $j( "body" ).find( 'a' ).each( function(i) { if( $j(this).attr( 'href' ) && $j(this).attr( 'href' ).match( 'mailto:' ) == null && !$j(this).hasClass('json') && $j(this).attr( 'href' ).match( 'javascript:' ) == null) { var url = $j(this).attr( 'href' ).toLowerCase(); // HACK! if (url.indexOf( site_url ) >= 0 || url.indexOf( 'http://' ) < 0) { if (url.indexOf('#comments')>=0) { url = url.replace('#comments',''); if (url.indexOf('?') >= 0) url += '&goto=comments'; else url += '?goto=comments'; } $j(this).attr( 'href', url.replace(site_url,'')); //$j(this).address(); $j(this).click(function(){ flashHeader.jsLoad($j(this).attr('href')); SWFAddress.setValue($j(this).attr('href')); return false; }); } else $j(this).attr( 'target', '_blank'); } }); }, resizeFlash: function() { if( !swfobject.hasFlashPlayerVersion(player_version) ) return; var content = $j( "#flashHeaderWrapper" ), flashMovie = content.find('object'); if( jQuery( window ).width() > minWidth ) { content.css('width', '100%'); flashMovie.attr('width', '100%' ); } else { content.css('width', minWidth); flashMovie.attr('width', minWidth ); } if ( content.height() == compactHeight || content.height() == intermediateHeight) return; if( jQuery( window ).height() > compactHeight && jQuery( window ).height() > pageMinHeight) { fullHeight = jQuery( window ).height() - 55; content.css('height', fullHeight ); flashMovie.attr('height', fullHeight); } else { content.css('height', flashMinHeight); flashMovie.attr('height', parseInt(flashMinHeight) ); } }, getFlashMovieObject: function (movieName){ if (window.document[movieName]){ return window.document[movieName]; } if (navigator.appName.indexOf("Microsoft Internet")==-1){ if (document.embeds && document.embeds[movieName]) return document.embeds[movieName]; } else return document.getElementById(movieName); }, positionFooter : function() { var winHeight = jQuery( window ).height(), flashHeight = jQuery( '#flashHeaderWrapper' ).height(); if ( winHeight < pageMinHeight && flashHeight == flashMinHeight ) jQuery("#footerWrap").removeClass( 'fixed' ).addClass( 'absolute' ); else jQuery("#footerWrap").removeClass( 'absolute' ).addClass( 'fixed' ); } } var conversationLanding = { Page_Load: function() { $j("div#conversationsList div.conversation a").live('mouseover',conversationLanding.Conversation_MouseOver); $j("div#conversationsList div.conversation a").live('mouseout',conversationLanding.Conversation_MouseOut); }, Conversation_MouseOver: function(e) { if (!ie6) $j(this).find("img.conversation-image-hover").show(); return true; }, Conversation_MouseOut: function(e) { $j(this).find("img.conversation-image-hover").hide(); return true; } } var casestudyLanding = { Page_Load: function() { $j("div#casestudyList div.casestudy a").live('mouseover',casestudyLanding.CaseStudy_MouseOver); $j("div#casestudyList div.casestudy a").live('mouseout',casestudyLanding.CaseStudy_MouseOut); }, CaseStudy_MouseOver: function(e) { if (!ie6) $j(this).find("img.casestudy-image-hover").show(); return true; }, CaseStudy_MouseOut: function(e) { $j(this).find("img.casestudy-image-hover").hide(); return true; } } initialize = function() { flashHeader.Page_Load(); conversationLanding.Page_Load(); casestudyLanding.Page_Load(); jQuery('#htmlHeaderNav ul li').mouseover(function(){ jQuery(this).addClass('ro'); }); jQuery('#htmlHeaderNav ul li').mouseout(function(){ jQuery(this).removeClass('ro'); }); //NOFLASH settings if(!swfobject.hasFlashPlayerVersion(player_version)) { if(jQuery.url.attr("anchor") != null) flashHeader.jsLoad( jQuery.url.attr("anchor") ); else $j("#container").animate({opacity: 1}); } //conversation article thumbnail hover $j('.casestudy-thumb a div').live('mouseover', function(){ $j(this).children('img:last').show(); $j('#custom-tooltip').css({ top: $j(this).offset().top - 35, left: $j(this).offset().left }); $j('#custom-tooltip').text($j(this).parent().attr('title')); $j('#custom-tooltip').show(); }); $j('.casestudy-thumb a div').live('mouseout', function(){ $j(this).children('img:last').hide(); $j('#custom-tooltip').hide(); }); } function cufon() { if (!ie6) { Cufon.replace( '#onw_contact_form .form-element-row label,'+ 'h1, h2, #subscribe-newsletter, .commentsLink,'+ '#submit, .our-process, .careers-key ul, #sidebar .contacts,'+ '#contact-getdrafted .details div,'+ '.news-article-title a, .pcx-article-title a'); } } function noFlash(e) { if (!e.success) { jQuery('#wrapper, #content, #container, #htmlHeader').show(); jQuery('#flashHeaderWrapper').css('height','auto'); jQuery( document ).find( 'a' ).unbind(); } } $j(document).ready(initialize);