// JavaScript Document

function redir(w){
window.location.replace(w);
}

function CheckresFormEN(){
	AlertM = "";
	if (document.resform.restitle.value==""){
		AlertM+= "Title is mandatory\n";
	}
	if (document.resform.resabstract.value==""){
		AlertM+= "Abstract is mandatory\n";
	}
	if (document.resform.resappcode.value==""){
		AlertM+= "Market Application Code is mandatory\n";
	}
	if (document.resform.resgoal.value==""){
		AlertM+= "Project Goal is mandatory\n";
	}
	if (document.resform.restechkeyw.value==""){
		AlertM+= "Technology Keywords are mandatory\n";
	}
	if (document.resform.resyearfounded.value==""){
		AlertM+= "Year founded is mandatory\n";
	}
	if (document.resform.reskeycust.value==""){
		AlertM+= "Key customers are mandatory\n";
	}
	if (document.resform.reskeycomp.value==""){
		AlertM+= "Key competitors are mandatory\n";
	}
	if (document.resform.resachieve.value==""){
		AlertM+= "Key Achievements are mandatory\n";
	}
	if (document.resform.resbegdate.value==""){
		AlertM+= "Begin Date is mandatory\n";
	}	
	if (AlertM==""){
		return true;
	}else{
		alert(AlertM);
		return false;
	}
}

function CheckorgFormEN(){
	AlertM = "";
	if (document.organifname.orgname.value==""){
		AlertM+= "Your Organisation Name is mandatory\n";
	}
	if (document.organifname.orgfunction.value==""){
		AlertM+= "Your Organisation Function is mandatory\n";
	}
	if (document.organifname.orggenmail.value==""){
		AlertM+= "Your E-mail is mandatory\n";
	}else{
		re = /^[\w\.=-]+@[\w\.-]+\.[a-z]{2,4}$/i;
		if (!re.test(document.organifname.orggenmail.value)){
			AlertM+= "Your E-mail is not valid\n";
		}
		}
	if (AlertM==""){
		return true;
	}else{
		alert(AlertM);
		return false;
	}
}

function CheckFormEN(){
	AlertM = "";
	if (document.membfname.title.value==""){
		AlertM+= "Your Title is mandatory\n";
	}
	if (document.membfname.membfname.value==""){
		AlertM+= "Your Firstname is mandatory\n";
	}
	if (document.membfname.memblname.value==""){
		AlertM+= "Your Lastname is mandatory\n";
	}	
	if (document.membfname.gender.value==""){
		AlertM+= "Your Gender is mandatory\n";
	}	
	if (document.membfname.membemail.value==""){
		AlertM+= "Your E-mail is mandatory\n";
	}else{
		re = /^[\w\.=-]+@[\w\.-]+\.[a-z]{2,4}$/i;
		if (!re.test(document.membfname.membemail.value)){
			AlertM+= "Your E-mail is not valid\n";
		}
		}
		if(document.membfname.confirmmembemail.value) {
			if(document.membfname.membemail.value && (document.membfname.confirmmembemail.value != document.membfname.membemail.value))
				AlertM+= ("The confirmation of E-mail is not the same as the original.");
		}
		else if(document.membfname.confirmmembemail.value=="")
			AlertM+= ("The confirmation of E-mail is mandatory\n");

	if (AlertM==""){
		return true;
	}else{
		alert(AlertM);
		return false;
	}
}

function CheckFormMembers(){
	AlertM = "";
	if (document.checkmember.logmember.value==""){
		AlertM+= "Your Login is mandatory\n";
	}
	if (document.checkmember.logpass.value==""){
		AlertM+= "Your Password is mandatory\n";
	}

	if (AlertM==""){
		return true;
	}else{
		alert(AlertM);
		return false;
	}
}

function CheckFormSearch(){
	AlertM = "";
	if (document.searchform.keywords.value==""){
		AlertM+= "Enter a word to search for\n";
	}
	if (AlertM==""){
		return true;
	}else{
		alert(AlertM);
		return false;
	}
}

function CheckFormSearch2(){
	AlertM = "";
	if (document.searchform2.keywords.value==""){
		AlertM+= "Enter a word to search for\n";
	}
	if (AlertM==""){
		return true;
	}else{
		alert(AlertM);
		return false;
	}
}

function CheckLostEN(){
	AlertM = "";
	if (document.memblost.lostmail.value==""){
		AlertM+= "Your E-mail is mandatory\n";
	}else{
		re = /^[\w\.=-]+@[\w\.-]+\.[a-z]{2,4}$/i;
		if (!re.test(document.memblost.lostmail.value)){
			AlertM+= "Your E-mail is not valid\n";
		}
		}
	if (AlertM==""){
		return true;
	}else{
		alert(AlertM);
		return false;
	}
}

function CheckModifyEN(){
	AlertM = "";
	if (document.modifyprof.title.value==""){
		AlertM+= "Your Title is mandatory\n";
	}
	if (document.modifyprof.membfname.value==""){
		AlertM+= "Your Firstname is mandatory\n";
	}
	if (document.modifyprof.memblname.value==""){
		AlertM+= "Your Lastname is mandatory\n";
	}	
	if (document.modifyprof.gender.value==""){
		AlertM+= "Your Gender is mandatory\n";
	}	
	if (document.modifyprof.membemail.value==""){
		AlertM+= "Your E-mail is mandatory\n";
	}else{
		re = /^[\w\.=-]+@[\w\.-]+\.[a-z]{2,4}$/i;
		if (!re.test(document.modifyprof.membemail.value)){
			AlertM+= "Your E-mail is not valid\n";
		}
		}
	if (AlertM==""){
		return true;
	}else{
		alert(AlertM);
		return false;
	}
}
