﻿(function($) {	
	$.fn.productNav = function(settings) {
		settings = jQuery.extend({ 
			overClass:"over",
			extension:".png",
			suffix:"-over",
			borderHiderClass:"hider",
			over:function(t){
				toggleContainer(t);
			},
			out:function(t){
				toggleContainer(t);
			}
		}, settings);
		
		/*
		function addHider(box) {
			if(!$("."+settings.borderHiderClass, box).length) {
				var h = $(document.createElement("div")).addClass(settings.borderHiderClass);
				//var v = $(".heading", box);
				//v.after($(h).html("&nbsp;"));
			}
		}
		*/
		function toggleContainer(box) {
			box.toggleClass(settings.overClass);
			//addHider(box);
		}	
		return $(this).navRollover(settings);
	}
		
	$.fn.overviewHover = function(settings) {
		settings = jQuery.extend({ 
			overClass:"over",
			over:function(t){ toggleListItem(t, settings.overClass); },
			out:function(t){ toggleListItem(t, settings.overClass); }
		}, settings);		
		function toggleListItem(item, cssClass) { item.toggleClass(cssClass); }
				
		return $(this).hover(function() {
			settings.over($(this));
		}, function() {
			settings.out($(this));
		}).click(function() {
			window.location=$("a:first", this).attr("href");
		});	
	};
	$(function() {
		$(".productNavigation > li").productNav().find(".product").overviewHover();		
	});	
})(jQuery); 