document.observe("dom:loaded", function() { 
	$('catalogue_synopsis').observe('keyup', charLimit);
});

function submitApplicationForm(langEntries, theForm)
{
	var why = "";
	why += checkDropdown(langEntries, theForm.film_length.selectedIndex,  langKeyPrint(langEntries, 'film_length'));
	why += isEmpty(langEntries, theForm.orig_title.value, langKeyPrint(langEntries, 'orig_title'));
	why += checkDropdown(langEntries, theForm.prod_year.selectedIndex,  langKeyPrint(langEntries, 'prod_year'));
	why += checkDropdown(langEntries, theForm.format.selectedIndex,  langKeyPrint(langEntries, 'format'));

	time = checkDropdown(langEntries, theForm.run_time_m.selectedIndex,  langKeyPrint(langEntries, 'run_time_m'));
	time2 = checkDropdown(langEntries, theForm.run_time_h.selectedIndex,  langKeyPrint(langEntries, 'run_time_h'));
	
	if (time != '' && time2 != '')
	{
		why += '"' + langKeyPrint(langEntries, 'run_time') + '" ' + langKeyPrint(langEntries, 'has_not_been_selected_dropdown') + '\n';
	}
		
// 	sels = document.getElementsByTagName('select');
// 	values = '';
// 	for (i=0; i < sels.length; i++)
// 	{
// 		if (sels[i] != undefined)
// 		{
// 			if (sels[i].name.search('progs_sel_arr') > -1)
// 			{
// 				for (x=0; x < sels[i].length; x++)
// 				{
// 					if (sels[i][x].selected) { values += sels[i][x].value; }
// 				}
// 			}
// 		}
// 	}
// 	
// 	if (values == '') { why += langKeyPrint(langEntries, 'program') + ' ' + langKeyPrint(langEntries, 'multi_no_sel') + '\n'; }

	why += isEmpty(langEntries, theForm.film_lang.value, langKeyPrint(langEntries, 'film_lang'));
/* 	why += isEmpty(langEntries, theForm.subtitles_lang.value, langKeyPrint(langEntries, 'subtitles_lang')); */
	why += isEmpty(langEntries, theForm.synopsis.value, langKeyPrint(langEntries, 'synopsis'));
	why += isEmpty(langEntries, theForm.nationality.value, langKeyPrint(langEntries, 'nationality'));
/* 	why += isEmpty(langEntries, theForm.production.value, langKeyPrint(langEntries, 'production')); */
	why += isEmpty(langEntries, theForm.director.value, langKeyPrint(langEntries, 'director'));
/* 	why += isEmpty(langEntries, theForm.script.value, langKeyPrint(langEntries, 'script')); */
/* 	why += isEmpty(langEntries, theForm.music.value, langKeyPrint(langEntries, 'music')); */
/* 	why += isEmpty(langEntries, theForm.cinemato.value, langKeyPrint(langEntries, 'cinemato')); */
/* 	why += isEmpty(langEntries, theForm.editing.value, langKeyPrint(langEntries, 'editing')); */
/* 	why += isEmpty(langEntries, theForm.animation.value, langKeyPrint(langEntries, 'animation')); */
/* 	why += isEmpty(langEntries, theForm.cast.value, langKeyPrint(langEntries, 'cast')); */
/* 	why += isEmpty(langEntries, theForm.applicant_name.value, langKeyPrint(langEntries, 'applicant_name')); */
/* 	why += isEmpty(langEntries, theForm.address.value, langKeyPrint(langEntries, 'address')); */
/* 	why += isEmpty(langEntries, theForm.postal_code.value, langKeyPrint(langEntries, 'postal_code')); */
/* 	why += isEmpty(langEntries, theForm.city.value, langKeyPrint(langEntries, 'city')); */
/* 	why += isEmpty(langEntries, theForm.country.value, langKeyPrint(langEntries, 'country')); */
/* 	why += isEmpty(langEntries, theForm.phone.value, langKeyPrint(langEntries, 'phone')); */
/* 	why += isEmpty(langEntries, theForm.email.value, langKeyPrint(langEntries, 'email')); */
	
	if (why != "") {
	   alert(why);
	}
	else{
		document.getElementById('form_buttons').innerHTML = 'Processing...';
		theForm.submit();
	}
}

