//onload

$(window).load(function() {

	$(".tip").hide();	
	$('#haus1').children(".tip").show();
	
	if($(window).height() <= 1250) {
		$('.mainbg').css("min-height","1250px");
	}

	$('#start').click(function() {
		$(window).scrollTo( '1250px', 800);
	});
		
	$('#reflistenlink').click(function() {
		$('#refliste').css("display","block");
		$(window).scrollTo( '#refliste', 800);
  		return false;
	});
	$('#reflistenlink2').click(function() {
		$('#refliste').css("display","none");
		$(window).scrollTo( '#stage', 800);
  		return false;
	});

$('#quicknavislider').animate({
    left: '-180px'
  }, 500);
  
$('#quicknavislider').mouseleave(function() {
  $('#quicknavislider').animate({
    left: '-180px'
  }, 500, function() {
    // Animation complete.
  });
});

$('#quicknavislider').click(function() {
  $('#quicknavislider').animate({
    left: '-20px'
  }, 500, function() {
    // Animation complete.
  });
});

$('.logo').mouseenter(function() {
	$('#home').animate({
    	left: '60px'
  	}, 400);
});

$('.logo').mouseleave(function() {
	$('#home').animate({
    	left: '28px'
  	}, 400);
});

$('#haus1').click(function() {  
  	if(!haus1on) { 
		haus1func();
		getPages(this.href,'#textbox1','#textbox3','#textbox3',"fb");
	} else {
		lasthaus(1);
	}
  	return false;
});

$('#haus').mouseenter(function() {
	if(lastnum==0) { 
		$("#haus1").children(".tip").hide();
		lastnum = 1;
	}
});

$('#haus1').mouseenter(function() {
  if(!haus1on) { 
 	  $(this).animate( 
	  { marginLeft: (hausfacts1[2]+((hausfacts1[0]/4)*0.8))+'px', marginTop: (hausfacts1[3]+((hausfacts1[1]/4)*0.8))+'px', width: ((hausfacts1[0]/2)*1.2)+'px', height: ((hausfacts1[1]/2)*1.2)+'px' 
	  }, animationspeed, function() {
	  $(this).children(".tip").show();
	  });
  }
});


$('#haus1').mouseleave(function() {
	if(!haus1on) { 
	  $(this).animate( 
	  { marginLeft: (hausfacts1[2]+(hausfacts1[0]/4))+'px', marginTop: (hausfacts1[3]+(hausfacts1[1]/4))+'px', width: (hausfacts1[0]/2)+'px', height: (hausfacts1[1]/2)+'px' }, animationspeed, function() {
	  $(this).children(".tip").hide();
	  });
  	}
});


//haus 2

$('#haus2').mouseenter(function() {
  if(!haus2on) { 
	  $(this).animate( 
	  { marginLeft: (hausfacts2[2]+((hausfacts2[0]/4)*0.8))+'px', marginTop: (hausfacts2[3]+((hausfacts2[1]/4)*0.8))+'px', width: ((hausfacts2[0]/2)*1.2)+'px', height: ((hausfacts2[1]/2)*1.2)+'px' 
	  }, animationspeed, function() {
	  $(this).children(".tip").show();
	  });
  }
});


$('#haus2').mouseleave(function() {
	if(!haus2on) { 
	  $(this).animate( 
	  { marginLeft: (hausfacts2[2]+(hausfacts2[0]/4))+'px', marginTop: (hausfacts2[3]+(hausfacts2[1]/4))+'px', width: (hausfacts2[0]/2)+'px', height: (hausfacts2[1]/2)+'px' }, animationspeed, function() {
	  $(this).children(".tip").hide();
	  });
  	}
});

$('#haus2').click(function() { 
  if(!haus2on) { haus2func();
	  getPages(this.href,'#textbox1','#textbox3','#textbox3',"fb");
	} else {
		lasthaus(2);
	}
  return false;
});

//haus 3

$('#haus3').mouseenter(function() {
  if(!haus3on) { 
	  $(this).animate( 
	  { marginLeft: (hausfacts3[2]+((hausfacts3[0]/4)*0.8))+'px', marginTop: (hausfacts3[3]+((hausfacts3[1]/4)*0.8))+'px', width: ((hausfacts3[0]/2)*1.2)+'px', height: ((hausfacts3[1]/2)*1.2)+'px' 
	  }, animationspeed, function() {
	  $(this).children(".tip").show();
	  });
  }
});


$('#haus3').mouseleave(function() {
	if(!haus3on) { 
	  $(this).animate( 
	  { marginLeft: (hausfacts3[2]+(hausfacts3[0]/4))+'px', marginTop: (hausfacts3[3]+(hausfacts3[1]/4))+'px', width: (hausfacts3[0]/2)+'px', height: (hausfacts3[1]/2)+'px' }, animationspeed, function() {
	  $(this).children(".tip").hide();
	  });
  	}
});

$('#haus3').click(function() { 
  if(!haus3on) { 
  	haus3func();
  	getPages(this.href,'#textbox1','#textbox3','#textbox3',"fb");
	} else {
		lasthaus(3);
	}
  return false;
});


//haus 4

$('#haus4').mouseenter(function() {
  if(!haus4on) { 
	  $(this).animate( 
	  { marginLeft: (hausfacts4[2]+((hausfacts4[0]/4)*0.8))+'px', marginTop: (hausfacts4[3]+((hausfacts4[1]/4)*0.8))+'px', width: ((hausfacts4[0]/2)*1.2)+'px', height: ((hausfacts4[1]/2)*1.2)+'px' 
	  }, animationspeed, function() {
	  $(this).children(".tip").show();
	  });
  }
});


$('#haus4').mouseleave(function() {
	if(!haus4on) { 
	  $(this).animate( 
	  { marginLeft: (hausfacts4[2]+(hausfacts4[0]/4))+'px', marginTop: (hausfacts4[3]+(hausfacts4[1]/4))+'px', width: (hausfacts4[0]/2)+'px', height: (hausfacts4[1]/2)+'px' }, animationspeed, function() {
	  $(this).children(".tip").hide();
	  });
  	}
});

$('#haus4').click(function() { 
  if(!haus4on) { 
  	haus4func();
  	getPages(this.href,'#textbox1','#textbox3','#textbox3',"fb");
	} else {
		lasthaus(4);
	}
  return false;
});

//haus 5

$('#haus5').mouseenter(function() {
  if(!haus5on) { 
	  $(this).animate( 
	  { marginLeft: (hausfacts5[2]+((hausfacts5[0]/4)*0.8))+'px', marginTop: (hausfacts5[3]+((hausfacts5[1]/4)*0.8))+'px', width: ((hausfacts5[0]/2)*1.2)+'px', height: ((hausfacts5[1]/2)*1.2)+'px' 
	  }, animationspeed, function() {
	  $(this).children(".tip").show();
	  });
  }
});


$('#haus5').mouseleave(function() {
	if(!haus5on) { 
	  $(this).animate( 
	  { marginLeft: (hausfacts5[2]+(hausfacts5[0]/4))+'px', marginTop: (hausfacts5[3]+(hausfacts5[1]/4))+'px', width: (hausfacts5[0]/2)+'px', height: (hausfacts5[1]/2)+'px' }, animationspeed, function() {
	  $(this).children(".tip").hide();
	  });
  	}
});

$('#haus5').click(function() { 
  if(!haus5on) {
	  haus5func();
  	getPages(this.href,'#textbox1','#textbox3','#textbox3',"fb");
	} else {
		lasthaus(5);
	}
  return false;
});


//haus 6

$('#haus6').mouseenter(function() {
  if(!haus6on) { 
	  $(this).animate( 
	  { marginLeft: (hausfacts6[2]+((hausfacts6[0]/4)*0.8))+'px', marginTop: (hausfacts6[3]+((hausfacts6[1]/4)*0.8))+'px', width: ((hausfacts6[0]/2)*1.2)+'px', height: ((hausfacts6[1]/2)*1.2)+'px' 
	  }, animationspeed, function() {
	  $(this).children(".tip").show();
	  });
  }
});


$('#haus6').mouseleave(function() {
	if(!haus6on) { 
	  $(this).animate( 
	  { marginLeft: (hausfacts6[2]+(hausfacts6[0]/4))+'px', marginTop: (hausfacts6[3]+(hausfacts6[1]/4))+'px', width: (hausfacts6[0]/2)+'px', height: (hausfacts6[1]/2)+'px' }, animationspeed, function() {
	  $(this).children(".tip").hide();
	  });
  	}
});

$('#haus6').click(function() { 
  if(!haus6on) {
	  haus6func();
  	getPages(this.href,'#textbox1','#textbox3','#textbox3',"fb");
	} else {
		lasthaus(6);
	}
  return false;
});

//haus 7

$('#haus7').mouseenter(function() {
  if(!haus7on) { 
	  $(this).animate( 
	  { marginLeft: (hausfacts7[2]+((hausfacts7[0]/4)*0.8))+'px', marginTop: (hausfacts7[3]+((hausfacts7[1]/4)*0.8))+'px', width: ((hausfacts7[0]/2)*1.2)+'px', height: ((hausfacts7[1]/2)*1.2)+'px' 
	  }, animationspeed, function() {
	  $(this).children(".tip").show();
	  });
  }
});


$('#haus7').mouseleave(function() {
	if(!haus7on) { 
	  $(this).animate( 
	  { marginLeft: (hausfacts7[2]+(hausfacts7[0]/4))+'px', marginTop: (hausfacts7[3]+(hausfacts7[1]/4))+'px', width: (hausfacts7[0]/2)+'px', height: (hausfacts7[1]/2)+'px' }, animationspeed, function() {
	  $(this).children(".tip").hide();
	  });
  	}
});

$('#haus7').click(function() { 
  if(!haus7on) { 
  	haus7func();
  	getPages(this.href,'#textbox1','#textbox3','#textbox3',"fb");
	} else {
		lasthaus(7);
	}
  return false;
});

//haus 8

$('#haus8').mouseenter(function() {
  if(!haus8on) { 
	  $(this).animate( 
	  { marginLeft: (hausfacts8[2]+((hausfacts8[0]/4)*0.8))+'px', marginTop: (hausfacts8[3]+((hausfacts8[1]/4)*0.8))+'px', width: ((hausfacts8[0]/2)*1.2)+'px', height: ((hausfacts8[1]/2)*1.2)+'px' 
	  }, animationspeed, function() {
	  $(this).children(".tip").show();
	  });
  }
});


$('#haus8').mouseleave(function() {
	if(!haus8on) { 
	  $(this).animate( 
	  { marginLeft: (hausfacts8[2]+(hausfacts8[0]/4))+'px', marginTop: (hausfacts8[3]+(hausfacts8[1]/4))+'px', width: (hausfacts8[0]/2)+'px', height: (hausfacts8[1]/2)+'px' }, animationspeed, function() {
	  $(this).children(".tip").hide();
	  });
  	}
});

$('#haus8').click(function() { 
  if(!haus8on) { 
  	haus8func();
  	getPages(this.href,'#textbox1','#textbox1','',"fb2");
	} else {
		lasthaus(8);
	}
  return false;
});

//haus 9

$('#haus9').mouseenter(function() {
  if(!haus9on) { 
	  $(this).animate( 
	  { marginLeft: (hausfacts9[2]+((hausfacts9[0]/4)*0.8))+'px', marginTop: (hausfacts9[3]+((hausfacts8[1]/4)*0.8))+'px', width: ((hausfacts9[0]/2)*1.2)+'px', height: ((hausfacts9[1]/2)*1.2)+'px' 
	  }, animationspeed, function() {
	  $(this).children(".tip").show();
	  });
  }
});


$('#haus9').mouseleave(function() {
	if(!haus9on) { 
	  $(this).animate( 
	  { marginLeft: (hausfacts9[2]+(hausfacts9[0]/4))+'px', marginTop: (hausfacts9[3]+(hausfacts9[1]/4))+'px', width: (hausfacts9[0]/2)+'px', height: (hausfacts9[1]/2)+'px' }, animationspeed, function() {
	  $(this).children(".tip").hide();
	  });
  	}
});

$('#haus9').click(function() { 
  if(!haus9on) { 
  	haus9func();
  	getPages(this.href,'#textbox1','#textbox1','',"fb2");
	} else {
		lasthaus(9);
	}
  return false;
});

$('#referenzen').click(function() { 
	clearBoxes();
	lasthaus(0);
	getPages(this.href,'#textbox1','#stage','',"ref");
  	return false;
  });
  
$('#fach').click(function() { 
	$(window).scrollTo( '#bottom', 800);
  	return false;
  });
  
$('.firma').click(function() { 
	clearBoxes();
	lasthaus(0);
	getPages(this.href,'#textbox1','#stage','',"firma");
  	return false;
  });

$('.kontakt').click(function() { 
	clearBoxes();
	lasthaus(0);
	getPages(this.href,'#textbox1','#stage','',"kontakt");
  	return false;
  });

});

