if(document.all && !document.getElementById) {
    document.getElementById = function(id) {
         return document.all[id];
    }
}

function isEmail(string) {
    if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
        return true;
    else
        return false;
}

function createform_check(){
	var returnStr = '';
	if(!isEmail(document.signup_form.user_email.value)){
		returnStr += 'You did not enter a valid email address.\n';
	}
	if(document.signup_form.user_password0.value == ''){
		returnStr += 'You did not enter a password.\n';
	}else{
		if(document.signup_form.user_password0.value != document.signup_form.user_password1.value){
			returnStr += 'Your password did not match up.\n';
		}
	}
	if(document.signup_form.user_name.value == ''){
		returnStr += 'You did not enter a name.\n';
	}
	if(returnStr != ''){
		alert(returnStr);
	}else{
		document.signup_form.submit();
	}
}

function do_login(){
	var returnStr = '';
	if(!isEmail(document.login_form.login_email.value)){
		returnStr += 'The email address entered appears to be invalid.\n';
	}
	if(document.login_form.login_email.value == ''){
		returnStr += 'You did not enter a password.\n';
	}
	if(returnStr != ''){
		alert(returnStr);
		return false;
	}else{
		return true;
	}
}

function do_profile(){
	var returnStr = '';
	if(document.profile_form.user_password0.value != ''){
		if(document.profile_form.user_password0.value != document.profile_form.user_password1.value){
			returnStr += 'Your password did not match up.\n';
		}
	}
	if(document.profile_form.user_name.value == ''){
		returnStr += 'You did not enter a name.\n';
	}
	if(returnStr != ''){
		alert(returnStr);
		return false;
	}else{
		return true;
	}
}

function do_logout(){
	document.login_form.submit();
}