$(document).ready(function() {
	$('#home .productfeaturelist li:nth-child(4n)').addClass('last');
	$('#store .shop-overall li:nth-child(3n)').addClass('last');
	$('#store .col-b .shop-catalogue:nth-child(3n)').addClass('sc-last');	
	$('.catbc').clone().appendTo('div#crumbs');
	$('.col-a div.news-item').wrapAll('<div class="news-list" />');
	$('.col-b div.news-item').wrapAll('<div class="sb-news-list" />');
	$('.view-invoice a').text('view invoice');
	$('.order-list:even, .member-details li:even').addClass('even');
	
	// cases
	$('.case-item').each(function() {
		if ($('.subject a', this).html() == 'Staff Education Programs Request Form' || 'Staff Education Programs Subscription (Transferring Customers)') {
			$('.subject a', this).text('View your selected Staff Education Programs');
		}
	});

	//cart summary
	if ($('#catCartSummary .cartSummaryItem').html() != 'Shopping cart is empty.') {
		var summary = $('#catCartSummary .cartSummaryItem').text().split(" ");
		var total = summary[0];
							
		$('.totalCart span').html(total);
		} else {
		$('.totalCart span').html("0");
	}	
	
	if ($('li.catalogueItemNotFound').size() === 1){
		$('.catalogueList').hide();
	}
	$('.store-details .storehd span').appendTo('div.productcat');
	$("span.carttotal").text($("input#Amount").val());
	
	// field focus
	$('.ffocus').each(function() {
		$(this).val($(this).attr('title'));
		$(this).css({ color: '#999999' });
	});
	$('.ffocus').focus(function() {
		if ($(this).val() == $(this).attr('title')) {
			$(this).val('');
			$(this).css({ color: '#666666' });
		}
		}).blur(function() {
		if ($(this).val() == '') {
			$(this).val($(this).attr('title'));
			$(this).css({ color: '#999999' });
		}
	});
	
	$(".form-horizontal input, .form-horizontal textarea, .form-horizontal select").focus(function () {
		$(this).parents('li').addClass('focuscolor');
			}).blur(function() {
		$(this).parents('li').removeClass('focuscolor');
	});

	//faq
	$('.faq-item .faq-question').click(function() {
		$(this).next('.faq-answer').toggle();
		return false;
	});
});
