//===============================================
// 判断用户是否登录。参数isIframe,传参true或者false
//
// 【参数】isIframe：如果是iframe页面，传true；如果是父页面，传false
//=============================================== 
function checkIsLogin(isIframe) {
      $.ajax({
             url:"/sse-international-web/front/ui/checkIsLogin",
             dataType:"jsonp",
             jsonp:"jsonpcallback",
             success:function(data){
                 var result = data.result;
                 if (result == "success") {
                 } else if (result == "failure") {
                       alert("请您登录后操作！");
                       //跳转到登录界面
                       if (isIframe) {
                    	   parent.location.href="/hdzx/yhzcdl/index.shtml";
                       } else {
                    	   location.href="/hdzx/yhzcdl/index.shtml";
                       }
                 } else {
                       //alert("未知错误！");
                 }
             }
        });
}
//处理头部的登录
function dealHeaderHtml() {
   $.ajax({
          url:"/sse-international-web/front/ui/checkIsLogin",
          dataType:"jsonp",
          jsonp:"jsonpcallback",
          success:function(data){
              var result = data.result;
              if (result == "success") {
                  $("#loginHeadHtml").html("<em class=\"yellow\">欢迎您，"+data.username+"<span>|</span><a href=\"#\" onclick=\"location.href='/hdzx/index.shtml'\">进入互动中心</a><span>|</span><a href=\"#\" onclick=\"intoEditWebuser();\">修改个人信息</a><span>|</span><a href=\"#\" onclick=\"logout();\">退出</a></em>");
              } else if (result == "failure") {
            	  $("#loginHeadHtml").html("<em class=\"yellow\"><a href=\"#\" onclick=\"location.href='/hdzx/yhzcdl/index.shtml'\">登录</a><span>|</span><a href=\"#\" onclick=\"location.href='/hdzx/yhzcdl/index.shtml?mPage=intoRegisterStep1&mHeight=700'\">注册</a></em>");
              } else {
                    //alert("未知错误！");
              }
          }
     });
}
//退出登录
function logout() {
   $.ajax({
          url:"/sse-international-web/front/ui/logout",
          dataType:"jsonp",
          jsonp:"jsonpcallback",
          success:function(data){
              location.reload();
          }
     });
}
//修改个人信息
function intoEditWebuser() {
	location.href="/hdzx/yhzcdl/index.shtml?mPage=intoEditWebuser&mHeight=396";
}
