
var sw;
if (!sw) {
	sw = {}
}

$.extend(sw, {
	init : function() {
		sw.hoverlist();
		sw.productlist();
		sw.variantlist();
		sw.contentfulllist();
		$(document).pngFix(); 
	},
	/* Generic List (wrapper element gets the class: 'jquery_hoverlist' and every item which has*/

	hoverlist : function() {
		var product_key = 'product00';
		var product = $('.jquery_hoverlist .jquery_hoverlist_item');
		var current_product = $('.jquery_hoverlist .jquery_hoverlist_item:first');
		$(current_product).addClass('active');
		
		$(product).hover( function() {
			$('#'+product_key).hide();
			$(product).removeClass('active');
			product_key = $(this).attr('rel');
			$('#'+product_key).show();
			$(this).addClass('active');
		}, function(){
			current_product = $(this);
		});
	},
	productlist : function() {
		var key = 'product00';
		var product = $('.produktliste li a');
		var current_product = $('.produktliste li a:first');
		$(current_product).addClass('active');
		
		$(product).hover( function() {
			$('#'+key).hide();
			$(product).removeClass('active');
			key = $(this).attr('rel');
			$('#'+key).show();
			$(this).addClass('active');
		}, function(){
			current_product = $(this);
		});
	},
	variantlist : function() {
		var variantkey = 'product00';
		var product = $('.variantView tr.hover');
		var current_product = $('.variantView tr.hover:first');
		$(current_product).addClass('active');
		
		$(product).hover( function() {
			$(product).removeClass('active');
			variantkey = $(this).attr('rel');
			$('#'+variantkey).show();
			$(this).addClass('active');
		}, function(){
			current_product = $(this);
		});
	},
	lightboxlist : function() {
		$('.productbox a').live('mouseenter', function(e) {
			$('.productbox a').removeClass('active');
			$(this).addClass('active');
			tmp_img_src = $(this).attr('href');
			tmp_text = $(this).find('img').attr('alt');
			$('.productbox .image-container img').attr('src', tmp_img_src);
			$('.productbox h2').html(tmp_text);
		});		
		$('.productbox a').live('click', function(e) {
			e.preventDefault();
		});		
	},
	contentfulllist : function() {
		$('.contentfull .left li a').hover( function() {
			$(this).parent().parent().find('a').removeClass('active');
			$(this).addClass('active');
			tmp = $(this).attr('title');
			$(this).parents('.left').find('.image-container img').attr('src', tmp);
		}, function(){
			
		});
		$('.contentfull .left li a').click( function(e) {
			e.preventDefault();
		});
	}
})

$(sw.init)
