$(document).ready(function (){
	//Reitermenue umsetzen
	$("#telephoneSearch").click(function(){
	    if($(this).parent().attr("class") == "inact"){
	        $(".act").attr("class", "inact");
	        $(this).parent().attr("class", "act");
	        $("#telephoneLayer").show();
	        $("#personLayer").hide();
	    }
	});
	$("#personSearch").click(function(){
	    if($(this).parent().attr("class") == "inact"){
	        $(".act").attr("class", "inact");
	        $(this).parent().attr("class", "act");
	        $("#telephoneLayer").hide();
	        $("#personLayer").show();
	    }      
	});
	
	//Zeilen bei Hover highlighten
	$('.searchTable > tbody > tr').hover(function() {
		//mouseover
		$(this).css("background-color","#eee");
		},
		function() {
		//mouseout
		$(this).css("background-color","#fff");
		}
	);
	
	//Telefon A-Z umsetzen
	$('.letters a').click(function () {
		var hash=$(this).attr("href").substr(1);
		$('#buchstabe').val(hash);		
    $('#letterForm').submit();
	} );
	
	//Eintraege pro Seite verarbeiten
	$('.iPPselect').change(function() {
		$('.iPP').val($(this).val());
		if ( $("#telephoneLayer").is(':visible') )
			$('#letterForm').submit();
	  if ( $("#personLayer").is(':visible') )
	  	$('#searchForm').submit();
	});
	
	//Schnelleinstieg ermoeglichen: telefon.html#A
	if (document.location.hash) {
		var hash=document.location.hash.substr(1);
		$('#buchstabe').val(hash);		
	  $('#letterForm').submit();
  }
	
});
