function CheckLoginInfo(form_name)
{
	var isError=true;
	if(IsEmpty_Login("txtUsername"))
	{
		alert("User name can not be null");
		isError = false;
	}	
	else
	{
		if(IsEmpty_Login("txtPwd"))
		{
			alert("password can not be null");
			isError = false;
		}
	}
	return isError;
}
function checkEmail_forgetPwd(form_name)
{
	var isError=true;
	if(IsEmpty_Login("txtForgetName"))
	{
		document.getElementById("ForgetNameValidate").innerHTML="* Name can not be null.";
		isError = false;
	}	
	else
	{
		document.getElementById("ForgetNameValidate").innerHTML="*";
	}
	if(!checkEmail_Other("txtForgetEmail"))
	{
		document.getElementById("ForgetEmailValidate").innerHTML="* Invalidate User Email.";
		isError = false;
	}
	else
	{
		document.getElementById("ForgetEmailValidate").innerHTML="*";
	}
	return isError;
}
/**
 * Check strText
 */ 
function IsEmpty_Login(strElementID)
{
	var strText = document.getElementById(strElementID).value;
    strText=MyTrim(strText);
	if(strText=="")
	{
	  	return true;
	}
	else
	{
		return false;
	}
	
}
 
function checkEmail_Other(strElementID)
{
	var strText = document.getElementById(strElementID).value;
	strText=MyTrim(strText);
  	var patrn=/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/;  
	
  	if (!patrn.exec(strText)) 
 	{
 		return false;
	}
  	return true
}

function checkPassword(strElementID)
{
	var userPwd = document.getElementById(strElementID).value;
	userPwd = MyTrim(userPwd);
	var patrn=/^(?=(?:.*?[a-zA-Z]){2,})[a-zA-Z0-9]{6,}$/;
	if(!patrn.exec(userPwd))
	{
		return false;
	}
	return true;
}
 
 /**
 Trims leading and trailing whitespaces.
 */ 
function MyTrim(strText) 
{
   var temp = strText;
   var obj = /^(\s*)([\W\w]*)(\b\s*$)/;
   if (obj.test(temp)) { 
     temp = temp.replace(obj, '$2'); 
   }
   return temp;
}

function CheckEmail_News(form_name)
{
	var isError=true;
	if(IsEmpty_Login("txtNewsMail"))
	{
		alert("User email can not be null");
		isError = false;
	}	
	else
	{
		if(!checkEmail_Other("txtNewsMail"))
		{
			alert("Invalidate emial enterd");
			isError = false;
		}
	}
	return isError;
}