/* PAGE LOADING */

function LoadingGifNew(divid){
    $('#'+divid+'').html("<img style=\"width: 24px; margin: 100px 0 100px 400px;\" src=\"img/loader.gif\" border=\"0\" width=\"24\" height=\"24\"/>");
}

function load_partypics(which_date){
    LoadingGifNew('wrap_partypics');
    $('#wrap_partypics').load(which_date); 
}

function load_last_partypics (monat,datum){
    $('#wrap_partypics').load('partyfotos_view.php?PartyPicsMonat='+monat+'&datum='+datum);      
};

/* IMAGESLIDER */

$(window).load(function() {
    $('#slider').nivoSlider({
        effect:'random', // Specify sets like: 'fold,fade,sliceDown'
        slices:6, // For slice animations
        boxCols: 8, // For box animations
        boxRows: 4, // For box animations
        animSpeed:500, // Slide transition speed
        pauseTime:11000, // How long each slide will show
        startSlide:0, // Set starting Slide (0 index)
        directionNav:false, // Next & Prev navigation
        directionNavHide:false, // Only show on hover
        controlNav:false, // 1,2,3... navigation
        controlNavThumbs:false, // Use thumbnails for Control Nav
        controlNavThumbsFromRel:false, // Use image rel for thumbs
        controlNavThumbsSearch: '.jpg', // Replace this with...
        controlNavThumbsReplace: '_thumb.jpg', // ...this in thumb Image src
        keyboardNav:false, // Use left & right arrows
        pauseOnHover:false, // Stop animation while hovering
        manualAdvance:false, // Force manual transitions
        captionOpacity:0.8, // Universal caption opacity
        prevText: 'Prev', // Prev directionNav text
        nextText: 'Next', // Next directionNav text
        beforeChange: function(){}, // Triggers before a slide transition
        afterChange: function(){}, // Triggers after a slide transition
        slideshowEnd: function(){}, // Triggers after all slides have been shown
        lastSlide: function(){}, // Triggers when last slide is shown
        afterLoad: function(){} // Triggers when slider has loaded
    });
});


$(document).ready(function(){
    
    
    
    /* ZEITSTEUERUNG NÄCHSTES EVENT 
    var anzahl_events = $('h1.datum_events').length;
    var zeit_jetzt = new Date();
    var tag_jetzt = zeit_jetzt.getDate();
    var monat_jetzt = zeit_jetzt.getMonth() + 1;
    console.log(anzahl_events);
    console.log(zeit_jetzt);
    console.log(tag_jetzt);
    console.log(monat_jetzt);
    for(var i=0 ; i < anzahl_events; i++){
        var datum = $('h1.datum_events:eq('+i+')').html();
        console.log(datum);
    }
    */
    
    /* EVENTS Beim Laden ALLE EINKLAPPEN */
    $('.event_content').css('display', 'none');
    
    
    /* EVENTS EIN- UND AUSKLAPPEN */
    $('div.event_head').click(function(){
        $(this).next('div').slideToggle(700);        
    });
    
    
    
    /* SCROLLING GB BUTTON */
    $("#btn_gb_top").click(function(event){
	        //prevent the default action for the click event
	        event.preventDefault();
	 
	        //get the full url - like mysitecom/index.htm#home
	        var full_url = this.href;
	 
	        //split the url by # and get the anchor target name - home in mysitecom/index.htm#home
	        var parts = full_url.split("#");
	        var trgt = parts[1];
	 
	        //get the top offset of the target anchor
	        var target_offset = $("#"+trgt).offset();
	        var target_top = target_offset.top;
	 
	        //goto that anchor by setting the body scroll top to anchor top
	        $('html, body').animate({scrollTop:target_top}, 500);
	    });
})





