visibleLayer = '';

function presetContent() {
	var presetSample = '';
	var query = window.location.search.substring(1);
	var vars = query.split("&");
	for (var i=0;i<vars.length;i++) {
    	var pair = vars[i].split("=");
    	if (pair[0] == 'project') { presetSample = pair[1]; }
	} 
	if (presetSample != '') { 
		showSample('sample_'+presetSample); 
//	} else {
//		showSample('sample_01'); 
	}
}

function showSample(whichLayer) {
	displayType = 'block';
	if (visibleLayer != '') {
		toggleSample(visibleLayer,'none')
	} else {
		toggleSample('sample_01','none')
	}
	toggleSample(whichLayer,'block')
	visibleLayer = whichLayer;

	navName = 'projectsNav';
	if (document.getElementById) {
		// this is the way the standards work
		var styleNav = document.getElementById(navName).style;
	}
	else if (document.all) {
		// this is the way old msie versions work
		var styleNav = document.all[navName].style;
	}
	else if (document.layers) {
		// this is the way nn4 works
		var styleNav = document.layers[navName].style;
	}
	styleNav.display = 'block';
}

function toggleSample(whichLayer,displayType) {
	if (document.getElementById) {
		// this is the way the standards work
		var styleSample = document.getElementById(whichLayer).style;
		var styleLink = document.getElementById(whichLayer+'_link').style;
	}
	else if (document.all) {
		// this is the way old msie versions work
		var styleSample = document.all[whichLayer].style;
		var styleLink = document.all[whichLayer+'_link'].style;
	}
	else if (document.layers) {
		// this is the way nn4 works
		var styleSample = document.layers[whichLayer].style;
		var styleLink = document.layers[whichLayer+'_link'].style;
	}
	// displayType needs to be 'none' (not visible) or 'block' (visible)
	if (displayType != 'block') {
		// Assume the layers should be hidden
		displayType = 'none';
		styleLink.color = '#666666'; 
	} 
	else {
		styleLink.color = 'red'; 
	}
	styleSample.display = displayType;
}

function showPortfolio(whichLayer) {
	displayType = 'block';
	if (visibleLayer != '') {
		togglePortfolio(visibleLayer,'none')
	}
	togglePortfolio(whichLayer,'block')
	visibleLayer = whichLayer;
}

function togglePortfolio(whichLayer,displayType) {
	if (document.getElementById) {
		// this is the way the standards work
		var styleImage = document.getElementById(whichLayer+'_label').style;
		var styleConnector = document.getElementById(whichLayer+'_connector').style;
		var styleDescription = document.getElementById(whichLayer+'_description').style;
		var styleIntro = document.getElementById('introduction').style;
	}
	else if (document.all) {
		// this is the way old msie versions work
		var styleImage = document.all[whichLayer+'_label'].style;
		var styleConnector = document.all[whichLayer+'_connector'].style;
		var styleDescription = document.all[whichLayer+'_description'].style;
		var styleIntro = document.all['introduction'].style;
	}
	else if (document.layers) {
		// this is the way nn4 works
		var styleImage = document.layers[whichLayer+'_label'].style;
		var styleConnector = document.layers[whichLayer+'_connector'].style;
		var styleDescription = document.layers[whichLayer+'_description'].style;
		var styleIntro = document.layers['introduction'].style;
	}
	// displayType needs to be 'none' (not visible) or 'block' (visible)
	if (displayType != 'block') {
		// Assume the layers should be hidden
		displayType = 'none';
	}
	styleImage.display = displayType;
	styleConnector.display = displayType;
	styleDescription.display = displayType;
	styleIntro.display = 'none';
}

function toggleLayer(whichLayer) {
	if (document.getElementById) {
		// this is the way the standards work
		var styleImage = document.getElementById(whichLayer+'_label').style;
		var styleConnector = document.getElementById(whichLayer+'_connector').style;
		var styleDescription = document.getElementById(whichLayer+'_description').style;
		styleImage.display = styleImage.display? "":"block";
		styleConnector.display = styleConnector.display? "":"block";
		styleDescription.display = styleDescription.display? "":"block";
	}
	else if (document.all) {
		// this is the way old msie versions work
		var styleImage = document.all[whichLayer+'_label'].style;
		var styleConnector = document.all[whichLayer+'_connector'].style;
		var styleDescription = document.all[whichLayer+'_description'].style;
		styleImage.display = styleImage.display? "":"block";
		styleConnector.display = styleConnector.display? "":"block";
		styleDescription.display = styleDescription.display? "":"block";
	}
	else if (document.layers) {
		// this is the way nn4 works
		var styleImage = document.layers[whichLayer+'_label'].style;
		var styleConnector = document.layers[whichLayer+'_connector'].style;
		var styleDescription = document.layers[whichLayer+'_description'].style;
		styleImage.display = styleImage.display? "":"block";
		styleConnector.display = styleConnector.display? "":"block";
		styleDescription.display = styleDescription.display? "":"block";
	}
}