//functions


var zoombox = new Array(332,250);
var zoomareaW = 332;
var zoomareaH = 250;
  
function changePic(img) {
	zoomimgObj.attr("src", img.href);
	zoomimgObj.css("margin-left", "0px" );
	zoomimgObj.css("margin-top", "0px" );
	return false;
}

function changePic2(img) {
	zoomimgObj2.attr("src", img.href);
	zoomimgObj2.css("margin-left", "0px" );
	zoomimgObj2.css("margin-top", "0px" );
	return false;
}

$(window).ready(function(event) {
	zoomareaObj = $("#zoomarea");
	zoomimgObj = $("#zoomimg");
	var infoObj = $("#info");
	
	zoomareaObj.mousemove(function(event) {
							   
	    var cursor = {x:0, y:0};
		
		  offset = zoomareaObj.offset();
		  
		  	cursor.x = event.pageX - offset.left;
			cursor.y = event.pageY - offset.top;
			
		  //alert(zoomPosX)
		var zoomW = (zoomimgObj.width()-zoomareaW) / zoomareaW ;
		var zoomH = (zoomimgObj.height() - zoomareaH) / zoomareaH ;		

		var marginL = -Math.floor(cursor.x  * zoomW)+"px";
		var marginT = -Math.floor(cursor.y * zoomH)+"px";
				
		zoomimgObj.css("margin-left", marginL );
		zoomimgObj.css("margin-top", marginT );
		  
	});
	
	zoomareaObj.mouseenter(function() {  
		//infoObj.animate({ "opacity": 0}, "200");
		infoObj.hide();
	});
	zoomareaObj.mouseleave(function() {  
		//infoObj.animate({ "opacity": 1}, "200");
		infoObj.show();
	});
	
});

