﻿$(document).ready(function(){				   
		// 当鼠标聚焦在搜索框
		$('#edtSearch').focus(
			function() {
				if($(this).val() == '输入关键字') {
					$(this).val('').css({color:"#454545"});
				}
			}
		// 当鼠标在搜索框失去焦点
		).blur(
			function(){
				if($(this).val() == '') {
					$(this).val('输入关键字').css({color:"#333333"});
				}
			}
		);
	});
// Navigation Menu
$(function() {
		$(".menu ul").css({display: "none"}); // Opera Fix
		$(".footer li:first").addClass("nb");
		$(".menu li:first").addClass("homepage");
		$(".menu li").hover(function(){
			$(this).find('ul:first').css({visibility: "visible",display: "none"}).slideDown("normal");
		},function(){
			$(this).find('ul:first').css({visibility: "hidden"});
		});
	});
 
// Bookmark
function bookmark(title, url) {
	  if (document.all)
		window.external.AddFavorite(url, title);
	  else if (window.sidebar)
		window.sidebar.addPanel(title, url, "")
}
$(function(){
	 var index = 0;
	 $("#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;}
			  } , 5000);
	 });
	 //自动开始
	 var MyTime = setInterval(function(){
		showImg(index)
		index++;
		if(index==5){index=0;}
	 } , 3000);
})
//关键函数：通过控制i ，来显示不通的幻灯片
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");
}
