/**
 * Javascript - jQuery enabled
 * 
 * @package WPFramework
 * @subpackage Media
 * @author: Robert WŸnsch
 */

jQuery(document).ready(function($){
	
	if(jQuery('body.category-work').length > 0) { dbarth.cat_work.prepare(); }
	if(jQuery('body.single.is-category-work').length > 0) { dbarth.single_work.prepare(); }
	
});

dbarth = {};

dbarth.cat_work = {};
dbarth.cat_work.prepare = function()
{
	// Hide all thumbs:
	dbarth.cat_work.hide_all_thumbs();
	// Show thumb of first post:
	dbarth.cat_work.show_thumb_obj(jQuery('#sub-menu').find('li').eq(0).find('a'));
	// Enable thumb hover for all posts:
	jQuery('#sub-menu').find('li').find('a').hover(dbarth.cat_work.show_thumb,dbarth.cat_work.hide_thumb);
};
dbarth.cat_work.show_thumb = function() { dbarth.cat_work.show_thumb_obj(this); };
dbarth.cat_work.show_thumb_obj = function(obj)
{
	dbarth.cat_work.hide_all_thumbs();
	var id = jQuery(obj).closest('li').attr('id').split('-').pop();
	if (!isNaN(id)) jQuery('#post-'+id).show();
};
dbarth.cat_work.hide_thumb = function() { /*dbarth.cat_work.hide_all_thumbs();*/ }
dbarth.cat_work.hide_all_thumbs = function() { jQuery('div.posts').find('div.post').hide(); };

dbarth.single_work = {};
dbarth.single_work.prepare = function()
{
	// Hide info:
	dbarth.single_work.hide_info();
	// Enable info toggle:
	jQuery('#primary').find('a.browser-info').toggle(dbarth.single_work.show_info,dbarth.single_work.hide_info);
};
dbarth.single_work.show_info = function() { jQuery('#primary').find('.entry-content').eq(0).show(); jQuery('#primary').find('a.browser-info').text('Close information') };
dbarth.single_work.hide_info = function() { jQuery('#primary').find('.entry-content').eq(0).hide(); jQuery('#primary').find('a.browser-info').text('Further information')};