jQuery.noConflict();
jQuery(document).ready(function($){
	
	// Wordpress Dropdown Menu
	$("#menu-main-navigation > li").hover(
		function(){ $("ul:first", this).css({display: 'block'}); },
		function(){ $("ul:first", this).css({display: 'none'}); }
	);
	
	$("#menu-main-navigation > li ul li").hover(
		function(){ $("ul:first", this).css({display: 'block'}); }, 
		function(){ $("ul:first", this).css({display: 'none'}); } 
	);
	
	$("#menu-main-navigation > li ul li ul li").hover(
		function(){ $("ul:first", this).css({display: 'block'}); }, 
		function(){ $("ul:first", this).css({display: 'none'}); } 
	);
	
	$("#menu-main-navigation > li ul li ul li ul li").hover(
		function(){ $("ul:first", this).css({display: 'block'}); }, 
		function(){ $("ul:first", this).css({display: 'none'}); } 
	);
	
	$("#menu-main-navigation > li ul").css({display: 'none'});
	
	// Product Slider
    jQuery('#featured-products').jcarousel();

	// FancyBox jQuery
	jQuery("a.group").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': true });
	
	// Banner Slider
	if($('#slider').length > 0){ //If element exists
		$('#slider').cycle({
			fx : 'fade',
			speed :  1500, 
    		timeout : 6000,
			pause : 1,
			random : 0,
			cleartype :  1, // enable cleartype corrections
			cleartypeNoBg: true,
			pager : '#slider_pager',
			pagerAnchorBuilder: function(idx, slide) {
				if (idx == 0) {
						return '<li class="pagination"><a href="#"></a></li>';
				}
				else {
                        return '<li class="pagination"><a href="#"></a></li>';
                }

			}

		});
	}
	
	$("#p2p-promovideo").click(function() {
		$.fancybox({
			'padding'			: 	0,
			'margin'			: 	0,
			'autoScale'			: 	false,
			'hideOnOverlayClick':	true,
			'transitionIn'		:	'fade',
			'transitionOut'		:	'fade',
			'speedIn'			:	100,
			'speedOut'			:	100,
			'titleShow'			:	false,
			'width'				: 	853,
			'height'			: 	504,
			'centerOnScroll'	:	'true',
			'overlayColor'		:	'#000000',
			'overlayOpacity'	:	'0.5',
			'href'				: 	this.href.replace(new RegExp("watch\\?v=", "i"), 'v/') + '&autoplay=1',
			'type'				: 	'swf',
			'swf'				: 	{
			'wmode'				: 	'transparent',
			'allowfullscreen'	: 	'true'
			}
		});
	
		return false;
	});
	
});

// To Top Button
$(function(){$.fn.scrollToTop=function(){$(this).hide().removeAttr("href");if($(window).scrollTop()!="0"){$(this).fadeIn("fast")}var scrollDiv=$(this);$(window).scroll(function(){if($(window).scrollTop()=="0"){$(scrollDiv).fadeOut("fast")}else{$(scrollDiv).fadeIn("fast")}});$(this).click(function(){$("html, body").animate({scrollTop:0},"slow")})}});
$(function() {
	$("#toTop").scrollToTop();
});