//var arrows1 = "<div id='arrows'><a href='#' id='tb1down' class='down'></a></div>";
var arrows1 = "<div id='arrows'><a href='#' id='tb1down' class='button'></a></div>";
var arrows2 = "<div id='arrows'><a href='#' id='tb2up' class='up'></a><a href='#' id='tb2down' class='down'></a></div>";
//var arrows3 = "<div id='arrows'><a href='#' id='tb3up' class='up'></a></div>";
var arrows3 = "<div id='arrows'><a href='#' id='tb3up' class='button'></a></div>";
var nojump = false;

function getPages(u,p,jump,p2,arg) {	

	$.get(u, function(data){
	if(p2) {
		if(p2 == "#textbox1") arrows = arrows1;
		if(p2 == "#textbox2") arrows = "";
		if(p2 == "#textbox3") arrows = arrows3;
		$(p2).html(arrows + cleanCode(data,"<!--startText2-->","<!--stopText2-->"));
	}
	
	if(p == "#textbox1") arrows = arrows1;
	if(p == "#textbox2") arrows = "";
	if(p == "#textbox3") arrows = arrows3;
	$(p).html(arrows + cleanCode(data,"<!--startText1-->","<!--stopText1-->"));	
			
	//zoompic
	if(arg == "fb") {
	
	$("#tb3up").text("Referenzen");
	$("#tb1down").text("Allgemein")
		
	zoomareaObj2 = $("#zoomarea2");
	zoomimgObj2 = $("#zoomimg2");
	infoObj2 = $("#info2");
	
	infoObj2.show();
		
	zoomareaObj2.mousemove(function(event) {
							   
	    var cursor = {x:0, y:0};
		
		  var offset = zoomareaObj2.offset();
		  
		  	cursor.x = event.pageX - offset.left;
			cursor.y = event.pageY - offset.top;
			
		  //alert(zoomPosX)
		var zoomW = (zoomimgObj2.width()-zoomareaW) / zoomareaW ;
		var zoomH = (zoomimgObj2.height() - zoomareaH) / zoomareaH ;		

		var marginL = -Math.floor(cursor.x  * zoomW)+"px";
		var marginT = -Math.floor(cursor.y * zoomH)+"px";
				
		zoomimgObj2.css("margin-left", marginL );
		zoomimgObj2.css("margin-top", marginT );
		  
	});
	
	zoomareaObj2.mouseenter(function() {  
		//infoObj.animate({ "opacity": 0}, "200");
		infoObj2.hide();
	});
	zoomareaObj2.mouseleave(function() {  
		//infoObj.animate({ "opacity": 1}, "200");
		infoObj2.show();
	});	
	
	
	//zoompic ende
	
	$('.reflink').click(function() {
	  getPages(this.href,'#textbox2','','','fbref');
	  return false;
	});
	
	$('#tb1down').click(function() {  
  		$(window).scrollTo('#textbox3', 800);
		return false;
	});
	$('#tb3up').click(function() {  
  		$(window).scrollTo('#textbox1', 800);
		return false;
	});
	
	}	
	
	if(arg == "fb2") {
	
	$('#arrows').hide();
		
	zoomareaObj2 = $("#zoomarea2");
	zoomimgObj2 = $("#zoomimg2");
	infoObj2 = $("#info2");
	
	infoObj2.show();
		
	zoomareaObj2.mousemove(function(event) {
							   
	    var cursor = {x:0, y:0};
		
		  var offset = zoomareaObj2.offset();
		  
		  	cursor.x = event.pageX - offset.left;
			cursor.y = event.pageY - offset.top;
			
		  //alert(zoomPosX)
		var zoomW = (zoomimgObj2.width()-zoomareaW) / zoomareaW ;
		var zoomH = (zoomimgObj2.height() - zoomareaH) / zoomareaH ;		

		var marginL = -Math.floor(cursor.x  * zoomW)+"px";
		var marginT = -Math.floor(cursor.y * zoomH)+"px";
				
		zoomimgObj2.css("margin-left", marginL );
		zoomimgObj2.css("margin-top", marginT );
		  
	});
	
	zoomareaObj2.mouseenter(function() {  
		//infoObj.animate({ "opacity": 0}, "200");
		infoObj2.hide();
	});
	zoomareaObj2.mouseleave(function() {  
		//infoObj.animate({ "opacity": 1}, "200");
		infoObj2.show();
	});	
	
	
	//zoompic ende
	
	
	}	
	
	if(arg == "fbref") {
		
	zoomareaObj = $("#zoomarea");
	zoomimgObj = $("#zoomimg");
	var infoObj = $("#info");
	infoObj.show();
	
	zoomareaObj.mousemove(function(event) {
							   
	    var cursor = {x:0, y:0};
		
		  offset = zoomareaObj.offset();
		  
		  	cursor.x = event.pageX - offset.left;
			cursor.y = event.pageY - offset.top;
			
		  //alert(zoomPosX)
		var zoomW = (zoomimgObj.width()-zoomareaW) / zoomareaW ;
		var zoomH = (zoomimgObj.height() - zoomareaH) / zoomareaH ;		

		var marginL = -Math.floor(cursor.x  * zoomW)+"px";
		var marginT = -Math.floor(cursor.y * zoomH)+"px";
				
		zoomimgObj.css("margin-left", marginL );
		zoomimgObj.css("margin-top", marginT );
		  
	});
	
	zoomareaObj.mouseenter(function() {  
		infoObj.hide();
	});
	zoomareaObj.mouseleave(function() {  
		infoObj.show();
	});
	
	}
	
	if(arg == "ref") {
		
	$('#arrows').hide();
	
	$('.reflink1').click(function() {
	  haus1func();
	  getPages(document.getElementById('haus1').href,'#textbox1','','#textbox3',"fb");
	  getPages(this.href,'#textbox2','#textbox2','','fbref');
	  return false;
	});
	
	$('.reflink2').click(function() {
	   haus2func();
	  getPages(document.getElementById('haus2').href,'#textbox1','','#textbox3',"fb");
	  getPages(this.href,'#textbox2','#textbox2','','fbref');
	  return false;
	});
	
	$('.reflink3').click(function() {
	   haus3func();
	  getPages(document.getElementById('haus3').href,'#textbox1','','#textbox3',"fb");
	  getPages(this.href,'#textbox2','#textbox2','','fbref');
	  return false;
	});
	
	$('.reflink4').click(function() {
	   haus4func();
	  getPages(document.getElementById('haus4').href,'#textbox1','','#textbox3',"fb");
	  getPages(this.href,'#textbox2','#textbox2','','fbref');
	  return false;
	});
	
	$('.reflink5').click(function() {
	   haus5func();
	  getPages(document.getElementById('haus5').href,'#textbox1','','#textbox3',"fb");
	  getPages(this.href,'#textbox2','#textbox2','','fbref');
	  return false;
	});
	
	$('.reflink6').click(function() {
	   haus6func();
	  getPages(document.getElementById('haus6').href,'#textbox1','','#textbox3',"fb");
	  getPages(this.href,'#textbox2','#textbox2','','fbref');
	  return false;
	});
	
	$('.reflink7').click(function() {
	   haus7func();
	  getPages(document.getElementById('haus7').href,'#textbox1','','#textbox3',"fb");
	  getPages(this.href,'#textbox2','#textbox2','','fbref');
	  return false;
	});
	
	$('.reflink0').click(function() {
	 alert("Referenz fehlt noch!")
	  return false;
	});
			
	}
	
	if(arg == "firma") {
		$('#arrows').hide();
		$('.sn').click(function() {
	  	getPages(this.href,'#textbox1','#stage','','firma');
		
	  	return false;
		});
	}
	
	if(arg == "kontakt") {
		$('#arrows').hide();
		$('.sn').click(function() {
	  	getPages(this.href,'#textbox1','#stage','','kontakt');		
	  	return false;
		});
		$('#kontaktform').submit(function() { 	
			$.post("kontakt.php", { 
				   anrede: $('input:radio[name=anrede]:checked').val(), 
				   vorname: $('#vorname').val(), 
				   nachname: $('#nachname').val(), 
				   firma: $('#firma').val(), 
				   telefon: $('#telefon').val(), 
				   email: $('#email').val(), 
				   abteilung: $('select option:selected').val(), 
				   ansprechpartner: $('#ansprechpartner').val(), 
				   nachricht: $('#nachricht').val(), 
				   submit: $('#submit').val()
			}, function(data){
				var ausgabe = cleanCode(data,"<!--errorstart-->","<!--errorstop-->")
				$("#errorausgabe").html(ausgabe);
				if(ausgabe.indexOf("Vielen Dank") != -1) $("#kontaktform").hide();
		   });
	  		return false; 
		});
	}
	
	if(jump) $(window).scrollTo( jump, 800 );
	
 });
}

