$(document).ready(function() {
	
	
	//fade in and out of google map in contact
	
	$("#dlh_googlemap_21").css("overflow","hidden");
	$("#dlh_googlemap_22").css("overflow","hidden");
	$("#dlh_googlemap_23").css("overflow","hidden");
	$("#dlh_googlemap_28").css("overflow","hidden");
	
	
	$("#kontakt_dresden .ce_text span.map").click( function () {
		if ($("#dlh_googlemap_21").css("height") == "0px") {
			$("#dlh_googlemap_21").animate({height: '300px'});
		} else if ($("#dlh_googlemap_21").css("height") == "300px") {
			$("#dlh_googlemap_21").animate({height: '0px'});
		}
	})
	
		
	
	$("#kontakt_berlin .ce_text span.map").click( function () {
		if ($("#dlh_googlemap_22").css("height") == "0px") {
			$("#dlh_googlemap_22").animate({height: '300px'});
		} else if ($("#dlh_googlemap_22").css("height") == "300px") {
			$("#dlh_googlemap_22").animate({height: '0px'});
		}
	})
	
	$("#kontakt_magdeburg .ce_text span.map").click( function () {
		if ($("#dlh_googlemap_23").css("height") == "0px") {
			$("#dlh_googlemap_23").animate({height: '300px'});
		} else if ($("#dlh_googlemap_23").css("height") == "300px") {
			$("#dlh_googlemap_23").animate({height: '0px'});
		}
	})
	
	$("#kontakt_dresden .ce_text span.map_en").click( function () {
		if ($("#dlh_googlemap_28").css("height") == "0px") {
			$("#dlh_googlemap_28").animate({height: '300px'});
		} else if ($("#dlh_googlemap_28").css("height") == "300px") {
			$("#dlh_googlemap_28").animate({height: '0px'});
		}
	})
	
	//toggle functionality
	$("#content .geschaeftsfuehrung .ce_text ul").css("display","none");
	$("#content .geschaeftsfuehrung .ce_text h5").css("cursor","pointer");
	

	$("#content .geschaeftsfuehrung .ce_text h5").click(function () {
      $(this).next("ul").toggle("normal");
    });
	
	$("#content .geschaeftsfuehrung .ce_text h5").toggle(function(){
		$(this).addClass("active_headline");
	}, function () {
		$(this).removeClass("active_headline");
	});

		
	//animation for navigation
	/*$('#link_company').hover(function() {
		
		if($('.overlay').css("display") == "none") {
			$('.overlay').css({opacity:0.2, display:"none"}).fadeIn(600);	
		}
			
    	$("#togglenav_company").slideDown("normal");
		
 	}, function() {
		$("#togglenav_company").slideUp("fast");
	});

	$('#link_portfolio').hover(function() {
 		
		if($('.overlay').css("display") == "none") {
			$('.overlay').css({opacity:0.2, display:"none"}).fadeIn(600);	
		}
		
		$("#togglenav_portfolio").slideDown("normal");
	}, function() {
		$("#togglenav_portfolio").slideUp("fast");
	});
	
	$('#link_reference').hover(function() {
 		
		if($('.overlay').css("display") == "none") {
			$('.overlay').css({opacity:0.2, display:"none"}).fadeIn(600);	
		};
		
	}, function() {
	});
		
	$('#navigation').hover(function() {
		
 	},function(event) {
		//fade out overlay
		$('.overlay').fadeOut(600); 
	
	});*/
	
	//animation for navigation
	$('#link_company').click(function() {
		$('#togglenav_portfolio').hide();
		$('#togglenav_company').slideToggle('medium');
    	//$("#togglenav_company").slideDown("normal");
 	//}, function() {
		//$("#togglenav_company").hide();
	});

	$('#link_portfolio').click(function() {
		$('#togglenav_company').hide();
		$('#togglenav_portfolio').slideToggle('medium');
 		//$("#togglenav_portfolio").slideDown("normal");
	//}, function() {
		//$("#togglenav_portfolio").hide();
	});
	
	$('#link_reference').hover(function() {
 		
	});
		
	/*$('#navigation').click(function() {
		$('.overlay').css({opacity:0.1, display:"none"}).fadeIn(600);
 	},function(event) {
		//fade out overlay
		$('.overlay').fadeOut(600); 
	
	});*/


	
	//image gallery
	if ($("#gallery").length > 0) {
		$('#gallery').galleryView();	
	}
		
	//set active links in navigation
	
	
	$(".company_link").attr("id","navi_company_link");
	$(".portfolio_link").attr("id","navi_portfolio_link");
	$(".reference_link").attr("id","navi_reference_link");
	
	if ($("body").attr("class") == "company") {
		$(".company_link").attr("id","navi_company_link_active");
	} else if ($("body").attr("class") == "portfolio") {
		$(".portfolio_link").attr("id","navi_portfolio_link_active");
	} else if ($("body").attr("class") == "reference") {
		$(".reference_link").attr("id","navi_reference_link_active");
	}
	
	$("#ctrl_keywords").val("Suche");
		
	//Englisches Kontaktformular Senden-Btn und Löschen-Btn
	$("#contact-form146 #submit_btn").text("Submit");
	$("#contact-form146 #delete_btn").text("Delete");
 
 
});

function validateForm(){
	with(document.forms[0]){
		$(".errorMessage").css("display","none");
		if(title_woman.checked == false && title_man.checked == false) {
			$("#errorTitle").css("display","block");
			return false;
		} else if(firstname.value == "") {
			$("#errorFirstname").css("display","block");
			return false;
		} else if(lastname.value == "") {
			$("#errorLastname").css("display","block");
			return false;
		} else if(email.value == "") {
			$("#errorEmail").css("display","block");
			return false;
		}
	} 
} 

	



