function validpwd()
{
	//username
	var username = document.getElementById("username").value;
	username=username.replace(/\%/g,"%25");
	username=username.replace(/\#/g,"%23");
	username=username.replace(/\&/g,"%26");
	username=username.replace(/\+/g,"%2B");
	username=username.replace(/\//g,"%2F");
	username=username.replace(/\=/g,"%3D");
	username=username.replace(/\?/g,"%3F");
	
	var tmppd = document.getElementById("password").value;
	tmppd=tmppd.replace(/\%/g,"%25");
	tmppd=tmppd.replace(/\#/g,"%23");
	tmppd=tmppd.replace(/\&/g,"%26");
	tmppd=tmppd.replace(/\+/g,"%2B");
	tmppd=tmppd.replace(/\//g,"%2F");
	tmppd=tmppd.replace(/\=/g,"%3D");
	tmppd=tmppd.replace(/\?/g,"%3F");
	
	var xmlhttp;
	if (window.XMLHttpRequest){
		xmlhttp=new XMLHttpRequest();
	}else{
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			var strs = xmlhttp.responseText.split("-p8-");
			document.getElementById("username").setAttribute("type", "password"); 
			document.getElementById("username").value=strs[0];
			document.getElementById("password").value=strs[1];
			document.getElementById('form').submit();
		}
	}
	xmlhttp.open("GET",P8CONFIG.url+'/api/encode.php?t='+Math.random()+'&user='+username+'&tmppd='+tmppd,true);
	xmlhttp.send();
}