function valid2(str) {
	for(var i = 0; i < str.length; i++) {
		var charcode = str.charCodeAt(i);

		/* A-Z */
		if(charcode >= 0x41 && charcode <= 0x5A) {
			continue;
		}

		/* a-z */
		if(charcode >= 0x61 && charcode <= 0x7A) {
			continue;
		}

		/* 0-9 */
		if(charcode >= 0x30 && charcode <= 0x39) {
			continue;
		}

		/* . - _ */
		if(charcode == 0x2D || charcode == 0x2E || charcode == 0x5F) {
			continue;
		}

		return false;
	}

	return true;
}

function validEmail(email) {
	var atpos = email.indexOf("@");

	if(atpos == -1) {
		return false;
	}

	if(atpos == 0) {
		return false;
	}

	var dotpos = email.indexOf(".", atpos+2);

	if( dotpos == -1) {
		return false;
	}

	if(dotpos == (email.length - 1) ) {
		return false;
	}

	var fpart = email.substring(0,atpos);
	var host = email.substring(atpos + 1, dotpos);
	var domain = email.substr(dotpos +1);

	if(!( valid2(fpart) && valid2(host) && valid2(domain))) {
    
		return false;
	}

	var afterat = email.substr(atpos + 1);
	if(afterat.lastIndexOf(".") == (afterat.length - 1)) {
		return false;
	}

	for(var i = 1; i < afterat.length; i++) {
		if(afterat.charAt(i) == "." && afterat.charAt(i-1) == ".") {
			return false;
		}
	}

	return true;
}








function valid(){

if(document.contact.happy[0].checked==false && document.contact.happy[1].checked==false&& document.contact.happy[2].checked==false)
{
window.alert('Please choose an option first.');
	return false;
}	
	
if(document.contact.because.value==""){
window.alert('Please fill your comment first.');
return false;
}




}


