function VideoPlayerOverlay(containerClass,contentClass) {

	this.flashContainerId = "flashcontainer"
	this.overlay = $("<div></div>").attr('class',containerClass);
	this.overlaycontent = $("<div></div>").attr('class',contentClass);
	this.overlaycontentflashcontainer = $("<div></div>").attr('id',this.flashContainerId);
	this.flashMovie;
	this.videoToPlay;
	var mainObject = this;

	$(document).ready(function(e){
		
		
		$('body ').append(mainObject.overlay);
		$('body ').append(mainObject.overlaycontent);
		
		mainObject.overlaycontent.append(mainObject.overlaycontentflashcontainer);
		mainObject.overlay.click(function(e){
			mainObject.hideOverlay();
		});
		
		$(document).keyup(function(event){
		    if (event.keyCode == 27) {
		        mainObject.hideOverlay();
		    }
		});

		
		$(".maincontent .playvideo").click(function(e){
			e.preventDefault();
			mainObject.flashMovie = this.href;
			mainObject.showOverlay();
			
		});
	});
	
	
	
	
	
}
VideoPlayerOverlay.prototype.showOverlay = function() {

	//this.overlay.fadeIn("slow");
	this.overlay.css("display","block");
	this.overlay.css("height",$('body').height());
	//this.overlaycontent.fadeIn("slow");
	var topPos = ($(window).height() / 2) - 220;
	//console.log(topPos)
	this.overlaycontent.css("top", topPos +"px")
	this.overlaycontent.css("display","block");
	this.swfObjectEmbed();
	
}
VideoPlayerOverlay.prototype.hideOverlay = function() {
	//this.overlay.fadeOut("slow");
	//this.overlaycontent.fadeOut("slow");
	this.overlay.css("display","none");
	this.overlaycontent.css("display","none");

}
VideoPlayerOverlay.prototype.swfObjectEmbed = function() {

	var flashvars = {};
	var params = {};
	var attributes = {};
	//flashvars.path =  "static/flash/";
	//flashvars.xmlFileName = encodeURIComponent(xmlFileName);
	params.wmode = "transparent";
	attributes.id = "flashcontainer";
	attributes.align = "left";

	swfobject.embedSWF(this.flashMovie, this.flashContainerId, "550", "440", "9.0.0", "", flashvars, params, attributes);
	
}
