// Check Browser CSS Compatibility // alert(document.compatMode); // Supress BOM Script Errors function errorsuppressor(){ return true; } if(location.href.indexOf("localhost") == -1) { window.onerror = errorsuppressor; } // 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; } // Prep cookie message on gateway function prepGateway() { if (!document.getElementById("gateway")) return false; var learnmore = document.getElementById("learnmore"); document.getElementById("about").style.display = "none"; learnmore.onclick = function() { toggleElement('about', this) return false; } } addLoadEvent(prepGateway); // 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"; } } // Site Drop-down Nav function GetURLRedirect() { if (!document.getElementById) return false; if (!document.getElementById("ctl00_selectsite")) return false; var dropbox = document.getElementById("ctl00_selectsite"); dropbox.onchange = function() { if(this.options[this.selectedIndex].value != "") { self.location = this.options[this.selectedIndex].value; } } } addLoadEvent(GetURLRedirect); // Set Year in Footer :-) function SetCurrentYear() { if (!document.getElementById) return false; if (!document.getElementById("currentyear")) return false; var clientDate = new Date() var currentYear = clientDate.getFullYear(); document.getElementById("currentyear").innerHTML = currentYear; } addLoadEvent(SetCurrentYear); // Primary Nav (IE 6 only) primarynavhover = function() { if (!document.getElementById) return false; if (!document.getElementById("primarynav")) return false; var listElements = document.getElementById("primarynav").getElementsByTagName("li"); for (var i=0; i < listElements.length; i++) { listElements[i].onmouseover = function() { this.className+=" iehover"; } listElements[i].onmouseout = function() { this.className = this.className.replace(new RegExp(" iehover\\b")); } } } if (window.attachEvent) window.attachEvent("onload", primarynavhover); // Global Pop-up (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() { var featureWindow = window.open(this.href,"win", 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=none,resizable=1,top=300,left=250,width=785,height=500'); featureWindow.focus(); return false; } function displayNewWindow() { var featureWindow = window.open(this.href,"win", 'toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=yes,resizable=1,top=100,left=100,width=800,height=600'); featureWindow.focus(); return false; } // Brings Reset Buttons back to top of page function resetPage() { var inputelemnt = document.getElementsByTagName("input"); for (var i=0; i < inputelemnt.length; i++) { if (inputelemnt[i].getAttribute("type") == "reset") { inputelemnt[i].onclick = function() { window.location = window.top.location; } } } } addLoadEvent(resetPage); // Unobtrusive Print function printDoc() { if (!document.getElementById("minwidth-tertiarynav")) return false; // Add logic here to determine where this should be on a page by page basis if (document.getElementById("gateway")) return false; if (document.getElementById("experienced")) return false; if (document.getElementById("opportunities")) return false; if (document.getElementById("apply")) return false; if (document.getElementById("apply_resume_options")) return false; if (document.getElementById("apply_resume_quicksubmit")) return false; if (document.getElementById("apply_resume_builder")) return false; if (document.getElementById("apply_resume_upload")) return false; if (document.getElementById("csc_general")) return false; if (document.getElementById("studentgrad")) return false; if (document.getElementById("newsletter")) return false; if (document.getElementById("frame_main")) return false; var para = document.createElement("p"); var anchor = document.createElement("a"); var strtxt = document.createTextNode("Print Page"); para.setAttribute("id", "printpage"); para.appendChild(anchor); anchor.appendChild(strtxt); anchor.onclick = function() { print(); dcsMultiTrack("DCS.dcssip", location.hostname,"DCS.dcsuri",location.href + "/PrintPage","WT.ti","PrintPage"); //WebTrends Print Tracking return false; } var lastnode = document.getElementById("minwidth-tertiarynav"); var parentnode = lastnode.parentNode; parentnode.insertBefore(para, lastnode); } addLoadEvent(printDoc); // Deatil Page Print function printDetails() { if (!document.getElementById("getnews")) return false; var para = document.createElement("li"); var anchor = document.createElement("a"); var strtxt = document.createTextNode("Print Page"); para.setAttribute("id", "pageprint"); para.appendChild(anchor); anchor.appendChild(strtxt); anchor.onclick = function() { print(); dcsMultiTrack("DCS.dcssip", location.hostname,"DCS.dcsuri",location.href + "/PrintPageDetail","WT.ti","PrintPageDetail"); //WebTrends Print Tracking return false; } var lastnode = document.getElementById("getnews"); var parentnode = lastnode.parentNode; parentnode.insertBefore(para, lastnode); } addLoadEvent(printDetails); // Printer Friendly URL function printURL() { if (!document.getElementById("breadtrail")) return false; var para = document.createElement("p"); para.setAttribute("id", "printurl"); para.innerHTML = "Page URL: " + location.href + "?GlobalCountryCode=US&GlobalLanguageCode=en&GlobalAudienceCode="; var lastnode = document.getElementById("breadtrail"); var parentnode = lastnode.parentNode; parentnode.insertBefore(para, lastnode); } addLoadEvent(printURL); // Close Window function closeWindow() { if (!document.getElementById("subpage")) return false; var para = document.createElement("p"); var link = document.createElement("a"); var text = document.createTextNode("Close Window"); para.setAttribute("id", "closewindow"); para.appendChild(link); link.appendChild(text); link.onclick = function() { window.close(); return false; } var container = document.getElementById("subpage"); container.appendChild(para); } addLoadEvent(closeWindow); // History Links function pageJump(pageto) { window.history.go(pageto); return false; } // Custom Select Redirects (US Only) function CustomNavSelect1() { window.location = document.aspnetForm.CustomNav1.options[document.aspnetForm.CustomNav1.selectedIndex].value; } function CustomNavSelect2() { window.location = document.aspnetForm.CustomNav2.options[document.aspnetForm.CustomNav2.selectedIndex].value; } function CustomNavSelect3() { window.location = document.aspnetForm.CustomNav3.options[document.aspnetForm.CustomNav3.selectedIndex].value; } // Candidate Enhancements (Going Bye-bye the second the ELOAS issue is cleared up) var flashProxy; function displaySWFContent() { if (!document.getElementById) return false; if (!document.getElementById("objectcontentactive")) return false; var container = document.getElementById("objectcontentactive"); var containerid = container.getAttribute("id"); var body = document.body; var bodyid = body.getAttribute("id"); var bodyclass = body.className; if (!container) return false; if (bodyid == "studentgrad") { var uid = new Date().getTime(); flashProxy = new FlashProxy(uid, "/global/_flash/app_flashgateway.swf"); var filepath = "/global/_flash/studentgrad/mainmovie.swf"; var filewidth = "614"; var fileheight = "300"; var bgcolor = "#ffffff"; var basepath = "/global/_flash/studentgrad"; var csspath = "../../_templates/default/css/app_flash.css"; var xmlpath = "/global/_xml/studentgrad.xml"; var basenode = "/COPY/LOCAL/content/dataset"; var elementid = containerid; //Hack....done because there is no country called "Global" if (bodyclass == "global en global-en global-en-university" || bodyclass == "cn en cn-en cn-en-university" || bodyclass == "cn zh-hans cn-zh-hans cn-zh-hans-university") { var showflash = true; } container.onmouseover = function() { flashProxy.call("mouseOnStage"); } container.onmouseout = function() { flashProxy.call("mouseOffStage"); } } else if (bodyid == "meetus") { var filepath = "/global/_flash/meetus/mainmovie.swf"; var filewidth = "650"; var fileheight = "198"; var bgcolor = "#ffffff"; var basepath = "/global/_flash/meetus"; var csspath = "../../_templates/default/css/app_flash.css"; var xmlpath = "../../_xml/meetus_flash.xml"; var elementid = containerid; //Hack....done because there is no country called "Global" if (bodyclass == "global en global-en global-en-experienced" || bodyclass == "global en global-en global-en-university") { var showflash = true; } } else if (bodyid == "experienced") { var filepath = "/global/_media/video/files/del_global_004_experienced.swf"; var filewidth = "614"; var fileheight = "300"; var bgcolor = "#ffffff"; var videofile = ""; var aspect = "exactfit" var elementid = containerid; //Hack....done because there is no country called "Global" if (bodyclass == "global en global-en global-en-experienced" || bodyclass == "no no no-no no-no-experienced") { var showflash = true; } } var so = new SWFObject(filepath, "app_movie", filewidth, fileheight, "6", bgcolor); so.useExpressInstall('/global/_flash/flash_expressinstall.swf'); so.addParam("menu", "false"); so.addParam("base", basepath); so.addParam("wmode", "opaque"); so.addParam("scale", aspect); so.addParam("allowScriptAccess", "sameDomain"); so.addVariable("lcId",uid); so.addVariable("css_url", csspath); so.addVariable("xmlfilepath", xmlpath); so.addVariable("xmlBaseNode", basenode); so.addVariable("filepath", videofile); so.addVariable("loop", "1"); so.setAttribute("style", ";"); if (showflash == true) { so.write(elementid); } } // DotNet is giving me attribute headaches, so I'll insert them via the DOM function appendToggleAttrib() { if (!document.getElementsByTagName) return false; var bodyid = document.body.getAttribute("id"); if (bodyid == "opportunities" || bodyid == "experienced") { var para = document.getElementsByTagName("p"); for (var i=0; i < para.length; i++) { if (para[i].className == "searchtoggle") { para[i].setAttribute("title", "Help"); } } } } function appendAddThis() { if (!document.getElementById) return false; if (!document.getElementById("addthis")) return false; var list_addthis = document.getElementById("addthis").getElementsByTagName("a")[0]; list_addthis.onmouseover = function() { return addthis_open(this, '', '[URL]', '[TITLE]'); } list_addthis.onmouseout = function() { addthis_close(); } list_addthis.onclick = function() { return addthis_sendto(); return false; } } addLoadEvent(appendAddThis); function addOptionTitle() { // Add title attribute to all select boxes for usability if (!document.getElementsByTagName("select")) return false; var list = document.getElementsByTagName("select"); for(var i = 0; i < list.length; i++) { var option = list[i].getElementsByTagName("option") for(var j = 0; j < option.length; j++) { option[j].setAttribute("title", option[j].text); } } } addLoadEvent(addOptionTitle);