	function getScrollOffset () {
	    var scrOfX = 0, scrOfY = 0;
	    if (typeof window.pageYOffset == "number") {
	        scrOfY = window.pageYOffset;
	    } else if (document.body && (document.body.scrollLeft || document.body.scrollTop)) {
	        scrOfY = document.body.scrollTop;
	    } else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
	        scrOfY = document.documentElement.scrollTop;
	    }
    	return scrOfY;
	};				

	function getSizeHeight() {    
		var myHeight = 0;     
		
		if( typeof( window.innerWidth ) == 'number' ) {        
			//Non-IE        
			myHeight = window.innerHeight;    
		} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {        
			//IE 6+ in 'standards compliant mode'        
			myHeight = document.documentElement.clientHeight;    
		} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {        
			//IE 4 compatible        
			myHeight = document.body.clientHeight;    
		}    
		return myHeight; 
	}
		
	function show_submenu(submenu_id,restore) {
		if (restorer_menu_aktiv) clearTimeout(restorer_menu_aktiv);
		if (submenu_id==1) {
			document.getElementById('hauptmenue_1').style.visibility='visible';
			document.getElementById('button-spass').className='button-spass-aktiv';
			document.getElementById('button-infos').className='';
			document.getElementById('button-shop').className='';
			document.getElementById('hauptmenue_2').style.visibility='hidden';
			document.getElementById('hauptmenue_3').style.visibility='hidden';
		} else if (submenu_id==2) {
			document.getElementById('hauptmenue_2').style.visibility='visible';
			document.getElementById('button-spass').className='';
			document.getElementById('button-infos').className='button-infos-aktiv';
			document.getElementById('button-shop').className='';
			document.getElementById('hauptmenue_1').style.visibility='hidden';
			document.getElementById('hauptmenue_3').style.visibility='hidden';
		} else if (submenu_id==3) {
			document.getElementById('hauptmenue_3').style.visibility='visible';
			document.getElementById('button-spass').className='';
			document.getElementById('button-infos').className='';
			document.getElementById('button-shop').className='button-shop-aktiv';
			document.getElementById('hauptmenue_1').style.visibility='hidden';
			document.getElementById('hauptmenue_2').style.visibility='hidden';
		}
	}
	
	function submenu_ausblenden() {
		restorer_menu_aktiv = window.setTimeout("restore_submenu()",2500);
	}

	function restore_submenu() {
		show_submenu(restorer_menu_aktiv_id,1);
	}

	var restorer_popupmenu_aktiv_id = 0;
	var restorer_popupmenu_aktiv;
	function show_popupmenu(popupmenu_id) {
		if (restorer_popupmenu_aktiv) clearTimeout(restorer_popupmenu_aktiv);
		if (restorer_popupmenu_aktiv_id>0) {
			document.getElementById('navi_popup_'+restorer_popupmenu_aktiv_id).style.display='none';
			if (restorer_popupmenu_aktiv_id!=submenu_aktiv_id) {
				document.getElementById('navi_popup_a_'+restorer_popupmenu_aktiv_id).style.backgroundPosition='-166px 0px';
				document.getElementById('navi_popup_a_'+restorer_popupmenu_aktiv_id).style.color='#ffffff';
			}
		}
		if (document.getElementById('navi_popup_'+popupmenu_id)) {
			document.getElementById('navi_popup_'+popupmenu_id).style.display='block';
			document.getElementById('navi_popup_a_'+popupmenu_id).style.backgroundPosition='0px 0px';
			document.getElementById('navi_popup_a_'+popupmenu_id).style.color='#ffcd82';
			restorer_popupmenu_aktiv_id = popupmenu_id;
		} else {
			restorer_popupmenu_aktiv_id = 0;
		}
	}

	function popupmenu_ausblenden() {
		restorer_popupmenu_aktiv = window.setTimeout("restore_popupmenu()",3000);
	}

	function restore_popupmenu() {
		show_popupmenu(0);
	}

	function activate_facebook(fb_div,href_url) {
		if (fb_div.innerHTML=="") {
			var newiFrame = document.createElement("iframe");
			newiFrame.src = 'https://www.facebook.com/plugins/like.php?href='+encodeURI(href_url)+'&send=true&show_faces=false&font=trebuchet%20ms&layout=button_count';
			newiFrame.style.width = '120px';
			newiFrame.style.height = '22px';
			newiFrame.style.borderWidth = '0px';
			newiFrame.scrolling = 'no';
			newiFrame.frameborder = 0;
			newiFrame.allowtransparency = 'true';
			fb_div.appendChild(newiFrame);
		}
	}
 
	var google_plus_geladen = false;
	var render_google_interval;
	function activate_google_plus(gp_div,href_url) {
		if (gp_div.innerHTML=="") {
			var newiFrame = document.createElement("div");
			newiFrame.className = 'g-plusone';
			//newiFrame.setAttribute("data-href", "");
//			newiFrame.setAttribute("data-href", href_url.replace(/\?/g, "#"));
			newiFrame.setAttribute("data-href", href_url);
			//alert(href_url.replace(/\%3F/g, "#"));
			newiFrame.setAttribute("data-size", "medium");
			newiFrame.setAttribute("data-count", "true");
			gp_div.appendChild(newiFrame);
		}
		
		if (google_plus_geladen==false) {
			var newScript = document.createElement("script");
			newScript.src = 'https://apis.google.com/js/plusone.js';
			newScript.innerText = ' {lang: \'de\', parsetags: \'explicit\'} ';
			document.getElementById('gp-root').appendChild(newScript);
			google_plus_geladen = true;
			render_google_interval = window.setInterval("render_google_plus()",100);
		} else {
			render_google_plus();
		}
	}
	
	function render_google_plus() {
		if (gapi.plusone) {
			gapi.plusone.go();
			if (render_google_interval) clearInterval(render_google_interval);
		}
	}
	
	function findPosAbs(obj) {
		var curleft = curtop = 0;
		if (obj.offsetParent) {
		do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
		return [curleft,curtop];
		
		}
	}
	
	function show_2click_hinweis(activer_div, activate) {
		if (activate>=1) {
			var pos_activ = findPosAbs(activer_div);
			if (activate==1) {
				document.getElementById('titel_tag_hinweis').innerHTML='<span>Bronkos Datenschutz!</span>Erst wenn du hier klickst wird das Social Plugin von Facebook oder Google+ aktiv und du kannst deine Empfehlung senden. Infos im <b>Impressum</b>';
				document.getElementById('titel_tag_hinweis').style.left=(pos_activ[0]-90)+'px';
			} else if (activate==2) {
				document.getElementById('titel_tag_hinweis').innerHTML='<span>Versandkosten INFO</span>Pauschal: <b>6,90 &euro;</b><br>Lieferung nur nach Deutschland<br><br>Ab <b>142,80 &euro;</b> (120,- &euro; netto) liefern wir <b>versandkostenfrei</b>!';
				document.getElementById('titel_tag_hinweis').style.left=(pos_activ[0]-80)+'px';
			}
			document.getElementById('titel_tag_hinweis').style.top=(pos_activ[1]-168)+'px';
			document.getElementById('titel_tag_hinweis').style.display='block';
		} else {
			document.getElementById('titel_tag_hinweis').style.display='none';
			document.getElementById('titel_tag_hinweis').innerHTML='';
		}
	}
	
	function kommentar_anzeigen(kommentar_tag,href_link) {
		 
		if (document.getElementById('fb-root').innerHTML=="") { 
			var e = document.createElement('script');
    	    e.type = 'text/javascript';
	        e.src = document.location.protocol + '//connect.facebook.net/de_DE/all.js';
    	    e.async = true;
	        document.getElementById('fb-root').appendChild(e);
			window.fbAsyncInit = function() {
				FB.init({appId: '229556230402071', status: true, cookie: true, xfbml: true});
			}
		}

		if (document.getElementById(kommentar_tag).style.display=="block") {
			document.getElementById(kommentar_tag).style.display='none';
			document.getElementById(kommentar_tag+'_loading').style.display='block';
		} else {
			window.setTimeout("document.getElementById('"+kommentar_tag+"_loading').style.display='none';",700);
			document.getElementById(kommentar_tag).style.display='block';
		}

	}


	function init_scroll_hinweis() {
		window.setInterval("check_scroll_hinweis();",300);
	}
	FastInit.addOnLoad(init_scroll_hinweis());
	
	function check_scroll_hinweis() {
		var scroll_position = getScrollOffset();
		var fenster_hoehe = getSizeHeight();
		var sichtbar_bis = (fenster_hoehe+scroll_position);
		if (sichtbar_bis<750)
			document.getElementById('scroll-hinweis').style.display='block';
		else
			document.getElementById('scroll-hinweis').style.display='none';
	}

	function getPageHeight() {
		// Höhe des <body> in Pixeln
		var bodyHeight = (document.getElementById('main-header').offsetHeight+document.getElementById('main-content').offsetHeight);
			
		return bodyHeight;
	}


	window.onscroll = function(){
		var intTopOffset = 570;
		var fenster_hoehe = getSizeHeight();
		var aktuellePosition = getScrollOffset();
		if (aktuellePosition>intTopOffset) {
			if (document.getElementById("shop_warenkorb")) {
				document.getElementById("shop_warenkorb").style.top = "0px";
		    	document.getElementById("shop_warenkorb").style.position = "fixed";
			}
		} else {
			if (document.getElementById("shop_warenkorb")) {
				document.getElementById("shop_warenkorb").style.top = "570px";
		    	document.getElementById("shop_warenkorb").style.position = "absolute";
			}
			if (document.getElementById("scroll-hinweis-top")) {
				document.getElementById("scroll-hinweis-top").style.top = "570px";
		    	document.getElementById("scroll-hinweis-top").style.position = "absolute";
			}
		}
		if (document.getElementById("scroll-hinweis-top")) {
			var seiten_hoehe = getPageHeight()-190;
			if (((aktuellePosition+fenster_hoehe)<seiten_hoehe) & aktuellePosition>((fenster_hoehe/2)+25)) {
				document.getElementById("scroll-hinweis-top").style.top = (fenster_hoehe-200)+"px";
		    	document.getElementById("scroll-hinweis-top").style.position = "fixed";
			} else if (aktuellePosition>((fenster_hoehe/2)-174) & ((aktuellePosition+fenster_hoehe)<seiten_hoehe)) {
				document.getElementById("scroll-hinweis-top").style.top = ((fenster_hoehe)+(fenster_hoehe/2)-174)+"px";
		    	document.getElementById("scroll-hinweis-top").style.position = "absolute";
			} else {
				document.getElementById("scroll-hinweis-top").style.top = (seiten_hoehe-200)+"px";
		    	document.getElementById("scroll-hinweis-top").style.position = "absolute";
			}
			if (aktuellePosition>((fenster_hoehe/2)-174))
				document.getElementById('scroll-hinweis-top').style.display='block';
			else
				document.getElementById('scroll-hinweis-top').style.display='none';
		}
			
	}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

	function change_social(change_aktion) {
		
		if (document.getElementById("enable_social").checked==true) {
			createCookie("enable_social","1",30);
		} else if(change_aktion==1) {
			createCookie("enable_social","0",30);
		}

		if (document.getElementById("enable_comments").checked==true) {
			createCookie("enable_comments","1",30);
		} else if(change_aktion==2) {
			createCookie("enable_comments","0",30);
		}
		
		set_social(change_aktion);
		
	} 
	
	function set_social(aktion) {
		
		if (readCookie("enable_social")=="1") {

			document.getElementById("enable_social").checked=true;	
			for (var i = 0; i < social_media_icons.length; ++i) {
				if (social_media_icons[i]!="" & social_media_icons[i]!=undefined & social_media_icons[i]!="undefined") {
					activate_facebook(document.getElementById('facebook_like_'+i),social_media_icons[i]);
					activate_google_plus(document.getElementById('google_plus_'+i),social_media_icons[i]);
				}
			}
			render_google_interval = window.setInterval("render_google_plus()",1000);
		} else if (aktion==1) {
			document.location.reload();	
		}
		
		if (readCookie("enable_comments")=="1") {
			
			document.getElementById("enable_comments").checked=true;
			for (var i = 0; i < social_media_comments.length; ++i) {
				if (social_media_comments[i]!="" & social_media_comments[i]!=undefined & social_media_comments[i]!="undefined") {
					kommentar_anzeigen('kommentar_'+i,social_media_comments[i]);
				}
			}
			
		} else if (aktion==2) {

			document.getElementById("enable_comments").checked=false;
			for (var i = 0; i < social_media_comments.length; ++i) {
				if (social_media_comments[i]!="" & social_media_comments[i]!=undefined & social_media_comments[i]!="undefined") {
					document.getElementById('kommentar_'+i).style.display='none';
				}
			}
			
		}
		
	}
	
	document.observe("dom:loaded", function() {
		set_social(0);
	});
