// JavaScript Document
function are_you_sure() {
	var answer = confirm("Are you sure you want to delete this?")
	
	if (!answer) {
		return false;
	}
}
	
function is_valid_email(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 check_register_small_data() {

	var problem = 'No';
	
	if (document.mlist.name.value == '> name') {
		alert ("Please enter your name!");
		document.mlist.name.focus();
		problem = 'Yes';
	}

	if (document.mlist.email.value == '> e-mail address') {
		alert ("Please enter your email address!");
		document.mlist.email.focus();
		problem = 'Yes';
	}
	else if(!isValidEmail(document.mlist.email.value)) {
		alert ("Please enter a valid e-mail address!");
		document.mlist.email.focus();
		problem = 'Yes';
	}
																  
	if (problem == 'No') {
		return true;
	} else {
		return false;
	}
}