document.writeln("<div class=\"imgnav\" id=\"imgnav\"> ");
document.writeln("      	<div id=\"ctrl\" class=\"ctrl\">");
document.writeln("        <div id=\"btn\"><span class=\"hov\">1<\/span><span>2<\/span><span>3<\/span><span>4<\/span> <\/div> ");
document.writeln("        	<ul id=\"msg\" style=\"display:none\">");
document.writeln("            	<li style=\"display:block;\">111111111<\/li>");
document.writeln("                <li>22222222<\/li>");
document.writeln("                <li>333333333<\/li>");
document.writeln("                <li>444444444<\/li>");
document.writeln("                ");
document.writeln("            <\/ul>            ");
document.writeln("        <\/div>");
document.writeln("    	<div id=\"img\">");
document.writeln("        	<a href=\"#nogo\"><img style=\"display:block;\" src=\"Themes\/Skin_Default\/js\/index\/1.gif\" alt=\"\" \/><\/a>");
document.writeln("            <a href=\"#nogo\"><img src=\"Themes\/Skin_Default\/js\/index\/2.gif\" alt=\"\" \/><\/a>");
document.writeln("            <a href=\"#nogo\"><img src=\"Themes\/Skin_Default\/js\/index\/3.gif\" alt=\"\" \/><\/a>");
document.writeln("            <a href=\"#nogo\"><img src=\"Themes\/Skin_Default\/js\/index\/4.gif\" alt=\"\" \/><\/a>");
document.writeln("             ");
document.writeln("        <\/div>");
document.writeln("        ");
document.writeln("    <\/div>");

$(function(){
	 var index = 0;
	 $("#btn span").mouseover(function(){
		index  =  $("#btn span").index(this);
		showImg(index);
	});	
	 //滑入 停止动画，滑出开始动画.
	 $('#imgnav').hover(function(){
			  if(MyTime){
				 clearInterval(MyTime);
			  }
	 },function(){
			  MyTime = setInterval(function(){
			    showImg(index)
				index++;
				if(index==5){index=0;}
			  } , 1600);
	 });
	 //自动开始
	 var MyTime = setInterval(function(){
		showImg(index)
		index++;
		if(index==5){index=0;}
	 } , 1600);
})
//关键函数：通过控制i ，来显示不通的幻灯片
function showImg(i){
		$("#img img")
			.eq(i).stop(true,true).fadeIn(800)
			.parent().siblings().find("img").hide();
		$("#msg li")
			.eq(i).stop(true,true).fadeIn(800)
			.siblings().hide();
		 $("#btn span")
			.eq(i).addClass("hov")
			.siblings().removeClass("hov");
}