function cleanCode(d,a,e) {
	d = d.substring(d.indexOf(a),d.indexOf(e))
	return d;
}

function clearBoxes() {
	$('#textbox1').html(" ");
	$('#textbox2').html(" ");
	$('#textbox3').html(" ");
}

//haus


var haus1on = false;
var haus2on = false;
var haus3on = false;
var haus4on = false;
var haus5on = false;
var haus6on = false;
var haus7on = false;
var haus8on = false;
var haus9on = false;

var lastnum = 0;
var animation = false;
var animationspeed = 200;

var hausfacts9 = new Array(300,142,805,-36,25);
var hausfacts8 = new Array(280,172,-20,-43,24);
var hausfacts7 = new Array(350,96,680,-24,18);
var hausfacts6 = new Array(330,120,190,-30,17);
var hausfacts5 = new Array(80,264,580,-66,22);
var hausfacts4 = new Array(344,100,60,-25,19);
var hausfacts3 = new Array(320,155,360,-39,20);
var hausfacts2 = new Array(320,160,550,-40,21);
var hausfacts1 = new Array(300,165,300,-42,23);

function lasthaus(n) {	
  	$('#haus'+lastnum).children(".tip").hide();
	if(lastnum == 1) {
		$('#haus1').animate( 
		 { marginLeft: (hausfacts1[2]+(hausfacts1[0]/4))+'px', marginTop: (hausfacts1[3]+(hausfacts1[1]/4))+'px', width: (hausfacts1[0]/2)+'px', height: (hausfacts1[1]/2)+'px' }, animationspeed, function() {
			// Animation complete.
		$('#haus1').css("z-index",hausfacts1[4]);
		  });
		haus1on = false;
	} else if(lastnum == 2) {
		$('#haus2').animate( 
  			 { marginLeft: (hausfacts2[2]+(hausfacts2[0]/4))+'px', marginTop: (hausfacts2[3]+(hausfacts2[1]/4))+'px', width: (hausfacts2[0]/2)+'px', height: (hausfacts2[1]/2)+'px' }, 300, function() {
		$('#haus2').css("z-index",hausfacts2[4]);
		  });
		haus2on = false;
	}else if(lastnum == 3) {
		$('#haus3').animate( 
  			 { marginLeft: (hausfacts3[2]+(hausfacts3[0]/4))+'px', marginTop: (hausfacts3[3]+(hausfacts3[1]/4))+'px', width: (hausfacts3[0]/2)+'px', height: (hausfacts3[1]/2)+'px' }, 300, function() {
		$('#haus3').css("z-index",hausfacts3[4]);
		  });
		haus3on = false;
	}else if(lastnum == 4) {
		$('#haus4').animate( 
  			 { marginLeft: (hausfacts4[2]+(hausfacts4[0]/4))+'px', marginTop: (hausfacts4[3]+(hausfacts4[1]/4))+'px', width: (hausfacts4[0]/2)+'px', height: (hausfacts4[1]/2)+'px' }, 300, function() {
		$('#haus4').css("z-index",hausfacts4[4]);
		  });
		haus4on = false;
	}else if(lastnum == 5) {
		$('#haus5').animate( 
  			 { marginLeft: (hausfacts5[2]+(hausfacts5[0]/4))+'px', marginTop: (hausfacts5[3]+(hausfacts5[1]/4))+'px', width: (hausfacts5[0]/2)+'px', height: (hausfacts5[1]/2)+'px' }, 300, function() {
		$('#haus5').css("z-index",hausfacts5[4]);
		  });
		haus5on = false;
	}else if(lastnum == 6) {
		$('#haus6').animate( 
  			 { marginLeft: (hausfacts6[2]+(hausfacts6[0]/4))+'px', marginTop: (hausfacts6[3]+(hausfacts6[1]/4))+'px', width: (hausfacts6[0]/2)+'px', height: (hausfacts6[1]/2)+'px' }, 300, function() {
		$('#haus6').css("z-index",hausfacts6[4]);
		  });
		haus6on = false;
	}else if(lastnum == 7) {
		$('#haus7').animate( 
  			 { marginLeft: (hausfacts7[2]+(hausfacts7[0]/4))+'px', marginTop: (hausfacts7[3]+(hausfacts7[1]/4))+'px', width: (hausfacts7[0]/2)+'px', height: (hausfacts7[1]/2)+'px' }, 300, function() {
		$('#haus7').css("z-index",hausfacts7[4]);
		  });
		haus7on = false;
	}else if(lastnum == 8) {
		$('#haus8').animate( 
  			 { marginLeft: (hausfacts8[2]+(hausfacts8[0]/4))+'px', marginTop: (hausfacts8[3]+(hausfacts8[1]/4))+'px', width: (hausfacts8[0]/2)+'px', height: (hausfacts8[1]/2)+'px' }, 300, function() {
		$('#haus8').css("z-index",hausfacts8[4]);
		  });
		haus8on = false;
	} else if(lastnum == 9) {
		$('#haus9').animate( 
  			 { marginLeft: (hausfacts9[2]+(hausfacts9[0]/4))+'px', marginTop: (hausfacts9[3]+(hausfacts9[1]/4))+'px', width: (hausfacts9[0]/2)+'px', height: (hausfacts9[1]/2)+'px' }, 300, function() {
		$('#haus9').css("z-index",hausfacts9[4]);
		  });
		haus9on = false;
	}
	lastnum = n;
}

