  function checkRadio(field)
  {
    for(var i=0; i < field.length; i++) {
      if(field[i].checked) return field[i].value;
    }
    return false;
  }
function checklogin(){	
var text = document.regis.email;
if(text.checked = false){
		alert("เลือก E-mail สำหรับลงทะเบียน");
		return false;
	}
var text = document.regis.fname;
if(text.value==""){
		alert("กรุณาระบุชื่อครับ");
		text.focus();
		return false;
	}
var text = document.regis.sex;
if(text.value==""){
		alert("กรุณาระบุเพศครับ");
		text.focus();
		return false;
	}
var text = document.regis.year;
if(text.value==""){
		alert("กรุณาระบุปีเกิดครับ");
		text.focus();
		return false;
	}	
var text = document.regis.province;
if(text.value==""){
		alert("กรุณาระบุจังหวัดครับ");
		text.focus();
		return false;
	}	
var text = document.regis.email2;
if(text.value==""){
		alert("กรุณาระบุ E-mail ครับ");
		text.focus();
		return false;
	}
var text = document.regis.password;
if(text.value==""){
		alert("กรุณาระบุ Password ครับ");
		text.focus();
		return false;
	}	
if(text.value.length<4 || text.value.length>50)
		{
		alert("กรุณาระบุ Password ไม่น้อยกว่า 4 ตัว \n และไม่เกิน 20 ตัวครับ");
		text.value="";
		text.focus();
		return false;
		}
	if(text.value!=document.regis.Confirm.value){
		alert("กรุณากรอกรหัสผ่านให้เหมือนกันทั้ง 2 ครัง");
		text.value="";
		document.regis.Confirm.value="";
		text.focus();
		return false;
	}
var text = document.regis.relation;
if(text.value==""){
		alert("กรุณาระบุ เพื่อนที่อยากคุย ครับ");
		text.focus();
		return false;
	}	
var text = document.regis.suggest;
if(text.value==""){
		alert("กรุณาระบุ คำแนะนำตัว ครับ");
		text.focus();
		return false;
	}		
document.regis.submit_but.disabled=true;
}

function clicktype() {  //show or hide detail
	if (document.regis.email[0].checked==true) {
		document.regis.email2.value=document.regis.msn.value;
} else if (document.regis.email[1].checked==true) {
		document.regis.email2.value=document.regis.yahoo.value;
} else if (document.regis.email[2].checked==true) {
		document.regis.email2.value=document.regis.gtalk.value;
} else if (document.regis.email[3].checked==true) {
		document.regis.email2.value="";
		document.regis.email2.focus();
	}
}

