$(document).ready(function() {

$('.cars_nav_links').children('a').mouseenter(function(e) {
$(this).animate({ opacity: '1.0'}, 300);
}).mouseleave(function(e) {
$(this).animate({ opacity: '0.1'}, 500);
});

$('.cars_nav_rechts').children('a').mouseenter(function(e) {
$(this).animate({ opacity: '1.0'}, 300);
}).mouseleave(function(e) {
$(this).animate({ opacity: '0.1'}, 500);
});

$('.nav_bord_rechts').mouseenter(function(e) {
$(this).animate({ opacity: '1.0'}, 300);
}).mouseleave(function(e) {
$(this).animate({ opacity: '0.1'}, 500);
}).click(function(e) {
$('.env').children('.bord').animate({ left: '-835px'}, 500); // -- index
$('.env').children('.bord_p').animate({ left: '-235px'}, 500); // -- portfolio
$(this).animate({ top: '0'}, 0);
$('.nav_bord_links').animate({ top: '-400px'}, 0);
});

$('.nav_bord_links').mouseenter(function(e) {
$(this).animate({ opacity: '1.0'}, 300);
}).mouseleave(function(e) {
$(this).animate({ opacity: '0.1'}, 500);
}).click(function(e) {
$('.env').children('.bord').animate({ left: '65px'}, 500); // -- index
$('.env').children('.bord_p').animate({ left: '65px'}, 500); // -- portfolio
$(this).animate({ top: '0'}, 0);
$('.nav_bord_rechts').animate({ top: '-400px'}, 0);
});

var bord_k_w = $('.env').children('.bord_k').children('.inhoud_sl_k').innerWidth();
//var winWB = (bord_k_w)*1.3;
var winWB = (bord_k_w)*3;

$('.cars_k_l').mouseenter(function(e) {
$(this).animate({ opacity: '1.0'}, 300);
$('.env').children('.bord_k').children('.inhoud_sl_k').animate({ left: '0'}, winWB);
}).mouseleave(function(e) {
$(this).animate({ opacity: '0.1'}, 500);
$('.env').children('.bord_k').children('.inhoud_sl_k').stop();
});

$('.cars_k_r').mouseenter(function(e) {
var win_k = document.body.clientWidth;
var div_k = $('.env').children('.bord_k').children('.inhoud_sl_k').innerWidth();

if (div_k > win_k) {
var stop_num = (div_k-win_k)+65;
var r_stop = "-" + stop_num + "px";
} else {
var stop_num = 0;
var r_stop = stop_num;
}

$(this).animate({ opacity: '1.0'}, 300);
$('.env').children('.bord_k').children('.inhoud_sl_k').animate({ left: r_stop}, winWB);
}).mouseleave(function(e) {
$(this).animate({ opacity: '0.1'}, 500);
$('.env').children('.bord_k').children('.inhoud_sl_k').stop();
});

$('.in_sl_gr').children('.inhoud_sl').children('.foot_sl').mouseenter(function(e) {
var divh = (this).offsetHeight;
var divH = 354;
if (divh >= divH) {
var divTop = 0;
} else {
var divTop = (divH-divh) + "px";
}
$(this).animate({ top: divTop}, 300);
}).mouseleave(function(e) {
$(this).animate({ top: '323px'}, 300);
});
});

$(function() {

$(window).resize(function() {
var w_h1 = ($("#cars-h1").parents(".bord").innerWidth())-135;
//var w_h1 = ($("#cars-h1").parents(".bord").innerWidth())-300;
$('#cars-h1').carouFredSel({
width: w_h1, 
align: false,
auto: false,
circular: false,
infinite: false,
items: {
visible: {
min: 3,
max: 10
}
},
scroll: {
items:1,
duration: 300
},
prev: {
button: "#vorg"
},
next: {
button: "#volg"
}
});
}).resize();

});

$(function() {

$(window).resize(function() {
var w_n1 = ($("#cars-n1").parents(".bord_n").innerWidth())-1;
$('#cars-n1').carouFredSel({
width: w_n1, 
align: false,
auto: false,
circular: false,
infinite: false,
items: {
visible: {
min: 3,
max: 10
}
},
scroll: {
items:1,
duration: 300
},
prev: {
button: "#vorg"
},
next: {
button: "#volg"
}
});
}).resize();

});

$(function() {

$(window).resize(function() {
var w_p1 = ($("#cars-p1").parents(".bord_p").innerWidth())-301;
$('#cars-p1').carouFredSel({
width: w_p1, 
align: false,
auto: false,
circular: false,
infinite: false,
items: {
visible: {
min: 1,
max: 10
}
},
scroll: {
items:1,
duration: 300
},
prev: {
button: "#vorg"
},
next: {
button: "#volg"
}
});
}).resize();

});



