<?php
	header("Content-type: text/javascript");


?>



	//form validation
	function validateName(fld) {
		"use strict";
		var error = "";
				
		if (fld.value === '' || fld.value === 'Nickname' || fld.value === 'Enter Your Name..' || fld.value === 'Your Name..') {
			error = "<?php esc_html_e("You did not enter your first name.",'gadgetine-theme');?>";
		} else if ((fld.value.length < 2) || (fld.value.length > 200)) {
			error = "<?php printf ( esc_html__('First name is the wrong length.','gadgetine-theme'));?>";
		}
		return error;
	}
			
	function validateEmail(fld) {
		"use strict";
		var error="";
		var illegalChars = /^[^@]+@[^@.]+\.[^@]*\w\w$/;
				
		if (fld.value === "") {
			error = "<?php printf ( esc_html__("You did not enter an email address.",'gadgetine-theme'));?>";
		} else if ( fld.value.match(illegalChars) === null) {
			error = "<?php printf ( esc_html__('The email address contains illegal characters.','gadgetine-theme'));?>";
		}

		return error;

	}
			
	function valName(text) {
		"use strict";
		var error = "";
				
		if (text === '' || text === 'Nickname' || text === 'Enter Your Name..' || text === 'Your Name..') {
			error = "<?php printf ( esc_html__("You did not enter Your First Name.",'gadgetine-theme'));?>";
		} else if ((text.length < 2) || (text.length > 50)) {
			error = "<?php printf ( esc_html__('First Name is the wrong length.','gadgetine-theme'));?>";
		}
		return error;
	}
			
	function valEmail(text) {
		"use strict";
		var error="";
		var illegalChars = /^[^@]+@[^@.]+\.[^@]*\w\w$/;
				
		if (text === "") {
			error = "<?php printf ( esc_html__("You did not enter an email address.",'gadgetine-theme'));?>";
		} else if ( text.match(illegalChars) === null) {
			error = "<?php printf ( esc_html__('The email address contains illegal characters.','gadgetine-theme'));?>";
		}

		return error;

	}
			
	function validateMessage(fld) {
		"use strict";
		var error = "";
				
		if (fld.value === '') {
			error = "<?php printf ( esc_html__("You did not enter Your message.",'gadgetine-theme'));?>";
		} else if (fld.value.length < 3) {
			error = "<?php printf ( esc_html__('The message is to short.','gadgetine-theme'));?>";
		}

		return error;
	}		

	function validatecheckbox() {
		"use strict";
		var error = "<?php esc_html_e('Please select at least one checkbox!','gadgetine-theme');?>";
		return error;
	}

