function view_in_window(id, width, height) {
	width = Number(width);
	height = Number(height);

	var max_popup_width = screen.width - 20;
	var max_popup_height = screen.height - 120;

	var max_width = max_popup_width - 20;
	var max_height = max_popup_height - 40;

	var new_width = width;
	var new_height = height;

	var resize_width = width > max_width;
	var resize_height = height > max_height;
	if (resize_width && resize_height) {
		if (width / height >= max_width / max_height) {
			new_width = max_width;
			ratio = new_width / width;
			new_height = Number(height * ratio);
		} else {
			new_height = max_height;
			ratio = new_height / height;
			new_width = Number(width * ratio);
		}
	} else if (resize_width && !resize_height) {
		new_width = max_width;
		ratio = new_width / width;
		new_height = Number(height * ratio);
	} else if (!resize_width && resize_height) {
		new_height = max_height;
		ratio = new_height / height;
		new_width = Number(width * ratio);
	}

	var popup_width = new_width + 27;
	var popup_height = new_height + 40;

//	window.open(get_absolute_location("Uploads/View/" + id + "?width=" + new_width + "&height=" + new_height), "_blank", "resizable=no,width=" + popup_width + ",height=" + popup_height + ",toolbar=no,scrollbars=no,location=no,menubar=no,status=no");
	window.open(COMMON.LOCAL_SITE_URL +"/Uploads/View/" + id + "?width=" + new_width + "&height=" + new_height, "_blank", "resizable=no,width=" + popup_width + ",height=" + popup_height + ",toolbar=no,scrollbars=no,location=no,menubar=no,status=no");
}

function track_view(id) {
	https.get_object({ call_id: "TrackView", parameters: { id: id }, callback: basic_handle });
}

function view_in_dhtml_window(id, file_name, preview_name, width, height) {
	track_view(id);
	view_image_in_dhtml_window(id, file_name, preview_name, width, height);
}

function view_image_in_dhtml_window(id, file_name, preview_name, width, height) {
	width = Number(width);
	height = Number(height);

	var previews = [
		{ width: 1580, height: 1080, prefix: "", postfix: "_1600x1200.jpg" },
		{ width: 1260, height: 840, prefix: "", postfix: "_1280x960.jpg" },
		{ width: 1004, height: 658, prefix: "", postfix: "_1024x768.jpg" },
		{ width: 780, height: 480, prefix: "", postfix: "_800x600.jpg" }
	];
	var max_popup_width = document.documentElement.clientWidth;
	var max_popup_height = document.documentElement.clientHeight;

	var max_width = max_popup_width - 20;
	var max_height = max_popup_height - 40;

	var new_width, new_height, src;

	if (width <= max_width && height <= max_height) {
		new_width = width;
		new_height = height;
		src = file_name;
	} else {
		var best_preview = false;
		for (var i = 0; i < previews.length; i++) {
			if (previews[i].width <= max_width && previews[i].height <= max_height) {
				best_preview = previews[i];
			}
		}
		if (best_preview === false) {
			best_preview = previews[previews.length - 1];
		}
		src = "previews/" + preview_name + best_preview.postfix;

		var best_preview_ratio = best_preview.width / best_preview.height;
		var current_ratio = width / height;
		if (current_ratio < best_preview_ratio) {
			new_height = best_preview.height;
			new_width = current_ratio * new_height;
		} else {
			new_width = best_preview.width;
			new_height = new_width / current_ratio;
		}
	}

	var matches = /[^\/]+$/.exec(file_name);
	YAHOO.dialog.multimedia_dialog.setHeader(matches[0]);
	var html = "<div style=\"display:none\"><img src=\"" + full_htmlspecialchars(src) + "\" width=\"" + new_width + "\" height=\"" + new_height + "\" alt=\"\" onload=\"on_dhtml_image_loaded()\" /></div>";
	html += "<table class=\"loading_asset\" height=\"" + new_height + "px\"><tr><td>Loading Asset</tr></td></table>";
	YAHOO.dialog.multimedia_dialog.form.innerHTML = html;
	YAHOO.dialog.multimedia_dialog.form.parentNode.parentNode.style.width = (new_width + 20).toString() + "px";
	YAHOO.dialog.multimedia_dialog.form.parentNode.parentNode.style.height = (new_height + 40).toString() + "px";
	YAHOO.dialog.multimedia_dialog.show();
}

