/*---------------------------
main.js

Artemis Branding
1.250.595.0136
admin@artemisbranding.com
----------------------------*/
$(document).ready(function() {
	// Vars
	var aPhotos = new Array();
	var nItem;
	var nBgX;
	var sSection;
	// Get module name
	var jModule = $.url.param("module");
	if (jModule == null) {
		jModule = 'home';
	}
	var aSections = new Array (	'who-we-are', 'mmc-staff', 'news', 'events', 'mmc-board-of-directors', 'reports', 
								'what-we-do', 'referrals', 'victim-services', 'counselling', 'prevention', 
								'what-abuse-is', 'signs-of-sexual-abuse', 'when-a-child-discloses-sexual-abuse', 'resources', 
								'contact', 'request-information', 'reporting-child-abuse' );
	$.each(aSections, function(i, val) {
		if (jModule == val) {
			nItem = i;
		}
    });
	if (nItem >= 0 && nItem <= 5) {
		sSection = 'who-we-are';
		nBgX = -105;
	} else if (nItem >= 6 && nItem <= 10) {
		sSection = 'what-we-do';
		nBgX = -210;
	} else if (nItem >= 11 && nItem <= 14) {
		sSection = 'what-abuse-is';
		nBgX = -315;
	} else if (nItem >= 15 && nItem <= 17) {
		sSection = 'contact';
		nBgX = -420;
	} else {
		sSection = 'home';
		nBgX = 0;
	}
	// Set background image
	if (jModule == 'home') {
		$('#container').css({ 'background' : 'transparent url("/images/home.jpg") 35px 160px no-repeat' });
	} else {
		$('#container').css({ 'background' : 'transparent url("/images/' + sSection + '.jpg") 530px 240px no-repeat' });
	}
	// Preload Images
	var aPhotosStr = new Array('who-we-are', 'what-we-do', 'what-abuse-is', 'conatact');
	$.each(aPhotosStr, function(i, val) {
		aPhotos[i] = new Image();
		aPhotos[i].src = '/images/photos/' + val + '.jpg';
    });
	$.preloadCssImages();
	// Highlight menu items
	$('#menu .item-' + sSection + ' a').css({ 'background' : 'transparent url("/images/menu-over.png") ' + nBgX + 'px 0 no-repeat' });
	$('#side-nav .item-' + jModule + ' a').css({ 'color': '#663366' });
	$('#bottom-nav .item-' + jModule + ' a').css({ 'color': '#4db1e2' });
});
