// JS code here to retrieve file links indirectly

// retrieves a dynamically generated link from the server
retrieveFileLink = function(page, name) {
	$.ajax({
		type: "POST",
		url: base+page,
		dataType: "json",
		data: "name="+name+"&code="+orderCode+"&language="+language+randomizer(),
		success: function(response) {
			if (response) {
				if (
					typeof(response.filename) == "string" &&
					typeof(response.link) == "string"
				) {
					displayMessage(
						lang["downloadfile"]+":<br /><br /><a href='"+
						response.link+"' target='_new'>"+response.filename+"</a>",
						275,
						300
					);
				} else if (typeof(response.error) == "string") {
					displayError(response.error);
				} else {
					displayError(lang["invalidcontent"]);
				}
			} else {
				displayError(response);
			}
		},
		failure: function(response) {
			displayError(response);
		}
	});
}

var fileFunctionsLoaded = true;
