/* Deloitte Careers - Global Functions Author: Michael Spellacy for TMP Worldwide Advertising and Communications, LLC */ // Supress BOM Script Errors function errorsuppressor(){ return true; } if(location.href.indexOf("localhost") == -1) { window.onerror = errorsuppressor; } /* ====== jQuery functions ====== */ if($.cookie("DCAREERS_TXT")) { // For Text Resizing $("#content").addClass($.cookie("DCAREERS_TXT")); } $(function() { /* ====== Text Resize ====== */ // Get saved text size if($.cookie("DCAREERS_TXT")) { $("#content").addClass($.cookie("DCAREERS_TXT")); $("body").addClass($.cookie("DCAREERS_TXT")); } // Dynamically insert text resize button $("#t4").after('
  • Change Text Size
  • '); // Set new text size resizeme = function(textSize) { var newSize = textSize; // We need to make sure we can movie the size to next in line depending on what cookie value is set var currentSize = $("#content").attr("class"); if (currentSize == "medium") { newSize = "large"; } else if (currentSize == "large") { newSize = "small"; } else if (currentSize == "small") { newSize = "medium"; } $("#content").removeClass().addClass(newSize); $("body").removeClass(currentSize).addClass(newSize); $.cookie("DCAREERS_TXT",newSize, { path: "/", expires: 10000 }); return false; }; // Toggle through each side $("#text-size a").toggle ( function() { resizeme("medium"); }, function() { resizeme("large"); }, function() { resizeme("small"); } ); if (document.getElementById("gateway")) { // Begin: If is gateway page /* ====== "Learn more" link on gateway page ====== */ $("#about").append(''); var aboutbox = $("#about").height() + 5; $("#save a").click(function() { $("#about").appendTo("body"); $("#about").toggle().css({ top: $(this).offset().top - aboutbox, left: $(this).offset().left - 30 }); return false; }); $("#about a.close").click(function() { $(this).parent().hide(); return false; }); } else { if (!$("body#session_error").length) //Exit if (!$("body.antisocial").length) // Exit // Facebook Like Button if ($("body.site-careers").length) { // RULE: Careers Template Social - Only show social buttons on careers site $("#aspnetForm").prepend("
    "); // Add necessary div for FB to sniff for if ($(".pagecallout").length) { $(".pagecallout").before(""); } $("#secondarycontent").append(""); // Create like button and append to secondarycontent $("#ctl00_tertiarynav").prepend(""); // Create like button and prepend to tertiarynav var shortTitle = $("#metatitle").attr("content").substring(0, 100); // Grab title from og:title meta, shorten to 100 characters (so it can be retweeted) var tweetbtn = "Tweet"; $("#secondarycontent").append(tweetbtn); $("#ctl00_tertiarynav").prepend(tweetbtn); if ($(".pagecallout").length) { $("#like-button-heading").after(tweetbtn + "

    "); } window.fbAsyncInit = function() { FB.init({appId: "134262293278270", status: true, cookie: true, xfbml: true}); // Deloitte Careers under Hugo Plasternaff }; (function() { var e = document.createElement("script"); e.async = true; e.src = document.location.protocol + "//connect.facebook.net/en_US/all.js"; document.getElementById("fb-root").appendChild(e); }() ); } // End: Careers Template Social /* ====== Widgets ====== */ // HACK: Hijacking YouTubes UI a bit because it's C-R-A-Z-Y resetYouTubeVideo = function() { if (document.getElementById("videobar")) { $("#videobar").scrollTop(0); // $(".resultDiv_gsvb").removeAttr("title"); $(".playing_gsvb").removeAttr("style").removeClass("playing_gsvb").addClass("idle_gsvb"); $(".player_gsvb").remove(); } } /* ====== Social Buttons (Hide/Show) ====== */ // Can't set top position of widget in CSS because amount of widget li's is dynamic so we have to force it in JS instead - what a pain var iconHeight = $("#social-network li > a").height(); $("#social-network li").each(function() { $(this).children(".widget").css("top", "-" + iconHeight * ($(this).index() + 1) + "px"); // Height of tag multiplied by number in list }); $("#social-network ul li a.button").click(function() { $("#settings-toolbar").fadeOut("fast"); $(this).next().animate({"right" : "50px"}, "medium"); // and show only this widget $("#social-network").animate({"right" : "-50px"}, "fast"); return false; }); // Close Button $(".widget").append('

    Close

    '); $(".widget p.close a").click(function () { resetYouTubeVideo(); $(this).parent().parent().animate({"right":"-285px"}); $("#social-network").animate({"right":"0"}); return false; }); $("#settings-toolbar").append('

    Close

    '); $("#change-location > a").click(function() { resetYouTubeVideo(); $(".widget").animate({"right":"-285px"}); $("#social-network").animate({"right":"0"}); $("#settings-toolbar").fadeIn("fast"); return false; }); $("#settings-toolbar p.close a").click(function(){ $(this).parent().parent().fadeOut("fast"); return false; }); }; // End: If is gateway page }); // Multiple Onload Utility function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { oldonload(); func(); } } } // Insert-after Function function insertAfter(newElement, targetElement) { var parent = targetElement.parentNode; if (parent.lastChild == targetElement) { parent.appendChild(newElement); } else { parent.insertBefore(newElement, targetElement.nextSibling); } } // Frame Buster if (window.name == 'careersdeloitte_frameMain') { window.top.location.href = window.location.href; } // Back to top function scrollToTop() { scroll(0, 0); } // Prep link and toggle displays function prepElements(page, parent, child) { if (!document.getElementById(page)) return false; var linkid = document.getElementById(parent); document.getElementById(child).style.display = "none"; linkid.onclick = function() { toggleElement(child, this); return false; } } // Prep transcript in medialibrary function prepMediaLibrary() { prepElements("ctl00_primarycontent_accessibility", "ctl00_primarycontent_accessibility", "ctl00_primarycontent_transcriptcontent"); } addLoadEvent(prepMediaLibrary); // Check for children tables in datagrids function prepMultipleGrids() { var get_grid = document.getElementsByTagName("table"); for (var i=0; i < get_grid.length; i++) { if (get_grid[i].className == "datagridchild") { get_grid[i].style.display = "none" } } } // Toggle, Show/Hide Element(s) function toggleElement(val, obj){ if(document.getElementById(val).style.display == "none") { obj.className = "expandon"; document.getElementById(val).style.display = "block"; } else { obj.className = "expand"; document.getElementById(val).style.display = "none"; } } // Global New-windows (parse through DOM, if viewpage class exists, append event) function newWinLinks() { for (var i=0; i < document.links.length; i++) { if (document.links[i].className == "viewpage") { document.links[i].onclick = displayPage; } if (document.links[i].className == "viewmedia") { document.links[i].onclick = displayMedia; } if (document.links[i].className == "viewfeature") { document.links[i].onclick = displayFeature; } if (document.links[i].className == "newwindow") { document.links[i].onclick = displayNewWindow; } } } addLoadEvent(newWinLinks); function displayPage() { var pageWindow = window.open(this.href,"win", 'toolbar=1,location=0,directories=0,status=0,menubar=1,scrollbars=yes,resizable=1,top=100,left=200,width=820,height=500'); pageWindow.focus(); return false; } function displayMedia() { var mediaWindow = window.open(this.href,"win", 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=none,resizable=1,top=300,left=475,width=363,height=180'); mediaWindow.focus(); return false; } function displayFeature() { modalWindow.windowId = "viewfitfactor"; modalWindow.width = 785; modalWindow.height = 499; modalWindow.content = "