var url;
var width;
var height;

function closeMovie(){
	var target=document.getElementById('movieBkg');
	target.parentNode.removeChild(target);
}

function showMovie(url, width, height){
	
	
	
	var num = Number(height);
	height = num + 20;

	var movieBkg = document.createElement('div');
	movieBkg.setAttribute('id', 'movieBkg');
	document.getElementById('container').appendChild(movieBkg);

	var movieContainer = document.createElement('div');
	movieContainer.setAttribute('id', 'movieContainer');
	document.getElementById('movieBkg').appendChild(movieContainer);

	var closeButtonContainer = document.createElement('div');
	closeButtonContainer.setAttribute('id', 'closeButtonContainer');
	closeButtonContainer.setAttribute('style', 'position:relative; width:100%;');
	document.getElementById('movieContainer').appendChild(closeButtonContainer);
	
	var closeButton = document.createElement('input');
	closeButton.setAttribute('id', 'closeButton');
	closeButton.setAttribute('class', 'closeButton');
	closeButton.setAttribute('value', 'close');
	closeButton.setAttribute('name', 'close');
	closeButton.setAttribute('type', 'button');
	closeButton.setAttribute('onClick', 'closeMovie();');
	document.getElementById('closeButtonContainer').appendChild(closeButton);

	var movObjectContainer = document.createElement('div');
	movObjectContainer.setAttribute('id', 'movObjectContainer');
	movObjectContainer.setAttribute('style', 'position:relative; width:100%;');
	document.getElementById('movieContainer').appendChild(movObjectContainer);
	
	/*var movObject = document.createElement('OBJECT');
	movObject.setAttribute('id', 'movObject');
	movObject.setAttribute('class', 'movie');
	movObject.setAttribute('classid', 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B');
	movObject.setAttribute('codebase', 'http://www.apple.com/qtactivex/qtplugin.cab');
	movObject.setAttribute('width', width);
	movObject.setAttribute('height', height);
	//movObject.innerText = "<param name='src' value='"+url+"'><param name='qtsrc' value='"+url+"'><param name='autoplay' value='true'><param name='controller' value='true'><param name='loop' value='false'><EMBED src="+url+" qtsrc="+url+" width='"+width+"' height='"+height+"' autoplay='true' controller='true' loop='false' pluginspage='http://www.apple.com/quicktime/download/'></EMBED>";
	document.getElementById('movObjectContainer').appendChild(movObject);



			
			

	// PARAMETERS //
	
	var par1 = document.createElement('param');
	par1.setAttribute('name', 'src');
	par1.setAttribute('value', url);
	document.getElementById('movObject').appendChild(par1);
	
	var par2 = document.createElement('param');
	par2.setAttribute('name', 'qtsrc');
	par2.setAttribute('value', url);
	document.getElementById('movObject').appendChild(par2);
	
	var par3 = document.createElement('param');
	par3.setAttribute('name', 'autoplay');
	par3.setAttribute('value', 'true');
	document.getElementById('movObject').appendChild(par3);
	
	var par4 = document.createElement('param');
	par4.setAttribute('name', 'controller');
	par4.setAttribute('value', 'true');
	document.getElementById('movObject').appendChild(par4);
	
	var par5 = document.createElement('param');
	par5.setAttribute('name', 'loop');
	par5.setAttribute('value', 'false');
	document.getElementById('movObject').appendChild(par5);*/

	// PARAMETERS //


	var EmbedObj = document.createElement('embed');
	EmbedObj.setAttribute('src', url);
	EmbedObj.setAttribute('qtsrc', url);
	EmbedObj.setAttribute('width', width);
	EmbedObj.setAttribute('height', height);
	EmbedObj.setAttribute('autoplay', 'true');
	EmbedObj.setAttribute('controller', 'true');
	EmbedObj.setAttribute('loop', 'false');
	EmbedObj.setAttribute('pluginspage','http://www.apple.com/quicktime/download/');
	document.getElementById('movObjectContainer').appendChild(EmbedObj);

	
	
	
	
					
	//document.write("<div id='movieBkg' style='position: absolute; top: 0px; left: 0px; height: 100%; width: 100%; background-color:rgb(0,0,0); z-index:5;'><div id='movie' style='position: absolute; maring-left: auto; maring-right: auto; box-shadow: 0 0 30px rgba(150, 150, 150, 1); -webkit-box-shadow: 0 0 30px rgba(150, 150, 150, 1); -moz-box-shadow: 0 0 30px rgba(50, 150, 150, 1); z-index: 6;'><input value='close' name='close' type='button' onClick='closeMovie();'><br/><OBJECT classid='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B' codebase='http://www.apple.com/qtactivex/qtplugin.cab' width='"+width+"' height='"+height+"'><param name='src' value='"+url+"'><param name='qtsrc' value='"+url+"'><param name='autoplay' value='true'><param name='controller' value='true'><param name='loop' value='false'><EMBED src="+url+" qtsrc="+url+" width='"+width+"' height='"+height+"' autoplay='true' controller='true' loop='false' pluginspage='http://www.apple.com/quicktime/download/'></EMBED></OBJECT></div></div>");
}
