/* Author: 

*/

WebFontConfig = {
google: { families: [ 'Playfair+Display:latin' ] }
};
(function() {
var wf = document.createElement('script');
wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
  '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
wf.type = 'text/javascript';
wf.async = 'true';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(wf, s);
})(); 

jQuery(window).load(function(){
	// Run load functions
	//loadGoogleMapsAPI();

	// Slide down comments
	$('a[href="\#showComments"]').click(function(){
		// Obtain classes associated with link
		var postClasses = $(this).parents('div[id*="post-"]').attr('id');
		// Find unique class number
		var postNumber = postClasses.split("-")[1];
		// Slide section up/down
		$('div[id*="post-'+postNumber+'"] > section[class*="comments"]').stop(true,true).slideToggle();
		// Update UI text
		if ($(this).parents('.post_details_comment_block').find('.post_comments > a').text() == 'Hide comments') {
			$(this).parents('.post_details_comment_block').find('.post_comments > a').text('Show comments');
		} else if ($(this).parents('.post_details_comment_block').find('.post_comments > a').text() == 'Show comments') {
			$(this).parents('.post_details_comment_block').find('.post_comments > a').text('Hide comments');
			$(this).parents('.post_block').find('a[href="\#post_comment"]').show();
		}
	});
	
	// Slide down comment form
	$('a[href="\#post_comment"]').click(function(){
		// Obtain classes associated with link
		var commentClasses = $(this).parents('div[id*="post-"]').attr('id');
		// Find unique class number
		var postNumber = commentClasses.split("-")[1];
		// Slide section up/down
		$('div[id*="post-'+postNumber+'"] > section[class*="post_comment_form"]').stop(true,true).slideToggle();
		// Update UI text
		if ($(this).text() == 'Hide comment form') {
			// Show comments text
			$(this).html('Post my comment<img class="post_comment_icon" src="http://lockwitz.com/blank.png">');
		} else if ($(this).text() == 'Post my comment') {
			$(this).html('Hide comment form<img class="post_comment_icon" src="http://lockwitz.com/blank.png">');		
		}
	});

	// Hover highlight for post
	$('.post_block').hover(function() {
		// Add highlight class
		$(this).addClass('post_block_highlight');
	}, function() {
		$(this).removeClass('post_block_highlight');
	});
	
	// Hover highlight for comments
	$('section[class*="comments"] > article').hover(function() {
		// Add highlight class
		$(this).addClass('comment_highlight');
	}, function() {
		$(this).removeClass('comment_highlight');
	});
	
	// Show large picture in sidebar on thumbnail click
	$('canvas.itxttitle').click(function() {
		$('canvas.itxttitle').css('z-index','0');
		$(this).css('z-index','9999');
	});
	
	// Hover highlight for lockwitz
	$('#site_name').hover (function() {
		//$(this).addClass('highlight');
		// Change text color to blue
		$(this).find('a').stop(true,true).animate({
			color: '#4096EE'
		}, 1500, function() {
			//Animation Complete
			$(this).addClass('highlight');
		 });
	}, function() {
		//$(this).removeClass('highlight');
		// Change text color back to grey
		$(this).find('a').stop(true,true).animate({
			color: '#787878'
		}, 1500, function() {
			//Animation Complete
			$(this).removeClass('highlight');
		});
	});
	

});
$(document).ready(function(){
	
});




















