// ## designNissanNav.js
// 	Controls the dynamic functionality, HTML, and default instructional copy associated with the "Design Your Nissan" model types on the left-hand side of the page.

// FUNCTION LIST:
// 	buildLayer(trim, text);
//	setResetLayout();
// 	resetLayer();
// 	initDesignNav();


// TEMPLATE(S) USED:
// 	gallery.html
// 	performance.html
// 	specs.html

var buildLayerTimeout;
var isOkToReset = true;

// Builds the information layer beneath the menu.
function buildLayer(trim, text) {
//	if (buildLayerTimeout) clearTimeout(buildLayerTimeout);
	var layerText =  '<table border="0" cellpadding="0" cellspacing="0" width="237">';
	layerText += '<tr><td width="232" class="EmphasisText"><b>' + trim + '</b></td>';
	layerText += '<td width="5" nowrap="nowrap"></td></tr>';
	layerText += '<tr><td height="6"></td></tr>';
	layerText += '<tr><td class="EmphasisText">' + text + '</td>';
	layerText += '<td></td></tr>';
	layerText += '</table>&nbsp;';
	
	trimInfo.write(layerText);
	trimInfo.show();
	isOkToReset = false;
}

function setResetTimeout() {
	isOkToReset = true;
	if (is.mac)	buildLayerTimeout = setTimeout('resetLayer()',4000)
	else buildLayerTimeout = setTimeout('resetLayer()',400)
}

// Resets the layer to the default instructional copy.
function resetLayer() {
	var layerText = "";
	
	if (isOkToReset) {
		layerText = '<table border="0" cellpadding="0" cellspacing="0" width="237">';
		layerText += '<tr><td width="232" class="EmphasisText">'
		layerText += ''
		layerText += '</td></tr></table>&nbsp;'

		trimInfo.write(layerText);
		trimInfo.show();
	}
}

// Initializes the layer to the default instructional copy.
function initDesignNav() {
	resetLayer();
}
