$.fn.player = function( ){
	if( $(this).attr("width") ) {
		this.width = $(this).attr("width");
	}else{
		this.width = 500;
	}
	if( $(this).attr("height") ) {
		this.height = $(this).attr("height");
	}else{
		this.height = 500;
	}
	var file = $(this).attr("href");
	obj = this;
	this.swf = function( file ){ //显示swf
		$("body").append('<div id="salmon-player-alpha"><div id="salmon-player-title">关闭</div><div id="salmon-player"></div></div>');
		$("#salmon-player").html('<object id="173game1" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+ this.width +'" height="'+this.height+'"><param name="allowfullscreen" value="true"><param name="movie" value="'+file+'"><param name=""quality" value="high"><embed id="173game2" src="'+file+'" width="'+ this.width +'" height="'+this.height+'" align="middle" type="application/x-shockwave-flash"/></object>');
		this.work();
		return this;
	};
	this.img = function ( file ){
		var url = 'file='+file+'&amp;height='+obj.height+'&amp;width='+obj.width+'&amp;autostart=true&amp;controlbar=bottom&amp;backcolor=0x000000&amp;frontcolor=0xCCCCCC&amp;lightcolor=0x557722';
		$("body").append('<div id="salmon-player-alpha"><div id="salmon-player-title">关闭</div><div id="salmon-player"></div></div>');
		$("#salmon-player").html('<img id="" src="'+ file +'" height="'+this.height+'" width="'+ this.width +'" />');
		this.work();
	};
	this.flv = function (file){
		var url = 'file='+file+'&amp;height='+obj.height+'&amp;width='+this.width+'&amp;autostart=true&amp;controlbar=bottom&amp;backcolor=0x000000&amp;frontcolor=0xCCCCCC&amp;lightcolor=0x557722';
		$("body").append('<div id="salmon-content"><div id="salmon-player-alpha"><div id="salmon-player-title">关闭</div><div id="salmon-player"></div></div></div>');
		$("#salmon-player").html('<object id="173game1" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+ this.width +'" height="'+this.height+'"><param name="allowfullscreen" value="true"><param name="movie" value="/play/player.swf"><param name="wmode" value="transparent" /><param name=""quality" value="high"><param name="flashvars" value="'+ url +'"><embed id="173game2" src="/play/player.swf?'+url+'" width="'+ this.width +'" height="'+this.height+'" align="middle" type="application/x-shockwave-flash"/></object>');
		

		this.work();
		return this;
	};
	this.work = function (){
		var clientWidth = document.body.clientWidth; //可见区域宽
		var clientheigt = ($(window).height() - obj.height ) / 2;
		if( clientheigt <= 0){
			clientheigt = $(document).scrollTop() + 50;
		}else{
			clientheigt = $(document).scrollTop() + clientheigt;
		}
		$("#salmon-player-alpha").show();
		$("#salmon-player-alpha").css("width", obj.width + 'px');
		$("#salmon-player-alpha").css("height", obj.height + 'px');
		$("#salmon-player-alpha").css("top", clientheigt);
		$("#salmon-player-alpha").css("left", (clientWidth - obj.width) / 2);
		$("#salmon-player-title").click(function (){
			$("#salmon-player-alpha").remove();	
		});
		$(document).scroll( function (){
			var height = ($(window).height() - obj.height ) / 2;
			if( height <= 0){
				height = $(document).scrollTop() + 50;
			}else{
				height = $(document).scrollTop() + height;
			}
			$("#salmon-player-alpha").css("top", height);
		});
	};
	if( file.indexOf(".swf")>0 ){
		this.swf( file );
	}else if( file.indexOf(".flv")>0 ){
		this.flv( file );
	}else{
		this.img( file );
	}
	return this;
};