
/* Author: Billiau Glenn - @billiauglenn
*/


jQuery.noConflict();
jQuery(document).ready(function($){ 
  
$(".iframe").colorbox({iframe:true, width:"90%",scrolling:false, height:"90%",title:"Slide over or tab on the image"});
    
    
    // AJAX FOR CONTACT FORM
    $('#btnSubmitContact').click(function(){
       
	var naam = $('#naam').val();
	var email = $('#email').val();
	var telefoon = $('#telefoon').val();
	var bericht = $('#bericht').val();
        
               
        $.ajax({
           type: "POST",
         url: "mailHandler.php",
         
           data: "naam="+naam+"&email="+email+"&telefoon="+telefoon+"&bericht="+bericht,
           success: function(msg)
           {
               
               $('#formGroup').fadeOut();
               $('#formMsg').delay(500).fadeIn();
           }
         });
			
	return(false);
	});
    
    
    $('#title').mouseover(function(){
        $('#about_title').slideDown(600);
    });
   
    $('#about_title').mouseover(function(){
        $('#about_title').show();

    });
    
    $('#about_title').mouseout(function(){
        $('#about_title').slideUp(600);
        
    });
    $('#about_title').click(function(){
    $('html, body').animate({scrollTop: $(".scroller.about").offset().top}, 1000);
    });
    
    $('.navHuwelijken').mouseover(function(){
        $('#huwelijken_title').show();
    });
 
    $('#huwelijken_title').mouseover(function(){
        $('#huwelijken_title').show();
    });
    $('#huwelijken_title').mouseout(function(){
        $('#huwelijken_title').hide();
    });
    
   $('.navHuwelijken').mouseout(function(){
        $('#huwelijken_title').hide();
    });
       $('.navHuwelijken').click(function(){
          window.location = 'http://weddingdesign.be';
    });
      $('#huwelijken_title').click(function(){
          window.location = 'http://weddingdesign.be';
    });
//  initiate functions
  $(window).load(function (){calContainer();});
  $(window).resize(function() {calContainer();});
  
  
// gallery's
  $(".groupMode").colorbox({rel:'groupMode', height:"90%",scrolling:false,preloading:false});
  $(".groupPortret").colorbox({rel:'groupPortret', height:"90%",scrolling:false,preloading:false});
  $(".groupModel").colorbox({rel:'groupModel', height:"90%",scrolling:false,preloading:false});
  $(".groupNabewerking").colorbox({rel:'groupNabewerking', height:"90%",scrolling:false,preloading:false});
  $(".groupArchitectuur").colorbox({rel:'groupArchitectuur', height:"90%",scrolling:false,preloading:false});
  
  $(".ajax").colorbox();		
         
//Create JQeffect for bottom contact/navigation bar

     $('.contactButton').click(function(){
      
        if($('.contactBar').hasClass('expanded')) {
        $('.contactBar').animate({
        height: '30'   
        }, 1000, function() {
           if( jQuery(window).scrollTop() > calContainer()){
        $('#bottom_nav').show();
        }
        return(false);
        
        });
        $('.contactBar').removeClass('expanded');  
        }
        
        else {
            $('.contactBar').addClass('expanded') ;
                            $('#bottom_nav').hide();

            $('.contactBar').animate({
            height: '300'
            }, 1000, function() {
            return(false);
            });
        }
        
   return(false);
        
    });
//ENDS HERE
     
     
// show navigation bar when scroller is higher than screen height
jQuery(window).scroll(function(){
if(jQuery(window).scrollTop() > calContainer()){
  // show back to top
  jQuery('#bottom_nav').show();
}
else{
  // hide back to top
  jQuery('#bottom_nav').hide();
}
});

     
     
     
     
     function calContainer(){
     
     // get browser height, container height, calculate and define the margin for vertical center    
     var screenHeight = $(window).height();
     var containerHeight = $('.content').height();
     var contactBarHeight = $('.contactBar').height();
     var containerMargin = ((screenHeight-contactBarHeight) - containerHeight)/2;
        $('.intro').css({"margin-top":containerMargin,"margin-bottom":containerMargin+1500});
        $('.content').css({"margin-top":containerMargin,"margin-bottom":+1500});
       
       // create 100% height for mobile 
       $('#mobile').css({"height":screenHeight});
       
       // position the scroller handlers depending on screensize
       $('.scroller').css({"top":containerMargin-(containerMargin*2)});
       
         return(screenHeight);
    }
    
    
    
    
    
    
    
    //Define unique scrollers for navigation
    $('.navMode').click(function(){
        
       $('html, body').animate({scrollTop: $(".scroller.mode").offset().top}, 1000);
               return(false);
    });
    $('.navPortret').click(function(){
       $('html, body').animate({scrollTop: $(".scroller.portret").offset().top}, 1000);
               return(false);
    });
    $('.navModel').click(function(){
       $('html, body').animate({scrollTop: $(".scroller.model").offset().top}, 1000);
               return(false);
    });
    $('.navNabewerking').click(function(){
       $('html, body').animate({scrollTop: $(".scroller.nabewerking").offset().top}, 1000);
               return(false);
    });
    $('.navArchitectuur').click(function(){
       $('html, body').animate({scrollTop: $(".scroller.architectuur").offset().top}, 1000);
               return(false);
    });
    $('.navAbout').click(function(){
       $('html, body').animate({scrollTop: $(".scroller.about").offset().top}, 1000);
               return(false);
    });
    $('.up').click(function(){
       $('html, body').animate({scrollTop: (0)}, 1000);
               return(false);

    });
    
     });
    
