var aat=0
var pt=0


function aguest(ii,pn) {
	document.mapo.action="lists.asp?ID=" + ii + "&guest=1&pname="+pn
	document.mapo.submit()
}

function lgin(ij,pn) {
	var ff=document.mapo.mladdr.value
	var sf=0
	
	ff=trim01(ff)

	if ( ff=="" ) {
		alert("メールアドレスを入力してください")
		document.mapo.mladdr.focus()
		sf=1
	}

	if ( (document.mapo.mladdr.value != ff) && (sf==0) ) {
		alert("スペースが含まれています")
		document.mapo.mladdr.value=ff
		document.mapo.mladdr.focus()
	} else {
		if ( ff != "") {
			if ( aat == 0 ) {
				alert("@が含まれていません")
				document.mapo.mladdr.value=ff
				document.mapo.mladdr.focus()
			} else {
				if ( aat > 1 ) {
					alert("@が" + aat + "個含まれています")
					document.mapo.mladdr.value=ff
					document.mapo.mladdr.focus()
				} else {
					if ( pt == 0 ) {
						alert(". が含まれていません")
						document.mapo.mladdr.value=ff
						document.mapo.mladdr.focus()
					} else {
						document.mapo.action="lists.asp?ID=" + ij + "&guest=0&pname="+pn
						document.mapo.submit()
					}
				}
			}
		}
	}
}	

function requlg(ij,pn) {
	var ff=document.mapo.mladdr.value
	var sf=0
	
	ff=trim01(ff)

	if ( ff=="" ) {
		alert("メールアドレスを入力してください")
		document.mapo.mladdr.focus()
		sf=1
	}

	if ( (document.mapo.mladdr.value != ff) && (sf==0) ) {
		alert("スペースが含まれています")
		document.mapo.mladdr.value=ff
		document.mapo.mladdr.focus()
	} else {
		if ( ff != "") {
			if ( aat == 0 ) {
				alert("@が含まれていません")
				document.mapo.mladdr.value=ff
				document.mapo.mladdr.focus()
			} else {
				if ( aat > 1 ) {
					alert("@が" + aat + "個含まれています")
					document.mapo.mladdr.value=ff
					document.mapo.mladdr.focus()
				} else {
					if ( pt == 0 ) {
						alert(". が含まれていません")
						document.mapo.mladdr.value=ff
						document.mapo.mladdr.focus()
					} else {
						//document.mapo.action="mlapolg.asp?guest=0&pname="+pn
						document.mapo.action="mloshirase.asp?guest=0&pname="+pn
						document.mapo.submit()
					}
				}
			}
		}
	}
}	

function soushin2(ij,pn) {
	var fp=9999
	var sf=0
	
	fp=trim01(fp)
	if ( fp == "") {
		alert("パスワードを入力してください")
		document.mapo.pass2.focus()
	} else {
		document.mapo.action="lists.asp?ID=" + ij + "&guest=0&pname="+pn
		document.mapo.submit()
	}
}	

function trim01(bb) {
    var sl=0
    var i=0
    var j=1

	i=bb.length
	aat=0
	if ( i == 0 ) {
    return ""
	}
	else {
		for (j=0; j<i; j++) {
			if ( bb.substring(j,j+1) == " " ) {
				bb= bb.substring(0,j) + bb.substring(j+1,i)
				i--
				j--
			}
			if ( bb.substring(j,j+1) == "@" ) {
				aat++
			}
			if ( bb.substring(j,j+1) == "." ) {
				pt++
			}
		}
	}
	return bb
}


