//
//create closure
//

(function($) {
//
// plugin definition
//
$.fn.center = function () {
	this.css("position","absolute");
    this.css("top", (($(window).height() - this.outerHeight()) / 2) + $(window).scrollTop() + "px");
    this.css("left", (($(window).width() - this.outerWidth()) / 2) + $(window).scrollLeft() + "px");
    return this;
}

$.fn.youtube = function (options) {

 // plugin defaults
        $.fn.youtube.defaults = {
            width: 400,
            height: 226,
			VideoID:'',
			Container: "player"
        };

		// build main options before element iteration
        var opts = $.extend({}, $.fn.youtube.defaults, options);

	// Lets Flash from another domain call JavaScript
        var params = { allowScriptAccess: "always" };
        // The element id of the Flash embed
        var atts = { id: "ytPlayer" };
        // All of the magic handled by SWFObject (https://code.google.com/p/swfobject/)
        swfobject.embedSWF("https://www.youtube.com/v/" + opts.VideoID +
                           "&enablejsapi=1&showinfo=0;playerapiid=player1",
                           opts.container,opts.width, opts.height, "8", null, null, params, atts);
}

//
// end of closure
//
})(jQuery);
