// JavaScript Document

function require(element, msg, minlen){
	if(element.value.length < minlen){
		alert(msg);
		element.focus();
		return false;
	}
	return true;
}

function requiresize(element, msg, minlen, maxlen){
	if(element.value.length < minlen || element.value.length > maxlen){
		alert(msg);
		element.focus();
		return false;
	}
	return true;
}

function comparesame(elea, eleb, msg){
	if(elea.value!=eleb.value){
		alert(msg);
		elea.focus();
		return false;
	}
	return true;
}

function validemail(email, msg){
	if(!email.value.match(/^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/)){
		alert(msg);
		email.focus();
		return false;
	}
	return true;
}

function validphone(phone, msg){
	if(!phone.value.match(/^[0-9]+$/)){
		alert(msg);
		email.focus();
		return false;
	}
	return true;
}

function getElement(elename){
	var ele=document.getElementsByName(elename);
	return ele[0];
}