function AtLink(){

	if(document.forms[0].id.value == "" || document.forms[0].pwd.value == ""){
		alert('ユーザIDとパスワードを入力して下さい');
		return false;
	}

	if(CheckLength(document.forms[0].id.value,1)){
		alert('ユーザIDは半角英数字のみ使用して下さい');
		return false;
	}


	if(CheckLength(document.forms[0].pwd.value,1)){
		alert('パスワードは半角英数字のみ使用して下さい');
		return false;
	}

	var pwd = document.forms[0].pwd.value;
	if(pwd.length != 4){
		alert('パスワードは4ケタの英数字を入力して下さい');
		return false;
	}

}

function CheckLength(str,flg) {
    for (var i = 0; i < str.length; i++) {
        var c = str.charCodeAt(i);
        // Shift_JIS: 0x0 ～ 0x80, 0xa0 , 0xa1 ～ 0xdf , 0xfd ～ 0xff
        // Unicode : 0x0 ～ 0x80, 0xf8f0, 0xff61 ～ 0xff9f, 0xf8f1 ～ 0xf8f3
        if ( (c >= 0x0 && c < 0x81) || (c == 0xf8f0) || (c >= 0xff61 && c < 0xffa0) || (c >= 0xf8f1 && c < 0xf8f4)) {
            if(!flg) return true;
        } else {
            if(flg) return true;
        }
    }
    return false;
}