function on_dhtml_image_loaded() {
	var image_div = get_obj_by_path(YAHOO.dialog.multimedia_dialog.form, "child");
	var loading_div = get_obj_by_path(image_div, "next");
	image_div.style.display = "block";
	loading_div.style.display = "none";
}

function get_inner_html(type, media_path, media_width, media_height, media_mime_type, large_preview_path, dataformat) {
	media_width = Number(media_width);
	media_height = Number(media_height);
	var result = {};
	var inner_html = "";
     var src = full_htmlspecialchars(media_path);
     if (type == "flv") {
		media_height += 20;
		inner_html += '<embed src="' + COMMON.IMAGE_PATH + '/flvplayer.swf" wmode="transparent" width="' + media_width + '" height="' + media_height + '" allowfullscreen="true" allowscriptaccess="always" flashvars="&file=' + COMMON.SITE_URL + '/' + src + '&height=' + media_height + '&width=' + media_width + '&autostart=true&shuffle=false&image=' + COMMON.SITE_URL + '/' + large_preview_path + '" />';
	} else if (type == "audio") {
		media_width = 273;
		media_height = 20;
		inner_html += '<embed src="' + COMMON.IMAGE_PATH + '/flvplayer.swf" width="' + media_width + '" height="' + media_height + '" allowfullscreen="true" allowscriptaccess="always" flashvars="&file=' + COMMON.SITE_URL + '/' + src + '&height=' + media_height + '&width=' + media_width + '&autostart=true&shuffle=false"/>';
     } else if (type == "video") {
		if (browser.is_safari() && media_mime_type == "video/avi") {
               media_mime_type = "video/x-msvideo";
               inner_html += '<object data="' + src + '" type="' + media_mime_type + '" width="' + media_width + '" height="' + media_height + '">\
                    <param name="src" value="' + src + '">\
                    <param name="autoStart" value="1">\
               </object>';
		} else if (media_mime_type == "video/quicktime" && dataformat == "quicktimevr") {
			inner_html += '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"';
			inner_html += ' codebase="http://www.apple.com/qtactivex/qtplugin.cab"';
			inner_html += ' width="' + media_width + '" height="' + media_height + '" >';
			inner_html += ' <param name="src" value="' + src + '">';
			inner_html += ' <param name="bgcolor" value="#ffffff">';
			inner_html += ' <param name="scale" value="tofit">';
			inner_html += ' <param name="controller" value="true">';
			inner_html += '<embed width="' + media_width + '" height="' + media_height + '"';
			inner_html += 'pluginspage="http://www.apple.com/quicktime/download/"';
			inner_html += ' type="video/quicktime"';
			inner_html += ' src="' + src + '"';
			inner_html += ' bgcolor="#ffffff"';
			inner_html += ' scale="tofit"';
			inner_html += ' controller="true"';
			inner_html += ' />';
			inner_html += '</object>';
		} else {
               inner_html += '<embed src="' + src + '"';
               inner_html += ' width="' + media_width + '" height="' + media_height + '"';
               inner_html += ' scale="aspect" ';
               inner_html += ' autostart="true" loop="false"';
               if (media_mime_type) {
               		inner_html += ' type="' + media_mime_type + '"';
				}
				inner_html += '></embed>';
          }
     } else if (type == "image") {
          inner_html += '<img src="' + src + '" width="' + media_width + '" height="' + media_height + '" alt="" />';
     } else if (type == "flash") {
          inner_html += '<object type="application/x-shockwave-flash" data="' + src + '" width="' + media_width + '" height="' + media_height + '">\
               <param name="movie" value="' + src + '">\
               <param name="quality" value="high">\
               <param name="bgcolor" value="#FFFFFF">\
               <param name="wmode" value="transparent">\
          </object>';
     } else {
          return;
     }
     result.html = inner_html;
     result.width = media_width;
     result.height = media_height;
     return result;
}

