﻿//是否登录
function isLogin_get(context) {
    DaShi.WebSite.Services.Users.IsLogin(isLogin_response, null, context)
}


//最新更新
function lastupdate_get(usertype, pageIndex, pageSize, context){

    DaShi.WebSite.Services.Users.LastUpdateList(usertype, pageIndex, pageSize, lastupdate_get_response, null, context);
}

function lastupdatevip_get(usertype, pageIndex, pageSize, context){

    DaShi.WebSite.Services.Users.LastUpdateVipList(usertype, pageIndex, pageSize, lastupvipupdate_get_response, null, context);
}

function lastupvipupdate_get_response(list,context){

    if (!list || !context)
        return;
    
    var html = "";    
    for(var i = 0; i < list.length; i++){
    
        if(!list[i])
            continue;
            
            html += '<li><a href="http://'+list[i].Domain +'.z6.cn/" target="_blank">'+
                    '<img width="118" height="44" src="http://www.z6img.cn/upload/Face/Enterprises/'+ list[i].LogoURL+'" alt="'+ list[i].Name+'" border="0" />'+
                    
                    '</a></li>';
                    
                    }
context.object.innerHTML = html;
}

function lastupdate_get_response(list, context){

    if (!list || !context)
        return;
    
    var html = "";    
    for(var i = 0; i < list.length; i++){
    
        if(!list[i])
            continue;
            
        if(context.usertype == 4 || context.usertype == 32){

            html += "<li><a href=\"http://" + list[i].Domain + ".z6.cn/\" target=\"blank\"> <img height=\"49\" src=\"http://www.z6img.cn/upload/face/users/" + list[i].Face + "\" width=\"48\" border=\"0\" class=\"imageborder\"></a><br />" +
                    "<span><a href=\"http://" + list[i].Domain + ".z6.cn/\" target=\"blank\">" + list[i].RealName + "</a></span></li>";
        }
        else if (context.usertype == 8){
        
            html += '<li>' +
                    '   <a href="http://' + list[i].Domain + '.z6.cn/" target="_blank">' +
                    '       <img class="wenphoto-left" height="46" src="http://www.z6img.cn/upload/face/users/' + list[i].Face + '"' +
                    '           width="65" border="0" alt="' + list[i].NickName + '" /></a>' +
                    '   <a href="http://' + list[i].Domain + '.z6.cn/" target="_blank" title="' + list[i].NickName + '">' +
                            list[i].NickName +    
                    '   </a>' +
                    '</li>';
        }
//        else if (context.usertype==16){
//        
//            html += '<ul><li><a href="http://'+list[i].Domain +'.z6.cn/" target="_blank">'+
//                    '<img width="118" height="44" src="http://202.75.222.17/upload/Face/Enterprises/'+ list[i].LogoURL+'" alt="'+ list[i].Name+'" border="0" />'+
//                    
//                    '</a></li>'+

//                    '</ul>';
        
        
//        }
        else{
        
            html += '<li style="float: left; width: 70px; height: 89px; overflow: hidden">'+
                    '   <table cellspacing="0" cellpadding="0" width="60" border="0">'+
                    '       <tr>'+
                    '          <td align="center" width="60">'+
                    '               <a class="text_two_a" href="http://' + list[i].Domain + '.z6.cn/" target="_blank">'+
                    '                   <img class="imgborder" height="52" src="http://www.z6img.cn/upload/face/users/' + list[i].Face + '"'+
                    '                       width="60" border="0" alt="' + list[i].NickName + '-大师网z6.cn" /></a>'+
                    '           </td>'+
                    '       </tr>'+
                    '       <tr>'+
                    '           <td align="center" height="22">'+
                    '               <a class="text_two_a" href="http://' + list[i].Domain + '.z6.cn/" target="_blank" title="' + list[i].NickName + '">'+
                    '                   <nobr>' + list[i].RealName + '</nobr>' +
                    '               </a>'+
                    '           </td>'+
                    '       </tr>'+
                    '   </table>' +
                    '</li>';
        }
    }

    context.object.innerHTML = html;
}


function current_user_get(userid) {

    DaShi.WebSite.Services.Users.GetCurrentUserFullInfo(userid, current_user_get_response, null, null);
}

