Index: /trunk/calendar/inc/class.uicalendar.inc.php
===================================================================
--- /trunk/calendar/inc/class.uicalendar.inc.php	(revision 625)
+++ /trunk/calendar/inc/class.uicalendar.inc.php	(revision 638)
@@ -4479,5 +4479,5 @@
 			$var['access'] = Array(
 				'field'	=> lang('Type'),
-				'data'	=> '<select onchange="javascript:changeViewMode(this.value);" id="cal[type]" name="cal[type]"><option value="normal">'.lang('Normal').'</option><option value="private" '.(!$event['public']?'SELECTED':'').' >'. lang('Private').'</option><option value="hourAppointment" '.($event['type'] == 'H'?'SELECTED':'').' >'.lang('Hours Appointment').'</option></select>'
+				'data'	=> '<select onchange="javascript:changeViewMode(this.value);" id="cal[type]" name="cal[type]" '.($event['type'] == 'H'?'DISABLED':'').'><option value="normal">'.lang('Normal').'</option><option value="private" '.(!$event['public']?'SELECTED':'').' >'. lang('Private').'</option><option value="hourAppointment" '.($event['type'] == 'H'?'SELECTED':'').' >'.lang('Hours Appointment').'</option></select>'
 			); //event['public']
 
@@ -4554,5 +4554,5 @@
 										</tr>
 										</table>
-									<script src='calendar/templates/celepar/js/edit.js' type='text/javascript'></script>
+									<script src='calendar/templates/celepar/js/edit.js' type='text/javascript'></script>				
 									"
 						);
@@ -4581,4 +4581,10 @@
 								$combo_org = $this->get_organizations(trim(strtolower($context)),$user_context, $recursive);
 								$footer_ext_participantes = lang("Tip: To search in the <b>Global Catalog</b>, type the <b>F9</b> key, like the ExpressoMail.");
+								// Begin load array lang
+								ob_start();
+        						@include($module_name.'/inc/load_lang.php');
+        						$load_lang_vars = ob_get_contents();
+        						ob_end_clean();
+								// End load array_lang
 								
 								$var['participants'] = array
@@ -4606,5 +4612,5 @@
 											'	<br>'.lang("Search for").':'.
 											'	<input value="" id="cal_input_searchUser" size="35" autocomplete="off" onkeyup="javascript:optionFinderTimeout(this)"><br>'.
-											'	<b>'.lang("Available users and groups").'</b>'.
+											'	<b>'.lang("Available users and groups").'</b><br>'.
 											'	<select id="user_list_in" style="width: 300px" multiple size="13"></select>'.
 											'</td>'.
@@ -4614,11 +4620,10 @@
 											'<script type="text/javascript" src="phpgwapi/js/dJSWin/dJSWin.js"></script>'.		
 											"<script src='calendar/templates/celepar/js/edit_exmail.js' type='text/javascript'></script>" .
-											"<script src='".$module_name."/inc/load_lang.php' type='text/javascript'></script>".
+											$load_lang_vars.																			
 											"<script src='".$module_name."/js/connector.js' type='text/javascript'></script>".
 											"<script type='text/javascript'>var DEFAULT_URL = '".$module_name."/controller.php?action=';</script> ".											
 											"<script type='text/javascript'>" .
-											"setTimeout('get_available_users(\"".$module_name."\",\'".$user_context."\',\'".($recursive ? "" : "search")."\')',1000);". 
+											"var timeout_get_available_users = setTimeout('get_available_users(\"".$module_name."\",\'".$user_context."\',\'".($recursive ? "" : "search")."\')',1000);". 
 											"</script> "
-												
 								);
 							}						
@@ -4890,8 +4895,4 @@
 			$p->set_var('cancel_button',$cancel_button);
 			$p->pparse('out','edit_entry');
-			echo "<script src='calendar/templates/celepar/js/edit.js' type='text/javascript'></script>";
-			echo "<script>var type=document.getElementById('cal[type]'); changeViewMode(type.value);</script>";
-
-			
 		}
 		
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        