var playing_media = [];
function show_multimedia(click_to_play_div, upload_file_name, width, height, media_mime_type, is_video, is_flv, large_preview_path, no_dhtml_popup, id, dataformat) {
	track_view(id);
	click_to_play_div = click_to_play_div.parentNode;
	if (no_dhtml_popup) {
		//click_to_play_div.innerHTML = html;
		show_multimedia_common(click_to_play_div, upload_file_name, width, height, is_video, media_mime_type, is_flv, large_preview_path, dataformat);
		playing_media.push(click_to_play_div);
	} else {
		var matches = /[^\/]+$/.exec(upload_file_name);
		YAHOO.dialog.multimedia_dialog.setHeader(matches[0]);
//		YAHOO.dialog.multimedia_dialog.form.innerHTML = html;
		var result = show_multimedia_common(YAHOO.dialog.multimedia_dialog.form, upload_file_name, width, height, is_video, media_mime_type, is_flv, large_preview_path, dataformat);
		YAHOO.dialog.multimedia_dialog.form.parentNode.parentNode.style.width = (result.width + 20).toString() + "px";
		YAHOO.dialog.multimedia_dialog.form.parentNode.parentNode.style.height = (result.height + 40).toString() + "px";

		YAHOO.dialog.multimedia_dialog.show();
	}
}

function show_multimedia_common(div, upload_file_name, width, height, is_video, mime_type, is_flv, large_preview_path, dataformat) {
	if (is_flv) {
		var result = get_inner_html("flv", upload_file_name, width, height, mime_type, large_preview_path, dataformat);
	} else if (is_video) {
		var result = get_inner_html("video", upload_file_name, width, Number(height) + 15, mime_type, undefined, dataformat);
	} else if (mime_type == "audio/x-aiff") {
		var result = get_inner_html("video", upload_file_name, "260", 15, mime_type, undefined, dataformat);
	} else {
		var result = get_inner_html("audio", upload_file_name, width, height, mime_type, undefined, dataformat);
	}
	div.innerHTML = result.html;
	return result;
}

function stop_multimedia() {
//	if (!window.old_gallery_view_type) {
//		multimedia_cancel_handle();
//	} else {
		multimedia_cancel_handle();
		for (var i in playing_media) {
			if (playing_media.hasOwnProperty(i)) {
				var obj = get_obj_by_path(playing_media[i], "child");
				while (obj) {
					try {
						obj.Stop();
					} catch (e) {
					}
					obj = get_obj_by_path(obj, "next");
				}
			}
		}
		playing_media = [];
//	}
}
function on_sort_order_click(obj, field_name, direction) {
	var form = get_form(obj);
	form.sort_field.value = field_name;
	form.sort_direction.value = direction;
	form.offset.value = "0";
	form.submit();
}
function on_list_form_header_link_click(obj, offset) {
	var form = get_form(obj);
	form.offset.value = offset;
	form.submit();
}
function on_limit_change(obj) {
	var form = obj.form;
	form.offset.value = 0;
	form.submit();
}
function clear_form(form) {
	var clearable_attribute;
	for (j = 0; j < form.elements.length; j++) {
		clearable_attribute = form.elements[j].attributes.getNamedItem("clearable");
		if (clearable_attribute || form.elements[j].type == 'text' || form.elements[j].type == 'select-one' || form.elements[j].type == 'textarea') {
			form.elements[j].value = "";
		}
	}
}
function on_new_button_click(module_name) {
	var form = document.forms["new_button"];
	form.action = COMMON.LOCAL_SITE_URL + "/" + module_name + "/EditView";
	form.submit();
}
function on_calendar_update(cal) {
	var field = cal.params.inputField;
	get_obj_by_path(field, "prev").value = cal.date.print("%Y-%m-%d %H:%M:%S");
}
function on_belongs_to_click(obj) {
	var form = obj.form;
	var radio_buttons = form.elements["belongs_to"];
	var parent_selector;
	var parent_row;
	for (var i = 0; i < radio_buttons.length; i++) {
		parent_selector = form.elements[radio_buttons[i].value];
		parent_row = get_obj_by_path(parent_selector, "parent 9");
		if (radio_buttons[i].checked) {
			parent_selector.disabled = false;
			parent_row.style.display = "";
		} else {
			parent_selector.disabled = true;
			parent_row.style.display = "none";
		}
	}
}
function validate_data(form) {
	var error_elements = [];
	var error_messages = [];
	var element;
	var required_attribute;
	var validation_pattern_attribute;
	var display_name_attribute;
	var regexp;
	var error;
	for (var i = 0; i < form.elements.length; i++) {
		error = false;
		element = form.elements[i];
		if (element.disabled) {
			continue;
		}
		required_attribute = element.attributes.getNamedItem("required");
		validation_pattern_attribute = element.attributes.getNamedItem("validation_pattern");
		display_name_attribute = element.attributes.getNamedItem("display_name");
		if (validation_pattern_attribute) {
			regexp = new RegExp(validation_pattern_attribute.nodeValue);
			error = !regexp.test(element.value);
		} else if (required_attribute) {
			error = element.value == "";
		}
		if (error) {
			error_elements.push(element);
			error_messages.push(display_name_attribute.nodeValue + " is not valid");
		}
	}
	//	custom validation
	if (form.elements["custom_validation_function_name"]) {
		var function_name = form.elements["custom_validation_function_name"].value;
		if (function_name && window[function_name] && typeof window[function_name] == "function") {
			var custom_validation_results = window[function_name](form);
			for (var i = 0; i < custom_validation_results.error_elements.length; i++) {
				error_elements.push(custom_validation_results.error_elements[i]);
				error_messages.push(custom_validation_results.error_messages[i]);
			}
		}
	}
	if (error_elements.length) {
		alert("The following error(s) occurred:\n" + error_messages.join(",\n") + ".");
		error_elements[0].focus();
		return false;
	} else {
		return true;
	}
}
function swap_search_display(obj) {
	var div = get_obj_by_path(obj, "parent 3 next");
	if (div.style.display == "none") {
		div.style.display = "block";
		obj.title = "Hide Search";
		obj.value = "Hide Search";
	} else {
		div.style.display = "none";
		obj.title = "Show Search";
		obj.value = "Show Search";
	}
}

