String.prototype.trim = function (){
	return this.replace(/^\s+|\s+$/g, "");
}

function trimall(m){
	for(i=0;i<m.elements.length;i++)
		m.elements[i].value=m.elements[i].value.trim();
}

function chkpass(m,m1,n,n1){
	if(m.value=="")
		return n+" is empty.\n";
	if(m.value.length <6 || m.value.length> 12)
		return n+" must be over 6 characters, but not more than 12 characters.\n";
	if(m.value!=m1.value)
		return n+" must be the same as "+n1+".\n";
	return "";
}

function chktext(m,n){
	if(m.value=="")
		return n+" is empty.\n";
	return "";
}
function chknum(m,n,s){
	if(m.value==""&&s==1)
		return n+" is empty.\n";
	if(m.value!=""&&s>1 && m.value.length != s)
		return n+" must be "+s+" characters.\n";
	if(isNaN(m.value))
		return n+" is not number.\n";
	return "";
}
function chkemail(m){
	if(m.value=="")
		return "Email is empty.\n";
	else
	if((m.value.indexOf ('@',0) == -1 || m.value.indexOf ('.',0) == -1))
		return "Email is not correct.\n";
	return "";
}
function chkradio(m,n){
	fg=true;
	if(m.checked){
		fg=false;
	}else{
		for(i=0;i<m.length;i++)
			if(m[i].checked) fg=false;
	}
	if(fg) return n+" is empty.\n";
	return "";
}
function setradio(m){
	for(i=0;i<m.length;i++){
		m[i].checked=false;
		}
}

