function attachMailTo() {
   var mailAdr = document.getElementsByTagName('a');
   for (var CountMail=0;CountMail<mailAdr.length;CountMail++) {
      if (mailAdr[CountMail].className != 'mailto') continue; 
	  var email = mailAdr[CountMail].innerHTML.split("").reverse().join("");
      mailAdr[CountMail].innerHTML = email;
	  mailAdr[CountMail].href = 'mailto:' + email; 	  
   }
}
window.onload = attachMailTo;

$(function() {
	$.easing.custom = function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
	}
	$(".content_slideshow").scrollable({ easing: 'custom', speed: 'slow', disabledClass: 'disable', items: '.content_slideshow_items', circular: true}).autoscroll({ autoplay: true, interval: 3500, autopause: false });
	$("#login_link").toggle(function() {
		$("#header_login").fadeTo('fast', 1.0);
		$(".kunden-login").css({ "background-color": "#5FA03F", "border": "1px solid #5FA03F" });
	},
	function () {
		$("#header_login").fadeTo('fast', 0);
		$(".kunden-login").css({ "background-color": "#339900", "border": "1px solid #339900" });
	});
});

jQuery(function( $ ){
	$('#fmea_download').click(function() {
		$('#fmea_download_request').fadeTo('fast', 0, function() {
			$('#fmea_download_request').slideUp('fast', function() {
				$('#fmea_download_button').slideUp('normal', function() {
					$.post('../QUEEN-System-FMEA_request.php', function(data) {
						$('#fmea_download_request').html(data).slideDown('fast', function() {
							$('#fmea_download_request').fadeTo('fast', 1, function() {
								$.scrollTo( $('#download_system_fmea_header'), 500);  
								$('#form_download_system_fmea_submit').click(function() {
									$.post('../form_submit.php', $('#form_download_system_fmea').serialize(), function(data) {
										$('#fmea_download_request_notify').html(data);
									});
								});							
							});
						});
					});
				});
			});
		});
	});
});
jQuery(function( $ ){
	$('#qtol_download').click(function() {
		$('#qtol_download_request').fadeTo('fast', 0, function() {
			$('#qtol_download_request').slideUp('fast', function() {
				$('#qtol_download_button').slideUp('normal', function() {
					$.post('../QUEEN-Qtol_request.php', function(data) {
						$('#qtol_download_request').html(data).slideDown('fast', function() {
							$('#qtol_download_request').fadeTo('fast', 1, function() {
								$.scrollTo( $('#qtol_download_header'), 500);  
							});
						});
					});
				});
			});
		});
	});
});
jQuery(function( $ ){
	$('#qtol_order').click(function() {
		$('#qtol_order_request').fadeTo('fast', 0, function() {
			$('#qtol_order_request').slideUp('fast', function() {
				$('#qtol_order_button').slideUp('normal', function() {
					$.post('../QUEEN-Qtol_order_request.php', function(data) {
						$('#qtol_order_request').html(data).slideDown('fast', function() {
							$('#form_ustid_msg').slideUp('fast').delay(150).html('Nicht erforderlich bei Lieferungen innerhalb von Deutschland').slideDown('normal', function() {
								$('#qtol_order_request').fadeTo('fast', 1, function() {
									$.scrollTo( $('#qtol_order_header'), 500);  
									$('#form_qtol_bestellung_submit').click(function() {
										$.post('../form_submit.php', $('#form_qtol_order').serialize(), function(data) {
											$('#qtol_bestellen_request_notify').html(data);
										});
									});
								});
							});
						});
					});
				});
			});
		});
	});
});

jQuery(function( $ ){
	$('#form_demo_zugang_submit').click(function() { 
		$.post('../form_submit.php', $('#form_demo_zugang').serialize(), function(data) {
			$('#demo_zugang_request_notify').html(data);
		});
	});							
});