function form_keypress_handler(event) {
	var on_enter_callback, on_escape_callback, on_enter, on_escape;
	on_enter = this.getAttribute("on_enter");
	on_escape = this.getAttribute("on_escape");
	if (on_enter) {
		on_enter_callback = window[on_enter];
	} else {
		on_enter_callback = null;
	}
	if (on_escape) {
		on_escape_callback = window[on_escape];
	} else {
		on_escape_callback = null;
	}

	event = event || window.event;
	return on_form_keypress(event, on_enter_callback, on_escape_callback);
}

function add_form_listeners() {
	var form, on_enter_callback, on_escape_callback, on_enter, on_escape;
	for (var i = 0; i < document.forms.length; i++) {
		form = document.forms[i];
		on_enter = form.getAttribute("on_enter");
		on_escape = form.getAttribute("on_escape");
		if (on_enter || on_escape) {
			if (on_enter) {
				on_enter_callback = window[on_enter];
			} else {
				on_enter_callback = null;
			}
			if (on_escape) {
				on_escape_callback = window[on_escape];
			} else {
				on_escape_callback = null;
			}
			if (on_enter_callback || on_escape_callback) {
				form.onkeypress = form_keypress_handler;
			}
		}
	}
}
add_event_listener(window, "load", add_form_listeners);

function on_checkbox_text_click(obj, path) {
	if (path === undefined) {
		path = "prev";
	}
	var checkbox = get_obj_by_path(obj, path);
	checkbox.checked ^= 1;
	if (checkbox.onclick) {
		checkbox.onclick();
	}
}


function get_page_size() {
       var xScroll, yScroll;

       if (window.innerHeight && window.scrollMaxY) {
               xScroll = document.body.scrollWidth;
               yScroll = window.innerHeight + window.scrollMaxY;
       } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
               xScroll = document.body.scrollWidth;
               yScroll = document.body.scrollHeight;
       } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
               xScroll = document.body.offsetWidth;
               yScroll = document.body.offsetHeight;
       }

       var windowWidth, windowHeight;
       if (self.innerHeight) {        // all except Explorer
               windowWidth = self.innerWidth;
               windowHeight = self.innerHeight;
       } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
               windowWidth = document.documentElement.clientWidth;
               windowHeight = document.documentElement.clientHeight;
       } else if (document.body) { // other Explorers
               windowWidth = document.body.clientWidth;
               windowHeight = document.body.clientHeight;
       }

       // for small pages with total height less then height of the viewport
       if (yScroll < windowHeight){
               pageHeight = windowHeight;
       } else {
               pageHeight = yScroll;
       }

       // for small pages with total width less then width of the viewport
       if (xScroll < windowWidth){
               pageWidth = windowWidth;
       } else {
               pageWidth = xScroll;
       }

       return { page_width: pageWidth, page_height: pageHeight, window_width: windowWidth, window_height: windowHeight };
}

