// SubNavigation
$(function() {
	$(".navi li").hover(function(){
		$(this).find('ul:first').show("fast").css({visibility: "visible",display: "block"});
	},function(){
		$(this).find('ul:first').hide("fast").css({visibility: "hidden"});
	});
});
//Homepage Tabs
$(function(){
    var $title = $(".news h2 span");
    var $content = $(".news ul");
    $title.mousemove(function(){
        var index = $title.index($(this));
		$(this).addClass("mon").siblings().removeClass("mon");
        $content.hide();
        $($content.get(index)).show();
        return false;
    });
});
// Homepage Scroll
$(function(){
   var num=0;
   var imgWidth=228;//图片的宽度
   var speed=5;//流动的速度，每20毫秒一个像素
   function howlking(){
   num++;
   if(num<imgWidth){
         $('.scroll ul').css('left',-num+"px");
   }else{
      $('.scroll ul').find('li:first').appendTo($('.scroll ul'));
   $('.scroll ul').css('left',"0px");
   num=0;
   }
   }
   var times=setInterval(howlking,speed);
   $('.scroll').hover(function(){clearTimeout(times)},function(){times=setInterval(howlking,speed)});
});
// Menu First li nb
$(function() {
	$(".navi li:first").addClass("nl");
	$(".footpage li:first").addClass("nb");
});
// SearchForm
$(document).ready(function(){				   
	$('.searchInput').focus(
		function() {
			if($(this).val() == '输入关键字') {
				$(this).val('').css({color:"#222"});
			}
		}
	).blur(
		function(){
			if($(this).val() == '') {
				$(this).val('输入关键字').css({color:"#777"});
			}
		}
	);
});
// Slideshow
$(function(){
	var index = 0;
	$("#operate span:first").addClass("hov");
	$("#operate span").mouseover(function(){
	  index  =  $("#operate span").index(this);
	  showImg(index);
	});	
	
	$('#slideshow').hover(function(){
			if(MyTime){
			   clearInterval(MyTime);
			}
	},function(){
			MyTime = setInterval(function(){
			  showImg(index)
			  index++;
			  if(index==5){index=0;}
			} , 6000);
	});
	
	var MyTime = setInterval(function(){
	  showImg(index)
	  index++;
	  if(index==5){index=0;}
	} , 6000);
})
function showImg(i){
	$("#showimg img")
	  .eq(i).stop(true,true).fadeIn(1000)
	  .parent().siblings().find("img").hide();
	$("#msg li")
	  .eq(i).stop(true,true).fadeIn(1000)
	  .siblings().hide();
	$("#operate span")
	  .eq(i).addClass("hov")
	  .siblings().removeClass("hov");
}


//QQ在线
lastScrollY = 0;
function heartBeat(){
var diffY;
if (document.documentElement && document.documentElement.scrollTop)
diffY = document.documentElement.scrollTop;
else if (document.body)
diffY = document.body.scrollTop
else
{/*Netscape stuff*/}
//alert(diffY);
percent=.1*(diffY-lastScrollY);
if(percent>0)percent=Math.ceil(percent);
else percent=Math.floor(percent);
document.getElementById("leftDiv").style.top = parseInt(document.getElementById("leftDiv").style.top)+percent+"px";
document.getElementById("rightDiv").style.top = parseInt(document.getElementById("rightDiv").style.top)+percent+"px";
lastScrollY=lastScrollY+percent;
//alert(lastScrollY);
}
//下面这段删除后，对联将不跟随屏幕而移动。
window.setInterval("heartBeat()",1);
//-->
//关闭按钮
function close_left1(){
    left1.style.visibility='hidden';
}
function close_left2(){
    left2.style.visibility='hidden';
}
function close_right1(){
    right1.style.visibility='hidden';
}
function close_right2(){
    right2.style.visibility='hidden';
}
//显示样式
document.writeln("<style type=\"text\/css\">");
document.writeln("#leftDiv,#rightDiv{margin-top:60px;position:absolute;z-index:9999;}");

document.writeln("<\/style>");
//以下为主要内容
document.writeln("<div id=\"leftDiv\" style=\"top:300px;left:5px\">");
//------左侧各块开始


//---L2
document.writeln("<div id=\"left2\" class=\"itemFloat\">");document.writeln("");
document.writeln("<\/div>");
//------左侧各块结束
document.writeln("<\/div>");
document.writeln("<div id=\"rightDiv\" style=\"top:150px;right:15px\">");
//------右侧各块结束


document.writeln("<\/div>");

