function autoCheck()
	{
	if (document.getElementById('fullnameID').value) fakeEvent('fullnameID')
	if (document.getElementById('screenameID').value) fakeEvent('screenameID')
	if (document.getElementById('emailID').value) fakeEvent('emailID')
	}

function fakeEvent(inputId)
	{
	ev=document.createEvent('KeyboardEvent');
	ev.initEvent('keyup',true,true);
	document.getElementById(inputId).dispatchEvent(ev);	
	}

function actionJoin()
	{
	if (!document.joinZ.fullname.disabled)
		if (!substr_count(document.getElementById('fullnameX').style.backgroundImage,'_img/true.png')) return false
	if (!document.joinZ.screename.disabled)
		if (!substr_count(document.getElementById('screenameX').style.backgroundImage,'_img/true.png')) return false
	if (!substr_count(document.getElementById('emailX').style.backgroundImage,'_img/true.png')) return false
	if (!substr_count(document.getElementById('passwordX').style.backgroundImage,'_img/true.png')) return false
	if (document.getElementById('recaptcha_response_field').value=='') return false
	document.joinZ.fullname.removeAttribute('disabled')
	document.joinZ.screename.removeAttribute('disabled')
	return true
	}

function check(obj,e)
	{
	if (e && keyCheck(e.keyCode)) return false
	if (obj.value.length==1 && obj.value==' ' && obj.type!='password')
		{
		obj.value= ''
		return false
		}
	if (obj.name=='fullname')
		{
		document.getElementById(obj.name + 'X').style.backgroundImage='url(_img/true.png)'
		return false
		}
	document.getElementById(obj.name + 'X').style.backgroundImage= 'url(_img/load.gif)'
	if (obj.name=='password')
		{
		if (obj.value.length<5) document.getElementById(obj.name  + 'X').style.backgroundImage= 'url(_img/false.gif)'
		else document.getElementById(obj.name + 'X').style.backgroundImage= 'url(_img/true.png)'
		return false
		}
	xmlHttp= ajax();
	xmlHttp.open('get','preregistrations/?' + obj.name + '=' + obj.value+'&1=1')
	xmlHttp.onreadystatechange = function()
		{
		if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
			{
			if (xmlHttp.responseText==1)document.getElementById(obj.name + 'X').style.backgroundImage= 'url(_img/true.png)'
			else document.getElementById(obj.name + 'X').style.backgroundImage= 'url(_img/false.gif)'
			}
		}
	xmlHttp.send(null)
	return true
	}

var updateStrength = function(pw) 
	{
	var strength = getStrength(pw)
	var width = (429/32)*strength
	new Effect.Morph('psStrength', {style:'width:'+width+'px', duration:'0.4'})
	}

var getStrength = function(passwd) 
	{
	intScore = 0;
	if (passwd.match(/[a-z]/)) intScore = (intScore+1)
	if (passwd.match(/[A-Z]/)) intScore = (intScore+5)
	if (passwd.match(/\d+/)) intScore = (intScore+5)
	if (passwd.match(/(\d.*\d.*\d)/)) intScore = (intScore+5)
	if (passwd.match(/[!,@#$%^&*?_~]/)) intScore = (intScore+5)
	if (passwd.match(/([!,@#$%^&*?_~].*[!,@#$%^&*?_~])/)) intScore = (intScore+5)
	if (passwd.match(/[a-z]/) && passwd.match(/[A-Z]/)) intScore = (intScore+2)
	if (passwd.match(/\d/) && passwd.match(/\D/)) intScore = (intScore+2)
	if (passwd.match(/[a-z]/) && passwd.match(/[A-Z]/) && passwd.match(/\d/) && passwd.match(/[!,@#$%^&*?_~]/)) intScore = (intScore+2)
	return intScore
	}