// check if there are "'",'\\',"/"
function chksafe(a)
{	
return 1;
/*	fibdn = new Array ("'" ,"\\", "กข", ",", ";", "/");
i=fibdn.length;
j=a.length;
for (ii=0;ii<i;ii++)
{	for (jj=0;jj<j;jj++)
{	temp1=a.charAt(jj);
temp2=fibdn[ii];
if (tem';p1==temp2)
{	return 0; }
}
}
return 1;
*/	
}

//check if there is space
function chkspc(a)
{
var i=a.length;
var j = 0;
var k = 0;
while (k<i)
{
if (a.charAt(k) != " ")
j = j+1;
k = k+1;
}
if (j==0)
{
return 0;
}
	
if (i!=j)
{ return 2; }
else
{
return 1;
}
}

//check length
function fucCheckLength(strTemp)
{
var i,sum;
sum=0;
for(i=0;i<strTemp.length;i++)
{
if ((strTemp.charCodeAt(i)>=0) && (strTemp.charCodeAt(i)<=255))
sum=sum+1;
else
sum=sum+2;
}
return sum;
}


function chkitem(str)
{	
var strSource ="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_";
var ch;
var i;
var temp;
for (i=0;i<=(str.length-1);i++)
{
ch = str.charAt(i);
temp = strSource.indexOf(ch);
if (temp==-1)
{
return 0;
}
}
if (strSource.indexOf(ch)==-1)
{
return 0;
}
else
{
return 1;
}
}

function FORM1_onsubmit()
{
if (chkitem(document.FORM1.uid.value)==0)
{
alert("Please enter right username!");
document.FORM1.uid.focus();
return false;
}
if ((document.FORM1.uid.vlaue=='') || (chkspc(document.FORM1.uid.value)==0)|| (chkspc(document.FORM1.uid.value)==2))
{
alert("Please enter username without space!");
document.FORM1.uid.focus();
return false;
}
if (chkitem(document.FORM1.pwd.value)==0)
{
alert("Please enter password!");
document.FORM1.pwd.focus();
return false;
}

if ( fucCheckLength(document.FORM1.uid.value) != document.FORM1.uid.value.length )
{
alert("The username is English only!");
document.FORM1.uid.focus();
return false;
}
if (fucCheckLength(document.FORM1.uid.value) <4 )
{
alert("The username is 4 letters at least!");
document.FORM1.uid.focus();
return false;
}
}



