// JavaScript Document
$.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    $("<img>").attr("src", arguments[i]);
  }
}
$(document).ready(

	function(){
	//Adding hover-functionality to <li>-elements for IE6
		function ie6hover(elem){
			$(elem).hover(
				function() {
					$(this).addClass("ie6hover");
				},
				function() {
					$(this).removeClass("ie6hover");
				}
			);
		};
		ie6hover("#left ul li a div");
		ie6hover("#middle_big div.prod");
		//Thumbnails over links
		function hoverin() {
			$(this).css({'z-index' : '10'}); /*Add a higher z-index value so this image stays on top*/ 
			$(this).find('img').css({ 'display' : 'block' });
			$(this).find('img').addClass("hover").stop() /* Add class of "hover", then stop animation queue buildup*/
				.animate({
					width: '152px', /* Set new width */
					height: '198px', /* Set new height */
					top: '20px'
				}, 200); /* this value of "200" is the speed of how fast/slow this hover animates */
		
		};
		function hoverout() {
			$(this).css({'z-index' : '0'}); /* Set z-index back to 0 */
			$(this).find('img').removeClass("hover").stop()  /* Remove the "hover" class , then stop animation queue buildup*/
				.animate({
					width: '8px', /* Set width back to default */
					height: '10px', /* Set height back to default */
					top: '3px'
				}, 400, function(){$(this).css({ 'display' : 'none' });});
		}
		$("#middle #thumb li").hover(hoverin,hoverout);
		$("#right #thumb li").hover(hoverin,hoverout);
	}
);
//Set page height by screen resolution
		function setPageHeight(){
			var winHeight = document.documentElement.clientHeight;
			var mainTop = ((winHeight-520)/2);
			if(winHeight<520){mainTop=+10;winHeight=540;}
			$("#page").css("height",winHeight+"px");
			$("#main").css("top",mainTop+"px");
		}
//Adding resize event
	//$(window).resize(function(){setPageHeight();});
function testForm() {
	 var error = false;
	 var error_message = "Eingabe-Fehler:\n";
	 /* Ueberpruefen des Nachname-Feldes auf Inhalt */
	 if (document.formular.lastname.value == '') {
		  error = true;
		  error_message += "Bitte geben Sie Ihren Nachnamen ein.\n\n";
		  $("#lastname").css("color","red");
	 }else{
		  $("#lastname").css("color","");
	 }
	 /* Ueberpruefen des Vorname-Feldes auf Inhalt */
	 if (document.formular.surename.value == '') {
		  error = true;
		  error_message += "Bitte geben Sie Ihren Vornamen ein.\n\n";
		  $("#surename").css("color","red");
	 }else{
		  $("#surename").css("color","");
	 }
	 /* Ueberpruefen des eMail-Feldes auf Inhalt */
	 if (document.formular.email.value == '') {
		  error = true;
		  error_message += "Bitte geben Sie Ihre E-Mail-Adresse ein.\n\n";
		  $("#email").css("color","red");
	 }
	 /* Ueberpruefen des eMail-Feldes auf das (at)-Zeichen */
	 else if (document.formular.email.value.indexOf("@") == -1) {
		  error = true;
		  error_message += "Bitte geben Sie eine gültige E-Mail-Adresse ein.\n\n";
		  $("#email").css("color","red");
	 }else{
		  $("#email").css("color","");
	 }
	 /* Ueberpruefen des Text-Feldes auf Inhalt */
	 if (document.formular.text.value == '') {
		  error = true;
		  error_message += "Bitte geben Sie Ihr Anliegen ein.\n\n";
		  $("#text").css("color","red");
	 }else{
		  $("#text").css("color","");
	 }
	 /* Ist irgendwo ein Fehler aufgetreten ? */
	 if (error) {
		  /* error_message += "Bitte korrigieren Sie Ihre Angaben."; */
		  alert(error_message);
		  return false; //Formular wird nicht abgeschickt.
	 } 
	 else {
		  return true;  //Formular wird abgeschickt.
	 }
};

