//////////////////////////////////////////////////////////////////////////
// main navigation
//////////////////////////////////////////////////////////////////////////

var navOff = new Array();
var navOver = new Array();
var navSelected = new Array();

if (document.images) {
    var navList = new Array(
        'home',
        'why_plaid',
        'meet_the_staff',
        'portfolio',
        'blog',
		'contact_us'
    );
    for (var i=0; i<navList.length; i++) {
        navOff[navList[i]] = new Image();
        navOff[navList[i]].src = "http://thegreatestagency.thinkplaid.com//images/nav/"+navList[i]+"_off.jpg";
        navOver[navList[i]] = new Image();
        navOver[navList[i]].src = "http://thegreatestagency.thinkplaid.com//images/nav/"+navList[i]+"_over.jpg";
        navSelected[navList[i]] = new Image();
        navSelected[navList[i]].src = "http://thegreatestagency.thinkplaid.com/images/nav/"+navList[i]+"_selected.jpg";
    }
}

//////////////////////////////////////////////////////////////////////////

function imgOff(imgName) {
    if (imgName && imgName.length && document.images) {
		if (imgName != curPage) {
			document[imgName].src = navOff[imgName].src;
		}
    }
}

function imgOver(imgName) {
    if (imgName && imgName.length && document.images) {
		if (imgName != curPage) {
	        document[imgName].src = navOver[imgName].src;
		}
	}
}

function imgSelected(imgName) {
	if (imgName && imgName.length && document.images) {
		document[imgName].src = navSelected[imgName].src;
	}
}

//////////////////////////////////////////////////////////////////////////
// staff
//////////////////////////////////////////////////////////////////////////

var staffOff = new Array();
var staffOver = new Array();

if (document.images) {
    var staffList = new Array(
        'darryl',
        'david',
		'ausra',
		'justus',
		'bill',
		'leigh',
		'paul',
		'chrisd',
		'chris',
		'eliza',
		'matt',
		'sara',
		'rj',
		'steph'
	);

	for (var i=0; i<staffList.length; i++) {
        staffOff[staffList[i]] = new Image();
        staffOff[staffList[i]].src = "http://thegreatestagency.thinkplaid.com/images/staff-heads/"+staffList[i]+"-off2.jpg";
        staffOver[staffList[i]] = new Image();
       	staffOver[staffList[i]].src = "http://thegreatestagency.thinkplaid.com/images/staff-heads/"+staffList[i]+"-over2.jpg";
    }
}

//////////////////////////////////////////////////////////////////////////

function staffImgOff(imgName) {
    if (imgName && imgName.length && document.images) {
		document[imgName].src = staffOff[imgName].src;
    }
}

function staffImgOver(imgName) {
    if (imgName && imgName.length && document.images) {
        document[imgName].src = staffOver[imgName].src;
	}
}

function showBox(container,x,y){
	curContainer = container;
	var contentCoords = getElementPosition('contentWrapperWide');

	Xcoord = contentCoords.left + x;
	Ycoord = contentCoords.top + y;
	Xcoord += "px";
	Ycoord += "px";

	document.getElementById(container).style.left = Xcoord;
	document.getElementById(container).style.top = Ycoord;

	document.getElementById('overlay').style.display = 'block';
	document.getElementById(container).style.display = 'block';
	
	return false;
}

function hideBox(container){
	document.getElementById('overlay').style.display = 'none';
	document.getElementById(container).style.display = 'none';
	return false;
}

function getElementPosition(elemID) {
    var offsetTrail = document.getElementById(elemID);
    var offsetLeft = 0;
    var offsetTop = 0;
    while (offsetTrail) {
        offsetLeft += offsetTrail.offsetLeft;
        offsetTop += offsetTrail.offsetTop;
        offsetTrail = offsetTrail.offsetParent;
    }
    if (navigator.userAgent.indexOf("Mac") != -1 && 
        typeof document.body.leftMargin != "undefined") {
        offsetLeft += document.body.leftMargin;
        offsetTop += document.body.topMargin;
    }
    return {left:offsetLeft, top:offsetTop};
}


//////////////////////////////////////////////////////////////////////////
// homepage rollovers
//////////////////////////////////////////////////////////////////////////

var homepageOff = new Array();
var homepageOver = new Array();

if (document.images) {
    var homepageList = new Array(
        'bffb-sxsw','bffbholiday','facebook','facebookWP','flickr','flickrWP','freePPT','pntourblog','whyplaid_bullets','twitter','twitterWP','vimeo','vimeoWP'
	);

	for (var i=0; i<homepageList.length; i++) {
        homepageOff[homepageList[i]] = new Image();
        homepageOff[homepageList[i]].src = "http://thegreatestagency.thinkplaid.com/images/rollovers/"+homepageList[i]+"-off.png";
        homepageOver[homepageList[i]] = new Image();
       	homepageOver[homepageList[i]].src = "http://thegreatestagency.thinkplaid.com/images/rollovers/"+homepageList[i]+"-on.png";
    }
}

//////////////////////////////////////////////////////////////////////////

function homepageImgOff(imgName) {
    if (imgName && imgName.length && document.images) {
		document[imgName].src = homepageOff[imgName].src;
    }
}

function homepageImgOver(imgName) {
    if (imgName && imgName.length && document.images) {
        document[imgName].src = homepageOver[imgName].src;
	}
}


//////////////////////////////////////////////////////////////////////////
// Portfolio rollovers
//////////////////////////////////////////////////////////////////////////

var portfolioOff = new Array();
var portfolioOver = new Array();

if (document.images) {
    var portfolioList = new Array(
        'janetJackson','segwaySocial','emiFacebook','meTime','txWatches','riuniteSocial','g2g','umphreysMcgee','segwayPuma');

	for (var i=0; i<portfolioList.length; i++) {
        portfolioOff[portfolioList[i]] = new Image();
        portfolioOff[portfolioList[i]].src = "http://thegreatestagency.thinkplaid.com/images/rollovers/"+portfolioList[i]+"-off.jpg";
        portfolioOver[portfolioList[i]] = new Image();
       	portfolioOver[portfolioList[i]].src = "http://thegreatestagency.thinkplaid.com/images/rollovers/"+portfolioList[i]+"-on.jpg";
    }
}

//////////////////////////////////////////////////////////////////////////

function portfolioImgOff(imgName) {
    if (imgName && imgName.length && document.images) {
		document[imgName].src = portfolioOff[imgName].src;
    }
}

function portfolioImgOver(imgName) {
    if (imgName && imgName.length && document.images) {
        document[imgName].src = portfolioOver[imgName].src;
	}
}







