File: D:/HostingSpaces/SBogers105/musculo.nl/wwwroot/css-js/musculo.js
// JavaScript Document
function backgroundImageSize(){
$.doTimeout( 1000, function(){
var windowHeight = $("#mainframe").height() + 450;
var position = $('#backgroundPhotos').position();
var imageHeight = $('#backgroundPhotos').height() + position.top;
if(imageHeight > windowHeight){
var verschil = imageHeight - windowHeight;
var newHeight = imageHeight - verschil - position.top;
$('#backgroundPhotos').css('height', newHeight+'px');
}
$('#backgroundPhotos img').fadeIn('fast');
});
}
function scrollSubmenu(){
var scrollPos;
var waardeNieuweTop = 0;
var innerHeight = $(window).innerHeight();
var $submenu = $('#submenu');
var offsetSubmenu = $submenu.offset();
var posSubmenu = offsetSubmenu.top;
var $footer = $('#footer');
var offsetFooter = $footer.offset();
var posFooter = offsetFooter.top;
var beginFooter = posFooter - innerHeight + - 150;
var hoogteSubmenu = $submenu.height();
var hoogteMarginWaarde = posFooter - $submenu.height() - 140 - 390;
$(window).scroll(function() {
scrollPos = $(window).scrollTop();
if((scrollPos > posSubmenu - 18)){
if((innerHeight - (scrollPos - beginFooter) - hoogteSubmenu - 20 ) < 0 ){
$submenu.removeClass("fixed");
$submenu.css('margin-top',hoogteMarginWaarde+'px');
}else{
$submenu.css('margin-top','20px');
$submenu.addClass("fixed");
}
}else{
$submenu.css('margin-top','2px');
$submenu.removeClass("fixed");
}
});
}
$(document).ready(function(){
$('#hoofdmenu li a').each(function(){
$(this).parent().width($(this).width() + 20);
});
$('#footermenu li a').each(function(){
$(this).parent().width($(this).width() + 20);
});
$('#hoofdmenu li.active a').addClass('font');
$('#footermenu li.active a').addClass('font');
if($("#submenu").length){
scrollSubmenu();
}
$('.menubalk .notActive a').hover(function(){
$(this).stop().animate({color: "#638DBB"}, "fast");
},function(){
$(this).stop().animate({color: "#888888"}, "fast");
});
$('#sideMenu .notActive a').hover(function(){
$(this).stop().animate({color: "#638DBB"}, "fast");
},function(){
$(this).stop().animate({color: "#C4C4C4"}, "fast");
});
$('.blauweLink').hover(function(){
$(this).stop().animate({backgroundColor: "#638DBB"}, "fast");
},function(){
if($(this).parent().hasClass("active")){
}else{
$(this).stop().animate({backgroundColor: "#184E7F"}, "fast");
}
});
$('.smallColumn').hover(function(){
$("> .title .titelText h2", this).stop().animate({color: "#638DBB"}, "fast");
$("> .leesMeer", this).stop().animate({height: "40px"}, "fast");
},function(){
$("> .title .titelText h2", this).stop().animate({color: "#184E7F"}, "fast");
$("> .leesMeer", this).stop().animate({height: "11px"}, "fast");
});
$('.smallColumn').click(function(){
window.location.href = $('.leesMeer a',this).attr('href');
});
$('#submenu li').click(function(){
window.location.href = $('a',this).attr('href');
});
$('#komma').hover(function(){
$("> a", this).stop().animate({color: "#006cb0"}, "fast");
},function(){
$("> a", this).stop().animate({color: "#638DBB"}, "fast");
});
if($('#fotogallery').length){
var activeFoto = 0;
var totalFotos = $("#fotogallery .images li").length;
var galleryPlay = true;
$("#fotogallery li").eq(0).css({'display':'block'});
$("#fotogalleryMenu li").eq(0).toggleClass("active");
function fotoRotateGallery(){
if(galleryPlay){
$.doTimeout( 4000, function(){
if(galleryPlay){
$("#fotogallery li").eq(activeFoto).fadeOut('slow');
$("#fotogalleryMenu li").eq(activeFoto).toggleClass("active");
activeFoto = activeFoto + 1;
if(activeFoto == totalFotos){ activeFoto = 0; }
$("#fotogalleryMenu li").eq(activeFoto).toggleClass("active");
$("#fotogallery li").eq(activeFoto).fadeIn('slow');
fotoRotateGallery();
}
});
}
}
fotoRotateGallery();
$('#fotogalleryMenu li').each(function(index) {
$(this).click(function(e){
if(index != activeFoto){
if(index == 0 && index == totalFotos){
}else{
e.preventDefault;
clickFotoAction(index);
}
}
});
});
function clickFotoAction(newFotoActive){
$("#fotogallery li").eq(activeFoto).fadeOut('slow');
$("#fotogalleryMenu li").eq(activeFoto).toggleClass("active");
galleryPlay = false;
$("#fotogalleryMenu li").eq(newFotoActive).toggleClass("active");
$("#fotogallery li").eq(newFotoActive).fadeIn('slow');
activeFoto = newFotoActive;
}
}
$('#contactBlockCTA').click(function(e){
e.preventDefault();
window.location.href = $('.telephone a',this).attr('href');
});
});
$(window).load(function(){
backgroundImageSize();
});