/*
# $Id: editDoc.js 1 2006-12-16 10:21:16Z james $
*/

//-------------------------------
// VOID updateDocName( filename, docName )
//--
// HTMLElement	= File upload box from which the name will be extracted
// STRING	= ID of input element in which to store the document name
//--
// Extracts the actual filename by removing the directory information
// and set as the document name if none has been specified.
//-------------------------------
function updateDocName(filename, docName) {

	// Vars
	docName = getHTMLElement(docName);
	filename = filename.value;
	if(docName.value!="") return false;

	// Format filename
	filename = filename.replace(/\\/g, "/");
	filename = filename.substr(filename.lastIndexOf("/")+1);

	// Set as document name
	docName.value = filename;
}

function changeLocale(list) {

	// Vars
	var form = document.forms['form_interface'];
	var id = form['id'].value;
	var locale = list.options[list.selectedIndex].value;

	// Redirect
	self.location = EXNT_genHREF('doc', 'editDoc', {id:id, lang:locale});
}