function haus1func() {
	clearBoxes();
	if(lasthaus != 1) lasthaus(1);
	$('#haus1').css("z-index","32");
	haus1on = true;
  	$('#haus1').animate( 
  	{ marginLeft: hausfacts1[2]+'px', marginTop: hausfacts1[3]+'px', width: hausfacts1[0]+'px', height: hausfacts1[1]+'px'
  	}, animationspeed, function() {
	$('#haus1').children(".tip").show();
	});
}

function haus2func() {
	clearBoxes();
	if(lastnum != 2) lasthaus(2);
	$('#haus2').css("z-index","32");
	haus2on = true;
  	$('#haus2').animate( 
  	{ marginLeft: hausfacts2[2]+'px', marginTop: hausfacts2[3]+'px', width: hausfacts2[0]+'px', height: hausfacts2[1]+'px'
  	}, animationspeed, function() {
	$('#haus2').children(".tip").show();
	});
}

	
function haus3func() {
	clearBoxes();
	if(lastnum != 3) lasthaus(3);
	$('#haus3').css("z-index","32");
	haus3on = true;
  	$('#haus3').animate( 
  	{ marginLeft: hausfacts3[2]+'px', marginTop: hausfacts3[3]+'px', width: hausfacts3[0]+'px', height: hausfacts3[1]+'px'
  	}, animationspeed, function() {
	$('#haus3').children(".tip").show();
	});
}
	
