$(document).ready(function() 
{

	
	//abecedny zoznam firiem
    $('#comp_letter a').click(function(){getCompanyByLetter(this);return false;});
	
	function getCompanyByLetter(elem)
	{
        $.ajax({
            type: "GET",
            url: "/getCompany.php?letter="+$(elem).text(),
            success: function(msg)
            {
                $('#comp_letter_result').html(msg);
            }
        });
    }
    
    
	
});

	jQuery.fn.resizeImg = function()
	{
		var max_width = 80;
		var max_height = 50;
		var heights = '';
		$('#random img').each(function(){
			
			
			if($(this).width() > max_width || $(this).height() > max_height)
			{
				
				width_scale = max_width/$(this).width();
				height_scale = max_height/$(this).height();
				//alert(width_scale);
				
				if(width_scale <  height_scale)
				{
					scale = width_scale;
				}
				else
				{
					scale = height_scale;
				}
				
				new_width = Math.round(scale*$(this).width());
				new_height = Math.round(scale*$(this).height());
				$(this).css('width',new_width+'px');
				$(this).css('height',new_height+'px');
			}
			
			
			
		})
		//alert(heights);
	}
	
	//jQuery.fn.resizeImg();
