$(window).load(function() {
        $('#slider').nivoSlider({ pauseTime:5000, pauseOnHover:false });
    });

$(document).ready(function () {
	
	$('.image_thumb_item').each(function() {
		var this_link = $(this).find('a');
		var link_item_id = $(this_link).attr('id');
		var link_item_id_set = '.image_thumb_links a#'+link_item_id;
		//alert(link_item_id);
		$(this_link).click(function() {
			var myID = $(this).attr('id');
			//alert(myID);
			$('.product_image_link_wrapper .image_thumb_links').each(function(){
				$(this).addClass('hidden');
			});
			//alert($(link_item_id_set));
			$(link_item_id_set).removeClass('hidden');
			$('.product_image_link_wrapper #'+myID).removeClass('hidden');
		});
	});
	
	$('.image_thumb_links').each(function() {
		//alert(this);	
		var rel_item = $(this).find('a.colorbox').attr('rel');
		//$("a[rel='example1']").colorbox();
		$("a[rel='"+rel_item+"']").colorbox();
	});
	
	
	$('#ticker1').twitterfeed('jklivinstore').ajaxStop(function() {
		$('#ticker1 div.twitterBody').vTicker({ showItems: 1});
	});
	
	$('input#jrjjuy-jrjjuy').val('email address');
	$('input#jrjjuy-jrjjuy').focus(function() {
		$(this).val('');
	});
	var x = 0;
	
	$(function(){
		$('span.swatch').each(function() {
			
			var tooltip_content = $(this).find('img').attr('title');
			$(this).bt(tooltip_content,
			{
				activeClass: 'bt-active',
				cssClass: 'bt',
				hoverIntentOpts:  {                          // options for hoverIntent (if installed)
									interval: 100,           // http://cherne.net/brian/resources/jquery.hoverIntent.html
									timeout: 100
								},
				shrinkToFit: true,
				fill: '#999',
				strokeWidth: 0,
				strokeStyle: 'none',
				padding: 5,
				positions: 'top, right',
				cornerRadius: 0
			});
		});
		
		var product_color_options = $('.color_options');
		
		$('.color_option').each(function(i) {
			//alert('this');
			var tooltip_content = $(this).find('img').attr('title');
			$(this).bt(tooltip_content,
			{
				activeClass: 'bt-active',
				cssClass: 'bt',
				hoverIntentOpts:  {                          // options for hoverIntent (if installed)
									interval: 100,           // http://cherne.net/brian/resources/jquery.hoverIntent.html
									timeout: 100
								},
				shrinkToFit: true,
				fill: '#999',
				strokeWidth: 1,
				strokeStyle: '#fff',
				padding: 5,
				positions: 'bottom',
				cornerRadius: 0
			});
		});
	});
	
	/* equalize the hieght */
	
	$('.item-row').each(function() {
		
		$(this).children('div.item').each(function() {
			//$(this).height(row_height);
		});
	});
	
	
});
