jQuery(document).ready(function(j$) {

	// Overlays
	j$("a[rel^='#'], img[rel^='#']").overlay();
	
	// Website Design Portfolio Image Scroller
/*
	j$(".image_scroll").scrollable({ circular: true });
	
	j$(".image_scroll .next_btn").click(function() {
			j$(".mlc_image_overlay .image_scroll").data("scrollable").next();
		}
	);
	j$(".image_scroll .prev_btn").click(function() {
			j$(".mlc_image_overlay .image_scroll").data("scrollable").prev();
		}
	);
*/
	
	// Invoice Functions
	
	// Color Invoice Table Fields
	j$('#invoice_page #wp_invoice_itemized_table td:contains("PayPal Processing Fee")').parent().css({'background-color': '#f7ffb3'});
	j$('#invoice_page #wp_invoice_itemized_table td:contains("PAID")').parent().css({'background-color': '#c3ffca', 'border-width': '1px 0', 'border-color': '#5bc26b', 'border-style': 'solid'});
	
	// Change Invoice List Text
	j$('.wp_invoice_list h2:contains("Pay These")').html('Pending Invoices');
	j$('.wp_invoice_list h2:contains("Already Paid")').html('Paid Invoices');
	
	// Color odd Invoice list rows
	j$('.wp_invoice_list ul li:nth-child(even), .file_list tr:nth-child(odd)').css({'background-color': '#eee'});
	
	// Add text to links
	j$('.wpi_due_invoices .wpi_invoice_link').append('<span class="click_text">&larr;click to view</span>');
	j$('.wpi_paid_invoices .wpi_invoice_link a').click(
		function(e){
			e.preventDefault();
		}
	);
	j$('.wpi_paid_invoices .wpi_invoice_link a').hover(
		function(){
			j$(this).css({'cursor': 'default'});
		}
	);
	
	// Hide all subfolders at startup
	j$(".php-file-tree").find("UL").hide();
	
	// Expand/collapse on click
	j$(".pft-directory A").click( function() {
		j$(this).parent().find("UL:first").slideToggle("medium");
		if( j$(this).parent().attr('className') == "pft-directory" ) return false;
	});
	
	// Extend Sidebar
	j$('#sidebar').css({ 'height': j$('#main_content_wrapper').outerHeight(true) });
	
	// Change Body Background Based on Category
	if( j$('.post_info-category:contains("Mac OS X Quick Tips")').size() != 0 ){
		j$('body').attr('style', 'background:#2B7195 url("/wp-content/themes/mlc-2011-v2/img/page_assets/mac_bg.jpg") top center no-repeat !important');
		j$('#tagline').html('Mac OS X Quick Tips').css('font-size', '40px');
	}
	
	// Twitter Feed Animations
	j$('#twitter_feed').hover(
		function(){
			j$(this).animate({ left: '-15px' });
		}, function(){
			j$(this).stop().animate({ left:'-290px' });
		}
	);
});
