$(document).ready(function() {

	// corners
//	$('#bottom, #pagetop, #page, .page-444 blockquote, .page-534 #gforms_confirmation_message, .comminfo, .portfolioentries img, .skillinfo, .blogitem img').corners('10px');
//	$('.sidebarinside').corners('10px bottom-left bottom-right');
//	$('.sidebartop').corners('10px top-left top-right');
//	$('.catarch .trigger a').corners('3px');
//	$('#content img').corners('5px');

	// h1 hover
	$('h1 a').hover( function () { $(this).stop().animate({opacity:"0"}, 'fast');}, function () { $(this).stop().animate({opacity:"1"}, 'fast');});
	
	//nav hover
	$('#nav li a').hover( function () { $(this).animate({backgroundPosition: '(0px 0px)'}, 'fast');}, function () { $(this).animate({backgroundPosition: '(0px -42px)'}, 'fast');});
	
	// text replacement
	Cufon.replace('h2, #content h3, .deettitle', { 
		fontFamily: 'Rockwell',
		color: '-linear-gradient(#fff, #c9cdca)',
		textShadow: '2px 2px #333'
	});
	Cufon.replace('.promocontent, .subdeet h4, .blogtitle h4, span.author', {
		fontFamily: 'Myriad Pro',
		hover: true,
		textShadow: '1px 1px #333'
	});
	
	// promo stuff	
	$('.promo:first').show();
	$('.nav-about')
		.click( function() {
			$('.promo:visible').fadeOut('fast');
			$('.promoabout').fadeIn('fast');
		});

	$('.nav-portfolio')
		.click( function() {
			$('.promo:visible').fadeOut('fast');
			$('.promoportfolio').fadeIn('fast');
		});

	$('.nav-skills')
		.click( function() {
			$('.promo:visible').fadeOut('fast');
			$('.promoskills').fadeIn('fast');
		});

	$('.nav-blog')
		.click( function() {
			$('.promo:visible').fadeOut('fast');
			$('.promoblog').fadeIn('fast');
		});

	$('.nav-contact')
		.click( function() {
			$('.promo:visible').fadeOut('fast');
			$('.promocontact').fadeIn('fast');
		});

	// skill set hover
	$('.skilllink').hover( function () { $(this).next().fadeIn('fast');}, function () { $(this).next().fadeOut('fast');});

	// portfolio hover
	$('.portfolioentries a').hover( function () { $(this).next().fadeIn('fast');}, function () { $(this).next().fadeOut('fast');});

	// blog 
	$('.blogitem:last').addClass('blogitemmargin');
	$(".blogitem, .subpage, .archentry").click(function(){ window.location = $(this).attr("title");});

	// bottom
	$('#gform_6 input.button').val('');

	// crumbs
	$('#breadcrumbs li:last').addClass('crumb');

	// blog page
	$('.archentry:odd').addClass('evenrow');
	
	// sidebar 
	$('.monthlies, .triggeroff').hide();
	$('.showme')
		.click( function() {
			$('.monthlies').slideDown();
			$('.triggeron').hide();
			$('.triggeroff').show();
		});
	$('.triggeroff')
		.click( function() {
			$('.monthlies').slideUp();
			$('.triggeroff').hide();
			$('.triggeron').show();
		});

	// footer
	$('#footer .alignright').css({height: "0px"});
	$('#footer').hover( function () { $('#footer .alignright').stop().animate({height:"100px"});}, function () { $('#footer .alignright').stop().animate({height:"0px"});});
	$('#footer .alignleft a').css({opacity:"0.3"});
	$('#footer').hover( function () { $('#footer .alignleft a').stop().animate({opacity:"1"});}, function () { $('#footer .alignleft a').stop().animate({opacity:"0.3"});});

	// quick email validation
	$('#gform_6').each(function () { $(this).find('input').each(function (i) {i = i+1; $(this).addClass('item' + i); }); });

	// portfolio
	$('.portimg').css({opacity:"1"});
	$('.portentry').hover( 
		function () { 
			$('.portimg', this).stop().animate({marginTop: "80px", opacity: "0.5"});
		}, 
		function () { 
			$('.portimg', this).stop().animate({marginTop:"0", opacity: "1"});
		}
	);
	$('.portentry:odd').addClass('oddportblock');
	
	// contact
	$('#forms2').hide();
	$('.quote a').click( function() {
		$('#forms1').hide();
		$('#forms2').show();
		$('.general').removeClass('active');
		$('.quote').addClass('active');
	});
	$('.general a').click( function() {
		$('#forms2').hide();
		$('#forms1').show();
		$('.general').addClass('active');
		$('.quote').removeClass('active');
	});
	$('#gform_2 .button').mousedown(function() { $(this).css({backgroundPosition: '0 -34px'}) });
	$('#gform_2 .button').mouseup(function() { $(this).css({backgroundPosition: '0 0'}); });

});

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-2422341-6']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
})();
