function SingleSelect(Obj,Msg)   
 {   
 var bl;   
 bl=false;   
 for (var i=0;i<Obj.length;i++)   
  {   
  if (Obj[i].checked){bl=true;break;}   
  }   
 if (!(bl)){alert(Msg);Obj[0].focus();}   
 return bl;   
 }   
    
function joinCheck(){
	var str;

	if (document.cards.sender_name.value == ""){
		alert("请填写你的姓名！");
		document.cards.sender_name.focus();
		return false;
	}

	if (document.cards.sender_email.value == ""){
		alert("请填写你的EMAIL地址！");
		document.cards.sender_email.focus();
		return false;
	}

	if ( isEmail(document.cards.sender_email.value) == false){
		alert("你的EMAIL地址有误！");
		document.cards.sender_email.focus();
		return false;
	}

	if (document.cards.recip_name.value == ""){
		alert("请填写收卡人姓名！");
		document.cards.recip_name.focus();
		return false;
	}


	if (document.cards.recip_email.value == ""){
		alert("请填写收卡人EMAIL地址！");
		document.cards.recip_email.focus();
		return false;
	}

	if ( isEmail(document.cards.recip_email.value) == false){
		alert("收卡人的EMAIL地址有误！");
		document.cards.recip_email.focus();
		return false;
	}


	if (document.cards.the_title.value == ""){
		alert("请填写贺卡标题！");
		document.cards.the_title.focus();
		return false;
	}

	if (document.cards.the_message.value == ""){
		alert("请填写贺卡正文内容！");
		document.cards.the_message.focus();
		return false;
	}
			return true;
}

function isEmail(strEmail)
{
    if (strEmail == null) return false;
    strEmail += "";
    
    //检查Email的长度
    var iLen;
    iLen = strEmail.length;
    //alert("iLen: " + iLen);
    if (iLen < 5)
    {
        alert("length is not enough");
        return false;
    }

    //检查Email的字符组成
    var strRngAll;
    var strRng1, strRng2, strRng3, strRng4;

    strRng1    = "0123456789";
    strRng2    = "abcdefghijklmnopqrstuvwxyz";
    strRng3    = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    strRng4    = "_@.";
    strRngAll    = strRng1 + strRng2 + strRng3 + strRng4;
    
    var iCount;
    var iChrIdx;

    //-- 是否含有非法字符
    for (iCount = 0; iCount < iLen; iCount ++)
    {
        iChrIdx = strRngAll.indexOf(strEmail.charAt(iCount));
        if (iChrIdx == -1)
        {
            alert("invalid char ..\niChrIdx: " + iChrIdx + "\nchar: " + strEmail.charAt(iCount));
            return false;
        }
    }
    
    //-- 是否首字符是数字
    iChrIdx = strRng1.indexOf(strEmail.charAt(0));
    if (iChrIdx != -1)
    {
        alert("invalid 1st char ..");
        return false;
    }
    
    //检查@字符
    var iAtIdx, iAtIdx1;
    
    iAtIdx        = strEmail.indexOf("@");
    iAtIdx1    = strEmail.lastIndexOf("@");
    //alert("iAtIdx: " + iAtIdx + "\niAtIdx1: " + iAtIdx1);

    //-- 是否存在@字符
    if (iAtIdx < 0)
    {
        alert("there is no @");
        return false;
    }
    
    //-- 是否有2个以上的@字符
    if (iAtIdx != iAtIdx1)
    {
        alert("there r more than ONE @");
        return false;
    }
    
    //-- 是否@字符在首位上
    if (iAtIdx == 0)
    {
        alert("@ is in wrong pos");
        return false;
    }
    
    //检查.字符
    var iDotIdx, iDotIdx1;
    
    iDotIdx    = strEmail.indexOf(".");
    iDotIdx1    = strEmail.lastIndexOf(".");
    //alert("iDotIdx: " + iDotIdx + "\niDotIdx1: " + iDotIdx1);
    
    //-- 是否存在.字符
    if (iDotIdx < 0)
    {
        alert("there is no .");
        return false;
    }
    
    //-- 是否@字符在末位上
    if (iDotIdx1 == iLen - 1) 
    {
        alert(". is in wrong pos");
        return false;
    }
    
    //检查.字符和@字符的顺序
    if (iDotIdx < iAtIdx + 2) 
    {
        alert("@ & . r in wrong pos");
        return false;
    }

    return true;
}

