function imageHolder() {
	
	//Organize our thumbs
	var iThumb = 1;
	jQuery('#album-thumbs > ul > li').each(function() {
		
		if(iThumb === 1) {
			
			jQuery(this).addClass('current');
			
		}
		
		jQuery(this).attr('id', 'albumThumb-'+iThumb);
		iThumb++;
		
	});
	
	imageWidth = jQuery('#image-holder > img').width();
	
	//if the user resizes, we resize too
	jQuery(window).resize(function() {
		
		resizeHolder();
		imageWidth = jQuery('#image-holder > img').width();
		centerImage(imageWidth);
		thumbsArrows();
		
	});
	
	//deals with our album thumbs
	albumThumbs();
	
	var myHash = window.location.hash;
	
	if(myHash != '') {
	
		var myHashTemp = myHash.split('#');
		var myHashArr = myHashTemp[1].split('/');
		
		if(myHashArr[1] != null) {
			
			if(myHashArr[1] != '' && isInt(myHashArr[1]) && newAlbum === 0) {
				
				var myFirstPhoto = jQuery('#album-thumbs > ul > li:eq('+(myHashArr[1] - 1)+')');
				
				if(myFirstPhoto.length > 0) {
					
					jQuery('#album-thumbs > ul > li.current').removeClass('current').children('span').remove();
					myFirstPhoto.addClass('current').append('<span class="currentArrow"></span>');
					var firstImage = myFirstPhoto.children('img').attr('longdesc');
					
				} else {
					
					var firstImage = jQuery('#album-thumbs > ul > li.current > img').attr('longdesc');
					
				}
				
			} else {
				
				var firstImage = jQuery('#album-thumbs > ul > li.current > img').attr('longdesc');
				
			}
			
		} else {
	
			var firstImage = jQuery('#album-thumbs > ul > li.current > img').attr('longdesc');
	
		}
	
	} else {
	
		var firstImage = jQuery('#album-thumbs > ul > li.current > img').attr('longdesc');
	
	}
		
	loadImage(firstImage);
	newAlbum = 0;
	
	jQuery('#album-thumbs > ul > li').click(function() {
		
		callSpecPhoto(jQuery(this).attr('id'));
		
	});
	
	thumbsArrows();
	
	jQuery('#photo-album-wrapper').hover(function() {
		
		jQuery(this).stop().animate({ bottom: 0 }, { duration: 300, easing: 'easeOutQuart' });
		jQuery('.thumb-icon').stop().animate({ width: 0, height: 0 }, 100);
		
	}, function() {
		
		jQuery(this).stop().animate({ bottom: '-111px' }, { duration: 300, easing: 'easeOutQuart' });
		jQuery('.thumb-icon').stop().animate({ width: '16px', height: '20px' }, 100);
		
	});
	
	jQuery('#open-externally').css({ opacity: .5 }).hover(function() {
		
		jQuery(this).stop().animate({ opacity: 1 }, { duration: 200, easing: 'easeOutQuart' });
		jQuery(this).children('span').stop(true, true).fadeIn(200);
		
	}, function() {
		
		jQuery(this).stop().animate({ opacity: .5 }, { duration: 300, easing: 'easeOutQuart' });
		jQuery(this).children('span').stop(true, true).fadeOut(200);
		
	});
	
	
	
	
	
}

function resizeHolder() {
	
	var windowHeight = jQuery(window).height();
	jQuery('#image-holder').css({height: (windowHeight-80)+'px' });
	var windowWidth = jQuery(window).width();
	jQuery('#image-holder').css({ width: windowWidth+'px'});
	
	var windowHeight = jQuery(window).height();
	jQuery('#image-holder').css({height: (windowHeight-80)+'px' });
	var windowWidth = jQuery(window).width();
	jQuery('#image-holder').css({ width: windowWidth+'px'});
	
}

