/** PascalSystem Function */ var PS = { onload : function(func) { if (typeof this._domLoadedFunction == 'undefined') PS._domLoadedFunction = new Array(); PS._domLoadedFunction.push(func); document.observe("dom:loaded", PS._onload); }, substr : function(strVal, startIndex, lengthSubstring) { strVal = strVal.toString(); if (typeof lengthSubstring == 'undefined') lengthSubstring = false; if (typeof strVal.substr == 'function') { if (lengthSubstring) return strVal.substr(startIndex, lengthSubstring); return strVal.substr(startIndex); } var strLen = strVal.length; if (strLenstartIndex+lengthSubstring) return buildStr; buildStr+= strVal[i]; } return buildStr; }, evalJsOnContent : function(content) { if (typeof content == 'string') content = document.getElementById(content); if (!content) return; var scripts = content.getElementsByTagName('script'); for (var i=0;i0) { element._psoverlay.className+= ' pascalsystem-'+element.className.toString().split(' ').join(' pascalsystem-'); } if (element.id && element.id.toString().length>0) { element._psoverlay.id+= 'pascalsystem-'+element.id.toString(); } element._psoverlay.style.display = 'none'; element._psoverlay.style.position = 'absolute'; var temps = element.getElementsByTagName('*'); if (temps.length) { element.insertBefore(element._psoverlay, temps[0]); } else { element.appendChild(element._psoverlay); } var dimm = $(element).getDimensions(); element._psoverlay.style.width = dimm.width.toString()+'px'; element._psoverlay.style.height = dimm.height.toString()+'px'; element._psoverlay.style.display = 'block'; return true; }, unOverlayElement : function(element) { return; if (typeof element == 'string') element = document.getElementById(element); if (!element) return; if (typeof element._psoverlay == 'undefined') return; element._psoverlay.style.display = 'none'; element._psoverlay.parentNode.removeChild(element._psoverlay); element._psoverlay = false; return true; }, eachFunc : function(selector, funcRef) { if (typeof selector == 'string') { selector = $$(selector); } for (var i=0;i0) && (url[0]=='?') || (url.indexOf('?')>0))?true:false; var params = {}; for (var key in blocks) { params['pascalsystem'+key] = blocks[key]; } if ("https:" == document.location.protocol) { url = url.toString().replace('http://','https://'); } var obj = new Ajax.Request(url,{ method:'get', requestHeaders: params, onSuccess: function(transport){ var response = transport.responseText || ""; var data = eval('('+response+')'); var selector; var html; var destEls; var regs; var replaceElement = false; var destEl; var srcEl; var temp; for (var blockName in data) { selector = data[blockName].selector; regs = selector.split('|'); replaceElement = false; if (regs.length>1) { selector = regs[0]; replaceElement = regs[1]; } destEls = $$(selector); if (!destEls.length) continue; if (replaceElement) { destEls = $(destEls[0]).getElementsBySelector(replaceElement); if (!destEls.length) continue; temp = document.createElement('div'); temp.innerHTML = data[blockName].html; srcEl = $(temp).getElementsBySelector(replaceElement); if (!srcEl.length) continue; srcEl = srcEl[0]; destEls[0].style.display = 'none'; destEls[0].parentNode.insertBefore(srcEl, destEls[0]); destEls[0].parentNode.removeChild(destEls[0]); temp = null; destEl = destEls[0]; } else { destEl = destEls[0]; //alert(data[blockName].html); destEl.innerHTML = data[blockName].html; } PS.evalJsOnContent(destEl); } PS._onload(); } }); } }; /** * PascalSystem Catalog Quick View Image */ PS.catalogQuickViewImage = function(selector) { if (typeof selector == 'undefined') selector = 'a.product-image' var els = $$(selector); for (var i=0;i winWidth) { scale = scaleWidth / winWidth; scaleHeight = Math.round(scaleHeight/scale); scaleWidth = winWidth; } if (scaleHeight > winHeight) { scale = scaleHeight / winHeight; scaleWidth = Math.round(scaleWidth/scale); scaleHeight = winHeight; } this.style.width = scaleWidth.toString()+'px'; this.style.height = scaleHeight.toString()+'px'; this.style.visibility = 'visible'; this.style.position = 'static'; this.style.top = 'auto'; this.style.left = 'auto'; m.content.center(); } imgPreload.src = srcImg; imgPreload.style.width='1px'; imgPreload.style.height='1px'; imgPreload.style.top='0px'; imgPreload.style.left='0px'; imgPreload.style.position='absolute'; imgPreload.onload = setTimeout(function(){ if ((typeof imgPreload._postAction != 'undefined') && imgPreload._postAction) return; imgPreload.__onload(); },250); document.body.appendChild(imgPreload); if ($(imgPreload).getWidth() && $(imgPreload).getHeight()) { imgPreload._postAction = true; setTimeout(function(){ imgPreload.__onload(); },250); } }, true); return false; } } } PS.catalogQuickViewImage.init = function(selector) { if (typeof window._catalogQuickViewImageLoaded != 'undefined') { PS.catalogQuickViewImage(selector); return; } document.observe("dom:loaded", function() { PS.catalogQuickViewImage(selector); window._catalogQuickViewImageLoaded = true; }); }