$(document).ready(function() {
	$('blockquote').addClass('highlight');
	
	/*Blog Posts*/
	
	$('a.showhide').click(function () {
		var el = $(this).attr('id');
		$('.theentry').hide();
		$('.summary').show();
		$('#sum-'+el+'.summary').hide();
		$('#con-'+el+'.theentry').show();
		}
	);
	$('.summary:eq(0)').hide();
	$('.theentry:eq(0)').show();
	
	/*Portfolio Menu*/
	
	$('.portfolio').hide(); //by default hides everything in the portfolio menu
	
	$('a.portMenu').click(function () {
		var theLink = $(this).attr('id'); //set theLink = id of the link clicked
		
		$('.portfolio').hide(); //hide all items
		$('#'+theLink+'Menu').show(); //show the menu that's being called for
		
		}
	);
	
	/* AJAXy goodness for my portfolio */
	
	$('a.portlink').click(function() {
			$.get('../portfolio/portSelect.php', {'term': $(this).attr('id')}, function(data) { //calls a php file to load the portfolio item based on the id of the link clicked
						$('#portfolioStuff').html(data); //displays it
																			});
			return false;
									 }
									 );
	
	
	/* premade contact form */
	
	$('#contactform').submit(function(){
 
		var action = $(this).attr('action');
 
		$('#submit')
			//.before('<img src="ajax-loader.gif" class="loader" />')
			.attr('disabled','disabled');
 
		$.post(action, { 
			name: $('#name').val(),
			email: $('#email').val(),
			phone: $('#phone').val(),
			concerning: $('#concerning').val(),
			message: $('#message').val()
		},
			function(data){
				$('#contactform #submit').attr('disabled','');
				$('.response').remove();
				$('#contactform').before('<span class="response">'+data+'</span>');
				$('.response').slideDown();
				//$('#contactform img.loader').fadeOut(500,function(){$(this).remove()});
				if(data=='Message sent!') $('#contactform').slideUp();
			}
		);
 
		return false;
 
	});
	
});

