// JavaScript Document


function showfilter(){
    if(document.getElementById('blogfilter') != null)
    {
	    document.getElementById('blogfilter').style.display = 'block';
    }
}

function hidefilter(){
    if(document.getElementById('blogfilter') != null)
    {
	    document.getElementById('blogfilter').style.display = 'none';
	}
}

function shownewsmenu(){
	document.getElementById('blogfilter2').style.display = 'block';
}
function hidenewsmenu(){
		document.getElementById('blogfilter2').style.display = 'none';
}



	
$(document).ready(function() {

	jQuery(function( $ ){


    var winh = document.getElementById('windowh').offsetHeight;
    //var winh = $(window).height();
    
    //console.log($(window).height());

    
    if (winh < 620){
        document.getElementById('socialmedia').style.display="none";
        // document.getElementById('thedate').style.padding="0 0 20px 0";
        document.getElementById('socialalt').style.display="block";
    }
    
    
    //navigation display controls
    window.onload = scroll;
    window.onscroll = scroll;
    //window.onload = load;
    
      // here are the animation functions

//    var ANIMATATESPEED = 1900;
//    
//    document.getElementById('ahappening').onclick=foo;
//    
//    function foo(){
//        $(document.getElementById('redribbon')).animate({top:"0px"}, ANIMATATESPEED);
//    }
//    
//    document.getElementById('ainvolved').onclick=foo2;
//    
//    function foo2(){
//        $(document.getElementById('redribbon')).animate({top:"40px"}, ANIMATATESPEED);
//    }
//    
//    document.getElementById('asponsors').onclick=foo3;
//    
//    function foo3(){
//        $(document.getElementById('redribbon')).animate({top:"80px"}, ANIMATATESPEED);
//    }

//    document.getElementById('acontact').onclick=foo4;
//    
//    function foo4(){
//        $(document.getElementById('redribbon')).animate({top:"120px"}, ANIMATATESPEED + 480); 
//    }
//    
//    function load() {
//        var sponh = document.getElementById('sponsors').offsetHeight;
//	    var haph = document.getElementById('happening').offsetHeight;
//	    var invh = document.getElementById('involved').offsetHeight;
//	    var conh = document.getElementById('contact').offsetHeight;
//	    
//        var currentPos = $(document).scrollTop();
//        var TRANSISTIONOFFSET = 255;
//        
//        if ( currentPos <= (haph + TRANSISTIONOFFSET) ){   
//            $(document.getElementById('ahappening')).addClass("isHere");           
//            $(document.getElementById('ainvolved')).removeClass("isHere");
//            $(document.getElementById('asponsors')).removeClass("isHere");
//            $(document.getElementById('acontact')).removeClass("isHere");
//            $(document.getElementById('redribbon')).animate({top:"0px"}, ANIMATATESPEED);
//        }
//        else if ( currentPos > (haph + TRANSISTIONOFFSET) && currentPos <= (haph + invh + 2*(TRANSISTIONOFFSET))){
//            
//            $(document.getElementById('ainvolved')).addClass("isHere");   
//            $(document.getElementById('ahappening')).removeClass("isHere");
//            $(document.getElementById('asponsors')).removeClass("isHere");
//            $(document.getElementById('acontact')).removeClass("isHere"); 
//            $(document.getElementById('redribbon')).animate({top:"40px"}, ANIMATATESPEED);     
//        }
//        else if ( currentPos > (haph + invh + 2*(TRANSISTIONOFFSET)) && currentPos <= (haph + invh + sponh + 3*(TRANSISTIONOFFSET))){  
//            $(document.getElementById('asponsors')).addClass("isHere");    
//            $(document.getElementById('ainvolved')).removeClass("isHere");
//            $(document.getElementById('ahappening')).removeClass("isHere");
//            $(document.getElementById('acontact')).removeClass("isHere");  
//            $(document.getElementById('redribbon')).animate({top:"80px"}, ANIMATATESPEED);
//        }
//        else if ( currentPos > (haph + invh + sponh + 3*(TRANSISTIONOFFSET)) ) {
//            $(document.getElementById('acontact')).addClass("isHere");    
//            $(document.getElementById('ainvolved')).removeClass("isHere");
//            $(document.getElementById('asponsors')).removeClass("isHere");
//            $(document.getElementById('ahappening')).removeClass("isHere");
//            $(document.getElementById('redribbon')).animate({top:"120px"}, ANIMATATESPEED);
//        }
//    }

	
    function scroll() {
        var sponh = 0;
        var haph = 0;
        var invh = 0;
        var conh = 0;
        
        
		if (document.getElementById("sponsors") != null)
		{
		    sponh = document.getElementById('sponsors').offsetHeight;
		}
		
		if (document.getElementById('happeningFront') != null)
		{
	        haph = document.getElementById('happeningFront').offsetHeight;
	    }
	    
	    if (document.getElementById('involved') != null)
	    {
	        invh = document.getElementById('involved').offsetHeight;
	    }
	    
	    if (document.getElementById('contact') != null)
	    {
	        conh = document.getElementById('contact').offsetHeight;
	    }
	    
        var currentPos = $(document).scrollTop();
        var TRANSISTIONOFFSET = 260;
        if (sponh > 0)
        {
            if ( currentPos <= (haph + TRANSISTIONOFFSET) ){   
                $(document.getElementById('ahappening')).addClass("isHere");           
                $(document.getElementById('ainvolved')).removeClass("isHere");
                $(document.getElementById('asponsors')).removeClass("isHere");
                $(document.getElementById('acontact')).removeClass("isHere");
                document.getElementById('redribbon').style.top = "2000px";
            }
            else if ( currentPos > (haph + TRANSISTIONOFFSET) && currentPos <= (haph + invh + 2*(TRANSISTIONOFFSET))){
                
                $(document.getElementById('ainvolved')).addClass("isHere");   
                $(document.getElementById('ahappening')).removeClass("isHere");
                $(document.getElementById('asponsors')).removeClass("isHere");
                $(document.getElementById('acontact')).removeClass("isHere");
               document.getElementById('redribbon').style.top = "80px";      
            }
            else if ( currentPos > (haph + invh + 2*(TRANSISTIONOFFSET)) && currentPos <= (haph + invh + sponh + 3*(TRANSISTIONOFFSET))){  
                $(document.getElementById('asponsors')).addClass("isHere");    
                $(document.getElementById('ainvolved')).removeClass("isHere");
                $(document.getElementById('ahappening')).removeClass("isHere");
                $(document.getElementById('acontact')).removeClass("isHere"); 
                document.getElementById('redribbon').style.top = "120px"; 
            }
            else if ( currentPos > (haph + invh + sponh + 3*(TRANSISTIONOFFSET)) ) {
                $(document.getElementById('acontact')).addClass("isHere");    
                $(document.getElementById('ainvolved')).removeClass("isHere");
                $(document.getElementById('asponsors')).removeClass("isHere");
                $(document.getElementById('ahappening')).removeClass("isHere");
                document.getElementById('redribbon').style.top = "160px";
            }
        }
    }
    
    
    
	$.localScroll.defaults.axis = 'y';
	
		$.localScroll.hash({

		//duration:1500
		});
	
	$.localScroll({
	//	hash:true
	duration:2500


		});
	});
	
	$("a[class=iframe]").fancybox({
		'width'				: 800,
		'height'			: 600,				
		'autoScale'			: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});	
	
		$("a[class=iframe2]").fancybox({
		'width'				: 620,
		'height'			: 565,				
		'autoScale'			: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});	
		$("a[class=iframe3]").fancybox({
		'width'				: 720,
		'height'			: 540,				
		'autoScale'			: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});	
		$("a[class=iframe4]").fancybox({
		'width'				: 690,
		'height'			: 575,				
		'autoScale'			: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});	
		$("a[class=iframeform]").fancybox({
		'width'				: 680,
		'height'			: 560,			
		'autoScale'			: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});	
	
    $('#Slideshow').slideshow({
	
	playframe:false,
	width:660,
	height:327,
	panel:false, 
	title:false,
	
	controls :{         // show/hide controls elements
		'hide':true,    // show controls bar on mouse hover
		'first':false,   // goto first frame
		'prev':false,    // goto previouse frame (if it first go to last)
		'play':false,    // play slideshow
		'next':false,    // goto next frame (if it last go to first)
		'last':false,    // goto last frame
		'help':false,    // show help message
		'counter':false  // show slide counter
	 }
	 
	}).playSlide();	
	
});
