 function CheckForm(){
  if(login.user_name.value==""){
    alert("请填写用户名或昵称");
    login.user_name.focus();
    return false;
  }
  if(login.password.value == ""){
    alert("请填写密码");
    login.password.focus();
    return false;
  }

  return true;
}
function CodeCookie(str)
{  var strRtn="";
  for (var i=str.length-1;i>=0;i--)
  {
  strRtn+=str.charCodeAt(i);
  if (i) strRtn+="O";
  }
  return strRtn;
}
function DecodeCookie(str)
{
  var strArr;
  var strRtn="";
  strArr=str.split("O");
  for (var i=strArr.length-1;i>=0;i--) 
  strRtn+=String.fromCharCode(eval(strArr[i]));
  return strRtn;
}
var status = '';
function checkCookie(){

    var allcookie = document.cookie.split('; ');
//    var isautologin = false;
    var islogon = false;
    for(var i=0;i<allcookie.length;i++){
        var cookiename = allcookie[i].split('=')[0];
        if(cookiename=='mop_logon'){
            islogon = true;
        }
        if(cookiename == 'mop_status'){
          var tmpString = unescape(allcookie[i].split('=')[1]);
          status = DecodeCookie(tmpString);
        }
    }

    if(islogon == true){
        return true;
    }else{
        return false;
    }

}

function checkAutoCookie(){
    var allcookie = document.cookie.split('; ');
    var isautologin = false;
    for(var i=0;i<allcookie.length;i++){
        var cookiename = allcookie[i].split('=')[0];
        if(cookiename=='mop_auto_login'){
            isautologin = true;
        }
    }

    if(isautologin == true){
        return true;
    }else{
        return false;
    }
}

if( !checkCookie() && checkAutoCookie()){
  window.location='http://passport.mop.com/AutoLogin?url=http://mm.mop.com';
}

if(checkCookie()){//logon
  var userName = '';
  var mopMail = '';
  var mp = '';
  var mm = '';
  var stats = '';
  var luck = '';
  var strIp = '';
  var loginTimes = '';
  status.replace('?','O').replace('?','O').replace('?','O');
  try{
    var stat = status.split("|");
    userName = stat[0];
    mopMail = stat[1];
    mp = stat[2];
    mm = stat[3];
    stats = stat[4];
    luck = stat[5];
    strIp = stat[6];
    loginTimes = stat[7];
  }catch(e){

  }
  
  
document.write('<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">');
document.write('<tr>');
document.write('<td height="20" class="btb_658E00">昵　称： '+userName+' </td>');
document.write('</tr>');
document.write('<tr>');
document.write('<td height="20" class="btb_658E00">用户名： '+mopMail+' </td>');
document.write('</tr>');
document.write('<tr>');
document.write('<td height="20" class="bt_658E00">MP： '+mp+' </td>');
document.write('</tr>');
document.write('<tr>');
document.write('<td height="10" class="bt_658E00">MM： '+mm+'</td>');
document.write('</tr>');
document.write(' <tr>');
document.write(' <td height="10" class="bt_658E00">');
document.write('<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="box_FBFFE0" style="height:30px">');
//document.write('<tr>');
//document.write('<td align="center" class="bt_658E00"><a href="/mmtrans.jsp"><font class="linkcolor1">我要消费</font></a></td>');
//document.write('</tr>');
document.write('</table>            </td>');
document.write('</tr>');
document.write('<tr>');
document.write('  <td height="30" align="right" valign="bottom"><a href="http://passport.mop.com/Logout?backUrl='+document.URL+'"><img src="/images/login_img06.jpg" border=0 /></a></td>');
document.write('</tr>');
document.write('</table>');
}
else{//unlogin
document.write('<table width="93%" border="0" align="center" cellpadding="0" cellspacing="0">');
document.write('<form name=login action="http://passport.mop.com/Login?url='+document.URL+'" onSubmit="return CheckForm();" method="POST">');
document.write('        <tr>');
document.write('         <td height="23"><table>');
document.write('              <tr>');
document.write('                <td height="21"> ');
document.write('                  <select name="flag">');
document.write('                    <option value="1">用户名</option>');
document.write('                    <option value="0" selected>昵称</option>');
document.write('                  </select>');
document.write('                  <input type="text" name="user_name" style="width:60px"></td>');
document.write('              </tr>');
document.write('              <tr>');
document.write('                <td height="23" class="white1">密码 ');
document.write('                  <input type="password" name="password"  style="width:95px">');
document.write('                </td>');
document.write('              </tr>');
document.write('              <tr>');
document.write('                <td height="18" align="center" class="white1"> ');
document.write('                  <input type="checkbox"  name="auto_login" value="1">');
document.write('                  自动登录</td>');
document.write('              </tr>');
document.write('              <tr>');
document.write('                <td height="21" align="center"><input type="image" src="/images/login_img04.jpg">&nbsp;&nbsp;<a href="http://passport.mop.com/sign/login_1.jsp"><img src="/images/login_img05.jpg" border="0"></a></td>');
document.write('              </tr>');
document.write('            </table> </td>');
document.write('        </tr>');
document.write('        </form>');
document.write('      </table>');

}




