/*!
 * Dashing Magento Theme
 * Copyright (c) 2011 Worry Free Labs, LLC. (http://worryfreelabs.com/)
 */

jQuery.noConflict();

function initMenu(){
jQuery('#nav > li.parent').each(function(){
		var _width = jQuery(this).find('ul.level0 > li').length * 170;
		jQuery(this).find('ul.level0').width(_width);
			var pos = jQuery(this).position();
			myleft = pos.left + _width + 20;
			docwidth = jQuery(document).width();
			if(myleft > docwidth){
				pxLeft = docwidth-myleft-30;
				jQuery(this).find('ul.level0').css('left',pxLeft+'px');
			}
		
	});
}
jQuery(function($) {

	setTimeout("initMenu()", 1000);
	$('#nav ul.level0, .mini-cart').before('<span class="space"> </span>');
	
	$('#navigation .searchbtn').hover(function() {
		$('#search').focus();
		$(this).find('.form-search').show();
	}).focusout(function() {
		$(this).find('.form-search').hide();
	});
	
	$('.button').hover(
		function() {
			$(this).animate({opacity: 0.8}, 'fast');
		},
		function() {
			$(this).animate({opacity: 1}, 'fast');
		}
	);
	
	
	$('a.fancybox').fancybox({
		titlePosition: 'inside'
	});
	
	$('a.quickview').fancybox({
		autoScale		: false,
		autoDimensions	: false,
		width			: 650,
		height			: 650,
		onComplete		: function() {
			var $fancyboxInner = $('#fancybox-inner');
			
			/*$('.upsell-list > div', $fancyboxInner).easySlider({
				prevId:	'upsellLeft',
				nextId:	'upsellRight'
			});
			
			$('.quickview-thumbs a', $fancyboxInner).bind('click', function(event) {
				event.preventDefault();
				$('#quick_image', $fancyboxInner).attr('src', $(this).attr('href'));
			});*/
		}
	});
});

