function checkemail(frm){
	var str=frm.email.value;
//	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	atpos = str.indexOf("@"); //5
	stoppos = str.lastIndexOf("."); //6

	
	if (stoppos > 0 && atpos > 0 && stoppos > atpos && stoppos - atpos > 1)
		ck=true
	else{
		alert("Please input a valid email address!")
		ck=false
	}
	return ck;
}

function check_post_comment(frm){
	var fsub = true, err, ctr=0, fld_focus;
	var err = "The ff fields must not be empty/invalid: \n\n";

	if(frm.comment_name.value.length < 1){
		if(fsub == true) fld_focus = frm.comment_name;
		fsub = false;
		err += ++ctr+". Name \n";
	}
	if(frm.comment_email.value.length < 1 || frm.comment_email.value.indexOf('@') == -1){
		if(fsub == true) fld_focus = frm.comment_email;
		fsub = false;
		err += ++ctr+". Email \n";
	}
	if(frm.comment_comment.value.length < 1){
		if(fsub == true) fld_focus = frm.comment_comment;
		fsub = false;
		err += ++ctr+". Comment \n";
	}
	
	if(fsub == false){
		alert(err);
		fld_focus.focus();
	}
	return(fsub);
}
//	alert('test');
//function check_employment(frm){
//	alert('test');
//}

function check_signup(frm){
	var fsub = true, err, ctr=0, fld_focus;
	var err = "The ff fields must not be empty/invalid: \n\n";

	if(frm.signup_email.value.length < 1 || frm.signup_email.value.indexOf('@') == -1){
		if(fsub == true) fld_focus = frm.signup_email;
		fsub = false;
		err += ++ctr+". Email \n";
	}
	if(frm.signup_zip.value.length < 1 || frm.signup_zip.value == 'zip'){
		if(fsub == true) fld_focus = frm.signup_zip;
		fsub = false;
		err += ++ctr+". Zip \n";
	}
	
	if(fsub == false){
		alert(err);
		fld_focus.focus();
	}
	return(fsub);
}


function check_contact(frm){
	var fsub = true, err, ctr=0, fld_focus;
	var err = "The ff fields must not be empty/invalid: \n\n";


	if(frm.project_researcher_name.value.length < 1 || frm.project_researcher_name.value == 'Researcher Name'){
		if(fsub == true) fld_focus = frm.project_researcher_name;
		fsub = false;
		err += ++ctr+". Researcher Name \n";
	}	
	
	if(frm.project_project_title.value.length < 1 || frm.project_project_title.value == 'Project Title'){
		if(fsub == true) fld_focus = frm.project_project_title;
		fsub = false;
		err += ++ctr+". Project Title \n";
	}		
	

	

	



	
		if(frm.project_city.value.length < 1 || frm.project_city.value == 'City'){
		if(fsub == true) fld_focus = frm.project_city;
		fsub = false;
		err += ++ctr+". City \n";
	}
	
	if(frm.project_age.value.length < 1 || frm.project_age.value == 'Birth Date'){
		if(fsub == true) fld_focus = frm.project_age;
		fsub = false;
		err += ++ctr+". Birth Date \n";
	}
	
	
	if(frm.project_post_grad.value.length < 1 || frm.project_post_grad.value == 'Post grad'){
		if(fsub == true) fld_focus = frm.project_post_grad;
		fsub = false;
		err += ++ctr+". Post grad \n";
	}
	
	if(frm.project_post_grad_degree.value.length < 1 || frm.project_post_grad_degree.value == 'Post grad degree'){
		if(fsub == true) fld_focus = frm.project_post_grad_degree;
		fsub = false;
		err += ++ctr+". Post grad degree \n";
	}
	
	if(frm.project_college_school.value.length < 1 || frm.project_college_school.value == 'College'){
		if(fsub == true) fld_focus = frm.project_college_school;
		fsub = false;
		err += ++ctr+". College \n";
	}
	
	if(frm.project_college_degree.value.length < 1 || frm.project_college_degree.value == 'College Degree'){
		if(fsub == true) fld_focus = frm.project_college_degree;
		fsub = false;
		err += ++ctr+". College Degree \n";
	}
	
/*	if(frm.project_work.value.length < 1 || frm.project_work.value == 'Work'){
		if(fsub == true) fld_focus = frm.project_work;
		fsub = false;
		err += ++ctr+". Work \n";
	}
	*/
	if(frm.project_employer.value.length < 1 || frm.project_employer.value == 'Employer'){
		if(fsub == true) fld_focus = frm.project_employer;
		fsub = false;
		err += ++ctr+". Employer \n";
	}	
	
	if(frm.project_position.value.length < 1 || frm.project_position.value == 'Position'){
		if(fsub == true) fld_focus = frm.project_position;
		fsub = false;
		err += ++ctr+". Position \n";
	}		
	
	regex = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/i;

	if(!regex.test(frm.project_email1.value)){
		if(fsub == true) fld_focus = frm.project_email1;
		fsub = false;
		err += ++ctr+". Contact Email Add \n";
	}
	
	if(frm.project_tel_num.value.length < 1 || frm.project_tel_num.value == 'Phone Number'){
		if(fsub == true) fld_focus = frm.project_tel_num;
		fsub = false;
		err += ++ctr+". Phone Number \n";
	}
	
	

	
	
	if(fsub == false){
		alert(err);
		fld_focus.focus();
	}
	return(fsub);
}

function image_view(url, width, height){
	img = window.open (url, "mywindow","menubar=1,resizable=1,screenX=100,screenY=100,width="+width+",height="+height);
	img.focus();	
}
function url_view(url, width, height){
	img = window.open (url, "mywindow","menubar=1,resizable=1,screenX=100,screenY=100,width="+width+",height="+height);
	img.focus();	
}