jQuery(window).resize(function () {
	// FB Gewinn bei kleinerer Bildschirmgröße ausblenden
	if(jQuery(document).width() < "1130" ){
			jQuery("a.lnkGewinn").css("display", "none");
		} else {
			jQuery("a.lnkGewinn").css("display", "block");
		};
});



jQuery(document).ready(function() {
	
	// Price Replace (aKtion bis 15.09.2011)
	/*
	jQuery("span.price").each(function(){
			if (jQuery(this).html() == "1,95&nbsp;€") {
				jQuery(this).html("1,50&nbsp;€")
				}
		});
	*/	
		

	// FB Gewinn bei kleinerer Bildschirmgröße ausblenden
	if(jQuery(document).width() < "1130" ){
		jQuery("a.lnkGewinn").css("display", "none");
	} else {
		jQuery("a.lnkGewinn").css("display", "block");
	};

	jQuery("ul.messages").slideDown(500);
/*	jQuery("ul.gallery li").hover(function() { //On hover...
		var thumbOver = jQuery(this).find("img").attr("src"); //Get image url and assign it to 'thumbOver'
		//Set a background image(thumbOver) on the <a> tag - Set position to bottom
		jQuery(this).find("a.thumb").css({'background' : 'url(' + thumbOver + ') no-repeat center bottom'});
		//Animate the image to 0 opacity (fade it out)
		jQuery(this).find("span.grayscale").stop().fadeTo('fast', 0 , function() {
			jQuery(this).hide()
		});
		} , function() { //on hover out...
		//Fade the image to full opacity
		jQuery(this).find("span.grayscale").stop().fadeTo('fast', 1).show();
 	});*/
	fitScreen()
	navActiveClass();
	tabs();
	replaceVersand();
	// jQuery Cycle Tipps und Fakten
	/*
	jQuery("#tippsCycle").cycle({ 
		fx:     "fade", 
		speed:  0, 
		timeout: 0, 
		next:   ".next", 
		prev:   ".prev" 
	});
	*/
});

function replaceVersand() {
	var strVersand = jQuery('span.tax-details');
	var nContent = strVersand.html();
	if(nContent) {
	nContent = nContent.replace(/\+/g, "");
	jQuery('span.tax-details').html(nContent);
	};
}

// Tabs Produktbeschreibung	
function tabs() {
	var tabContainers = jQuery('div.tabs > div');
	tabContainers.hide().filter(':first').show();
	
	jQuery('div.tabs ul.tabNavigation a').click(function () {
		tabContainers.hide();
		tabContainers.filter(this.hash).show();
		jQuery('div.tabs ul.tabNavigation a').removeClass('selected');
		jQuery(this).addClass('selected');
		fitScreen();
		return false;
	})
	.filter(':first').click();
}




// Erfolgsgeschichte ein/- ausblenden
function ErfolgFading() {
		jQuery("#erfolgsgeschichte").slideDown("normal", function () {
			jQuery(this).click(function () {
				jQuery(this).slideUp("normal");
			});
		});
}



// Content auf 100% Höhe
function fitScreen() {
	/**/
	if (jQuery.browser.safari) {
	} else {
		if (jQuery(".col-main").height() < jQuery(window).height()) {
			jQuery(".col-main").height(jQuery(document).height() - 300);
		}
	}
}



/* Navigation "active"-CSS-Klasse via javascript */
function navActiveClass(){	
	if (location.pathname == "/" || location.pathname == "/dd/") { 
		jQuery(".links a").each(function(){
			if (jQuery(this).attr("href") == "/" ) 
			{ jQuery(this).addClass("active"); }
		});	
	} 
	else  {
		jQuery(".site-left-col a").each(function(){
			jQuery(this).parent().removeClass("active"); 
			if ((location + location.hash) == jQuery(this).attr("href") && jQuery(this).attr("href") != "/" )
			{ 				
				jQuery(this).parent().addClass("active"); 			
			}					
		});		
	}
	// Haupt-Menüpunkt aktiv lassen bei aufgeklappten Menü
	if (jQuery("#nav li.level0 ul.level1 li").hasClass("active")) {
		jQuery("#nav li.level0 ul.level1").css("display","block");
		jQuery("#nav li.level0.last").addClass("active");
	}
}


$(window).bind('hashchange', function () {
	navActiveClass();
});



function switchImage(path){
	jQuery("#image").fadeOut(350,function(){
		jQuery("#image").attr("src",path);
		jQuery("#image").fadeIn(350);
		});
	}
