$(document).ready(function() {


	
		
		$(document).pngFix(); 
		
		// Widget
		
		$('div.widget form').submit(function() {

			return false;
		});
		
		/* Trainingspartnersuche Anfang */
		var aktuell = $('p.bigimage img').attr('src');
	
		
		var fertigbild = $('p.bigimage img').find(":contains('-kl')");
		
		/*alert(fertigbild);
		$(aktuell).each(function() {
			$(this).contains('-kl')
		  });*/

		
		var Bild = './img/bundesrepublik.png'
		
		if(!$('div.anmeldenseite').length) {
		
		$('input.submit').unwrap();
		
		}
		


		
		MM_preloadImages('./img/hamburg.png','./img/cta_small.png','./img/cta_small_left.png','./img/cta_small_right.png','./img/cta_small_hover.png','./img/cta_small_left_hover.png','./img/cta_small_right_hover.png','./img/cta_head.jpg','./img/cta_head_hover.jpg','./img/schleswig.png','./img/mecklenburg.png','./img/berlin.png','./img/brandenburg.png','./img/hessen.png','./img/niedersachsen.png','./img/saarland.png','./img/anhalt.png','./img/bayern.png','./img/sachsen.png','./img/wuerttemberg.png','./img/westfalen.png','./img/thueringen.png')

			/*
			*   Examples - images
			*/
			
			/*jQuery('#training').jcarousel({
				vertical: true,
				scroll: 13,
				buttonNextCallback: function() {
					var $button = $('.jcarousel-skin-tango .jcarousel-next');
					if($button.hasClass('jcarousel-next-disabled-vertical')) {
						$button.hide();
					} else {
						$button.show();
					}
				},
				buttonPrevCallback: function() {
					var $button = $('.jcarousel-skin-tango .jcarousel-prev');
					if($button.hasClass('jcarousel-prev-disabled-vertical')) {
						$button.hide();
					} else {
						$button.show();
					}
				}
			});*/
			
			//Show Banner
			$(".main_image .desc").show(); //Show Banner
			$(".main_image .block").animate({ opacity: 0.85 }, 1 ); //Set Opacity

			//Click and Hover events for thumbnail list
			$(".image_thumb ul li:first").addClass('active'); 
			$(".image_thumb ul li").click(function(){ 
				//Set Variables
				var imgAlt = $(this).find('img').attr("alt"); //Get Alt Tag of Image
				var imgTitle = $(this).find('a').attr("href"); //Get Main Image URL
				var imgDesc = $(this).find('.block').html(); 	//Get HTML of block
				var imgDescHeight = $(".main_image").find('.block').height();	//Calculate height of block	
				
				if ($(this).is(".active")) {  //If it's already active, then...
					return false; // Don't click through
				} else {
					//Animate the Teaser				
					$(".main_image .block").animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
						$(".main_image .block").html(imgDesc).animate({ opacity: 0.85,	marginBottom: "0" }, 250 );
						$(".main_image embed").attr({ src: imgTitle , alt: imgAlt});
					});
				}
				
				$(".image_thumb ul li").removeClass('active'); //Remove class of 'active' on all lists
				$(this).addClass('active');  //add class of 'active' on this list only
				return false;
				
			}) .hover(function(){
				$(this).addClass('hover');
				}, function() {
				$(this).removeClass('hover');
			});
					
			//Toggle Teaser
			$("a.collapse").click(function(){
				$(".main_image .block").slideToggle();
				$("a.collapse").toggleClass("show");
			});



			$(".fancybox").fancybox({
				'titlePosition'		: 'inside',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none'
			})
			
			
			$('tr.SRLightRow td:nth-child(2),tr.SRLightRow td:nth-child(4),tr.SRLightRow td:nth-child(5),tr.SRDarkRow th:nth-child(2),tr.SRDarkRow th:nth-child(4),tr.SRDarkRow th:nth-child(5)').remove();
			$('table.bioTableAlt tr td:nth-child(4),table.bioTableAlt tr th:nth-child(4)').remove();
			$('table.bioTableAlt tr:gt(20), table#SRTable tr:gt(20)').remove();
			$('table#SRTable').removeAttr('width');
			$('table.bioTableAlt a, table#SRTable a').removeAttr('href');
			$('table.bioTableAlt tr td:first-child, table#SRTable tr td:first-child').addClass('rang');
			$('table.bioTableAlt tr td:nth-child(2), table#SRTable tr td:nth-child(2)').addClass('name');
			$('table.bioTableAlt tr td:nth-child(3), table#SRTable tr td:nth-child(3)').addClass('punkte');
			$('table.bioTableAlt tr td:nth-child(4), table#SRTable tr td:nth-child(4)').addClass('gespielt');
			
			$('table.bioTableAlt tr.bioTableHead td.rang').text('Rang');
			$('table.bioTableAlt tr.bioTableHead td.name').text('Name');
			$('table.bioTableAlt tr.bioTableHead td.punkte').text('Punkte');
			$('table.bioTableAlt tr.bioTableHead td.gespielt').text('Turniere');
			
			$('table#SRTable th:nth-child(1)').text('Rang');
			$('table#SRTable th:nth-child(2)').text('Name');
			$('table#SRTable th:nth-child(3)').text('Punkte');
			$('table#SRTable th:nth-child(4)').text('Turniere');
	
			
			
			$('div.trainingssuche ul.suborgan').each(function(i){
				$(this).attr('rel',1 + i);
			});
			
			$('ul.suborgan, div#trainingssuche div.column3').hide();
			$('div.newsteaser div.newsitem:gt(1)').remove();
			$('div.newsteaserbottom div.newsitem:gt(1)').remove();
			$('div.border div.newsitem:gt(1)').remove();
			
			$('div.cta_small_vorne').hover(function() {
				$(this).children().addClass('active')
			},function(){
				$(this).children().removeClass('active')
			});

			
			
			
			$('div.trainingssuche ul.organ li').click(function(){
				var staerke = $(this).attr('rel');
				$('div#trainingssuche div.column3:eq(1)').show();
				$('div#trainingssuche div.column3:eq(1) h3').show();
				$('ul.suborgan').show();
				$(this).addClass('active').siblings().removeClass('active');
				$('p.staerke').text(staerke);
				$('ul.suborgan').empty();
			});
			
			
			$('div.trainingssuche div.col1 area').click(function(){
				var name = $(this).attr('title');
				$('div.trainingssuche div.column3').hide();
				$('div.trainingssuche div.column3 li').removeClass('active');
				var bild = $(this).attr('alt');
				$('p.auswahl').text('Du hast folgendes Bundesland ausgewaehlt: ' + name);

				$('div.trainingssuche div.col1 area').hide();
				$('div.trainingssuche div.column3:first').show();
				
				Bild = './img/' + bild + '.png';
				$('p.land').empty();
				$('p.land').text(bild);
				
				$(this).addClass('active');
				var text = $('p.land').text();
										
			});


			
			$("div.trainingssuche area").hover(function(){
				var alt = $(this).attr('alt'); 
				var name = $(this).attr('title');
				
				if(alt=='hamburg') {
					$('div.trainingssuche #imagemap').attr('src','./img/hamburg.png');
				}
				if(alt=='brandenburg') {
					$('div.trainingssuche #imagemap').attr('src','./img/brandenburg.png');
				}
				if(alt=='bremen') {
					$('div.trainingssuche #imagemap').attr('src','./img/bremen.png');
				}
				if(alt=='mecklenburg') {
					$('div.trainingssuche #imagemap').attr('src','./img/mecklenburg.png');
				}
				if(alt=='schleswig') {
					$('div.trainingssuche #imagemap').attr('src','./img/schleswig.png');
				}
				if(alt=='rheinland') {
					$('div.trainingssuche #imagemap').attr('src','./img/rheinland.png');
				}
				if(alt=='saarland') {
					$('div.trainingssuche #imagemap').attr('src','./img/saarland.png');
				}
				if(alt=='hessen') {
					$('div.trainingssuche #imagemap').attr('src','./img/hessen.png');
				}
				if(alt=='thueringen') {
					$('div.trainingssuche #imagemap').attr('src','./img/thueringen.png');
				}
				if(alt=='wuerttemberg') {
					$('div.trainingssuche #imagemap').attr('src','./img/wuerttemberg.png');
				}
				if(alt=='niedersachsen') {
					$('div.trainingssuche #imagemap').attr('src','./img/niedersachsen.png');
				}
				if(alt=='sachsen') {
					$('div.trainingssuche #imagemap').attr('src','./img/sachsen.png');
				}
				if(alt=='berlin') {
					$('div.trainingssuche #imagemap').attr('src','./img/berlin.png');
				}
				if(alt=='anhalt') {
					$('div.trainingssuche #imagemap').attr('src','./img/anhalt.png');
				}
				if(alt=='bayern') {
					$('div.trainingssuche #imagemap').attr('src','./img/bayern.png');
				}
				if(alt=='westfalen') {
					$('div.trainingssuche #imagemap').attr('src','./img/westfalen.png');
				}
				
			},function(){
				
				if(!$(this).hasClass('active')) {
					// Bild zurueck wechseln
					
					$('div.trainingssuche #imagemap').attr('src', Bild);
					
				}
				
			});
			
			
			
			$('.fotoslider').nivoSlider({
		effect:"fade",
        slices:15,
        boxCols:8,
        boxRows:4,
        animSpeed:200,
        startSlide:0,
        directionNav:true,
        directionNavHide:true,
        controlNav:true,
        controlNavThumbs:false,
        controlNavThumbsFromRel:false,
        keyboardNav:true,
        pauseOnHover:true,
        manualAdvance:false,
        prevText: 'Zur&uuml;ck', // Prev directionNav text
        nextText: 'Weiter', // Next directionNav text
        afterChange: function(){
        	var commenthoehe = $('div.comments').height();
        	$('div.ausgleich').height(commenthoehe + 70);
        }
    });
    
    var commenthoehe = $('div.comments').height();
        	$('div.ausgleich').height(commenthoehe + 70);
    
    

			
			 $('ul.organ li a').click(function() {                       

						   var $land = $('p.land').text();

						   // var $staerke = $('p.staerke').text();
						   var $staerke = $(this).parent('li').attr('rel');
						  


						   jQuery.ajax({

										   url: 'http://tennis-live.eu/trainingfinder.php',

										   cache: false,

										   data: 'land='+$land+'&staerke='+$staerke,

										   context: $(this),

										   dataType: 'xml',

										   success: function(data, textStatus, XMLHttpRequest){

														  // JS-Funktion zum Ueberarbeiten der Anzeige
														  var $list_element = $('ul.spielerliste');

														  $(data).find('output spielerliste spieler').each(function(i){
																			var $name = $(this).find('name').text();
																			var $ort = $(this).find('ort').text();
																			var $nachname = $(this).find('nachname').text();
																			var $user = $(this).find('user').text();
																		
																		  $list_element.append('<li><a style="line-height: 20px;" href="index.php?d=user&s='+$user+'"><strong>' + $name + ' ' + $nachname + '</strong><br><span style="font-size: 10px;">aus <span class="bundesland">' + $ort +'</span></span></a></li>');

														  });
														  $('span.bundesland:empty').parent().remove();
														  $('input#id_search').quicksearch('ul.spielerliste li');
														  $('input#id_search').removeAttr('style');
														  $('ul.spielerliste').removeAttr('style');
																												       
														 if($('ul.spielerliste li:eq(7)').length) {
																$('ul.spielerliste').removeAttr('style').attr('style', 'max-height: 493px; overflow-y: scroll; width: 218px;')
																$('input#id_search').attr('style', 'width: 212px;')
															}
															
															
														 if($('ul.spielerliste:empty').length) {
															$('ul.spielerliste').html('<p style="color: white; font-weight: bold;">Es wurden keine Spieler gefunden</p>');
														} 
														  
										   },
										   
										   error: function(jqXHR, textStatus, errorThrown) {
											  alert('Handler for .error() called.'+ textStatus)
											}


						   });
						    	
						 

		   });
			
			
			
			
		   
		   $('p.onlinegetter:contains("offline")').parent().remove();
			
		
		
		/* Trainingspartnersuche Ende */
		
		$('input[type="checkbox"], input[type="radio"]').addClass('ohnebg');


		/*$("#default-usage-select").selectbox().bind('change', function(){
			$('<div>Value of #default-usage-select changed to: '+$(this).val()+'</div>').appendTo('#demo-default-usage .demoTarget').fadeOut(5000, function(){
				$(this).remove();
			});
		});*/
		
	  $('a[rel*=facebox]').facebox({
        loading_image : 'loading.gif',
        close_image   : 'closelabel.gif'
      }) 


	$('.ergebnisdiv').hide();
		$('.showbox').click(function() {
		//$('#box').slideToggle(300);
			
			$('div.auswertunghide').slideToggle();
			$('.ergebnisdiv').slideToggle();
	});
	$(function() {
        $("a.showbox").toggle(function (){
            $("a.showbox").text("Umfragebox schliessen")
            .stop();
        }, function(){

            $("a.showbox").text("An der Umfrage teilnehmen")
            .stop();
        });
    });



	$(".tabbies").accessibleTabs({
            tabhead:'h2',
            fx:"show",
            fxspeed: 0,
			saveState:true
        });
	
	
	/*jQuery("#mycarousel").jcarousel({
        scroll: 3,
        initCallback: mycarousel_initCallback,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
	
	$('.jcarousel-control a:first').addClass('active');
	$('.jcarousel-control a').click( function() {
		$(this).siblings('.active')
		.removeClass('active');
		$(this).addClass('active');
	});*/ 
	
	$('div#tabbie1 table:eq(3)').addClass('paddingbottom');
	
	$('input.file').mouseenter(function() {
		$('div.fakefile').addClass('fakefilehover');
	}); 
	
	$('input.file').mouseleave(function() {
		$('div.fakefile').removeClass('fakefilehover');
	}); 
	
	$("div.gaestebuchseite").not(':contains(a)').remove();
	$("div.freundeseite").not(':contains(a)').remove();
	$("div.fotosseite").not(':contains(a)').remove();
	$("div.postausgangseite").not(':contains(a)').remove();
	$("div.postgangseite").not(':contains(a)').remove();
	$("div.forumuebersichtseite").not(':contains(a)').remove();
	$("div.forumdetailseite").not(':contains(a)').remove();
	$("div.albensuchenseite").not(':contains(a)').remove();
	$("div.eventsseite").not(':contains(a)').remove();
	$("div.fotosbearbeitenseite").not(':contains(a)').remove();
	$("div.fotoskommentareseite").not(':contains(a)').remove();
	$("div.gruppenforumuebersicht").not(':contains(a)').remove();
	$("div.suchenmitglieder").not(':contains(a)').remove();
	$("div.gruppenkategoriedetail").not(':contains(a)').remove();
	$("div.fotobearbeitenneuseite").not(':contains(a)').remove();

	
	$("div.useronline div:contains('offline')").parent().remove();
	$("body.logedin div.verstecken").remove();
	
	if($('div.anfragen p').length) {
	 
	} else {
		$('div.anfragen span.empty').text('Du hast keine neuen Anfragen');
	}
	
	if($('div#freundeonline div:gt(0)').length) {
	 
	} else {
		$('div#freundeonline p.empty').text('Momentan sind keine deiner Freunde online');
	}
	
	if($('div#fotos img').length) {
	 
	} else {
		$('div#fotos p.empty').text('Es wurden noch keine Bilder hochgeladen');
	}
	
	if($('div#freunde div').length) {
	 
	} else {
		$('div#freunde p.empty').text('Es wurden noch keine Freunde hinzugefuegt');
	}
	
	if($('div#gaestebuch div:gt(1)').length) {
	 
	} else {
		$('div#gaestebuch p.empty').text('Es hat bisher noch niemand an die Pinnwand geschrieben');
	}
	
	if($(".genmsg:contains('Posteingang')").length) {
		$('a#posteingangtab').addClass('active');
	}
	
	if($(".genmsg:contains('Postausgang')").length) {
		$('a#postausgangtab').addClass('active');
	}
	
	if($(".genmsg:contains('Papierkorb')").length) {
		$('a#papierkorbtab').addClass('active');
	}
	
	if($(".genmsg:contains('Archiv')").length) {
		$('a#archivtab').addClass('active');
	}
	
	if($("body div#map").length) {
		$('div.mitgliedersuche').remove();
	}
	
	if($("div#zuletztonline span:empty").length) {
		$('div#zuletztonline span:empty').parent().remove();
		
	}
	
	$('div#head div.jNiceSelectWrapper, form.kleineinputs div.jNiceSelectWrapper, .kleineselects div.jNiceSelectWrapper').css('width','80px').addClass('kleinesselect');
	$('td.profilfeld:empty').parent().parent().parent().remove();
	

	
	$('body:contains("Zuletzt online")').addClass('startseite');
	$('body.logedin').removeClass('startseite');
	
	$('span.vereincontent:empty').html('<span class=vereincontent><i>Keine Angabe</i></span>');
	
	$("div#jetztonline div.usershow span.offline").parent().parent().remove();
	
	$('div.altezeigen').hide();
	if($('table.aktion').length && $('table.aktion:gt(10)').length) {
		$('div.altezeigen').show();
	} 
	$('table.aktion:gt(10)').hide();
	$('a.aktionzeigen').click(function(){
		$('table.aktion:gt(10)').fadeToggle('slow');
	});
	
	$(function() {
        $("a.newtable").toggle(function (){
            		$('div.newtable').html('<div style=\"padding: 15px; border: 1px solid #767676; margin-bottom: 20px;\"><table><tr><td class=label>Trainingsdatum</td><td><input type=text name=datum7></td></tr></table><br><table><tr><td class=label>Trainingsdatum</td><td><input type=text name=datum8></td></tr></table><br><table><tr><td class=label>Trainingsdatum</td><td><input type=text name=datum9></td></tr></table></div>');
        }, function(){

            $("div.newtable").empty();
        });
    });
	
	$(function() {
        $("a.aktionzeigen").toggle(function (){
            $("a.aktionzeigen").text("Aeltere Beitraege ausblenden")
            .stop();
        }, function(){

            $("a.aktionzeigen").text("Aeltere Beitraege einblenden")
            .stop();
        });
    });

	if ($('div.column1:contains("Bitte einloggen")').length > 0) {
		$('div.membership:eq(2)').empty().html('<h2>Was ist Tennis Live</h2><p style="width: 330px;">Tennis Live ist eine Community von Tenisspielern fuer Tennisspieler. Hier kannst du neue Trainingspartner finden, dich in Gruppen ueber den Sport austauschen, im Forum fachsimpeln, anderen Tennisspielern Nachrichten schicken oder dir einfach nur die neuesten Infos ueber die Welt der Profis ansehen.</p>');
	}

	
	$('input.ort').parent().parent().css('margin-top', '-30px').css('margin-left', '105px');
	$('form.neuesevent input.ort').parent().parent().css('margin-top', '-26px').css('margin-left', '105px');
	
	$('input[type="text"], input[type="password"]').addClass('text');
	 
	if($('div#nowonline div:empty').length) {
		$('div#nowonline div').text('Es ist keiner deiner Freunde online');
	}


 if($('div.vereintables:empty').length) {
		$('h3.sportabout').remove();
		}
		
	$('div.col1 div.usershow:first').css('margin-left', '0px');

	// $('input#id_search').quicksearch('div#freunde div.usershowdetail');
	
	$('div#doyouknow .show:eq(0), div#doyouknow .show:eq(1), div#doyouknow .show:eq(2)').show();
	$('div#doyouknow br.clear:gt(2), div#doyouknow div.show:gt(2)').remove();
	
	
	
	$('#mainnavigation li').hover(

		function () {

			//Submenue zeigen

			$('ul', this).show();

			$(this).addClass('hover');

		}, 

		function () {

			//Submenue verstecken

			$('ul', this).hide();

			$(this).removeClass('hover');			

		}

	);
	
	
	$('div.usershowdetail:last-child hr').remove();
	
	$('ul.messagessub li').each(function(i){
		$(this).attr('rel',0 + i);
	});
	
	var lastli = $('ul.messagessub li:last-child').attr('rel');
	
	$('span.messagenumber strong').text(lastli);
	
	if($('span.messagenumber strong:contains(0)').length) {
		$('span.messagenumber').remove();
	}
	
	if(!$('ul.messagessub li:eq(1)').length) {
		$('ul.messagessub').remove();
	}
	
		$('input[name="search"], textarea.wermachtwas, input#id_searchuser, ul#mainnavigation input.suchfeld, div#footer input.text, textarea[name="cont"]').toggleVal();

	$('div.newsteaser a.tipsy').click(function() {
		$('div.newsteaser').hide();
	});
	
	$('body.startseite div#wrap1').removeAttr('id').attr('id', 'wrap');
	
});




