$(function(){
 //pic_width 图片宽度
 //pic_height 图片高度
 //button_pos按扭位置 1左 2右 3上 4下
 //stop_time图片停留时间(1000为1秒钟)
 //show_text是否显示文字标签 1显示 0不显示
 //txtcolor 文字色
 //bgcolor背景色
 //imag=[];
 //link=[];
 //text=[];
 //file_url=""//images/AdsFile.swf
  $.fn.flashad=function(obj){
	///////////////////////////////////////获取
	var img=[];
	var text=[];
	var link=[];
	$(this).find("a").each(function(i){
		img.push($(this).attr("rel"));
		text.push($(this).text());
		link.push($(this).attr("href"));
	});
	//////////////////////////////////////
	
	var def={width:200,height:200,button_position:4,stop_time:3000,show_text:0,txtcolor:"000000",bgcolor:"ffffff",img:img.join("|"),text:text.join("|"),link:link.join("|"),file_url:"images/AdsFile.swf"}
	$.extend(def,obj);
	var swf_height=def.show_text==1?def.height+20:def.height;//swf设置

	var flashset='width="'+ def.width +'" height="'+ swf_height +'"';
	var value='pics='+def.img+'&links='+def.link+'&texts='+def.text+'&pic_width='+def.width+'&pic_height='+def.height+'&show_text='+def.show_text+'&txtcolor='+def.txtcolor+'&bgcolor='+def.bgcolor+'&button_pos='+def.button_position+'&stop_time='+def.stop_time
	this.html('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cabversion=6,0,0,0" '+flashset+'><param name="movie" value="'+def.file_url+'"><param name="quality" value="high"><param name="wmode" value="opaque"><param name="FlashVars" value="'+value+'" quality="high" '+flashset+' allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /><embed src="'+def.file_url+'" FlashVars="'+value+'" quality="high" '+flashset+' allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');
	return true
  }
 // $("body").flashad({img:img.join("|"),link:link.join("|"),text:text.join("|"),file_url:"images/AdsFile.swf"} );
 })
