// JavaScript Document

$(document).ready(function(){
	
	//Styleswitcher laden
	loadStyle();
	
	
	//Dropdown List Function
	
	if ($(".dropdown_list_title")) {
		
		var dropdown_list_items = $(".dropdown_list_title");
		
	
		jQuery.each(dropdown_list_items, function() {
							
			var dropdown_text = $(this).next();								  
			$(dropdown_text).hide();								  
				
			$(this).click(function () {
								 
				$(dropdown_text).slideToggle("fast");
				
				if( $(this).hasClass("dropdown_list_title_open") ) {
					$(this).removeClass("dropdown_list_title_open")
				}
				else {
					$(this).addClass("dropdown_list_title_open")
				}
				
				
				
   			 });
			
			
		})
		
		
	}
	
	
	//clear searchfield on click
	searchlabeltext = $("input#search_input").val();
	
	$("input#search_input").focus(function() {
	  if(this.value==searchlabeltext) this.value='';
	});
    
	$("input#search_input").blur(function() {
	  if(this.value=='') this.value=searchlabeltext;
	});	
	
	$("div.projektteam-mitglied h5").click(function(){
		$(this).next().toggle();
	});
	
	
	//download checkboxen bei titleclick checken
	
	$(".pdfshop_headline").hover(function(){
		
		$(this).css({cursor:"pointer"});
	},
	function(){
		$(this).css({cursor:"none"});
	
	});

	
	$(".pdfshop_headline").toggle(function(){
		
		$(this).prev().find("input").attr("checked", "checked");
	},
	function(){
		$(this).prev().find("input").removeAttr("checked");
	
	});
	
	
	//Nachträglich Hinzufügen des _blank Attributes für Buttons
	$("a.button").each(function (){
		if (($(this).attr("href").indexOf("http://")) == 0) {
			$(this).attr("target","_blank");
		}
		else {}
	});
	
		
}); 


