var To15 = 0; var To3 = 0; var To6 = 0; var To10 = 0; if($('html').is('.no-csstransitions')) { To15 = 100; To3 = 200; To6 = 500; To10 = 800 };
var version = 'pc';
$(window).load(function() {
//Page
$('.loadpage').stop().animate({ opacity: 0 }, To3); $('.page').add('.bottompage').css('visibility', 'visible').animate({ opacity: 1 }, To10)
// Realisations Gallerie
//$('.realgal li img').each(function() { src = 'img/thumbs/'+$(this).attr('id'); $(this).attr('src', src) });
// Realisations Gallerie
if(window.location.hash.substring(1,4) == 'mod') { real = window.location.hash.substring(5);
showMod(real, 1); window.location = '#page2'; window.location = '#mod='+real; $('#menureal_2').css('background-color', '#789') };
if(window.location.search.substring(1,4) == 'mod') { showMod(window.location.search.substring(5), 5) };
})
$(document).ready(function() {
//Page
if($('.presentimg').width() > 1100) { version = 'pc' } else if($('.presentimg').width() > 695) { version = 'tab' } else { version = 'smart' };
if(version != 'smart') {
$('.section').each(function() { if(parseInt($(this).height()) < parseInt($(window).height())) { $(this).css( 'min-height', ($(window).height()+($(window).height()*0.25)) ) } }) }
$('.loadpage').delay(100).animate({ opacity: 1 }, To3);
//Referencement
$('.present a').add('.menu a').add('.linkint').add('.links a').add('.extramod a').add('.linknojs').add('#listmodh4 a').removeAttr('href');
$('.present img').add('.logo img').add('.modgal li img').removeAttr('title');
// CSS IE7
if (window.PIE) { $('.menu a').each(function() { PIE.attach(this) }); $('.vid').each(function() { PIE.attach(this) }) }
$('details').hide();
//Menu
if(window.location.hash) { h = window.location.hash.substring(5);
$('.menu a').each(function() { if(h == $(this).attr('id').substring((parseInt($(this).attr('id').length)-1))) { $(this).css('background-color', '#789').addClass('currentpage') } }) }
$('.menu a').mouseover(function() { $(this).css('background-color', '#789') })
.mouseout(function() { if(!$(this).is('.currentpage')) { $(this).css('background-color', '#0A0B33') } })
.click(function() { MenuScroll( $(this).attr('id') ) })
//Ombrage
$('.shadowfade').mouseover(function() { $(this).addClass('shadow') }).mouseout(function() { $(this).removeClass('shadow') })
//Contact - Formulaire
$('#object').focus(function() { if($(this).val() == 'Objet de votre message') { $(this).val('').css({ color: '#333B43', textAlign: 'left' }) } })
.blur(function() { if($(this).val() == '') { $(this).val('Objet de votre message').css({ color: '#808080', textAlign: 'center' }) } });
$('#name').focus(function() { if($(this).val() == 'Nom/Societe') { $(this).val('').css({ color: '#333B43', textAlign: 'left' }) } })
.blur(function() { if($(this).val() == '') { $(this).val('Nom/Societe').css({ color: '#808080', textAlign: 'center' }) } });
$('#phone').focus(function() { if($(this).val() == 'Telephone') { $(this).val('').css({ color: '#333B43', textAlign: 'left' }) } })
.blur(function() { if($(this).val() == '') { $(this).val('Telephone').css({ color: '#808080', textAlign: 'center' }) } });
$('#mail').focus(function() { if($(this).val() == 'Adresse e-mail') { $(this).val('').css({ color: '#333B43', textAlign: 'left' }) } })
.blur(function() { if($(this).val() == '') { $(this).val('Adresse e-mail').css({ color: '#808080', textAlign: 'center' }) } });
$('#mailing').submit(function() { $('#mailing h4 span').html('');
if($('#object').val() == '' || $('#object').val() == 'Objet de votre message') { $('#mailing h4').append(' (Merci d\'indiquer l\'objet de votre message)'); return false };
if($('#mail').val() == '' || $('#mail').val() == 'Adresse e-mail') { $('#mailing h4').append(' (Merci d\'indiquer votre adresse e-mail)'); return false };
if($('#message').val() == '') { $('#mailing h4').append(' (Merci d\'indiquer le contenu de votre message)'); return false };
$.post("php/mail.php?ajax=1", { object: $('#object').val(), name: $('#name').val(), phone: $('#phone').val(), mail: $('#mail').val(), message: $('#message').val() },
function(data) { if(data == 0) { $('#mailing h4').append(' n\'a pas pu être envoyé, merci de réessayer.') }
else { $('#mailing h4').append(' est correctement envoyé.') } });
return false; });
//Contact - Map
$('#sat').click(function() { $('#maproad').animate({ opacity: 1 }, To3); $('#mapsat').animate({ opacity: 0 }, To3) });
$('#rte').click(function() { $('#maproad').animate({ opacity: 0 }, To3); $('#mapsat').animate({ opacity: 1 }, To3) });
//Video - Menu
$('.videoplayer iframe').attr('src', 'http://www.youtube.com/v/akavvK0y9HE&rel=0&autoplay=0');
var sources = new Array('http://www.youtube.com/v/akavvK0y9HE&autoplay=1&rel=0', 'http://www.youtube.com/v/jOzjy8Y9ASw&autoplay=1&rel=0',
'http://www.youtube.com/v/jjC_orrGHd8&autoplay=1&rel=0');
$('.videomenu li').mouseover(function() { if(!window.PIE) { $(this).removeClass('vid').addClass('shadowfocus') }})
.mouseout(function() { if(!window.PIE) { $(this).removeClass('shadowfocus').addClass('vid') }})
.click(function() { src = sources[parseInt($(this).attr('id').substring(3))-1]; $('.videoplayer iframe').attr('src', src) })
// Realisations Gallerie
$('.realgal li').mouseover(function() { $('#'+$(this).attr('id')+' .modtitle').add(this).css('background-color', '#002c38') })
.mouseout(function() { $('#'+$(this).attr('id')+' .modtitle').add(this).css('background-color', '#070724') })
.click(function() { if(version == 'smart') { window.location.href = './?mod='+$(this).attr('id')+'#page2' } else { showMod($(this).attr('id'), 1) } });
// Liens
$('.links a').click(function() { MenuScroll('menureal_2', $(this).html().toLowerCase()) });
$('.extramod a').click(function() { MenuScroll('menureal_2', $(this).attr('id').substring(4)) });
$('.linkint').click(function() { MenuScroll('menureal_2') });
// Moteur de recherche
$('.searching').focus(function() { if($(this).val() == 'Recherche ...') { $(this).val('').css({'color': '#000', 'text-align': 'left' }) }; $('.search').submit() })
.blur(function() { $('.searchresults ul').css('opacity', 0);
if($(this).val() == '') { $(this).val('Recherche ...').css({'color': '#888', 'text-align': 'center' }) } })
$('.search').submit(function() { if($('.searching').val() == 'Recherche ...' || $('.searching').val().length < 2) { return false };
$('.searchresults ul').css('opacity', 0); $('.searchresults ul').html('');
$.getJSON("php/search.php", { "searching": $('.searching').val() }, function(data) {
if(!data) { $('.searchresults ul').append('
Pas de résultats'); return false };
for (i=1; i<(data.total+1); i++) { $('.searchresults ul').append(''+data['mod'+i+'']+'');
$('#search'+i+'').bind('mouseover', function() { $(this).css('opacity', 1) }); $('#search'+i+'').bind('mouseout', function() { $(this).css('opacity', 0.75) });
$('#search'+i+'').bind('click', function() { $('.searching').val($(this).html());
if(window.location.search.substring(5) != $(this).html().toLowerCase() && window.location.hash.substring(5) != $(this).html().toLowerCase()) {
MenuScroll('menureal_2', $(this).html().toLowerCase() ) } }) }; $('.searchresults ul').css('opacity', 1); $('.searchresults ul li').css('opacity', 0.75) });
return false; })
//Scroll
$(window).scroll(function() { T = $(window).scrollTop();
if(T > $('.presentimg').height() && (!window.PIE) && version == 'pc') { $('.presentimg').animate({opacity: 0 }, To3) }
else if(T < $('.presentimg').height() && $('.presentimg').width() > 1100) { $('.presentimg').delay(100).animate({opacity: 1 }, To3) };
if(T > ($('#page4').offset().top-100)) { $('.menu a').removeClass('currentpage').mouseout(); $('#menucontact_4').css('background-color', '#789').addClass('currentpage'); return };
if(T > ($('#page3').offset().top-100)) { $('.menu a').removeClass('currentpage').mouseout(); $('#menuvideo_3').css('background-color', '#789').addClass('currentpage'); return };
if(T > ($('#page2').offset().top-100)) { $('.menu a').removeClass('currentpage').mouseout(); $('#menureal_2').css('background-color', '#789').addClass('currentpage'); return };
if(T > ($('#page1').offset().top-100)) { $('.menu a').removeClass('currentpage').mouseout(); $('#menuinfo_1').css('background-color', '#789').addClass('currentpage'); return };
if(T > 0) { $('.menu a').removeClass('currentpage').mouseout(); $('#menuinfo_0').css('background-color', '#789').addClass('currentpage'); return };
})
})
function MenuScroll(page, mod) { var real = 0; $('.menu a').removeClass('currentpage').mouseout();
if(window.location.hash.substring(1,4) == 'mod') { real = 1 };
pagenumber = page.substring((parseInt($('#'+page+'').attr('id').length)-1));
dist = Math.abs( $('#page'+pagenumber+'').offset().top - $(window).scrollTop() ); time = 300+(dist/3.5);
$('html,body').animate({scrollTop: $('#page'+pagenumber+'').offset().top }, time, 'jswing', function() {
if(mod) { if (!window.PIE) { $('.model').load('pages/real2.php') }; $('#'+mod+'').click() }; window.location = '#page'+pagenumber });
$('#'+page+'').css('background-color', '#789').addClass('currentpage');
if(real) { removeMod() };
}
var nb_photos; var description; var longueur; var largeur; var tirant; var poids; var materiau; var puissance; var homologation;
var equipement1; var equipement2; var equipement3; var equipement4; var equipement5; var equipement6; var equipement7; var prod;
var carac = 0; var equip = 0;
function showMod(mod, etap) { prod = mod;
switch (etap) {
case 1: // Infos bdd
$.getJSON("pages/real-info.php", { "prod": mod }, function(data) {
nb_photos = data.nb_photos; description = data.description; longueur = data.longueur; largeur = data.largeur;
tirant = data.tirant; poids = data.poids; materiau = data.materiau; puissance = data.puissance; homologation = data.homologation;
equipement1 = data.equipement1; equipement2 = data.equipement2; equipement3 = data.equipement3; equipement4 = data.equipement4;
equipement5 = data.equipement5; equipement6 = data.equipement6; equipement7 = data.equipement7;
carac = data.carac; equip = data.equip;
$('.real').trigger("showMod1") });
break;
case 2: // Ajout des infos
for (i=1; i<(nb_photos+1); i++) { $('.modgal ul').append('
') };
$('.realtitle span').html(' : '+description);
if(version == 'pc') { $('#nbgal').html( Math.ceil(nb_photos/9) ) } else if(version == 'tab') { $('#nbgal').html( Math.ceil(nb_photos/4) ) };
if(longueur != '') { $('#modlongueur').html(longueur) } else { $('#longueur').hide() }; if(equipement1 != '') { $('#modequip1').html(equipement1) } else { $('#equip1').hide() }
if(largeur != '') { $('#modlargeur').html(largeur) } else { $('#largeur').hide() }; if(equipement2 != '') { $('#modequip2').html(equipement2) } else { $('#equip2').hide() }
if(tirant != '') { $('#modtirant').html(tirant) } else { $('#tirant').hide() }; if(equipement3 != '') { $('#modequip3').html(equipement3) } else { $('#equip3').hide() }
if(poids != '') { $('#modpoids').html(poids) } else { $('#poids').hide() }; if(equipement4 != '') { $('#modequip4').html(equipement4) } else { $('#equip4').hide() }
if(materiau != '') { $('#modmateriau').html(materiau) } else { $('#materiau').hide() }; if(equipement5 != '') { $('#modequip5').html(equipement5) } else { $('#equip5').hide() }
if(puissance != '') { $('#modpuissance').html(puissance) } else { $('#puissance').hide() }; if(equipement6 != '') { $('#modequip6').html(equipement6) } else { $('#equip6').hide() }
if(homologation != '') { $('#modhomologation').html(homologation) } else { $('#homologation').hide() }; if(equipement7 != '') { $('#modequip7').html(equipement7) } else { $('#equip7').hide() }
if(!carac && !equip) { $('.modcarac').hide() }; if(!carac) { $('.carac').hide() }; if(!equip) { $('.equip').hide() };
$('.real').trigger("showMod2");
break;
case 3: //Affichage
if (window.PIE) { $('.modgal').each(function() { PIE.attach(this) }); $('.modcarac').each(function() { PIE.attach(this) }) };
$('.realgal').animate({ opacity: 0 }, To3).hide(); $('.model').show().animate({ opacity: 1 }, To3); window.location.hash = '#mod='+mod;
if(window.location.search) { window.location.search = '' };
$('.real').trigger("showMod3");
break;
case 4: //Chargement des images
for (i=1; i<(nb_photos+1); i++) { $('#photo'+i+' img').attr('src', 'prod/'+prod+'/pics/'+i+'.jpg?'+Math.random()) };
$('#photo'+ Math.min(9, nb_photos) +' img').load(function() { $('.loadgal').hide();
for (i=1; i<(nb_photos+1); i++) { $('#photo'+i+' img').delay(200*(i-1)).css('cursor', 'pointer').animate({ opacity: 1 }, To3) }; $('.real').trigger("showMod4") })
break;
case 5: //Animations
Wn = $('.modgal li img').width(); Hn = $('.modgal li img').height(); Wr = $('.modgal li img').width() * 1.055; Hr = $('.modgal li img').height() * 1.074;
Lr = 1-(($('.modgal li img').width() * 0.055)/2); Tr = 1-(($('.modgal li img').height() * 0.074)/2);
Wz = (parseInt($('.modgal ul').width())-(parseInt($('.modgal li').css('margin-left'))*2));
if(version == 'pc' || version == 'tab') { Hz = (parseInt($('.modgal ul').height())-(parseInt($('.modgal li').css('margin-top'))*2)) };
$('.modgal li img').bind('mouseover', function() { if(!$(this).is('.modzoom')) { $(this).stop().animate({ width: Wr, height: Hr, top: Tr, left: Lr }, 150) } });
$('.modgal li img').bind('mouseout', function() { if(!$(this).is('.modzoom')) { $(this).stop().animate({ width: Wn, height: Hn, top: 0, left: 0 }, 150) } });
$('.modgal li img').toggle(function() { if($(this).is('.modzoom')) { return }; $(this).addClass('modzoom'); photoId = $(this).parent().attr('id');
if(version == 'pc') { firstId = (parseInt($('#curgal').html())*9)-8 } else if(version == 'tab') { firstId = (parseInt($('#curgal').html())*4)-3 };
diffTop = ($('#photo'+firstId+' img').offset().top - $(this).offset().top); diffLeft = ($('#photo'+firstId+' img').offset().left - $(this).offset().left);
if(photoId.substring(5) == firstId) { diffLeft += 6; diffTop += 6 };
if(diffLeft < 0) { diffLeft = '-='+Math.abs(diffLeft) } else { diffLeft = '+='+diffLeft }; if(diffTop < 0) { diffTop = '-='+Math.abs(diffTop) } else { diffTop = '+='+diffTop };
$('.modgal li img').each(function() { if($(this).parent().attr('id') != photoId) { $(this).animate({ opacity: 0 }, To3) } });
$(this).css('z-index', 200).delay(100).animate({ width: Wz, height: Hz, top: diffTop, left: diffLeft }, 350, 'easeInBack')
}, function() { $(this).removeClass('modzoom');
$(this).animate({ width: Wn, height: Hn, top: 0, left: 0 }, 275, 'linear', function() { $(this).css('z-index', 20) });
$('.modgal li img').delay(100).animate({ opacity: 1 }, To3);
});
$('.real').trigger("showMod5")
break;
case 6: // Actions
if(version == 'pc') { DiffMargin =($('.modgal ul').height()-17); Max = Math.ceil(nb_photos/9) } else if(version =='tab') { DiffMargin =($('.modgal ul').height()-14); Max = Math.ceil(nb_photos/4) };
$('#rightgal').unbind("click").click(function() { if(parseInt($('#curgal').html()) == Max) { return }; $('.modzoom').click(); $('.modgal li img').animate({ opacity: 1 }, To3);
$('.modgal ul').css({ marginTop: (parseInt($('.modgal ul').css('margin-top'))-DiffMargin)+'px' }); $('#curgal').html( parseInt($('#curgal').html())+1 ) });
$('#leftgal').unbind("click").click(function() { if(parseInt($('#curgal').html()) == 1) { return }; $('.modzoom').click(); $('.modgal li img').animate({ opacity: 1 }, To3);
$('.modgal ul').css({ marginTop: (parseInt($('.modgal ul').css('margin-top'))+DiffMargin)+'px' }); $('#curgal').html( parseInt($('#curgal').html())-1 ) });
if (!window.PIE) { $('#listmodh4').click(function() { removeMod() }) } else {
$('#listmodh4').click(function() { if(window.location.search) { window.location.href = 'index.php#page2' } else { window.location.href = 'index.php?#page2' } }) }
break;
}}
$('.real').bind("showMod1", function() { showMod(prod, 2) }); $('.real').bind("showMod2", function() { showMod(prod, 3) });
$('.real').bind("showMod3", function() { showMod(prod, 4) }); $('.real').bind("showMod4", function() { showMod(prod, 5) });
$('.real').bind("showMod5", function() { showMod(prod, 6) });
function removeMod() { $('.realtitle span').html(''); window.location.hash = '#page2';
if (window.PIE) { $('.modgal').each(function() { PIE.detach(this) }); $('.modcarac').each(function() { PIE.detach(this) }) };
$('.model').animate({ opacity: 0 }, To3).hide(); $('.realgal').show().animate({ opacity: 1 }, To3);
if (!window.PIE) { $('.model').load('pages/real2.php') }
if(window.location.search.substring(1,4) == 'mod') { window.location.search = '' }; }