function show_overlay(text) {
	var obj = document.getElementById("overlay");
	var page_size = get_page_size();
	obj.style.height = page_size.page_height + "px";
	obj.style.display = "block";
	var text_container = get_obj_by_path(obj, "child 0 0 0 0 0");
	set_node_value(text_container, text);
	var dimensions = get_dimensions(text_container);
	var height_diff = Math.floor((page_size.page_height - page_size.window_height) / 2);
	var x = Math.round((dimensions.width - 145) / 2);
	var y = Math.round((dimensions.height));
	text_container.style.backgroundPosition = x.toString() +  "px 55px";
	if (height_diff > 0) {
		get_obj_by_path(obj, "child").style.marginTop = "-" + height_diff.toString() + "px";
	}
}

function hide_overlay() {
	document.getElementById("overlay").style.display = "none";
}

function is_quicktime_installed() {
	var result = false;
	var quicktime_object = false;
	if (navigator.plugins && navigator.plugins.length) {
		var navigatorLength = navigator.plugins.length;
		for (var i = 0; i < navigatorLength; i++ ) {
			var plugin = navigator.plugins[i];
			if (plugin.name.indexOf("QuickTime") > -1) {
				result = true;
				break;
			}
		}
	} else {
		execScript("on error resume next: quicktime_object = IsObject(CreateObject('QuickTimeCheckObject.QuickTimeCheck.1'))", "VBScript");
		result = quicktime_object;
	}
	return result;
}

function basic_handle(result) {
}

//	upload progress
var check_for_invalid_upload_timer;
var check_for_hanged_request_timer;
var transform_parameters;
var refresh_upload_status_timer;
var refresh_upload_status_interval = 300;

function init_transform_parameters() {
	transform_parameters = {
		url: "",
		files_total: 0,
		error: "",
		upload_started: false,
		stopped : false
	};
}

function init_upload_variables() {
	check_for_invalid_upload_timer = null;
	check_for_hanged_request_timer = null;
	refresh_upload_status_timer = null;
	document.forms["upload_form"].UPLOAD_IDENTIFIER.value = uid;
	document.forms["upload_form"].submitting = false;
}

function refresh_upload_status() {
	https.get_object({ url: "index.php?module=json&action=upload_info&UPLOAD_IDENTIFIER=" + uid, callback: refresh_upload_status_callback });
	check_for_hanged_request_timer = window.setTimeout("https.abort()", 2000);
}

function clear_hanged_request_timer() {
	if (check_for_hanged_request_timer) {
		window.clearTimeout(check_for_hanged_request_timer);
	}
}

function refresh_upload_status_callback(result) {
	if (!result) {
		result = { "empty": true };
	}
	clear_hanged_request_timer();
	var not_empty = !result.empty;
	transform_parameters.upm = result.upm;
	if (!transform_parameters.upload_started) {
		transform_parameters.upload_started = not_empty;
	}
	if (not_empty) {
		transform_parameters.error = "";
	}
	transform_parameters.result = result;
	transform();
	if (!transform_parameters.upload_started || not_empty) {
		set_refresh_upload_status_timer();
	} else {
		clear_refresh_upload_status_timer();
	}
}

