

	//CHECK IF EMAIL VALUE EXIST BEFORE SUBMITTING
	function CheckFeedback(){

		if (feedback.Email.value == ""){
			return CheckFB();
		}else{
			return CheckEmail();
		}
	}

	//IF USER CONFIRM EMAIL ADDRESS GO TO THE EMAIL ADDRESS FIELD OTHERWISE SUBMIT THE FORM
	function CheckFB() {
		if ( confirm( fbEmail() ) ){
			feedback.submit();
		}else{
			feedback.Email.focus();
		}
	return false;
	}


	//GRAB FROM THE ADDRESS BAR THE CURRENT LANG FOR THE PAGE
	function QS(wQuery){

		getQS = location.search.substring(1);
		getQS = getQS.split( "&" );

		for (i=0; i<getQS.length; i++){
			if ( wQuery == getQS[i].split("=")[0] ){
				 return ( getQS[i].split("=")[1] );
			}
		}
	}


	//BASED ON THE CURRENT LANG, DISPLAY THE CONFIRMATION MESSAGE
	function fbEmail(){
		switch (QS("plang")){
			case "es":
				return( 'Aunque no es indispensable, nos ayudaría mucho que usted incluyera su dirección de correo electrónico para poder responderle\n\nApreciamos sus comentarios. Nos ayudan a mejorar nuestro sitio web.\n\nDesea continuar sin proveer su dirección de correo electrónico?' )
				break;
			case "pt-br":
				return( 'Although it is not required, it would be very helpful for us if you could include your e-mail address in order for us to respond back to you.\n\nWe appreciate your feedback. It will help us to improve our web site.\n\nDo you want to continue without providing an email address?' )
				break;
			case "en":
				return( 'Although it is not required, it would be very helpful for us if you could include your e-mail address in order for us to respond back to you.\n\nWe appreciate your feedback. It will help us to improve our web site.\n\nDo you want to continue without providing an email address?' )
				break;
		}
	}

	function mssgValidation(){
		switch (QS("plang")){
			case "es":
				return( "El campo de \"E-mail\" parece estar incorrecto o incompleto. Por favor revise su \"E-mail\"." )
				break;
			case "pt-br":
				return( "The \"E-mail\" address may be either incorrect or incomplete.  Please check the value of the \"E-mail\" field." )
				break;
			case "en":
				return( "The \"E-mail\" address may be either incorrect or incomplete.  Please check the value of the \"E-mail\" field." )
				break;
		}
	}


	//IF THERE IS AN EMAIL ADDRESS, VALIDATE IT!
	function CheckEmail(){

		var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-@-_.";
		var checkStr = feedback.Email.value;
		var allValid = true;
		for (i = 0;  i < checkStr.length;  i++){
			ch = checkStr.charAt(i);
			for (j = 0;  j < checkOK.length;  j++)
				if (ch == checkOK.charAt(j))
				break;
				if (j == checkOK.length){
					allValid = false;
					break;
				}
			}
			if (!allValid){
				alert(mssgValidation());
				feedback.Email.focus();
				return (false);
			}

		var CheckRegExp = /^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})$/;
		var string = feedback.Email.value;
		if ( string.match( CheckRegExp ) == null ) {
						alert(mssgValidation());
						feedback.Email.focus();
				return ( false );
		}
		return true;
	}

