function submitfriendform() {
	var thereiserror = "Y" ;
	var passed_validation = "Y" ;
	var validationmsg = '' ;
	if (document.forms.friendform.elements['actual_code']) {
		if (document.forms.friendform.elements['actual_code'].value != document.forms.friendform.elements['typed_code'].value) {
			passed_validation = "N" ;
			validationmsg = ", also please complete the validation code." ;
		}
	} else {
		passed_validation = "Y"
	}
	var thereiserror = "Y" ;
	var alertmsg = '' ;
	if (emailcheck(document.forms.friendform.friend_email.value) == false) {
		alertmsg = "Your friend's E-mail address is invalid.\n" ;
	} 
	if (emailcheck(document.forms.friendform.friend_sender_email.value) == false) {
		alertmsg = alertmsg + "Your own E-mail address is invalid.\n" ;
	}
	if (passed_validation == 'N') {
		alertmsg = alertmsg + "Please check the validation code.\n" ;
	}
	if (alertmsg != '') {
		alert(alertmsg) ;
	} else {
		// Submit the form
		document.forms.friendform.toldafriend.value = 'Y' ;	// Tell page that is returning from this script
		document.forms.friendform.submit() ;
	}
}

function submitquestionform() {
	var thereiserror = "Y" ;
	var passed_validation = "Y" ;
	var validationmsg = '' ;
	if (document.forms.questionform.elements['actual_code']) {
		if (document.forms.questionform.elements['actual_code'].value != document.forms.questionform.elements['typed_code'].value) {
			passed_validation = "N" ;
			validationmsg = ", also please complete the validation code." ;
		}
	} else {
		passed_validation = "Y"
	}
	var thereiserror = "Y" ;
	var alertmsg = '' ;
	if (emailcheck(document.forms.questionform.question_sender_email.value) == false) {
		alertmsg = alertmsg + "Your own E-mail address is invalid.\n" ;
	}
	if (passed_validation == 'N') {
		alertmsg = alertmsg + "Please check the validation code.\n" ;
	}
	if (alertmsg != '') {
		alert(alertmsg) ;
	} else {
		// Submit the form
		document.forms.questionform.askedaquestion.value = 'Y' ;	// Tell page that is returning from this script
		document.forms.questionform.submit() ;
	}
}

function submitpricematchform() {
	var thereiserror = "Y" ;
	var passed_validation = "Y" ;
	var validationmsg = '' ;
	if (document.forms.pricematchform.elements['actual_code']) {
		if (document.forms.pricematchform.elements['actual_code'].value != document.forms.pricematchform.elements['typed_code'].value) {
			passed_validation = "N" ;
			validationmsg = ", also please complete the validation code." ;
		}
	} else {
		passed_validation = "Y"
	}
	var thereiserror = "Y" ;
	var alertmsg = '' ;
	if (emailcheck(document.forms.pricematchform.pricematch_sender_email.value) == false) {
		alertmsg = alertmsg + "Your E-mail address is invalid.\n" ;
	}
	if (passed_validation == 'N') {
		alertmsg = alertmsg + "Please check the validation code.\n" ;
	}
	if (alertmsg != '') {
		alert(alertmsg) ;
	} else {
		// Submit the form
		document.forms.pricematchform.askpricematch.value = 'Y' ;	// Tell page that is returning from this script
		document.forms.pricematchform.submit() ;
	}
}

function submitpage(indexKey) {
	//alert(document.forms.viewproduct.nameoffeature.options[document.forms.viewproduct.nameoffeature.selectedIndex].value);
	//alert("THIS:" + document.forms.viewproduct.nameoffeature.value)
	document.forms.viewproduct.action = 'view-product.php?index=' + indexKey ;
	document.forms.viewproduct.submit() ;
}

function viewquestions() {
       	document.getElementById('viewquestions').style.display = 'none';
       	document.getElementById('hidequestions').style.display = 'inline';
	document.getElementById('questions').style.display = 'inline';
}

function viewanswer(questionno) {
       	document.getElementById('question' + questionno).style.display = 'inline';
}

function hidequestions() {
       	document.getElementById('viewquestions').style.display = 'inline';
       	document.getElementById('hidequestions').style.display = 'none';
	document.getElementById('questions').style.display = 'none';
}

