function echeck(str) {
	var at="@";
	var dot=".";
	var lat=str.indexOf(at);
	var lstr=str.length;
	var ldot=str.indexOf(dot);
	
	if (str.indexOf(at)==-1){ return false; }
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){ return false; }
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){ return false; }
	if (str.indexOf(at,(lat+1))!=-1){ return false; }
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){ return false; }
	if (str.indexOf(dot,(lat+2))==-1){ return false; }
	if (str.indexOf(" ")!=-1){ return false; }
	return true;					
}

function ValidateForm(){
	var strName = document.frmVideo.name;
	var strEmail = document.frmVideo.email;
	var strYouTube = document.frmVideo.youtube;
	
	if ((strName.value == null)||(strName.value == "")){
		alert("Please enter your Name");
		strName.focus();
		return false;
	}
	if ((strEmail.value == null)||(strEmail.value == "") || (echeck(strEmail.value) == false)){
		alert("Please enter a valid Email Address.");
		strEmail.focus();
		return false;
	}
	if ((strYouTube.value == null)||(strYouTube.value == "")){
		alert("Please enter the URL of your video on YouTube.");
		strYouTube.focus();
		return false;
	}
	
	//return true;
	//var poststr=createpoststring(); //Get contents to post and create query string first
	var strName = document.getElementById("frmVideo").name.value;//get value to post from a form field
	var strEmail = document.getElementById("frmVideo").email.value;
	var strYouTube = document.getElementById("frmVideo").youtube.value;
	var poststr = "name=" + encodeURI(strName) + "&email=" + encodeURI(strEmail) + "&url=" + encodeURI(strYouTube);
	ajaxpack.postAjaxRequest("process-form.php", poststr, processGetPost, "txt");
 }
