/* STANDARD TEMPLATE */
/* Javascript Triggers and Custom Functions
----------------------------------------------------------------------------- */

	
	$(document).ready(function() {
		
		markup();
	
	});

	$(window).load(function() {

		if (section != "messageboard" && section != "checkout" ) {
		
			homePage();

			// PLUGIN: CLIQUE ACTIONS (Replaces submit buttons with text links)
			try { $('input[type=submit]').cliqueActions(); } catch (error) { alert('Error: Missing Clique Actions Plugin'); }
			
			
// Store-Only		
			
			
			if (section == "store") {

				// PLUGIN: CLIQUE ITEM WIDGET
				try {
				$('div.widget-item.display:not(.photos, .gift)').cliqueItemWidget({
				
					checkStock: false,
					pressure: false,
					browser: 'thumbnails', // thumbnails / slideshow
					removeEmptyThumbs: true, // Removes rows of empty thumbnails
					viewer: true, // Shows enlarged images
					preview: false, // Preview enlarged images when hovering thumbnails
					zoom: 'none' // loupe / drag / none
					
				});
				$('.widget-item.browse.tooltip').cliqueItemWidget();
				$('.widget-item.filter').cliqueItemWidget();
				} catch (error) { alert('Error: Missing Clique Item Plugin'); }
			
				$('#page-index div.photos').css('visibility', 'visible');
	
			}
			
			$('div.purchase li.emphasis:not(.notify)').show();

		}

	});

	
/* FUNCTION: CUSTOM HOME PAGE FUNCTIONS
----------------------------------------------------------------------------- */


	function homePage() {
	
		$('.styles ul li').click(function() {
		
			if ($(this).parent().hasClass('open')) {

				// Close
				$(this).parent().removeClass('open');
				
				// Update Price
				if ($(this).children('small').length > 0) {
				
					$('.topic strong').text('$49.99');
			
				} else {
				
					$('.topic strong').text('$14.99');

				}
			
			} else {
			
				// Open
				$(this).parent().addClass('open');
				
				// Position
				if (!$(this).children('strong').text().match(/non/i)) {
				
					$(this).parent().addClass('autographed');
				
				} else {
				
					$(this).parent().removeClass('autographed');
				
				}
				
				// Hover Effects
				$('.styles ul.open li').hover(function() {
		
					$(this).addClass('hover');
			
				}, function() {
		
					$(this).removeClass('hover');
			
				});
		
			}
		
			return false;

		});
	
	}
	
	
/* FUNCTION: MARKUP CHANGES
----------------------------------------------------------------------------- */


	function markup() {
	
		$('div.purchase a.submit').text('Buy Now');
	
	}
	
	
/* FUNCTION: OBSCURE
----------------------------------------------------------------------------- */


	function obscure(account, domain, extension) {
	
		return '<a href="mailto:' + account + '@' + domain + '.' + extension + '">' + account + '@' + domain + '.' + extension + '</a>';
	
	}



