﻿// JScript 文件
/* 页面幻灯 */
$(document).ready(function(){$(".Slide").each(function(i){
  var Slide = $(this);
  var SlideList = $(this).children();
  var Width  = Number($(this).css("width").match(/\d*/));
  var Height = Number($(this).css("height").match(/\d*/));
  $(this).children().remove();
  $(this).append("<ul><li class=\"SlideC\"></li><li class=\"SlideN\"></li><li class=\"SlideT\"></li></ul>");
  $(this).find(".SlideC").css({width:Width+"px", height:Height+"px", "margin-top":           "0px", "z-index":"1", padding:"0px"});
  $(this).find(".SlideN").css({width:(SlideList.length*19+10)+"px", height:     "20px", "margin-top":(10-Height)+"px", "z-index":"2", padding:"0px", position:"absolute", "margin-left":(Width-SlideList.length*19-10)+"px"});
  $(this).find(".SlideT").css({width:Width+"px", height:     "25px", "margin-top":         "-25px", "z-index":"2", padding:"0px", position:"absolute", "line-height":"25px", "text-indent":"25px", color:"#FFFFFF", "background-color":"Black", filter:"alpha(opacity=40)", opacity:"0.4"});
  
  $(this).find(".SlideC").append(SlideList);
  $(this).find(".SlideC").find("img").css({width:Width+"px", height:Height+"px", display:"none"});
  $(this).find(".SlideC").children().each(function(j){ $(Slide).find(".SlideN").append("<div style=\"width:9px; height:9px; margin:2px 5px; float:left; background-color:Transparent; cursor:pointer; overflow:hidden;\"></div>");});
  $(this).find(".SlideN").children().each(function(j){ SetSlideNumberOFF($(this));});
  $(this).find(".SlideN").children().each(function(j){ $(this).click(function(){
    SetSlideNumberOFF($(this).parent().children()); $(Slide).find(".SlideC img").hide();//幻灯片初始化
    SetSlideNumberON($(this));                $(Slide).find(".SlideC img").eq(j).show(); $(Slide).find(".SlideT").html($(Slide).find(".SlideC img").eq(j).attr("alt"));//显示当前幻灯片
    $(Slide).find(".SlideC a").removeAttr("href");  $(Slide).find(".SlideC img").attr("alt", ""); $(Slide).find(".SlideT").html("");//临时添加
  });});
  $(this).find(".SlideN div").eq(0).trigger('click');
  
  eval("SlideInterval"+i+" = setInterval(function(){ SlideAutomatic(Slide);}, 3000)");
  $(this).hover(function()      { clearInterval(eval("SlideInterval"+i))}, function(){ eval("SlideInterval"+i+" = setInterval(function(){ SlideAutomatic(Slide);}, 3000)");});
  function SlideAutomatic(Slide){ for(var j=0; j<$(Slide).find(".SlideN").children().length;j++){ var Color = $(Slide).find(".SlideN").children().eq(j).children().eq(0).css("background-color"); if(Color=="#ffffff")         { if(j==($(Slide).find(".SlideN").children().length-1)){ $(Slide).find(".SlideN").children().eq(0).trigger('click');}else{ $(Slide).find(".SlideN").children().eq(j+1).trigger('click');}break;}if(/255/.test(String(Color))){ if(j==($(Slide).find(".SlideN").children().length-1)){ $(Slide).find(".SlideN").children().eq(0).trigger('click');}else{ $(Slide).find(".SlideN").children().eq(j+1).trigger('click');}break;}}};
  function SetSlideNumberOFF(SlideNumber)
  {
    $(SlideNumber).children().remove();
    $(SlideNumber).append("<div style=\"width:1px; height:1px; background-color:#696969; margin:0px 4px; overflow:hidden;\"></div>");
    $(SlideNumber).append("<div style=\"width:5px; height:1px; background-color:#696969; margin:0px 2px; overflow:hidden;\"></div>");
    $(SlideNumber).append("<div style=\"width:7px; height:2px; background-color:#696969; margin:0px 1px; overflow:hidden;\"></div>");
    $(SlideNumber).append("<div style=\"width:9px; height:2px; background-color:#696969; margin:0px 0px; overflow:hidden;\"></div>");
    $(SlideNumber).append("<div style=\"width:7px; height:2px; background-color:#696969; margin:0px 1px; overflow:hidden;\"></div>");
    $(SlideNumber).append("<div style=\"width:5px; height:1px; background-color:#696969; margin:0px 2px; overflow:hidden;\"></div>");
    $(SlideNumber).append("<div style=\"width:1px; height:1px; background-color:#696969; margin:0px 4px; overflow:hidden;\"></div>");
  };
  function SetSlideNumberON(SlideNumber)
  {
    $(SlideNumber).children().remove();
    $(SlideNumber).append("<div style=\"width:1px; height:1px; background-color:#FFFFFF; margin:0px 4px; overflow:hidden;\"></div>");
    $(SlideNumber).append("<div style=\"width:5px; height:1px; background-color:#FFFFFF; margin:0px 2px; overflow:hidden;\"></div>");
    $(SlideNumber).append("<div style=\"width:7px; height:2px; background-color:#FFFFFF; margin:0px 1px; overflow:hidden;\"></div>");
    $(SlideNumber).append("<div style=\"width:9px; height:2px; background-color:#FFFFFF; margin:0px 0px; overflow:hidden;\"></div>");
    $(SlideNumber).append("<div style=\"width:7px; height:2px; background-color:#FFFFFF; margin:0px 1px; overflow:hidden;\"></div>");
    $(SlideNumber).append("<div style=\"width:5px; height:1px; background-color:#FFFFFF; margin:0px 2px; overflow:hidden;\"></div>");
    $(SlideNumber).append("<div style=\"width:1px; height:1px; background-color:#FFFFFF; margin:0px 4px; overflow:hidden;\"></div>");
  };
});});
/* 信息列表 */
$(document).ready(function(){$(".NewsUL").each(function(i){
  $(this).find(".NewsLI a:nth-child(1)").remove();                                                     //删除信息列表的信息分类信息
  $(this).width($(this).parent().width()-15);                                                          //设置信息列表块宽度
  $(this).find(".NewsLI .L").width($(this).find(".NewsLI").width()-$(this).find(".NewsLI .R").width());//设置信息列表信息标题框宽度
  $(this).find(".NewsLI .Hot").css("background", "Transparent url(./../Image/Hot.gif) no-repeat scroll "+($(this).find(".NewsLI .L").width()-30)+"px 5px");//设置信息列表信息标题框宽度
  
  //$(".NewsLI a").each(function(i){ $(this).parent().width($(this).parent().parent().width()-$(this).parent().next().width());});                         //截取首页列表信息的信息长度
  //$(".CEIA_Li a").each(function(i){ $(this).text(StringCutWidth($(this).text(), ($(this).parent().width()-15)/6)[0]);});                                  //截取首页列表信息的信息长度
  //$(".Right .MM .CEIA_Li a").each(function(i){$(this).text(StringCutWidth($(this).text(), ($(this).parent().width()-$(this).next().width() - 9)/8)[0]);});//截取二级页面右侧列表信息的信息长度
});});
/* 信息滚动 */
$(document).ready(function(){$(".Scroll ul").each(function(i){if($(this).children().length > 7){
  $(this).find(".NewsLI").css("background-image", "none");
  var Scroll = $(this);
  eval("ScrollInterval"+i+" = setInterval(function(){ ScrollAutomatic(Scroll);}, 100)");
  $(this).hover(function(){ clearInterval(eval("ScrollInterval"+i))}, function(){ eval("ScrollInterval"+i+" = setInterval(function(){ ScrollAutomatic(Scroll);}, 100)");});
  function ScrollAutomatic(Scroll)
  {
    var margintop = $(Scroll).css("margin-top") == undefined ? 0 : StringPixelToNumber($(Scroll).css("margin-top"))-1;//获取上外边框大小
    if(margintop < 0 - $(Scroll).children().eq(0).height()){ $(Scroll).append($(Scroll).children("li:first-child")); $(Scroll).remove("li:first-child"); margintop+=$(Scroll).children().eq(0).height();}//计算外边框大小
    //margintop = (margintop+$(Scroll).height())<0?$(Scroll).height():(margintop-1);                                  //计算上外边框大小
    $(Scroll).css("margin-top", margintop+"px");                                                                    //设置上外边框大小
  };
  function StringPixelToNumber(String){ return Number(String.substring(0, String.length-2));};
}});});
/* 友情链接 */
$(document).ready(function(){$(".Friend table").each(function(i){
  $(this).find("tr").hide(); $(this).find("tr").show();                                                                            //友情链接显示初始化
  $(this).find("td a").each(function(i){$(this).text(StringCutWidth($(this).text(), ($(this).parent().width()-15)/6)[0]);});       //友情链接公司名称长度限制
  //$(this).hover(function(){ $(this).find("tr").show();}, function(){ $(this).find("tr").hide(); $(this).find("tr").eq(0).show();});//友情链接鼠标滑过响应
});});
