function showHideNav(navSection) {
	var tmpNavSection = 'navLinks' + navSection;

	if(document.getElementById(tmpNavSection).style.display == 'none') {
		document.getElementById(tmpNavSection).style.display = 'block';
	} else {
		document.getElementById(tmpNavSection).style.display = 'none';
	}
}

function joinPayPalFields(formname) {
	var numoptions = 0;
	var productstripped = formname.replace('Form','');
	
	document.forms[formname].elements['os0'].value = "";
	document.forms[formname].elements['os1'].value = "";
	
	for(var i=1; i<20; i++) {
		if(document.getElementById(productstripped + 'option' + i + 'value') == undefined) {
			numoptions = i-1;
			break;
		}
	}
	
	if(numoptions>1) {
		var halfoptions = parseInt(numoptions / 2);
	} else {
		var halfoptions = 1;
	}
	
	for(var i=1; i<=numoptions; i++) {
		var optiontype = document.forms[formname].elements[productstripped + 'option' + i + 'value'].type;
		var optionname = document.forms[formname].elements[productstripped + 'option' + i + 'name'].value;
		var optionvalue = "";
		
		switch(optiontype) {
			case "select-one":
				optionvalue = document.forms[formname].elements[productstripped + 'option' + i + 'value'].options[document.forms[formname].elements[productstripped + 'option' + i + 'value'].selectedIndex].value;
				break;
			case "text":
				optionvalue = document.forms[formname].elements[productstripped + 'option' + i + 'value'].value;
				break;
		}
		
		if(i <= halfoptions) {
			if(document.forms[formname].elements['os0'].value != "") {
				document.forms[formname].elements['os0'].value += ", ";
			}
			document.forms[formname].elements['os0'].value += optionname + ': ' + optionvalue;
		} else {
			if(document.forms[formname].elements['os1'].value != "") {
				document.forms[formname].elements['os1'].value += ", ";
			}
			document.forms[formname].elements['os1'].value += optionname + ': ' + optionvalue;
		}
	}
	
	return true;
}

function addfriend() {
	var test=document.createElement("div");
	test.style.clear = "both";
	test.innerHTML += "<div style='float: left; width: 30%; text-align: center;'><input type='text' name='friendname[]' /></div>";
	test.innerHTML += "<div style='float: left; width: 30%; text-align: center;'><input type='text' name='friendemail[]' /></div>";
	document.getElementById('friendlist').appendChild(test);
}