function albumThumbs () {
	
	jQuery('#album-thumbs > ul > li span:not(#album-thumbs > ul > li.current > span)').remove();
	
	//Hover effect on our thumbs
	jQuery('#album-thumbs > ul > li').hover(function() {
		
		jQuery(this).stop().animate({ 'margin-top': '20px' }, { duration: 200, easing: 'easeOutQuart' });
		jQuery(this).children('img').addClass('hovered');
		
	}, function() {
		
		jQuery(this).stop().animate({ 'margin-top': '30px' }, { duration: 200, easing: 'easeOutQuart' });
		jQuery(this).children('img').removeClass('hovered');
		
	});
	
	//adds the arrow to the current album thumb
	albumThumbCurrentArrow();
	
	var numberPhotos = jQuery('#album-thumbs > ul > li').length;
	
}

function callSpecPhoto(id) {
	
	var currentPhoto = jQuery('#album-thumbs > ul > li.current');
	
	var nextPhoto = jQuery('#'+id);
	
	if(nextPhoto.attr('class') != 'current') {
		
		currentPhoto.removeClass('current');
		nextPhoto.addClass('current');
		
		var nextImg = nextPhoto.children('img').attr('longdesc');
		
		loadImage(nextImg);
		
		albumThumbs();
		
	}
	
}

function centerImage(width) {
	
	var windowWidth = jQuery(window).width();
	var windowHeight = (jQuery(window).height() - 80);

	var imageHeight = jQuery('#image-holder > img').height();
	var imageWidth = jQuery('#image-holder > img').width();
	
	if(imageHeight != null) {
		
		if(imageHeight > windowHeight) {
			
			if(imageWidth > windowWidth) {
				
				if((imageWidth - windowWidth) > (imageHeight - windowHeight)) {
					
					var imageNewWidth = windowWidth;
					var imageNewHeight = (imageNewWidth / imageWidth) * imageHeight;
				
					jQuery('#image-holder > img').css({ height: imageNewHeight+'px', width: imageNewWidth+'px' });
					
					var imagePosTop = (windowHeight - jQuery('#image-holder > img').height()) / 2;
					jQuery('#image-holder > img').css({ 'margin-top': imagePosTop+'px' });
					
				} else if((imageWidth - windowWidth) < (imageHeight - windowHeight)) {
					
					var imageNewHeight = windowHeight;
					var imageNewWidth = (imageNewHeight / imageHeight) * imageWidth;
				
					jQuery('#image-holder > img').css({ height: imageNewHeight+'px', width: imageNewWidth+'px' });
					
					var imagePos = (windowWidth - jQuery('#image-holder > img').width()) / 2;
					jQuery('#image-holder > img').css({ 'margin-left': imagePos+'px' });
					
				}
				
			} else {
				
				var imageNewHeight = windowHeight;
				var imageNewWidth = (imageNewHeight / imageHeight) * imageWidth;
				
				jQuery('#image-holder > img').css({ height: imageNewHeight+'px', width: imageNewWidth+'px' });
					
				var imagePos = (windowWidth - jQuery('#image-holder > img').width()) / 2;
				jQuery('#image-holder > img').css({ 'margin-left': imagePos+'px' });
				
			}
			
		} else if(imageWidth > windowWidth) {
			
			var imageNewWidth = windowWidth;
			var imageNewHeight = (imageNewWidth / imageWidth) * imageHeight;
				
			jQuery('#image-holder > img').css({ height: imageNewHeight+'px', width: imageNewWidth+'px' });
				
			var imagePosTop = (windowHeight - jQuery('#image-holder > img').height()) / 2;
			
			jQuery('#image-holder > img').css({ 'margin-top': imagePosTop+'px' });
			
		} else {
			
			//thre is not extra width or height
			var imagePosTop = (windowHeight - imageHeight) / 2;
			jQuery('#image-holder > img').css({ 'margin-top': imagePosTop+'px' });
					
			var imagePos = (windowWidth - jQuery('#image-holder > img').width()) / 2;
			jQuery('#image-holder > img').css({ 'margin-left': imagePos+'px' });
			
		}
		
	}

}

