/**
 * @FileName: register.js
 * @Author: Leo chxizi@gmail.com
 * @Date:  2009-10-6 09:22
 */

function checkUser()
{
	var email = $("#email").val();
	if (email.trim() == "" || email.length < 6 )
	{
		$("#email_msg").html("Please specify a valid e-mail address.");
		return false;			
	}
	else if(chekEmail(email)==false)
	{
		$("#email_msg").html("The email address must be in example@eing.com format.");
		return false;	
	}
	else
	{
		$("#email_msg").load("ajax.php?action=checkname", {name: $("#email").val()});
		$("#email_msg").html("");
	}

}
function checkPwd()
{
	var pwd = $("#pwd1").val();
	if (pwd.trim() == "" || pwd.length < 6)
	{
		$("#pwd_msg").html("Please specify your Password.");
	}
	else
	{
		$("#pwd_msg").html("");
	}
}
function checkPwd2()
{
	var pwd = $("#pwd1").val();
	var pwd2 = $("#pwd2").val();
	if (pwd2.trim() == "" )
	{
		$("#pwd2_msg").html("Please specify your Password.");
	}
	else if (pwd != pwd2)
	{
		$("#pwd2_msg").html("Your password entries did not match.");
	}
	else
	{
		$("#pwd2_msg").html("");
	}
}
function checkFname()
{
	var fname = $("#fname").val();
	if (fname.trim() == "")
	{
		$("#fname_msg").html("Please specify a First Name.");
	}
	else
	{
		$("#fname_msg").html("");
	}
}
function checkLname()
{
	var lname = $("#lname").val();
	if (lname.trim() == "")
	{
		$("#lname_msg").html("Please specify a Last Name.");
	}
	else
	{
		$("#lname_msg").html("");
	}
}
function checkCountry()
{
	var country = $("#country").val();
	if (country.trim() == "0")
	{
		$("#country_msg").html("Please specify a Last Name.");
	}
	else
	{
		$("#country_msg").html("");
	}
}
function checkPhone()
{
	var phone = $("#phone").val();
	if (phone.trim() == "" )
	{
		$("#phone_msg").html("Please specify your Contact Phone.");			
	}
	else if(chekNumeric(phone)==false)
	{
		$("#phone_msg").html("The Phone numbers must be in digital format.");	
	}
	else
	{
		$("#phone_msg").html("");
	}

}
function checkCountry()
{
	var country = $("#country").val();
	if (country.trim() == "0")
	{
		$("#country_msg").html("Please specify a Country.");
	}
	else
	{
		$("#country_msg").html("");
	}
}
function checkState()
{
	var state = $("#state").val();
	if (state.trim() == "")
	{
		$("#state_msg").html("Please specify your State or Province.");
	}
	else
	{
		$("#state_msg").html("");
	}
}
function checkCity()
{
	var city = $("#city").val();
	if (city.trim() == "")
	{
		$("#city_msg").html("Please specify your City.");
	}
	else
	{
		$("#city_msg").html("");
	}
}
function checkAddress()
{
	var address = $("#address").val();
	if (address.trim() == "")
	{
		$("#address_msg").html("Please specify your Address.");
	}
	else
	{
		$("#address_msg").html("");
	}
}
function checkZip()
{
	var zip = $("#zip").val();
	if (zip.trim() == "")
	{
		$("#zip_msg").html("Please specify a Zip or Postal Code.");
	}
	else
	{
		$("#zip_msg").html("");
	}
}

