Index: trunk/contactcenter/js/cc.js
===================================================================
--- trunk/contactcenter/js/cc.js	(revision 258)
+++ trunk/contactcenter/js/cc.js	(revision 284)
@@ -57,5 +57,5 @@
 var CC_full_add_const = false;
 var CC_full_add_photo = false;
-	
+
 var CC_last_height = window.innerHeight;
 var CC_last_width = window.innerWidth;
@@ -90,5 +90,5 @@
 		 photo_input = photo_frame.contentDocument.createElement('input');
 	}
-	
+
 	photo_frame.id = 'cc_photo_frame';
 	photo_frame.style.position = 'absolute';
@@ -96,12 +96,12 @@
 	photo_frame.style.top = '600px';
 	photo_frame.style.left = '0px';
-	
+
 	photo_form.id = 'cc_photo_form';
 	photo_form.method = 'POST';
 	photo_form.enctype = 'multipart/form-data';
-	
+
 	photo_input.id = 'cc_photo_input';
 	photo_input.type = 'file';
-	
+
 	if (is_ie)
 	{
@@ -113,5 +113,5 @@
 	}
 	photo_form.appendChild(photo_input);
-	
+
 }
 
@@ -121,5 +121,5 @@
 	var obj = Element(id);
 	var max = obj.options.length;
-	
+
 	if (option == undefined)
 	{
@@ -161,5 +161,5 @@
 function openFullAdd(){
 	// Build the FullAdd Window.
-	if(!fullAddWin && !is_ie) 
+	if(!fullAddWin && !is_ie)
 		__f();
 
@@ -168,5 +168,5 @@
 	fullAddWin.open();
 	tabs._showTab('cc_contact_tab_0');
-	Element("cc_conn_type_1").checked = false;	
+	Element("cc_conn_type_1").checked = false;
 	Element("cc_conn_type_2").checked = false;
 	Element("cc_conn_type_sel").disabled = true;
@@ -189,5 +189,5 @@
 function editGroup(id){
 	populateEditGroup(id);
-	ccAddGroup.window.open();			
+	ccAddGroup.window.open();
 }
 /*
@@ -199,5 +199,5 @@
 {
 	CC_full_add_const = false;
-	
+
 	setTimeout('populateFullAddConstAsync()', 10);
 }
@@ -207,9 +207,9 @@
 	var handler = function(responseText)
 	{
-		//Element('cc_debug').innerHTML = responseText;		
+		//Element('cc_debug').innerHTML = responseText;
 		var data = unserialize(responseText);
 		var i = 1;
 		var j;
-		
+
 		if (typeof(data) != 'object')
 		{
@@ -217,5 +217,5 @@
 			return;
 		}
-		
+
 		/* Populate Prefixes */
 		for (j in data[0])
@@ -224,5 +224,5 @@
 			i++;
 		}
-		
+
 		/* Populate Suffixes */
 		i = 1;
@@ -246,13 +246,13 @@
 		{
 			Element('cc_addr_countries').options[i] = new Option(data[3][j], j);
-			
+
 			if (j == 'BR' || j == 'br')
 			{
 				CC_br_index = i;
 			}
-			
+
 			i++;
 		}
-		
+
 		/* Populate Connection Types */
 		i = 1;
@@ -262,5 +262,5 @@
 			i++;
 		}
-		
+
 		/* Populate Relations Types */
 		i = 0;
@@ -270,5 +270,5 @@
 			i++;
 		}
-		
+
 		CC_full_add_const = true;
 
@@ -305,26 +305,31 @@
 {
 	var handler = function(responseText)
-	{			
-		var data = unserialize(responseText);			
-		Element('group_id').value = data['id_group'];								
-		var options_contact_list = Element('contact_list');
-		if(data['contact_list']) {					
-			options_contact_list.innerHTML = data['contact_list'];
+	{
+		var data = unserialize(responseText);
+		Element('group_id').value = data['id_group'];
+
+		if(data['contact_list']) {
+			for(i = 0; i < data['contact_list'].length; i++) {
+				option = document.createElement('option');
+				option.value = data['contact_list'][i]['id_connection'];
+				option.text = data['contact_list'][i]['names_ordered']+' ('+data['contact_list'][i]['connection_value']+')';
+				Element('contact_list').options[Element('contact_list').options.length] = option;
+			}
 		}
 
 		if(data['id_group']) {
-		
-			if(data['contact_in_list']) {					
-				for(i = 0; i < data['contact_in_list'].length; i++) {				
+
+			if(data['contact_in_list']) {
+				for(i = 0; i < data['contact_in_list'].length; i++) {
 					option = document.createElement('option');
 					option.value = data['contact_in_list'][i]['id_connection'];
-					option.text = data['contact_in_list'][i]['names_ordered']+' ('+data['contact_in_list'][i]['connection_value']+')';				
+					option.text = data['contact_in_list'][i]['names_ordered']+' ('+data['contact_in_list'][i]['connection_value']+')';
 					Element('contact_in_list').options[Element('contact_in_list').options.length] = option;
 				}
-			}		
-			
+			}
+
 			Element('title').value =  data['title'];
 		}
-				
+
 		if (typeof(data) != 'object' || data['result'] != 'ok')
 		{
@@ -333,8 +338,8 @@
 		}
 	};
-		
+
 	id = typeof(id) == 'undefined' ? id = 0 :  id;
-	
-	ccAddGroup.clear(true);			
+
+	ccAddGroup.clear(true);
 	Connector.newRequest('populateEditGroup', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_group&id='+id, 'GET', handler);
 }
@@ -371,5 +376,5 @@
 		return false;
 	}
-	
+
 	/* First thing: Send Photo */
 	if (Element('cc_pd_select_photo').value != '' && !is_ie)
@@ -389,5 +394,5 @@
 			frame = old_frame;
 		}
-		
+
 		frame.id = 'cc_photo_frame';
 		frame.style.visibility = 'hidden';
@@ -398,5 +403,5 @@
 
 		form = frame.contentDocument.createElement('form');
-		
+
 		var id_contact = Element('cc_full_add_contact_id').value;
 		form.id = 'cc_form_photo';
@@ -404,8 +409,8 @@
 		form.enctype = 'multipart/form-data';
 		form.action = 'http://'+ document.domain + Element('cc_root_dir').value+'../index.php?menuaction=contactcenter.ui_data.data_manager&method=post_photo&id='+(id_contact != '' && id_contact != 'null' ? id_contact : '');
-		
+
 		var input_clone = Element('cc_pd_select_photo').cloneNode(false);
 		form.appendChild(input_clone);
-		
+
 		frame.contentDocument.body.appendChild(form);
 		form.submit();
@@ -461,7 +466,7 @@
 	var empty = true;
 	var replacer = '__##AND##__';
-	
+
 	data['commercialAnd'] = replacer;
-	
+
 	if (Element('cc_full_add_contact_id').value != '' && Element('cc_full_add_contact_id').value != 'null')
 	{
@@ -472,5 +477,5 @@
 	/* Status: Full Added */
 	data['id_status'] = CC_STATUS_FULL_ADD;
-	
+
 	/* Personal Data */
 	data['alias']         = replaceComAnd(Element('cc_pd_alias').value, replacer);
@@ -510,5 +515,5 @@
 				data['connections'] = new Array();
 			}
-			
+
 			for (var i in CC_contact_full_info['connections'][type])
 			{
@@ -522,5 +527,5 @@
 					data['connections']['connection'+connNumber] = new Array(5);
 				}
-				
+
 				data['connections']['connection'+connNumber]['id_connection'] = CC_contact_full_info['connections'][type][i]['id'];
 				data['connections']['connection'+connNumber]['id_typeof_connection'] = type;
@@ -531,10 +536,10 @@
 						data['connections']['connection'+connNumber]['connection_is_default']  = 'TRUE';
 					}
-					else 
+					else
 						data['connections']['connection'+connNumber]['connection_is_default']  = 'FALSE';
 				}
 
 //				data['connections']['connection'+connNumber].length = 5;
