﻿$(document).ready(function(){

  $.ajax({
            url:'profile/Index1.ashx',
            async:true,
            type:'post',
            dataType: "text",
            data:{},
            success: function(text){
                  if(text=="0"){
                    alert("没有获取到数据");
                    return;
                  }
                  var json = eval("(" + text + ")");
                  var homeinformation="";//首页资讯
                  var dynamic="";var dy=1;
                  var blog="";
                  var help="";
                  var common="";
                  var ydmw="";
                  
                  var jjcp="";//基金产品新增加的
                  var common_jj="";
                  var common_lc="";
                  var common_bx="";
                  var common_qt="";
                  $.each(json.root,function(i,entry){
//                    if(entry.Title.length>20){
//                        entry.Title=entry.Title.substring(0,18)+"...";
//                    }
                    if(entry.DictionaryId=="16"){//显示首页资讯
                        
                        
                        if(entry.placeid=="1"){
                            if(entry.PictureURL==""){
                                
                                $(".right1").eq(0).html('<div class="right2"><a href="SHow_News.aspx?nid='+entry.Id+'"><img src="image/11_27.jpg" height="73" width="82" alt="赢在龙头动态" title="赢在龙头动态"/></a></div><div class="right_fong3" style="width:200px;height:70px;text-overflow:ellipsis; overflow:hidden;"  title='+entry.Title+'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="SHow_News.aspx?nid='+entry.Id+'"><font color="#CC3300" style="width:170px;text-overflow:ellipsis; white-space:nowrap; overflow:hidden;"><b>'+entry.Title+'</b></font></h4></a><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="SHow_News.aspx?nid='+entry.Id+'">'+entry.content+'</a></div><br /><font style="float:right" color="#CC3300"><a href="SHow_News.aspx?nid='+entry.Id+'">[详细]</a></font>');
                            }else{
                                $(".right1").eq(0).html('<div class="right2"><a href="SHow_News.aspx?nid='+entry.Id+'" ><img src="http://www.120918.com'+entry.PictureURL+'" height="73" width="82" alt="赢在龙头动态" title="赢在龙头动态"/></a></div><div class="right_fong3" style="width:210px;height:70px;text-overflow:ellipsis; overflow:hidden;"  title='+entry.Title+'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="SHow_News.aspx?nid='+entry.Id+'"><font color="#CC3300" style="width:170px;text-overflow:ellipsis; white-space:nowrap; overflow:hidden; "><b>'+entry.Title+'</b></font></h4></a><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="SHow_News.aspx?nid='+entry.Id+'">'+entry.content+'</a></div><br /><font style="float:right" color="#CC3300"><a href="SHow_News.aspx?nid='+entry.Id+'">[详细]</a></font>');
                            }
                        }else{
                            
                            homeinformation+='<li style=" white-space:nowrap; overflow:hidden;">•&nbsp;<a href="SHow_News.aspx?nid='+entry.Id+'" title='+entry.Title+'>'+entry.Title+'</a></li>';
                        }
                    }else if(entry.DictionaryId=="10"){//动态
                            if(dy==1){
                                $(".right1").eq(1).html('<div class="right2"><a href="SHow_News.aspx?nid='+entry.Id+'"><img src="image/11_53.jpg" height="73" width="82" alt="赢在龙头动态" title="赢在龙头动态"/></a></div><div class="right_fong3" style="width:210px;height:73px;text-overflow:ellipsis; overflow:hidden;text-indent: 2em;" ><a href="SHow_News.aspx?type=dt&nid='+entry.Id+'">'+entry.content.replace(/<.+?>/g,"").replace(/&nbsp;/g,"")+'</a></div><br /><font color="#CC3300" style="float:right"><a href="SHow_News.aspx?nid='+entry.Id+'">[详细]</a></font>');
                            }else{
                                dynamic+='<li style=" white-space:nowrap; overflow:hidden;">•&nbsp;<a href="SHow_News.aspx?nid='+entry.Id+'" title='+entry.Title+'>'+entry.Title+'</a></li>';
                            }
                            dy=dy+1;
                        
                        
//                    }else if(entry.DictionaryId=="15"){//博客
//                        
//                       if(entry.content!="")
//                       {
//                         blog+='<li style=" white-space:nowrap; overflow:hidden;">•&nbsp;<a href="'+entry.content+'" title='+entry.Title+' target="_blank">'+entry.Title+'</a></li>';
//                       
//                       }else
//                        blog+='<li style=" white-space:nowrap; overflow:hidden;">•&nbsp;<a href="SHow_News.aspx?nid='+entry.Id+'" title='+entry.Title+'>'+entry.Title+'</a></li>';
//                    }else if(entry.DictionaryId=="2"){//移动梦网
//                        ydmw+='<li style=" white-space:nowrap; overflow:hidden;">•&nbsp;<a href="SHow_News.aspx?nid='+entry.Id+'" title='+entry.Title+'>'+entry.Title+'</a></li>';
//                    }else if(entry.DictionaryId=="49"){//求助
//                        
//                        help+='<li style="white-space:nowrap; overflow:hidden;">【<a href="help.aspx?cid='+entry.PictureURL+'&type=all">'+entry.content+'</a>】&nbsp;&nbsp;&nbsp;<a href="help.aspx?nid='+entry.Id+'"   title="'+entry.Title+'" >'+entry.Title+'</a></li>';
                    }else if(entry.DictionaryId=="43"){//投资常识
                        
                        //common+='<li style="white-space:nowrap; overflow:hidden;line-height:22px;margin-left:0px;">【<a href="study.aspx?cid='+entry.PictureURL+'&type=all">'+entry.content+'</a>】&nbsp;&nbsp;&nbsp;<a href="study.aspx?nid='+entry.Id+'"" title='+entry.Title+'>'+entry.Title+'</a></li> ';
                        if(entry.PictureURL=="14"){
                            common_jj +='<li style="text-overflow:ellipsis; white-space:nowrap; overflow:hidden;line-height:22px;margin-left:0px;width:230px;">【<a href="study.aspx?cid='+entry.PictureURL+'&type=all">'+entry.content+'</a>】&nbsp;&nbsp;&nbsp;<a href="study.aspx?nid='+entry.Id+'&type=jj" title='+entry.Title+'>'+entry.Title+'</a></li> ';
                        }
                        if(entry.PictureURL=="36"){
                            common_lc +='<li style="text-overflow:ellipsis; white-space:nowrap; overflow:hidden;line-height:22px;margin-left:0px;width:230px;">【<a href="study.aspx?cid='+entry.PictureURL+'&type=all">'+entry.content+'</a>】&nbsp;&nbsp;&nbsp;<a href="study.aspx?nid='+entry.Id+'&type=lc" title='+entry.Title+'>'+entry.Title+'</a></li> ';
                        }
                        if(entry.PictureURL=="63"){
                            common_bx +='<li style="text-overflow:ellipsis; white-space:nowrap; overflow:hidden;line-height:22px;margin-left:0px;width:230px;">【<a href="study.aspx?cid='+entry.PictureURL+'&type=all">'+entry.content+'</a>】&nbsp;&nbsp;&nbsp;<a href="study.aspx?nid='+entry.Id+'&type=bx" title='+entry.Title+'>'+entry.Title+'</a></li> ';
                        }
                        if(entry.PictureURL=="64"){
                            common_qt +='<li style="text-overflow:ellipsis; white-space:nowrap; overflow:hidden;line-height:22px;margin-left:0px;width:230px;">【<a href="study.aspx?cid='+entry.PictureURL+'&type=all">'+entry.content+'</a>】&nbsp;&nbsp;&nbsp;<a href="study.aspx?nid='+entry.Id+'&type=qt" title='+entry.Title+'>'+entry.Title+'</a></li> ';
                        }
                    }else if(entry.DictionaryId=="24"){//基金产品                        
                       jjcp+='<tr><td width=200><a href="SHow_News.aspx?nid='+entry.Id+'" title="'+entry.Title+'">'+entry.Title+'</a></td><td>'+entry.time.getUTCFullYear()+'-'+f((entry.time.getUTCMonth()+1))+'-'+f(entry.time.getDate())+'</td></tr>';
                    }
                  });
                  
                  $(".font5 > ul").html(homeinformation);
                  $(".font7 > ul").html(common_jj + common_lc + common_bx + common_qt);//以前为博客
                  //$(".font77 > ul").html(ydmw);//以前为移动梦网
                  $(".new_right > ul").html(dynamic);
                  //$(".font_left > ul").html(jjcp);
				 
                  $(".font6").html('<table style="line-height:18px;margin-top:10px;">'+jjcp+'</table>');
            },
            error:function(text){
                alert("error righttopalbum");
            }
    });
    Gettoday();
    function substring(str){
//        if(str.length>15){
//            str=str.substring(0,12)+"...";
//        }
        return str;
    }
     function f(n) {
           
            return n < 10 ? '0' + n : n;
        }
      $(".button1").addClass("button11");
//      $(".button_box > a").each(function(i){
//            $(".button_box > a").eq(i).hover(function(){
//                switch(i){
//                    case 0:
//                         $(".banner").css("background","url(../image/11_18.jpg) no-repeat");
//                         $(".button1").addClass("button11");
//                         $(".button2").removeClass("button22");
//                         $(".button3").removeClass("button33");
//                         $(".button4").removeClass("button44");
//                        break;
//                    case 1:
//                         $(".banner").css("background","url(../image/1(2).jpg) no-repeat");
//                         $(".button2").addClass("button22");
//                         $(".button1").removeClass("button11");
//                         $(".button3").removeClass("button33");
//                         $(".button4").removeClass("button44");
//                        break;
//                    case 2:
//                         $(".banner").css("background","url(../image/2(2).jpg) no-repeat");
//                         $(".button3").addClass("button33");
//                         $(".button1").removeClass("button11");
//                         $(".button2").removeClass("button22");
//                         $(".button4").removeClass("button44");
//                        break;
//                    case 3:
//                         $(".banner").css("background","url(../image/3(2).jpg) no-repeat");
//                         $(".button4").addClass("button44");
//                         $(".button1").removeClass("button11");
//                         $(".button2").removeClass("button22");
//                         $(".button3").removeClass("button33");
//                        break;
//                    default:break;
//                }
//            },function(){
//            
//            });
//                
//    });
function Gettoday(){

  $(".jazai2").html("加载中...");
      $.ajax({
            url:'profile/LCCP.ashx',
            async:true,
            type:'post',
            dataType:"text",
            data:{},
            success: function(text){
                  if(text=="0"){
                    $(".jazai2").html("<ul><li style='width:220px;'>&nbsp;</li></ul>");
                    return;
                  }
                  var json = eval("(" + text + ")");
                  var content=json.root[0].Desc.replace(/<.+?>/g,"").replace(/&nbsp;/g,"");
                  
//                  if(content.length>100){
//                    content=content.substring(0,96)+"...";
//                  }
                  
                  var str='<ul>';
                  str+='<li><a href="show_news.aspx?nid='+json.root[0].id+'" class="more5" style="color:#006 ;margin-left:60px;font-size:14px; font-weight:bold;">'+json.root[0].title+'</a></li>';
//                  if(json.root[0].PictureURL==""){
//                    str+='<li style="float:left;margin-left:-8px;-margin-left:10px;display:inline"><a href="show_news.aspx?nid='+json.root[0].id+'"><img src="image/lccp.jpg" class="lcimg" style="margin-top:10px;" /></a></li>';
//                  }else{
//                    str+='<li style="float:left;"><a href="show_news.aspx?nid='+json.root[0].id+'"><img src="'+json.root[0].PictureURL+'" class="lcimg" style="margin-top:10px;" /></a></li>';
//                  }
                  str+='<li class="more6" style="font-size:13px;color:#666;line-height:22px; width:270px;white-space:normal;float:left; ;margin-left:-8px;-margin-left:10px;margin-top:2px;display:inline">';
                  str+='<div style="float:left;display:inline; width:270px; ">  <div style="float:left;height:120px;text-overflow:ellipsis; white-space:normal; overflow:hidden;display:inline;">&nbsp;&nbsp;&nbsp;&nbsp;<a href="show_news.aspx?nid='+json.root[0].id+'" title="'+content+'" style="">'+content+'</a></div></div>';//<a href="show_news.aspx?nid='+json.root[0].id+'"  style="color:#872802;float:right;margin-top:-20px;">[详细]</a>
                  str+='</li></ul>';
                 
                 $(".jazai2").html(str);
            },
            error:function(text){
                alert("获取失败");
            }
               });
}
})
