﻿//var s = document.createElement("script");
//s.src = " http://www.z6.cn/Scripts/tender.js";
//document.getElementsByTagName("HEAD")[0].appendChild(s);

//取得招标信息 的浏览数
function commission_gethits(context) {
    if (context != null) {
        if (context.pid != null && context.pid != "") {
            //            DaShi.WebSite.Services.Commissions.Search(context.pid, commission_gethits_response, null, context);
            DaShi.WebSite.Services.Commissions.Hits(context.pid, commission_gethits_response, null, context);
        }
    }
}
function commission_gethits_response(hits,context) {
    if (context != null && hits != null) {
        context.list.innerHTML = hits;
    }
}
//招标信息列表
function commissionList_get(cc,pageIndex, pageSize,context){

    DaShi.WebSite.Services.Commissions.commissionList(cc, pageIndex, pageSize, commissionList_get_response, null, context);
}

function search123(k) {
    var _casecategory, _ps = 0;

    _casecategory = k;

    location.href = "CommissionTenderList.aspx?ac=ls&pn=1&casecategory=" + _casecategory.toString() + "&ps=" + _ps.toString();
}

//       function showTenderName(category) {
//           var temp = YAHOO.tender.search(category, null);
//            
//            if (temp)
//                return temp;
//            else
//                return false;
//        }

//        var ttt = null;
//        
//       Write= function  {

//            category1 = showTenderName(10101);
//            if (category1) {
//                categroy2 = showTenderName(1010102);
//                if (categroy2) {
//                    ttt = categroy2.n.substring(0, 2).Trim();
////                    document.write(categroy2.n.substring(0, 2).Trim());
//                }
//            }
//        }
function commissionList_get_response(list, context){

    if (!list || !context)
        return;
    
    var html = "";
    var tit="";
    var http = "";

    switch (context.cc)
       {
           case 10101:
               tit = "最新纯设计招标";
               http = "search123(10101)";
               break;
           case 10102:
               tit = "最新装修招标";
               http = "search123(10102)";
               break;
           case 10103:
               tit = "最新产品直销求购";
               http = "search123(10103)";
               break;
       
       }
        
                html +='<h4>'+

                   '<span ><a onclick=' + http + ' style="cursor: pointer">MORE</a>' +
                   '</span>' + tit +
                   '</h4>';


                html += '<ul>';
    
    for(var i = 0; i < list.length; i++){
    
            if(!list[i])
            continue;


        var d2 = new Date(list[i].JoinTime);
        var sYMD2 = (parseInt(d2.getMonth(), 10) + parseInt(1)).toString() + "-" + d2.getDate().toString();



        html += '<li>' +
                '<span>('+sYMD2+')</span>'+
                '<a title="'+list[i].Title +'" href="http://www.z6.cn/CommissionDetail_pid=' + list[i].ID +'.html">'+list[i].Title+
                '</a>'+
                '</li>';
        }        
       html+='</ul>';
                
            context.object.innerHTML = html;
            
    
}