function changeBg(filename){
	$('#supersized img').attr('src', '/publish_files/'+filename);
	$.post('/changeBackground.php', { changeBackground: filename });
}

//$(window).load(function(){
//	var theWindow = $(window);
//	var	$bg = $("#bg");
//	var widthAspectRatio = $bg.width() / $bg.height();
//	var heightAspectRatio = $bg.height() / $bg.width();				
//});

//$(function() { 
//    var theWindow = $(window);
//	var	$bg = $("#bg");
//	var widthAspectRatio;
//	var heightAspectRatio;
//	
//	widthAspectRatio = $bg.width / $bg.height;
//	heightAspectRatio = $bg.height / $bg.width;
//
////	$bg.load(function() {
////		widthAspectRatio = this.width / this.height;
////		heightAspectRatio = this.height / this.width;
////	});
//	
//	function resizeBg() {
////		if ( (theWindow.width() / theWindow.height()) < widthAspectRatio ) {
////			$bg.removeClass().addClass('bgheight');
////		} else {
////			$bg.removeClass().addClass('bgwidth');
////		}
//
//		var currentWAP = (theWindow.width() / theWindow.height());
//		var currentHAP = (theWindow.height() / theWindow.width());
//
//		if ( currentWAP < widthAspectRatio ) {
//			$('#temp_box2').text('if');
//			$bg.removeClass().addClass('bgheight');
//		} else {
//			$('#temp_box2').text('else');
//			$bg.removeClass().addClass('bgwidth');
//		}
//
//		
//		//$bg.removeClass().addClass('bgheight');
//		
//		//$('#temp_box').html('WINDOW: ' + theWindow.width() + 'x' + theWindow.height() + '<br>BACKGROUND: ' + $bg.width() + 'x' + $bg.height() + ' (WAP: '+widthAspectRatio+' HAP: '+heightAspectRatio+') <br>current WAP: ' + currentWAP + '<br>current HAP: ' + currentHAP);
//	}
//	
//	$("#bg").load(function() {
//		$('#temp_box').html('<br>BACKGROUND: ' + $bg.width() + 'x' + $bg.height());
//		
//		theWindow.resize(function() {
//			resizeBg();
//		}).trigger("resize");
//	});
//	
//	
//});

$(function() { 
	$('.thumb').live('mouseover mouseout', function(event) {
		if(event.type == 'mouseover') {
			$(this).children('img').css('z-index','2').stop()
			.animate({
				left: '-39px',
				width: '138px', /* Set new width */
				height: '104px' /* Set new height */
			}, 200, function(){ $(this).siblings('span').css('display','block').hide().fadeIn(400); });

		} else {
			
			$(this).children('span').hide();
			$(this).children('img').css('z-index','0').stop()
			.animate({
				left: '0',
				width: '60px', /* Set width back to default */
				height: '45px'/* Set height back to default */
			}, 400);
		}
	});
	
	$('.content_toggle').click(function(event) {
		event.preventDefault();
		
		if ($(this).hasClass('hide')){
			$('#content_toggle').fadeOut(200);
			$(this).removeClass('hide').addClass('show');
		} else {
			$('#content_toggle').fadeIn(400);
			$(this).removeClass('show').addClass('hide');
		}
	});
});
