/**
 *	Send help email to territory manager (from empty search result)
 */ 
function sendEmptySearchMessage() {
													
	$('#esmLoader').fadeIn("fast");
	var helpIndex = $('#helpIndex').val();
	var helpSearchText =	$('#helpSearchText').val();
	var helpUserEmail = '';
	
	if ($('#helpUserEmail')) {
		helpUserEmail = $('#helpUserEmail').val();
		if ($('#helpUserEmail').val() == '') {
			$('#esmLoader').hide();
			alert(insertEmailMsg);
			return false;
		}
	}
	
	$.post("/service", {
			ajax: "AjaxService",
			action: "sendEmptySearchMessage",
			helpIndex: helpIndex,
			helpSearchText: helpSearchText,
			helpUserEmail: helpUserEmail
		},
		function(data) {
			
			if (data == 'OK') {
			
				// Slide message
				$('#esmFinally').show("slide", { direction: "left", distance: 600 }, 1500);
				
				// Load fresh pictures
				var params = {
					"ajax": "SearchAjax",
					"action": "loadPictures",
					"maxCount": 20,
					"searchIndex": helpIndex,
					"searchUrl": ";orderby:date",
					"page": 1
				}
				$.get("/service", params, 
					function(data, status) {
						if (status == "success") {
							$('#result-content').append(data);
							thumbee();
							$('.object_transparent').each(function(i) {
								$(this).css("opacity", 1);
							});
						}
					}
				);
				
				// Show results
				setTimeout("$('#loadFreshPictures').fadeIn('slow');", 3000);
				setTimeout("$('#result-content').fadeIn('slow');", 4000);
				
				
			} else {
				$('#esmFinally').html(notSendedEmail);
				$('#esmFinally').show("slide", { direction: "left", distance: 600 }, 2000);
			}
			
			$('#esmLoader').hide();
			
		});

}

