//set arrow links to effect carousel
function homeScroll_initCallback(carousel) {

    jQuery('#homeScroll-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#homeScroll-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};

// Preload Object
var image1 = new Image();
image1.src = "img/spacer.gif";


function removeInlineStyles($element)
{
	$(element).removeAttr("style");
};


// Mini Cart Slider
$(function() {
$("#minicart").hover(function () {
     $("#minicartExt", this).slideDown(1000);
}, 
function() {    
    $("#minicartExt", this).stop(true, true).slideUp (1000);
      }
);
});


// Shoes Code
$(function(){
	$('#cuwrapper li').each(function (i) {
		var imgpath = $(this).find('strong').text();
		$('<img>').attr('src', imgpath);
	});

	$('#cuwrapper li').css('opacity','0.6');
	var crnt = $('.link1').attr('class');
	$('.'+crnt).fadeTo(500, 1.0);
	
	$('#cutranslyr').css({
		'opacity': '0.6',
		'height': $('#cucaption').height(),
		'border-radius': '6px',
		'-moz-border-radius': '6px',
		'-webkit-border-radius': '6px'
	});
	
	$('#cuwrapper li').hover(
		function (){
			var tmpcrnt = $(this).attr('class');

			if(crnt!=tmpcrnt){
				crnt = $(this).attr('class');
				$('#cuwrapper li').fadeTo(150, 0.6);
				
				var newimgpath =$(this).find('strong').text();
				var newttlpath = $(this).find('em').text();					
				var newcappath = $(this).find('span').text();
				$(this).fadeTo(300, 1.0);
				
				$('#cuimage').attr('src', newimgpath).stop().fadeTo(800, 1.0);
				$('#cucaption h3').text(newttlpath);
				$('#cucaption p').text(newcappath);
			}
		}
	);
});

//for each in the collection, find the maximum height and set all elements to that height
$.fn.equalHeight = function() {
	
	var tallest = 0;
	
	$(this).each(function() {
		var thisHeight = $(this).height();
		if(thisHeight > tallest) {
			tallest = thisHeight;
		}
	});
	
	$(this).height(tallest);
}


//Document Ready
$(document).ready(function() 
{
	//hide email addresses with javascript
        $('.obfuscated').defuscate();

	// PNG Fix
		$(document).pngFix();

	// drop menu helper
		$('.dropmenudiv').hover(function(){
			switch($(this).attr('id')){
				case 'dropmenu1':
					$("#about").css({backgroundPosition: 'center -40px'});
					break;
				case 'dropmenu2':
					$("#shoes").css({backgroundPosition: 'center -40px'});
					break;
			}
		});
		
		$('.dropmenudiv').mouseleave(function(){
			$("#about").removeAttr("style");
			$("#shoes").removeAttr("style");
		});
	
	// category menu accordian
		$("#homeLeft ul li.leftMenu>a").live("click", function(){
			$("#homeLeft ul li.leftMenu div").hide();
			$(this).next("div").show();
			return false;
		});

	// foot conditions accordian
		$("#toggleList div>a").live("click", function(){
			$("#toggleList div span").hide();
			$(this).next("span").show();
			$(window).scrollTo($(this), 300)
			return false;
		});

	// carousel scroller
		jQuery("#homeScroll").jcarousel({
			scroll: 1,
			initCallback: homeScroll_initCallback,
			// This tells jCarousel NOT to autobuild prev/next buttons
			buttonNextHTML: null,
			buttonPrevHTML: null
		});
	
	// equal heights
		$("#homeRight .equal").equalHeight();


});

//jquery cycle

$(function() {
    $('#topRotation').cycle({
    timeout: 12000
    });
});
$(function() {
    $('#homeRotation').cycle();
    
});

