var hasLaunchWindowBeenCreated = false

function loadShareWindow(movieId)
{
	//Make the ajax call to the share window
	ajax('/includes/shareMovie.php', loadWindowResponse)
}

function loadWindowResponse(response)
{
	grayOut(true); 	
	
	if(!createLaunchWindow())
	
	$('launchWindow').innerHTML = response
}

function createLaunchWindow()
{
	var tbody = document.getElementsByTagName("body")[0];
	var mContainer = document.createElement('div'); 
	var xpos = findPosX($flash("flvPlayer"))
	var ypos = findPosY($flash("flvPlayer"))
	
	mContainer.style.position = 'absolute'
	mContainer.id = 'launchWindow'
	mContainer.style.left = xpos + 'px' 
	mContainer.style.top = ypos + 'px'
	mContainer.style.zIndex = 50
	tbody.appendChild(mContainer)	
	
	hasLaunchWindowBeenCreated = true
}

function closeWindow()
{
	grayOut(false); 
	$('launchWindow').innerHTML = ''
}

function loadEmbedWindow(movieId)
{
	//Make the ajax call to the share window
	ajax('/includes/embedVideoWindow.php?movieId='+movieId, loadWindowResponse)	
}