function fToggleSections(sectionNo) {
	for (i = 1; i <= sections; i++) {
		if (i != sectionNo) {
			document.getElementById("section" + i).style.display = "none";
		} else {
			document.getElementById("section" + i).style.display = "block";
		};
	};
	
};

function legalPopup() {
    window.open('legalInfo.html', 'legal', 'width=330, height=190, scrollbars=0, resizable=0, toolbar=0');
	return false;
};

function fAskForReset () {
	var confirm = window.confirm("Are you sure you want to clear the fields?" + "\n" +
								 "Click OK if yes, or CANCEL if you don't want to clear them");
	if (confirm) {
		return true;
	} else {
		return false;
	}
};

function fCheckForm () {
	var myForm = document.emailform;
	
	var validForm = false;
	
	var validName = false;
	var validEmail = false;
	var validMsg = false;
	
	if ((myForm.name.value) && (myForm.name.value != "your name here")) {
		validName = true;
	} else {
		alert("Please provide your name.");
		myForm.name.focus();
		return false;
	}
	
	if (myForm.company.value == "your company name") {
		myForm.company.value = "";
	}
	
/* email checking function */
	var emailAddress = new String(myForm.email.value);
	var atIndex = emailAddress.indexOf("@");
	var dotIndex = emailAddress.indexOf(".", atIndex);

	if ((atIndex > 0) && (dotIndex > atIndex+1) && (emailAddress.length > dotIndex+1)) {
		validEmail = true;
	} else {
		alert("Please provide a valid e-mail address.");
		myForm.email.focus();
		return false;
	}
/* email checkeing finished */
	
	if (myForm.subject.value == "e-mail subject") {
		myForm.subject.value = "";
	}
	
	if ((myForm.msg.value) && (myForm.msg.value != "your message here")) {
		validMsg = true;
	} else {
		alert("Please fill in the messege field.");
		myForm.msg.focus();
		return false;
	}
	
	if ((validName) && (validEmail) && (validMsg)) {
		return true;
	} else {
		alert("Some data missing");
		return false;
	}
};