function getFlashObj(id) 
{
	return 	window.document[id];
}

function callFlashFunc(func,arg)
{
	if( arg == undefined ) arg = '';
	
	var fChart = getFlashObj('uploaderSWF');
	
	//alert(' ' + arg + ' ' + func);
	
	fChart.SetVariable("as_func_args", arg);
	fChart.SetVariable("as_func_name", func);
}

function onBrowseFile()
{	
	callFlashFunc('selectVideoFile','')
}

function onUploadFile()
{
	if( isFileSelected ) 
	{
		callFlashFunc('startUpload','')
		var el = getEl('progressBar');
		el.style.display = "block";		
		el.style.height = '90px';
				
		isFileUploading = true;
	}
}

isFileSelected = false;
isFileUploading = false;

function onFileSelected(fname)
{
	var f = getEl('uploadFileName');
	f.value = fname;
	
	isFileSelected = true;
}

function onCompleteUpload(fname)
{
	//window.location.reload(false);
	//history.go(0)
	//window.location.href=window.location.href
	
	//window.location.reload();
	
	//alert('completed ' + fname);
	
	var u = getEl('upload_file_name');
	u.value = fname;
	document.theForm.submit();
	//
}

function getEl(id)
{
	return document.getElementById(id);
}
