// JavaScript Document var CookieEnabled = (document.cookie.length>0); var imagesPath = "/skins/default/images/"; var photosPath = ""; var input = new Array(); // Appends Get Vars into js Vars var url = String(self.location); var tmp = url.split("?"); if (tmp[1]) { var queryString = tmp[1]; vars = queryString.split('#'); vars = vars[0].split('&'); var _GET = new Array(); for (var i = 0 ; i < vars.length; ++i ) { tmp = vars[i].split('='); _GET[tmp[0]] = tmp[1]; } } function checkMail(adresse){ var regEx = /([a-z0-9]+([-_]?[a-z0-9]+)*.)*[a-z0-9]+([-_]?[a-z0-9]+)*@([a-z0-9]+([-_]?[a-z0-9]+)*.)+[a-z]{1,4}/gi; if (adresse.match(regEx) != adresse ) { return false; } else { return true; } } function _Elem(id) { return document.getElementById(id); } function _Error(id) { if (id.indexOf('_input') > 0) { _Elem(id.replace(/_input/,'_str')).style.borderColor = '#FF0000'; } else { _Elem(id).style.borderColor = '#FF0000'; } } function _Valid(id) { if (id.indexOf('_input') > 0) { _Elem(id.replace(/_input/,'_str')).style.borderColor = '#cecece'; } else { _Elem(id).style.borderColor = '#cecece'; } } function checkArray(required) { var nbErr = 0; for (i=0; i < required.length; i++) { if (required[i].indexOf('|') > 0 ) { var tmp = required[i].split('|'); var eee = 0; for (j=0; j 0 || _Elem(tmp[j]).value > 0) { eee++; } } for (j=0; j 0 ) { var tmp = required[i].split('&'); var eee = 0; var a = _Elem(tmp[0]).value; for (j=0; j= 0) { if (checkMail(_Elem(required[i]).value)) { _Valid(required[i]); } else { nbErr++; _Error(required[i]); } } else { if (_Elem(required[i]).value == 0 || _Elem(required[i]).value == '') { nbErr++; _Error(required[i]); } else { _Valid(required[i]); } } } return nbErr; } function CheckRappel() { var required = {rappel_societe:'Société', rappel_nom:'Nom', rappel_telephone:'Téléphone',rappel_code_postal:'Code postal'}; nbErr = 0; for (i in required) { if ( _Elem(i).value == '' || _Elem(i).value == required[i] ) { nbErr ++; _Error(i); } else _Valid(i); } return nbErr == 0; } function checkCommentaire() { var required = new Array('pseudo','email', 'message'); var nbErr = checkArray(required); return nbErr == 0; } function checkInscriptionFast() { var required = new Array('insc_pseudo','insc_email', 'insc_motdepasse&insc_motdepasse2'); var nbErr = checkArray(required); return nbErr == 0; } function checkLogin() { var required = new Array('login_email', 'login_motdepasse'); var nbErr = checkArray(required); return nbErr == 0; } // cookies function EcrireCookie(nom, valeur) { var argv=EcrireCookie.arguments; var argc=EcrireCookie.arguments.length; var expires=(argc > 2) ? argv[2] : null; var path='/'; var domain=(argc > 4) ? argv[4] : null; var secure=(argc > 5) ? argv[5] : false; document.cookie=nom+"="+escape(valeur)+ ((expires==null) ? "" : ("; expires="+expires.toGMTString()))+ ((path==null) ? "" : ("; path="+path))+ ((domain==null) ? "" : ("; domain="+domain))+ ((secure==true) ? "; secure" : ""); } function getCookieVal(offset) { var endstr=document.cookie.indexOf (";", offset); if (endstr==-1) endstr=document.cookie.length; return unescape(document.cookie.substring(offset, endstr)); } function LireCookie(nom) { var arg=nom+"="; var alen=arg.length; var clen=document.cookie.length; var i=0; while (i=0) { if (coul) this.aryEntry[idx].couleur = coul; if (marq) this.aryEntry[idx].marquage = marq; if (quant) this.aryEntry[idx].quantite = quant; if (designation) this.aryEntry[idx].designation = designation; } else { this.aryEntry[this.aryEntry.length] = {id:produit_id, couleur:coul, marquage:marq, quantite:quant,designation:designation}; this.nbElem = this.aryEntry.length; } this.sauver(); this.afficher(); if (alerter == true) { if (CookieEnabled) Alerte('Message', 'Le produit a été ajouté à votre sélection'); else Alerte('Message', 'Vous devez activer les cookies dans les preferences de votre navigateur pour pouvoir demander un devis.'); } }, supprimer:function(produit_id) { idx = -1; for(i=0; i=0) { for (i=idx; i<(this.aryEntry.length-1); i++) { this.aryEntry[i] = this.aryEntry[i+1]; with(this.aryEntry[i]) { EcrireCookie('PanierEntry'+i,id+'|'+couleur+'|'+marquage+'|'+quantite+'|'+designation); } } this.aryEntry.splice(this.aryEntry.length-1,1); this.nbElem = this.aryEntry.length; EffacerCookie('PanierEntry'+this.aryEntry.length-1); EcrireCookie('PanierNbElem',this.nbElem); } self.location = '/votre-devis'; }, sauver:function() { EcrireCookie('PanierNbElem', this.nbElem); for(i=0; i 1) s = 's'; else s = ''; if (this.nbElem > 0) { var elems = ''; for (i=0; i0)?(''+this.aryEntry[i].quantite+'x '):'')+this.aryEntry[i].designation+'  
'; } elems+='
'; _Elem('Panier').innerHTML = elems+''; } else _Elem('Panier').innerHTML = '
Votre selection est vide.
'; }, vider:function() { EffacerCookie('PanierNbElem'); for (i=0; i 180) //AkisiBulleOffset = {x:5,y:-180}; //else AkisiBulleOffset = {x:5,y:35}; AkisiBulleOffset = {x:5,y:-180}; Show('AkisiBulleDiv'); if (IE) Show('AkisiBulleIframe'); if (IE) { document.onmousemove = AkisiBulleFollowMouse; obj.onmouseout = HideAkisiBulle; } else { document.addEventListener('mousemove', AkisiBulleFollowMouse, true); obj.addEventListener('mouseout', HideAkisiBulle, true); } _Elem('AkisiBulleDiv').innerHTML = '
'; } } function Zoomer(src) { if (src.indexOf('1x1.gif')== -1) { _Elem('ZoomImg').src = src.replace(/250x250/,'500x500'); Show('dvZoom'); } } function checkContact(isdevis) { nbErr = 0; fieldToFocus = 'none'; aryChk = new Array('raison_sociale','nom', 'telephone','email','code_postal'); for (i=0;i 0) { prod = new produit(ajaxCallBack); prod.ajaxGetCatsSite(id); } else { _Elem('categorie_id').options.length = 1; } } var ajaxCallBack = { ajaxGetCatsSite: function(ary) { _Elem('categorie_id').options.length = 1; if (ary['aryCats']) for (i = 0; i < ary['aryCats'].length; i++) selectAddOption('categorie_id', ary['aryCats'][i]['libelle'], ary['aryCats'][i]['categorie_id']); } } function selectAddOption(sId, oText, oVal, where) { sTmp = _Elem(sId); nbOptions = sTmp.options.length; if (where == 'top') { for(i=nbOptions; i >= 1 ; i--) { sTmp.options[i] = new Option (sTmp.options[i-1].innerHTML, sTmp.options[i-1].value); } sTmp.options[0] = new Option(oText, oVal); } else { sTmp.options[nbOptions] = new Option(oText, oVal); } } function acallback(item) { _Elem('mot_clef').value = item.text; //_Elem('mot_clef').form.submit(); self.location='/'+item.url; }