﻿function getNewsInfo()
{
   $.ajax
   ({  
        type:"get",
        url:"PageHandler/newsInfo.ashx?check=1&CId=1&top=3&Rand=1",
        cache:false,
        dataType:"json",
        success:function(msg)
        { 
            jsonProductInfo=msg;
            if(msg[msg.length-1].CK==1)
            {  
                var strNewsList=" ";
                for(var i=0;i<msg.length-2;i++)
                { 
                    var title=msg[i].title;
                    var mx=msg[i].mx;
                    if(title.length>18)
                    {
                        title=title.substr(0,18)+".....";
                    }
                    if(mx.length>50)
                    {
                        mx=mx.substr(0,50)+".....";
                    }
                    strNewsList+='<ul><li><a href="showNews.aspx?newsId='+msg[i].contentId+'" class="link14bold">'+title+'</a> </li><li>'+mx+'</li></ul>';
                }  
                 $("#news_a_content_right").html(strNewsList);
            }
            else
            {
                alert("没有数据！");
            }
        }
    })
}
//合作伙伴
function binghzhb()
{
   $.ajax
   ({  
        type:"get",
        url:"PageHandler/linkInfo.ashx?check=1&Type=2",
        cache:false,
        dataType:"json",
        success:function(msg)
        {  
            if(msg[msg.length-1].CK==1)
            { 
               var strLinkInfo='<ol id="roll">';
               
               for(var i=0;i<msg.length-2;i++)
               { 
                   var linkName=msg[i].linkName; 
                    if(linkName.length>18)
                    {
                        linkName=linkName.substr(0,18)+".....";
                    }
                   strLinkInfo+='<li><a title="'+linkName+'" href="'+msg[i].linkUrl+'" target="_blank">'+linkName+'</a></li>';
               }  
               strLinkInfo+="</ol>"
               
               $("#yewu_rightbox").html(strLinkInfo);
               roll();
            }
            else
            {
                alert("没有数据！");
            }
        }
    })
}


function bindYwImg()
{
   $.ajax
   ({  
        type:"get",
        url:"PageHandler/aboutInfo.ashx?aboutId=13",
        cache:false,
        dataType:"json",
        success:function(msg)
        {  
            if(msg[msg.length-1].CK==1)
            {  
               var StrImg='<a href="aboutInfo.aspx?aboutId='+msg[0].abouId+'"><img src="Files/War/'+msg[0].Img+'" width="250" height="140" /></a>';
               $("#pp").html(StrImg);
            }
            else
            {
                alert("没有数据！");
            }
        }
    })
   $.ajax
   ({  
        type:"get",
        url:"PageHandler/aboutInfo.ashx?aboutId=14",
        cache:false,
        dataType:"json",
        success:function(msg)
        {  
            if(msg[msg.length-1].CK==1)
            {  
               var StrImg='<a href="aboutInfo.aspx?aboutId='+msg[0].abouId+'"><img src="Files/War/'+msg[0].Img+'" width="250" height="140" /></a>';
               $("#sj").html(StrImg);
            }
            else
            {
                alert("没有数据！");
            }
        }
    })
   $.ajax
   ({  
        type:"get",
        url:"PageHandler/aboutInfo.ashx?aboutId=15",
        cache:false,
        dataType:"json",
        success:function(msg)
        {  
            if(msg[msg.length-1].CK==1)
            {  
               var StrImg='<a href="aboutInfo.aspx?aboutId='+msg[0].abouId+'"><img src="Files/War/'+msg[0].Img+'" width="250" height="140" /></a>';
               $("#dh").html(StrImg);
            }
            else
            {
                alert("没有数据！");
            }
        }
    })
   $.ajax
   ({  
        type:"get",
        url:"PageHandler/aboutInfo.ashx?aboutId=16",
        cache:false,
        dataType:"json",
        success:function(msg)
        {  
            if(msg[msg.length-1].CK==1)
            {  
               var StrImg='<a href="aboutInfo.aspx?aboutId='+msg[0].abouId+'"><img src="Files/War/'+msg[0].Img+'" width="250" height="140" /></a>';
               $("#jy").html(StrImg);
            }
            else
            {
                alert("没有数据！");
            }
        }
    })
}

