﻿// JScript 文件
var CarList=null;
var UseList=null;
var PriceList=null;
var RecommandList=null;

function ShowBrandList(updateElemID)
{
     var url = "../ajaxPage/searchResponse.ashx";
     var pars = (window.location.search=='')?'?type=cartype':(window.location.search) +'&type=cartype';
     document.getElementById(updateElemID).update('正在生成列表...');
     //loadJS.push(url+pars,"utf-8", function(){InitBrandList(updateElemID)});
     new Ajax.Request(url+pars, {method:"get", onComplete:function(request){InitBrandList(request,updateElemID)},evalScripts:true,asynchronous:true} ); 
}
function InitBrandList(request,updateElemID)
{
    CarList= eval('['+request.responseText+']');
    var strdiv="";
    if(CarList==null || CarList.length <= 0)
    {
        document.getElementById(updateElemID).style.display="none";
        return;
    }
    
    if(GetIntValue(DecodeUrlParameter('pid')) > 0)//单品牌时 冒泡排序
    {
        var i,j;
        for(i=CarList.length-1;i>= 0;i--){
            for(j=0;j<= i-1;j++){
                if(CarList[j].carcount < CarList[j + 1].carcount){
                  var temp=CarList[j];
                  CarList[j]=CarList[j + 1];
                  CarList[j + 1]=temp;
                }
             }
        }
    }
    strdiv+="<h2 class=\"mclb_tit1\">按品牌选择</h2>";
    strdiv+="<ul>";
    for(var i=0;i<CarList.length;i++)
    {  
        var parapart = document.location.search;
        parapart = parapart.replace(/^\?+/, '').replace(/#+$/, '');
        var arrparas = parapart.split('&');
        var ___iterator_;
        var temp='';
        for (___iterator_ = 0; ___iterator_ < arrparas.length; ++___iterator_)
        {
            var urlparacomp = arrparas[___iterator_].split('=');
            if (urlparacomp[0] != 'pid' && urlparacomp[0] != 'bid'&&urlparacomp[0] != 'brandIds'&&urlparacomp[0] != 'productIds'){
            temp += '&' + urlparacomp[0]+ '='+ urlparacomp[1];
            }
         }
        strdiv+="<li>";
        strdiv+="<a class=\"mc_cola\" href ='carlist.aspx?pid=" +CarList[i].ProducerId+"&bid=" + CarList[i].BrandId + "&cid="+CarList[i].CarId+temp+"' target=\"_self\">"+CarList[i].name +"</a> (" + CarList[i].carcount+")";
        strdiv+="</li>";
    }   
    strdiv+="</ul>";
    strdiv+="<div class=\"clear\"></div>";
    
    document.getElementById(updateElemID).update(strdiv);
}

function ShowUseYearList(updateElemID)
{
    var url = "../ajaxPage/searchResponse.ashx";
    var pars = (window.location.search=='')?'?type=useyear':(window.location.search) +'&type=useyear';
    document.getElementById(updateElemID).update('正在生成列表...');
    new Ajax.Request(url+pars, {method:"get", onComplete:function(response){InitUseYearList(response,updateElemID)},evalScripts:true,asynchronous:true} ); 
}
function InitUseYearList(request,updateElemID)
{
    UseList= eval('['+request.responseText+']');
    if(UseList==null)
    {
        return;
    }
    var strdiv="";
    for(var i=0;i<UseList.length;i++)
    {
        if(UseList[i].carcount > 0)
        {
            strdiv+="<li>";
            strdiv+="<a class=\"mc_cola\" href ='" +DecodeUrlParameters('ca',UseList[i].ca)+"' target=\"_self\">"+UseList[i].name +"</a> (" + UseList[i].carcount+")";
            strdiv+="</li>";
        }
    }
    document.getElementById(updateElemID).update(strdiv);
    if(strdiv == '')
    {
         document.getElementById('divUseYearList').style.display='none';
    }
}
function ShowCarpriceList(updateElemID)
{
    var url = "../ajaxPage/searchResponse.ashx";
    var pars = (window.location.search=='')?'?type=price':(window.location.search) +'&type=price';
    document.getElementById(updateElemID).update('正在生成列表...');
    new Ajax.Request(url+pars, {method:"get", onComplete:function(response){InitpriceList(response,updateElemID)},evalScripts:true,asynchronous:true});
}
function InitpriceList(request,updateElemID)
{
    PriceList= eval('['+request.responseText+']');
    if(PriceList == null)
    {
        document.getElementById('divPriceList').style.display='none';
        return;
    }
    var strdiv="";
    for(var i=0;i<PriceList.length;i++)
    {
        if(PriceList[i].carcount > 0)
        {
            var parapart = document.location.search;
            parapart = parapart.replace(/^\?+/, '').replace(/#+$/, '');
            var arrparas = parapart.split('&');
            var ___iterator_;
            var temp='';
            for (___iterator_ = 0; ___iterator_ < arrparas.length; ++___iterator_)
            {
                var urlparacomp = arrparas[___iterator_].split('=');
                if (urlparacomp[0] != 'lp' && urlparacomp[0] != 'hp'){
                temp += '&' + urlparacomp[0]+ '='+ urlparacomp[1];
                }
             }
            strdiv+="<li>";
            strdiv+="<a class=\"mc_cola\"  href ='carlist.aspx?lp=" +PriceList[i].lp + "&hp=" + PriceList[i].hp  + temp +"' target=\"_self\">"+PriceList[i].name +"</a> (" + PriceList[i].carcount+")";
            strdiv+="</li>";
        }
    }
    document.getElementById(updateElemID).update(strdiv);
    if(strdiv == '')
    {
         document.getElementById('divPriceList').style.display='none';
    }
}
function testcarlistrecommand(updateElemID)
{
    var url = "../ajaxPage/searchResponse.ashx";
    var pars = (window.location.search=='')?'?type=oneline':(window.location.search) +'&type=oneline';
  
    new Ajax.Request(url+pars, {method:"get", onComplete:function(response){InitRecommandList(response,updateElemID)},evalScripts:true,asynchronous:true});
}
function InitRecommandList(request,updateElemID)
{
    if(request.responseText!=undefined& request.responseText!=null)
    {
        RecommandList= eval('['+request.responseText+']');
    }
    if(RecommandList==null)
    {
        document.getElementById('divtotal').style.display='none';
        return;
    }
    var strdiv="";
    for(var i=0;i<RecommandList.length;i++)
    {
        strdiv+=" <div class=\"sell2_downb_wz\"> <div class=\"sell2_downb_wz1 t_center\">";
        strdiv+= RecommandList[i].year + "</div>";
        strdiv+="<h4><a class=\"mc_cola\" href ='t_CarInfo.aspx?ucarid=" +RecommandList[i].ucarid + "' target=\"_self\">"+ RecommandList[i].name + "</a></h4>";
        strdiv+=" <div class=\"sell2_downb_wz3 t_center\">" +RecommandList[i].cityName + "</div>";
        strdiv+="<em>" + RecommandList[i].price + "万</em>";
        strdiv+=" </div>";
        if(i != RecommandList.length-1)
        {
            strdiv+=" <div class=\"clear\"></div>";
        }
    }
    if(strdiv != '')
    {
         document.getElementById('divtotal').style.display='block';
         document.getElementById(updateElemID).innerHTML +=strdiv;
    }
}
var _Ucar_ResponseSearch = 
{
   attachEvent:function(o,name,fun){
		return document.all ? o.attachEvent(name,fun) : o.addEventListener(name.substr(2),fun,false);
	},
	
    DynamicLoadJavaScript:  function(spcount)
    {
       if(document.getElementById(spcount).innerHTML!='0')
       {
           ShowBrandList('divBrand');
           ShowCarpriceList('divPrice');
           ShowUseYearList('divUseYear');
       }
       else
       {
            document.getElementById('divBrand').style.display="none";
            document.getElementById('divUseYearList').style.display='none';
            document.getElementById('divPriceList').style.display='none';
       }
    },
    
    AppendHTML: function() 
    {
        this.attachEvent(window,"onload",InniteCarList);
        this.attachEvent(window,"onload",this.DynamicLoadJavaScript);
    }
}
//_Ucar_ResponseSearch.AppendHTML();
function SelectChangeCarList(__parameter,id)
{
    window.location.href = DecodeUrlParameters(__parameter,document.getElementById(id).value);
}
function SearcheCarList(__parameter,_value)
{
    window.location.href = DecodeUrlParameters(__parameter,_value);
}
function DecodeUrlParameters(_key,_value)
{
     var _Parameter= {productIds:'',brandIds:'',pid:'0',bid:'0',cid:'0',pvid:'0',ctid:'0',order:'0',pagecount:'15',IsPic:'0',cartype:'0',cc:'',y:'',ca:'',us:'',dm:'',lp:'',hp:'',p:'',t:'',e:'',pt:'',gb:'',c:'',userid:'0'};
     for(var i in _Parameter)
     {
       _Parameter[i]= DecodeUrlParameter(i);
     }
     _Parameter[_key] = _value;
     if(_key== 'pid')
     {
        _Parameter['bid']=0;
        _Parameter['cid']=0;
        _Parameter['brandIds']=0;
        _Parameter['productIds']=0;
     }
     else if(_key== 'bid')
     {
        _Parameter['cid']=0;
        _Parameter['brandIds']=0;
        _Parameter['productIds']=0;
     }
     else if(_key == "pvid")
     {
         _Parameter['ctid']=0;
     }
     var _parapart ='';
     for(var a in _Parameter)
     {if(_Parameter[a]!=null &_Parameter[a]!= '' ){
        _parapart += a + "=" + _Parameter[a] + "&";
        }
     }
    var __oriurlparts = document.location.href.split('?');
    var __pathpart = __oriurlparts[0];
    return __pathpart+"?"+_parapart.substring(0 ,_parapart.length -1 );
}
function SortImgInfo()
{
   Sort=Class.create() 
   Sort.down='http://img2.ucar.cn/ucar/image/ucar/ucar2009/buycar/mclb_down.gif';
   Sort.up ='http://img2.ucar.cn/ucar/image/ucar/ucar2009/buycar/mclb_up.gif';
   Sort.priceDown='http://img2.ucar.cn/ucar/image/ucar/ucar2009/buycar/pricedown.gif';
   Sort.priceUp='http://img2.ucar.cn/ucar/image/ucar/ucar2009/buycar/priceup.gif';
   Sort.timeDown='http://img2.ucar.cn/ucar/image/ucar/ucar2009/buycar/timedown.gif';
   Sort.timeUp='http://img2.ucar.cn/ucar/image/ucar/ucar2009/buycar/timeup.gif';
   Sort.downb='http://img2.ucar.cn/ucar/image/ucar/ucar2009/buycar/mclb_downb.gif';
   Sort.upb ='http://img2.ucar.cn/ucar/image/ucar/ucar2009/buycar/mclb_upb.gif';
   Sort.priceDownb='http://img2.ucar.cn/ucar/image/ucar/ucar2009/buycar/pricedownb.gif';
   Sort.priceUpb='http://img2.ucar.cn/ucar/image/ucar/ucar2009/buycar/priceupb.gif';
   Sort.timeDownb='http://img2.ucar.cn/ucar/image/ucar/ucar2009/buycar/timedownb.gif';
   Sort.timeUpb='http://img2.ucar.cn/ucar/image/ucar/ucar2009/buycar/timeupb.gif';
   return Sort;
 
}
function InniteCarList()
{
    var order = GetIntValue(DecodeUrlParameter('order'));
    var pid= GetIntValue(DecodeUrlParameter('pid'));
    var pid= GetIntValue(DecodeUrlParameter('pid'));
    var bid= GetIntValue(DecodeUrlParameter('bid'));
    var cid= GetIntValue(DecodeUrlParameter('cid'));
    var pvid= GetIntValue(DecodeUrlParameter('pvid'));
    var ctid= GetIntValue(DecodeUrlParameter('ctid'));
    var cartype =  GetIntValue(DecodeUrlParameter('cartype'));
    var pagecount= GetIntValue(DecodeUrlParameter('pagecount'));
    var isPic = GetIntValue(DecodeUrlParameter('IsPic'));
    if(isPic==1)
    {
      document.getElementById('hfpic').className = "mclb_yout";
      document.getElementById('hfpic'). href="javascript:SearcheCarList('IsPic','0');"
    }
    if(pid > 0)
    {
       document.getElementById('selbrand').disabled=false;
    }
    if(bid > 0)
    {
     document.getElementById('selcartype').disabled=false;
    }
    if(pvid>0)
    {
        document.getElementById('selcity').disabled=false;
    }
    if(cartype >= 0)
    {
       for(var i=0;i<4;i++)
       {
           var temp = i+1;
           if(cartype == i)
           {
                document.getElementById('tab2'+temp).className = "dj2_0"+temp;
           }
           else
           {
             document.getElementById('tab2'+temp).className = "dj2_"+temp;
           }
       }
    }
    document.getElementById('ddlorder').value = order;
    Sort = SortImgInfo();
    if(order == 0)
    {
        document.getElementById('imgtime').src = Sort.timeDown;
        document.getElementById('imgpub').src=Sort.down;
    }
    else if(order == 1)
    {
        document.getElementById('imgprice').src =  Sort.priceUp;
        document.getElementById('imgtime').src=document.getElementById('imgtime').src.replace(".gif",'b.gif').replace('bb','b'); 
        document.getElementById('imgsellprice').src= Sort.up; 
    }
    else if(order == 2)
    {
        document.getElementById('imgprice').src =Sort.priceDown;
        document.getElementById('imgtime').src=document.getElementById('imgtime').src.replace(".gif",'b.gif').replace('bb','b'); 
        document.getElementById('imgsellprice').src=Sort.down;
    }
    else if(order == 3)
    {
        document.getElementById('imgtime').src =Sort.timeUp;
        document.getElementById('imgprice').src=document.getElementById('imgprice').src.replace(".gif",'b.gif').replace('bb','b');  
        document.getElementById('imgpub').src= Sort.up;
    }
    else if(order == 4)
    {
        document.getElementById('imgtime').src =Sort.timeDown;
        document.getElementById('imgprice').src=document.getElementById('imgprice').src.replace(".gif",'b.gif').replace('bb','b');  
        document.getElementById('imgpub').src=Sort.down;
    }
    else if(order == 5)
    {
        document.getElementById('imgbuycar').src=Sort.up;
    }
    else if(order == 6)
    {
         document.getElementById('imgbuycar').src= Sort.down;
    }
    else if(order == 7)
    {
        document.getElementById('imgdrive').src= Sort.up;
    }
    else if(order == 8)
    {
        document.getElementById('imgdrive').src=Sort.down;
    }
    if(pagecount == 30)
    {
         document.getElementById('hf30').className = "mclb_ytcz";
         document.getElementById('hf15').className = "";
    }
    else
    {
         document.getElementById('hf15').className = "mclb_ytcz";
         document.getElementById('hf30').className = "";
    }
}
function priceImgClick(id)
{  Sort = SortImgInfo();
    if(document.getElementById(id).src ==Sort.priceDownb)
    {
        SearcheCarList('order','2');
    }
    else if(document.getElementById(id).src == Sort.priceUpb)
    {
        SearcheCarList('order','1');
    }
    else if(document.getElementById(id).src == Sort.priceUp)
    {
        SearcheCarList('order','2');
    }
    else if(document.getElementById(id).src == Sort.priceDown)
    {
        SearcheCarList('order','1');
    }
}
function timeImgClick(id)
{

 Sort = SortImgInfo();
    if(document.getElementById(id).src ==Sort.timeDownb)
    {
        SearcheCarList('order','4');
    }
    else if(document.getElementById(id).src == Sort.timeUpb)
    {
        SearcheCarList('order','3');
    }
    else if(document.getElementById(id).src ==Sort.timeUp)
    {
        SearcheCarList('order','4');
    }
    else if(document.getElementById(id).src == Sort.timeDown)
    {
        SearcheCarList('order','3');
    }
}
function ListtopImgClick(id,value1,value2)
{
    var ordervalue = GetIntValue(DecodeUrlParameter('order'))
    if(ordervalue == value1)
    {
        SearcheCarList('order',value2);
    }
    else
    {
        SearcheCarList('order',value1)
    }
}
function HistorySearchView()
{
    var strDiv ="";
    var cookievalue = eval('['+GetCookie('LastSearchView')+']');

    if(cookievalue == null)
    {
        document.getElementById('divRecently').style.display='none';
        return;
    }
    for(var i=0;i<cookievalue.length;i++)
    {
        if(cookievalue[i])
        {
           strDiv +="<li>";
           strDiv +="<a href=\"" +cookievalue[i].href + "\" title='" +unescape(cookievalue[i].title) +"' target=\"_blank\">";
           strDiv += unescape(cookievalue[i].title);
           strDiv +="</a>"
           strDiv+="</li>";
       }
    }
    document.getElementById('divHistory').update(strDiv);
}

function WriteSearchHistory()
{
   var title= escape(document.getElementById('sptitle').getElementsByTagName('a')[0].innerHTML);
   var link= window.location.href;
   if(title == null || title == '' || title == '全部车源')
   {
        return;
   }

   var cookieList = GetCookie('LastSearchView');
   var cookievalue = '{href:\''+window.location.href+'\',title:\''+title+'\'}';

   if(cookieList == null)
   {
        SetCookie('LastSearchView',cookievalue);
   }
   else
   {
        var temp=null;
        temp=cookievalue;
        var oldcookievalue = eval('['+GetCookie('LastSearchView')+']');
        var count=0;
        for(var i=0;i<oldcookievalue.length;i++)
        {
            if((eval('['+cookievalue+']')[0].title != oldcookievalue[i].title) && count < 4)
            {
                temp+=","+'{title:\''+oldcookievalue[i].title+'\',href:\''+oldcookievalue[i].href+'\'}';
                count++;
            }
        }
       
        DelCookie('LastSearchView');
        SetCookie('LastSearchView',temp);
   }
}
function GetIsHigh(id)
{
    if(document.getElementById(id).parentNode.className == 'bg2')
    {
        return 'mclb_lb2';
    }
    else
    {
        return 'bg1 mclb_lb3 ';
    }
}
var _Ucar_SaleCarList = 
{
   attachEvent:function(o,name,fun){
		return document.all ? o.attachEvent(name,fun) : o.addEventListener(name.substr(2),fun,false);
	},
	
    AppendHTML: function() 
    {
        WriteSearchHistory();
        HistorySearchView();
        //this.attachEvent(window,"onload",function(){HistorySearchView()});
        //this.attachEvent(window,"onload",function(){WriteSearchHistory()});
    }
}

function saet(o)
{
	var x=y=0;
	do{
      x+=o.offsetLeft;
	  y+=o.offsetTop;
	}
	while (o=o.offsetParent);
	return {"x":x,"y":y};
}

function opendiv(thisObj,openAId,numx,numy)
{	

    var x=saet(thisObj).x;
	var y=saet(thisObj).y;
	
	var newx = x + numx;
	var newy = y + numy; 
     document.getElementById(openAId).style.display="block";
     document.getElementById(openAId).style.top=newy+"px";
	 document.getElementById(openAId).style.left=newx+"px";
}

function loadcarmiddleImg(id)
{ 
    opendiv( document.getElementById(id),'fucengimg',65,-127);
    document.getElementById('imgmiddle').src= document.getElementById(id).src.replace("_smaller","_middle");
    document.getElementById('imgmiddle').style.width='250px';
    document.getElementById('imgmiddle').style.height='187px';
}
var iTimeoutID;
function BookReadMail(id)
{
    var mail = document.getElementById(id);
    var divBookRead = document.getElementById('divBookRead');
    divBookRead.style.display="block";
    var _EmailNumFilter=/^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
    if(mail.value == null || mail.value == '')
    {
        document.getElementById('divBookRead').update("请填写Email!");
        iTimeoutID = window.setTimeout("know(iTimeoutID)", 3000);
    }
    else if(!_EmailNumFilter.test(mail.value))
    {
        document.getElementById('divBookRead').update("Email格式不正确!");
        iTimeoutID = window.setTimeout("know(iTimeoutID)", 3000);
    }
    else
    {
         document.getElementById('divBookRead').update("正在处理请稍候...");
         var search = document.location.search == ''?'?bt=1':document.location.search;
        var url="../ajaxPage/bookReadCarSource.ashx"+search + "&bt=1&type=add&ism=1&mail=" +mail.value+"&url="+window.location.href.replace(/\&/g,'$') + "&suiji=" + Math.round(Math.random()*10000);
        new Ajax.Request(url, {method:"get",onComplete:updatedivBookRead,evalScripts:true,asynchronous:true} ); 
    }
}

function updatedivBookRead(request)
{
    var text = '';
    if(request.responseText=="1")//成功
    {
        text='感谢您使用优卡网车源订阅服务!';
    }
    else if(request.responseText=="0")//重复
    {
        text='您已订阅,不能重复订阅!';
    }
    else if(request.responseText=="-1")//失败
    {
         text='抱歉，您的订阅失败,请重试!';
    }
    document.getElementById("divBookRead").update(text);
    document.getElementById('txtMail').value='';
    iTimeoutID = window.setTimeout("know(iTimeoutID)", 3000);
}
function know()
{
     document.getElementById("divBookRead").style.display="none";
     window.clearTimeout(iTimeoutID)  
}
function CreateRSS()
{
    window.open('CreateRSS.ashx' + window.location.search);
}
function perAttention()
{
  if(document.getElementById('spAttened').innerHTML == '[ 设为关注 ]')
  {
    bit.popUp.coping.load('showIdasdaaa','',250,30,'bgIedasdaa','#333',9999,1,'',onloadHTML(),function(){});
    var url="../ajaxPage/personAttention.ashx?t=checkLog&sj="+Math.round(Math.random()*10000);
    new Ajax.Request(url, {method:"get",onComplete:CheckUserLogIn,evalScripts:true,asynchronous:true} ); 
  }
  else 
  {
    document.getElementById('spAttened').innerHTML = '[ 您已关注成功 ]';
  }
}
function onloadHTML()
{
    var html='';
    html +="<div>";
    html +="<img id=\"imgmiddle1\" src=\"http://img2.ucar.cn/ucar/image/ucar/ucar2009/buycar/onload.gif\" alt=\"正在加载\" />";
    html += "系统正在加载请稍后...";
    html += '</div>';
    return html;
}
function CheckUserLogIn(request)
{
    var result = request.responseText;
    bit.popUp.coping.clear('bgIedasdaa','showIdasdaaa')
    if(result=='true')//已登录用户验证收藏数目
    {
        var url="../ajaxPage/personAttention.ashx?t=checkCount&sj="+Math.round(Math.random()*10000);
        new Ajax.Request(url, {method:"get",onComplete:CheckUserCount,evalScripts:true,asynchronous:true} ); 
    }
    else//未登录用户
    {
        bit.popUp.coping.load('showIdasdaa','',350,1100,'bgIedasda','#333',1000,30,'',showDiogue(),function(){});
        
    }
}
function CheckUserCount(request)
{
    var result = request.responseText;
    if(result == 'true')
    {
        var search = document.location.search == ''?'?bt=1':document.location.search+"&bt=1";
        var url="../ajaxPage/bookReadCarSource.ashx"+search + "&type=add&title=" +escape(document.getElementById('sptitle').innerHTML) + "&url="+window.location.href.replace(/&/g,"$","$&");;
        new Ajax.Request(url, {method:"get",onComplete:bookResult,evalScripts:true,asynchronous:true} ); 
    }
    else//收藏列表
    {
        bit.popUp.coping.load('showIdasdaa','',350,0,'bgIedasda','#333',1000,30,'',showDiogue2(result),function(){});
      
    }
}
function bookResult(request)
{
    var result = request.responseText;
    if(result == "1")
    {
        document.getElementById('spAttened').update('[ 关注设置成功 ]');
        document.getElementById('spAttened').title='当前搜索条件已成功设为关注';
         document.getElementById('spAttened').disabled=true;
        document.getElementById('spAttened').onclick=function (){};
    }
    else
    {
        alert('您已关注过此条件的车源');
    }
}
function showDiogue2(result)
{
    var html =''; 
    var list = eval('['+result+']');
    html+="<div id='divattend' class=\"tsxx\" style=\"position: absolute;height:auto;\">";
    html+="<div class=\"tsxxa\">";
    html+="<div class=\"tsxxb\">";
    html+="<h2><span style=\"cursor: pointer;\" onclick=\"bit.popUp.coping.clear('bgIedasda','showIdasdaa')\">关闭</span>设为关注提示信息</h2>";
    html+="<P class=\"tsxx_ts\">Hi <span>" + list[0].userName + "</span>，你关注已达5条，如需新增关注请删除至少一条已有关注。</P>";
    for(var i=0;i<list.length;i++)
    {
        html+="<div class=\"tsxx_wz\" id='div" +i+ "' value='" +list[i].id+ "'>";
        html+=" <label>条件" + (i+1) + "：</label>";
        html+="<span><a href=\"" +list[i].url + "\" class=\"mc_cola\" target=\"_blank\">" +list[i].text + "</a><br />";
        html+="  &nbsp; &nbsp;共" +list[i].count+ "条信息"; 
	    html+=" </span>";
	    html+="<em  style=\"cursor: pointer;\" onclick=\"delAttend('div" +i+ "')" + "\">删除</em>";
	    html+="</div>";
    }
    html+="</div>";
    html+="</div>";
    html+="</div>";
    return html;
}
function delAttend(id)
{
    var item= document.getElementById(id);
    var url="../ajaxPage/bookReadCarSource.ashx?type=canel&mscid="+item.value;
    new Ajax.Request(url, {method:"get",onComplete:function(response){bookcanel(response,id)},evalScripts:true,asynchronous:true} ); 
}
function bookcanel(response,id)
{
    if(response.responseText=='邮件订阅已取消'){
     var item= document.getElementById(id);
     item.removeNode(true);
    }
    else{
    alert('系统忙，请重试!');
    }
    
}
function showDiogue()
{
     var html =''; 
     html+="<div class=\"hydl\" style=\"position: absolute;height:600px;\" id=\"divUserLogin\">"
     html+="<div class=\"hydla\">";
     html+="<div class=\"hydlb\">";
     html+="<h2>";
     html+=" <span style=\"cursor: pointer;\" onclick=\"bit.popUp.coping.clear('bgIedasda','showIdasdaa')\">关闭</span>会员登录</h2>";
     html+=" <p class=\"hydl_ts\">";
     html+="<strong>提示：</strong>只有登录后才能报存你设置的关注。没有注册的用户请先<strong><a href=\"/User/reg.aspx?back=true\" class=\"mc_cola\">注册</a></strong></p>";
     html+="<div class=\"hydl_wz\">";
     html+="<samp>";
     html+= "用户名：</samp>";
     html+= "<input type=\"text\" id='txtuserName' class=\"hydl_input1\"/>";
     html+= "</div>";
     html+= "<div class=\"hydl_wz\">";
     html+= "<samp>";
     html+= "密码：</samp>";
     html+= "<input id='txtpwd' type=\"password\" class=\"hydl_input1\"/>";
     html+= "</div>";
     html+="<div class=\"hydl_wz2\">";
     html+=" <input type=\"button\" class=\"hydl_but1\" value=\"登录\" onclick='userLogIn();' /> ";
     html+="<a href=\"/User/Findpwd.aspx\" class=\"mc_cola\">忘记密码？</a>";
     html+="</div>";
     html+= "</div>";
     html+= "</div>";
     html+= "</div>";
     return html;
}
function userLogIn()
{
    var name = $F('txtuserName');
    var pwd = $F('txtpwd');
    if(name=='')
    {
        alert('用户名必填');return;
    }
    if(pwd == '')
    {
     alert('密码必填');return;
    }
    var url="../ajaxPage/personAttention.ashx?t=login&username=" + escape(name) + "&pwd=" + pwd;
    new Ajax.Request(url, {method:"get",onComplete:UserLogIn,evalScripts:true,asynchronous:true} ); 
}
function UserLogIn(request)
{
    var result = request.responseText;
    if(result == 'true')
    {
        window.location.href = this.location.href;
    }
    else
    {
        alert('登录失败');
    }
}