-				
+
 				empty = false;
 				connNumber++;
@@ -543,5 +548,5 @@
 
 		}
-		
+
 		if (!empty)
 		{
@@ -550,9 +555,9 @@
 		}
 	}
-	
+
 	if (CC_contact_full_info['removed_conns'])
 	{
 		empty = false;
-		
+
 		if (typeof(data['connections']) != 'object')
 		{
@@ -589,6 +594,6 @@
 			for (var i in CC_contact_full_info['connections'][type]){
 				if((CC_contact_full_info['connections'][type][i]['value'].length < 4) ||
-					(!comp.test(CC_contact_full_info['connections'][type][i]['value']))){ 
-					showMessage('Endereço para conexão de ' + CC_contact_full_info['connections'][type][i]['name'] + ', não é válido');
+					(!comp.test(CC_contact_full_info['connections'][type][i]['value']))){
+					showMessage('Endereï¿œo para conexï¿œo de ' + CC_contact_full_info['connections'][type][i]['name'] + ', nï¿œo ï¿œ vï¿œlido');
 					return false;
 				}
@@ -596,9 +601,9 @@
 			var _options_default = Element("cc_"+(type == 1 ? 'email' : 'phone')+"_default");
 			if(_options_default.value == '-1') {
-				alert("É necessário escolher um "+ (type == 1 ? 'E-mail' : 'Telefone')+" como padrão!");
+				alert("ï¿œ necessï¿œrio escolher um "+ (type == 1 ? 'E-mail' : 'Telefone')+" como padrï¿œo!");
 				return false;
 			}
 		}
-		
+
 	}
 
@@ -609,5 +614,5 @@
 
 /********* Personal Data Functions *********/
-/* 
+/*
  * data[0] => cc_pd_select_photo
  * data[1] => cc_pd_alias
@@ -657,8 +662,8 @@
 {
 	Element('cc_addr_types').selectedIndex = 0;
-	
+
 	Element('cc_addr_countries').selectedIndex = 0;
 	Element('cc_addr_countries').disabled = true;
-	
+
 	Element('cc_addr_states').selectedIndex = 0;
 	Element('cc_addr_states').disabled = true;
@@ -711,7 +716,7 @@
 	var type = Element('cc_addr_types');
 	var oldSelected = type.value;
-	
+
 	saveAddressFields();
-	
+
 	if (oldSelected == '_NONE_')
 	{
@@ -719,13 +724,13 @@
 		return true;
 	}
-	
+
 	CC_addr_last_selected = type.selectedIndex;
-	
+
 	Element('cc_addr_countries').disabled = false;
-	
+
 	var data = CC_contact_full_info['addresses'];
 	var addrIndex  = 'address'+Element('cc_addr_types').value;
-	
-	if (typeof(data) != 'object' || typeof(data[addrIndex]) != 'object') 
+
+	if (typeof(data) != 'object' || typeof(data[addrIndex]) != 'object')
 	{
 		resetAddressFields();
@@ -736,9 +741,9 @@
 		return true;
 	}
-	
+
 	var addrTypeID = Element('cc_addr_types').value;
-	
+
 	data = CC_contact_full_info['addresses'][addrIndex];
-	
+
 	Element('cc_addr_id').value          			 = data['id_address']		? data['id_address']			: '';
 	Element('cc_addr_1').value            			= data['address1']			? data['address1']				: '';
@@ -762,5 +767,5 @@
 		states.selectedIndex = 0;
 		clearSelectBox(states, 4);
-		updateAddrCities();	
+		updateAddrCities();
 		return;
 	}
@@ -777,11 +782,11 @@
 	{
 		var data = unserialize(responseText);
-		
+
 		clearSelectBox(states, 1);
-			
+
 		if (typeof(data) != 'object')
 		{
 			showMessage(Element('cc_msg_err_contacting_server').value);
-	
+
 			return;
 		}
@@ -790,5 +795,5 @@
 		{
 			states.disabled = true;
-			cities.disabled = true;			
+			cities.disabled = true;
 			states.selectedIndex = 0;
 			cities.selectedIndex = 0;
@@ -830,5 +835,5 @@
 		}
 	};
-	
+
 	Connector.newRequest('populateStates', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_states&country='+Element('cc_addr_countries').value, 'GET', handler);
 }
@@ -858,5 +863,5 @@
 			newState.disabled = false;
 			updateAddrNewStateOnMouseOut();
-			
+
 			cities.disabled = false;
 			clearSelectBox(cities, 3);
@@ -869,11 +874,11 @@
 		case '_NOSTATE_':
 			clearSelectBox(cities, 3);
-			
+
 			cities.disabled = false;
 			cities.selectedIndex = 0;
-			
+
 			requestStr = 'country='+Element('cc_addr_countries').value;
 			break;
-		
+
 		default:
 			requestStr = 'country='+Element('cc_addr_countries').value+'&state='+states.value;
@@ -890,15 +895,15 @@
 {
 	var cities = Element('cc_addr_cities');
-	
+
 	var handler = function (responseText)
 	{
 		var data = unserialize(responseText);
-		
+
 		clearSelectBox(cities, 1);
-		
+
 		if (typeof(data) != 'object')
 		{
 			showMessage(Element('cc_msg_err_contacting_server').value);
-			
+
 			return;
 		}
@@ -945,5 +950,5 @@
 		}
 	};
-	
+
 	Connector.newRequest('populateCities', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_cities&'+requestStr, 'GET', handler);
 }
@@ -951,5 +956,5 @@
 function updateAddrNewStateOnMouseOver ()
 {
-	if (Element('cc_addr_states_new').value == Element('cc_msg_type_state').value && Element('cc_addr_states').selectedIndex == 1) 
+	if (Element('cc_addr_states_new').value == Element('cc_msg_type_state').value && Element('cc_addr_states').selectedIndex == 1)
 	{
 		Element('cc_addr_states_new').value = '';
@@ -959,5 +964,5 @@
 function updateAddrNewStateOnMouseOut ()
 {
-	if (Element('cc_addr_states_new').value.length == 0 && Element('cc_addr_states').selectedIndex == 1) 
+	if (Element('cc_addr_states_new').value.length == 0 && Element('cc_addr_states').selectedIndex == 1)
 	{
 		Element('cc_addr_states_new').value = Element('cc_msg_type_state').value;
@@ -979,5 +984,5 @@
 		return;
 	}
-	
+
 	Element('cc_addr_1').readonly = false;
 	Element('cc_addr_1').disabled = false;
@@ -1009,5 +1014,5 @@
 
 			//resetAddrFillingFields();
-			
+
 			return;
 
@@ -1017,5 +1022,5 @@
 			newCity.disabled = false;
 			updateAddrNewCityOnMouseOut();
-			
+
 			break;
 
@@ -1031,5 +1036,5 @@
 function updateAddrNewCityOnMouseOver ()
 {
-	if (Element('cc_addr_cities_new').value == Element('cc_msg_type_city').value && Element('cc_addr_cities').selectedIndex == 1) 
+	if (Element('cc_addr_cities_new').value == Element('cc_msg_type_city').value && Element('cc_addr_cities').selectedIndex == 1)
 	{
 		Element('cc_addr_cities_new').value = '';
@@ -1039,5 +1044,5 @@
 function updateAddrNewCityOnMouseOut ()
 {
-	if (Element('cc_addr_cities_new').value.length == 0 && Element('cc_addr_cities').selectedIndex == 1) 
+	if (Element('cc_addr_cities_new').value.length == 0 && Element('cc_addr_cities').selectedIndex == 1)
 	{
 		Element('cc_addr_cities_new').value = Element('cc_msg_type_city').value;
@@ -1053,10 +1058,10 @@
 		return true;
 	}
-	
-	var addrFields = new Array('cc_addr_1', 
-	                           'cc_addr_2', 
-							   'cc_addr_complement', 
+
+	var addrFields = new Array('cc_addr_1',
+	                           'cc_addr_2',
+							   'cc_addr_complement',
 							   'cc_addr_other',
-							   'cc_addr_postal_code', 
+							   'cc_addr_postal_code',
 							   'cc_addr_po_box',
 							   'cc_addr_countries',
@@ -1065,5 +1070,5 @@
 
 	var empty = true;
-	
+
 	for (var i = 0; i < 8; i++)
 	{
@@ -1074,5 +1079,5 @@
 		}
 	}
-				
+
 	if (empty)
 	{
@@ -1103,5 +1108,5 @@
 		default:
 			addrInfo['id_country'] = Element('cc_addr_countries').value;
-		
+
 	}
 
@@ -1117,5 +1122,5 @@
 		default:
 			addrInfo['id_state'] = Element('cc_addr_states').value;
-		
+
 	}
 
@@ -1130,6 +1135,6 @@
 		default:
 			addrInfo['id_city'] = Element('cc_addr_cities').value;
-		
-	}	
+
+	}
 
 	addrInfo['id_typeof_address']  = Element('cc_addr_types').options[lastIndex].value;
@@ -1144,15 +1149,15 @@
 	CC_contact_full_info['addresses']['address'+Element('cc_addr_types').options[lastIndex].value] = addrInfo;
 
-	if (Element('cc_addr_cities').value == '_NEW_' && 
+	if (Element('cc_addr_cities').value == '_NEW_' &&
 	    Element('cc_msg_type_city').value !=  Element('cc_addr_cities_new').value &&
 		Element('cc_addr_cities_new').value != '')
 	{
 		var addrRootInfo = CC_contact_full_info['addresses']['new_cities'];
-		
+
 		if (!addrRootInfo)
 		{
 			addrRootInfo = new Array();
 		}
-		
+
 		var i = addrRootInfo.length;
 		addrRootInfo[addrInfo['id_typeof_address']] = new Array();
@@ -1163,15 +1168,15 @@
 	}
 
-	if (Element('cc_addr_states').value == '_NEW_' && 
-	    Element('cc_msg_type_state').value !=  Element('cc_addr_states_new').value && 
+	if (Element('cc_addr_states').value == '_NEW_' &&
+	    Element('cc_msg_type_state').value !=  Element('cc_addr_states_new').value &&
 		Element('cc_addr_states_new').value != '')
 	{
 		var addrRootInfo = CC_contact_full_info['addresses']['new_states'];
-		
+
 		if (!addrRootInfo)
 		{
 			addrRootInfo = new Array();
 		}
-		
+
 		var i = addrRootInfo.length;
 		addrRootInfo[addrInfo['id_typeof_address']] = new Array();
@@ -1203,16 +1208,27 @@
 	for(idx_conn; idx_conn < cc_conn_default.options.length; idx_conn++)
 		if(cc_conn_default.options[idx_conn].value == _label)
-			break;	
-	
+			break;
+
 	if(idx_conn == cc_conn_default.options.length)
 		cc_conn_default.options[idx_conn] = new Option (_label,_label, false,false);
-			
+
 	if (!document.all)
 	{
-		return '<td style="position: absolute; left: 0; top: 0; z-index: -1; visibility: hidden"><input id="cc_conn_id_' + CC_conn_count + '" type="hidden" value="_NEW_"><input id="cc_conn_is_default_' + CC_conn_count + '" type="hidden" value="false"></td>'+
-		//'<td style="width: 30px;" align="right"><input name="cc_conn_is_default" id="cc_conn_is_default_'+ CC_conn_count +'" type="radio"></td>'+
-		'<td style="width: 10px;" align="right"><input id="cc_conn_name_'+CC_conn_count+'" type="hidden"><td style="width: 100px;" align="right"><span style="width: 150px;" id="cc_conn_label_'+CC_conn_count+'">'+_label+'</span></td>' +
-		'<td align="left"><input id="cc_conn_value_'+ CC_conn_count +'" style="width: 150px;" type="text">&nbsp;' +
-		'<img align="top" alt="X" src="templates/default/images/x.png" style="width:18px; height:18px" onclick="javascript:removeConnField(\'cc_conn_tr_' + CC_conn_count + '\')"></td>';
+		if (Element("cc_conn_type_1").checked)
+		{
+			return '<td style="position: absolute; left: 0; top: 0; z-index: -1; visibility: hidden"><input id="cc_conn_id_' + CC_conn_count + '" type="hidden" value="_NEW_"><input id="cc_conn_is_default_' + CC_conn_count + '" type="hidden" value="false"></td>'+
+			//'<td style="width: 30px;" align="right"><input name="cc_conn_is_default" id="cc_conn_is_default_'+ CC_conn_count +'" type="radio"></td>'+
+			'<td style="width: 10px;" align="right"><input id="cc_conn_name_'+CC_conn_count+'" type="hidden"><td style="width: 100px;" align="right"><span style="width: 150px;" id="cc_conn_label_'+CC_conn_count+'">'+_label+'</span></td>' +
+			'<td align="left"><input id="cc_conn_value_'+ CC_conn_count +'" style="width: 150px;" maxlength="100" type="text">&nbsp;' +
+			'<img align="top" alt="X" src="templates/default/images/x.png" style="width:18px; height:18px" onclick="javascript:removeConnField(\'cc_conn_tr_' + CC_conn_count + '\')"></td>';
+		}
+		else if (Element("cc_conn_type_2").checked)
+		{
+			return '<td style="position: absolute; left: 0; top: 0; z-index: -1; visibility: hidden"><input id="cc_conn_id_' + CC_conn_count + '" type="hidden" value="_NEW_"><input id="cc_conn_is_default_' + CC_conn_count + '" type="hidden" value="false"></td>'+
+			//'<td style="width: 30px;" align="right"><input name="cc_conn_is_default" id="cc_conn_is_default_'+ CC_conn_count +'" type="radio"></td>'+
+			'<td style="width: 10px;" align="right"><input id="cc_conn_name_'+CC_conn_count+'" type="hidden"><td style="width: 100px;" align="right"><span style="width: 150px;" id="cc_conn_label_'+CC_conn_count+'">'+_label+'</span></td>' +
+			'<td align="left"><input id="cc_conn_value_'+ CC_conn_count +'" style="width: 150px;" maxlength="50" type="text">&nbsp;' +
+			'<img align="top" alt="X" src="templates/default/images/x.png" style="width:18px; height:18px" onclick="javascript:removeConnField(\'cc_conn_tr_' + CC_conn_count + '\')"></td>';
+		}
 	}
 	else
@@ -1238,5 +1254,5 @@
 		img.align = 'top';
 		img.onclick = function(e){ removeConnField(remove_id);};
-		
+
 		for (var i = 0; i < 3; i++)
 		{
@@ -1249,5 +1265,5 @@
 
 		inputs[1].id = 'cc_conn_name_'+CC_conn_count;
-		inputs[1].type = 'hidden';		
+		inputs[1].type = 'hidden';
 
 		inputs[2].id = 'cc_conn_value_'+CC_conn_count;
@@ -1278,19 +1294,19 @@
 		|| typeof(CC_contact_full_info['connections'][CC_conn_last_selected]) == 'undefined'
 		|| typeof(CC_contact_full_info['connections'][CC_conn_last_selected][CC_conn_count]) == 'undefined');
-	
-	if(_emptyLine) {	
-		
+
+	if(_emptyLine) {
+
 		if(Element("cc_conn_type_sel").value == '-1'){
-				return false;	
-		}
-		
+				return false;
+		}
+
 		for(k = 0; k < CC_conn_count; k++) {
 			if(Element("cc_conn_name_"+k) && Element("cc_conn_name_"+k).value != "" && Element("cc_conn_name_"+k).value == Element("cc_conn_type_sel").value) {
-				alert('Você já possui uma entrada para o tipo "'+Element("cc_conn_type_sel").value+'"!');
-				Element("cc_conn_type_sel").options.selectedIndex = 0;				
+				alert('Vocï¿œ jï¿œ possui uma entrada para o tipo "'+Element("cc_conn_type_sel").value+'"!');
+				Element("cc_conn_type_sel").options.selectedIndex = 0;
 				return false;
 			}
 		}
-	}	
+	}
 	if (!document.all)
 	{
@@ -1319,5 +1335,5 @@
 
 function connRemoveLine(id)
-{	
+{
 	var p = Element(id).parentNode;
 	var cc_conn_default = Element("cc_phone_default").style.display == '' ? Element("cc_phone_default") : Element("cc_email_default");
@@ -1358,5 +1374,5 @@
 		}
 	}
-	
+
 	CC_conn_count = 0;
 }
@@ -1380,5 +1396,5 @@
 function updateConnFields()
 {
-	
+
 	var connID;
 	var i;
@@ -1389,18 +1405,15 @@
 	var cc_conn_is_default = '';
 	var selected_index = '';
-	
+
 	cc_conn_type_sel.disabled = false;
 	div_cc_conn_is_default.style.display = "";
-	
+
 	for(var i = 0;i < cc_conn_type_sel.options.length; i++)
-		cc_conn_type_sel.options[i--] = null;	
-		
+		cc_conn_type_sel.options[i--] = null;
+
 	if(Element('cc_conn_type_1').checked) {
-	    var lang_new_email = Element('cc_msg_new_email').value;
-	    var lang_main = Element('cc_msg_main').value;
-	    var lang_alternative = Element('cc_msg_alternative').value;	
-	    cc_conn_type_sel[0] = new Option(lang_new_email,'-1');	
-	    cc_conn_type_sel[1] = new Option(lang_main,lang_main);
-	    cc_conn_type_sel[2] = new Option(lang_alternative,lang_alternative);	
+		cc_conn_type_sel[0] = new Option('Novo Email...','-1');
+		cc_conn_type_sel[1] = new Option('Principal','Principal');
+		cc_conn_type_sel[2] = new Option('Alternativo','Alternativo');
 		connID = 1;
 		selected_index = cc_email_default.options.selectedIndex;
@@ -1409,24 +1422,17 @@
 		}
 
-		var lang_select_email = Element('cc_msg_select_email').value;
-		cc_email_default.options[0] = new Option(lang_select_email,'-1');		
+		cc_email_default.options[0] = new Option('Selecionar Email...','-1');
+
 		cc_phone_default.style.display = 'none';
-		cc_email_default.style.display = '';			
+		cc_email_default.style.display = '';
 		cc_conn_is_default = cc_email_default;
 	}
 	else if(Element('cc_conn_type_2').checked) {
-	    var lang_new_telephone = Element('cc_msg_new_phone').value;
-	    var lang_home = Element('cc_msg_home').value;
-	    var lang_cellphone = Element('cc_msg_cellphone').value;
-	    var lang_work = Element('cc_msg_work').value;
-	    var lang_fax = Element('cc_msg_fax').value;
-	    var lang_pager = Element('cc_msg_pager').value;
-	    cc_conn_type_sel[0] = new Option(lang_new_telephone,'-1');	
-	    cc_conn_type_sel[1] = new Option(lang_home,lang_home);
-	    cc_conn_type_sel[2] = new Option(lang_cellphone,lang_cellphone);	
-	    cc_conn_type_sel[3] = new Option(lang_work,lang_work);
-	    cc_conn_type_sel[4] = new Option(lang_fax,lang_fax);
-	    cc_conn_type_sel[5] = new Option(lang_pager,lang_pager);
-
+		cc_conn_type_sel[0] = new Option('Novo Telefone...','-1');
+		cc_conn_type_sel[1] = new Option('Residencial','Residencial');
+		cc_conn_type_sel[2] = new Option('Celular','Celular');
+		cc_conn_type_sel[3] = new Option('Comercial','Comercial');
+		cc_conn_type_sel[4] = new Option('Fax','Fax');
+		cc_conn_type_sel[5] = new Option('Pager','Pager');
 		connID = 2;
 		selected_index = cc_phone_default.options.selectedIndex;
@@ -1435,11 +1441,10 @@
 		}
 
-		var lang_choose_phone = Element('cc_msg_choose_phone').value;		
-		cc_phone_default.options[0] = new Option(lang_choose_phone,'-1');
+		cc_phone_default.options[0] = new Option('Selecionar Telefone...','-1');
 		cc_email_default.style.display = 'none';
 		cc_phone_default.style.display = '';
 		cc_conn_is_default = cc_phone_default;
 	}
-			
+
 	Element("cc_conn_type_sel").options.selectedIndex = 0;
 	/* First save the data */
@@ -1447,12 +1452,12 @@
 
 	CC_conn_last_selected = connID;
-	
+
 	clearConn();
-	
+
 	if (connID == '_NONE_')
 	{	cc_conn_is_default.disabled = true;
 		return;
 	}
-	
+
 	/* If no data already available, return */
 	if (!CC_contact_full_info['connections'])
@@ -1478,5 +1483,5 @@
 			}
 		}