function transform() {
	if (window.exiting) {
		return;
	}
	var params = transform_parameters;
	var indicator_bar = document.getElementById("indicator_bar");
	var indicator_text = document.getElementById("indicator_text");
	var indicator_container = document.getElementById("indicator_container");
	var complete_container = document.getElementById("complete_container");
	var upload_result = document.getElementById("upload_result");
	var error_container = document.getElementById("error_container");
	var error = document.getElementById("error");
	var progress_container = document.getElementById("progress_container");
	var progress_file = document.getElementById("progress_file");
	var current_speed = document.getElementById("current_speed");
	var average_speed = document.getElementById("average_speed");
	var uploaded = document.getElementById("uploaded");
	var time_passed = document.getElementById("time_passed");
	var time_left = document.getElementById("time_left");
	var please_wait = document.getElementById("please_wait");
	var abort_link = document.getElementById("abort_link");

	if (params.url) {
		error_container.style.display = "none";
		progress_container.style.display = "none";
		please_wait.style.display = "none";

		indicator_bar.style.width = "100%";
		indicator_text.innerHTML = "100 %";
		upload_result.innerHTML = "";

		indicator_container.style.display = "block";
		complete_container.style.display = "block";
		abort_link.style.display = "none";
	} else if (params.error) {
		indicator_container.style.display = "none";
		complete_container.style.display = "none";
		progress_container.style.display = "none";
		please_wait.style.display = "none";

		error.innerHTML = params.error;

		error_container.style.display = "block";
		abort_link.style.display = "block";
	} else if (!progress_bar_enabled) {
		indicator_container.style.display = "none";
		complete_container.style.display = "none";
		error_container.style.display = "none";
		progress_container.style.display = "none";

		please_wait.style.display = "block";
		abort_link.style.display = "block";
	} else if (!params.result.empty) {
		complete_container.style.display = "none";
		error_container.style.display = "none";
		please_wait.style.display = "none";

		var percent = Math.round(params.result.bytes_uploaded * 100 / params.result.bytes_total);/**/
		indicator_bar.style.width = percent + "%";
		indicator_text.innerHTML = percent + " %";

		progress_file.innerHTML = "Uploading file <strong>" + params.result.files_uploaded + "<\/strong> of <strong>" + params.files_total + "<\/strong>";
		current_speed.innerHTML = "Current speed: <strong>" + format_size(params.result.speed_last) + "/s<\/strong>";
		average_speed.innerHTML = "Average speed: <strong>" + format_size(params.result.speed_average) + "/s<\/strong>";
		uploaded.innerHTML = "Uploaded <strong>" + format_size(params.result.bytes_uploaded) + "<\/strong> of <strong>" + format_size(params.result.bytes_total) + "</strong>";
		time_passed.innerHTML = "Time Passed: <strong>" + format_time(params.result.time_last - params.result.time_start) + "<\/strong>";
		time_left.innerHTML = "Time Left: <strong>" + format_time(params.result.est_sec) + "<\/strong>";

		indicator_container.style.display = "block";
		progress_container.style.display = "block";
		abort_link.style.display = "block";
	} else if (!params.upload_started) {
		indicator_container.style.display = "none";
		complete_container.style.display = "none";
		error_container.style.display = "none";
		progress_container.style.display = "none";

		please_wait.style.display = "block";
		abort_link.style.display = "block";
	} else {
		indicator_container.style.display = "none";
		error_container.style.display = "none";
		progress_container.style.display = "none";
		please_wait.style.display = "none";

		upload_result.innerHTML = "Please wait while previews are generated.";

		complete_container.style.display = "block";
		abort_link.style.display = "block";
	}
}

function check_for_invalid_upload() {
	if (transform_parameters.upm !== false && !transform_parameters.upload_started) {
		transform_parameters.error = "Cannot get upload status. Looks like we've got an error here. Upload cancellation is recommended.";
	}
}

function abort_upload() {
	window.exiting = true;
	var parent_project = projects.get_selected_project();
	var url;
	if (!parent_project) {
		url = window.location.href;
	} else {
		url = COMMON.LOCAL_SITE_URL + "/folders/" + parent_project.get_full_name();
	}
	window.location.href = url;
}

function on_upload_successfull() {
	stop_everything();
	transform_parameters.url = true;
	transform_parameters.upload_done = true;
	transform();
}

function on_upload_error(error_message) {
	stop_everything();
	transform_parameters.error = error_message;
	transform_parameters.upload_done = true;
	transform();
}

function stop_everything() {
	clear_refresh_upload_status_timer();
	clear_check_for_invalid_upload_timer();
	transform_parameters.stopped = true;
	https.abort();
}

function clear_refresh_upload_status_timer() {
	if (refresh_upload_status_timer) {
		window.clearTimeout(refresh_upload_status_timer);
	}
}

function set_refresh_upload_status_timer(interval) {
	clear_refresh_upload_status_timer();
	if (transform_parameters.stopped) {
		return;
	}
	if (interval == undefined) {
		interval = refresh_upload_status_interval;
	}
	refresh_upload_status_timer = window.setTimeout("refresh_upload_status();", interval);
}

function clear_check_for_invalid_upload_timer() {
	if (check_for_invalid_upload_timer) {
		window.clearTimeout(check_for_invalid_upload_timer);
	}
}

