// Just for the Go Paperless page - www.standardlife.co.uk/gopaperless

// This just hides all four IDs. It's not very clever.
function hideAll() {
	document.getElementById('gohome').style.display = 'none';
	document.getElementById('gomanage').style.display = 'none';
	document.getElementById('gogopaperless').style.display = 'none';
	document.getElementById('goregister').style.display = 'none';
}

// This tries to show the element which is passed as an ID
function showPage(pageID) {
	hideAll();
	// ... because I might be lying
	if (document.getElementById(pageID)) {
		// ... show it!
		document.getElementById(pageID).style.display = 'block';
	}
}

// This is a slightly silly select-box navigation, because we can cram more content onto the page this way.
function selectNav() {
	document.write('<p><select id="benefitnav" onchange="showBenefit(this.value);">');
	document.write('<option value="benefitpension">Pension plans</option>');
	document.write('<option value="benefitlife">Life policies</option>');
	document.write('<option value="benefitmortgages" selected="selected">Mortgages</option>');
	document.write('<option value="benefitsavings">Savings accounts</option>');
	document.write('</select></p>');
	// Hiding the headings which are for non-JavaScript users
	document.write('<style type="text/css">.benefithead { display: none };</style>');
}

// This should hide all the benefit divs, then show the one which has it's ID passed as a parameter
function showBenefit(benefitID) {
	hideBenefits();
	document.getElementById(benefitID).style.display = 'block';
}

// This just hides the benefits
function hideBenefits() {
	document.getElementById('benefitpension').style.display = 'none';
	document.getElementById('benefitpension').style.display = 'none';
	document.getElementById('benefitlife').style.display = 'none';
	document.getElementById('benefitmortgages').style.display = 'none';
	document.getElementById('benefitsavings').style.display = 'none';
}