-	}	
+	}
 	if(cc_conn_is_default.options.length > selected_index)
 		cc_conn_is_default.options.selectedIndex = (selected_index == "-1" ? 0 : selected_index);
@@ -1499,5 +1504,5 @@
 			CC_contact_full_info['connections'][CC_conn_last_selected] = new Array();
 		}
-		else 
+		else
 		{
 			delete CC_contact_full_info['connections'][CC_conn_last_selected];
@@ -1511,8 +1516,8 @@
 				var subNodes = nodes[i].childNodes;
 				var found = false;
-				
+
 				for (var j = 0; j < subNodes.length; j++)
 				{
-					if (subNodes[j].childNodes.length > 0 && 
+					if (subNodes[j].childNodes.length > 0 &&
 					    subNodes[j].childNodes[0].id)
 					{
@@ -1522,5 +1527,5 @@
 							CC_contact_full_info['connections'][CC_conn_last_selected][k] = new Array();
 						}
-						
+
 					    if (subNodes[j].childNodes[0].id.indexOf('cc_conn_name') != -1)
 						{
@@ -1542,5 +1547,5 @@
 							else
 							{
-								CC_contact_full_info['connections'][CC_conn_last_selected][k]['value'] = ''; 
+								CC_contact_full_info['connections'][CC_conn_last_selected][k]['value'] = '';
 							}
 						}
@@ -1553,5 +1558,5 @@
 					}
 				}
-				
+
 				if (found)
 				{
@@ -1570,5 +1575,5 @@
 			delete CC_contact_full_info['connections'][CC_conn_last_selected];
 		}
-		
+
 	}
 
