jQuery(document).ready(function($) {
	$("#whats_for_sale").mouseenter(function(){
		changeImages('for_sale', 'images/for_sale-over.gif');
		$("div.category-lists").css("z-index", 10000);
		$("div.category-lists").stop().css("opacity", 1).show();
	}).mouseleave(function(){
		changeImages('for_sale', 'images/for_sale.gif');
		$("div.category-lists").fadeOut(300);
	});
	
	$("#category-ul-list-expandable li ul").hide();
	$("#category-ul-list-expandable li").mouseenter(function() {
		$(this).find("ul:hidden").slideDown(700);
	});
	$("#category-ul-list-expandable li").mouseleave(function() {
		$(this).find("li").not(".menu_current").find("ul").slideUp(700);
	});	
	
	$("#category-accordian").find("a.expand").click(function(event) {
		event.preventDefault();
		$link = $(this);
		$list = $link.parent().find("ul").eq(0);
		if($list.is(":visible")) {
			$list.slideUp();
		} else {
			$list.slideDown();
		}
	});
	
	function newImage(arg) {
		if (document.images) {
			rslt = new Image();
			rslt.src = arg;
			return rslt;
		}
	}
	
	function changeImages() {
		if (document.images && (preloadFlag == true)) {
			for (var i=0; i<changeImages.arguments.length; i+=2) {
				document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
			}
		}
	}
	
	var preloadFlag = false;
	function preloadImages() {
		if (document.images) {
			topNavAbout_over = newImage("/images/topNavAbout-over.jpg");
			topNavSalvage_over = newImage("/images/topNavSalvage-over.jpg");
			topNavResources_over = newImage("/images/topNavResources-over.jpg");
			topNavContact_over = newImage("/images/topNavContact-over.jpg");
			topNavCart_over = newImage("/images/topNavCart-over.jpg");
			preloadFlag = true;
		}
	}
	function change(url){
		if(url=="none"){
			return false;
		} else {
			window.location=url;
		}
	}
	
	$('#jsCarousel').jsCarousel({
		
		autoscroll: true,
		masked: false,
		itemstodisplay: 6,
		orientation: 'h'
	});
});

