﻿function getDepartment2()
{
    $.ajax({
        url: "Cscript/GetDepartmentList.ashx",
        cache: false,
        async:false,
        dataType:"json",
        success: function(json)
        {
        
            $("#dept ul li:gt(0)").remove();
            for(var i=0;i<json.length;i++)
            {
                $("#dept ul").append('<li style="height:32px; padding-left:40px; width:162px; line-height:32px; background-image: url(images/dh-2.jpg); background-repeat: no-repeat; font-size:14px; font-weight:bold"><a href="javascript:void(0)">'+json[i].deptname+'</a></li>');
                $("#dept ul li:gt(0)").eq(i).data("data",json[i].intro);
            }
        },
        error:function()
        {
            //alert("GetDepartmentCount.ashx运行错误");
        } 
    });
}
//获取领导班子成员
function getEmployee2()
{
    $.ajax({
        url: "Cscript/GetEmployeeList.ashx",
        cache: false,
        async:false,
        dataType:"json",
        success: function(json)
        {
            $("#dept ul li:gt(0)").remove();
            for(var i=0;i<json.length;i++)
            {
                $("#dept ul").append('<li style="height:32px; padding-left:40px; width:162px; line-height:32px; background-image: url(images/dh-2.jpg); background-repeat: no-repeat; font-size:14px; font-weight:bold"><a href="javascript:void(0)">'+json[i].name1+'</a></li>');
                $("#dept ul li:gt(0)").eq(i).data("data",json[i].id);
            }

        },
        error:function()
        {
           // alert("GetEmployeeCount.ashx运行错误");
        } 
    });
}

//获取领导班子成员
function getEmployeeInfo(id)
{
    $.ajax({
        url: "Cscript/GetEmployeeInfo.ashx",
        cache: false,
        data:"id="+id,
        dataType:"html",
        success: function(json)
        {
            $("#emp").html(json);
        },
        error:function()
        {
            //alert("GetEmployeeCount.ashx运行错误");
        } 
    });
}

function ShowMaquee()
{
//    $("#marquee1").marquee();
    $.ajax
    ({
        url: "CScript/GetNoticeList.ashx",
        cache: false,
        dataType:"json",
        success: function(json)
        {
//         alert(json.length);
//            $("#marquee1 li").remove();
             for(var i=0;i<json.length;i++)
             {
                $("#marquee1").append("<li><a href=ShowNotice.htm?id="+json[i].id+">"+json[i].name1+"</a></li>");
            }
            
             $("#marquee1").marquee();
        },
        error:function()
        {
           // alert("json");
        } 
    });
}
function ShowFriendSite()
{
      $.ajax({
        url: "CScript/GetTextLink.ashx",
        cache: false,
        dataType:"json",
        success: function(json)
        {
             $("#friendsite").html("友情链接:");
              for(var i=0;i<json.length;i++)
              {
                $("#friendsite").append("<span style='margin-left:10px;'><a target='_blank' href='"+json[i].SiteUrl+"'>"+json[i].SiteName+"</a></span>")            
              }
        },
        error:function()
        {
              $("#friendsite").append("<span style='margin-left:10px;'><a>暂无友情链接</a></span>");
        } 
    });
}

function ShowImgFriendSite()
{
      $.ajax({
        url: "CScript/GetImgLink.ashx",
        cache: false,
        dataType:"json",
        success: function(json)
        {
          $("#imglink").html();
          for(var i=0;i<json.length;i++)
          {
            $("#imgfriendsite").append("<a target='_blank' href="+json[i].SiteUrl+"><img style='width:100px;height:30px;margin-right:10px;' src='"+json[i].LogoUrl+"' /></a>")            
          }
        },
        error:function()
        {
//            alert("GetTextLink.ashx脚本错误");
        } 
    });
}

//显示专题栏目
function ShowSpecChannel()
{
      $.ajax({
        url: "CScript/GetSubjectList.ashx",
        cache: false,
        dataType:"json",
        success: function(json)
        {
            $("#SpecChannel ul li").remove();
            
            for(var i=0;i<json.length;i++)
            {
               $("#SpecChannel ul").append('<li><span><a href="FoodSubject.htm?id='+json[i].SpecialID+'">'+json[i].SpecialName+'</a></span></li>');
            }    
        },
        error:function()
        {
            $("#SpecChannel ul").append('<li >暂无此类文章</li>');
        } 
    });
}