//网站建设
function getwzjs()
{ 
  $.ajax
   ({  
        type:"get",
        url:"PageHandler/ProductInfo.ashx?check=1&CId=24&top=6&Rand=1",
        cache:false,
        dataType:"json",
        success:function(msg)
        {  
            if(msg[msg.length-1].CK==1)
            {  
               var title1=msg[0].productName;
               var jj=msg[0].mx;
                if(title1.length>10)
                {
                    title1=title1.substr(0,10)+".....";
                }
               if(jj.length>45)
               {
                    jj=jj.substr(0,45)+".....";
               } 
               title1='<a href="showProduct.aspx?PId='+msg[0].productId+'" class="link14bold">'+title1+'</a>'
             
                var StrImg='<img src="Files/product/bigImg/'+msg[0].productBigImg+'" width="320" height="200" />';
                $("#WebsiteImg").html(StrImg);
                $("#jj").html(jj);
                $("#WebsiteTitle").html(title1);
            
               var strProductList="";
               for(var i=0;i<msg.length-2;i++)
               { 
                    var title=msg[i].productName;
                    if(title.length>6)
                    {
                        title=title.substr(0,6)+".....";
                    }
                    strProductList+='<ul><li><a href="showProduct.aspx?PId='+msg[i].productId+'"> <img src=Files/product/'+msg[i].productImg+' width="150" height="100" /></a></li> <li><a href="showProduct.aspx?PId='+msg[i].productId+'">'+title+'</a></li></ul>';
               }  
               $("#website").html(strProductList);
            }
            else
            {
                alert("没有数据！");
            }
        }
    })
}

//工作花絮
var JosnImgInfo="";
function getgzhx()
{ 
  $.ajax
   ({  
        type:"get",
        url:"PageHandler/ProductInfo.ashx?check=1&CId=31&top=4&Rand=1",
        cache:false,
        dataType:"json",
        success:function(msg)
        {  
            JosnImgInfo=msg;
            if(msg[msg.length-1].CK==1)
            {  
               var strProductList="<ul>";
               
               for(var i=0;i<msg.length-2;i++)
               { 
                   if(i==0)
                   {
                        strProductList+='<li id="HX_bigImg" class="margin_r5"><a href="showProduct.aspx?PId='+msg[0].productId+'"><img src="Files/product/bigImg/'+msg[0].productBigImg+'" width="480" height="240" /></a></li>';
                   }
                   if(i==3 )
                   {
                       strProductList+='<li onmousemove="setBigImg('+i+')"><a href="showProduct.aspx?PId='+msg[i].productId+'"><img src="Files/product/'+msg[i].productImg+'" width="110" height="240" /></a></li>';
                   }
                   else
                   {
                       strProductList+='<li class="margin_r5" onmousemove="setBigImg('+i+')"><a href="showProduct.aspx?PId='+msg[i].productId+'"><img src="Files/product/'+msg[i].productImg+'" width="110" height="240" /></a></li>';
                   }
               }  
               strProductList+="</ul>"
               
               $("#highlights").html(strProductList);
            }
            else
            {
                alert("没有数据！");
            }
        }
    })
}
function setBigImg(id)
{
    var strImg='<a href="showProduct.aspx?PId='+JosnImgInfo[id].productId+'"><img src="Files/product/bigImg/'+JosnImgInfo[id].productBigImg+'" width="480" height="240" /></a>';
    $("#HX_bigImg").html(strImg);
}


//影视制作
function getyszz()
{ 
  $.ajax
   ({  
        type:"get",
        url:"PageHandler/ProductInfo.ashx?check=1&CId=25&top=3&Rand=1",
        cache:false,
        dataType:"json",
        success:function(msg)
        {  
            if(msg[msg.length-1].CK==1)
            {  
                var strYsList=" ";
                for(var i=0;i<msg.length-2;i++)
                { 
                    var title=msg[i].productName;
                    var mx=msg[i].mx;
                    var StrImg='<img src="Files/product/'+msg[i].productImg+'" width="280" height="160" />';
                    if(title.length>10)
                    {
                        title=title.substr(0,10)+".....";
                    }
                    if(mx.length>55)
                    {
                        mx=mx.substr(0,55)+".....";
                    }
                    title='<a href="showProduct.aspx?PId='+msg[i].productId+'" class="link14bold">'+title+'</a>';
                    strYsList+='<ul><li><a href="showProduct.aspx?PId='+msg[i].productId+'" class="link14bold">'+StrImg+'</a> </li><li>'+title+'</li><li class="font12gray">'+mx+'</li></ul>';
                }  
                $("#film").html(strYsList);
            }
            else
            {
                alert("没有数据！");
            }
        }
    })
}


