jQuery(document).ready(function(){
	
	// global
	
	jQuery('.lightwindow').lightbox();
	jQuery('a[href*="jpg"]').lightbox();
	jQuery('a[href*="png"]').lightbox();
	jQuery('a[href*="jpeg"]').lightbox();
	
	// home
	
	jQuery("#recent-posts .recent-post:nth-child(5n)").addClass("fourth");
	jQuery(".footer-upper li:last").addClass("last");	
	
	jQuery('#home-tabs').tabs();
	
	//faqs
	
	jQuery('#faq-tabs').tabs();
		 
	jQuery( "li.eligibility-faq" ).each(function( intIndex ){
		jQuery('.eligibility-heading-' + intIndex).toggle(function() {
			jQuery( '.eligibility-body-' + intIndex ).addClass('showit');
		}, function() {
		 	jQuery( '.eligibility-body-' + intIndex ).removeClass('showit');
		});
	});
	
	jQuery( "li.pre-loan-faq" ).each(function( intIndex ){
		jQuery('.pre-loan-heading-' + intIndex).toggle(function() {
			jQuery( '.pre-loan-body-' + intIndex ).addClass('showit');
		}, function() {
		 	jQuery( '.pre-loan-body-' + intIndex ).removeClass('showit');
		});
	});
	
	jQuery( "li.post-loan-faq" ).each(function( intIndex ){
		jQuery('.post-loan-heading-' + intIndex).toggle(function() {
			jQuery( '.post-loan-body-' + intIndex ).addClass('showit');
		}, function() {
		 	jQuery( '.post-loan-body-' + intIndex ).removeClass('showit');
		});
	});
  
  
  	// specialists
  	
  	jQuery( "div.related" ).each(function( intIndex ){
		jQuery('.related-more-' + intIndex).toggle(function() {
			jQuery( '.related-' + intIndex ).addClass('showit');
		}, function() {
		 	jQuery( '.related-' + intIndex ).removeClass('showit');
		});
	});
	
	// testimonials
  	
  	$('#testimonials a.more').click(function() {

		var filterVal = $(this).attr('class').replace('current','').replace('more','').trim();
		
		$('#testimonials a.more').addClass('hidden');
		$('.testimonials-title a.less').removeClass('hidden');
		
		if(filterVal == 'all') {
			$('#testimonials .testimonial.hidden').fadeIn('slow').removeClass('hidden');
			$('#testimonials a.more').removeClass('hidden');
		} else {
			$('#testimonials .testimonial').each(function() {
				if(!$(this).hasClass(filterVal)) {
					$(this).fadeOut('normal').addClass('hidden');
					$('.testimonials-title h2').html('What customers of ' + filterVal.replace('-',' ') + ' have to say about us');
				} else {
					$(this).fadeIn('slow').removeClass('hidden');
				}
			});
		}

		return false;
	});
	
	$('.testimonials-title a.less').click(function() {
		$(this).addClass('hidden');
		$('#testimonials .testimonial.hidden').fadeIn('slow').removeClass('hidden');
		$('#testimonials a.more').removeClass('hidden');
		$('.testimonials-title h2').html('What our customers have to say about us');
	});
	
	
	// resources
	
	$('#sidebar-resources.resources li').click(function() {
		$('#sidebar-resources.resources li').removeClass('current');
		$(this).addClass('current');
	});
	
	 
});

