1var GOOGLE_CAPTCHA_ID_V3 = '6LeLhoIUAAAAACDpGME3MNGDOD-W5pVN62Ir-AIL'; 2 3var PLATFORM = 'pc'; 4 5var ua = navigator.userAgent; 6var browser; 7 8var x = 0; 9var x = 0; 10var y = 0; 11var isDragging = false; 12var imgCoords; 13var widthZoom; 14var ratio; 15var previewWidth = previewHeight = 250; 16var axe; 17var xObjmid = 0; 18var yObjmid = 0; 19var objectToDrag; 20 21var imgX = 0; 22var imgY = 0; 23var imgHeight = 0; 24var imgWidth = 0; 25var imgCoords = [0, 0]; 26var cursor; 27var nav = ""; 28var fromloadzoom = false; 29var countReload = 0; 30 31var screenWidth = screen.width; 32var screenHeight = screen.height; 33 34function getPositionCurseur(e) 35{ 36 37 var DocRef; // Variable pour IE uniquement 38 39 // L'evenement est passee e la fonction 40 // donc tous sauf IEe 41 if (e) { // Dans ce cas on obtient directement la position dans la page 42 x = e.pageX; 43 y = e.pageY; 44 } 45 46 if (y >= 0 && x >= 0) { 47 } else { 48 nav = "ie"; 49 x = event.clientX; 50 y = event.clientY; 51 52 //-- Il faut traiter le CAS des DOCTYPE sous IE 53 if (document.documentElement && document.documentElement.clientWidth) // Donc DOCTYPE 54 { DocRef = document.documentElement; } // Dans ce cas c'est documentElement qui est reference 55 else 56 { DocRef = document.body; } // Dans ce cas c'est body qui est reference 57 58 //-- On rajoute la position liee aux ScrollBars 59 x += DocRef.scrollLeft; 60 y += DocRef.scrollTop; 61 } 62} 63 64function findPos(obj) 65{ 66 var curleft = curtop = 0; 67 curleft = obj.offsetLeft; 68 curtop = obj.offsetTop; 69 return [curleft, curtop]; 70} 71 72function showZoom(url) 73{ 74 if (!document.getElementById('cursor')) { 75 76 var cursor = document.createElement("div"); 77 cursor.setAttribute("id", "cursor"); 78 cursor.setAttribute("onmouseover", 'showZoom(document.getElementById(\'urlZoom\').value);'); 79 cursor.setAttribute("onmousemove", 'drag(event);'); 80 cursor.setAttribute("onmouseout", 'hideZoom();'); 81 cursor.setAttribute("style", 'background-color:#FFF; display:none; filter:alpha(opacity=50); -moz-opacity:0.5; opacity:0.5; z-index:900; position:absolute; border:2px solid #000000;cursor:crosshair;'); 82 document.getElementById('master').appendChild(cursor); 83 /* 84 var html='<div id="cursor" onmouseover="showZoom(document.getElementById(\'urlZoom\').value);" onmousemove="drag(event);" onmouseout="hideZoom();" style="background-color:#FFF; display:none; filter:alpha(opacity=50); -moz-opacity:0.5; opacity:0.5; z-index:900; position:absolute; border:2px solid #000000;cursor:crosshair;" > </div>'; 85 document.getElementById('master').innerHTML+=html; 86 */ 87 } 88 89 if (document.getElementById("img1")) { 90 imgWidth = document.getElementById("img1").offsetWidth; 91 imgHeight = document.getElementById("img1").offsetHeight; 92 imgCoords = findPos(document.getElementById("img1")); 93 94 if (ua.indexOf("MSIE 7") != -1) { 95 IE7imagePos = GetRealOffset("img1"); 96 if (document.getElementById("image").offsetLeft < 50) { 97 imgCoords[0] = IE7imagePos.left - document.getElementById("master").offsetLeft; 98 imgCoords[1] = IE7imagePos.top - document.getElementById("master").offsetTop; 99 } 100 } 101 102 document.getElementById("wImgZoom").value = document.getElementById("imgZoom").width; 103 ratio = document.getElementById("imgZoom").width / document.getElementById("img1").width; 104 105 if (fromloadzoom != true) { document.getElementById("cursor").style.display = "block"; } 106 107 if (ratio > 0) { 108 if ((previewWidth / ratio) < 500 && (previewHeight / ratio) < 500 && (previewWidth / ratio) != null && (previewHeight / ratio) != null) { 109 document.getElementById("cursor").style.width = (previewWidth / ratio) + "px"; 110 document.getElementById("cursor").style.height = (previewHeight / ratio) + "px"; 111 } 112 } 113 // beginDrag(document.getElementById("cursor"),null); 114 } 115 116 var imgbwidth = parseInt(document.getElementById("wImgb").value, 10); 117 118 var incBorder = parseInt(document.getElementById("img1").offsetWidth - document.getElementById("img1").width); 119 document.getElementById("zoom").style.width = previewWidth + "px"; 120 document.getElementById("zoom").style.height = previewHeight + "px"; 121 document.getElementById("zoom").style.left = (imgCoords[0] + imgbwidth + 5 + incBorder) + "px"; 122 document.getElementById("zoom").style.top = imgCoords[1] + "px"; 123 124 if (document.getElementById("wImgZoom").value == '0') { 125 fromloadzoom = true; 126 127 hideZoom(); 128 129 /*url = url.replace('hd.', 'b.'); 130 document.getElementById("urlZoom").value = url; 131 document.getElementById("imgZoom").src = url; 132 console.log('url'+url+document.getElementById("wImgZoom").value);*/ 133 } 134 135 if (fromloadzoom != true) { document.getElementById("zoom").style.display = "block"; } 136 137 loadZoom(url); 138 139 if (fromloadzoom == true) { 140 fromloadzoom = false;
141 } 142} 143 144function loadZoom(url) 145{ 146 147 document.getElementById("urlZoom").value = url; 148 document.getElementById("imgZoom").src = document.getElementById("urlZoom").value; 149 150 ratio = document.getElementById("imgZoom").width / document.getElementById("img1").width; 151 152 if (ratio == 1) { 153 if (document.getElementById("imgZoom").width == document.getElementById("img1").width) { document.getElementById("imgZoom").width = document.getElementById("imgZoom").width * 2; } 154 if (document.getElementById("imgZoom").height == document.getElementById("img1").height) { document.getElementById("imgZoom").height = document.getElementById("imgZoom").height * 2; } 155 document.getElementById("wImgZoom").value = document.getElementById("imgZoom").width; 156 widthZoom = document.getElementById("wImgZoom").value; 157 heightZoom = document.getElementById("imgZoom").height; 158 ratioW = widthZoom / imgWidth; 159 ratioH = heightZoom / imgHeight; 160 161 if (ratioW <= ratioH) { 162 ratio = ratioW; 163 } else { 164 ratio = ratioH; 165 } 166 167 if ((previewWidth / ratio) < 500 && (previewHeight / ratio) < 500 && (previewWidth / ratio) != null && (previewHeight / ratio) != null) { 168 document.getElementById("cursor").style.width = (previewWidth / ratio) + "px"; 169 document.getElementById("cursor").style.height = (previewHeight / ratio) + "px"; 170 } 171 } 172 173 174 if (document.getElementById("cursor").style.width < 10 || document.getElementById("cursor").style.width > 500 || document.getElementById("cursor").style.width == null) { 175 fromloadzoom = true; 176 if (countReload < 5) { 177 countReload++; 178 setTimeout("showZoom('" + url + "')", 200); 179 } else { 180 if (countReload < 10) { 181 countReload++; 182 setTimeout("showZoom('" + url + "')", 400); 183 } else { 184 if (countReload < 15) { 185 countReload++; 186 setTimeout("showZoom('" + url + "')", 600); 187 } 188 } 189 } 190 } 191} 192 193function loadZoomBis(url) 194{ 195 document.getElementById("urlZoom").value = url; 196 document.getElementById("imgZoom").src = document.getElementById("urlZoom").value; 197} 198 199function hideZoom() 200{ 201 document.getElementById("zoom").style.display = "none"; 202 document.getElementById("cursor").style.display = "none"; 203} 204 205function GetRealOffset(id) 206{ 207 var elem = document.getElementById(id); 208 var leftOffset = elem.offsetLeft; 209 var topOffset = elem.offsetTop; 210 var parent = elem.offsetParent; 211 212 var i = 1; 213 while (parent != null && i < 20) { 214 leftOffset += parent.offsetLeft; 215 topOffset += parent.offsetTop; 216 parent = parent.offsetParent; 217 i++; 218 } 219 220 var Offsets = new Object(); 221 Offsets.top = topOffset; 222 Offsets.left = leftOffset; 223 224 //alert(Offsets.top + " " +Offsets.left) 225 return Offsets; 226} 227 228function drag(e) 229{ 230 231 var newPosX = 0; 232 var newPosY = 0; 233 234 var curW = (previewWidth / ratio); 235 var curH = (previewHeight / ratio); 236 237 getPositionCurseur(e); 238 239 var imgCoordsimage = Array(); 240 var imgCoordsmaster = findPos(document.getElementById("master")); 241 imgCoordsimagediv = findPos(document.getElementById("image")); 242 imgCoordsimage["deb"] = findPos(document.getElementById("image")); 243 244 var incBorder = parseInt(document.getElementById("img1").offsetWidth - document.getElementById("img1").width) / 2; 245 246 imgCoordsimage["deb"][0] = imgCoordsimage["deb"][0] + incBorder; 247 imgCoordsimage["deb"][1] = imgCoordsimage["deb"][1] + incBorder; 248 249 if (ua.indexOf("MSIE 7") != -1) { 250 IE7imagePos = GetRealOffset("image"); 251 imgCoordsimage["deb"][0] = IE7imagePos.left + incBorder - document.getElementById("master").offsetLeft; 252 imgCoordsimage["deb"][1] = IE7imagePos.top + incBorder - document.getElementById("master").offsetTop; 253 if (document.getElementById("cursor")) { document.getElementById("cursor").style.position = "absolute"; } 254 } 255 256 imgCoordsimage["fin"] = findPos(document.getElementById("img1")); 257 imgCoordsimage["fin"][0] = imgCoordsimage["deb"][0] + parseInt(document.getElementById("img1").width); 258 imgCoordsimage["fin"][1] = imgCoordsimage["deb"][1] + parseInt(document.getElementById("img1").height); 259 260 newPosY = y - imgCoordsmaster[1] - curH / 2; 261 newPosX = x - imgCoordsmaster[0] - curW / 2; 262 263 if (newPosY <= imgCoordsimage["deb"][1]) { 264 newPosY = imgCoordsimage["deb"][1]; 265 266 } else if (newPosY + curH >= imgCoordsimage["fin"][1]) { 267 newPosY = imgCoordsimage["fin"][1] - curH - 4; 268 } 269 270 if (newPosX <= imgCoordsimage["deb"][0]) { 271 newPosX = imgCoordsimage["deb"][0]; 272 273 } else if (newPosX + curW >= imgCoordsimage["fin"][0]) { 274 newPosX = imgCoordsimage["fin"][0] - curW - 4; 275 } 276 277 var left = (newPosX) + "px";
278 var top = (newPosY) + "px"; 279 280 if (document.getElementById("cursor")) { document.getElementById("cursor").style.left = left; } 281 if (document.getElementById("cursor")) { document.getElementById("cursor").style.top = top; } 282 283 if (document.getElementById("cursor") && document.getElementById("cursor").style.display == "block") { 284 document.getElementById("imgZoom").style.left = (((imgCoordsimage["deb"][0] - incBorder - newPosX) * ratio)) + "px"; 285 document.getElementById("imgZoom").style.top = (((imgCoordsimage["deb"][1] - incBorder - newPosY) * ratio)) + "px"; 286 } 287} 288 289function quantity(type, obj) 290{ 291 if (type == 'moins' && obj.value > 1) 292 { obj.value = parseInt(obj.value) - 1; } 293 else if (type == 'plus') 294 { obj.value = parseInt(obj.value) + 1; } 295} 296 297function change_zoom(id, pid, nzoom, newid, newvalue, ids, ids2) 298{ 299 if (document.getElementById(id)) { 300 if (document.getElementById(id).style.display == "inline") { 301 document.getElementById(id).style.display = "none"; 302 document.getElementById(id).style.position = ""; 303 304 if (newid && newvalue && document.getElementById('pd_zoom')) { 305 if (document.getElementById('change_pdzoom').value == '1') { 306 document.getElementById('pd_zoom').style.display = 'none'; 307 } else { 308 document.getElementById('pd_zoom').style.display = 'block'; 309 } 310 } 311 if (ids) { 312 hide_all(ids); 313 } 314 if (newid && document.getElementById(newid)) { 315 document.getElementById(newid).value = 'product_zoom'; 316 if (document.getElementById('pdtid_defaut')) { document.getElementById('change_img_hd').value = document.getElementById('pdtid_defaut').value; } 317 } 318 } else { 319 if (ids && ids2) { 320 hide_all(ids); 321 hide_all(ids2); 322 } 323 document.getElementById(id).style.display = "inline"; 324 document.getElementById(id).style.position = "absolute"; 325 if (document.getElementById(newid) && newid && newvalue) { 326 document.getElementById(newid).value = newvalue; 327 } 328 if (pid) { 329 if (document.getElementById('change_img_hd')) { 330 document.getElementById('change_img_hd').value = pid; 331 } 332 if (document.getElementById('pid_' + pid)) { 333 document.getElementById('pdtimg_' + pid).src = document.getElementById('pid_' + pid).value; 334 } 335 } 336 if (document.getElementById('pd_zoom')) { 337 if (nzoom == '1') { 338 document.getElementById('pd_zoom').style.display = 'none'; 339 } else { 340 document.getElementById('pd_zoom').style.display = ''; 341 } 342 } 343 } 344 } 345} 346 347function hideshow_id(id, type) 348{ 349 if (document.getElementById(id)) { 350 if (type == 1) 351 { document.getElementById(id).style.display = 'block'; } 352 else 353 { document.getElementById(id).style.display = 'none'; } 354 } 355} 356 357function hideId(id) 358{ 359 if (document.getElementById(id)) { 360 document.getElementById(id).style.display = 'none'; 361 } 362} 363 364function showId(id) 365{ 366 if (document.getElementById(id)) { 367 document.getElementById(id).style.display = 'block'; 368 } 369} 370 371function activeImgPrinc(pdtId) 372{ 373 activeVisible('img1', true); 374 hideall('0', 'change_prozm', pdtId, 'product_zoom', 'zvc'); 375} 376 377function activeVisible(id, isActive) 378{ 379 if (document.getElementById(id)) { 380 if (isActive) { 381 document.getElementById(id).style.visibility = 'visible'; 382 } else { 383 document.getElementById(id).style.visibility = 'hidden'; 384 } 385 } 386} 387 388function getElementsByName_iefix(tag, name) 389{ 390 var elem = document.getElementsByTagName(tag); 391 var arr = new Array(); 392 for (i = 0, iarr = 0; i < elem.length; i++) { 393 att = elem[i].getAttribute("name"); 394 if (att == name) { 395 arr[iarr] = elem[i]; 396 iarr++; 397 } 398 } 399 return arr; 400} 401 402function hide_all(id) 403{ 404 for (var i = 0; i < (getElementsByName_iefix('div', id).length); i++) { 405 getElementsByName_iefix('div', id)[i].style.display = "none"; 406 getElementsByName_iefix('div', id)[i].style.position = ""; 407 } 408} 409 410function hideall_class(type, id) 411{ 412 for (var i = 0; i < (getElementsByName_iefix(type, id).length); i++) { 413 getElementsByName_iefix(type, id)[i].className = ""; 414 } 415} 416 417function hideall(nzoom, newid, pid, ids, ids2) 418{ 419 if (ids && ids2) { 420 hide_all(ids); 421 hide_all(ids2); 422 } 423 424 if (document.getElementById(newid)) { 425 document.getElementById(newid).value = 'product_zoom'; 426 } 427 428 if (document.getElementById(newid)) { 429 document.getElementById('change_img_hd').value = pid; 430 } 431 432 if (document.getElementById('pd_zoom')) { 433 if (nzoom == '1') { 434 document.getElementById('pd_zoom').style.display = 'none'; 435 } else { 436 document.getElementById('pd_zoom').style.display = 'block'; 437 } 438 } 439} 440 441function writeCookie(nom, valeur, jours) 442{ 443 var expDate = new Date() 444 expDate.setTime(expDate.getTime() + (jours * 24 * 3600 * 1000)) 445 document.cookie = nom + "=" + escape(valeur) + ";expires=" + expDate.toGMTString() + "; path=/"; 446} 447 448// this fixes an issue with the old method, ambiguous values 449// with this test document.cookie.indexOf( name + "=" ); 450function getCookie(check_name) 451{ 452 // first we'll split this cookie up into name/value pairs 453 // note: document.cookie only returns name=value, not the other components 454 var a_all_cookies = document.cookie.split(';'); 455 var a_temp_cookie = ''; 456 var cookie_name = ''; 457 var cookie_value = ''; 458 var b_cookie_found = false; // set boolean t/f default f 459 460 for (i = 0; i < a_all_cookies.length; i++) { 461 // now we'll split apart each name=value pair 462 a_temp_cookie = a_all_cookies[i].split('='); 463 464 465 // and trim left/right whitespace while we're at it 466 cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, ''); 467 468 // if the extracted name matches passed check_name 469 if (cookie_name == check_name) { 470 b_cookie_found = true; 471 // we need to handle case where cookie has no value but exists (no = sign, that is): 472 if (a_temp_cookie.length > 1) { 473 cookie_value = unescape(a_temp_cookie[1].replace(/^\s+|\s+$/g, '')); 474 } 475 // note that in cases where cookie is initialized but no value, null is returned 476 return cookie_value; 477 break; 478 } 479 a_temp_cookie = null; 480 cookie_name = ''; 481 } 482 if (!b_cookie_found) { 483 return null; 484 } 485} 486 487if (getCookie('user_resolution') == null) { 488 writeCookie('user_resolution', screen.width + "x" + screen.height, 30); 489} 490
491/* LOGO RECEIVE&PAY in left.php*/ 492function popupcalc(merchantID, montant) 493{ 494 var win2 = window.open("http://www.receiveandpay.com/wallet/customer/calculette.php?MerchantID=" + merchantID + "&Amount=" + montant, 'popup', 'height=503,width=600,status=yes,scrollbars=yes,menubar=no,resizable=yes'); 495} 496 497function popupRnp(name, url, width, height) 498{ 499 var var_popuprnp = window.open(url, name, 'height=' + height + ',width=' + width + ',status=yes,scrollbars=yes,menubar=no,resizable=yes'); 500} 501 502function popupWin(name, url, height) 503{ 504 window.open(url, name, 'height=705,width=615,status=yes,scrollbars=yes,menubar=no,resizable=yes'); 505} 506 507function sf_innerHTML(id, value) 508{ 509 if (document.getElementById(id)) { 510 document.getElementById(id).innerHTML = value; 511 } 512} 513 514if (ua.indexOf("MSIE") != -1) { 515 browser = "ie"; 516} else if (ua.indexOf("Firefox") != -1) { 517 browser = "ff"; 518} else if (ua.indexOf("Safari") != -1 || ua.indexOf("Chrome") != -1) { 519 browser = "webkit"; 520} else { 521 browser = "opera"; 522} 523 524function addToFavorite(url, title) 525{ 526 527 if (browser == "ff") { 528 window.sidebar.addPanel(title, url, ""); 529 } else if (browser == "ie") { 530 window.external.AddFavorite(url, title); 531 } 532} 533 534function getHTTPObject() 535{ 536 if (window.XMLHttpRequest) 537 { return new XMLHttpRequest(); } 538 else if (window.ActiveXObject) 539 { return new ActiveXObject("Microsoft.XMLHTTP"); } 540 else { 541 return; 542 } 543} 544 545function trim(myString) 546{ 547 if (typeof myString !== "string") { 548 return myString; 549 } 550 551 return myString.replace(/^\s+/g, '').replace(/\s+$/g, ''); 552} 553 554function SF_PrintIframe(name) 555{ 556 frames[name].focus(); 557 frames[name].print(); 558} 559 560 561/****** fonctions de verification de champs *****/ 562function checkEmail(inputStr) 563{ 564 if (trim(inputStr) == '') { 565 return false; 566 } 567 568 var mailFormat = /^([\w-\.]+)@\w+([\.-]?\w+)*\.([a-zA-Z]{2,30}|[0-9]{1,10})(\]?)+$/; 569 570 if (inputStr.match(mailFormat)) { 571 return true; 572 } else { 573 return false; 574 } 575} 576 577function checkNormalChar(stringIn) 578{ 579 var retval = false; 580 581 var i; 582 for (i = 0; i <= stringIn.length - 1; i++) { 583 // Caracteres autorises : A->Z, a->z, 0->9 @,_ 584 if (((stringIn.charCodeAt(i) >= 48) && (stringIn.charCodeAt(i) <= 57)) || ((stringIn.charCodeAt(i) >= 64) && (stringIn.charCodeAt(i) <= 90)) || ((stringIn.charCodeAt(i) >= 97) && (stringIn.charCodeAt(i) <= 122)) || (stringIn.charCodeAt(i) == 95) || (stringIn.charCodeAt(i) == 46) || (stringIn.charCodeAt(i) == 45)) { 585 retval = true; 586 } else { 587 retval = false; 588 break; 589 } 590 } 591 return retval; 592} 593 594// teste un champ pour verifier qu'il ne contient que des 595// caracteres alphanumeriques, minuscules ou majuscules 596// avec des contraintes de taille 597// text : champ e tester 598// length_min : taille minimale du champ 599// length_max : taille maximal du champ 600function isAlphaNumerique(text, length_min, length_max) 601{ 602 var pattern = '^[a-zA-Z0-9]{' + length_min + ',' + length_max + '}$'; 603 var comparaison = new RegExp(pattern, 'g'); 604 605 if (comparaison.test(text)) { return true; } 606 else { return false; } 607} 608 609function AddToFavorites(name, url) 610{ 611 if (window.sidebar) { // Firefox 612 window.sidebar.addPanel(name, url, ''); 613 } else { 614 if (window.external && typeof (window.external.AddFavorite) !== "undefined") { 615 // Internet Explorer 616 window.external.AddFavorite(url, name); 617 } 618 } 619} 620 621function number_format(number, decimals, dec_point, thousands_sep) 622{ 623 // http://kevin.vanzonneveld.net 624 // + original by: Jonas Raoni Soares Silva (http://www.jsfromhell.com) 625 // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) 626 // + bugfix by: Michael White (http://crestidg.com) 627 // + bugfix by: Benjamin Lupton 628 // + bugfix by: Allan Jensen (http://www.winternet.no) 629 // + revised by: Jonas Raoni Soares Silva (http://www.jsfromhell.com) 630 // * example 1: number_format(1234.5678, 2, '.', ''); 631 // * returns 1: 1234.57 632 633 var n = number, 634 c = isNaN(decimals = Math.abs(decimals)) ? 2 : decimals; 635 var d = dec_point == undefined ? "," : dec_point; 636 var t = thousands_sep == undefined ? "." : thousands_sep, 637 s = n < 0 ? "-" : ""; 638 var i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", 639 j = (j = i.length) > 3 ? j % 3 : 0; 640 641 return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : ""); 642} 643 644 645function strpos(haystack, needle) 646{ 647 // Finds position of first occurrence of a string within another 648 // 649 // version: 1107.2516 650 // discuss at: http://phpjs.org/functions/strpos // + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) 651 // + improved by: Onno Marsman 652 // + bugfixed by: Daniel Esteban 653 // + improved by: Brett Zamir (http://brett-zamir.me) 654 // * example 1: strpos('Kevin van Zonneveld', 'e', 5); // * returns 1: 14 655 var i = (haystack + '').indexOf(needle, 0); 656 return i === -1 ? false : true; 657} 658 659//GLOBAL 660 661function SFgetElementsByName(tag, attrName, attrValue) 662{ 663 //compatible IE 664 var elem = document.getElementsByTagName(tag); 665 var arr = new Array(); 666 for (i = 0, iarr = 0; i < elem.length; i++) { 667 att = elem[i].getAttribute(attrName); 668 if (att == attrValue) { 669 arr[iarr] = elem[i]; 670 iarr++; 671 } 672 } 673 return arr; 674} 675 676function SFsetClassName(tag, attrName, attrValue, classValue) 677{ 678 for (var i = 0; i < (SFgetElementsByName(tag, attrName, attrValue).length); i++) { 679 SFgetElementsByName(tag, attrName, attrValue)[i].className = classValue; 680 681 } 682} 683 684function SFRemoveClassName(tag, attrName, attrValue, classValue) 685{ 686 for (var i = 0; i < (SFgetElementsByName(tag, attrName, attrValue).length); i++) { 687 objId = SFgetElementsByName(tag, attrName, attrValue)[i]; 688 deleteClass(objId, classValue); 689 } 690} 691 692//BEGIN PRODUCT 693function SFselectTabInit(briefcaseId, tabName) 694{ 695 if (document.getElementById(tabName + '1')) { 696 SFselectTab(briefcaseId, '1'); 697 return; 698 } else if (document.getElementById(tabName + '6')) { 699 SFselectTab(briefcaseId, '6'); 700 } 701} 702 703function SFselectTab(briefcaseId, contentNumber) 704{ 705 var currentTab = 'tab' + contentNumber; 706 var currentContent = 'contentTab' + contentNumber; 707 708 SFsetClassName('div', 'data-name', 'titreTab', 'tab'); 709 SFsetClassName('div', 'data-name', 'contentTab', 'content'); 710 711 document.getElementById(currentTab).className = 'tab-active'; 712 document.getElementById(currentContent).className = 'content-active'; 713 714} 715 716//END PRODUCT 717 718/** 719 * @return {boolean} 720 */ 721function SFwinRedirect(urlHttp) 722{ 723 if (urlHttp != '') { 724 if (strpos(urlHttp, 'http://') !== false || strpos(urlHttp, 'https://') !== false) { 725 window.location.href = urlHttp; 726 727 return true; 728 } 729 } 730 731 return false;
732} 733 734function formFindIdByTypeTag(type) 735{ 736 var isError = false; 737 for (var i = 0; i < (SFgetElementsByName(type, 'data-required', '1').length); i++) { 738 var thisId = SFgetElementsByName(type, 'data-required', '1')[i].id; 739 var objId = document.getElementById(thisId); 740 var error = false; 741 if (objId) { 742 if (trim(objId.value) == '') { 743 error = true; 744 } else if ((objId.type == "checkbox" && objId.checked == false)) { 745 error = true; 746 } else if (objId.type == "file") { 747 var strExt = objId.accept; 748 if (strExt != '') { 749 if (!strpos(strExt, 'image')) { 750 var extFile = objId.value.split('.').pop(); 751 if (!strpos(strExt, extFile)) { 752 error = true; 753 } 754 } 755 } 756 } 757 if (error) { 758 isError = true; 759 addClass(objId, 'form_err'); 760 } else { 761 deleteClass(objId, 'form_err'); 762 } 763 764 } 765 } 766 return isError; 767} 768 769function addClass(objId, class_name) 770{ 771 772 if (typeof objId == "string") 773 { objId = document.getElementById(objId); } 774 775 if (strpos(objId.className, class_name) === false) 776 { objId.className += " " + class_name; } 777} 778 779function deleteClass(objId, class_name) 780{ 781 782 if (typeof objId == "string") 783 { objId = document.getElementById(objId); } 784 785 var str = objId.className; 786 objId.className = str.replace(" " + class_name, ""); 787} 788 789function validFormPost() 790{ 791 var error = false; 792 793 var isError1 = formFindIdByTypeTag('input'); 794 var isError2 = formFindIdByTypeTag('textarea'); 795 var isError3 = formFindIdByTypeTag('select'); 796 797 if (isError1 || isError2 || isError3) { 798 error = true; 799 } 800 801 return !error; 802} 803 804function getValueRadio(radio) 805{ 806 for (var i = 0; i < radio.length; i++) { 807 if (radio[i].checked) { 808 return radio[i].value; 809 } 810 } 811} 812 813function getValueByEleId(id) 814{ 815 if (document.getElementById(id)) { 816 return document.getElementById(id).value; 817 } 818 819 return ''; 820} 821 822/** 823 * Create Slider 824 * 825 * @param id 826 */ 827function createSlider(id) 828{ 829 var slider = $(id); 830 831 var interval = slider.attr("data-interval"); 832 var speed = slider.attr("data-speed"); 833 834 var autoPlay = Boolean(Number(slider.attr("data-autoplay"))); 835 var circular = Boolean(Number(slider.attr("data-circular"))); 836 var keyboard = Boolean(Number(slider.attr("data-keyboard"))); 837 838 slider.scrollable({ 839 circular: circular, 840 speed: speed, 841 keyboard: keyboard 842 }); 843 844 slider.navigator({ 845 activeClass: 'current', 846 navi: '.slidetabs', 847 naviItem: 'a' 848 }); 849 850 slider.autoscroll({ 851 autoplay: autoPlay, 852 interval: interval 853 }); 854} 855 856function SFaddEventListener(domElement, eventName, callBackFunction) 857{ 858 if (domElement) { 859 if (domElement.addEventListener) { 860 /*W3C DOM*/ 861 domElement.addEventListener(eventName, callBackFunction, false); 862 } else if (domElement.attachEvent) { 863 /*IE DOM*/ 864 domElement.attachEvent(eventName, callBackFunction); 865 } 866 } 867} 868 869function menu(menu, state) 870{ 871 if (document.getElementById) { 872 document.getElementById(menu).style.visibility = state; 873 } else { 874 document[menu].visibility = state; 875 } 876} 877 878function showMenuVertical2(id) 879{ 880 var d = document.getElementById(id); 881 for (var i = 1; i <= 30; i++) { 882 if (document.getElementById('smenu' + i)) { 883 document.getElementById('smenu' + i).style.display = 'none'; 884 } 885 } 886 if (d) { 887 d.style.display = 'block'; 888 } 889} 890 891function demarche(page) 892{ 893 window.open(page, 'demarche', 'width=400,height=400,toolbar=false,scrollbars=false'); 894} 895 896function calculette(page) 897{ 898 window.open(page, 'calculette', 'width=600,height=495,toolbar=false,scrollbars=false'); 899} 900 901function winopen(url, name, w, h) 902{ 903 window.open(url, name, 'width=' + w + ',height=' + h + ',status=yes,scrollbars=yes,menubar=no,resizable=yes'); 904} 905 906function closeCookieBar() 907{ 908 writeCookie('okCookie', 1, '365'); 909 hideId('cookie-law-info-bar'); 910} 911 912function checkFormData() 913{ 914 var err = false;
915 916 $('input[data-required],select[data-required],textarea[data-required]').each( 917 function () { 918 var id = $(this).attr("id"); 919 if (document.getElementById(id)) { 920 if (trim(document.getElementById(id).value) == '') { 921 document.getElementById(id).style.background = 'pink'; 922 err = true; 923 } else { 924 document.getElementById(id).style.background = ''; 925 } 926 } else { 927 console.log('id not set on field data-required: "' + id + '"'); 928 } 929 } 930 ); 931 932 $('input[data-check="checkEmail"]').each( 933 function () { 934 var id = $(this).attr("id"); 935 936 if (document.getElementById(id)) { 937 if (checkEmail(document.getElementById(id).value) === false) { 938 document.getElementById(id).style.background = 'pink'; 939 err = true; 940 } else { 941 document.getElementById(id).style.background = ''; 942 } 943 } else { 944 console.log('id not set on field data-required: "' + id + '"'); 945 } 946 } 947 ); 948 949 return !err; 950} 951 952/** 953 * Wish List 954 */ 955function addListenerWishList() 956{ 957 var items = document.querySelectorAll("#list_contener .wishlist,#list_contener .wishlist.wishlist_added, #home .wishlist,#home .wishlist.wishlist_added, #product .wishlist,#product .wishlist.wishlist_added"); 958 959 if (items.length > 0) { 960 for (var i = 0; i < items.length; i++) { 961 SFaddEventListener(items[i], "click", addWishList); 962 } 963 } 964} 965 966function toggleMenu() 967{ 968 var idElement = this.getAttribute('data-target'); 969 var target = document.getElementById(idElement); 970 var content = target.getAttribute('data-active'); 971 972 if (content === 'false') { 973 showId(idElement); 974 target.setAttribute('data-active', 'true'); 975 } else { 976 hideId(idElement); 977 target.setAttribute('data-active', 'false'); 978 } 979} 980 981/** 982 * Slider Footer 983 */ 984function createSliderListView() 985{ 986 var element = document.getElementById('slider_list_viewed'); 987 element.style.width = (parseInt(screenWidth) - 70) + 'px'; 988 989 $("#slider_list_viewed").scrollable({ 990 circular: true, 991 speed: 500, 992 interval: 2000 993 }).navigator(); 994} 995 996var callbackSendFriend = function (token) { 997 document.getElementById('action').value = 'validate'; 998 document.getElementById('token').value = token; 999 document.getElementById('formulaire').submit(); 1000 document.getElementById('token').value = ''; 1001}; 1002 1003function onLoadSendFriend(event) 1004{ 1005 event.preventDefault(); 1006 1007 var nameFrom = document.getElementById('ctx_name_from'); 1008 var mailFrom = document.getElementById('ctx_email_from'); 1009 var mailTo = document.getElementById('ctx_mail_to'); 1010 1011 if (nameFrom && nameFrom.value === '') { 1012 alert(document.getElementById('pf_13').value); 1013 document.getElementById('ctx_name_from').focus(); 1014 return false; 1015 } else if (mailFrom && (mailFrom.value === '' || !checkEmail(mailFrom.value))) { 1016 alert(document.getElementById('pf_14').value); 1017 mailFrom.focus(); 1018 return false; 1019 } else if (mailTo.value === '' || !checkEmail(mailTo.value)) { 1020 alert(document.getElementById('pf_12').value); 1021 mailTo.focus(); 1022 return false; 1023 } else { 1024 grecaptcha.execute(); 1025 } 1026} 1027 1028function validateFormCustom(event) 1029{ 1030 event.preventDefault(); 1031 1032 if (validFormPost() === false) { 1033 document.getElementById('popup_validation_form').style.display = 'block'; 1034 } else { 1035 grecaptcha.ready(function () { 1036 grecaptcha.execute(GOOGLE_CAPTCHA_ID_V3, {action: 'formCustom'}).then(function (token) { 1037 if (document.getElementById('checkc')) { 1038 document.getElementById('formPost').action = '/mag/' + document.getElementById('lang').value + '/form_post.php?'; 1039 document.getElementById('action').value = 'valid'; 1040 document.getElementById('token').value = token; 1041 document.getElementById('formPost').submit(); 1042 document.getElementById('token').value = ''; 1043 } else { 1044 console.log('Error form checkc'); 1045 return false;
1046 } 1047 }); 1048 }); 1049 } 1050} 1051 1052var callbackContact = function (token) { 1053 document.getElementById('action').value = 'validate'; 1054 document.getElementById('token').value = token; 1055 document.getElementById('formulaire').submit(); 1056 document.getElementById('token').value = ''; 1057}; 1058 1059function onLoadContact(event) 1060{ 1061 event.preventDefault(); 1062 1063 if (checkFormData() === false || checkAcceptCGVAccount() === false) { 1064 return false; 1065 } else { 1066 grecaptcha.execute(); 1067 } 1068} 1069 1070var callbackSponsor = function (token) { 1071 document.getElementById('action').value = 'validate'; 1072 document.getElementById('token').value = token; 1073 document.getElementById('formulaire').submit(); 1074 document.getElementById('token').value = ''; 1075}; 1076 1077function onLoadSponsor(event) 1078{ 1079 event.preventDefault(); 1080 1081 var err = ''; 1082 1083 for (var i = 1; i <= 5; i++) { 1084 if (document.getElementById('ctx_cli_mail' + i).value != '') { 1085 if (!checkEmail(document.getElementById('ctx_cli_mail' + i).value)) { 1086 err += document.getElementById('ctx_cli_mail' + i).value + '\n'; 1087 } 1088 } else { 1089 if (i == 1) { 1090 err += document.getElementById('ctx_cli_mail' + i).value + '\n'; 1091 } 1092 } 1093 } 1094 1095 if (err != '') { 1096 alert(document.getElementById('ac_56').value + ' \n ' + err); 1097 return false; 1098 } else { 1099 grecaptcha.execute(); 1100 } 1101} 1102 1103function setFormCheckHuman() 1104{ 1105 document.getElementById("contenerrobot").innerHTML = '<input type="hidden" name="isHuman" id="isHuman" value="1">'; 1106} 1107 1108document.addEventListener('DOMContentLoaded', function () { 1109 addListenerWishList(); 1110 1111 if (document.getElementById('slider_list_viewed')) { 1112 createSliderListView(); 1113 } 1114 1115 SFaddEventListener(document.querySelector('#actionToggleSticky'), "click", toggleMenu); 1116 SFaddEventListener(document.querySelector('#actionCloseSticky'), "click", toggleMenu); 1117 1118 SFaddEventListener(document.querySelector('#btnFormCustom'), "click", validateFormCustom); 1119 SFaddEventListener(document.querySelector('#btnContact'), "click", onLoadContact); 1120 SFaddEventListener(document.querySelector('#btnSponsor'), "click", onLoadSponsor); 1121 SFaddEventListener(document.querySelector('#btnSendFriend'), "click", onLoadSendFriend); 1122 1123 SFaddEventListener(document.querySelector('#formSearch'), "submit", formSearch); 1124 1125 if (document.getElementById('searchLiveResult')) {
1126 SFaddEventListener(document.querySelector('#ctx_search'), "focus", SearchLive); 1127 } 1128}); 1129 1130/* Basket top + right*/ 1131 1132function showChar(numItems, total) 1133{ 1134 sf_innerHTML('par_g', '('); 1135 sf_innerHTML('par_d', ')'); 1136 1137 if (numItems == 0) { 1138 sf_innerHTML('numit_basket', '0'); 1139 sf_innerHTML('charact_basket', getValueByEleId('msg_z9_06')); 1140 } else if (numItems == 1) { 1141 sf_innerHTML('charact_basket', getValueByEleId('msg_z9_06')); 1142 } else if (numItems > 1) { 1143 sf_innerHTML('charact_basket', getValueByEleId('msg_z9_07')); 1144 } 1145 1146 if (total) { 1147 sf_innerHTML('chartotal_basket', getValueByEleId('msg_z9_08')); 1148 sf_innerHTML('currency_basket', getValueByEleId('msg_currency')); 1149 sf_innerHTML('charit_basket', getValueByEleId('msg_it_ot')); 1150 } else { 1151 sf_innerHTML('chartotal_basket', ''); 1152 sf_innerHTML('currency_basket', ''); 1153 sf_innerHTML('charit_basket', ''); 1154 } 1155} 1156 1157function showChar_dbasket(total) 1158{ 1159 sf_innerHTML('chartotal_dbasket', getValueByEleId('msg_z9_08')); 1160 sf_innerHTML('currency_dbasket', getValueByEleId('msg_currency')); 1161 sf_innerHTML('charit_dbasket', getValueByEleId('msg_it_ot')); 1162} 1163 1164function popup_alert(type, divname, param) 1165{ 1166 if (type == 'stocklimit') 1167 { sf_innerHTML(divname, "<span>" + getValueByEleId('z9_23') + " " + param + " " + getValueByEleId('z9_24') + "</span>"); } 1168 1169 document.getElementById(divname).style.display = 'inline'; 1170} 1171 1172/* End Basket top + right*/ 1173 1174function showNavigation() 1175{ 1176 document.getElementById('navigation').innerHTML = document.getElementById('navigation_bottom_temp').innerHTML; 1177 document.getElementById('navigation_bottom_temp').innerHTML = ''; 1178 1179 var navig_ff = getCookie('navig_ff'); 1180 1181 if (navig_ff != '') { 1182 var elements = document.querySelector("#aria2>a"); 1183 if (elements && strpos(navig_ff, elements.href) !== false) { 1184 elements.href = navig_ff; 1185 } 1186 writeCookie('navig_ff', '', 1); 1187 } 1188} 1189 1190function precisionRound(number, precision) 1191{ 1192 var factor = Math.pow(10, precision); 1193 return Math.round(number * factor) / factor; 1194} 1195 1196function checkAcceptCGV() 1197{ 1198 if (document.getElementById('ckb_accept_cgv') && document.getElementById('ckb_accept_cgv').checked === false) { 1199 alert(document.getElementById('msg_z6_09').value); 1200 return false; 1201 } 1202 return true; 1203} 1204 1205function checkAcceptCGVAccount() 1206{ 1207 if (document.getElementById('ckb_accept_cgv_account') && document.getElementById('ckb_accept_cgv_account').checked === false) { 1208 alert(document.getElementById('msg_z6_09').value); 1209 return false; 1210 } 1211 return true; 1212} 1213 1214function reaproPopupOpen() 1215{ 1216 document.getElementById('popupAlertReapro').style.display = 'block'; 1217 moveEltChild('option_contener', 'popupAlertReaproOptionContainer'); 1218} 1219 1220function reaproPopupClose() 1221{ 1222 moveEltChild('popupAlertReaproOptionContainer', 'option_contener'); 1223 document.getElementById('popupAlertReapro').style.display = 'none'; 1224} 1225 1226function reaproPopupSend(pdtId) 1227{ 1228 var optid_array = []; 1229 var listoptid_array = []; 1230 var opt_param = ""; 1231 1232 var i = 1; 1233 while (document.getElementById('hidden_choice_opt_' + i)) { 1234 optid_array.push(document.getElementById('hidden_choice_opt_' + i).value); 1235 listoptid_array.push(document.getElementById('hidden_choice_listopt_' + i).value); 1236 opt_param = opt_param + "&input_choice_opt_" + i + "=" + document.getElementById('input_choice_opt_' + i).value; 1237 opt_param = opt_param + "&hidden_choice_opt_" + i + "=" + document.getElementById('hidden_choice_opt_' + i).value; 1238 opt_param = opt_param + "&hidden_choice_listopt_" + i + "=" + document.getElementById('hidden_choice_listopt_' + i).value; 1239 i++; 1240 } 1241 1242 if (document.getElementById("mail_reapro_pop") && document.getElementById("mail_reapro_pop").value != "") { 1243 var xhr_object = null; 1244 xhr_object = getHTTPObject(); 1245 xhr_object.open("POST", "/mag/reaprosubscribe.php", true); 1246 xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 1247 xhr_object.send("mail=" + document.getElementById("mail_reapro_pop").value + "&pdtId=" + pdtId + "&listoptid_array=" + listoptid_array + "&optid_array=" + optid_array + "&rnd=" + Math.random()); 1248 1249 xhr_object.onreadystatechange = function () { 1250 if (xhr_object.readyState == 4) { 1251 var reponse = xhr_object.responseText; 1252 if (reponse == "badMail") { 1253 document.getElementById("mail_reapro_pop_errorMail").style.display = "inline"; 1254 document.getElementById("popupAlertOptionNotSelected").style.display = "none"; 1255 } else if (reponse == "ok") { 1256 reaproPopupClose(); 1257 document.getElementById("popupConfirmReapro").style.display = "inline"; 1258 } else if (reponse == "optionNotSelected") { 1259 document.getElementById("popupAlertOptionNotSelected").style.display = "inline"; 1260 document.getElementById("mail_reapro_pop_errorMail").style.display = "none"; 1261 } 1262 } 1263 } 1264 } else { 1265 document.getElementById("mail_reapro_pop_errorMail").style.display = "inline"; 1266 } 1267} 1268 1269function moveEltChild(eltSrcId, eltDestId) 1270{ 1271 var eltSrc = document.getElementById(eltSrcId); 1272 var eltDest = document.getElementById(eltDestId);
1273 while (thisChild = eltSrc.firstChild) { 1274 eltSrc.removeChild(thisChild); 1275 eltDest.appendChild(thisChild); 1276 } 1277} 1278 1279function paginationAdvSearch(page, idForm) 1280{ 1281 document.getElementById('page').value = page; 1282 1283 document.getElementById(idForm).submit(); 1284} 1285 1286function changeTotalCrossSell() 1287{ 1288 var eltTotal = $('#crossSellTotal'); 1289 var total = Number(eltTotal.text()); 1290 1291 var thisId = $(this).attr('data-id'); 1292 var eltPriceBlock = $('#slider_cross_selling_top .block_price'); 1293 var eltImg = $('#imgCrossSell_' + thisId); 1294 var eltTitle = $('#titreCrossSell_' + thisId); 1295 1296 if ($(this).prop('checked')) { 1297 $(this).prop('checked', 'checked'); 1298 total += Number($(this).val()); 1299 1300 eltImg.fadeIn(); 1301 eltTitle.css('opacity', '1'); 1302 } else { 1303 total -= Number($(this).val()); 1304 1305 eltImg.fadeOut(); 1306 eltTitle.css('opacity', '0.5'); 1307 } 1308 1309 total = total.toFixed(2); 1310 1311 if (total <= 0) { 1312 eltTotal.text(total); 1313 eltPriceBlock.fadeOut(); 1314 } else { 1315 eltPriceBlock.fadeOut(); 1316 eltTotal.text(total); 1317 eltPriceBlock.fadeIn(); 1318 } 1319} 1320 1321function addCartCrossSell(lang) 1322{ 1323 var isAdded = false; 1324 1325 $('input[data-action=ckbChange]').each( 1326 function () { 1327 if ($(this).prop('checked')) { 1328 var pdtId = $(this).attr('data-id'); 1329 checkStockAndAdd(pdtId, 'popup', 'id=' + pdtId + '&lang=' + lang + '&nb=1&popup_inactive=1'); 1330 isAdded = true; 1331 } 1332 } 1333 ); 1334 1335 if (isAdded) { 1336 setTimeout(function () { 1337 window.location.href = 'mag/' + lang + '/shoppingcart.php'; 1338 }, 500); 1339 } 1340} 1341 1342function formSearch(e) 1343{ 1344 if (document.getElementById('ctx_search') && document.getElementById('ctx_search').value.length < 3) { 1345 alert(document.getElementById('msg_z7_06').value); 1346 1347 e.preventDefault(); 1348 } 1349} 1350 1351var SearchLive = function () { 1352 var lastValue = this.value; 1353 1354 this.onkeyup = function () { 1355 setTimeout(function () { 1356 SearchLive.changeValue(); 1357 }, 1500); 1358 }; 1359 1360 SearchLive.changeValue = function () { 1361 var newValue = $('#ctx_search').val(); 1362 1363 newValue = newValue.trim(); 1364 1365 if (newValue.length >= 3 && lastValue != newValue) { 1366 lastValue = newValue; 1367 1368 SearchLive.getResult(newValue); 1369 } 1370 }; 1371 1372 SearchLive.getResult = function (searchValue) { 1373 $.post("/mag/searchLive.php", { value: searchValue}) 1374 .done(function (data) { 1375 if (data != '') { 1376 data = data.replace("{msg_se_05}", $('#msg_se_05').val()); 1377 1378 $('#searchLiveResult').html(data); 1379 1380 activeVisible('searchLiveResult', true); 1381 } else { 1382 activeVisible('searchLiveResult', false); 1383 } 1384 }); 1385 } 1386}; 1387 1388var CountDownTimer = function ($clock) { 1389 var clock = $clock; 1390 1391 var endTime = clock.attr('data-date'); 1392 1393 var daysDiv = clock.find('.days-div'); 1394 var daysSpan = clock.find('.days'); 1395 var hoursSpan = clock.find('.hours'); 1396 var minutesSpan = clock.find('.minutes'); 1397 var secondsSpan = clock.find('.seconds'); 1398 1399 this.initialize = function() 1400 { 1401 this.timeInterval = setInterval(this.updateClock, 1000); 1402 }; 1403 1404 CountDownTimer.getTimeRemaining = function (endTime) { 1405 var total = new Date(endTime) - new Date(); 1406 var seconds = Math.floor((total / 1000) % 60); 1407 var minutes = Math.floor((total / 1000 / 60) % 60); 1408 var hours = Math.floor((total / (1000 * 60 * 60)) % 24); 1409 var days = Math.floor(total / (1000 * 60 * 60 * 24)); 1410 1411 return { 1412 total: total, 1413 days: days, 1414 hours: hours, 1415 minutes: minutes, 1416 seconds: seconds 1417 }; 1418 }; 1419 1420 this.updateClock = function () { 1421 var counter = CountDownTimer.getTimeRemaining(endTime); 1422 1423 daysSpan.html(counter.days); 1424 hoursSpan.html(('0' + counter.hours).slice(-2)); 1425 minutesSpan.html(('0' + counter.minutes).slice(-2)); 1426 secondsSpan.html(('0' + counter.seconds).slice(-2)); 1427 1428 if (counter.days <= 0) { 1429 daysDiv.hide(); 1430 } 1431 1432 if (counter.total <= 0) { 1433 clearInterval(this.timeInterval); 1434 } 1435 }; 1436}; 1437 1438function callFeatureCountdown() 1439{ 1440 $(".countdown_timer").attr("feature", 'countdown_timer').each(function () { 1441 new CountDownTimer($(this)).initialize(); 1442 }); 1443} 1444 1445function productLinkImageOpt() 1446{ 1447 $("#option_contener .link-img").each(function () { 1448 $(this).on("change", function () { 1449 if (SFwinRedirect($(this).val()) === false) { 1450 getPrice($(this).attr("data-pdtid")); 1451 1452 var optImgId = $(this).find(':selected').attr('data-optimg'); 1453 if (optImgId !== undefined && optImgId !== '0') { 1454 $("#image").find('.imgx[data-pdtimg="'+optImgId+'"]').click(); 1455 } 1456 } 1457 }); 1458 }); 1459} 1460 1461function subscribeNewsletter(store_id, email) { 1462 if (email == null) { 1463 if (document.getElementById("mail_newsletter") && document.getElementById("mail_newsletter").value != "") { 1464 email = document.getElementById("mail_newsletter").value; 1465 } 1466 } 1467 1468 if (email != '') { 1469 var xhr_object = null; 1470 xhr_object = getHTTPObject(); 1471 xhr_object.open("GET", "/mag/newsletter.php?mail=" + email, true); 1472 1473 xhr_object.onreadystatechange = function () { 1474 if (xhr_object.readyState == 4) { 1475 var reponse = xhr_object.responseText; 1476 if (reponse == "1") { 1477 document.getElementById("alert_newslet_sub").style.display = "inline"; 1478 } else { 1479 document.getElementById("alert_newslet_error").style.display = "inline"; 1480 document.getElementById("alert_newslet_sub").style.display = "none"; 1481 } 1482 } 1483 }; 1484 1485 xhr_object.send(null); 1486 } else { 1487 document.getElementById("alert_newslet_error").style.display = "inline"; 1488 } 1489}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.