function haus4func() {
	clearBoxes();
	if(lastnum != 4) lasthaus(4);
	$('#haus4').css("z-index","32");
	haus4on = true;
  	$('#haus4').animate( 
  	{ marginLeft: hausfacts4[2]+'px', marginTop: hausfacts4[3]+'px', width: hausfacts4[0]+'px', height: hausfacts4[1]+'px'
  	}, animationspeed, function() {
	$('#haus4').children(".tip").show();
	});
}

	
function haus5func() {
	clearBoxes();
	if(lastnum != 5) lasthaus(5);
	$('#haus5').css("z-index","32");
	haus5on = true;
  	$('#haus5').animate( 
  	{ marginLeft: hausfacts5[2]+'px', marginTop: hausfacts5[3]+'px', width: hausfacts5[0]+'px', height: hausfacts5[1]+'px'
  	}, animationspeed, function() {
	$('#haus5').children(".tip").show();
	});
}

function haus6func() {
	clearBoxes();
	if(lastnum != 6) lasthaus(6);
	$('#haus6').css("z-index","32");
	haus6on = true;
  	$('#haus6').animate( 
  	{ marginLeft: hausfacts6[2]+'px', marginTop: hausfacts6[3]+'px', width: hausfacts6[0]+'px', height: hausfacts6[1]+'px'
  	}, animationspeed, function() {
	$('#haus6').children(".tip").show();
	});
}

