/* SCRAMBLES THE DEATH DEALER */

$(document).ready(function() {
	Cufon.replace('h1', {fontFamily:'Apex Serif Light'})
	.replace('h1 a', {fontFamily:'Apex Serif Light',hover:'true'})
	.replace('p', {fontFamily:'Apex Serif Book'})
	.replace('.hello_there', {fontFamily:'Apex Serif Book'})
	.replace('li a', {fontFamily:'Apex Serif Book', hover:'true'});
	loadInfo('assets/includes/start.php', '#container_content');
	positionContainer();
	getSize();
	$(window).resize(function() {
		getSize();
	});
	
//	 $('.show_image img').css({'opacity':0}).animate({'opacity':1}, 1000);
	
	$('#home').click(function() {
		loadInfo('assets/includes/start.php', '#container_content');
		getSize();
	});
	$('#work').click(function() {
		loadInfo('assets/includes/work.php', '#container_content');
		getSize();
	});
	$('#flickr').click(function() {
		loadInfo('http://www.flickr.com/photos/ericlindstrom/', '.show_image');
		
	})
	
});

function loadInfo($string, $container) {
	$($container).load($string, function() {
		Cufon.replace('h1', {fontFamily:'Apex Serif Light'})
		.replace('h1 a', {fontFamily:'Apex Serif Light',hover:'true'})
		.replace('li a', {fontFamily:'Apex Serif Book', hover:'true'})
		.replace('.hello_there', {fontFamily:'Apex Serif Book'});
		positionContainer();
		$($container).css({'opacity':0}).animate({'opacity':1}, 500);
	});
}




function positionContainer() {
	$('#container').css({'margin-top': $(window).height() - ($("#container").height() + 40 ) });
}

function getSize() {
//	$('.show_image img').attr({'width': $(window).width()}).attr({'height': $(window).height()});
/*
	width: 1000px;
	height: 650px;
	
	1000 * .65;
	650 * 1.5385
*/	
	if ($(window).width() > 1000) {
		$('.show_image img').attr({'width': $(window).width()}).attr({'height': $(window).width()*.65});
	} else if ($(window).height() > 650) {
		$('.show_image img').attr({'height': $(window).height()}).attr({'width': $(window).height()*1.5385});
	} else if ($(window).width() > 1000 && $(window).height() > 650) {
		$('.show_image img').attr({'width': $(window).width()}).attr({'height': $(window).width()*.65});
	} else if ($(window).width() < 1000 && $(window).height() > 650) {
		$('.show_image img').attr({'height': $(window).height()}).attr({'width': $(window).height()*1.5385});
	}
	positionContainer();
}