/* THE KILLERS */
/* Store Functions
----------------------------------------------------------------------------- */


	$(document).ready(function() {

	});


	$(window).load(function() {


/* ITEM BROWSING
----------------------------------------------------------------------------- */


	$('strong.all, a.all').text('View All');
	$('#page-store ul.items:last').addClass('last');


// Hover Classes (for IE 6)


	$('ul.items li, ul.promos li').hover(function() {
	
		$(this).addClass('hover');
	
	}, function() {
	
		$(this).removeClass('hover');
	
	});
	
	$('#sidebar ul.special li, #sidebar div.widget-tag ul li').hover(
	
		function() {
			$(this).addClass('hover');
		},
		function() {
			$(this).removeClass('hover');
		}
	
	);


// Search Field

	
	$('div.search label input').val("Search for ...").attr("title", "Search for ...");

	function clearSearchField() {

		var label = $(this).attr("title");

		if (label == $(this).val()) {

			$(this).val("");

		} else if ($(this).val() == '') {
		
			$(this).val(label);
		
		}
	
	}

	$('div.search ul.actions input').click(function() {

		$("div.search label input").each(clearSearchField);

	});

	$("div.search label input").blur(clearSearchField);
	$("div.search label input").click(clearSearchField);


/* ITEM PAGE
--------------------------------------------------------------------------- */


	if (page == "item") {


		$('a.help.sizes').click(function() {
	
			var chart = $(this).attr('href');
			window.open(chart,"sizes","width=410,height=510,status=0,location=0,toolbar=0,directories=0,scrollbars=1,resizable=1");
			return false;
	
		});

		// Dim Sidebar Browser

		$('#sidebar').addClass('dimmer');
		$('#sidebar').hover(function() {
	
			$(this).removeClass('dimmer');	
	
		}, function() {
	
			$(this).addClass('dimmer');	
	
		});


		// Special Labels (sale, etc.)
	
		$('div.topic ul.tags li').each(function() {
	
			var tags = $(this).attr('class');
	
			if (tags.match('label')) {
	
				var tag = $(this).text();
				var tag = tag.replace('Label - ','');
				$(this).text(tag);
				$(this).removeClass().addClass('label');
	
			}
	
		});
		

		// Load Patterns

		$('div.widget-alert.added').cliqueAlertWidget();
		$('div.widget-item.display:not(.photos)').cliqueItemWidget({
		
			checkStock: false,
			pressure: false,

			browser: 'thumbnails', // thumbnails / slideshow
			removeEmptyThumbs: true,
			viewer: true,
			preview: true, // Shows enlarged images when hovering thumbnails
			zoom: 'none' // loupe / none
		
		});

	}


/* END
--------------------------------------------------------------------------- */


	$('div.receipt').show();
	$('#main').css('visibility','visible');
	$('div.bar a').attr('target','_top');


});