//乾盛战将
function getqszjli()
{
  $.ajax
   ({  
        type:"get",
        url:"PageHandler/ProductInfo.ashx?check=1&CId=23&top=6&Rand=1",
        cache:false,
        dataType:"json",
        success:function(msg)
        {  
            if(msg[msg.length-1].CK==1)
            {  
               var strProductList="<ul>";
               var StrImg='<a href="showTeach.aspx?PId='+msg[0].productId+'"><img src="Files/product/bigImg/'+msg[0].productBigImg+'" width="620" height="170" /></a>';
               $("#lecturer_left").html(StrImg);
               for(var i=0;i<msg.length-2;i++)
               { 
                    strProductList+='<li onmouseover="setqszjBigImg('+msg[i].productId+');"><a href="showTeach.aspx?PId='+msg[i].productId+'"><img src="Files/product/'+msg[i].productImg+'" width="80" height="80"  /></a></li>';
               } 
               strProductList+="</ul>"
               
               $("#lecturer_right").html(strProductList);
            }
            else
            {
                alert("没有数据！");
            }
        }
    })
}

function setqszjBigImg(pId)
{
   $.ajax
   ({  
        type:"get",
        url:"PageHandler/ProductInfo.ashx?check=1&Pid="+pId,
        cache:false,
        dataType:"json",
        success:function(msg)
        { 
            if(msg[msg.length-1].CK==1)
            {  
               var StrImg='<a href="showTeach.aspx?PId='+msg[0].productId+'"><img src="Files/product/bigImg/'+msg[0].productBigImg+'" width="620" height="170" /></a>';
               $("#lecturer_left").html(StrImg);
            }
            else
            {
                alert("没有数据！");
            }
        }
    })
}
//活动策划
function gethdchLi()
{ 
  $.ajax
   ({  
        type:"get",
        url:"PageHandler/ProductInfo.ashx?check=1&CId=27&top=3&Rand=1",
        cache:false,
        dataType:"json",
        success:function(msg)
        {  
            if(msg[msg.length-1].CK==1)
            {  
               var strProductList="";
               var StrImg='<a href="showProduct.aspx?PId='+msg[0].productId+'"><img src="Files/product/'+msg[0].productImg+'" width="620" height="250" /></a>';
               $("#event_left").html(StrImg);
               for(var i=0;i<msg.length-2;i++)
               { 
                   var mx=msg[i].mx; 
                   var title=msg[i].productName;
                    if(title.length>15)
                    {
                        title=title.substr(0,15)+".....";
                    }
                   if(mx.length>40)
                   {
                        mx=mx.substr(0,40)+".....";
                   }
                   strProductList+='<ul><li><a href="showProduct.aspx?PId='+msg[i].productId+'" class="link14bold">'+title+'</a></li><li class="font12gray">'+mx+'</li></ul>'    
               }  
               $("#event_right").html(strProductList);
            }
            else
            {
                alert("没有数据！");
            }
        }
    })
}

//友情链接
function getLinkInfo()
{ 
  $.ajax
   ({  
        type:"get",
        url:"PageHandler/linkInfo.ashx?check=1&top=20&Type=1",
        cache:false,
        dataType:"json",
        success:function(msg)
        {  
            if(msg[msg.length-1].CK==1)
            { 
               var strLinkInfo="<ul>";
               
               for(var i=0;i<msg.length-2;i++)
               { 
                   var linkName=msg[i].linkName; 
                    if(linkName.length>15)
                    {
                        linkName=linkName.substr(0,15)+".....";
                    }
                   strLinkInfo+='<li><a href="'+msg[i].linkUrl+'" target="_blank">'+linkName+'</a></li>';
               }  
               strLinkInfo+="</ul>"
               
               $("#linkbox_text").html(strLinkInfo);
            }
            else
            {
                alert("没有数据！");
            }
        }
    })
}

