﻿function txtChange(t)
{
    if (t.value=='请输入E-mail地址'){t.value=''}
}
function TtxtChange(t)
{
    if (t.value==''){t.value='请输入E-mail地址'}
}

function ChangeMobile1(t)
{
    if (t.value=='请输入手机号码'){t.value=''}
}

function ChangeMobile2(t)
{
     if (t.value==''){t.value='请输入手机号码'}
}
function TakeInfoSuccess()
{
   if($("#txtEmail").val().isEmail())
     alert('恭喜您,成功订阅俞兆林最新活动信息!');
   else
     alert("Email格式输入错误!");
}
function GetCouponsSuccess()
{
    if($("#MobileNum").val().isMobile())
       document.getElementById('postData').src='/GetCoupons.aspx?MobileNum='+$("#MobileNum").val();
    else
       alert("手机号格式输入错误!");
}
function MessageAlert(m)
{
   alert(m);
}

String.prototype.Trim = function() 
{ 
    var m = this.match(/^\s*(\S+(\s+\S+)*)\s*$/); 
    return (m == null) ? "" : m[1]; 
}
String.prototype.isMobile = function() 
{
    return (/^13[0-9]{1}[0-9]{8}$|^15[0-9]{1}[0-9]{8}$|18[0-9]{1}[0-9]{8}$/.test(this.Trim())); 
}
String.prototype.isEmail = function() 
{
    return (/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(this.Trim()));
}
