var start_time = (new Date()).getTime();
var expires_date = new Date( start_time + (30*1000*60*60*24));

function checkLoginForm(obj)
{
	if(isEmpty(obj.username.value))return alertF(ENTER_MEMBER_LOGIN, obj.username);
	if(isEmpty(obj.password.value))return alertF(ENTER_MEMBER_PASSWORD, obj.password);
	if(obj.imgcode)if(isEmpty(obj.imgcode.value))return alertF(ENTER_MEMBER_CODE, obj.imgcode);

	if(obj.PersistentCookie.checked)
	{
		var now = (new Date()).getTime();
		SetPHCookie("PH.NET_SessionIdx", randomPassword(10) + "/" + start_time + "/" + now + "/" + randomPassword(40));
	}
	return true;
}

function randomPassword(length)
{
   chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
   pass = "";
   for(x=0;x<length;x++)
   {
      i = Math.floor(Math.random() * 62);
      pass += chars.charAt(i);
   }
   return pass;
}
function SetPHCookie(name, value) {
	document.cookie = name + "=" + value + "; expires=" + expires_date.toGMTString() + "; path=/";
}
