$(document).ready(function(){
	
	/* Start Seite Karussel */
		
		jQuery('#nxsMarkenSlider').jcarousel({
			auto:3,
			visible:12,
			wrap:'circular',
			scroll:1
		});
		
		jQuery('#nxsAktuellSlider').jcarousel({
			auto:0,
			visible:6,
			wrap:'circular',
			scroll:1
		});
		
		jQuery('#nxsNeuSlider').jcarousel({
			auto:0,
			visible:6,
			wrap:'circular',
			scroll:1
		});
		
		/* Top Account Hover */
		
		$('#nxsMyAccLink').hover(function(){
			$('.nxsMyTopAcc').fadeIn(200);
		},
		function(){
			$('.nxsMyTopAcc').hide();
		}
		);
		
		$('.nxsMyTopAcc').hover(function(){
			$(this).show();
		},
		function(){
			$(this).fadeOut(200);
		}
		);
		
		/* Top Info Box Hover */
		
		$('#nxsInfoCenterLink').hover(function(){
			$('.nxsInfoBoxContainer').fadeIn(200);
		},
		function(){
			$('.nxsInfoBoxContainer').hide();
		}
		);
		
		$('.nxsInfoBoxContainer').hover(function(){
			$(this).show();
		},
		function(){
			$(this).fadeOut(200);
		}
		);
		
		
		/* Detailsseite Reiter */
		
		$('#nxsDescLink').click(function() {
			$('#tabContentDesc').show();
			$('#tabContentBewert').hide();
			$('#tabContentZubehoer').hide();
			$('#tabContentPDF').hide();
		});
		
		$('#nxsBewertLink').click(function() {
			$('#tabContentDesc').hide();
			$('#tabContentBewert').show();
			$('#tabContentZubehoer').hide();
			$('#tabContentPDF').hide();
		});
		
		$('#nxsZubehoerLink').click(function() {
			$('#tabContentDesc').hide();
			$('#tabContentBewert').hide();
			$('#tabContentZubehoer').show();
			$('#tabContentPDF').hide();
		});
		
		$('#nxsPDFLink').click(function() {
			$('#tabContentDesc').hide();
			$('#tabContentBewert').hide();
			$('#tabContentZubehoer').hide();
			$('#tabContentPDF').show();
		});
		
		
		/* Varianten Preis Detailseite */
		
		$('#nxsvarselect').change(function(){
			var str = "";
			$('#nxsvarselect option:selected').each(function(){
				if($(this).attr('price') != ''){
					str += $(this).attr('price') + " €*";
				}
			});
			if($('#nxsvarselect option:selected').attr('price')){
				$('.price_value .price').text(str);
				$('.price_value .price').prepend('<div style="height:20px"></div>');
			}
		})
		.trigger('change');
		
		
		var fOrigPrice = parseFloat($('.price_value .price .newPrice').text().replace(' €*','')); 
		var fOrigPriceFormatted = parseFloat($('.price_value .price .newPrice').text().replace('.',''));
		
		
		$('.nxsVarList').change(function(){
			var fAdd = 0;
			$('.nxsVarList option:selected').each(function(){
				if($(this).attr('price') != '' && $(this).attr('price')){
					fAdd += parseFloat($(this).attr('price'));
					
				}
			});
			
			var fSum = parseFloat(fOrigPriceFormatted) + parseFloat(fAdd);
			$('.price_value .price').text(fSum.toFixed(2).replace('.',',') + ' €*');
			$('.price_value .price').prepend('<div style="height:20px"></div>');
		});
		
		
			
			$('html').click(function() {
				$('.nxsToBasketErrorPopup').fadeOut(300);
			});
			
			$('.nxsToBasketErrorPopup').click(function(event){
				event.stopPropagation();
			});
		
		
			$('#test_toBasket').click(function(){
				var valid = true;
				$('.nxsVarList option:selected').each(function(){
					if($(this).attr('value') == ''){
						$('.nxsToBasketErrorPopup').fadeIn(300);
						valid = false;
						return false;
						event.stopPropagation();
					}
				});
				return valid;
			});	
		
		
		
		
 });
