// 手机号码有效性检查
function CheckMobileSub( mbNum )
{
	// [in] mbNum:		发送方手机号
	regexp_value = new RegExp ( '^([ \t\\+]*)13([0-9]{9})([^A-Za-z]*)$', 'i' );
	if ( mbNum.length != 11 || !mbNum.match( regexp_value ) )
	{
		alert( "请重新输入合法的手机号码(以'13'开头的11位数字)！" );
		return false;
	}
	else if( mbNum < 13500000000 || mbNum > 13999999999)
	{
		alert( "暂不支持您输入的手机号码。" );
		return false;
	}
	
	return true;
}

// 弹出窗口
function OpenWin( gourl , w, h ,l,t)
{
	//  [in] gourl:		弹出窗口的url
 	//  [in] w:     	弹出窗口的宽度
    //  [in] h:    		弹出窗口的高度
    //  [in] l:			弹出窗口初始位置(screen left)
    //  [in] t:			弹出窗口初始位置(screen top)
    var m_left = ( screen.width  - w  ) / 2;
    var m_top  = ( screen.height - h ) / 2;

	if( l != null && l != '' )m_left= m_left + l / 2;
	if( t != null && t != '' )m_top= m_top + t / 2;
    param = 'resizable=0, scrollbars=0, width=' + w + ', height=' + h + ', left=' + m_left + '; top=' + m_top;
    window.open ( gourl, '', param );
}

function checksub(frm)
{
	var strDetail = '';
	mbNum = frm.sms_no.value;
	if(!CheckMobileSub(mbNum))
		return false;

	for(i=0;i<frm.elements.length;i++)
	{
		var myStr = new String(frm.elements[i].name);
		var myString = myStr.substr(0,9);
		if(myString == 'check_sub')
			if(frm.elements[i].checked == true)
				strDetail = strDetail+"&"+myStr+"="+frm.elements[i].value;
	}
	if(strDetail == ''){
		alert("请选择至少一项服务！");
		return false;
	}
	strDetail = strDetail+"&sms_no="+frm.sms_no.value;
	OpenWin("http://sms.3721.com/award/award03.htm?"+strDetail,'500','570','','');
	return false;
}

function send(id,ct,w,h)
{
	var winurl;
	var l = '';
	var t = '';
	if(w == null || w == '') w = 440;
	if(h == null || h == '') h = 260;
	winurl = "http://sms.3721.com/default.htm?act=fs&id="+id+"&ct="+ct;
        winurl = winurl+'&agent_name=SMS_RIGHT_NORESULT';
	OpenWin( winurl , w, h ,l,t)
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}