$(document).ready(function(){
	
	// Bow Sub-Nav Dropdizzle
	
	var ladder = new Ladder();
	var bowNav = $('ul#bow-sub-nav');
	var bowItems = $('ul#bow-sub-nav>li');
	
	bowNav.hide();
	
	$('ul#bow-sub-nav, li.dropdown').hoverIntent(function() {
		bowNav.slideDown(450, 'easeOutExpo');
	},function() {
		bowNav.slideUp(450, 'easeOutExpo');
	});
	
	//MODAL IMAGE ROLLOVERS
	$(".diff-images .image, .quick-detail .image a").hover(function(){
        $(this).prepend('<span class="plus"></span>');
    },
    function(){
        $(this).find("img").stop().fadeTo(300, 1);
        $(this).find('.plus').remove();
    });
	
	// ! SLIDESHOW NAVIGATION STUFF!!!
	
	var sliderNav = $('a#previous-nav, a#next-nav');
	var count = $('#bow-images img').length;
	
	sliderNav.delay(0).fadeTo(200, 0.5);
	sliderNav.hover(
		function(){
			$(this).stop().fadeTo(200, 1)
		},
		function(){
			$(this).stop().fadeTo(200, 0.5)
	});	
	
	if (count < 2){
		sliderNav.fadeOut(300,0).hide();
	}
	
	
	// ! SLIDESHOW NAVIGATION STUFF!!!
	var count;
	
	if($('#profile-slider img').length > 0){
		count = $('#profile-slider img').length;
	}else if($('#product-slider img').length > 0){
		count = $('#product-slider img').length;
		
	}
	
	var slideshowNav = $('a#product-prev, a#product-next, a#profile-prev, a#profile-next');
	
	slideshowNav.fadeTo(200, 0.5);
	
	slideshowNav.hover(
		
		function(){
			$(this).stop().fadeTo(200, 1)
			},
		function(){
			$(this).stop().fadeTo(200, 0.5)
			}
		);	
	
	//Hide if not needed
	if (count < 2){
		slideshowNav.fadeTo(300,0).hide();
	}
	
	// ! jQuery Cycle Slideshows
		
	$('#profile-slider').cycle({ 
    	fx:     'scrollHorz', 
    	easing:	'easeOutExpo',
    	prev:   '#profile-prev', 
    	next:   '#profile-next', 
    	timeout: 0 
	});
		
	
	
	//The Detectorater
	//Detect IE Blah blah blah
	
	$(function(){
	
		 if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) { //test for MSIE x.x;
		 var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
	
		 if (ieversion>=8)
		 
		  var itsok = "it's ok";
	
		 else if (ieversion>=7)
		  
		  var itsok = "it's ok";
	
		 else if (ieversion>=6)
		  $('body.home #alert').fadeIn(300);
	
		 else if (ieversion>=5)
		  $('body.home #alert').fadeIn(300);
		}
	
	 
	 $('#close-alert').click(function(){
	 	$('#alert').fadeOut(300);
	 	});
	});
	
	/* Form Validation */
	
	$('#registration-form').validate();
	
	$('label.error').prev('input').addClass('error');
});

	