function loadImage(imageUrl) {
	
	var currentAlbum = jQuery('.currentAlbum').children('a').text().toLowerCase();
	
	tempIndex = 1;
	currentPhoto = 1;
	
	jQuery('#album-thumbs > ul > li').each(function() {
		
		if(jQuery(this).attr('class') == 'current') {
			
			currentPhoto = tempIndex;
			
		}
		
		tempIndex++;
		
		
		
	});
	
	var newHash = currentAlbum+'/'+currentPhoto;
	window.location.hash = newHash;
	
	resizeHolder();
	
	var img = new Image();
	
	jQuery(img).attr('src', imageUrl);
	
	if (!img.complete) {
		
		if(jQuery('#image-holder').children('img').length > 0) {
			
			jQuery('#image-holder').children('img').stop(true, true).fadeOut(200, function() {
				
				jQuery('#image-holder').removeClass('errorLoading').addClass('loading');
				
				jQuery(this).remove();
				
				var img = new Image();
		  
				jQuery(img).load(function() {
					
					//Hide our image
					jQuery(this).hide();
					
					//removes the loading class
					jQuery('#image-holder').removeClass('loading').append(this);
					
					//shows our image
					jQuery(this).stop(true, true).fadeIn(500);
					
					imageWidth = jQuery(this).width();
					
					centerImage(imageWidth);
					
				}).error(function() {
					
					//if there's an error
					jQuery('#image-holder').removeClass('loading').addClass('errorLoading');
					
				}).attr('src', imageUrl);
				
				jQuery('#open-externally').attr('href', imageUrl);
				
			});
					
		} else {
		
			var img = new Image();
			
			jQuery('#image-holder').removeClass('errorLoading').addClass('loading');
			
			jQuery(img).load(function() {
				
				//Hide our image
				jQuery(this).hide();
				
				//removes the loading class
				jQuery('#image-holder').removeClass('loading').append(this);
				
				//shows our image
				jQuery(this).stop(true, true).fadeIn(500);
				
				imageWidth = jQuery(this).width();
				
				centerImage(imageWidth);
				
			}).error(function() {
				
				//if there's an error
				jQuery('#image-holder').removeClass('loading').addClass('errorLoading');
				
			}).attr('src', imageUrl);
			
			jQuery('#open-externally').attr('href', imageUrl);
			
		}
	
	} else {
		
		if(jQuery('#image-holder > img').length > 0) {
			
			jQuery('#image-holder > img').fadeOut(150, function() {
				
				jQuery(this).remove();
				
				jQuery('#image-holder').append(jQuery(img));
				
				jQuery('#image-holder > img').css({ opacity: 0 }).animate({ opacity: 1 }, 200);
				
				imageWidth = jQuery('#image-holder > img').width();
				
				centerImage(imageWidth);
				
			});
			
			jQuery('#open-externally').attr('href', imageUrl);
			
		} else {
			
			jQuery('#image-holder').removeClass('errorLoading').append(jQuery(img));
			
			imageWidth = jQuery('#image-holder > img').width();
				
			centerImage(imageWidth);
			
			jQuery('#open-externally').attr('href', imageUrl);
			
		}
		
	}
	
}

function albumThumbCurrentArrow() {
	
	jQuery('#album-thumbs> ul > li.current').append('<span class="currentArrow"></span>');
	
}

function callPreviousPhoto() {
	
	var currentPhoto = jQuery('#album-thumbs ul li.current');
	var prevPhoto = currentPhoto.prev();
	
	if(prevPhoto.length == 0) {
		
		var prevPhoto = jQuery('#album-thumbs ul li:last');;
		
	}
	
	callSpecPhoto(prevPhoto.attr('id'));
	
}

