Index: trunk/calendar/templates/celepar/js/edit_exmail.js
===================================================================
--- trunk/calendar/templates/celepar/js/edit_exmail.js	(revision 264)
+++ trunk/calendar/templates/celepar/js/edit_exmail.js	(revision 638)
@@ -134,4 +134,11 @@
 
 function submitValues(){
+	var typeField = document.getElementById('cal[type]');
+	if (typeField && typeField.value == 'hourAppointment') {
+		if(document.getElementsByName('categories[]')[0].value == ""){
+			alert(alert_msg);
+			return false;
+		}
+	}
 	var select_in = document.getElementById('user_list');
 	for(i = 0; i < select_in.length; i++)
@@ -275,2 +282,64 @@
     selTemp = null
 }
+
+function changeViewMode(eltype){
+	var chValue = eltype;
+
+	switch (chValue){
+		case 'hourAppointment':
+			var names=new Array('title','priority','location','alarmhours','alarmminutes','recur_type','rpt_use_end','recur_interval','rpt_label');
+			for (var i=0; i < names.length; i++)
+			{
+				var Field = document.getElementsByName('cal['+names[i]+']');
+				if (Field[0])
+					Field[0].parentNode.parentNode.style.display = "none";
+			}
+
+			Field = document.getElementsByName('participants[]');
+			Field[0].parentNode.parentNode.style.display = "none";
+			Field[1].parentNode.parentNode.style.display = "none";
+			Field = document.getElementById('txt_loading');
+			Field.parentNode.parentNode.style.display = "none";
+			Field = document.getElementsByName('cal[rpt_day][]');
+			Field[0].parentNode.parentNode.style.display = "none";
+			break;
+		default:
+			var names=new Array('title','priority','location','alarmhours','alarmminutes','recur_type','rpt_use_end','recur_interval','rpt_label');
+			for (var i=0; i < names.length; i++)
+			{
+				var Field = document.getElementsByName('cal['+names[i]+']');
+				if (Field[0])
+					Field[0].parentNode.parentNode.style.display = "";
+			}
+			Field = document.getElementsByName('participants[]');
+			Field[0].parentNode.parentNode.style.display = "";
+			Field[1].parentNode.parentNode.style.display = "";
+			Field = document.getElementById('txt_loading');
+			Field.parentNode.parentNode.style.display = "";
+			Field = document.getElementsByName('cal[rpt_day][]');
+			Field[0].parentNode.parentNode.style.display = "";
+			break;
+	}
+
+}
+function updateTitleField(select){
+	var typeField = document.getElementsByName('cal[type]');
+	if (typeField[0].value != 'hourAppointment')
+		return;
+	var titleField = document.getElementsByName('cal[title]');
+	var optionsArray = select.childNodes;
+	titleField[0].value = '';
+	for(option in optionsArray)
+		if (optionsArray[option].selected)
+			titleField[0].value += optionsArray[option].text + ' ';
+}
+
+var __onLoad = window.onload;
+window.onload = function(){ 
+	__onLoad();
+	var cal_type = document.getElementById('cal[type]').value;
+	changeViewMode(cal_type);
+	if(cal_type == 'hourAppointment'){
+		clearTimeout(timeout_get_available_users);
+	}
+}; 
Index: trunk/calendar/templates/celepar/js/edit.js
===================================================================
--- trunk/calendar/templates/celepar/js/edit.js	(revision 602)
+++ trunk/calendar/templates/celepar/js/edit.js	(revision 638)
@@ -98,54 +98,4 @@
 		selectOpener.options[selectOpener.options.length-1].selected = true;
  	}
-function changeViewMode(chValue){
-	switch (chValue){
-		case 'hourAppointment':
-			var names=new Array('title','priority','location','alarmhours','alarmminutes','recur_type','rpt_use_end','recur_interval','rpt_label');
-			for (var i=0; i < names.length; i++)
-			{
-				var Field = document.getElementsByName('cal['+names[i]+']');
-				if (Field[0])
-					Field[0].parentNode.parentNode.style.display = "none";
-			}
-
-			Field = document.getElementsByName('participants[]');
-			Field[0].parentNode.parentNode.style.display = "none";
-			Field[1].parentNode.parentNode.style.display = "none";
-			Field = document.getElementById('txt_loading');
-			Field.parentNode.parentNode.style.display = "none";
-			Field = document.getElementsByName('cal[rpt_day][]');
-			Field[0].parentNode.parentNode.style.display = "none";
-			break;
-		default:
-			var names=new Array('title','priority','location','alarmhours','alarmminutes','recur_type','rpt_use_end','recur_interval','rpt_label');
-			for (var i=0; i < names.length; i++)
-			{
-				var Field = document.getElementsByName('cal['+names[i]+']');
-				if (Field[0])
-					Field[0].parentNode.parentNode.style.display = "";
-			}
-			Field = document.getElementsByName('participants[]');
-			Field[0].parentNode.parentNode.style.display = "";
-			Field[1].parentNode.parentNode.style.display = "";
-			Field = document.getElementById('txt_loading');
-			Field.parentNode.parentNode.style.display = "";
-			Field = document.getElementsByName('cal[rpt_day][]');
-			Field[0].parentNode.parentNode.style.display = "";
-			break;
-	}
-
-}
-function updateTitleField(select){
-	var typeField = document.getElementsByName('cal[type]');
-	if (typeField[0].value != 'hourAppointment')
-		return;
-	var titleField = document.getElementsByName('cal[title]');
-	var optionsArray = select.childNodes;
-	titleField[0].value = '';
-	for(option in optionsArray)
-		if (optionsArray[option].selected)
-			titleField[0].value += optionsArray[option].text + ' ';
-}
-
 	
 // Fim        
