	function alignImage(imgDiv) {

		var imgWidth = $("#" + imgDiv).width();
		var imgHeight = $("#" + imgDiv).height();

		var topPad = Math.floor((450 - imgHeight) / 2);
		var leftPad = Math.floor((515 - imgWidth) / 2);

		$("#" + imgDiv).css({marginLeft: leftPad }).css({marginTop: topPad }).css({marginRight: leftPad });

		// resize the side-by-sidediv's so they are the same height

		var leftHeight = $("#image-twothirds").height();
		var rightHeight = $("#image-onethird").height();

		if ( leftHeight > rightHeight ) {
			$("#image-onethird").css({height: leftHeight });
		} else {
			$("#image-twothirds").css({height: rightHeight });
		}
	}


$(document).ready( function() {

	
	Cufon.replace('#content h1', { fontFamily: 'Vegur', fontSize: '40px', color:'#000000', fontWeight:'normal' } );
	Cufon.replace('#content h2', { fontFamily: 'Vegur', fontSize: '22px', color:'#000000', fontWeight:'normal' } );
	Cufon.replace('#content h3', { fontFamily: 'Vegur', fontSize: '18px', color:'#000000', fontWeight:'normal' } );
	Cufon.replace('h3.post-title', { fontFamily: 'Vegur', fontSize: '30px', color:'#000000', fontWeight:'normal' } );
	Cufon.replace('h2.date-header', { fontFamily: 'Vegur', fontSize: '10px', color:'#000000', fontWeight:'normal' } );

	$('.rounded').corner();
	
	$('#sidebar .widget').corner();
	
	Cufon.replace('.footer-one-third h2', { fontFamily: 'ColaborateLight', fontSize: '20px', color:'#CCCCCC' } );
	Cufon.replace('.footer-one-third h3', { fontFamily: 'ColaborateLight', fontSize: '20px', color:'#CCCCCC' } );
	
// 	$('#slider1').s3Slider({
// 		timeOut: 6000
// 	});

    $('.slideshow').cycle({
		fx: 'fade' // transition type : fade, scrollUp, shuffle, etc...
	});

	

	// AJAX Handler
	function getFile(file, divID) {

		$("#pageLoading").fadeIn(500, function() {
			$.get(file,function(data) {
				$(divID).fadeOut('slow',function(){
					$(this).html(data).fadeIn('slow', function() {
						$("#pageLoading").fadeOut(500);
					});
				});
			});
		});


	}



	$("a#imageMain").live("click",  function(e) {
		e.preventDefault();
		getFile("/_includes/load-main.php" + $(this).attr("href"), "#gallery-wrapper");
	});

	$("a#imageGroup").live("click",  function(e) {
		e.preventDefault();
		getFile("/_includes/load-series.php" + $(this).attr("href"), "#gallery-wrapper");
	});

	$("a#imageDetail").live("click",  function(e) {
		e.preventDefault();
		getFile("/_includes/load-image.php" + $(this).attr("href"), "#gallery-wrapper");
	});

	// on load, center the 'loading' icon based on users screen
	var obj = $("#pageLoading");
	var halfsc = $(window).height()/2;
	var halfh = $(obj).height() / 2; 
	var halfscrn = screen.width/2;
	var halfobj =$(obj).width() / 2; 
	var goRight =  halfscrn - halfobj ;
	var goBottom = halfsc - halfh;
	$(obj).css({marginLeft: goRight }).css({marginTop: goBottom });





});

