function getEmail(host, login)
{
	var nsHost = (host+"").substr(6, host.length-1);
	var nsLogin = (login+"").substr(6, login.length-1);
	var returnValue = nsLogin + "@" + nsHost;
	return returnValue;
}

function showImage(images, nr)
{
	var h = $(document).height();
	var w = $(document).width();
	var path = images[nr];
	$('#image_container_bg').show();
	$('#image_container_bg').css({'width':w, 'height': h, 'opacity': 0.75});
	$('#image_container').show();
	$('#navigation').hide();
	$('#close_image').hide();

	
	var top = Math.round($(window).scrollTop() + ($(window).height() - 250) / 2);
	var left = Math.round(($(window).width() - 250) / 2);
	
	$('#image_container').css({'zIndex': 39, 'width': 250, 'height': 250, 'top': top, 'left': left});

	var imageLoad = $('<img src="" style="display: block; z-index: 40"  />');

	imageLoad.unbind('click');
	$('#arrow_next').unbind('click');
	$('#arrow_prev').unbind('click');
	
	
	if (images.length > (nr +1))
	{
	  imageLoad.css({'cursor': 'pointer'});
	  $('#arrow_next').show();
		$('#arrow_next').bind('click', function(event)
		{
		  hideImage()

		  showImage(images, ++nr);
		});
		
		imageLoad.bind('click', function(event)
		{
		  hideImage();

		  showImage(images, ++nr);
		});
	}
	else
	{
		imageLoad.css({'cursor': 'default'});
	  $('#arrow_next').hide();
	}
	
	if (nr > 0 )
	{
	  $('#arrow_prev').show();
	  $('#arrow_prev').bind('click', function(event)
		{
		  hideImage();
		  showImage(images, --nr);
		});
	}
	else
	{
	  $('#arrow_prev').hide();
	}

	var imageLoadObj = new Image();
	
	
	$(imageLoadObj).load( function()
	{
	  $(imageLoad).attr("src", path);
	  $('#image_box').empty();
	  $('#image_box').append($(imageLoad));
	  $(imageLoad).show();

	  var imgWidth = $(this).get(0).width;
	  var imgHeight = $(this).get(0).height;

	  var top = Math.round($(window).scrollTop() + (($(window).height() - imgHeight ) / 2));
	  
	  if (top < $(window).scrollTop()) top = $(window).scrollTop() + 30;
	  
	  var left = Math.round(($(window).width() - imgWidth ) / 2);
	  

	  $('#image_container').css({'top': top, 'left': left });
	  $('#image_container').css({'width': imgWidth, 'height': imgHeight, 'top': top, 'left': left});
	  
	  
	  $('#navigation').show();
		$('#navigation').css({'top': top +$('#image_container').outerHeight(), 'left': left, 'width': $('#image_container').outerWidth()});
		
		$('#close_image').show();
		$('#close_image').css({'top': top - 32, 'left': left + $('#image_container').outerWidth() - $('#close_image').outerWidth()});
	}).attr("src", path);
}


function hideImage()
{
	$('#close_image').hide();
	$('#navigation').hide();
  $('#image_box').empty();
  $('#image_container').hide();
  $('#image_container_bg').hide();
  $('#arrow_next').hide();
	$('#arrow_prev').hide();
}
