function initPage() { var nav = document.getElementById("navigation"); if (nav) { var nodes = nav.getElementsByTagName("li"); for (var i = 0; i < nodes.length; i++) { nodes[i].onmouseover = function () { if (this.className.indexOf("hover") == -1) { this.className += " hover"; hideSelectBoxes(this.getElementsByTagName("ul")[0]); } } nodes[i].onmouseout = function () { this.className = this.className.replace(" hover", ""); showSelectBoxes(this.getElementsByTagName("ul")[0]); } } } } if (window.attachEvent && !window.opera) window.attachEvent("onload", initPage); function hideFormText(){ var _inputs = document.getElementsByTagName('input'); for(var i = 0; i < _inputs.length; i++){ if(_inputs[i].type == 'text' || _inputs[i].type == 'password'){ _inputs[i].val = _inputs[i].value; _inputs[i].onfocus = function(){ if(this.value == this.val) this.value = ''; } _inputs[i].onblur = function(){ if(this.value == '') this.value = this.val; } } } } if (window.addEventListener) window.addEventListener("load", hideFormText, false); else if (window.attachEvent) window.attachEvent("onload", hideFormText); $(document).ready(function(){ /* <<< PIERRE */ $('div.product ul li a').click(function(){ $('div.product ul li').removeClass('active'); $(this).parent().addClass('active'); var tmp=$(this).attr('href').split(';'); $('img#img_pierre').parent().attr('href',tmp[0]+tmp[2]); $('img#img_pierre').parent().attr('title',$(this).attr('title')); $('img#img_pierre').attr('alt',$(this).attr('title')); fadeIMG(tmp[0]+tmp[1],'img#img_pierre'); }); $('a.vue-en-detail, a.vue-globale').click(function(){ $(this).parent().parent().find('li').removeClass('active'); $(this).parent().addClass('active'); pierreList(); }); $('a.ajouter-selection').click(function(){ var id_pierre=$(this).attr('href').substring(7); maselectionCreate(); maselectionShow(id_pierre); $(this).remove(); }); /* >>> PIERRE */ $('a.ma-selection').click(function(){ maselectionCreate(); if($('#maselection').css('display')=='block') $('#maselection').slideUp(1000); else maselectionShow(0); }); $('div.inform-section a.fermer').hide(); $('div.i-t-table.fiche').hide(); $('div.inform-section a.fermer').click(function(){ $('div.inform-section a.ouvrir').show(); $('div.i-t-table.fiche').slideUp(1000); $(this).hide(); }); $('div.inform-section a.ouvrir').click(function(){ $('div.inform-section a.fermer').show(); $('div.i-t-table.fiche').slideDown(1000,function(){ $('html,body').animate({scrollTop: $('a[name=ouvrir]').offset().top},500); }); $(this).hide(); }); $('div.i-t-row div.col-01').hover(function(){ var offset = $(this).offset(); if(!$('div.popup-area').length) { $('body').prepend(''); $('.popup-area').hide(); } var terme=$(this).find('strong').html(); var div=$(this); if(!div.find('div').length) { $.ajax({ type:'GET', url:chemin_root+'ajax-glossaire.php', data:'lg='+lg+'&terme='+terme+'&ajax=1', error:function(data){ alert('Erreur : '+data); }, success:function(data){ if(data!='') { $('.popup-area .popup-info').html(data); $('.popup-area').show(); $('.popup-area').css({'position':'absolute','z-index':'999','left':offset.left+120,'top':(offset.top-$('.popup-area').height()+4)}); } div.append('
'+data+'
'); } }); } else if(div.find('div').html()!='') { $('.popup-area .popup-info').html(div.find('div').html()); $('.popup-area').show(); $('.popup-area').css({'position':'absolute','z-index':'999','left':offset.left+120,'top':(offset.top-$('.popup-area').height()+4)}); } },function(){ $('.popup-area').hide(); }); /* INITIALISATION */ $("a[rel=lightbox]").lightbox(); pierreOver(); realisation(); setInterval('banner()',3000); }); function banner() { var l=$('div#banner img').length; if(l>1) { $('div#banner img:not(.active)').hide(); $('div#banner img').each(function(img){ if($(this).hasClass('active')) { $(this).css('z-index',2); $('div#banner img:eq('+(img+1'); $('#maselection').css({'position':'absolute','z-index':'999','left':offset.left,'top':(offset.top+28)}); $('#maselection').hide(); } } function maselectionShow(id_pierre) { $.ajax({ type:'GET', url:chemin_root+'ajax-selection.php', data:'lg='+lg+'&id_pierre='+id_pierre+'&ajax=1', error:function(data){ alert('Erreur : '+data); }, success:function(data){ $('#maselection').html(data); $('#maselection ul li div.input').hide(); $('#maselection').slideDown(1000,function(){ $('#maselection ul li').fadeIn(1000); }); $('#maselection a.comparer').click(function(){ $(this).unbind('click'); $('#maselection ul li div.input').show(1000); $(this).html('Compare'); $(this).attr('class','envoyer'); $(this).click(function(){ var selection=$('#maselection ul li div.input input:checked').length; if(selection>1 && selection<6) { $('form[name=form_selection]').attr('action',$('input[name=action_comparer]').val()); $('form[name=form_selection]').submit(); } else alert('Select between 2 and 5 stones'); }); }); $('#maselection a.telecharger').click(function(){ $(this).unbind('click'); $('#maselection ul li div.input').show(1000); $(this).html('Télécharger'); $(this).attr('class','envoyer'); $(this).click(function(){ var selection=$('#maselection ul li div.input input:checked').length; if(selection>0) { $('form[name=form_selection]').attr('action',$('input[name=action_telecharger]').val()); $('form[name=form_selection]').submit(); } else alert('Select at least one stone'); }); }); } }); } function fadeIMG(src,dest) { var picture=$(dest); var img = new Image(); $(img).load(function(){ picture.fadeOut(250,function() { picture.attr('src',src); picture.fadeIn(250,function() { }) }) }) .error(function () { }) .attr('src',src); } /* <<< PIERRE */ function pierreOver() { $('ul#p-gallery li a').mouseover(function(){ $('div.popup').remove(); $('body').prepend(''); $('div.popup').html('
'+$(this).attr('title')+' 
'); $('div.popup').hide(); $('div.popup').css('z-index','9999'); $('div.popup').css('position','absolute'); $('div.popup').css('top',$(this).offset().top-35); $('div.popup').css('left',$(this).offset().left-35); $('div.popup').fadeIn(500); $('div.popup').mouseout(function(){ $('div.popup').remove(); }); }); } function pierreList() { $.ajax({ type:'GET', url:chemin_root+'ajax-pierre-liste.php', data:'lg='+lg+'&vue='+$('div.btn-hold ul').find('li.active a').attr('class')+'&pierre='+$('div.recherchez-box select#nom').val()+'&finition_possible='+$('div.recherchez-box select#nuance').val()+'&utilisation_possible='+$('div.recherchez-box select#application').val()+'&utilisation_interieur='+($('div.recherchez-box input#interieur').attr('checked')?'1':'0')+'&utilisation_exterieur='+($('div.recherchez-box input#exterieur').attr('checked')?'1':'0')+'&ajax=1', error:function(data){ alert('Erreur : '+data); }, success:function(data){ $('div.promo-gallery-b').fadeOut('slow',function() { $(this).html(data); $(this).fadeIn('slow'); pierreOver(); }); } }); } /* >>> PIERRE */ /* <<< REALISATIONS */ function realisation() { $("a[rel=lightbox-realisation]").lightbox(); realisation_click=false; function realisationClick(a) { $('div.gallery-list-h ul li').removeClass('active'); a.parent().addClass('active'); var tmp=a.attr('href').split(';'); $('img#img_realisation').parent().parent().find('a.loupe').attr('href',tmp[0]+tmp[2]); $('img#img_realisation').parent().parent().find('a.loupe').attr('title',a.attr('title')); $('img#img_realisation').parent().attr('href',tmp[0]+tmp[2]); $('img#img_realisation').parent().attr('title',a.attr('title')); $('img#img_realisation').attr('alt',a.attr('title')); $.ajax({ type:'GET', url:chemin_root+'ajax-realisation.php', data:'lg='+lg+'&id_photo='+a.attr('rel').substring(5)+'&inc_rub='+$('input#realisation_rub').val()+'&inc_srub='+$('select#realisation_srub').val()+'&inc_ssrub='+$('select#realisation_ssrub').val()+'&ajax=1', error:function(data){ alert('Erreur : '+data); }, success:function(data){ $('div.infos-b').fadeOut('slow',function() { $(this).html(data); $(this).fadeIn('slow'); }); } }); fadeIMG(tmp[0]+tmp[1],'img#img_realisation'); } $('div.gallery-list-h ul li a').click(function(){ realisationClick($(this)); }); $('div.g-main-img a.prev, div.g-main-img a.next').click(function(){ if(!realisation_click) { realisation_click=true; var debut=parseInt($('div.gallery-list-h ul').css('margin-left'))/-113; var li=$('div.gallery-list-h ul li').length; var left=$('div.gallery-list-h ul li.active').prevAll().length+($(this).hasClass('next')?1:-1); if(left<0) left=li-1; else if(left>=li) left=0; realisationClick($('div.gallery-list-h ul li:eq('+left+') a')); if(left>=(debut+6)) left=(left-5)*-113; else if(left<0) left=(li-6)*-113; else if(left<=debut) left=left*-113; else if(left==0) left=0; else left='none'; if(left=='none') realisation_click=false; else { $('div.gallery-list-h ul').animate({marginLeft:left+'px'},500,'linear',function(){ realisation_click=false; }); } } }); $('div.gallery-list a.prev, div.gallery-list a.next').click(function(){ if(!realisation_click) { realisation_click=true; var li=$('div.gallery-list-h ul li').length; var left=parseInt($('div.gallery-list-h ul').css('margin-left')); if(left>=0 && $(this).hasClass('prev')) left=(li-5)*-113; if(left<=((li-6)*-113) && $(this).hasClass('next')) left=113; $('div.gallery-list-h ul').animate({marginLeft:+($(this).hasClass('prev')?left+113:left-113)+'px'},500,'linear',function(){ realisation_click=false; }); } }); $('div[id^=bassin]').hide(); $('map#carte_bassin area').click(function(){ $('div[id^=bassin]').hide(1000); $('div#bassin'+$(this).attr('href').substr(1,2)).show(1000); }); } function realisationList() { $('span#rea_srub').html($('#realisation_srub').prev().find('span:eq(2)').html()); $('span#rea_ssrub').html($('#realisation_ssrub').prev().find('span:eq(2)').html()); $.ajax({ type:'GET', url:chemin_root+'ajax-realisation-liste.php', data:'lg='+lg+'&inc_rub='+$('input#realisation_rub').val()+'&inc_srub='+$('select#realisation_srub').val()+'&inc_ssrub='+$('select#realisation_ssrub').val()+'&ajax=1', error:function(data){ alert('Erreur : '+data); }, success:function(data){ $('div.gallery-b').fadeOut('slow',function() { $(this).html(data); $(this).fadeIn('slow'); realisation(); }); } }); } function realisationSelect() { $.ajax({ type:'GET', url:chemin_root+'ajax-realisation-liste-select.php', data:'lg='+lg+'&inc_rub='+$('input#realisation_rub').val()+'&inc_srub='+$('select#realisation_srub').val()+'&ajax=1', error:function(data){ alert('Erreur : '+data); }, success:function(data){ $('select#realisation_ssrub').fadeOut('slow',function() { $(this).html(data); $(this).fadeIn('slow'); init(); }); } }); } function realisationClassique() { $.ajax({ type:'GET', url:chemin_root+'include/classique.php', data:'lg='+lg+'&inc_rub='+$('input#realisation_rub').val()+'&inc_srub='+$('select#realisation_srub').val()+'&ajax=1', error:function(data){ alert('Erreur : '+data); }, success:function(data){ $('div#classique').fadeOut('slow',function() { $(this).html(data); $(this).fadeIn('slow'); }); } }); } /* >>> REALISATIONS */