/*
name: jukebox-lightbox.js
$Rev: 45084 $
$Date: 2009-07-21 15:15:11 -0400 (Tues, 21 Jul 2009) $
author: Dan Kantor
dependency : streampad-jukebox.js
*/
///////////////////////////////////////////////////////////////
Jukebox.Lightbox = {
	create : function(title, allowClose){
		jQuery('#container').css('opacity', .2);
		var wh = jQuery(window).height();
		var ws = jQuery(window).scrollTop(); 
		var ww = jQuery(window).width();
		var wsw = jQuery(window).scrollLeft();
		var vidTop = Math.round( (wh - 400) / 2 ) + ws;
		var vidLeft = Math.round( (ww - 500) / 2 ) + wsw;
		var showClose = "<div id=\"lightboxclose\" title=\"Close\"></div>";
		if (allowClose == false){
			showClose = "";
		}
		var div = jQuery("<div id=\"lightboxdiv\" class=\"lightboxelement\">"+showClose+"<div class=\"lightboxtop lightboxelement\" draggable=\"true\">"+title+"</div><div class=\"lightboxmiddle lightboxelement\"></div></div>");
		jQuery(div).css({"top" : "80px", "left" : vidLeft, "height" : "400px", "width" : "500px"});
		jQuery(document.body).append(div);
		if (allowClose == true){
			jQuery(document).bind("click", Jukebox.Lightbox.close);
		}
		/*jQuery('.lightboxtop').bind('dragstart', Jukebox.Drag.lightbox.dragstart);
		jQuery('#lightboxdiv').bind('dragover', Jukebox.Drag.lightbox.dragover);
		jQuery('#lightboxdiv').bind('dragenter', Jukebox.Drag.lightbox.dragenter);
		//jQuery('#lightboxdiv').bind('dragend', Jukebox.Drag.lightbox.dragend);
		//jQuery('#lightboxdiv').bind('drag', Jukebox.Drag.lightbox.drag);
		console.log(jQuery('.lightboxmiddle'), 22)*/
		return jQuery('.lightboxmiddle');
	},
	close : function(e){
		if (jQuery(e.target).hasClass('lightboxelement')){
		} else {
			Jukebox.Lightbox.closeLightbox();
		}
	},
	closeLightbox : function(){
		jQuery(document).unbind("click", Jukebox.Lightbox.close);
		jQuery('#lightboxdiv').remove();
		jQuery('#container').css('opacity', 1);
	}
}