File: D:/HostingSpaces/SBogers10/komma-mediadesign.nl/wwwroot/facebook/css-js/vanrooij.js
// JavaScript Document
function websiteHeight(){
var windowHeight = window.innerHeight;
var contentHeight = $("#background").height();
contentHeight = contentHeight + 68;
if(contentHeight < windowHeight){
$('#background').css('height', function() {
var naam = (window.innerHeight - 68) + 'px';
return naam;
});
}else{
$("#background").css({'height':'auto'});
}
}
$(document).ready(function(){
websiteHeight();
$("#pagePeel").hover(function() { //On hover...
$("#pagePeel img , .msg_block").stop()
.animate({ //Animate and expand the image and the msg_block (Width + height)
width: '148px',
height: '153px'
}, 500);
} , function() {
$("#pagePeel img").stop() //On hover out, go back to original size 50x52
.animate({
width: '59px',
height: '61px'
}, 220);
$(".msg_block").stop() //On hover out, go back to original size 50x50
.animate({
width: '59px',
height: '59px'
}, 200); //Note this one retracts a bit faster (to prevent glitching in IE)
});
var gallery_open = false;
$("a.galleryBtn").click(function(e){
e.preventDefault();
headerOpenClose();
});
function headerOpenClose(){
if(gallery_open == false){
var newHeight = $("#background").height() + 99;
var newHeightText = newHeight + "px";
$("#header_foto").animate({"height": "359px"}, "slow");
$("#background").animate({"height": newHeightText}, "slow");
$("a.galleryBtn").animate({"top": "442px"}, "slow");
$("a.galleryBtn").removeClass("down");
$("a.galleryBtn").addClass("up");
gallery_open = true;
}else{
var newHeight = $("#background").height() - 99;
var newHeightText = newHeight + "px";
$("#header_foto").animate({"height": "260px"}, "slow");
$("#background").animate({"height": newHeightText}, "slow");
$("a.galleryBtn").animate({"top": "344px"}, "slow");
$("a.galleryBtn").removeClass("up");
$("a.galleryBtn").addClass("down");
gallery_open = false;
}
}
var activeFoto = 0;
var totalFotos = $("#header_foto li").length;
var galleryPlay = true;
$("#galleryDots li a").eq(0).toggleClass("active");
$("#header_foto li").eq(0).css({'display':'block'});
function fotoRotate(){
if(galleryPlay){
$.doTimeout( 4000, function(){
if(galleryPlay){
$("#header_foto li").eq(activeFoto).fadeOut('slow');
$("#galleryDots li a").eq(activeFoto).toggleClass("active");
activeFoto = activeFoto + 1;
if(activeFoto == totalFotos){ activeFoto = 0; }
$("#galleryDots li a").eq(activeFoto).toggleClass("active");
$("#header_foto li").eq(activeFoto).fadeIn('slow');
fotoRotate();
}
});
}
}
fotoRotate();
if(totalFotos == 0){
$("#galleryDots").css({'display':'none'});
}
if(totalFotos > 0){
$("#header_foto").click(function(e){
headerOpenClose();
});
}
$("#galleryDots li a").eq(0).click(function(e){
e.preventDefault;
$("#galleryDots li a").eq(0).addClass("active");
clickAction(0);
});
$("#galleryDots li a").eq(1).click(function(e){
e.preventDefault;
$("#galleryDots li a").eq(1).addClass("active");
clickAction(1);
});
$("#galleryDots li a").eq(2).click(function(e){
e.preventDefault;
$("#galleryDots li a").eq(2).addClass("active");
clickAction(2);
});
$("#galleryDots li a").eq(3).click(function(e){
e.preventDefault;
$("#galleryDots li a").eq(3).addClass("active");
clickAction(3);
});
$("#galleryDots li a").eq(4).click(function(e){
e.preventDefault;
$("#galleryDots li a").eq(4).addClass("active");
clickAction(4);
});
function clickAction(newActive){
$("#galleryDots li a").eq(activeFoto).toggleClass("active");
galleryPlay = false;
$("#header_foto li").eq(activeFoto).fadeOut('slow');
$("#header_foto li").eq(newActive).fadeIn('slow');
activeFoto = newActive;
}
if(totalFotos == 1){
$("#galleryDots").css({'left':'304px'});
$("#galleryDots li").eq(1).css({'display':'none'});
$("#galleryDots li").eq(2).css({'display':'none'});
$("#galleryDots li").eq(3).css({'display':'none'});
$("#galleryDots li").eq(4).css({'display':'none'});
}else if(totalFotos == 2){
$("#galleryDots").css({'left':'300px'});
$("#galleryDots li").eq(2).css({'display':'none'});
$("#galleryDots li").eq(3).css({'display':'none'});
$("#galleryDots li").eq(4).css({'display':'none'});
}else if(totalFotos == 3){
$("#galleryDots").css({'left':'295px'});
$("#galleryDots li").eq(3).css({'display':'none'});
$("#galleryDots li").eq(4).css({'display':'none'});
}else if(totalFotos == 4){
$("#galleryDots").css({'left':'290px'});
$("#galleryDots li").eq(4).css({'display':'none'});
}else if(totalFotos == 5){
$("#galleryDots").css({'left':'284px'});
}
//brandCarousel
var totalWidth = 0;
$('#brandCarousel li').each(function(){
totalWidth = totalWidth + $(this).width();
});
totalWidth = totalWidth - 175;
totalWidth = totalWidth * -1;
var firstTime = true;
$("a.carouselPrev").click(function(e){
e.preventDefault;
var posities = $("#brandCarousel ul").position();
var newPosition = posities.left + 96;
if(newPosition > 26){ newPosition = 26; }
$("#brandCarousel ul").animate({
left: newPosition
}, 500 );
});
$("a.carouselNext").click(function(e){
e.preventDefault;
var posities2 = $("#brandCarousel ul").position();
var newPosition2 = posities2.left - 96;
if(newPosition2 < totalWidth){ newPosition2 = totalWidth; }
$("#brandCarousel ul").animate({
left: newPosition2
}, 500 );
});
$('#route_input').focus(function() {
value=$(this).val();
if($(this).val()=="Vul hier uw adres in") {
$(this).attr("value","");
}
});
$('#route_input').blur(function() {
var defaultValue = "Vul hier uw adres in";
if($(this).val()=="") {
$(this).val(defaultValue);
}
});
});
$(window).resize(function() {
websiteHeight();
});