	
	/**
		Resize thumbs to the highest thumb in the row where perline the number of items in a row
	*/
	function resizeThumbs(jQueryId, perline) {
		// initialize
		offset = 1;
		var heap = new Array();	// list of objects we've seen so far
		var height = 0;			// current max height
		$(jQueryId).each(function(i, o) {
			height = Math.max(height, o.offsetHeight);	// find max height
			heap.push(o);								// add to heap
			if((i+offset)%perline==0) {						// if end of row
				$(heap).each(function(i, o) {$(o).css({height: height})});	// set the height of items on the heap
				heap = new Array();						// clear the heap
				height = 0;								// clear the max height
			}
		});
		$(heap).each(function(i, o) {$(o).css({height: height})});	// set the height of items on the heap (heap does not have to be empty yet here)
	}
	
	/**
		Overlay functions for ambassador_list and ambassador_business_case
		showOverlay/closeOverlay
	*/
	var previous = false;
	function showOverlay(id) {
		if(previous !== false) {	// hide previous overlay
			$(previous).fadeOut();
		}
		var offsetx = 0;
		if($("#overlay_"+id).hasClass("mirror"))
			offsetx = $("#thumb_"+id).outerWidth() - $("#overlay_"+id).width();	// position right or left of the thumb
		offsetx += 1;
		if(!(!$.browser.msie || ($.browser.msie &&  $.browser.version >= 7)))
			offsetx -= 1;
		var top = $("#thumb_"+id).offset().top;
		if($("#overlay_"+id).height() + top > $(document).height())
			top = $(document).height() - $("#overlay_"+id).height();
		$("#overlay_"+id).css({top: top, left: $("#thumb_"+id).offset().left + offsetx});	// set position
		$("#overlay_"+id).fadeIn();
		var height = $("#overlay_" + id + " .bottom_info").height();
		if($("#overlay_"+id + " .ambassador_details").height() < $("#overlay_"+id + " .ambassador_photo").height() + height)
			$("#overlay_"+id + " .ambassador_details").css({height: $("#overlay_"+id + " .ambassador_photo").height() + height});
		previous = "#overlay_"+id;
	}
	function closeOverlay() {
		$(previous).fadeOut();
		previous = false;
	}
	
	/**
		myGet is a wrapper for the jQuery get function with the added functionality of showing/hiding a 'loading' screen
	*/
	function myGet(url, data, callback) {
		showLoading();
		$.get(url, data, function(res){callback(res); hideLoading();});
	}
	function showLoading() {
		$("#loading").css({top: $(loadingMirror).offset().top,
							left: $(loadingMirror).offset().left,
							width: $(loadingMirror).width(),
							height: $(loadingMirror).height(),
							opacity: 0,
							display: 'block',
							zIndex: 2});
		$("#loading div").css({top: Math.min($(loadingMirror).height()/2, 150),
								width: $(loadingMirror).width()});
		$("#loading").fadeTo(400, 0.8);
	}
	function hideLoading() {
		$("#loading").css({height: ($(loadingMirror).height()+5)});
		$("#loading div").css({top: Math.min($(loadingMirror).height()/2, 150),
								width: $(loadingMirror).width()});
		$("#loading").fadeOut(400);
	}