function tooltipHandler() {
	
	tooltipAdded = 0;
	tooltipClicked = 0;
	
	jQuery('#image-holder').mouseenter(function() {
		
		var currentThumb = jQuery('#album-thumbs ul li.current');
		var currentDesc = currentThumb.children('div.description').html();
		
		if(tooltipAdded === 0) {
		
			jQuery('#image-tooltip').append(currentDesc);
		
			tooltipAdded = 1;
		
		}
		
		if(tooltipClicked === 0 && currentDesc !== null) {
			
			jQuery('#image-tooltip').fadeIn(200);
			
		}
		
	}).mousemove(function(e) {
		
		jQuery('#image-tooltip').css({ left: e.pageX+'px' });
		jQuery('#image-tooltip').css({ top: (e.pageY + 40)+'px' });
		
	}).mouseleave(function() {
		
		jQuery('#image-tooltip').css({ display: 'none' }).html('').append('<span></span>');
		tooltipAdded = 0;
		
	});
	
	jQuery('#image-holder').click(function() {
		
		var currentThumb = jQuery('#album-thumbs ul li.current');
		var currentDesc = currentThumb.children('div.description').html();
		
		if(tooltipClicked === 0) {
		
			jQuery('#image-tooltip').fadeOut(200);
			tooltipClicked = 1;
			
		} else {
			
			if(currentDesc !== null) {
		
				jQuery('#image-tooltip').fadeIn(200);
				tooltipClicked = 0;
			
			}
			
		}
		
	});
	
}

function thumbsArrows() {
	
	var thumbsWidth = ((jQuery('#album-thumbs li').length) * (86)) + 60;
	var windowWidth = jQuery(window).width();
	
	var noOfScrolls = (Math.ceil((thumbsWidth / windowWidth)) * 2) - 1;
	
	currentScroll = 1;
	
	jQuery('#more-thumbs, #less-thumbs').css({ opacity: 0 });
	
	jQuery('#more-thumbs').hover(function() {
		
		if(currentScroll !== noOfScrolls) {
		
			jQuery(this).stop().animate({ opacity: 1 }, 200);
			
		}
		
	}, function() {
		
		jQuery(this).stop().animate({ opacity: 0 }, 200);
		
	});
	
	jQuery('#less-thumbs').hover(function() {
		
		if(currentScroll !== 1) {
			
			jQuery(this).stop().animate({ opacity: 1 }, 200);
			
		} else if(currentScroll === 1) {
			
			jQuery(this).css({ 'z-index': 9 });
			
		}
		
	}, function() {
		
		jQuery(this).stop().animate({ opacity: 0 }, 200);
		
	});
	
	jQuery('#more-thumbs').click(function() {
		
		if(currentScroll < noOfScrolls) {
			
			thumbsPos = (currentScroll * (windowWidth / 2));
			jQuery('#album-thumbs').stop().animate({ left: '-'+thumbsPos+'px' }, 400);
			jQuery('#less-thumbs').css({ 'z-index': 15 });
			currentScroll++;
			
		}
		
	});
	
	jQuery('#less-thumbs').click(function() {
		
		if(currentScroll > 1) {
			
			thumbsPos = ((currentScroll-2) * (windowWidth / 2));
			jQuery('#album-thumbs').stop().animate({ left: '-'+thumbsPos+'px' }, 400);
			currentScroll--;
			
		}
		
	});
	
}

function dropDown() {
	
	jQuery("#menu ul li").hover(function() {
		
		jQuery(this).find('ul:first').css({ display: 'block', opacity: 0 }).stop().animate({ opacity: 1 }, 200);
		jQuery(this).find('ul:first li').css({ opacity: .8 });//Slides down when hover the UL
		 
	}, function() {
		jQuery(this).find('ul:first').fadeOut(200);
	});
	
	jQuery("#menu ul li ul li").hover(function() {
		
		jQuery(this).stop().animate({ opacity: 1 }, 150);
		
	}, function() {
		
		jQuery(this).stop().animate({ opacity: .8 }, 150);
		
	});
	
}