@@ -1596,9 +1601,9 @@
 	var number = randomString().toLowerCase();
 	var result = '';
-	
+
 	if(!is_ie)
-		result = prompt("Essa operação removerá TODOS os seus \ncontatos pessoais,  e  NÃO  PODERÁ  ser \ndesfeita. Digite o código abaixo:\n\tCódigo de confirmação: "+number);
+		result = prompt("Essa operaï¿œï¿œo removerï¿œ TODOS os seus \ncontatos pessoais,  e  Nï¿œO  PODERï¿œ  ser \ndesfeita. Digite o cï¿œdigo abaixo:\n\tCï¿œdigo de confirmaï¿œï¿œo: "+number);
 	else
-		result = prompt("Essa operação removerá TODOS os seus contatos pessoais,  e  NÃO  PODERÁ  ser desfeita. Digite o seguinte código de confirmação: "+number,"");
+		result = prompt("Essa operaï¿œï¿œo removerï¿œ TODOS os seus contatos pessoais,  e  Nï¿œO  PODERï¿œ  ser desfeita. Digite o seguinte cï¿œdigo de confirmaï¿œï¿œo: "+number,"");
 
 	if(result) {
@@ -1606,6 +1611,6 @@
 			Connector.newRequest('removeAllEntries', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=remove_all_entries', 'GET', handler);
 		else
-			alert('Código Incorreto');
-	}	
+			alert('Cï¿œdigo Incorreto');
+	}
 }
 
