/* 
Title: Main DOM Functions
Author: Michael "Spell" Spellacy, Senior UI Developer
Email: michael.spellacy@tmp.com
Company: TMP Worldwide Advertising and Communications, LLC 
*/

// 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;
}

// 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";
	}
}

function newWinLinks() {

for (var i=0; i<document.links.length; i++) {

	if (document.links[i].className == "viewpage") {
		document.links[i].onclick = displayWindow;
		
		}
	} 
}

function displayWindow() {

	var pageWindow = window.open(this.href,"win", 'toolbar=1,location=0,directories=0,status=0,menubar=1,scrollbars=yes,resizable=1,top=300,left=400,width=425,height=550');
	pageWindow.focus();
	return false;
}

addLoadEvent(newWinLinks);

// Add any future flash based functionality here */