(function($){

	$.fn.centerFlash = function(options){

		
		var opts = $.fn.extend({}, $.fn.centerFlash.defaults, options);
		var count = 1;
		
		return this.each(function(){
					
			var $this = $(this);
			
			var random = Math.floor(Math.random() * (opts.total)) + 1;
			
			var params = {
				  wmode: "transparent"
			};

			swfobject.embedSWF("flash/2011_head.swf", "swfobject", opts.width, opts.height, "9.0.0","expressInstall.swf", {}, params , {id: "flashMovie"});
			
			var wWidth = $(window).width();
			var elWidth = opts.width;
			//alert(elWidth);
			if(elWidth > wWidth){
				var left = (elWidth / 2) - (wWidth/2);
				$this.css("left","-" + left + "px")
			}else{
				var left = (wWidth / 2) - (elWidth/2);
				$this.css("left","-" + left + "px")
				
			}

			$(window).resize(function(){
				var wWidth = $(window).width();
				//alert(wWidth);
				if(elWidth > wWidth){
					
					var left = (elWidth / 2) - (wWidth/2);
					//alert(left);
					$this.css("left","-" + left + "px")
				}else{
					var left = (wWidth / 2) - (elWidth/2);
					$this.css("left","-" + left + "px")
					
				}
				
			});
		});//each
	
	};//centerFlash
	
  $.fn.centerFlash.defaults = {
		  total:  1,
		  width:2100,
		  height:239
  };//defaults

	
})(jQuery);