@@ -1618,5 +1623,5 @@
 		return;
 	}
-	
+
 	var handler = function (responseText)
 	{
@@ -1628,5 +1633,5 @@
 			return;
 		}
-		
+
 		if (data['status'] != 'ok')
 		{
@@ -1634,10 +1639,10 @@
 			return;
 		}
-		
+
 		setTimeout('updateCards()',80);;
 	};
-		
+
 	typeArg = (type == 'groups' ? 'group' : 'entry');
-		
+
 	Connector.newRequest('removeEntry', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=remove_'+typeArg+'&remove=' + id, 'GET', handler);
 }
@@ -1662,5 +1667,5 @@
 	var w_height = 0;
 	var w_extra = 200;
-	
+
 	if (document.body.clientHeight)
 	{
@@ -1691,4 +1696,12 @@
 			Element('cc_letter_' + i).className = 'letter_box';
 		}
+	}
+}
+
+function clearLetterSelection()
+{
+	for (var i = 0; i < 28; i++)
+	{
+		Element('cc_letter_' + i).className = 'letter_box';
 	}
 }
@@ -1758,10 +1771,10 @@
 				final_page = 1;
 			}
-			
+
 			html_pages += '<a href="javascript:setPages('+npages+', '+ actual_page +', '+ final_page +')">...</a> ';
 
 			page = showing_page ? showing_page : actual_page;
 		}
-		
+
 		for (; page <= npages; page++)
 		{
@@ -1823,5 +1836,5 @@
 		Element('cc_panel_arrow_last').style.cursor = 'hand';
 	}
-	
+
 	Element('cc_panel_pages').innerHTML = html_pages;
 }
@@ -1829,19 +1842,11 @@
 function populateCards(data, type)
 {
-	if (data[3].length >= 100 )
-	{
-		alert("Critério de pesquisa muito abrangente, achados " + data[3].length + " resultados");
-		for (i = 0; i < (Math.sqrt(data[3].length)-1); i++)
-			for (j = 0; j < 3; j++)
-				document.getElementById("cc_card:"+j+":"+i).innerHTML = '';
-		return false;
-	}
-	
+
 	if(type == 'groups')
 		return populateGroupsInCards(data);
-	
+
 	var pos = 0;
 	var ncards = data[3].length;
-	
+
 	if (typeof(data[3]) == 'object' && ncards > 0)
 	{
@@ -1851,5 +1856,5 @@
 			{
 				id = 'cc_card:'+j+':'+i;
-			
+
 				for (var k = 0; k < data[2].length; k++)
 				{
@@ -1858,6 +1863,6 @@
 						Element(id).style.display = 'none';
 						continue;
-					}					
-				
+					}
+
 					if(data[3][pos][k] != 'none')
 					{
@@ -1875,7 +1880,6 @@
 								}
 								break;
-							
+
 							case 'cc_mail':
-								
 								if (data[3][pos][k].length > (CC_visual == 'table'  ? 50 : 20))
 								{
@@ -1885,8 +1889,8 @@
 								else
 								{
-									Element(id+':'+data[2][k]).innerHTML = data[5] + data[3][pos][k] + '\')">'+ data[3][pos][k]+'</span>';									
+									Element(id+':'+data[2][k]).innerHTML = data[5] + data[3][pos][k] + '\')">'+ data[3][pos][k]+'</span>';
 								}
 								break;
-							
+
 							case 'cc_phone':
 								if (data[3][pos][k].length > 20)
@@ -1919,14 +1923,41 @@
 								Element(id+':cc_photo').src = '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_photo' + (data[4][pos] != 0 ? '&id='+data[3][pos][k] : '');
 								if(ccTree.catalog_perms == 1)
-									Element(id+':cc_icon_data').innerHTML =  '<span title="'+Element('cc_msg_copy_to_catalog').value+'" id="' + id + ':ccQuickAdd" onmouseout="window.status=\'\';" onclick="ccQuickAddContact.showList(\''+ Element(id+':cc_id').value + '\');return true;" style="cursor: pointer; cursor: hand; z-index: 1"><img src="templates/default/images/address-conduit-16.png" align="center"></span>';
+									Element(id+':cc_icon_data').innerHTML =  '<span title="Copiar para o Catï¿œlogo Pessoal" id="' + id + ':ccQuickAdd" onmouseout="window.status=\'\';" onclick="ccQuickAddContact.showList(\''+ Element(id+':cc_id').value + '\');return true;" style="cursor: pointer; cursor: hand; z-index: 1"><img src="templates/default/images/address-conduit-16.png" align="center"></span>';
 								break;
 
 							case 'cc_forwarding_address':
 								var contacts = data[3][pos][k];
-																
+
 								if( !contacts)
 									break;
-																																								
+
 								Element(id+':cc_icon_group').innerHTML =  '<span title="'+Element('cc_participants').value+'"  onmouseout="window.status=\'\';" onclick="ccListParticipants.showList(\''+ Element(id+':cc_id').value + '\');return true;" style="cursor: pointer; cursor: hand; z-index: 1"><img src="templates/default/images/people-mini.png" align="center">&nbsp;&nbsp;</span>';
+								break;
+
+							case 'cc_empNumber':
+								if (data[3][pos][k].length > 20)
+								{
+									Element(id+':'+data[2][k]).innerHTML = adjustString(data[3][pos][k], 20);
+									Element(id+':'+data[2][k]).title = data[3][pos][k];
+								}
+								else
+								{
+									Element(id+':'+data[2][k]).innerHTML = adjustString(data[3][pos][k], 20);
+								}
+								Element(id+':cc_empNumber').innerHTML = data[3][pos][k];
+								break;
+
+							//Para tratar tamanho do campo "departamento" do empregado
+							case 'cc_department':
+								if (data[3][pos][k].length > 15)
+								{
+									Element(id+':'+data[2][k]).innerHTML = adjustString(data[3][pos][k], 15);
+									Element(id+':'+data[2][k]).title = data[3][pos][k];
+								}
+								else
+								{
+									Element(id+':'+data[2][k]).innerHTML = adjustString(data[3][pos][k], 15);
+								}
+								Element(id+':cc_department').innerHTML = data[3][pos][k];
 								break;
 
@@ -1939,4 +1970,5 @@
 								else
 								{
+									if (Element(id+':'+data[2][k]) == null) alert('ï¿œ nulovgdfv');
 									Element(id+':'+data[2][k]).innerHTML = data[3][pos][k];
 								}
@@ -1944,5 +1976,5 @@
 					}
 				}
-	
+
 				if (--ncards == 0)
 				{
@@ -1950,5 +1982,5 @@
 					i = CC_max_cards[1];
 				}
-	
+
 				pos++;
 			}