function loadPages() {
		
	var cont = jQuery('#album-thumbs');
	
	newAlbum = 0;
	
	var firstAlbum = jQuery('li.menu-item-type-taxonomy:first a').attr('href');
	
	var myHash = window.location.hash;
		
		if(myHash != '') {
		
			var myHashTemp = myHash.split('#');
			var myHashArr = myHashTemp[1].split('/');
			
			var albumLoaded = 0;
			
			jQuery('#menu .menu-item-type-taxonomy').each(function() {
				
				if(jQuery(this).children('a').text().toLowerCase() == myHashArr[0]) {
					
					albumLoaded = 1;
					
					jQuery(this).addClass('currentAlbum');
					var curAlbum = jQuery(this).children('a').attr('href');
			
					cont.load(curAlbum, function() {
						
						imageHolder();
						
					});
					
				}
				
			});
			
		} else {
		
			jQuery('li.menu-item-type-taxonomy:first').addClass('currentAlbum');
			
			cont.load(firstAlbum, function() {
				
				imageHolder();
				
			});
	
		}
	
	if(albumLoaded === 0) {
		
		jQuery('li.menu-item-type-taxonomy:first').addClass('currentAlbum');
		
		cont.load(firstAlbum, function() {
			
			imageHolder();
			
		});
		
	}
		
	jQuery(document).keypress(function(e) {
		
		if(e.keyCode === 39) {
			
			var currentPhoto = jQuery('#album-thumbs ul li.current');
			var nextPhoto = currentPhoto.next();
		
			if(nextPhoto.length == 0) {
			
				var nextPhoto = jQuery('#album-thumbs ul li:first');
			
			}
			
			callSpecPhoto(nextPhoto.attr('id'));
			
		} else if(e.keyCode === 37) {
			
			var currentPhoto = jQuery('#album-thumbs ul li.current');
			var prevPhoto = currentPhoto.prev();
		
			if(prevPhoto.length == 0) {
			
				var prevPhoto = jQuery('#album-thumbs ul li:last');
			
			}
			
			callSpecPhoto(prevPhoto.attr('id'));
			
		}
		
	});
	
	jQuery('li.menu-item-type-taxonomy a').click(function() {
		
		if(jQuery('#content-holder').css('display') == 'block') {
			
			jQuery('#content-holder, #content-wrapper').fadeOut(200);
			
		}
		
		var currentClass = jQuery(this).parent().attr('class').split(' ');
		
		if(currentClass[1] != 'currentAlbum') {
		
			var newAlbumUrl = jQuery(this).attr('href');
			
			jQuery('#menu ul li.currentAlbum').removeClass('currentAlbum');
			jQuery(this).parent().addClass('currentAlbum');
			
			cont.children('ul').remove();
			cont.load(newAlbumUrl, function() {
				
				currentScroll = 1;
				jQuery('#album-thumbs').css({ left: 0 });
				thumbsArrows();
				newAlbum = 1;
				imageHolder();
				
				
			});
		
		}
		
		return false;
		
	});
	
	tooltipHandler();
	
	
	
	jQuery('#previous-photo').hover(function() {
		
		jQuery(this).children('div').css({ display: 'block', opacity: 0 }).stop().animate({ opacity: 1 }, 200);
		
	}, function() {
		
		jQuery(this).children('div').stop().animate({ opacity: 0 }, 200);
		
	});
	
	jQuery('#next-photo').hover(function() {
		
		jQuery(this).children('div').css({ display: 'block', opacity: 0 }).stop().animate({ opacity: 1 }, 200);
		
	}, function() {
		
		jQuery(this).children('div').stop().animate({ opacity: 0 }, 200);
		
	});
	
	jQuery('#next-photo').click(function() {
		
		var currentPhoto = jQuery('#album-thumbs ul li.current');
		var nextPhoto = currentPhoto.next();
	
		if(nextPhoto.length == 0) {
		
			var nextPhoto = jQuery('#album-thumbs ul li:first');
		
		}
		
		callSpecPhoto(nextPhoto.attr('id'));
		
	});
	
	jQuery('#previous-photo').click(function() {
		
		var currentPhoto = jQuery('#album-thumbs ul li.current');
		var prevPhoto = currentPhoto.prev();
	
		if(prevPhoto.length == 0) {
		
			var prevPhoto = jQuery('#album-thumbs ul li:last');
		
		}
		
		callSpecPhoto(prevPhoto.attr('id'));
		
	});
	
}

