<!--

msg_nofile = new Array();
msg_notdci = new Array();
msg_noname = new Array();
msg_noreg  = new Array();
msg_nodesc = new Array();
msg_upload = new Array();
msg_wait   = new Array();

msg_nofile['en'] = 'Please select a DCI file to upload.';
msg_notdci['en'] = 'Only DCI files are supported. Please try again.';
msg_noname['en'] = 'Please choose the NAME of the game to be used with your file.\n*If the game isn\'t in the list* you can add it with the "New game" button.';
msg_noreg['en']  = 'Please choose the REGION of the game to be used with your file.';
msg_nodesc['en'] = 'It seems that you forgot the description of your file, do you want to add it?';
msg_upload['en'] = 'Uploading begins...';
msg_wait['en']   = 'Your file is being uploaded, please wait.';

msg_nofile['fr'] = 'Veuillez choisir un fichier DCI à envoyer.';
msg_notdci['fr'] = 'Suls les fichiers DCI sont supportés. Veuillez réessayer.';
msg_noname['fr'] = 'Veuillez choisir le NOM du jeu avec lequel utiliser votre fichier.\n*Si le jeu n\'est pas dans la liste* vous pouvez l\'ajouter avec le bouton "Nouveau jeu".';
msg_noreg['fr']  = 'Veuillez choisir la REGION du jeu avec lequel utiliser votre fichier.';
msg_nodesc['fr'] = 'Il semble que vous ayez oublié la description de votre fichier, voulez vous l\'ajouter?';
msg_upload['fr'] = 'Début de l\'envoi...';
msg_wait['fr']   = 'Votre fichier est en cours d\'envoi, veuillez patienter.';

function upload(lg) {
	if (lg != 'fr') {
		lg = 'en';
	}

	if (submited) {
		alert(msg_wait[lg]);
		document.images['uploading'].src = document.images['preloaded'].src;

		return;
	}


	var el = '';

	if (document.ulform.dcifilepath.value == '' || document.ulform.dcifilepath.value == null) {
		if (typeof(document.getElementById) != 'undefined') {
			replacebgcol(document.getElementById('dcifilepath_id'), 'ff8f8f');
		}

		alert(msg_nofile[lg]);
		document.ulform.dcifilepath.focus();
		document.ulform.dcifilepath.select();

		return;
	}

	validformFile = /(.dci|.DCI)$/;
	if(!validformFile.test(document.ulform.dcifilepath.value)){
		if (typeof(document.getElementById) != 'undefined') {
			replacebgcol(document.getElementById('dcifilepath_id'), 'ff8f8f');
		}

		alert(msg_notdci[lg]);
		document.ulform.dcifilepath.focus();
		document.ulform.dcifilepath.select();

		return;
	}

	if (document.ulform.gamename.options[document.ulform.gamename.selectedIndex].value == '') {
		if (typeof(document.getElementById) != 'undefined') {
			replacebgcol(document.getElementById('gamename_id'), 'ff8f8f');
		}

		alert(msg_noname[lg]);
//		document.ulform.gamename.focus();

		return;
	}

	if (document.ulform.region.options[document.ulform.region.selectedIndex].value == '') {
		if (typeof(document.getElementById) != 'undefined') {
			replacebgcol(document.getElementById('region_id'), 'ff8f8f');
		}

		alert(msg_noreg[lg]);
		document.ulform.region.focus();

		return;
	}

	if (document.ulform.gamedesc.value.length < 8) {
		if (typeof(document.getElementById) != 'undefined') {
			replacebgcol(document.getElementById('gamedesc_id'), 'ff8f8f');
		}

		if (confirm(msg_nodesc[lg])) {
			document.ulform.gamedesc.focus();
			return;
		}
	}

	submited = 1;
	document.ulform.submit();
	alert(msg_upload[lg]);
	document.images['uploading'].src = document.images['preloaded'].src;

	return;
}

//-->