var topid="";
$(function(){
//导航响应
$("#menu ul li").mouseover(function(){
if ($(this).find("img").attr("id")!=topid){
$(this).find("img").attr("src",$(this).find("img").attr("src").replace("1","2"));
}
$(this).find("p").stop().show();
});
$("#menu ul li").mouseout(function(){
if ($(this).find("img").attr("id")!=topid){
$(this).find("img").attr("src",$(this).find("img").attr("src").replace("2","1"));
}
$(this).find("p").stop().hide();
});
$("#menu ul li").each(function(){
if ($(this).find("img").attr("id")==topid) $(this).find("img").attr("src",$(this).find("img").attr("src").replace("1","2"));
});
//首页
if (topid=="sort_home"){
//业务领域
$("#m_left .box_ywly div").mouseover(function(){
$home_ywly($(this).index());
});
$home_ywly(0);
//图片新闻
home_photonews_len=$("#m_center .home_photonews div.list_box").size();
for(var i=1; i<=home_photonews_len; i++){
$("#m_center .home_photonews div.list_tab").append(""+i+"");
}
$("#m_center .home_photonews div.list_tab span").mouseover(function(){
$home_photonews($(this).index());
});
$home_photonews(0);
//产品
$("#m_right .home_project .list_box ul").append("
"+$("#m_right .home_project .list_box ul li:eq(0)").html()+"");
$("#m_right .home_project .list_tab").data("q",$("#m_right .home_project .list_box ul li").size());
$("#m_right .home_project .list_tab").data("i",0);
$("#m_right .home_project ul").css("width",$("#m_right .home_project .list_tab").data("q")*$("#m_right .home_project .list_box").width());
$("#m_right .home_project .list_tab img").eq(0).click(function(){
var i=$(this).parent().data("i");
i--;
if(i<1){
$home_project_to($(this).parent().data("q"));
i=$(this).parent().data("q")-1;
};
$(this).parent().data("i",i);
$home_project(i);
});
$("#m_right .home_project .list_tab img").eq(1).click(function(){
var i=$(this).parent().data("i");
i++;
if(i>$(this).parent().data("q")){
$home_project_to(1);
i=2;
};
$(this).parent().data("i",i);
$home_project(i);
});
$home_project_timer();
//下属公司
$("#m_right .home_com div").click(function(){
$(this).next("ul").stop().slidetoggle("fast");
return false;
});
$("body").click(function(){
$("#m_right .home_com ul").stop().slideup("fast");
});
}
});
//首页业务
var home_old_id=-1;
function $home_ywly(id){
if (home_old_id!=-1){
$("#m_left .box_ywly div").eq(home_old_id).find("p:eq(0)").attr("class","t");
$("#m_left .box_ywly div").eq(home_old_id).find("p:eq(1)").hide();
}
$("#m_left .box_ywly div").eq(id).find("p:eq(0)").attr("class","t2");
$("#m_left .box_ywly div").eq(id).find("p:eq(1)").show();
home_old_id=id;
}
//首页图片新闻
var home_photonews_len=0;
var home_old_id2=-1;
var home_photonews_timer="";
function $home_photonews_timer(){
var i=home_old_id2+1;
if(i>=home_photonews_len) i=0;
$home_photonews(i);
}
function $home_photonews(id){
if (home_old_id2!=-1){
$("#m_center .home_photonews div.list_tab span").eq(home_old_id2).removeclass("sel");
$("#m_center .home_photonews div.list_box").eq(home_old_id2).stop().fadeout("fast",function(){$home_photonews2(id)});
}else{
$home_photonews2(id)
}
}
function $home_photonews2(id){
$("#m_center .home_photonews div.list_tab span").eq(id).addclass("sel");
$("#m_center .home_photonews div.list_box").eq(id).stop().fadein("fast");
home_old_id2=id;
cleartimeout(home_photonews_timer);
home_photonews_timer=settimeout("$home_photonews_timer()",5000);
}
//首页产品
var home_project_timer="";
function $home_project_timer(){
var i=$("#m_right .home_project .list_tab").data("i");
i++;
if(i>$("#m_right .home_project .list_tab").data("q")){
$home_project_to(1);
i=2;
}
$("#m_right .home_project .list_tab").data("i",i);
$home_project(i);
}
function $home_project_to(id){
var target=$("#m_right .home_project .list_box ul li").eq(id-1);
$("#m_right .home_project .list_box").stop().scrollto(target, 0)
//$(this).parent().find(".list_tab").data("i",id);
}
function $home_project(id){
$(this).parent().data("i",id);
var target=$("#m_right .home_project .list_box ul li").eq(id-1);
$("#m_right .home_project .list_box").stop().scrollto(target, 500);
cleartimeout(home_project_timer);
home_project_timer=settimeout("$home_project_timer()",3000);
return false;
}
//友情链接
function openlink(select_obj){
var url = select_obj.options[select_obj.selectedindex].value;
if(url != "") self.open(url,"_blank");
select_obj.selectedindex=0;
}
// 一般标签类
function tab(cname){
var old_id = new array();
old_id[cname] = 0;
this.$ = function(id){
return (typeof(id)=='object') ? id : document.getelementbyid(id);
}
this.show = function(tabname,boxname,id){
if (old_id[cname]!=id){
if (old_id[cname]!=0){
this.$(tabname+old_id[cname]).classname=tabname+"1";
this.$(boxname+old_id[cname]).classname=boxname+"1";
}
this.$(tabname+id).classname=tabname+"2";
this.$(boxname+id).classname=boxname+"2";
old_id[cname] = id;
}
}
}