function contentHandler() {
	
	centerContent();
	
	jQuery(window).resize(function() {
		
		centerContent();
		
	});
	
	jQuery('#menu ul li').click(function() {
		
		return false;
		
	});
	
	jQuery('#menu ul li.menu-item-type-post_type').click(function() {
		
		var pageUrl = jQuery(this).children('a').attr('href');
		
		if(jQuery('#content-wrapper').css('display') == 'none') {
			
			jQuery('#content-area').html('');
			jQuery('#content-area').css({ opacity: 0 });
			jQuery('#content-holder').addClass('loading');
			jQuery('#content-wrapper').fadeIn(200);
			jQuery('#content-holder').fadeIn(200);
			jQuery(this).addClass('hovered');
			
			jQuery('#content-area').load(pageUrl, function() {
				
				jQuery('#content-holder').removeClass('loading');
				
				Cufon.replace('#content-holder h1, #content-holder h2, #content-holder h3, #content-holder h4, #content-holder h5, #content-holder h6', {
					
					hover: true
					
				});
				
				submitForm();
				
				jQuery('#content-area').stop().animate({ opacity: 1 }, 200);
				
			});
		
		} else {
			
			if(jQuery(this).attr('class') != 'page hovered') {
				
				jQuery('#menu ul li.hovered').removeClass('hovered');
				
				jQuery('#content-area').html('');
				jQuery('#content-area').css({ opacity: 0 });
				jQuery('#content-holder').addClass('loading');
				jQuery(this).addClass('hovered');
			
				jQuery('#content-area').load(pageUrl, function() {
					
					jQuery('#content-holder').removeClass('loading');
					
					jQuery('#content-area').stop().animate({ opacity: 1 }, 200);
				
					Cufon.replace('#content-holder h1, #content-holder h2, #content-holder h3, #content-holder h4, #content-holder h5, #content-holder h6', {
						
						hover: true
						
					});
					
				});
				
				submitForm();
				
				
			} else {
			
				jQuery('#content-wrapper').fadeOut(200);
				jQuery('#content-holder').fadeOut(200);
				jQuery(this).removeClass('hovered');
			
			}
				
				Cufon.replace('#menu ul li a:not(#menu ul li ul li a)', {
						
						hover: true
						
				});
			
		}
		
		return false;
		
	});
	
	jQuery('#content-wrapper').click(function() {
		
		jQuery('#content-wrapper').fadeOut(200);
		jQuery('#content-holder').fadeOut(200);
		jQuery('#menu ul li.menu-item-type-post_type').removeClass('hovered');
				
				Cufon.replace('#menu ul li a:not(#menu ul li ul li a)', {
						
						hover: true
						
				});
		
	});
	
}

function centerContent() {
	
	var windowWidth = jQuery(window).width();
	var windowHeight = jQuery(window).height() - 80;
	
	var newLeftPos = (windowWidth - 960) / 2;
	var newHeight = (windowHeight - 80);
	
	var newAreaHeight = (windowHeight - 80);
	
	jQuery('#content-wrapper').css({ height: (newHeight+80)+'px' });
	jQuery('#content-holder').css({ left: newLeftPos+'px', height: newHeight+'px' });
	jQuery('#content-area').css({ height: newAreaHeight+'px' });
	
}

function isInt(x) { 
	   var y=parseInt(x); 
	   if (isNaN(y)) return false; 
	   return x==y && x.toString()==y.toString(); 
 } 

/**
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne <brian@cherne.net>
*/
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);

(function(a){a.fn.aeImageResize=function(b){var c=jQuery.extend({height:9,width:9},b);this.each(function(){var d=c.height,g=c.width,i=a(this).height(),f=a(this).width(),h=Math.ceil,e=Math.floor;if(i>=f){g=e(h(f/i*d))}else{d=e(h(i/f*g))}a(this).attr({height:d,width:g})})}})(jQuery);
