jQuery.fn.extend({
	jnews:function(pic,url,picWidth,picHeight,animateTimeLong,animateType){
		  var allNums=new String();
		  var allNews=new String();
		  var pics = pic;/* 图片路径或FLASH路径 */
		  var urls = url;/* 新闻链接 */	
		  var aType = animateType;/* 动画类型，值可以为"fade","animate"*/
		  var aLong = animateTimeLong;/*动画时间*/
		  var width = picWidth;//内容的宽度
		  var height = picHeight;//内容的高度
		  
		  /* 初始化全部内容 */
		  if(aType == "fade"){
		  	  this.html("<ul class='picNews_newsBox'></ul><ul class='picNews_numBox'></ul>");
		  }else if(aType == "animate"){
			  this.html("<ul class='picNews_newsBox_2'></ul><ul class='picNews_numBox'></ul>");
		  }
		  this.css({position:"relative",overflow:"hidden"});
		  for(var i=0;i<pics.length;i++){
			 var j = i+1;
			 allNums = allNums + "<li>"+j+"</li>";
			 if(pics[i].substring(pics[i].lastIndexOf(".")+1,pics[i].length) == "swf" || pics[i].substring(pics[i].lastIndexOf(".")+1,pics[i].length) == "SWF"){
				 /*插入FLASH*/
				 allNews = allNews + "<li style='height:" + height + "px;width:" + width + "px;'><a href='" + urls[i] + "' target='_blank'><object height='" + height + "' width='" + width + "' codebase='http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'><param value='" + pics[i] +"' name='movie'/><param value='Transparent' name='wmode'/><embed height='" + height + "' width='" + width + "' type='application/x-shockwave-flash' wmode='Transparent' src='" + pics[i] +"'/></object></a></li>";
			 }else{
				 /*插入图片*/
				 allNews = allNews + "<li style='height:" + height + "px;width:" + width + "px;'><a href='" + urls[i] + "' target='_blank'><img src='"+pics[i]+"'/></a></li>";
			 }
		  }
		  $(this).find(".picNews_numBox").html(allNums);//初始化按钮个数
		  
		  if(aType == "fade"){
			  $(this).find(".picNews_newsBox").html(allNews);//初始化所有图片和FLASH
			  $(this).find(".picNews_numBox li:eq(0)").addClass("CurNum");//初始化已选定按钮
			  $(this).find(".picNews_newsBox li:eq(0)").addClass("CurNews");//初始化第一个新闻
		  }else if(aType == "animate"){
			  $(this).find(".picNews_newsBox_2").html(allNews);//初始化所有图片和FLASH
			  $(this).find(".picNews_numBox li:eq(0)").addClass("CurNum");//初始化已选定按钮
		  }
		  /* 自动切换 */
		  var c = 1;
		  function clearAuto(){clearInterval(autoRun);}
		  function setAuto(){autoRun = setInterval(autoChange,aLong);}
		  function autoChange(){
			  	if(aType == "fade"){
					$(".picNews_numBox .CurNum").removeClass("CurNum");//清除选定按钮样式
					$(".picNews_newsBox .CurNews").removeClass("CurNews");//清除当前的新闻
					$(".picNews_numBox li:eq(" + c + ")").addClass("CurNum");//设置当前选定按钮
					$(".picNews_newsBox li:eq(" + c + ")").addClass("CurNews");//显示当前新闻
				}else if(aType == "animate"){
					$(".picNews_newsBox_2").animate({top:-c * picHeight},"normal")
					$(".picNews_numBox .CurNum").removeClass("CurNum");//清除选定按钮样式
					$(".picNews_numBox li:eq(" + c + ")").addClass("CurNum");//设置当前选定按钮
				}
				c++;
				if(c >= pics.length){c = 0;}
		  }
		  setAuto();
		  $(".picNews_numBox li").mouseover(function(){
		  	  clearAuto();//停止动画
			  $(".picNews_numBox .CurNum").removeClass("CurNum");//清除选定按钮样式
			  $(this).addClass("CurNum");//设置当前选定按钮
			  
			  var CurNum_i = $(".picNews_numBox li").index($("li.CurNum"));
			  
			  if(aType == "fade"){
				  $(".picNews_newsBox .CurNews").removeClass("CurNews");//清除当前的新闻
				  $(".picNews_newsBox li:eq(" + CurNum_i + ")").addClass("CurNews");//显示当前新闻
			  }else if(aType == "animate"){
				  $(".picNews_newsBox_2").animate({top:-CurNum_i * picHeight},"normal")
			  }
		  }).mouseout(function(){
			  setAuto();//开始动画
		  });
		}
})



