function current_user_get_response(info) {
    if (!info)
        return;
    //通用
    var theme = document.getElementById("__theme");
    var rank = document.getElementById("__rank");
    var face = document.getElementById("__face");
    var expertise = document.getElementById("__expertise");
    var fee = document.getElementById("__fee");
    var experience = document.getElementById("__experience");
    var declaration = document.getElementById("__declaration");
    var nickName = document.getElementById("__nickName")
    var realname = document.getElementById("__realname");
    var threeDayHits = document.getElementById("__threeDayHits");
    var weekHits = document.getElementById("__weekHits");
    var hits = document.getElementById("__hits");
    var compositeIndex = document.getElementById("__compositeIndex")
    
    if(theme != null)
        theme.href = info.Theme;
    if (rank != null)
        rank.innerHTML = info.Rank;
    if (face != null) {
        face.src = "http://www.z6img.cn/" + info.Face;
        face.parentNode.href = face.src.replace("s_","");
    }

    if (expertise != null)
        
        expertise.innerHTML = info.Expertise;

    if (fee != null)
        fee.innerHTML = info.Fee;
    
    if (experience != null)
        experience.innerHTML = info.Experience;
    if(nickName != null)
        nickName.innerHTML = info.NickName.substring(0, 18);
    if (declaration != null)
        declaration.innerHTML = info.Declaration;
    
    if( realname != null)
        realname.innerHTML = info.RealName;
    if (threeDayHits != null)
        threeDayHits.innerHTML = info.DayHits + info.ThreeDayHits;
    if (weekHits != null)
        weekHits.innerHTML = info.DayHits + info.WeekHits;
    if(hits != null)
        hits.innerHTML = info.Hits;
    if (compositeIndex != null) {
        compositeIndex.innerHTML = "<a href='http://www.z6.cn/help.aspx?cid=1' style='color:#ff0000;text-decoration:underline;'>" + info.CompositeIndex + "</a>";
        if (info.CompositeIndex >= 16000) {
            if (info.CompositeIndex >= 48000) {
                compositeIndex.innerHTML += "<a href='http://www.z6.cn/help.aspx?cid=1'><img src=\"http://www.z6img.cn/images/sun.gif\" height=\"15\" align=\"15\" align=\"absmiddle\" border=\"0\" /></a>";
                compositeIndex.innerHTML += "<a href='http://www.z6.cn/help.aspx?cid=1'><img src=\"http://www.z6img.cn/images/sun.gif\" height=\"15\" align=\"15\" align=\"absmiddle\" border=\"0\" /></a>";
                compositeIndex.innerHTML += "<a href='http://www.z6.cn/help.aspx?cid=1'><img src=\"http://www.z6img.cn/images/sun.gif\" height=\"15\" align=\"15\" align=\"absmiddle\" border=\"0\" /></a>";
                info.CompositeIndex -= 48000;
            }
            else if (info.CompositeIndex >= 32000) {
            compositeIndex.innerHTML += "<a href='http://www.z6.cn/help.aspx?cid=1'><img src=\"http://www.z6img.cn/images/sun.gif\" height=\"15\" align=\"15\" align=\"absmiddle\" border=\"0\" /></a>";
            compositeIndex.innerHTML += "<a href='http://www.z6.cn/help.aspx?cid=1'><img src=\"http://www.z6img.cn/images/sun.gif\" height=\"15\" align=\"15\" align=\"absmiddle\" border=\"0\" /></a>";
                info.CompositeIndex -= 32000;
            }
            else if (info.CompositeIndex >= 16000) {
            compositeIndex.innerHTML += "<a href='http://www.z6.cn/help.aspx?cid=1'><img src=\"http://www.z6img.cn/images/sun.gif\" height=\"15\" align=\"15\" align=\"absmiddle\" border=\"0\" /></a>";
                info.CompositeIndex -= 16000;
            }
            
        }
        if (info.CompositeIndex >= 4000) {
            if (info.CompositeIndex >= 12000) {
                compositeIndex.innerHTML += "<a href='http://www.z6.cn/help.aspx?cid=1'><img src=\"http://www.z6img.cn/images/moon.gif\" height=\"15\" align=\"15\" align=\"absmiddle\" border=\"0\" /></a>";
                compositeIndex.innerHTML += "<a href='http://www.z6.cn/help.aspx?cid=1'><img src=\"http://www.z6img.cn/images/moon.gif\" height=\"15\" align=\"15\" align=\"absmiddle\" border=\"0\" /></a>";
                compositeIndex.innerHTML += "<a href='http://www.z6.cn/help.aspx?cid=1'><img src=\"http://www.z6img.cn/images/moon.gif\" height=\"15\" align=\"15\" align=\"absmiddle\" border=\"0\" /></a>";
               info.CompositeIndex -= 12000;
            }
            else if (info.CompositeIndex >= 8000) {
            compositeIndex.innerHTML += "<a href='http://www.z6.cn/help.aspx?cid=1'><img src=\"http://www.z6img.cn/images/moon.gif\" height=\"15\" align=\"15\" align=\"absmiddle\" border=\"0\" /></a>";
            compositeIndex.innerHTML += "<a href='http://www.z6.cn/help.aspx?cid=1'><img src=\"http://www.z6img.cn/images/moon.gif\" height=\"15\" align=\"15\" align=\"absmiddle\" border=\"0\" /></a>";
                info.CompositeIndex -= 8000;
            }
            else if (info.CompositeIndex >= 4000) {
            compositeIndex.innerHTML += "<a href='http://www.z6.cn/help.aspx?cid=1'><img src=\"http://www.z6img.cn/images/moon.gif\" height=\"15\" align=\"15\" align=\"absmiddle\" border=\"0\" /></a>";
            info.CompositeIndex -= 4000;
            }
        }
        if (info.CompositeIndex >= 0) {
            if (info.CompositeIndex >= 3000) {
                compositeIndex.innerHTML += "<a href='http://www.z6.cn/help.aspx?cid=1'><img src=\"http://www.z6img.cn/home/images/seller03.gif\" height=\"15\" align=\"15\" align=\"absmiddle\"  border=\"0\" /></a>"
            }
            else if (info.CompositeIndex >= 2000) {
            compositeIndex.innerHTML += "<a href='http://www.z6.cn/help.aspx?cid=1'><img src=\"http://www.z6img.cn/home/images/seller02.gif\" height=\"15\" align=\"15\" align=\"absmiddle\" border=\"0\" /></a>"
            }
            else if (info.CompositeIndex >= 1000) {
            compositeIndex.innerHTML += "<a href='http://www.z6.cn/help.aspx?cid=1'><img src=\"http://www.z6img.cn/home/images/seller01.gif\" height=\"15\" align=\"15\" align=\"absmiddle\" border=\"0\" /></a>"
            }
        }
    }


    //设计师
    if (info.UserType == 32) {

        
    }
    
} 