//乾盛日志
function getRizhiInfo()
{ 
  $.ajax
   ({  
        type:"get",
        url:"PageHandler/newsInfo.ashx?check=1&top=8&CId=21",
        cache:false,
        dataType:"json",
        success:function(msg)
        {
            if(msg[msg.length-1].CK==1)
            { 
               var strNewsInfo="<ul>";
               
               for(var i=0;i<msg.length-2;i++)
               { 
                   var title=msg[i].title; 
                    if(title.length>16)
                    {
                        title=title.substr(0,16)+".....";
                    }
                   strNewsInfo+='<li><a href="log.aspx?newsId='+msg[i].contentId+'">'+title+'</a></li>';
               }  
               strNewsInfo+="</ul>"
               $("#dsj_list").html(strNewsInfo);
            }
            else
            {
                alert("没有数据！");
            }
        }
    })
}


//设备展示
function getsbzs()
{ 
  $.ajax
   ({  
        type:"get",
        url:"PageHandler/ProductInfo.ashx?check=1&CId=36&top=6",
        cache:false,
        dataType:"json",
        success:function(msg)
        {  
            if(msg[msg.length-1].CK==1)
            {  
                var strSBList="<ul>";
                for(var i=0;i<msg.length-2;i++)
                { 
                    var StrImg='<a href="showProduct.aspx?PId='+msg[i].productId+'&CId='+msg[i].ClassId+'"><img src="Files/product/'+msg[i].productImg+'" width="155" height="130" /></a>';
                    strSBList+='<li>'+StrImg+'</li>';
                } 
                strSBList+="</ul>"; 
                $("#equipment").html(strSBList);
            }
            else
            {
                alert("没有数据！");
            }
        }
    })
}



function roll()
{
   (function(A){
    function _ROLL(obj){
    this.ele = document.getElementById(obj);
    this.interval = false;
    this.currentNode = 0;
    this.passNode = 0;
    this.speed = 100;
    this.childs = _childs(this.ele);
    this.childHeight = parseInt(_style(this.childs[0])['height']);
       addEvent(this.ele,'mouseover',function(){
                                   window._loveYR.pause();
           });
    addEvent(this.ele,'mouseout',function(){
                                   window._loveYR.start(_loveYR.speed);
           });
    }
    function _style(obj){
     return obj.currentStyle || document.defaultView.getComputedStyle(obj,null);
    }
    function _childs(obj){
    var childs = [];
    for(var i=0;i<obj.childNodes.length;i++){
    var _this = obj.childNodes[i];
    if(_this.nodeType===1){
    childs.push(_this);
    }
    }   
    return childs;
    }
    function addEvent(elem,evt,func){
    if(-[1,]){
     elem.addEventListener(evt,func,false);   
    }else{
     elem.attachEvent('on'+evt,func);
    };
    }
    function innerest(elem){
      var c = elem;
    while(c.childNodes.item(0).nodeType==1){
       c = c.childNodes.item(0);
    }
    return c;
    }
    _ROLL.prototype = {
      start:function(s){
           var _this = this;
     _this.speed = s || 100;
        _this.interval = setInterval(function(){
          _this.ele.scrollTop += 1;
       _this.passNode++;
       if(_this.passNode%_this.childHeight==0){
          var o = _this.childs[_this.currentNode] || _this.childs[0];
          _this.currentNode<(_this.childs.length-1)?_this.currentNode++:_this.currentNode=0;
          _this.passNode = 0;
          _this.ele.scrollTop = 0;
          _this.ele.appendChild(o);
       }
        },_this.speed);
    },
    pause:function(){
    var _this = this;
      clearInterval(_this.interval);
    }
    }
    A.marqueen = function(obj){A._loveYR = new _ROLL(obj); return A._loveYR;}
    })
    (window);
    marqueen('roll').start(100/*速度默认100*/);
}
