//cufon cufon(); //google.load("jquery", "1.4.2"); //google.load("swfobject", "2.2"); // use $j as shortcut for jQuery; $ is used by prototype in WP var $j = jQuery.noConflict(); var fullHeight = jQuery( window ).height() - 55; var compactHeight = 230; var intermediateHeight = 320; var notloaded = true; (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"}; swfobject.embedSWF(template_directory + "/flash/Container.swf", "flashHeader", "100%", (full_flash?fullHeight:compactHeight), player_version,"", flashvars, params, attributes, noFlash); flashHeader.hijackLinks(); var hasFlash = (swfobject.getFlashPlayerVersion().major > 0); if(!hasFlash) { $j("#container").css("display","block"); $j("#htmlHeader").css("display","block"); } //Setup resize handler... $j( window ).resize( flashHeader.resizeFlash ); flashHeader.resizeFlash(); //console.log(flashvars.full); /* $j.address.change(function(event) { if(event.value != '/' && !event.value.match('featured')) { flashHeader.jsLoad(event.value); if($j("#flashHeaderWrapper").height() != compactHeight) { $j('#flashHeaderWrapper').animate( { height: compactHeight } ); jQuery('#container').show(); } } }); **/ // if (hasFlash && flashvars.full) $j('#container').hide(); $j('#container').customFadeOut(); if ( ( isRelativeSubPath() || isDeepLinkPath() ) && !isFeatured() ) jQuery( "#flashHeaderWrapper" ).css( "height", 230 ); // if( isDeepLinkPath() ) // { // //flashHeader.jsLoad(jQuery.url.attr("anchor"), 230); // // if( jQuery.url.attr("anchor").indexOf("/featured/") >= 0) // flashHeader.jsLoad(null, "100%") // } }, jsLoad: function( url, newHeight ) { // Sanitize url // Todo: this needs to be taken care of on server-side if ( url && url.length > 1 ) { if ( url.charAt(url.length - 1) == '/' ) { url = url.substr( 0, url.length - 1 ); } } if( newHeight != undefined ) { if( newHeight == '100%' ) { // jQuery('#container').hide(); // jQuery('#container').css('opacity', '0'); $j("#container").customFadeOut(300, function() { $j("#container").hide() } ); $j( '#flashHeaderWrapper' ).animate( { height: fullHeight} ); } else { $j( '#flashHeaderWrapper' ).animate( { height: newHeight } ); if(url) { //jQuery('#container').show(); if ( jQuery.browser.msie ) $j('#container').customFadeIn() } } } //console.log( 'loading:' + url); // Deeplink store... /*if( url.substr( 0, 1 ) == '/' ) { location.href = 'http://ie.dev/#' + url; } else { location.href = 'http://ie.dev/#' + url.substr( 13 ); }*/ if (String(url) != "false") { $j('html').animate({scrollTop:0}); if(swfobject.ua.ie) { $j('#container').load( url, function(){ flashHeader.hijackLinks(); var script = 'http://s7.addthis.com/js/250/addthis_widget.js#username=iemedia&domready=1'; if (window.addthis) window.addthis = null; $j.getScript( script, function(){ jQuery('.addthis_container a').removeAttr('title'); }); }); } else { $j("#container").customFadeOut(null, function() { $j('#container').load( url, function(){ flashHeader.hijackLinks(); var script = 'http://s7.addthis.com/js/250/addthis_widget.js#username=iemedia&domready=1'; if (window.addthis) window.addthis = null; $j.getScript( script, function(){ jQuery('.addthis_container a').removeAttr('title'); }); }); }); } notloaded = false; } }, jGotoPage: function( event ) { //console.log( 'going there...' ); link = $j( event.currentTarget ); url = link.attr( 'href' ); url = url.replace(site_url, ""); var flashMovie = flashHeader.getFlashMovieObject("flashHeader"); //flashMovie.updateHeader(1); //flashMovie.updateContentIndex( i, i); //flashMovie.fGoToPage( url ); //flashHeader.jsLoad(url); //console.log(url); $j.address.parameter('s', '', false).path(url); // don't load the URL just here, use the address on change event return false; }, /*jGotoPageRaw: function( url ) { var flashMovie = flashHeader.getFlashMovieObject("flashHeader"); //flashMovie.fGoToPage( url ); flashHeader.jsLoad( url ); $j.address.parameter('s', '', false).path(url); return false; },*/ hijackLinks: function(response, status, hxr) { if( status == "error" ) jQuery("#container").html( response ); //console.log('hijackem'); $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).unbind(); }); $j( "body" ).find( 'a' ).each( function(i) { if($j(this).attr( 'href' ) && $j(this).attr( 'href' ).match( 'mailto:' ) == null) { var url = $j(this).attr( 'href' ).toLowerCase(); // HACK! if (url.indexOf( site_url ) >= 0 || url.indexOf( 'http://' ) < 0) { $j(this).click( flashHeader.jGotoPage ); } else $j(this).attr( 'target', '_blank'); } }); }, resizeFlash: function() { if( !swfobject.hasFlashPlayerVersion(player_version) ) return; var content = $j( "#flashHeaderWrapper" ); var flashMovie = content.find('object'); if( content.height() != compactHeight && content.height() != intermediateHeight) { fullHeight = jQuery( window ).height() - 55; content.css('height', fullHeight ); flashMovie.attr('height', fullHeight ); //console.log(fullHeight); } //console.log(content.height()); }, 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); } }/*, setMenuItem: function (item) { var flashMovie = flashHeader.getFlashMovieObject("flashHeader"); if(flashMovie != null) flashMovie.updateHeader(item); } */ } 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) { $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) { $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}); } // Added this snippet to explicitly set minimized height when sub-url accessed directly // TECK TO CONFIRM ON RE-SCRIPT // Detect deep-linking... //var actualLocation = '/' + location.href.substr( 15 ); //TODO - fix this so its smarter... //jGotoPageRaw( actualLocation ); } function cufon() { Cufon.replace('h1, h2, .commentsLink, #submit, .our-process, .careers-key ul, .getdrafted #sidebar .contacts, #contact-getdrafted .details div'); } function noFlash(e) { if (!e.success) { jQuery('#wrapper, #content, #container, #htmlHeader').show(); jQuery('#flashHeaderWrapper').css('height','auto'); jQuery( document ).find( 'a' ).unbind(); } } //google.setOnLoadCallback( initialize ); $j(document).ready(initialize); //$j(document).ready(conversationLanding.Page_Load);