function calc(){
	var dist = $('#dist');
	var wheight = $(window).height();
	distheight = (parseInt(wheight)-730)/2;
	//alert(distheight);
	dist.css('height',distheight);
}

function change(z,name){
	 // counter
     var i = 0;
	 var img = $('#nav_'+name);
     // create object
     imageObj = new Image();

     // set image list
     images_on = new Array();
     images_on['startseite']="img/startseite_b.gif";
     images_on['projekte']="img/projekte_b.gif";
     images_on['kontakt']="img/kontakt_b.gif";
     images_on['links']="img/links_b.gif";
	 images_on['impressum']="img/impressum_b.gif";
	 
	 images = new Array();
     images['startseite']="img/startseite_a.gif";
     images['projekte']="img/projekte_a.gif";
     images['kontakt']="img/kontakt_a.gif";
     images['links']="img/links_a.gif";
	 images['impressum']="img/impressum_a.gif";


     // start preloading
     for(i=0; i<=4; i++){
     	imageObj.src=images_on[i];
		imageObj.src=images[i];
     }
	 
	if(z==1){
		img.attr('src',images_on[name]);
	}else{
		img.attr('src',images[name]);
	}
}
function preload(){
	prloadObj = new Image();
	 photos = new Array();
     photos['bild0']="img/photos_small/thb_abz.jpg";
	 photos['bild1']="img/photos_small/thb_belleile.jpg";
	 photos['bild2']="img/photos_small/thb_foto.jpg";
	 photos['bild3']="img/photos_small/thb_kurvilla.jpg";
	 photos['bild4']="img/photos_small/thb_mackenbach_bj.jpg";
	 photos['bild5']="img/photos_small/thb_mainzerstr.jpg";
	 photos['bild6']="img/photos_small/thb_riwa.jpg";
	 photos['bild7']="img/photos_small/thb_schaefer.jpg";
	 photos['bild8']="img/photos_small/thb_worms.jpg";
	 photos['bild9']="img/photos_small/thb_mackenbach_fj.jpg";
	 
	 photos['bild10']="img/pflinks1.gif";
	 photos['bild11']="img/pflinks2.gif";
	 photos['bild12']="img/pfrechts1.gif";
	 photos['bild13']="img/pfrechts2.gif";

	photos['bild14']="img/thb_test.jpg";
	 
	 // start preloading
     for(i=0; i<=13; i++){
     	prloadObj.src=photos['bild'+i];
     }
}
var pos = 0;
function scroll(dir){
	var countpic = 10;
	var bilder = new Array(
		"mainzerstr",	
		"mackenbach_bj",
		"mackenbach_fj",
		"riwa",
		"kurvilla",
		"abz",
		"schaefer",
		"foto",
		"belleile",
		"worms",
		"test"		
	);
	var text = new Array(
		"Neubau von drei Verbrauchermärkten in Kaiserslautern",
		"Planung für sechs Doppelhaushälften in Mackenbach",
		"Planung für vier Doppelhaushälften in Mackenbach",
		"Umbau und Renovierung denkmalgeschützes Wohn- und Geschäftshaus",
		"Hotel Kurvilla Sickingen, Renovierung, Modernisierung und Neugestaltung der Zimmer Landstuhl",
		"Hallenerweiterung mit Büro- und Ausstellungsraum in Ramstein",
		"Anbau Büro und Ausstellungsraum an Werkstattgebäude in Kaiserslautern",
		"Renovierung und Umnutzung einer ehemaligen Fischräucherei in ein Fotostudio",
		"Parc de Bordilla Gesamtplanung einer Ferienhaussiedlung mit 60 Einheiten in Frankreich, Belle-Ile en Mer",
		"Planung Nahversorgungs- und Pflegeeinrichtung in Worms"
	);
	if(dir == 'v'){
		pos = pos+1;
	}
	if(dir == 'b'){
		pos = pos-1;
	}
	if(pos < 1){
		$("#pfeilback").html('');
	}else{
		$("#pfeilback").html('<img src="img/pflinks1.png" class="png" width="19" height="19" alt="" border="0" onclick="scroll(\'b\');"  onmouseover="this.src=\'img/pflinks2.gif\';" onmouseout="this.src=\'img/pflinks1.gif\';" />');
	}
	if(pos == countpic-3){
		$("#pfeilvor").html('');
	}else{
		$("#pfeilvor").html('<img src="img/pfrechts1.png" class="png" width="19" height="19" alt="" border="0" onclick="scroll(\'v\');"  onmouseover="this.src=\'img/pfrechts2.gif\';" onmouseout="this.src=\'img/pfrechts1.gif\';" />');
	}

	
	
	$("#picwrapper1 .piccontainer").fadeOut(500, function() {
		$(this).html('<div class="bild"><img src="img/photos_small/thb_'+bilder[pos]+'.jpg" width="165" height="110"  /></div><div class="text">'+text[pos]+'</div>');
		$(this).fadeIn(500);
		$(this).click(function(){
			location.href='projekt_detail_'+bilder[pos]+'.htm';
		});
	});

	
	$("#picwrapper2 .piccontainer").fadeOut(500, function() {
		$(this).html('<div class="bild"><img src="img/photos_small/thb_'+bilder[pos+1]+'.jpg" width="165" height="110"  /></div><div class="text">'+text[pos+1]+'</div>');
		$(this).fadeIn(500);
		$(this).click(function(){
			location.href='projekt_detail_'+bilder[pos+1]+'.htm';
		});
	});

	
	$("#picwrapper3 .piccontainer").fadeOut(500, function() {
		$(this).html('<div class="bild"><img src="img/photos_small/thb_'+bilder[pos+2]+'.jpg" width="165" height="110"  /></div><div class="text">'+text[pos+2]+'</div>');
		$(this).fadeIn(500);
		$(this).click(function(){
			location.href='projekt_detail_'+bilder[pos+2]+'.htm';
		});
	});
}

