function updateMovie(playerPath, file, image, player) {
	if(image != '')
		var FO = {	movie:playerPath+"flvplayer.swf",width:"440",height:"340",majorversion:"7",build:"0",bgcolor:"#FFFFFF",flashvars:"image="+image+"&file="+file+"&autostart=true" };
	else {
		var FO = {	movie:playerPath+"flvplayer.swf",width:"440",height:"340",majorversion:"7",build:"0",bgcolor:"#FFFFFF",flashvars:"file="+file+"&autostart=true" };
	}
	UFO.create(	FO, player);
}

/*
* addMovie  - function which add a  movie
* deleteMovie  - function which remove a movie
*/
var index = 1;
var limitMovie = 1;
var limitMovies = 1;
function addMovie(id){
	if(limitMovie <= limitMovies) {
		var countMovies = parseInt(document.getElementById('countMovies').value, 10);	
		if(countMovies <= 0 || countMovies == '')
			index = 1;
		else if(countMovies > 0)
			index = countMovies + 1;
		document.getElementById('countMovies').value = index;
		var htmlPlace = document.getElementById('movies');
		var labelTranslate = document.getElementById('lg_movLabelTranslate');	
		var labelRemove = document.getElementById('lg_movLabelRemove');	
		fileObject = "<label for=\"movie_" + index + "\">" + labelTranslate.value + ":</label><input type=\"file\" name=\"movie_" + index + "\" id=\"movie_" + index + "\" class=\"file\"/> <a href=\"javascript:deleteMovie(" + index + ", 0);\" title=\"" + labelRemove.value + "\" class=\"removeMovie\">" + labelRemove.value + "</a>";
		//create the container
		var div2 = document.createElement('DIV');
		div2.id = "movieID_" + index;
			//adding a child into container 
			var div = document.createElement('DIV');
			div.innerHTML += fileObject;
		
		div2.appendChild(div);
		htmlPlace.appendChild(div2);
		index++;
		limitMovie++;
	}//end if
}//addMovie

function deleteMovie(indexOut, origMovie){
	var origImgPlace;
	//adding to a hidden input all the original movies removed
	if(origMovie != 0) {
		document.getElementById('originalMovies').value +=  "|" + origMovie;
	}//end if
	//removing a child from container: composed by: file input
	var div =  document.getElementById('movieID_' + indexOut);
	div.removeChild(div.firstChild);
	div.style.display = "none";
	limitMovie--;
}//end function deleteMovie(indexOut, origMovie)

