// image preloader
var imgarr = new Array("images/nav/what_we_do_on.gif",
						"images/nav/brand_on.gif",
						"images/nav/messaging_on.gif",
						"images/nav/our_work_on.gif",
						"images/nav/our_work_on.gif",
						"images/nav/meet_us_on.gif",
						"images/nav/homepg_on.gif",
						"images/nav/technology_on.gif",
						"images/nav/healthcare_on.gif",
						"images/nav/real_estate_on.gif",
						"images/nav/consumer_on.gif",
						"images/nav/b2b_on.gif");
						
var preld_imgs=new Array();

for (i=0; i<imgarr.length; i++) {
	preld_imgs[i] = new Image();
	preld_imgs[i].src = imgarr[i];
}

// keep frames
if (parent.location.href == self.location.href) {
	window.location.href = 'index.php';
}

pagename = "";
subname = "";

function gObj(me) {
	if (document.getElementById) {
		return document.getElementById(me);
	}
}

function gImg(me) {
	if (document.images) {
		return document.images[me];
	}
}

// image swap

function imgOn(aa) {
	gImg(aa).src = "images/nav/" + aa + "_on.gif";
}

function imgOff(bb) {
	gImg(bb).src = ((bb == pagename)&&(window.name == 'ga_visited')) ? "images/nav/" + bb + "_on.gif" : "images/nav/" + bb + "_off.gif";
}

function subImgOn(cc) {
	gImg(cc).src = "images/nav/" + cc + "_on.gif";
}

function subImgOff(dd) {
	gImg(dd).src = (dd == subname) ? "images/nav/" + dd + "_on.gif" : "images/nav/" + dd + "_off.gif";
}


// windowWidth rule fix

isMac = (navigator.appVersion.indexOf('Mac') != -1) ? true : false;
isMoz = ((navigator.userAgent.indexOf('Mozilla') != -1)&&(navigator.userAgent.indexOf('Safari') < 0)) ? true : false;

function getWindowWidth() {
	var windowWidth = 0;
	windowWidth = (typeof(window.innerWidth) == 'number') ? window.innerWidth : ((document.documentElement && document.documentElement.clientWidth) ? document.documentElement.clientWidth : document.body.clientWidth);
	return windowWidth;
}

function setContent() {
	if (isMac && isMoz) {
		var windowWidth = getWindowWidth();
		document.body.style.backgroundPosition = (windowWidth <= 855) ? "top left" : "top center";
	}
}


window.onload = function() {
	setContent();
}

window.onresize = function() {
	setContent();
}

window.onscroll = function() {
	setContent();
}