jQuery(function( $ ){
	$('#anfrage').click(function() {
		$('#anfrage_request').fadeTo('fast', 0, function() {
			$('#anfrage_request').slideUp('fast', function() {
				$('#anfrage_button').slideUp('normal', function() {
					$.post('../Kontakt_request.php', function(data) {
						$('#anfrage_request').html(data).slideDown('fast', function() {
							$('#anfrage_request').fadeTo('fast', 1, function() {
								$.scrollTo( $('#anfrage_header'), 500); 
								$('#form_anfrage_submit').click(function() {
									$.post('../form_submit.php', $('#form_anfrage').serialize(), function(data) {
										$('#anfrage_request_notify').html(data);
									});
								});							
							});
						});
					});
				});
			});
		});
	});
});
jQuery(function( $ ){
	$('#demo_zugang').click(function() {
		$('#demo_zugang_request').fadeTo('fast', 0, function() {
			$('#demo_zugang_request').slideUp('fast', function() {
				$('#demo_zugang_button').slideUp('normal', function() {
					$.post('../Demo-Zugang-QUEEN-iPMM_request.php', function(data) {
						$('#demo_zugang_request').html(data).slideDown('fast', function() {
							$('#demo_zugang_request').fadeTo('fast', 1, function() {
								$.scrollTo( $('#demo_zugang_header'), 500); 
								$('#form_demo_zugang_submit').click(function() {
									$.post('../form_submit.php', $('#form_demo_zugang').serialize(), function(data) {
										$('#demo_zugang_request_notify').html(data);
									});
								});							
							});
						});
					});
				});
			});
		});
	});
});
jQuery(function( $ ){
	$('#anfrage_leistungsverzeichnis').click(function() {
		$('#anfrage_leistungsverzeichnis_request').fadeTo('fast', 0, function() {
			$('#anfrage_leistungsverzeichnis_request').slideUp('fast', function() {
				$('#anfrage_leistungsverzeichnis_button').slideUp('normal', function() {
					$.post('../Leistungsverzeichnis_request.php', function(data) {
						$('#anfrage_leistungsverzeichnis_request').html(data).slideDown('fast', function() {
							$('#anfrage_leistungsverzeichnis_request').fadeTo('fast', 1, function() {
								$.scrollTo( $('#anfrage_leistungsverzeichnis_header'), 500); 
								$('#form_anfrage_leistungsverzeichnis_submit').click(function() {
									$.post('../form_submit.php', $('#form_anfrage_leistungsverzeichnis').serialize(), function(data) {
										$('#anfrage_leistungsverzeichnis_request_notify').html(data);
									});
								});							
							});
						});
					});
				});
			});
		});
	});
});
jQuery(function( $ ){
	$('#anfrage_leistungsverzeichnis_txt').click(function() {
		$('#anfrage_leistungsverzeichnis_request').fadeTo('fast', 0, function() {
			$('#anfrage_leistungsverzeichnis_request').slideUp('fast', function() {
				$('#anfrage_leistungsverzeichnis_button').slideUp('normal', function() {
					$.post('../Leistungsverzeichnis_request.php', function(data) {
						$('#anfrage_leistungsverzeichnis_request').html(data).slideDown('fast', function() {
							$('#anfrage_leistungsverzeichnis_request').fadeTo('fast', 1, function() {
								$.scrollTo( $('#anfrage_leistungsverzeichnis_header'), 500); 
								$('#form_anfrage_leistungsverzeichnis_submit').click(function() {
									$.post('../form_submit.php', $('#form_anfrage_leistungsverzeichnis').serialize(), function(data) {
										$('#anfrage_leistungsverzeichnis_request_notify').html(data);
									});
								});							
							});
						});
					});
				});
			});
		});
	});
});
(function($) {
	$.fn.customFadeIn = function(speed, callback) {
		$(this).fadeIn(speed, function() {
			if(jQuery.browser.msie)
				$(this).get(0).style.removeAttribute('filter');
			if(callback != undefined)
				callback();
		});
	};
	$.fn.customFadeOut = function(speed, callback) {
		$(this).fadeOut(speed, function() {
			if(jQuery.browser.msie)
				$(this).get(0).style.removeAttribute('filter');
			if(callback != undefined)
				callback();
		});
	};
})(jQuery);