//价格行情
function ShowPrice()
{
      $.ajax({
        url: "CScript/GetPrice.ashx",
        cache: false,
        dataType:"json",
        success: function(json)
        {
            $("#FoodCreateList ul li").remove();
            
            for(var i=0;i<json.length;i++)
            {
               $("#FoodCreateList ul").append('<li><span style="width:360px"><a href="ShowArticle.htm?id='+json[i].ArticleID+'">'+json[i].Title+'</a></span><span style="margin-left:10px;font-size:12px;font-style:italic;color:black">'+json[i].UpdateTime+'</span></li>');
            }    
        },
        error:function()
        {
            $("#FoodCreateList ul").append('<li >暂无此类文章</li>');
        } 
    });
}


//显示县级工作动态
function ShowSecondWork()
{
      $.ajax({
        url: "CScript/GetSecondWork.ashx",
        cache: false,
        dataType:"json",
        success: function(json)
        {
            $("#SecondWorkList ul li").remove();
            
            for(var i=0;i<json.length;i++)
            {
               $("#SecondWorkList ul").append('<li><span style="width:360px"><a href="ShowArticle.htm?id='+json[i].ArticleID+'">'+json[i].Title+'</a></span><span style="margin-left:10px;font-size:12px;font-style:italic;color:black">'+json[i].UpdateTime+'</span></li>');
            }    
        },
        error:function()
        {
            $("#SecondWork ul").append('<li >暂无此类文章</li>');
        } 
    });
}

function GetBaseInfo()
{
    $.ajax({
        url: "Cscript/GetBaseInfo.ashx",
        cache: false,
        dataType:"json",
        success: function(json)
        {
            $("#baseinfo").append("<a style=' margin:0 10px 0 10px'>"+json[0].username+"</a>");
            $("#baseinfo").append("<a style=' margin:0 10px 0 10px;color:black' href='http://www.miibeian.gov.cn/' target='_blank'>"+json[0].ICP+"</a></br>");
            $("#baseinfo").append("<a style=' margin:0 10px 0 10px;'>地址："+json[0].Adress+"</a>");
            $("#baseinfo").append("<a style=' margin:0 10px 0 10px;'>邮编："+json[0].Post+"</a>");
            $("#baseinfo").append("<a style=' margin:0 10px 0 10px;'>电话："+json[0].Tel+"</a>");
            $("#baseinfo").append("<a style=' margin:0 10px 0 10px;'>邮箱："+json[0].Email+"</a>");
        },
        error:function()
        {
            //alert("GetArticleClass脚本错误");
        } 
    });
}

function ShowVisit()
{
    $.ajax
    ({
        url: "CScript/GetParmValue.ashx",
        data:"id=3",
        cache: false,
        dataType:"html",
        success: function(json)
        {
           $("#visit ul").css("width",json.length*18);
           
           for(var i=0;i<json.length;i++)
           {
              $("#visit ul").append('<li>'+json.substr(i,1)+'</li>');
           }
        },
        error:function()
        {
            //alert("ShowVisit.ashx脚本错误");
        } 
    });
}

function ShowPicNews()
{
    $.ajax
    ({
        url: "CScript/GetElite.ashx",
        cache: false,
        dataType:"json",
        success: function(json)
        {
           $("#exp1 ul li").remove();
           
           for(var i=0;i<json.length;i++)
           {
              $("#exp1 ul").append('<li><a href="ShowArticle.htm?id='+json[i].ArticleID+'"><img src="'+json[i].DefaultPicUrl+'" title="'+json[i].Title+'" alt="'+json[i].Title+'" /></a></li>');
           } 
           $('#exp1').smallslider({"onImageStop":true });

        },
        error:function()
        {
           // alert("ShowVisit.ashx脚本错误");
        } 
    });


}

function UpdateVisit()
{
    $.ajax
    ({
        url: "CScript/UpdateVisit.ashx",
        cache: false,
        dataType:"html",
        success: function(json)
        {
        },
        error:function()
        {
           // alert("UpdateVisit.ashx脚本错误");
        } 
    });
}


//显示粮食要闻
function ShowGetFoodWork()
{
      $.ajax({
        url: "CScript/GetFoodWork.ashx",
        cache: false,
        dataType:"json",
        success: function(json)
        {
            $("#FoodWorkList ul li").remove();
            for(var i=0;i<json.length;i++)
            {
                $("#FoodWorkList ul").append('<li><span style="width:300px"><a href="ShowArticle.htm?id='+json[i].ArticleID+'">'+json[i].Title+'</a></span><span style="margin-left:10px;font-size:12px;font-style:italic;color:black">'+json[i].UpdateTime+'</span></li>');
            }
        },
        error:function()
        {
            $("#FoodWorkList ul").append('<li >暂无此类文章</li>');
        } 
    });
}

