function check_address(){
    atmark = 0;
    piriod = 0;
	
  var error = 0;
	cc = document.getElementById("contact").email.value.charAt(0);
    if (((cc < "0") || ("9" < cc)) && ((cc < "a") || ("z" < cc)) && ((cc < "A") || ("Z" < cc))) {
        alert("メールアドレスの書式が不正です。");
        document.getElementById("contact").email.focus();
        return(false);
    }
    cc = document.getElementById("contact").email.value.charAt(document.getElementById("contact").email.value.length - 1);
    if (((cc < "0") || ("9" < cc)) && ((cc < "a") || ("z" < cc)) && ((cc < "A") || ("Z" < cc))) {
        alert("メールアドレスの書式が不正です。");
        document.getElementById("contact").email.focus();
        return(false);
    }
    for (i = 1;i < document.getElementById("contact").email.value.length;i++) {
        cc = document.getElementById("contact").email.value.charAt(i);
        if (((cc < "0") || ("9" < cc)) &&
        ((cc < "a") || ("z" < cc)) &&
        ((cc < "A") || ("Z" < cc)) &&
        ("@" != cc) &&
        ("." != cc) &&
        ("_" != cc) &&
        ("-" != cc)) {
        alert("メールアドレスの書式が不正です。")
        document.getElementById("contact").email.focus();
        return(false);
        }
        else if (cc == "@") atmark++;
        else if (cc == ".") piriod++;
    }
    if (atmark < 1) {
        alert("メールアドレスの書式が不正です。");
        document.getElementById("contact").email.focus();
        return(false);
    }
    else if (atmark > 1) {
        alert("メールアドレスの書式が不正です。");
        document.getElementById("contact").email.focus();
        return(false);
    }
    if (piriod < 1) {
        alert("メールアドレスの書式が不正です。");
        document.getElementById("contact").email.focus();
        return(false);
    } 
}	 

var testresults
function checkemail(){
var str=document.contact.email.value
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str))
testresults=true
else{
alert("メールアドレスの書式が不正です。")
testresults=false
}
return (testresults)
}

function checkbae(){
if (document.layers||document.getElementById||document.all)
return checkemail()
else
return true
}

var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=yes,scrollbars=yes,resizable=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}
document.write("<link href=\"style1.css\" rel=\"stylesheet\" type=\"text/css\">");





document.write("<form action=\"http://www.ds-style.com/demo/MAIL/mail.php\" method=\"post\" name=\"contact\" id=\"contact\" onsubmit=\"return check_address()\">");

  document.write("<table border=\"0\" cellspacing=\"1\">");
    document.write("<tr>");
	  document.write("<td><a style=\"cursor:pointer;cursor: hand;\" onclick=\"javascript:popUpWindow('http://www.ds-style.com/demo/MAIL/info.html',100,100,500,500);\" title=\"メールマガジン購読について\">メールマガジン購読について</a></td>");
    document.write("</tr>");
    document.write("<tr>");
      document.write("<td>メールアドレス</td>");
    document.write("</tr>");
    document.write("<tr>");
      document.write("<td><input type=\"text\" name=\"email\" id=\"email\" value=\"\">");
    document.write("</tr>");
    document.write("<tr>");
      document.write("<td><input name=\"send_type\" type=\"checkbox\" value=\"html_mail\" checked>");
      document.write("HTML形式");
      document.write("<input name=\"Submit\" type=\"submit\" value=\"送信する\"></td>");
    document.write("</tr>");
  document.write("</table>");
  document.write("<input type=\"hidden\" name=\"act\" value=\"process\">");
  document.write("<input type=\"hidden\" name=\"select\" value=\"start\">");
  document.write("<input type=\"hidden\" name=\"return_url\" value=\"mail.php\">");
  document.write("<input type=\"hidden\" name=\"ref\" value=\"\">");
document.write("</form>");
//document.write('<small style="color:red"></small>');
//document.write('<!--digitalstudio-->');
