var swf_upload_control;


        function myShowUI() {
            var btnSubmit = document.getElementById("btnSubmit");
			
			btnSubmit.onclick = doSubmit;
			btnSubmit.disabled = true;		
			
            SWFUpload.swfUploadLoaded.apply(this);  // Let SWFUpload finish loading the UI.
        }
		
		function validateForm() {	
		//	var is_valid = true;		
			//document.getElementById("btnSubmit").disabled = !is_valid;	
			document.getElementById("btnSubmit").disabled = false;
		}
		
		function fileBrowse() {
			var txtFileName = document.getElementById("txtFileName");
			txtFileName.value = "";

			this.cancelUpload();
			this.selectFile();
		}
		
		
        // Called by the submit button to start the upload
		function doSubmit(e) {
			e = e || window.event;
			if (e.stopPropagation) e.stopPropagation();
			e.cancelBubble = true;
			
			try {
				// Add the post parameters to the end of post param array.
				//var formElem = document.forms[0];
				//var formElem = document.extraFields;
				
				
				//var formElem = $('extraFields');
				var params = new Object();
				params['user'] = $('userID').value;
				params['modelID'] = $('modelID').value;
				params['modelName'] = $('modelName').value;
				
				//Stu - Took loop out as it was reliant on the form being forms[0]
				//Good idea but we need to be able to pass the form reference to gain extra fields from....
				
				
				// Loop over the form elements.
				/*for (var index = 0; index < formElem.elements.length; ++index) {
					params[formElem.elements[index].name]
					= formElem.elements[index].value;
				}*/
			//alert(params);
				// Set the post parameters.
				swf_upload_control.setPostParams(params);
				swf_upload_control.startUpload();
			} catch (ex) {
				alert(ex);
            }
            return false;
	    }
