function isFilled(key)
{     
	if(key.value == "" || key.value == null) 
	{
		key.focus();
		return false;
	}
	else      
	return true;
}

function chkemail(z)
{
    for ( i=0; i<= z.value.length - 1 ;i++ )
    {
    x = z.value.charAt(i);
    y = escape( x);
	if ( y != x && y !='%40')
		{
			alert('電子信箱錯誤');
			z.focus();
			return false;
			i = z.value.length;
		}
	}
	
	if ( z.value.indexOf('@') == -1 )
		{
			alert('電子信箱格式錯誤');
			z.focus();
			return false;
		}
	if ( z.value.indexOf('.') == -1 )
		{
			alert('電子信箱格式錯誤');
			z.focus();
			return false;
		}
	if (z.value.charAt(0)=='@') 
	{
		alert('電子信箱格式錯誤');
		z.focus();
		return false; //Email 第一個字不可為'@'	
	}	
		return true;
}

function checkform( form )
{
	if(isFilled(form.email) == false) 
	{
        	alert("請輸入email，謝謝");
             return false;
	}
	if(chkemail(form.email) == false) 
        {
             return false;
        }
}