1if (windowID == null) var windowID=1; 2if (Loaded == null) var Loaded=false; 3productPattern = /-[0-9]{1,9}-/; 4productPatternLG = /-[0-9]{1,9}/; 5 6var agntUsr = navigator.userAgent.toLowerCase(); 7var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1; 8var isMac = (navigator.appVersion.indexOf("Mac") != -1); 9var isSafari = (navigator.appVersion.indexOf("Safari") != -1); 10var isMobile = (/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(agntUsr) || (agntUsr.includes("mac") && "ontouchend" in document)); 11 12function msieversion() { 13 var ua = window.navigator.userAgent 14 var msie = ua.indexOf ( "MSIE " ) 15 16 if ( msie > 0 ) // If Internet Explorer, return version number 17 return parseInt (ua.substring (msie+5, ua.indexOf (".", msie ))) 18 else // If another browser, return 0 19 return 0 20} 21 22window.console = typeof window.console === 'undefined' ? { log:function(str) {} } : window.console; 23 24// if (InternetExplorer && (msieversion() < 7)) document.write("<script language='JavaScript' src='/scripts/fixpng.js'><\/script>"); 25// if (!InternetExplorer) document.write("<script type='text/javascript' src='/scripts/mozilla.js'><\/script>"); 26 27function popUp() {} 28function popDown() {} 29 30function trim(str) { 31 str.replace(/^\s*/, '').replace(/\s*$/, ''); 32 33 return str; 34} 35 36function numvalidate(string) { 37 if (!string) return false; 38 var Chars = "0123456789"; 39 40 for (var i = 0; i < string.length; i++) { 41 if (Chars.indexOf(string.charAt(i)) == -1) 42 return false; 43 } 44 return true; 45} 46 47function SelectAll(obj) { 48 for (var i=0; i<obj.length; i++) 49 obj.options[i].selected=1; 50} 51 52function addListItem(obj, valueObj) { 53 newItem = valueObj.value; 54 obj.options[obj.options.length] = new Option(newItem,newItem,false,false); 55 valueObj.value=''; 56} 57 58function remListItems(container) { 59 counter=0; 60 while (counter<container.length) 61 if (container.options[counter]) { if (container.options[counter].selected) container.options[counter] = null; else counter++;} 62 else counter++; 63} 64 65function prevPic(args) { 66 for (var i = prodArray[args].length-1; i>-1; i--) { 67 if (parseInt(document.getElementById("pin" + args).innerText) > i+1) { 68 document.getElementById("pin" + args).innerText = i+1; 69 obj = document.images["pim" + args]; 70 objSrc = obj.src; 71 72 objSrc = objSrc.replace(productPattern, '-'+prodArray[args][i]+'-'); 73 obj.src = objSrc; 74 75 break; 76 } 77 } 78} 79 80function nextPic(args) { 81 for (var i = 0; i<prodArray[args].length; i++) { 82 if (parseInt(document.getElementById("pin" + args).innerText) < i+1) { 83 document.getElementById("pin" + args).innerText = i+1; 84 obj = document.images["pim" + args]; 85 objSrc = obj.src; 86 87 objSrc = objSrc.replace(productPattern, '-'+prodArray[args][i]+'-'); 88 obj.src = objSrc; 89 90 break; 91 } 92 } 93 } 94 95function resizePhoto(width, height, id) { 96 if (document.getElementById('pim'+id) != null) objType = 'pim'; 97 else if (document.getElementById('pic'+id) != null) objType = 'pic'; 98 else return; 99 100 obj = (InternetExplorer) ? document.getElementById(objType+id) : document.embeds[objType+id]; 101 obj.width = width; 102 obj.height = height; 103 104 if (parent.usingIFRAME != null) { parent.iFrameRedraw(); } 105} 106 107 108var iframeids=["n"]; 109 110function iFrameRedraw(height) { 111 var dyniframe=new Array() 112 for (i=0; i<iframeids.length; i++){ 113 if (document.getElementById) { //begin resizing iframe procedure 114 dyniframe[dyniframe.length] = document.getElementById(iframeids[i]); 115 if (dyniframe[i]) { 116 dyniframe[i].style.display="block" 117 if (window.opera) { //Opera 7+ syntax 118 document.title = dyniframe[i].document.title; 119 dyniframe[i].height = dyniframe[i].document.documentElement.clientHeight; 120 } 121 else if (dyniframe[i].contentDocument && dyniframe[i].contentDocument.body.offsetHeight) { //ns6 syntax 122 document.title = dyniframe[i].contentDocument.title; 123 dyniframe[i].height = dyniframe[i].contentDocument.body.offsetHeight+20; 124 } 125 else if (dyniframe[i].Document && dyniframe[i].Document.body.scrollHeight) { //ie5+ syntax 126 document.title = dyniframe[i].Document.title; 127 dyniframe[i].height = dyniframe[i].Document.body.scrollHeight; 128 } 129 130 if (height != null && height > dyniframe[i].height) dyniframe[i].height = height; 131 } 132 } 133 } 134} 135 136function Loadit() { 137 if (parent.nav != null && parent.nav.Go != null) parent.nav.Go(); 138 else if (parent.Go != null) parent.Go(); 139 Loaded=false; 140} 141 142function visi(id, isIt) { 143 document.getElementById(id).style.visibility = (isIt) ? 'visible' : 'hidden'; 144} 145 146function slide(toX, toY, id, hide, speed) { 147 if (speed == null) speed = 10; 148 if (hide == null) hide = false; 149 150 obj = document.getElementById(id); 151 obj.style.visibility = 'visible'; 152 153 changed = false; 154 if (obj) { 155 wX = parseInt(obj.style.left); 156 wY = parseInt(obj.style.top); 157 158 if (wX != toX) { 159 obj.style.left = (wX > toX) ? wX-1 : wX+1; 160 changed = true; 161 } 162 if (wY != toY) { 163 obj.style.top = (wY > toY) ? wY-1 : wY+1; 164 changed = true; 165 } 166 167 if (changed) setTimeout("slide(" + toX + "," + toY + ",'" + id + "')", 10); 168 } 169 170 if (hide) obj.style.visibility = 'hidden'; 171} 172 173function centerWindow(windowID, resizeX, resizeY) { 174 if (resizeX != null && resizeY != null) windowID.resizeTo(resizeX, resizeY); 175 else { 176 if (document.body.clientWidth == null || (document.body.clientWidth != null && document.body.clientWidth == 0)) return; 177 178 resizeX=document.body.clientWidth; 179 resizeY=document.body.clientHeight; 180 } 181
182 windowID.moveTo(screen.availWidth/2-resizeX/2, screen.availHeight/2-resizeY/2); 183 windowID.focus(); 184} 185 186function resizeWindow(wx, wy) { 187 if (document.body.clientWidth == null || (document.body.clientWidth != null && document.body.clientWidth == 0)) return; 188 window.resizeTo(wx,wy); 189 var Xoffset=wx-document.body.clientWidth; 190 var Yoffset=wy-document.body.clientHeight; 191 var resizeX=document.getElementById('resize').offsetWidth+Xoffset; 192 var resizeY=document.getElementById('resize').offsetHeight+Yoffset; 193 194 centerWindow(window, resizeX, resizeY); 195 window.focus(); 196} 197 198function gotoURL(url,tgt) { 199 if (tgt == null) tgt = '_self'; 200 if (url.indexOf('javascript:')!=-1) var Vote = eval(url.substring(11, url.length)); 201 else if (tgt != '_self' && tgt != '_top') window.open(url,tgt); 202 else window.location=url; 203} 204 205function checkEnter(e) { 206 var characterCode; 207 208 if (e && e.which) characterCode = e.which; 209 else { 210 e = event; 211 characterCode = e.keyCode; 212 } 213 214 return (characterCode == 13); 215} 216function mOvr(src,cOvr,msg) { 217 window.status=msg; 218 if (cOvr != null) (cOvr.indexOf('#') == -1) ? src.className = cOvr : src.bgColor = cOvr; 219} 220function mOut(src,cOut) { 221 window.status=''; 222 if (cOut != null) (cOut.indexOf('#') == -1) ? src.className = cOut : src.bgColor = cOut; 223} 224 225function printPage() { 226 if (window.print) window.print() 227 else alert("Sorry, your browser doesn't support this feature."); 228} 229 230function printIFRAME(frame) { 231 if (InternetExplorer) { 232 document.getElementById(frame).focus(); 233 document.getElementById(frame).print(); 234 } 235 else { 236 window.frames[frame].focus(); 237 window.frames[frame].print(); 238 } 239} 240 241function popURL(url, w, h, scrollbars, center, toolbar, resizable, name) { 242 if (w == null) w = 530; 243 if (h == null) h = 500; 244 if (scrollbars == null) scrollbars = 'yes'; 245 if (center == null) center = false; 246 if (toolbar == null) toolbar = 'no'; 247 if (resizable == null) resizable = 'no'; 248 249 lt = (center) ? ',left='+(screen.availWidth - w) / 2 + ',top='+(screen.availHeight - h) / 2 : ''; 250 251 if (url.indexOf(':') == -1 && url.indexOf('/images/') == -1 && url.indexOf('/p/') == -1) url = '/?p='+url; 252 253 if (name == null) { 254 windowID = url.length*windowID; 255 windowID++; 256 } 257 else windowID = name; 258 259 try { 260 wID = window.open(url,'mpop'+windowID,'menubar=no,resizable='+resizable+',width='+w+',height='+h+',screenX=0,screenY=0,scrollbars='+scrollbars+',statusbar=no,toolbar='+toolbar + lt); 261 wID.focus(); 262 } 263 catch(e) {} 264} 265 266function ecom_cart(id, qty) { 267 if (typeof qty != 'undefined' && parseInt(qty) > 0) document.location = '/?p=shopping.cart.add&id='+id+'&qty='+qty; 268 else document.location = '/?p=shopping.cart.add&id='+id; 269} 270 271function ecom_wishList(id) { 272 document.location = '/?p=shopping.wishlist.add&id='+id 273} 274 275function ecom_expandPhoto(id, index) { 276 popURL('products/opt/onlyPhoto/id/' + id + '&index=' + document.getElementById('pin'+index).innerText, 480, 400, 'yes', 'yes'); 277} 278 279function ecom_status(action) { 280 switch (action) { 281 case 'addBasket': 282 window.status = 'Add to Cart.'; 283 break; 284 case 'wishList': 285 window.status = 'Add to Wishlist.'; 286 break; 287 case 'expandPhoto': 288 window.status = 'Expand Photo.'; 289 break; 290 case 'clear': 291 window.status = ''; 292 } 293} 294 295function showmessage(msg) { 296 alert(msg); 297} 298 299function changeColor(element, color) { 300 if (element != null) element.style.backgroundColor = color; 301} 302 303function MM_swapImgRestore() { //v3.0 304 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; 305} 306 307function MM_preloadImages() { //v3.0 308 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); 309 var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) 310 if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} 311} 312 313function MM_findObj(n, d) { //v4.01 314 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { 315 d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} 316 if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
317 for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); 318 if(!x && d.getElementById) x=d.getElementById(n); return x; 319} 320 321function MM_swapImage() { //v3.0 322 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) 323 if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} 324} 325 326function CF_RunContent(src){document.write(src);} 327 328var sig1 = new Image(); 329var sig2 = new Image(); 330sig1.src = ''; 331sig2.src = ''; 332 333function showCredits(e, html) { 334 var parentOffset = $("#dtCredits").parent().offset(); 335 var relX = e.pageX - parentOffset.left; 336 var relY = e.pageY - parentOffset.top; 337 $("#dtCredits").css({left:relX,top:relY - $("#dtCredits").height() }).fadeIn(); 338} 339 340function hideCredits() { 341 $("#dtCredits").fadeOut(); 342} 343 344function thisMovie(movieName) { 345 if (navigator.appName.indexOf("Microsoft") != -1) { 346 return window[movieName] 347 } 348 else { 349 return document[movieName] 350 } 351} 352 353function insertTips(id, tipPattern) { 354 divs = document.getElementById(id); 355 for (t = 0; t < tipPattern.length; t++) 356 if (divs.innerText.search(tipPattern[t][0]) != -1) divs.innerHTML = divs.innerHTML.replace(tipPattern[t][0], tipPattern[t][1]); 357} 358 359function search(str) { 360 document.forms[0].SrchStr.value = str; 361 document.forms[0].submitIt.click(); 362} 363 364function srchCheck() { 365 if (document.forms[0].SrchStr.value.length<3) { alert("Please enter a Search string of at least 3 characters."); (document.forms[0].SrchStr.type == 'hidden') ? '': document.forms[0].SrchStr.focus(); return false; } 366 else return true; 367} 368 369if(!Array.prototype.indexOf) { 370 Array.prototype.indexOf = function(needle) { 371 for(var i = 0; i < this.length; i++) { 372 if(this[i] === needle) { 373 return i; 374 } 375 } 376 return -1; 377 }; 378} 379 380function fieldChecker(theform) { 381 var theField = ""; 382 var msg = ""; 383 var doPrompt = 0; 384 var isChecked = 0; 385 var fieldList = new Array(); 386 var jqry = typeof jQuery != 'undefined'; 387 thisFieldCheck = (typeof fieldCheck != 'undefined') ? fieldCheck : new Array(); 388 389 $("span.isrequired").removeClass("isrequired"); 390 391 if (jqry && ($("[name$=_req],.isrequired", "[name='"+ theform +"']").length >0)) { 392 if ($("[name$=_req],.isrequired", "[name='"+ theform +"']").length != thisFieldCheck.length) { 393 thisFieldCheck.length = 0; 394 395 $.each($("[name$=_req],.isrequired", "[name='"+ theform +"']"), function(i,v) { 396 var theTag = v.tagName; 397 var theElement = $(v); 398 var fname = $(v).attr("name").replace(/\_req$/, '').replace(/_/g, ' '); 399 400 if ($(v).data("requiredtext")) fname = $(v).data("requiredtext"); 401 402 if (fieldList.indexOf($(v).attr("name")) == -1) { 403 thisFieldCheck.push([$(v).attr("name"), fname.charAt(0).toUpperCase() + fname.slice(1) ]); 404 fieldList.push($(v).attr("name")) 405 } 406 }); 407 } 408 } 409 410 if (typeof tinymce != "undefined") tinymce.triggerSave(); 411 412 for (var i = 0; i<thisFieldCheck.length; i++) { 413 if (thisFieldCheck[i][0] == '') { msg += "\n\n------- "+ thisFieldCheck[i][1] +" -------\n"; continue; } 414 415 theField = document.forms[theform][thisFieldCheck[i][0]]; 416 if (!theField.id) theField.id = thisFieldCheck[i][0]; 417 if (jqry) $('#'+ theField.id, "[name='"+ theform +"']").addClass('FieldsReq'); 418 419 if (theField.type == "text" && thisFieldCheck[i][1].toLowerCase().indexOf('email') != -1 && ( theField.value.indexOf('@')==-1 || theField.value.split("@").length != 2 || theField.value.indexOf('.')==-1 || theField.value.replace(/^ /, '').replace(/ $/, '').indexOf(' ')!=-1 || theField.value.length<6 ) ) { doPrompt += 1; msg += "- "+ thisFieldCheck[i][1] +" (invalid address)\n"; } 420 else if (thisFieldCheck[i][1].toLowerCase().indexOf('email') != -1 && typeof document.forms[theform].confirmemail != 'undefined' && theField.value != document.forms[theform].confirmemail.value) { doPrompt += 1; msg += "- The email addresses entered do not match.\n"; } 421 else if (thisFieldCheck[i][1].toLowerCase().indexOf('country') != -1 && (theField.value == "X" || theField.value == "")) { doPrompt += 1; msg += "- "+ thisFieldCheck[i][1] +"\n"; } 422 else if (thisFieldCheck[i][1].toLowerCase() == "password") { 423 if (theField.value.length<6) { doPrompt += 1; msg += "- Your password must be at least 6 characters.\n"; } 424 if (thisFieldCheck[i][1] != "" && typeof eval("document.forms[theform]." + thisFieldCheck[i][1]) != "undefined" && theField.value != eval("document.forms[theform]." + thisFieldCheck[i][1]).value) { doPrompt += 1; msg += "- Your passwords don't match.\n"; } 425 } 426 else if (thisFieldCheck[i][0].toLowerCase().indexOf('password_1') != -1) { 427 if (theField.value.length<6) { doPrompt += 1; msg += "- Your password must be at least 6 characters.\n"; } 428 if (typeof eval("document.forms[theform]." + thisFieldCheck[i][0].toLowerCase().replace(/_1(_req)?/, '_2')) != 'undefined' && theField.value != eval("document.forms[theform]." + thisFieldCheck[i][0].toLowerCase().replace(/_1(_req)?/, '_2') + ".value")) { doPrompt += 1; msg += "- Your passwords don't match.\n"; } 429 } 430 else if ((theField.length != null && theField.length && (theField[0].type == "checkbox" || theField[0].type == "radio")) || theField.type == "checkbox" || theField.type == "radio") { 431 if (theField.length != null) { 432 isChecked = 0; 433 434 for (var li = 0; li<theField.length; li++) 435 if (theField[li].checked) isChecked++; 436 437 if (isChecked == 0) { doPrompt += 1; msg += "- "+ thisFieldCheck[i][1] +"\n"; } 438 } 439 else if (!theField.checked) { doPrompt += 1; msg += "- "+ thisFieldCheck[i][1] +"\n"; } 440 } 441 else if (theField.value.length == 0 || (jqry && $('#'+ theField.id, "[name='"+ theform +"']").hasClass("autotext") && typeof theField.defaultValue != 'undefined' && theField.value.replace(/ /g, '') == theField.defaultValue.replace(/ /g, ''))) { doPrompt += 1; msg += "- "+ thisFieldCheck[i][1] +"\n"; } 442 else if (jqry) $('#'+ theField.id, "[name='"+ theform +"']").removeClass('FieldsReq'); 443 444 if (doPrompt > 20) break; 445 } 446 447 if (doPrompt > 0) { alert("Please complete the required(*)/highlighted fields:\n\n" + msg, null, "Required Fields", "OK"); return false; } 448 449 return true; 450} 451 452function randomrange(m,n) { 453 return ( Math.floor ( Math.random ( )*0.9999999999999999* (n - m + 1) + m) ); 454} 455 456function random_number(min,max) { 457 return randomrange(min,max); 458} 459 460function fixfloat(number) { 461 return (parseFloat(number.toPrecision(12))); 462} 463 464function roundAccurately(number, decimalPlaces) { 465 return Number(Math.round(Number(number + "e" + decimalPlaces)) + "e" + decimalPlaces * -1); 466} 467 468function verifyCaptcha(hash, txt) { 469 var captchachk;
470 if (txt.substr(0,1).charCodeAt() == 126) txt = txt.replace(String.fromCharCode("126"), "").split("").reverse().join(""); 471 captchachk = $.ajax({ url:"/formmail/", type:"POST", data:{captchaverify:txt, captcha:hash}, async:false}).responseText; 472 if (captchachk.indexOf("captcha-invalid") != -1) { alert("Incorrect Anti-Spam code entered, please try again."); return false; } 473 else if (captchachk.indexOf("captcha-replay") != -1) { alert("That Anti-Spam code has already been used, please try another code."); $(".reloadCaptcha").trigger("click"); return false; } 474 else return true; 475} 476 477function checkAndVerify(frm, hash, txt) { 478 var frmdatacCode = $("[name='"+ frm +"'] [name=captchaCode]"); 479 if ($(frmdatacCode).length && txt.substr(0,1).charCodeAt() == 126) { 480 txt = txt.replace(String.fromCharCode("126"), "").split("").reverse().join(""); 481 $(frmdatacCode).val(txt); 482 } 483 return fieldChecker(frm) && verifyCaptcha(hash, txt); 484} 485 486function checkAndSubmit(frm) { 487 var theform = $("[name='"+ frm +"']"); 488 var thebutton = $("[name='"+ frm +"'] [type=submit]"); 489 var frmdataSupported = typeof window.FormData != 'undefined'; 490 var frmdatacCode = $("[name='"+ frm +"'] [name=captchaCode]"); 491 var formData = ""; 492 493 if ($(theform).closest(".frms").length && $(theform).closest(".frms")[0].hasAttribute("data-stripe") && !$("[name=fmm_credit_card_number]", "[name='"+ frm +"']").val().length) { 494 createStripeToken(frm); 495 return; 496 } 497 498 if (!fieldChecker(frm)) return; 499 else thebutton.data("btntext", thebutton.val()).val("Please wait...").prop("disabled", true); 500 501 if ($(frmdatacCode).length && $(frmdatacCode).val().substr(0,1).charCo
501deAt() == 126) $(frmdatacCode).val( $(frmdatacCode).val().replace(String.fromCharCode("126"), "").split("").reverse().join("") ); 502 503 if (frmdataSupported && $(theform).find(".frm-field-file").length) { 504 formData = new FormData(document.querySelector( "[name='"+ frm +"']" )); 505 506 $.ajax({ 507 url: theform.attr("action"), 508 data: formData, 509 cache: false, 510 contentType: false, 511 processData: false, 512 type: 'POST' 513 }) 514 .done(function(data) { 515 if (typeof data.result != "undefined") { 516 if (data.result == "Payment OK" || data.result == "OK") document.location = data.successurl; 517 else { 518 if ($(theform).closest(".frms").length && $(theform).closest(".frms")[0].hasAttribute("data-stripe")) $("[name=fmm_credit_card_number]", "[name='"+ frm +"']").val(""); 519 $(".reloadCaptcha", theform).trigger("click"); 520 alert(data.result); 521 } 522 } 523 else if (data.indexOf("captcha-invalid") != -1) alert("Incorrect Anti-Spam code entered, please try again."); 524 else if (data.indexOf("captcha-replay") != -1) { alert("That Anti-Spam code has already been used, please try another code."); $(".reloadCaptcha", theform).trigger("click"); } 525 else { 526 var theparent = theform.parent(); 527 theparent.html( $(data).find(".frm-complete").length == 1 ? $(d
527ata).find(".frm-complete").html() : data ); 528 goToElement( theparent ); 529 } 530 }) 531 .fail(ajaxErrorHandler) 532 .always(function(data) { 533 thebutton.val( thebutton.data("btntext") ).prop("disabled", false); 534 }); 535 } 536 else { 537 $.post(theform.attr("action"), theform.serialize() ) 538 .done(function(data) { 539 if (typeof data.result != "undefined") { 540 if (data.result == "Payment OK" || data.result == "OK") document.location = data.successurl; 541 else { 542 if ($(theform).closest(".frms").length && $(theform).closest(".frms")[0].hasAttribute("data-stripe")) $("[name=fmm_credit_card_number]", "[name='"+ frm +"']").val(""); 543 $(".reloadCaptcha", theform).trigger("click"); 544 alert(data.result); 545 } 546 } 547 else if (data.indexOf("captcha-invalid") != -1) alert("Incorrect Anti-Spam code entered, please try again."); 548 else if (data.indexOf("captcha-replay") != -1) { alert("That Anti-Spam code has already been used, please try another code."); $(".reloadCaptcha", theform).trigger("click"); } 549 else { 550 var theparent = theform.parent(); 551 theparent.html( data ); 552 goToElement( theparent ); 553 } 554 }) 555 .fail(ajaxErrorHandler) 556 .always(function(data) { 557 thebutton.val( thebutton.data("btntext") ).prop("disabled", false); 558 }); 559 } 560} 561 562function createStripeToken(theform) { 563 stripe.createToken(frmStripeElements.cardnumber, { 564 name: $("[name=fmm_name_on_card]", "[name='"+ theform +"']").val(), 565 address_line1: $("[name=fmm_billing_address]", "[name='"+ theform +"']").val(), 566 address_city: $("[name=fmm_billing_city]", "[name='"+ theform +"']").val(), 567 address_state: $("[name=fmm_billing_state]", "[name='"+ theform +"']").val(), 568 address_zip: $("[name=fmm_billing_zip]", "[name='"+ theform +"']").val(), 569 currency:'usd' 570 }) 571 .then(function(result) { 572 if (result.error) { 573 $("[name=fmm_credit_card_number]", "[name='"+ theform +"']").val(""); 574 if (typeof platformStripeResponse != "undefined") platformStripeResponse(result); 575 alert(result.error.message); 576 } else { 577 stripe.createSource({ 578 type: 'card', 579 token: result.token.id, 580 }) 581 .then(function(result) { 582 if (typeof platformStripeResponse != "undefined") platformStripeResponse(result); 583 if (result.error) { 584 $("[name=fmm_credit_card_number]", "[name='"+ theform +"']").val(""); 585 alert(result.error.message); 586 } else { 587 $("[name=fmm_credit_card_number]", "[name='"+ theform +"']").val(result.source.id); 588 checkAndSubmit(theform); 589 } 590 }); 591 } 592 }); 593} 594 595function stripeSetup(theform, customcss) { 596 if ($(theform).data("stripe").indexOf("ppk_") != -1) stripe = Stripe( $(theform).data("stripe").split("|")[0].substring(1), { stripeAccount:$(theform).data("stripe").split("|")[1] } ); 597 else stripe = Stripe( $(theform).data("stripe") ); 598 599 var stripesElements = stripe.elements(); 600 var defaultfont = $("body").css("font-family"); 601 602 var cssDefault = { 603 'base': { 604 'fontFamily': $("[name=fmm_credit_card_number]", theform).css("font-family").indexOf("MS Shell Dlg") == -1 ? $("[name=fmm_credit_card_number]", theform).css("font-family") : defaultfont, 605 'fontSize': $("[name=fmm_credit_card_number]", theform).css("font-size"), 606 'color': $("[name=fmm_credit_card_number]", theform).css("color"), 607 }, 608 'invalid': { 609 'color': '#95161a', 610 }, 611 }; 612 613 $.extend( cssDefault, customcss ); 614 615 var ourStripeElements = { 616 cardnumber: stripesElements.create("cardNumber", { 617 style: cssDefault 618 }), 619 cardexpiry: stripesElements.create("cardExpiry", { 620 style: cssDefault 621 }), 622 cardcvc: stripesElements.create("cardCvc", { 623 style: cssDefault, 624 placeholder: "CVV" 625 }) 626 }; 627 628 var clearToken = function(event) { 629 $("[name=fmm_credit_card_number]", theform).val(""); 630 //try { if (event.elementType == "cardNumber") console.log(event.brand); } catch(e) {} 631 }; 632 633 $("[name=fmm_expiry_month]", theform).parent().wrap('<div class="stripe-original-element"></div>'); 634 $("[name=fmm_cvv_number],[name=fmm_credit_card_number]", theform).wrap('<div class="stripe-original-element"></div>'); 635 $(".stripe-original-element", theform).wrap('<div class="stripe-elements" style="display:inline-block;"></div>'); 636 $(".stripe-original-element", theform).hide(); 637 $('<div class="cardnumber-element Fields" style="width:180px;"></div>').insertAfter( $("[name=fmm_credit_card_number]", theform).parent() ); 638 $('<div class="cardexpiry-element Fields" style="width:80px;"></div>').insertAfter( $("[name=fmm_expiry_month]", theform).parent().parent() ); 639 $('<div class="cardcvc-element Fields" style="width:50px;"></div>').insertAfter( $("[name=fmm_cvv_number]", theform).parent() ); 640 $("[name=fmm_credit_card_number],[name=fmm_cvv_number],[name=fmm_expiry_month],[name=fmm_expiry_year]", theform).removeClass("isrequired"); 641 $(".frm-cvv-help").css("top", "-1em"); 642 643 ourStripeElements.cardnumber.mount(".cardnumber-element"); 644 ourStripeElements.cardexpiry.mount(".cardexpiry-element"); 645 ourStripeElements.cardcvc.mount(".cardcvc-element"); 646 647 ourStripeElements.cardnumber.addEventListener("change", clearToken); 648 ourStripeElements.cardexpiry.addEventListener("change", clearToken); 649 ourStripeElements.cardcvc.addEventListener("change", clearToken); 650 651 return ourStripeElements; 652} 653 654function rotateAds(space, spaceid, show, timeout, fallbackad) { 655 if (typeof fallbackad != "undefined") addtourl = "&fallback="+fallbackad 656 else addtourl = ""; 657 $(space).height($(space).height()+1); 658 $(space).height($(space).height()-1); 659 //$(space).fadeOut("slow", function() { 660 $(space).load("/admgt/?space="+spaceid+"&show="+show+addtourl, {}, function() { 661 //$(space).fadeIn("slow", function() { 662 setTimeout("rotateAds('"+space+"','"+spaceid+"',"+show+","+timeout+",'"+fallbackad+"');", timeout*1000); 663 //}); 664 }) 665 //}); 666} 667 668function goToElement(ele) { 669 var navheight = 0;
670 if ($(".navbar-fixed-top").length != 0) navheight = $(".navbar").outerHeight(); 671 else if ($(".rd-navbar").length != 0) navheight = $(".rd-navbar").outerHeight(); 672 else if ($("header").length != 0 && $("header").css("position") == "fixed") navheight = $("header").outerHeight(); 673 674 $('html,body').animate({scrollTop: $(ele).offset().top - navheight },'slow'); 675} 676 677function goToID(id) { 678 $('html,body').animate({scrollTop: $(((id.indexOf("#") == -1 && id.indexOf(".") == -1) ? "#":"")+id).offset().top - ($(".navbar-fixed-top").length != 0 ? $(".navbar").outerHeight() : 0) },'slow'); 679} 680 681function verifyGoDaddySSLSeal(sealid) { 682 var bgHeight = "433", 683 bgWidth = "592", 684 url = "https://seal.godaddy.com/verifySeal?sealID=" + sealid; 685 686 window.open(url, "SealVerfication", "location=yes,status=yes,resizable=yes,scrollbars=no,width=" + bgWidth + ",height=" + bgHeight); 687} 688 689function verifyStarFieldSSLSeal(sealid) { 690 var bgHeight = "433", 691 bgWidth = "592", 692 url = "https://seal.starfieldtech.com/verifySeal?sealID=" + sealid; 693 694 window.open(url, "SealVerfication", "location=yes,status=yes,resizable=yes,scrollbars=no,width=" + bgWidth + ",height=" + bgHeight); 695} 696 697function sleep(ms) { 698 var dt = new Date(); 699 dt.setTime(dt.getTime() + ms); 700 while (new Date().getTime() < dt.getTime()); 701} 702 703function checkPasswordStrength(pass) { 704 var strength = 0; 705 var arr = [/.{15,}/, /.{8,}/, /[a-z]+/, /[0-9]+/, /[A-Z]+/, /[^a-zA-Z0-9]/]; 706 707 $.each(arr, function(i, regexp) { 708 if(pass.match(regexp)) strength++; 709 }); 710 711 strength = Math.min(100, strength/5*100); 712 713 return strength; 714} 715 716function numericOr0(num) { 717 return isNaN(num) ? 0: num*1; 718} 719 720function formatErrorMessage(jqXHR, exception) { 721 722 if (jqXHR.status === 0) { 723 return ('Not connected.\nPlease verify your network connection.'); 724 } else if (jqXHR.status == 404) { 725 return ('The requested page not found. [404]'); 726 } else if (jqXHR.status == 500) { 727 return ('Internal Server Error [500].'); 728 } else if (exception === 'parsererror') { 729 return ('Requested JSON parse failed.'); 730 } else if (exception === 'timeout') { 731 return ('Time out error.'); 732 } else if (exception === 'abort') { 733 return ('Ajax request aborted.'); 734 } else { 735 return ('Uncaught Error.\n' + jqXHR.responseText); 736 } 737} 738 739function ajaxErrorHandler(xhr, err) { 740 var responseTitle = $(xhr.responseText).filter('title').get(0); 741 alert($(responseTitle).text() + "\n" + formatErrorMessage(xhr, err) + "<OK>" ); 742} 743 744function createGUID() { 745 746 var d = new Date().getTime(); 747 var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { 748 var r = (d + Math.random()*16)%16 | 0; 749 d = Math.floor(d/16); 750 return (c=='x' ? r : (r&0x7|0x8)).toString(16); 751 }); 752 return uuid; 753 754} 755 756function fullScreenVideo(elem) { 757 if (!elem.paused && !elem.ended) return; 758 if (elem.requestFullscreen) { 759 elem.requestFullscreen(); 760 } else if (elem.mozRequestFullScreen) { 761 elem.mozRequestFullScreen(); 762 } else if (elem.webkitRequestFullscreen) { 763 elem.webkitRequestFullscreen(); 764 } 765 766 elem.play(); 767} 768 769function fullScreenElement(ele) { 770 // if already full screen; exit 771 // else go fullscreen 772 if ( 773 document.fullscreenElement || 774 document.webkitFullscreenElement || 775 document.mozFullScreenElement || 776 document.msFullscreenElement 777 ) { 778 if (document.exitFullscreen) { 779 document.exitFullscreen(); 780 } else if (document.mozCancelFullScreen) { 781 document.mozCancelFullScreen(); 782 } else if (document.webkitExitFullscreen) { 783 document.webkitExitFullscreen(); 784 } else if (document.msExitFullscreen) { 785 document.msExitFullscreen(); 786 } 787 } else { 788 element = $(ele).get(0); 789 if (element.requestFullscreen) { 790 element.requestFullscreen(); 791 } else if (element.mozRequestFullScreen) { 792 element.mozRequestFullScreen(); 793 } else if (element.webkitRequestFullscreen) { 794 element.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT); 795 } else if (element.msRequestFullscreen) { 796 element.msRequestFullscreen(); 797 } 798 } 799} 800 801var _MS_PER_DAY = 1000 * 60 * 60 * 24; 802function dateDiffInDays(a, b) { 803 // Discard the time and time-zone information. 804 var utc1 = Date.UTC(a.getFullYear(), a.getMonth(), a.getDate()); 805 var utc2 = Date.UTC(b.getFullYear(), b.getMonth(), b.getDate()); 806 807 return Math.floor((utc2 - utc1) / _MS_PER_DAY); 808} 809 810function gaTrack(pagePath) { 811 if (typeof gtag != "undefined") 812 try { gtag('event', 'page_view', { page_path: pagePath }); } catch(e) {} 813 else if (typeof ga != "undefined") 814 try { ga('send', 'pageview', pagePath); } catch(e) {} 815} 816 817function gaTrackEvent(category, action, label, value) { 818 category = category || 'Tracking'; 819 action = action || 'Click'; 820 label = label || 'Unknown'; 821 if (typeof gtag != "undefined") 822 try { gtag('event', action, { 'event_category' : category, 'event_label' : label +' = '+ value }); } catch(e) { } 823 else if (typeof ga != "undefined") 824 try { ga('send', 'event', category, action, label, value); } catch(e) {} 825} 826 827function iframeRef( frameRef ) { 828 return frameRef.contentWindow ? frameRef.contentWindow.document : frameRef.contentDocument; 829} 830 831function safariBackBugWorkAround() { 832 if (isSafari) { 833 $(window).bind("pageshow", function(event) { 834 if (event.originalEvent.persisted) window.location.reload(); 835 }); 836 } 837} 838 839function CreatePDFfromHTML(jqryelement, filename) { 840 var HTML_Width = jqryelement.width(); 841 var HTML_Height = jqryelement.height(); 842 var top_left_margin = 15; 843 var PDF_Width = HTML_Width + (top_left_margin * 2); 844 var PDF_Height = (PDF_Width * 1.5) + (top_left_margin * 2); 845 var canvas_image_width = HTML_Width; 846 var canvas_image_height = HTML_Height; 847
848 var totalPDFPages = Math.ceil(HTML_Height / PDF_Height) - 1; 849 850 html2canvas(jqryelement[0], {scrollY: -window.scrollY}).then(function (canvas) { 851 var imgData = canvas.toDataURL("image/jpeg", 1.0); 852 var pdf = new jsPDF('p', 'pt', [PDF_Width, PDF_Height]); 853 pdf.addImage(imgData, 'JPG', top_left_margin, top_left_margin, canvas_image_width, canvas_image_height); 854 for (var i = 1; i <= totalPDFPages; i++) { 855 pdf.addPage(PDF_Width, PDF_Height); 856 pdf.addImage(imgData, 'JPG', top_left_margin, -(PDF_Height*i)+(top_left_margin*4),canvas_image_width,canvas_image_height); 857 } 858 pdf.save(filename); 859 }); 860} 861 862if (typeof jQuery != 'undefined') { 863 864 readmoreReload = function() { 865 $(".readmore-marker").each(function() { 866 $(this).show(); 867 var snipAt = $(this).offset().top - $(this).closest("div").offset().top; 868 $(this).closest("div").height(snipAt).data("readmore-snip", snipAt); 869 $(this).hide(); 870 }); 871 }; 872 873 readmoreSetup = function(timeout) { 874 if ($(".readmore-marker").length) { 875 setTimeout(function() { 876 $(".readmore-marker").each(function() { 877 if ($(this).closest("div").hasClass("readmore-content")) return; 878 $(this).closest("div").addClass("readmore-content"); 879 $('<div class="readmore"><a href="#"><i class="fa fa-chevron-circle-down" aria-hidden="true"></i> <span>Read More</span></a></div>').insertAfter($(this).closest("div")); 880 var snipAt = $(this).offset().top - $(this).closest("div").offset().top; 881 $(this).closest("div").height(snipAt).data("readmore-snip", snipAt); 882 $(this).hide(); 883 }); 884 }, timeout); 885 886 $(document).off("click", ".readmore a").on("click", ".readmore a", function(ev) { 887 ev.preventDefault(); 888 $(this).find("i").toggleClass("fa-chevron-circle-down").toggleClass("fa-chevron-circle-up"); 889 if ($(this).find("i").hasClass("fa-chevron-circle-up")) { 890 $(this).parent().prev().animate({ height:$(this).parent().prev().get(0).scrollHeight }, 500); 891 $(this).find("span").text("Read Less"); 892 } 893 else { 894 $(this).parent().prev().animate({ height:$(this).parent().prev().data("readmore-snip") }, 500); 895 $(this).find("span").text("Read More"); 896 } 897 }); 898 } 899 }; 900 901 (function($) { 902 function debounce(callback, delay) { 903 var self = this, timeout, _arguments; 904 return function(e) { 905 if ($(this)[0].tagName == "A") e.preventDefault(); 906 _arguments = Array.prototype.slice.call(arguments, 0), 907 timeout = clearTimeout(timeout, _arguments), 908 timeout = setTimeout(function() { 909 callback.apply(self, _arguments); 910 timeout = 0; 911 }, delay); 912 913 return this; 914 }; 915 } 916 917 $.extend($.fn, { 918 debounce: function(event, callback, delay) { 919 this.bind(event, debounce.apply(this, [callback, delay])); 920 } 921 }); 922 })(jQuery); 923 924 $(function() { 925 if ($.fn.numeric) { 926 numericFieldChecks = function() { 927 if ($('.priceinput').length) $('.priceinput').numeric({ allow:"." }); 928 if ($('.numericinput').length) $('.numericinput').numeric(); 929 }; 930 numericFieldChecks(); 931 } 932 else { 933 numericFieldChecks = function() {} 934 } 935 936 if ($.fn.accordion && $("table.dropdown").length) { 937 $("table.dropdown > tbody > tr:nth-child(odd)").addClass("accordion"); 938 $('table.dropdown').each(function() { 939 $(this).accordion({header:'.accordion', collapsible:true, active:$(this).hasClass("open") ? 0 : false }); 940 $(this).find("tbody > tr:not(.accordion) > td").css("padding", "10px"); 941 }); 942 $('table.dropdown:eq(0)').accordion("option", "active", 0); 943 } 944 945 $(window).on("resize", function() { 946 if ($(".readmore-marker").length) readmoreReload(); 947 }); 948 949 $(document).on("keydown", ":input:not(textarea):not(:submit)", function(event) { 950 if (event.key == "Enter") { 951 event.preventDefault(); 952 } 953 }); 954 955 $("img").not("[alt]").each(function() { 956 try { $(this).attr("alt", $(this).attr("src").split("/").pop().split(".")[0].replace(/-/gi, " ")); } catch(e) {} 957 }); 958 959 $("a[data-widget='w-image']").not("[href],[name]").each(function() { 960 try { $(this).attr("aria-disabled", true).attr("tabindex", "-1").attr("role", "button"); } catch(e) {} 961 }); 962 963 $("img[alt='']").each(function() { 964 try { $(this).attr("alt", $(this).attr("src").split("/").pop().split(".")[0].replace(/-/gi, " ")); } catch(e) {} 965 }); 966 967 }); 968 969 $(window).on("load", function() { 970 readmoreSetup(2000); 971 }); 972 973} 974 975function copyText(name, element) { 976 var range, selection, worked; 977 978 if (document.body.createTextRange) { 979 range = document.body.createTextRange(); 980 range.moveToElementText(element); 981 range.select(); 982 } else if (window.getSelection) { 983 selection = window.getSelection(); 984 range = document.createRange(); 985 range.selectNodeContents(element); 986 selection.removeAllRanges(); 987 selection.addRange(range); 988 } 989 990 try { 991 document.execCommand('copy');
992 alert('Copied '+ name +' to clipboard.'); 993 } 994 catch (err) { 995 alert('Unable to copy '+ name +'.'); 996 } 997} 998 999/* phone formatting */ 1000function formatIntlTelInput(ev) { 1001 if ([88,32,69,84,190].includes(ev.which)) return; 1002 1003 if (typeof intlTelInputUtils !== 'undefined') { 1004 var currentText = $(this).intlTelInput("getNumber"); 1005 if (typeof currentText === 'string') { 1006 var ext = $(this).intlTelInput("getExtension") || ""; 1007 if (currentText.indexOf("ext") == -1 && ext != "") currentText += " ext. "+ext; 1008 else if (currentText.indexOf("ext") != -1 && ext == "") currentText = currentText.replace(/[^0-9-\(\)]+$/i, ""); 1009 $(this).intlTelInput("setNumber", currentText); 1010 $("[name="+ $(this).attr("name") +"_int]").val( $(this).intlTelInput("getNumber", intlTelInputUtils.numberFormat.INTERNATIONAL) ); 1011 } 1012 } 1013} 1014 1015function phoneFormatter(fieldname) { 1016 if ($("[name="+fieldname+"]").length == 0) return; 1017 1018 if ($("[name="+ fieldname +"_int]").length == 0) { 1019 $('<input type="hidden" name="'+ fieldname +'_int">').insertAfter( $("[name="+ fieldname +"]") ); 1020 $("[name="+ fieldname +"_int]").val( $("[name="+ fieldname +"]").val() ); 1021 } 1022 1023 $("[name="+fieldname+"]").intlTelInput({ 1024 preferredCountries: [ "us", "ca", "za" ], 1025 customPlaceholder: function(selectedCountryPlaceholder, selectedCountryData) { 1026 return selectedCountryPlaceholder + " ext. 1234"; 1027 }, 1028 formatOnDisplay:true, 1029 utilsScript:"//cdn.morphogine.net/universal/scripts/intl-tel-input/17.0.12/js/utils.js" }).css({ "width":"230px", "max-width":"100%" 1030 }); 1031 $(document).on("keyup", "[name="+fieldname+"]", formatIntlTelInput); 1032 $(document).on("change", "[name="+fieldname+"]", formatIntlTelInput); 1033 $(document).on("blur", "[name="+fieldname+"]", formatIntlTelInput); 1034 $(document).on("countrychange", "[name="+fieldname+"]", formatIntlTelInput); 1035 setTimeout(function() { $("[name="+fieldname+"]").trigger("blur"); }, 500); 1036} 1037/* /phone formatting */
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.