function haus7func() {
	clearBoxes();
	if(lastnum != 7) lasthaus(7);
	$('#haus7').css("z-index","32");
	haus7on = true;
  	$('#haus7').animate( 
  	{ marginLeft: hausfacts7[2]+'px', marginTop: hausfacts7[3]+'px', width: hausfacts7[0]+'px', height: hausfacts7[1]+'px'
  	}, animationspeed, function() {
	$('#haus7').children(".tip").show();
	});
}

function haus8func() {
	clearBoxes();
	if(lastnum != 8) lasthaus(8);
	$('#haus8').css("z-index","32");
	haus8on = true;
  	$('#haus8').animate( 
  	{ marginLeft: hausfacts8[2]+'px', marginTop: hausfacts8[3]+'px', width: hausfacts8[0]+'px', height: hausfacts8[1]+'px'
  	}, animationspeed, function() {
	$('#haus8').children(".tip").show();
	});
}


function haus9func() {
	clearBoxes();
	if(lastnum != 9) lasthaus(9);
	$('#haus9').css("z-index","32");
	haus9on = true;
  	$('#haus9').animate( 
  	{ marginLeft: hausfacts9[2]+'px', marginTop: hausfacts9[3]+'px', width: hausfacts9[0]+'px', height: hausfacts9[1]+'px'
  	}, animationspeed, function() {
	$('#haus9').children(".tip").show();
	});
}