function showPic(c,p,pc){
	var countpics = pc;
	for(i = 1;i < countpics+1;i++){
		$('#picnav'+i).html('&nbsp;'+i+'&nbsp;');
	}
	$('#picnav'+c).html('<b>&nbsp;'+c+'&nbsp;</b>');
	$("#ppic").fadeOut(500, function(){
		$(this).html('<img src="img/photos_big/'+p+'/p_'+p+c+'.jpg" />');
		$(this).fadeIn(500);
	});
}

function checkForm(){
	var tel = $("#phone").val();
	var mail = $("#email").val();
	var msg = $("#nachricht").val();
	if(tel == '' && mail == ''){
		alert('Bitte geben Sie eine Telefonnummer oder eine E-Mail-Adresse an');
	}else{
	 $.ajax({
			   type: "POST",
			   url: "sendmail.php",
			   data: "tel="+tel+"&mail="+mail+"&msg="+encodeURIComponent(msg),
			   success: function(nachr){
			   	$("#phone").attr('value','');
				$("#email").attr('value','');
				$("#nachricht").attr('value','');
			     alert(nachr);
			   }
			 });
	}
}
var startpos = 0;
function scrollstart(){
	var countpic = 1;
	var bilder = new Array(
		"fackelwoog_01"

	);
	var text = new Array(
		"Das ehemalige B&uuml;rogeb&auml;ude in der Fackelwoogstra&szlig;e wird zurzeit in ein Wohn- und Gesch&auml;ftshaus umgebaut. Die zwischen 200 m&sup2; und 270 m&sup2;  gro&szlig;en Etagen werden in Wohnfl&auml;chen neu aufgeteilt. Im Erdgeschoss entsteht ein gro&szlig;r&auml;umiges B&uuml;ro, in den Obergeschossen Mietwohnungen."
	);
	
	
	
	startpos++;
	if(startpos == countpic){
		startpos = 0;
	}
}