<!-- // custom for norcal
OnLoad += "initNorCal();";

function initNorCal() {
	if ($('teamContent')) {
		document.body.style.background = '#000 url(/images/css/411/background_red.gif) repeat top left'; 
		$('header').style.backgroundImage = 'url(/images/css/411/header.jpg)';
		
	} else if ($('customContent')) { 
		document.body.style.background = '#000 url(/images/css/411/background_orange.gif) repeat top left';
		$('header').style.backgroundImage = 'url(/images/css/411/header.jpg)';
		
	} else if ($('cart')) {
		document.body.style.background = '#000 url(/images/css/411/background_yellow.gif) repeat top left';
		
	} else if ($('contactContent')) {
		document.body.style.background = '#000 url(/images/css/411/background_green.gif) repeat top left';
		$('header').style.backgroundImage = 'url(/images/css/411/header.jpg)';
		
	} else { document.body.style.background = '#000 url(/images/css/411/background_blue.gif) repeat top left'; }
	
	if ($('homeBackground')) { $('header').style.backgroundImage = 'url(/images/css/411/header.jpg)'; }
	
	
	if ($('sidenav')) {
	
		var sideNavMin = 468;
		var sideNavHeight = parseInt($('sidenav').offsetHeight);
		var sideNavPadding = parseInt(returnComputedProperty($('sidenav'), 'padding-top')) + parseInt(returnComputedProperty($('sidenav'), 'padding-bottom'));
		var sideNavMargin = parseInt(returnComputedProperty($('sidenav'), 'margin-top')) + parseInt(returnComputedProperty($('sidenav'), 'margin-bottom'));
		var sideNavRelativeTop = Math.abs(parseInt(returnComputedProperty($('sidenav'), 'top')));
		
		var OCHeight = parseInt($('outerContent').offsetHeight);
		var ICHeight = parseInt($('innerContent').offsetHeight);
		var ICPadding = parseInt(returnComputedProperty($('innerContent'), 'padding-top')) + parseInt(returnComputedProperty($('innerContent'), 'padding-bottom'));

		// sidenav has to have a minimum height in most cases
		// so set the minimum (removing the padding) and then recalc the height
		if (sideNavHeight < sideNavMin) {
			$('sidenav').style.height = (sideNavMin - sideNavPadding) + 'px';
			sideNavHeight = parseInt($('sidenav').offsetHeight);
		}
		
		// now we can check to see if the content is as high as the nav
		// set the height to the same height minus the padding
		if (ICHeight < sideNavHeight) { $('innerContent').style.height = (sideNavHeight - ICPadding) + 'px'; }
		
		// we need to set a width for the innerContent because IE 6 & 7 really doesn't do well without it
		if (document.all) { $('innerContent').style.width = returnComputedWidth($('innerContent')); }
		
		//if (contentHeight < sideNavHeight) { $('outerContent').style.height = (sideNavHeight - sideNavRelativeTop) + 'px'; }
		if ($('footer')) { $('footer').style.display = 'block'; }
		if ($('copyright')) { $('copyright').style.display = 'block'; }
	}
	
	// this is the init for the custom page
	if ($('customContent')) {
		
		// set next and back buttons
		var divNodes = getElementsByClass('sampleControls', $('customContent'), 'DIV');
		for (var x = 0; x < divNodes.length; x++) {
			var aNodes = divNodes[x].getElementsByTagName('A');
			aNodes[0].onclick = function() { moveSample(this, 'back'); return false; };
			aNodes[1].onclick = function() { moveSample(this, 'next'); return false; };
		}
		
		// set image englarger, heh heh, I said enlarger
		var divNodes = getElementsByClass('sampleBox', $('customContent'), 'DIV');
		for (var x = 0; x < divNodes.length; x++) {
			divNodes[x].childNodes[0].onclick = function() { enlargeSample(this); return false; };
		}
	}
}

function moveSample(obj, type) {

	// get the img for this object
	var imgBox = obj.parentNode.previousSibling;
	while (imgBox.className != "sampleBox") { imgBox = imgBox.previousSibling; }
	
	// setup vars
	var imgObj = imgBox.childNodes[0].childNodes[0];
	var currentSrc = imgObj.src;
	var matches = currentSrc.match(/(\w+)\/(\d)\.jpg$/i);
	if (type == 'next') { var newImg = parseInt(matches[2]) + 1; } else { var newImg = parseInt(matches[2]) - 1; } // increase or decrease the number
	
	// make sure number is withing boundaries
	if (matches[1] == "embrod") { if (newImg == 0) { newImg = 7; } else if (newImg == 8) { newImg = 1; } }
	else if (matches[1] == "screen") { if (newImg == 0) { newImg = 5; } else if (newImg == 6) { newImg = 1; } }
	else if (matches[1] == "rhine") { if (newImg == 0) { newImg = 3; } else if (newImg == 4) { newImg = 1; } }
	
	
	imgObj.src = "/images/custom/norcal/samples/" + matches[1] + "/" + newImg + ".jpg";
	return true;
}

function enlargeSample(obj) {
	
	var matches = obj.childNodes[0].src.match(/(\w+)\/(\d)\.jpg$/i);
	var url = "/images/custom/norcal/samples/large/" + matches[1] + "_" + matches[2] + ".jpg";
	
	var imgwin = window.open(url, "imgwin", "location=no,toolbar=no,status=no,scrollbars=yes,resizable=yes,width=386,height=400");
	imgwin.opener = window;
	if (imgwin.blur) imgwin.focus();
}
//-->
