$(document).ready(function(){
	$(".text .images a,a[rel=lightbox]").lightBox({
		fixedNavigation:true,
		imageLoading:images.loading,
		imageBtnPrev:images.prev,
		imageBtnNext:images.next,
		imageBtnClose:images.close,
		imageBlank:images.blank,
		txtImage:"Bild",
		txtOf:" von "
	});
	
	$("div.news").draggable({delay:0.3}).css("opacity","0.85");
	
	$("#contact").validate({
		highlight: function(element, errorClass) {
			$(element).addClass(errorClass).mouseover(function(e){
				$("div.pflicht")
					.css("top",(parseInt(e.clientY)-47)+"px")
					.css("left",(parseInt(e.clientX)-8)+"px")
					.show();
			}).mousemove(function(e){
				$("div.pflicht")
					.css("top",(parseInt(e.clientY)-47)+"px")
					.css("left",(parseInt(e.clientX)-8)+"px");
			}).mouseout(function(){
				$("div.pflicht").hide();
			});
	  	},
	  	unhighlight: function(element, errorClass, validClass) {
	  		$(element).removeClass(errorClass).mouseover(function(){
				$("div.pflicht").hide();
			}).mousemove(function(){
				$("div.pflicht").hide();
			});			 	
	  	},			  				  						
		errorPlacement: function(error, element) {
			
		}															
	});
	
	$("map#Choose area").click(function(){
		$("div.popup").show();
		$("div.houses").hide();
		$("div#"+$(this).attr("class")).show();
		return false;
	});
	
	$("div.houses table tbody tr").mouseover(function(){
		if($(this).attr("class")!="nocoords")
			$(this).parents("div.houses").children("img.prev").attr("src",$(this).attr("class"));
		$(this).children("td").css("background-color","#e3b5bf");
	}).mouseout(function(){
		$(this).children("td").css("background-color","white");
	});
	
	$("a.close").click(function(){
		$(this).parents(".toclose").hide();
		return false;
	});
	
	$("a.newsbutton").click(function(){
		$("div.news").show();
		return false;
	});
	$("a.openform").click(function(){
		$("form#contact").show();
		return false;
	});
});
