// Modify these vars to suit your needs

var cssPath = "uploader/easyflashuploader.css"; 
var formPostURL = "uploader/upload.jsp"; 
var afterCompletionPage = ""; // leave empty if you dont want to redirect
var onCancelPage = "";
var flashMovieObjectEmbedID = "FileUploader"; // the html tag "id" for the flash <object> and <embed> tags
var flashFormID = "OrderingForm"; // the form which has the flash uploader embeded
var maxUploadSize = 524288000; 
var minUploadSize = 16384; 
var allowedFileTypes = '*.jpg;*.jpeg;*.gif;*.tiff;*.bmp;*.tif;*.png;*.swf;*.mov;*.mpeg;*.mpg;*.avi;*.wmv;*.mp3;*.wav;*.wma';
var uploadOnBrowse = true;
var showFlashAlert = true; 
var showNoAlert = false; 


// Called by flash; modify if you want to validate html form
function efuValidateForm()
{
	// put javascript form validation code here if you want
	// this function must return true for the flash to work
	// If there is a validation issue, show js alert box and return false.
	return true;	
}

// --- DO NOT MODIFY BEYOND THIS POINT; UNLESS YOU KNOW WHAT YOU ARE DOING ---
var formValues = ""; // leave it empty
// Called by flash
function efuGetAfterCompletionPage()
{
	return afterCompletionPage;
}

// Called by flash; no modification needed
function efuGetFormPostURL()
{
	return formPostURL;
}

// Called by flash; no modification needed
function efuGetFormValues()
{
	return formValues;
}

function efuGetCssPath()
{
	return cssPath;
}

function efuGetMaxUploadSize()
{
	return maxUploadSize;
}

function efuGetMinUploadSize()
{
	return minUploadSize;
}

function efuGetAllowedFileTypes()
{
	return allowedFileTypes;
}

function efuGetShowFlashAlert()
{
	return showFlashAlert;
}

function efuGetShowNoAlert()
{
	return showNoAlert;
}

function efuGetUploadOnBrowse()
{
	return uploadOnBrowse;
}

// called by html form; no modification needed
function efuGetFlashMovieObject(movieName)
{
  if (window.document[movieName]) 
  {
      return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  }
}

// called by html form; no modification needed
function efuDoSubmit()
{
	if(efuValidateForm())
	{
		formValues = '';
		var flash = efuGetFlashMovieObject(flashMovieObjectEmbedID);
		var formObj = document.getElementById(flashFormID);		
		for (var i = 0; i < formObj.elements.length; i++) 
		{
			formValues += escape(formObj.elements[i].name) + '=' + encodeURI(formObj.elements[i].value) + ((i != (formObj.elements.length - 1)) ? '&':'');
		}
		flash.startUpload();
	}
}

// cancel the current upload
function efuCancelUpload()
{
	var flash = efuGetFlashMovieObject(flashMovieObjectEmbedID);
	flash.cancelUpload();
	if(onCancelPage!='')
	{
		location.href = onCancelPage;
	}
}