// JavaScript Document

$(document).ready(function() {
	/* ACCORDION */
	$("#accordion").zAccordion({ 
		easing: 'easeOutQuint',
		timeout: 4000,
		slideWidth: 694,
		width: 820,
		height: 302
	});
	/* MAIN MENU */
	$('#main-menu > ul > li > a').mouseenter(function() {
		$(this).next('ul').children('li').children('a').css('min-width',$(this).width());
	});
	var submenuHeight = $('#main-menu > ul > li > ul').height();
	$('#main-menu > ul > li').mouseenter(function() {
		$(this).children('ul').css('display','block');
		$(this).children('ul').css('opacity','0');
		$(this).children('a').css({
			'background': 'url(../images/assets/main-menu-item-background.png) 50% -9px',
			'color': '#fff'
		});
		$(this).children('ul').stop().animate({
			'height': submenuHeight,
			'opacity': '1'
		}, { queue: false, duration: 300, easing: 'easeOutQuint'});
	});
	$('#main-menu > ul > li').mouseleave(function() {
		$(this).children('a').css({
			'background': 'none',
			'color': '#000'
		});
		$(this).children('ul').stop().animate({
			'height': 'toggle',
			'opacity': '0'
		}, { queue: false, duration: 300, easing: 'easeOutQuint'});
	});
	/* ANIMATED BUTTON */
	$('.animated-button').wrapInner('<span class="button-title"></span>');
	$('.animated-button').append('<span class="button-icon"></span>');
	$('.animated-button').mouseenter(function() {
		$(this).children('.button-icon').css('right', 'auto');
		$(this).children('.button-title').stop().animate({left: '8px'},{queue: false, duration: 300, easing: 'easeOutQuint'});
		var posx = $(this).width() + 20 + 'px';
		$(this).children('.button-icon').stop().animate({right: posx},{queue: false, duration: 300, easing: 'easeOutQuint'});
	});
	$('.animated-button').mouseleave(function() {
		$(this).children('.button-icon').css('left', 'auto');
		$(this).children('.button-title').stop().animate({left: '0'},{queue: false, duration: 300, easing: 'easeOutQuint'});
		$(this).children('.button-icon').stop().animate({right: '0'},{queue: false, duration: 300, easing: 'easeOutQuint'});
	});
	/* BUTTON */
	$('.button').mouseenter(function() {
		$(this).stop().animate({
			backgroundColor: "#f33" }, {queue: false, duration:300});
	});
	$('.button').mouseleave(function() {
		$(this).stop().animate({
			backgroundColor: "#f00" }, {queue: false, duration:300});
	});
	$('.recall').mouseenter(function() {
		$(this).stop().animate({
			backgroundColor: "#f33" }, {queue: false, duration:300});
	});
	$('.recall').mouseleave(function() {
		$(this).stop().animate({
			backgroundColor: "#f00" }, {queue: false, duration:300});
	});
	/* PRODUCT BOX */
	$('#new-products .product-box li:nth-child(4n)').css('margin-right','0');
	$('#new-products .product-box li:first-child').css('margin-left','-9px');
	$('#new-products .product-box li:nth-child(5n)').css('margin-left','-9px');
});

$(window).load(function() {
});

