﻿// JavaScript Document
function playswf(sFile,sWidth,sHeight){
 document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+ sWidth +'" height="'+ sHeight +'">  ');
 document.write(' <param name="movie" value="'+ sFile +'">  ');
 document.write(' <param name="quality" value="high">  ');
 document.write(' <param name="wmode" value="transparent">  ');
 document.write(' <embed src="'+ sFile +'" wmode="transparent" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+ sWidth +'" height="'+ sHeight +'"></embed>  ');
 document.write('</object> ');
}

function FormSubmit() {
    var strErr="";
	re = new RegExp(/^(\d{4})-(\d{1,2})-(\d{1,2})$/);


 	if (!CheckEmail(document.getElementById("email").value)) strErr=strErr+"请正确填写您的电子邮件!\n";

	if (strErr.length>0)
	{
		window.alert(strErr);
		return false;
	}else
	{
       document.getElementById("edm").submit();
		return true;
	}

  }  
  
  
function CheckEmail(email) {
		 ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";
		 ok2 = "[].@-_";

    for(i=0; i < email.length ;i++){
        if(ok.indexOf(email.charAt(i))<0){
      //  alert("email信箱格式不对!\n");
            return (false);
        }
    }
       if(ok2.indexOf(email.charAt(0))>=0){
       // alert("email信箱格式不对!\n");
            return (false);
        }

          if(ok2.indexOf(email.charAt(email.length-1))>=0){
      //  alert("email信箱格式不对!\n");
            return (false);
        }

    if(!((email.indexOf('@', 0) != -1) && (email.indexOf('.', 0) != -1) && (email.length>5)))
    { //alert("email信箱格式不对!\n");
    return false;
    	}
      if(email.indexOf('@') !=email.lastIndexOf('@'))
    { //alert("email信箱格式不对!\n");
    return false;
    	}
    return true;
}

function FormClear() {
	if (document.getElementById("email").value=="请输入email订阅电子通讯") {
	document.getElementById("email").value="";
	}
}