function mycarousel_initCallback(carousel) {
    jQuery('.jcarousel-control a').bind('click', function() {
        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
        return false;
    });

    jQuery('.jcarousel-scroll select').bind('change', function() {
        carousel.options.scroll = jQuery.jcarousel.intval(this.options[this.selectedIndex].value);
        return false;
    });

    jQuery('#mycarousel-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#mycarousel-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};

function validate_form(thisform){

  var error = false;
		$('input.required, textarea.required').each(function(){
			if($(this).attr('value')=='') {
				error = true;
				$(this).addClass('required_problem');
			}
		});

		if(error){
			alert("Die markierten Felder muessen ausgefuellt werden");
		}

		return !error;
}


$(function() {
	var d=300;
	$('#navigation a').each(function(){
		$(this).stop().animate({
			'marginTop':'-80px'
		},d+=150);
	});

	$('#navigation > li').hover(
	function () {
		$('a',$(this)).stop().animate({
			'marginTop':'-8px'
		},200);
	},
	function () {
		$('a',$(this)).stop().animate({
			'marginTop':'-80px'
		},200);
	}
);
});

/*$(function(){
	var $a = $('<a>Add Option</a>');
	$('body').append($a);
	$a.click(function(){
		var element = $('#select2')[0];
		var myNewOption = new Option("My Option", "123", true);
		element.options[element.options.length] = myNewOption;
		$.jNice.SelectUpdate(element);
	});
});*/

  $(function() {
    
    $('.tipsy').tipsy();
    
    $('#north').tipsy({gravity: 'n'});
    $('.south').tipsy({gravity: 's'});
    $('#east').tipsy({gravity: 'e'});
    $('#west').tipsy({gravity: 'w'});
    
    $('#auto-gravity').tipsy({gravity: $.fn.tipsy.autoNS});
    
    $('#example-fade').tipsy({fade: true});
    
    $('#example-custom-attribute').tipsy({title: 'id'});
    $('#example-callback').tipsy({title: function() { return this.getAttribute('original-title').toUpperCase(); } });
    $('#example-fallback').tipsy({fallback: "Where's my tooltip yo'?" });
    
    $('#example-html').tipsy({html: true });
	
	$('.ausklappbar').hide();
	
	$("tr.ausklappen").toggle(function (){
		$(this).html('<td><span class=icon></span>Suchformular einklappen</td>');
		$(this).addClass('active');
		$(this).next().show()
		
		.stop();
	},function(){
		$(this).removeClass('active');
		$(this).html('<td><span class=icon></span>Suchformular ausklappen</td>');
		$(this).next().hide()

		.stop();
	});
	
	$("div.ausklappen").toggle(function (){
		$(this).html('<span class=icon></span>Suchformular einklappen');
		$(this).addClass('active');
		$(this).next().show()
		
		.stop();
	},function(){
		$(this).removeClass('active');
		$(this).html('<span class=icon></span>Suchformular ausklappen');
		$(this).next().hide()

		.stop();
	});
    
    
    
  });
  
  $(function () {
		$('input#id_search').quicksearch('table tr.obergruppe');
		$('input#id_searchuser').quicksearch('div#freunde div.usershowdetail');
	});
	
  function antwort_auswahl(){
   antworten = document.Form.antwort.length;
   ok = false;
   for (zaehler = 0; zaehler < antworten; zaehler++){
    if (document.Form.antwort[zaehler].checked) {
     ok = true;
   }
  }
   if (ok == false) {
    switch (antworten) {
      case 2:
       Zahl = "zwei";
       break;
      case 3:
       Zahl = "drei";
       break;
      case 4:
       Zahl = "vier";
       break;
      case 5:
       Zahl = "fuenf";
       break;
      case 6:
       Zahl = "sechs";
       break;
      default:
       Zahl = "";
       break;
    }
    alert ("Bitte waele eine der " + Zahl + " Antworten aus!");
    return false;
   }
   else{
    return true;
   }
  }
  
 function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}



$(function()
{
	
	// Fade out the suggestions box when not active
	 $("input").blur(function(){
	 	$('#suggestions').fadeOut();
	 });
});

function lookup(inputString) {
	if(inputString.length <= 3) {
		$('#suggestions').fadeOut(); // Hide the suggestions box
	} 
	if (inputString.length >= 3)	{
		$.post("../../rpc.php", {queryString: ""+inputString+""}, function(data) { // Do an AJAX call
			$('#suggestions').fadeIn(); // Show the suggestions box
			$('#suggestions').html(data); // Fill the suggestions box
			$('a.suchlink:gt(6)').hide();
			//$('a.suchlink.last').show();
				$('div.test').html('<a class="suchlink last" href="index.php?d=mitglieder&vorname=' + inputString + '"><strong>Es werden nur Freunde angezeigt</strong><br>Auch andere Mitglieder anzeigen</a>');
		});
	}
} 





  



