jQuery.fn.ImageAutoSize = function(width) {
    $("img",this).each(function()
    {
        var image = $(this);
        if(image.width()>width)
        {
            image.width(width);
            image.height(width/image.width()*image.height());
        }
    });
}
jQuery.noConflict();
jQuery(document).ready(function($){
	/* Topnav Dropdown menu.	*/
	$('#topnav ul li').each(function(){
		if($(this).children('ul').length > 0) {
			$(this).addClass('withul');
			$(this).children('a').addClass('withula');
		
			$(this).hover(function(){
				$(this).addClass('withul-hover');
				$(this).children('ul').slideDown(200);
			},function(){
				$(this).removeClass('withul-hover');
				$(this).children('ul').slideUp(100);	
			});
		}
	});
	
	/* Slide Category Select */
	$('#category-select').each(function(){
		$(this).hover(function(){
			$('#category-dropdown:hidden').slideDown(200);
		},function(){
			$('#category-dropdown:visible').slideUp(100);	
		});
	});
	$('#category-select-toggle').click(function(){
		return false;
	});
	
	$('#category-select ul li a').wrapInner('<span>');
	
	$('.widget ul ul li:last-child').css({'border-bottom':0,'padding-bottom':0});

});