@@ -1958,9 +1990,9 @@
 
 function populateGroupsInCards(data)
-{	
+{
 	var pos = 0;
-	var contacts = data[5];		
+	var contacts = data[5];
 	var ncards = data[3].length;
-	
+
 	if (typeof(data[3]) == 'object' && ncards > 0)
 	{
@@ -1970,13 +2002,13 @@
 			{
 				id = 'cc_card:'+j+':'+i;
-			
+
 				for (var k = 0; k < data[2].length; k++)
 				{
-				
+
 					if(data[3][pos][k] != 'none')
-					{	
-											
+					{
+
 						switch (data[2][k])
-						{							
+						{
 							case 'cc_title':
 								if (data[3][pos][k].length > 50)
@@ -1990,5 +2022,5 @@
 								}
 								break;
-							
+
 							case 'cc_short_name':
 								if (data[3][pos][k].length > (CC_visual == 'table'  ? 50 : 20))
@@ -2002,5 +2034,5 @@
 								}
 								break;
-							
+
 							case 'cc_contacts':
 
@@ -2011,23 +2043,23 @@
 								var email = "";
 
-								for (var d = 0; d < contacts.length; d++) {																																					
+								for (var d = 0; d < contacts.length; d++) {
 									contact += contacts[d]['names_ordered']+ ",";
 									email += contacts[d]['connection_value']+",";
 								}
-								
+
 								Element(id+':cc_participantes').innerHTML = '<span title="Ver Participantes" id="' + id + ':ccQuickAdd" onmouseout="window.status=\'\';" onclick="ccListParticipants.showList(\''+ Element(id+':cc_id').value+'value\', \''+contact+'\', \''+email+'\', \''+title+'\', \''+id_group+'\');return true;" style="cursor: pointer; cursor: hand; z-index: 1"><img title="Ver participantes" align="center" src="templates/default/images/people-mini.png">&nbsp;&nbsp</span>';
-																					
+
 								break;
-							
+
 							case 'cc_id':
 								var id_contact = data[3][pos][k];
 								Element(id+':'+data[2][k]).value = data[3][pos][k];
-								 							
+
 								break;
-								
+
 						}
 					}
 				}
-	
+
 				if (--ncards == 0)
 				{
@@ -2035,5 +2067,5 @@
 					i = CC_max_cards[1];
 				}
-	
+
 				pos++;
 			}
@@ -2064,5 +2096,5 @@
 	};
 
-	Connector.newRequest('setMaxCards', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=set_n_cards&ncards=' + ncards, 'GET'); 
+	Connector.newRequest('setMaxCards', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=set_n_cards&ncards=' + ncards, 'GET');
 }
 
@@ -2070,5 +2102,5 @@
 {
 	var coord = new Array();
-	
+
 	//Element('cc_card_space').innerHTML = '';
 	//return;
@@ -2077,5 +2109,5 @@
 	//card_space_width = parseInt(is_ie ? document.body.offsetWidth : window.innerWidth) - parseInt(Element('cc_left').offsetWidth) - parseInt(CC_card_extra) - 40;
 	card_space_height = parseInt(Element('cc_card_space').offsetHeight) - parseInt(CC_card_extra);
-	
+
 	card_width = CC_card_image_width + CC_card_extra;
 	card_height = CC_card_image_height + CC_card_extra;
@@ -2083,5 +2115,5 @@
 	ncols = parseInt(card_space_width / card_width);
 	nlines = parseInt(card_space_height / card_height);
-	
+
 	coord[0] = ncols;
 	//coord[1] = nlines;
@@ -2097,8 +2129,8 @@
 {
 		if(type != 'groups') {
-		
+
 			html_card = '<td id="' + id + '" style="width: ' + CC_card_image_width + 'px; height: ' + CC_card_image_height + '">' +
 				'<div style="border: 0px solid #999; position: relative;">' +
-					'<img src="templates/default/images/card.png" border="0" width="' + CC_card_image_width +'" height="' + CC_card_image_height + '"i ondblclick="editContact(Element(\'' + id + ':cc_id\').value);">' + 
+					'<img src="templates/default/images/card.png" border="0" width="' + CC_card_image_width +'" height="' + CC_card_image_height + '"i ondblclick="editContact(Element(\'' + id + ':cc_id\').value);">' +
 						( ccTree.catalog_perms == 1 ?
 						'<span id="' + id + ':cc_icon_data" style="position: absolute; top: 35px; left: 222px; width: 18px; height: 18px; cursor: pointer; cursor: hand; z-index: 1"></span>':'') +
@@ -2106,21 +2138,25 @@
 						'<img title="'+Element('cc_msg_card_edit').value+'" id="' + id + ':cc_card_edit" style="position: absolute; top: 35px; left: 222px; width: 18px; height: 18px; cursor: pointer; cursor: hand; z-index: 1" onclick="editContact(Element(\'' + id + ':cc_id\').value);" onmouseover="resizeIcon(\''+id+':cc_card_edit\',0)" onmouseout="resizeIcon(\''+id+':cc_card_edit\',1)" src="templates/default/images/cc_card_edit.png">' +
 						'<img title="'+Element('cc_msg_card_remove').value+'" id="' + id + ':cc_card_remove" style="position: absolute; top: 78px; left: 223px; width: 15px; height: 14px; cursor: pointer; cursor: hand; z-index: 1" onclick="removeEntry(Element(\'' + id + ':cc_id\').value);" onmouseover="resizeIcon(\''+id+':cc_card_remove\',0)" onmouseout="resizeIcon(\''+id+':cc_card_remove\',1)" src="templates/default/images/cc_x.png">' : '') +
-						'<img id="' + id + ':cc_photo" style="position: absolute; top: 15px; left: 7px;" src="" border="0" ondblclick="editContact(Element(\'' + id + ':cc_id\').value);">' + 
+						'<img id="' + id + ':cc_photo" style="position: absolute; top: 15px; left: 7px;" src="" border="0" ondblclick="editContact(Element(\'' + id + ':cc_id\').value);">' +
 						'<span id="' + id + ':cc_company" style="position: absolute; top: 5px; left: 75px; width: 135px; border: 0px solid #999; font-weight: bold; font-size: 14px; text-align: center; height: 10px;" onmouseover="//Element(\''+id+':cc_company_full\').style.visibility=\'visible\'" onmouseout="//Element(\''+id+':cc_company_full\').style.visibility=\'hidden\'"></span>' +
-						'<span style="cursor: pointer; cursor: hand; z-index: 1;position: absolute; top: 100px; left: 35px"  valign="bottom" id="' + id + ':cc_icon_group">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>'+ 
-						'<span id="' + id + ':cc_name" style="position: absolute; top: 30px; left: 75px; width: 135px; border: 0px solid #999; font-weight: bold; font-size: 10px; text-align: center; height: 10px;" onmouseover="//Element(\''+id+':cc_name_full\').style.visibility=\'visible\'" onmouseout="//Element(\''+id+':cc_name_full\').style.visibility=\'hidden\'"></span>' + 
-						'<span id="' + id + ':cc_title" style="position: absolute; top: 60px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 12px; text-align: center; height: 10px;"></span>' + 
-						'<span id="' + id + ':cc_phone" style="position: absolute; top: 90px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 10px; text-align: center; height: 10px;"></span>' + 
-						'<span id="' + id + ':cc_mail" style="position: absolute; top: 105px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 10px; text-align: center; height: 10px;"></span>' + 
-						'<span id="' + id + ':cc_alias" style="position: absolute; top: 95px; left: 10px; width: 60px; border: 0px solid #999; font-weight: normal; font-size: 9px; text-align: center; height: 10px;"></span>' + 
+						'<span style="cursor: pointer; cursor: hand; z-index: 1;position: absolute; top: 100px; left: 35px"  valign="bottom" id="' + id + ':cc_icon_group">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>'+
+						//Para exibir a matricula do empregado nos cartoes
+						'<span id="' + id + ':cc_empNumber" style="position: absolute; top: 15px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 9px; text-align: center; height: 10px;"></span>' +
+						'<span id="' + id + ':cc_name" style="position: absolute; top: 30px; left: 75px; width: 135px; border: 0px solid #999; font-weight: bold; font-size: 10px; text-align: center; height: 10px;" onmouseover="//Element(\''+id+':cc_name_full\').style.visibility=\'visible\'" onmouseout="//Element(\''+id+':cc_name_full\').style.visibility=\'hidden\'"></span>' +
+						'<span id="' + id + ':cc_title" style="position: absolute; top: 60px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 12px; text-align: center; height: 10px;"></span>' +
+						//Para exibir o setor/lotacao do empregado nos cartoes
+						'<span id="' + id + ':cc_department" style="position: absolute; top: 70px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 10px; text-align: center; height: 10px;"></span>' +
+						'<span id="' + id + ':cc_phone" style="position: absolute; top: 90px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 10px; text-align: center; height: 10px;"></span>' +
+						'<span id="' + id + ':cc_mail" style="position: absolute; top: 105px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 10px; text-align: center; height: 10px;"></span>' +
+						'<span id="' + id + ':cc_alias" style="position: absolute; top: 95px; left: 10px; width: 60px; border: 0px solid #999; font-weight: normal; font-size: 9px; text-align: center; height: 10px;"></span>' +
 					'<input id="' + id + ':cc_id" type="hidden">' +
 				'</div>' + '</td>';
-		
+
 		} else {
 			html_card = '<td id="' + id + '" style="width: ' + CC_card_image_width + 'px; height: ' + CC_card_image_height + '">' +
-            '<div style="border: 0px solid #999; position: relative;">' + 
+            '<div style="border: 0px solid #999; position: relative;">' +
 				'<img src="templates/default/images/card.png" border="0" width="' + CC_card_image_width +'" height="' + CC_card_image_height + '"i ondblclick="editContact(Element(\'' + id + ':cc_id\').value);">' +
 				'<img title="'+Element('cc_msg_group_edit').value+'" id="' + id + ':cc_card_edit" style="position: absolute; top: 35px; left: 222px; width: 18px; height: 18px; cursor: pointer; cursor: hand; z-index: 1" onclick="editGroup(Element(\'' + id + ':cc_id\').value);" onmouseover="resizeIcon(\''+id+':cc_card_edit\',0)" onmouseout="resizeIcon(\''+id+':cc_card_edit\',1)" src="templates/default/images/cc_card_edit.png">' +
-				'<img title="'+Element('cc_msg_group_remove').value+'" id="' + id + ':cc_card_remove" style="position: absolute; top: 78px; left: 223px; width: 15px; height: 14px; cursor: pointer; cursor: hand; z-index: 1" onclick="removeEntry(Element(\'' + id + ':cc_id\').value,\'groups\');" onmouseover="resizeIcon(\''+id+':cc_card_remove\',0)" onmouseout="resizeIcon(\''+id+':cc_card_remove\',1)" src="templates/default/images/cc_x.png">' + 
+				'<img title="'+Element('cc_msg_group_remove').value+'" id="' + id + ':cc_card_remove" style="position: absolute; top: 78px; left: 223px; width: 15px; height: 14px; cursor: pointer; cursor: hand; z-index: 1" onclick="removeEntry(Element(\'' + id + ':cc_id\').value,\'groups\');" onmouseover="resizeIcon(\''+id+':cc_card_remove\',0)" onmouseout="resizeIcon(\''+id+':cc_card_remove\',1)" src="templates/default/images/cc_x.png">' +
 				'<span id="' + id + ':cc_title" style="position: absolute; top: 30px; left: 75px; width: 135px; border: 0px solid #999; font-weight: bold; font-size: 10px; text-align: center; height: 10px;" onmouseover="//Element(\''+id+':cc_name_full\').style.visibility=\'visible\'" onmouseout="//Element(\''+id+':cc_name_full\').style.visibility=\'hidden\'"></span>' +
 				'<span id="' + id + ':cc_participantes" style="cursor: pointer; cursor: hand; z-index: 1;position: absolute; top: 15px; left: 15px"></span>' +
@@ -2129,5 +2165,5 @@
 			'</div>' + '</td>';
 		}
-	
+
 
 	return html_card;
@@ -2141,11 +2177,17 @@
 			else
 				bg = "this.style.background=\'#EEEEEE\'";
-						
+
 			if(type != 'groups') {
-			
-				html_card = '<tr  style="height:20px" id="' + id + '" onmouseout="'+bg+'" onmouseover="this.style.background=\'LIGHTYELLOW\'" bgcolor="EEEEEE"><td width="auto" style="font-weight: normal; font-size: 10px; text-align: left; height: 10px;">' +					
-					'<span valign="bottom" id="' + id + ':cc_icon_group">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="' + id + ':cc_name"></span></td>' +
+
+				html_card = '<tr  style="height:20px" id="' + id + '" onmouseout="'+bg+'" onmouseover="this.style.background=\'LIGHTYELLOW\'" bgcolor="EEEEEE">' +
+					//Para exibir a matricula do empregado na tabela
+					'<td align="center" nowrap><span style="solid #999; font-weight: normal; font-size: 10px;height: 10px" id="' + id + ':cc_empNumber"></span></td>' +
+					'<td width="auto" style="font-weight: normal; font-size: 10px; text-align: left; height: 10px;"><span valign="bottom" id="' + id + ':cc_icon_group">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="' + id + ':cc_name"></span></td>' +
 					'<td style="solid #999; font-weight: normal; font-size: 10px; text-align: left; height: 10px"><span onMouseOver="this.title = \''+Element('cc_send_mail').value+' => '+'\'+document.getElementById(\''+id + ':cc_name\').innerHTML" id="' + id + ':cc_mail"></span></td>' +
-					'<td align="center" nowrap><span style="solid #999; font-weight: normal; font-size: 10px;height: 10px" id="' + id + ':cc_phone"></span></td>' +		
+					'<td align="center" nowrap><span style="solid #999; font-weight: normal; font-size: 10px;height: 10px" id="' + id + ':cc_phone"></span></td>' +
+					//Para exibir o setor/lotacao do empregado na tabela
+					'<td align="center" nowrap><span style="solid #999; font-weight: normal; font-size: 10px;height: 10px" id="' + id + ':cc_department"></span></td>' +
+//					'<td align="center" nowrap><span style="solid #999; font-weight: normal; font-size: 10px;height: 10px" id="' + id + ':cc_mobile"></span></td>' +
+					'<td style="solid #999; font-weight: normal; font-size: 10px; text-align: left; height: 10px"><span onMouseOver="this.title = \''+Element('cc_send_mail').value+' => '+'\'+document.getElementById(\''+id + ':cc_name\').innerHTML" id="' + id + ':cc_mail"></span></td>' +
 					( ccTree.catalog_perms == 1 ?
 					'<td align="left"><span valign="bottom" id="' + id + ':cc_icon_data"></span></td>':'') +
@@ -2156,7 +2198,9 @@
 					'<img title="'+Element('cc_msg_card_remove').value+'" id="' + id + ':cc_card_remove" style="width: 15px; height: 14px; cursor: pointer; cursor: hand; z-index: 1" onclick="removeEntry(Element(\'' + id + ':cc_id\').value);" src="templates/default/images/cc_x.png">' : '') +
 					'<input id="' + id + ':cc_id" type="hidden">'+
-					'<input type="hidden" id="' + id + ':cc_photo">' + 
-					'<span id="' + id + ':cc_title" style="display:none"></span>' + 
-					'<span id="' + id + ':cc_alias" style="display:none"></span>' + 
+					'<input type="hidden" id="' + id + ':cc_photo">' +
+					'<span id="' + id + ':cc_title" style="display:none"></span>' +
+					'<span id="' + id + ':cc_alias" style="display:none"></span>' +
+					// Esse campo ï¿œ necessï¿œrio se o contato possui dados no campo cc_company
+					'<span id="' + id + ':cc_company" style="display:none"></span>' +
 					'</td></tr>';
 			}
@@ -2170,5 +2214,5 @@
 					'&nbsp;&nbsp;|&nbsp;&nbsp;'+
 					'<img  title="'+Element('cc_msg_group_remove').value+'" id="' + id + ':cc_card_remove" style="width: 15px; height: 14px; cursor: pointer; cursor: hand; z-index: 1" onclick="removeEntry(Element(\'' + id + ':cc_id\').value,\'groups\');" src="templates/default/images/cc_x.png">'  +
-					'<input id="' + id + ':cc_id" type="hidden">'+										
+					'<input id="' + id + ':cc_id" type="hidden">'+
 					'</td></tr>';
 			}
@@ -2180,7 +2224,7 @@
 {
 	var pos;
-	
+
 	html_cards = '<div id="divScrollMain" style="overflow:auto;z-index:1"><table width="100%" border="0" cellpadding="0" cellspacing="3">';
-	
+
 	if (ncards > 0)
 	{
@@ -2202,5 +2246,5 @@
 		if((ccTree.catalog_perms & 2) && type != 'groups')
 			html_cards += '<tr><td colspan=4 align="right"><button id="cc_button_tools" value="" type="button" onclick="javascript:removeAllEntries()">Remover Todos</button></td></tr>';
-	}	
+	}
 	else if (CC_max_cards != 0)
 	{
@@ -2222,5 +2266,5 @@
 	html_cards = '<div id="divScrollMain" style="overflow:auto;z-index:1">';
 	html_cards += '<table  border="0" cellpadding="0" cellspacing="' + CC_card_extra + '">';
-	
+
 	if (ncards > 0)
 	{
@@ -2241,5 +2285,5 @@
 		if((ccTree.catalog_perms & 2) && type != 'groups')
 			html_cards += '<tr><td colspan=3 align="right"><button id="cc_button_tools" value="" type="button" onclick="javascript:removeAllEntries()">Remover Todos</button></td></tr>';
-	}	
+	}
 	else if (CC_max_cards != 0)
 	{
@@ -2278,5 +2322,5 @@
 		else if(CC_visual == 'table')
 			drawTable(0);
-			
+
 		setPages(0,0);
 		return;
@@ -2288,6 +2332,6 @@
 		data = unserialize(responseText);
 		if (data[0] == '0')
-		{				
-			Element('cc_type_contact').value = data[1];			
+		{
+			Element('cc_type_contact').value = data[1];
 			CC_npages = 0;
 			CC_actual_page = 1;
@@ -2301,7 +2345,7 @@
 		else
 		Element('cc_type_contact').value = data[10];
-		
-//		Element('cc_debug').innerHTML = responseText;						
-		
+
+//		Element('cc_debug').innerHTML = responseText;
+
 		if (typeof(data) != 'object')
 		{
@@ -2309,9 +2353,9 @@
 			return;
 		}
-		
+
 		if (typeof(data[3]) == 'object')
 		{
 			CC_npages = parseInt(data[0]);
-			CC_actual_page = parseInt(data[1]);			
+			CC_actual_page = parseInt(data[1]);
 			if(CC_visual == 'cards')
 				drawCards(data[3].length, data[10]);
@@ -2321,5 +2365,9 @@
 			populateCards(data, data[10]);
 			setPages(data[0], data[1]);
-			
+
+		}
+		else if (data['error'])
+		{
+			showMessage(data['error']);
 		}
 		else
@@ -2332,4 +2380,20 @@
 	var info = "letter="+letter+"&page="+CC_actual_page+"&ids="+ids;
 	Connector.newRequest('showCards', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_cards_data', 'POST', handler, info);
+}
+
+
+function clearCards()
+{
+	clearLetterSelection();
+	setHeightSpace();
+	setMaxCards(getMaxCards());
+
+	if(CC_visual == 'cards')
+		drawCards(0);
+	else if(CC_visual == 'table')
+		drawTable(0);
+
+	setPages(0,0);
+	return;
 }
 
@@ -2342,5 +2406,5 @@
 	var table_h = Element('cc_panel_table');
 	var cards_h = Element('cc_panel_cards');
-	
+
 	switch (type)
 	{
@@ -2355,14 +2419,14 @@
 			break;
 	}
-	
+
 	CC_visual = type;
 	showCards(getActualLetter(), getActualPage());
 }
 
-function ccSearchUpdate(ids)
+/*function ccSearchUpdate(ids)
 {
 	Element('cc_panel_letters').style.display = 'none';
 	Element('cc_panel_search').style.display  = 'inline';
-	
+
 	if(CC_visual == 'cards')
 		drawCards(0);
@@ -2375,5 +2439,5 @@
 		return;
 	}
-	
+
 	var sIds = serialize(ids);
 
@@ -2383,4 +2447,22 @@
 	}
 	showCards('search', '1', sIds);
+}
+*/
+
+function ccSearchUpdate()
+{
+	Element('cc_panel_letters').style.display = 'none';
+	Element('cc_panel_search').style.display  = 'inline';
+
+	if(CC_visual == 'cards')
+		drawCards(0);
+	else if(CC_visual == 'table')
+		drawTable(0);
+
+	if (CC_actual_letter != 'search')
+	{
+		CC_last_letter = CC_actual_letter;
+	}
+	//showCards('search', '1', sIds);
 }
 
@@ -2399,5 +2481,6 @@
 	Element('cc_panel_search').style.display  = 'none';
 	Element('cc_panel_letters').style.display = 'inline';
-	showCards(CC_last_letter, '1');
+	clearCards();
+	//showCards(CC_last_letter, '1');
 }
 
@@ -2424,26 +2507,40 @@
 	data[3] = Element('cc_qa_phone').value;
 	data[4] = Element('cc_qa_email').value;
+
+	return data;
+}
+
+function sendQuickAdd ()
+{
+	var data = getQuickAdd();
+
+	var str = serialize(data);
+
+	if (!str)
+	{
+		return false;
+	}
+
+	var handler = function (responseText)
+	{
+		setTimeout('updateCards()',100);;
+	}
+
+	resetQuickAdd();
+
+	Connector.newRequest('quickAdd', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=quick_add', 'POST', handler, 'add='+escape(str));
+}
+
 	
-	return data;
-}
-
-function sendQuickAdd ()
-{
-	var data = getQuickAdd();
-	
-	var str = serialize(data);
-
-	if (!str)
-	{
-		return false;
-	}
-
-	var handler = function (responseText)
-	{
-		setTimeout('updateCards()',100);;
-	}
-
-	resetQuickAdd();
-
-	Connector.newRequest('quickAdd', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=quick_add', 'POST', handler, 'add='+escape(str));
-}
+function connectVoip (phoneUser, typePhone){
+	var handler_voip = function (responseText){
+		if(!responseText) {
+			alert("Erro conectando servidor VoIP.");
+		}
+		else{
+			data = unserialize(responseText);
+			alert("Requisitando chamada para o ramal: "+data);
+		}
+	}
+	Connector.newRequest('voip', "../../expressoMail1_2/controller.php?action=expressoMail1_2.functions.callVoipconnect&to="+phoneUser+"&typePhone="+typePhone, 'POST', handler_voip);
+	}
