var normalImages = new Array( ); var overImages = new Array(); /* adds an entry for your image for switching, the entry contains a pair of images params: - name: the name of your set of images, this will be it's key - normalPath: the path to the image on it's normal state - overPath: the path to the image on it's higlighted state */ function addImageEntry( name, normalPath, overPath ) { normalImages[name] = new Image; normalImages[name].src = normalPath; overImages[name] = new Image; overImages[name].src = overPath; } /* switches your image to it's over state params: - name: the name of the field to switch - img: the name (key) for your set of images */ function overSwitch( name, img ) { if ( document.images ) document.images[name].src = overImages[img].src; } /* switches your image to it's normal state params: - name: the name of the field to switch - img: the name (key) for your set of images */ function outSwitch( name, img ) { if ( document.images ) document.images[name].src = normalImages[img].src; } function toggleHidden(id) { if (document.getElementById(id).style.display == 'none' ) { document.getElementById(id).style.display = 'block'; } else { document.getElementById(id).style.display = 'none'; } } function showElement(id) { document.getElementById(id).style.display = 'block'; } function hideElement(id) { document.getElementById(id).style.display = 'none'; } function showTooltip(text, e) { doShowTooltip(text, e, '8pt', 'auto'); } function showTooltipFontChange(text, e, fontSize) { doShowTooltip(text, e, fontSize, 'auto'); } function showTooltipBoxChange(text, e, boxWidth) { doShowTooltip(text, e, '8pt', boxWidth); } function doShowTooltip(text, e, fontSize, boxWidth) { if (document.all) { // if IE // grab the x-y pos.s if browser is IE tempX = event.clientX+ document.documentElement.scrollLeft; tempY = event.clientY + document.documentElement.scrollTop; winW = document.body.offsetWidth; } else { // grab the x-y pos.s if browser is NS tempX = e.pageX; tempY = e.pageY; winW = window.innerWidth; } // catch possible negative values in NS4 if (tempX < 0){tempX = 0;} if (tempY < 0){tempY = 0;} var newDiv; if (!document.getElementById('tooltipId')) { newDiv = document.createElement('div'); newDiv.setAttribute('id', 'tooltipId'); newDiv.style.position = 'absolute'; newDiv.style.zIndex = '1000'; newDiv.style.background = 'black'; newDiv.style.width = boxWidth; } else { newDiv = document.getElementById('tooltipId'); } document.body.appendChild(newDiv); newDiv.innerHTML = '
'; var innerDiv = document.getElementById('tooltipContent'); innerDiv.style.padding = '1em'; innerDiv.style.textAlign = 'center'; innerDiv.innerHTML = text; innerDiv.style.fontSize = fontSize; newDiv.style.display = 'block'; newDiv.style.visibility = 'hidden'; var objW = newDiv.offsetWidth; if ((tempX + 15 + objW) < winW) { newDiv.style.left = (tempX+15) + 'px'; } else { var diff = (tempX + 15 + objW) - winW; var offset = tempX - diff - 15; newDiv.style.left = offset + 'px'; } newDiv.style.top = (tempY+15) + 'px'; newDiv.style.visibility = 'visible'; } function hideTooltip() { var obj = document.getElementById('tooltipId'); obj.style.visibility = 'hidden'; } function trimString (str) { // str = typeof this.valueOf() == 'string' ? this : str; return str.replace(/^\s+/g, '').replace(/\s+$/g, ''); } $(document).ready(function(e) { $(".goodMessage a.close, .warnMessage a.close, .errorMessage a.close, .generalMessage a.close").click(function(e) { e.preventDefault(); $(this).closest(".goodMessage, .warnMessage, .errorMessage, .generalMessage").hide(); }); $(".payment-submit").on("click", function(e) { var $el = $(this); if ($el.data("clicked") === true) { e.preventDefault(); } else { $el.data("clicked", true); $(".payment-submit").removeClass("payment-submit").addClass("payment-submit-disabled"); var $formEl = $(this).closest("form"); if ($formEl.length) { setTimeout(function() { $formEl.submit(); }, 100); } } }); });