$.fn.extend({
	myFadeIn : function() {
    	return this.each(function() {
			// get type
			var src = $(this).attr('src');
			if (src.substr(src.lastIndexOf('.')) == '.png') {
				$(this).attr('isPng',1);
				// for ie6
				if ($.browser.msie && $.browser.version<7) {
					$(this).css('visibility','visible');
					return false;
				}
			}
			if ($(this).height() > 100) {
				$(this).startFadeIn();
			} else {
				$(this).load($(this).startFadeIn)
			}	
		});
	},
	startFadeIn : function() {
		var s = $(this);
		if(!s) return false;
		s.after('&nbsp;');
		s.hide();
		s.css('visibility','visible');
			if ($.browser.msie && s.attr('isPng')) {
				s.show();
			}
			else {
				s.fadeIn(2000);				
			}
	}

});


$(document).ready(function() {
	$(".gallery a").fancybox();
	$('a.media').media();
	$('.fadeIn').myFadeIn();
});
