jQuery(function ($) {

/* jQuery Tools - Overlay */
	$("#header a[rel], #footnotes a[rel], #singleMainContent .add_to_wishlist_inactive a, #floatswrap .order_table a[rel]").each(function(i) {
			
		$(this).overlay({
			effect: 'apple'
		});			
	});		


/*Form Validation*/	
	$("#signInForm, #quickLoginForm, #editEmail, #editPassword").each(function(i) {
		$(this).validate();			
	});

$(function() {
    var $mainNav = $('#main-nav'),
    navWidth = $mainNav.width();
    
    $mainNav.children('.main-nav-item').hover(function(ev) {
        var $this = $(this),
        $dd = $this.find('.main-nav-dd');
        
        // get the left position of this tab
        var leftPos = $this.find('.main-nav-tab').position().left;
        
        // get the width of the dropdown
        var ddWidth = $dd.width(),
        leftMax = navWidth - ddWidth;
        
        // position the dropdown
        $dd.css('left', Math.min(leftPos, leftMax) );
        
        // show the dropdown
        $this.addClass('main-nav-item-active');
    }, function(ev) {

        // hide the dropdown
        $(this).removeClass('main-nav-item-active');
    });
	
		$("#slides").slides({
				preload: true,
				preloadImage: "img/loading.gif",
				play: 5000,
				pause: 2500,
				hoverPause: true,
				animationStart: function(current){
					$(".caption").animate({
						bottom:-35
					},100);
					if (window.console && console.log) {
						// example return of current slide number
						console.log("animationStart on slide: ", current);
					};
				},
				animationComplete: function(current){
					$(".caption").animate({
						bottom:0
					},200);
					if (window.console && console.log) {
						// example return of current slide number
						console.log("animationComplete on slide: ", current);
					};
				},
				slidesLoaded: function() {
					$('.caption').animate({
						bottom:0
					},200);
				}
			});
		$("#zoom").gzoom({
						sW: 200,
						sH: 200,
						lW: 1024,
						lH: 768,
						lightbox: true,
						zoomIcon: 'images/gtk-zoom-in.png'
				});
});


});