function ShowGetTradeInfo()
{
      $.ajax({
        url: "CScript/GetTradeInfo.ashx",
        cache: false,
        dataType:"json",
        success: function(json)
        {
            $("#TradeInfo ul li").remove();
            for(var i=0;i<json.length;i++)
            {
                $("#TradeInfo ul").append('<li><span style="width:280px"><a href="ShowArticle.htm?id='+json[i].ArticleID+'">'+json[i].Title+'</a></span></li>');
            }
        },
        error:function()
        {
            $("#TradeInfo ul").append('<li >暂无此类文章</li>');
        } 
    });
}

function ShowGetFoodMarket()
{
      $.ajax({
        url: "CScript/GetFoodMarket.ashx",
        cache: false,
        dataType:"json",
        success: function(json)
        {
            $("#FoodMarketList ul li").remove();
            for(var i=0;i<json.length;i++)
            {
                 $("#FoodMarketList ul").append('<li><span style="width:360px"><a href="ShowArticle.htm?id='+json[i].ArticleID+'">'+json[i].Title+'</a></span><span style="margin-left:10px;font-size:12px;font-style:italic;color:black">'+json[i].UpdateTime+'</span></li>');
            }
        },
        error:function()
        {
            $("#FoodMarketList ul").append('<li >暂无此类文章</li>');
        } 
    });
}

function ShowLow()
{
      $.ajax({
        url: "CScript/GetLow.ashx",
        cache: false,
        dataType:"json",
        success: function(json)
        {
            $("#LowList ul li").remove();
            for(var i=0;i<json.length;i++)
            {
                $("#LowList ul").append('<li><span style="width:280px"><a href="ShowArticle.htm?id='+json[i].ArticleID+'">'+json[i].Title+'</a></span></li>');
            }
        },
        error:function()
        {
            $("#LowList ul").append('<li >暂无此类文章</li>');
        } 
    });
}

function search()
{
    if($("#key").val()=="")
    {
        return false;
    }
    else
    {
        window.open("search.htm?key="+$("#key").val(),"_self");
    }
}

function initArray()
 {
  for(i=0;i<initArray.arguments.length;i++)
  this[i]=initArray.arguments[i];
 }
 var isnMonths=new initArray("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月");
 var isnDays=new initArray("星期日","星期一","星期二","星期三","星期四","星期五","星期六","星期日");
 today=new Date();
 hrs=today.getHours();
 min=today.getMinutes();
 sec=today.getSeconds();
 clckh=""+((hrs>12)?hrs-12:hrs);
 clckm=((min<10)?"0":"")+min;clcks=((sec<10)?"0":"")+sec;
 clck=(hrs>=12)?"下午":"上午";
 var stnr="";
 var ns="0123456789";
 var a="";

function getFullYear(d)
{
  yr=d.getYear();if(yr<1000)
  yr+=1900;return yr;
}

$("#mydate").html(getFullYear(today)+"年 "+isnMonths[today.getMonth()]+" "+today.getDate()+"日 "+isnDays[today.getDay()]);//+" "+clckh+":"+clckm+":"+clcks);

$("#ChildMenubar >div:gt(0)").hide();
$("#Menubar ul li:gt(0) a").hover(
    function(){
                   //if($(this).attr("href")=="javascript:void(0)")
                   {
                       $("#ChildMenubar >div").hide();
                       var i=$("#Menubar ul >li:gt(0) a").index($(this)); 
                       $("#ChildMenubar >div").eq(i).show(100);
                   }
               },
    function(){}

)

$("#vote :radio").click(function(){$("#vote :radio").not($(this)).attr("checked","");$(this).attr("checked","checked")});

function Button1_onclick() 
{
      $.ajax({
        url: "CScript/vote.ashx",
        data:"id="+($("#vote li :radio[checked=true]").index("#vote li :radio")+1),
        cache: false,
        dataType:"html",
        success: function(json)
        {    
            alert("投票成功，感谢您的参与");
        },
        error:function()
        {
        } 
    });
}

function ShowFlash()
{
    $('#topbar1').flash(
        { 
          src: 'upload/flash/top.swf',
          width: 950,
          height:172
        },
        { version: 8 }
    );
}


