	var hTimer = null;
	var animStyle = 'slide';
        var counterAnzeige = 0;
        var AnzahlAnzeige = 15;
	
        $(document).ready(function(){
            $('#msg1').notificationmsg({period: 10000});
            
            $('#btnfade').click(onClick);
            
            $('#btnslide').click(onClick);
            
            $('#btnslidethru').click(onClick);
            
            $('#closebutton').click(function(){ $('#msg1').notificationmsg('hide'); });
            Center();
			
			$('#suchelayer').hide();            

        });
        
		
		
        function onClick(e)
        {
        
            var animStyle = 'slide'
            if(e.srcElement){
                if (e.srcElement.id==='btnfade'){
                    animStyle = 'fade';
                }
                else if(e.srcElement.id==='btnslide'){
                    animStyle = 'slide';
                }
                else{
                    animStyle = 'slidethru';
                }
            }
            else{
                if (e.target.id==='btnfade'){
                    animStyle = 'fade';
                }
                else if(e.target.id==='btnslide'){
                    animStyle = 'slide';
                }
                else{
                    animStyle = 'slidethru';
                }
            }
            $.ajax({
                    type: "POST",
                    url: "testmsg.php",
                    data: "{}",
                    dataType: "html",
                    success: function(msg) {
                        $("#modalbody").html(msg);
                        $('#msg1').notificationmsg({animation:animStyle});
                        $('#msg1').notificationmsg('show'); },
                    error: function(xhr,msg,e){
                        alert(msg);
                    }
                });                
        }
		
		function zeige()
        {
                     counterAnzeige = counterAnzeige + 1;
		 	$.ajax({
                    type: "POST",
                    url: "ajax_suche_livegirl_stickyad.php",
                    data: "{}",
                    dataType: "html",
                    success: function(msg) {
                        $("#modalbody").html(msg);
                        $('#msg1').notificationmsg({animation:animStyle});
                        $('#msg1').notificationmsg('show'); },
                    error: function(xhr,msg,e){
                        alert('Fehler');
                    }
                });  
		      if(counterAnzeige<AnzahlAnzeige) {
                       	
 	               hTimer = window.setTimeout(function(){        
					zeige();
				}, 15000);
                      } 
                       else 
                        { 
                          hTimer = null;
                       }
                        
		}
		
		
		hTimer = window.setTimeout(function(){        
			zeige();
		}, 15000);
		
	
		
		
        function Center()
        {
            var width = document.documentElement.clientWidth + document.documentElement.scrollLeft;
            var height = document.documentElement.clientHeight + document.documentElement.scrollTop;
            
            var top = ((height + document.documentElement.scrollTop) / 2) - ($('#centerdiv').height() / 2) +"px";
            
            var left = (width / 2) - ($('#centerdiv').width() / 2) +"px";
            $('#centerdiv').css({position:"absolute",top:top,left:left});
        }

		
		
// Suggestion Box		

function lookup(inputString) {
    if(inputString.length == 0) {
        // Hide the suggestion box.
        $('#suggestions').hide();
    } else {
        $.post("ajax_suche_peepshow.php", {queryString: ""+inputString+""}, function(data){
            if(data.length >0) {
                $('#suggestions').show();
                $('#autoSuggestionsList').html(data);
            }
        });
    }
} // lookup

function fill(thisValue) {
    $('#inputString').val(thisValue);
   $('#suggestions').hide();
}

// Suche einblenden / ausblenden

function suchewechsel() {
		 $('#suchelayer').toggle('slow');
  };    


