jQuery(document).ready(function(){
	
	/**
	 * FANCYBOX
	 */
	$(".fancybox").fancybox({
		titlePosition: 'inside',
		transitionIn: 'elastic', 
		transitionOut: 'elastic'
	});
	
	
	
	/**
	 * VIDEO
	 */
	$('.watch').hide();
	$('.player').click(function(){
		var $this = $(this);
		
		$this.addClass('playing').siblings().removeClass('playing');
		$('#video').attr('src', $this.find('.watch').attr('href'));
		return false;
	});
	
	
	/**
	 * Category menu
	 */
	$('.cat-child').each(function(){
		var $this = $(this),
			$parent = $this.parent();
			
		$parent.addClass('cat-has-children');
	});
	
	$('.cat-has-children > a').click(function(){
	    $(this).parent().toggleClass('cat-open').end().siblings('ul').slideToggle(300);
		return false;
	});
	
	
	
	$('.current-cat-ancestor').addClass('cat-open');
	
	
	
	/**
	 * Products equal height
	 */
	var prodHeight = 0;
	$('.product').each(function(){
		var $this = $(this),
		tHeight = $this.height();
		if(tHeight > prodHeight){
			prodHeight = tHeight;
		}
	});
	$('.product').height(prodHeight);
	
	
	
	/**
	 * qTip
	 */
	$('.product-pdf').qtip({ 
		position: {
			corner: {
				target: 'rightTop', 
				tooltip: 'leftMiddle'
			}
		},
		style: {
			name: 'dark', 
			tip: {
				corner: 'leftMiddle',
				color: '#bfbfbf',
				size: {x:5,y:5}
			},
			padding: 5,
			background: '#f2f2f2',
			color: '#ee2e24',
			textAlign: 'center',
			border: {
				width: 1,
				radius: 0,
				color: '#bfbfbf'
			}
		},
		show: { delay: 0 }
	});

	
	
});

