﻿function chkFrmSearch(obj)
{
	var keyword = obj.txtkeyword.value;
	var sex = obj.sbSex.value;
	var age = obj.sbAge.value;
	var region = obj.sbRegion.value;
	var telcode = obj.sbTelcode.value;
	var height = obj.sbHeight.value;
	var weight = obj.sbWeight.value;

	if(obj.txtkeyword.value == "Tìm thành viên...")
	{
		var keyword = '';
	}
	if(obj.txtkeyword.value == "Tìm thành viên..." && obj.sbSex.value == '' && obj.sbAge.value == '' && obj.sbRegion.value == '' && obj.sbTelcode.value == '' && obj.sbHeight.value == '' && obj.sbWeight.value == '')
	{
		btnSearch=confirm("Bạn muốn tìm tất cả thành viên ? ");
		if (!btnSearch)
			return false;
		else
			obj.action = "#search.html/in=all&sex="+sex+"&age="+age+"&region="+region+"&telcode="+telcode+"&height="+height+"&weight="+weight+"&keyword="+keyword;
			return true;
	}
	else
	{
		obj.action = "#search.html/in=all&sex="+sex+"&age="+age+"&region="+region+"&telcode="+telcode+"&height="+height+"&weight="+weight+"&keyword="+keyword;
		return true;
	}
}

function chkFrmCheck(obj)
{
	var id = obj.txtmemberid.value;
	var phoneno = obj.txtphoneno.value;
	if(obj.txtmemberid.value == "Nhập mã số")
	{
		alert('Bạn chưa nhập mã số ! ');
		obj.txtmemberid.focus();
		return false;
	}
	if(obj.txtmemberid.value.length != 4 || obj.txtmemberid.value.substring(0,1) == 0 || isFinite(obj.txtmemberid.value) <= false)
	{
		alert("Bạn nhập mã số chưa đúng. ");
		obj.txtmemberid.focus();
		return false;
	}
	if(obj.txtphoneno.value == "Nhập điện thoại")
	{
		alert('Bạn chưa nhập số điện thoại ! ');
		obj.txtphoneno.focus();
		return false;
	}
	if(obj.txtphoneno.value.length <= '9')
	{
		alert("Bạn nhập số điện thoại chưa đúng. ");
		obj.txtphoneno.focus();
		return false;
	}
	if(obj.txtphoneno.value.substring(0,1) != 0)
	{
		alert("Bạn nhập Số điện thoại chưa đúng.\nThiếu Số Mã vùng hoặc thiếu số 0 đầu cho di động. ");
		obj.txtphoneno.focus();
		return false;
	}
	else
	{
		obj.action = "#search.html/in=id&id="+id+"&phone="+phoneno;
		return true;
		//obj.submit();
	}
}
