$(function() {
	newWindow();
	//toggleHideCategories();
	//shortenContent();
});

function newWindow() {
	if($('.new-window').length) {
		$('.new-window').click(function(){
			window.open(this.href);
			return false;
		});
	}
}

function toggleHideCategories() {
	var category = $('.category-item');
	var subCatList = $('ul.sub-category');
	
	if(subCatList) {
		subCatList.hide();
		
		var showHideText = '<p class="category-trigger">Show Products</p>';
		var showText = 'Show Products';
		var hideText = 'Hide Products';
		category.append(showHideText);
		var subCatTrigger = $('p.category-trigger');
		
		
		subCatTrigger.click(function() {
			$(this).closest('.category-item').find('ul.sub-category').slideToggle();
			if($(this).text() == 'Show Products') {
				$(this).text(hideText);
			} else if($(this).text() == hideText) {
				$(this).text(showText);
			}
		});
	}
}

function shortenContent() {
	var initCont, initText, markup;
	
	markup = '</div><div class="extendedContent">';
	initCont = $('.shorten-content');

}
