var cachedImage = null; function loadImage(url){ var img = new Image(); // cached image is not null if(cachedImage != null){ $('#imageLoader') // then insert our image .append(cachedImage); } $('div#persBodyBG').block({ message: '', css : { backgroundColor: '', border: 'none', color: '' }, overlayCSS: { backgroundColor:'silver',color: '' } }); // wrap our new image in jQuery, then: $(img) // once the image has loaded, execute this code .on('load', function () { // set the image hidden by default $(this).hide(); if($('img', "#imageLoader").get().length == 0) // with the holding div #loader, apply: $('#imageLoader') // then insert our image .append(this); else { //Replace the image with the new one $('#personalizerImagePreview').replaceWith(this); } // fade our image in to create a nice effect $(this).fadeIn().attr({'id': "personalizerImagePreview"}); $('div#persBodyBG').unblock(); cachedImage = this; }) // if there was an error loading the image, react accordingly .on('error', function () { $('#imageLoader').append('failed loading'); // notify the user that the image could not be loaded $('div#persBodyBG').block({ message: '', css : {backgroundColor: '', border: 'none', color: '', cursor: 'default' }, overlayCSS: { backgroundColor:'', opacity: '0.6', cursor: 'default' } }); // $('#imageLoader').append(existingImg); }) // *finally*, set the src attribute of the new image to our image .attr('src', url); return img; } function maxChar(max) { if (this.value.length > max) { this.value = this.value.substring(0, max); } } function dispalyPopUpWindow(url, popUpDivStyleId) { if(popUpDivStyleId == null || popUpDivStyleId == 'undefined') popUpDivStyleId = '#popUpWindow'; var context = ''; url = context + url; if(url.indexOf("?")==-1){ url+="?"; }else{ url+="&"; } url=url+"dummyTS=" + (new Date().getTime()); $(popUpDivStyleId).children("#popUpFrame").attr("src", url); $(popUpDivStyleId).show(); return false; } function getPopUpWindow(url, popUpDivStyleId) { if(popUpDivStyleId == null || popUpDivStyleId == 'undefined') popUpDivStyleId = '#popUpWindow'; var context = ''; url = context + url; if(url.indexOf("?")==-1){ url+="?"; }else{ url+="&"; } url=url+"dummyTS=" + (new Date().getTime()); $(popUpDivStyleId).children("#popUpFrame").attr("src", url); return false; } function closePopUpWindow(popUpDivStyleId) { var url= '/blank.jsp'; $(popUpDivStyleId).children("#popUpFrame").attr("src", url); $(popUpDivStyleId).hide(); } function showTabCom(objComDivId) { var imgPath = "/assets/images/shopping/"; var objComDivArr = new Array("tab-more-info","tab-files","tab-review","tab-email-friend","tab-products"); for (i = 0; i < objComDivArr.length; i++) { if (document.getElementById(objComDivArr[i] + "-img")) { document.getElementById(objComDivArr[i] + "-img").src = imgPath + objComDivArr[i] + "-off.gif"; document.getElementById(objComDivArr[i]).style.display = "none"; } } document.getElementById(objComDivId + "-img").src = imgPath + objComDivId + ".gif"; document.getElementById(objComDivId).style.display = "block"; } utilityBrowserVer = parseInt(navigator.appVersion); function imgOn(imgName) { if (utilityBrowserVer >= 3) { imgOnString = eval(imgName + "_on.src"); document.images[imgName].src = imgOnString; } } function imgOff(imgName) { if (utilityBrowserVer >= 3) { imgOffString = eval(imgName + "_off.src"); document.images[imgName].src = imgOffString; } } function goToLink(address) { var linkURL = address.options[address.selectedIndex].value; window.top.location.href = linkURL; address.selectedIndex=0; } /* * This function launches a new web browser window to a specified width, height and features. * Features string is a comma separated window's feature needed for this new window. For Instance * If a new window needs a toolbar the feature string must be "toolbar" like needs scroll bar and * and toolbar then it must be "toolbar,scrollbar". Note that the order of the feature is not required. * Also it's case insensitive. Therefore, "scrollbar,toolbar" is identical to "Toolbar,ScrollBar". * * If the features string is ommitted then all the features are turned off. To turn all the features on * use the word "all" for features instead of specifying each feature. */ function openWindow(address, width, height,features) { /* Find out what features need to be enable * */ if(features) features = features.toLowerCase(); else features = ""; var toolbar = (features == "all" ? 1 : 0); var menubar = (features == "all" ? 1 : 0); var location = (features == "all" ? 1 : 0); var directories = (features == "all" ? 1 : 0); var status = (features == "all" ? 1 : 0); var scrollbars = (features == "all" ? 1 : 0); var resizable = (features == "all" ? 1 : 0); if(features != "all") { //split features var feature = features.split(","); for(i = 0; i < feature.length; i++) { if(feature[i] == "toolbar") toolbar = 1; else if(feature[i] == "menubar") menubar = 1; else if(feature[i] == "location") location = 1; else if(feature[i] == "directories") directories = 1; else if(feature[i] == "status") status = 1; else if(feature[i] == "scrollbars") scrollbars = 1; else if(feature[i] == "resizable") resizable = 1; } } features = "toolbar=" + toolbar + ","; features += "menubar=" + menubar + ","; features += "location=" + location + ","; features += "directories=" + directories + ","; features += "status=" + status + ","; features += "scrollbars=" + scrollbars + ","; features += "resizable=" + resizable; var newWindow = window.open(address, 'Popup_Window', 'width=' + width + ',height=' + height + ',"' + features + '"'); newWindow.focus(); } function confirmWindow(url, text) { if (confirm(text)) { window.go = url; window.location = url; } } function setOperation(opType,needSubmit,addressIndex) { document.addUpdateDeleteAddressForm.operation.value = opType; if(addressIndex) document.addUpdateDeleteAddressForm.selectedAddressIndex.value = addressIndex; if(needSubmit) { if(opType == "EDIT") window.location="/user/address_book.jsp?addressIndex=" + addressIndex; else document.addUpdateDeleteAddressForm.submit(); } } function setAddTo(addToType) { document.productForm.addTo.value = addToType; } // This is an example of sending product data from the server // to the client, then formatting the variants on the client-side // based on certain criteria. function cbFormatter(list, attribute, opt) { // Get the price for this variant.. If this is the primary list, get all related // variants from the group and get their prices as well so we can build a range. var pvds = list.productVariantDropdownSupport; // Get all of the product variants for this attribute var variantGroup = attribute.getVariant().getProductVariantGroup(); var groupVariants = variantGroup.getAllVariants() // Are all of the prices the same within the group? var lowGroupPrice = 999999.00; var highGroupPrice = -1.00; for (var idx = 0; idx < groupVariants.length; idx++) { lowGroupPrice = groupVariants[idx].numericPrice < lowGroupPrice ? groupVariants[idx].numericPrice : lowGroupPrice; highGroupPrice = groupVariants[idx].numericPrice > highGroupPrice ? groupVariants[idx].numericPrice : highGroupPrice; } // Are all of the prices the same within the variant? var variants = variantGroup.getVariantsMatching(attribute.name, attribute.value); var lowVariantPrice = 999999.00; var highVariantPrice = -1.00; var lowVariantDisplay = variants[0].displayPrice; var highVariantDisplay = variants[0].displayPrice; for (var idx = 0; idx < variants.length; idx++) { // Display really needs to be done before the re-assignment... lowVariantDisplay = variants[idx].numericPrice < lowVariantPrice ? variants[idx].displayPrice : lowVariantDisplay; lowVariantPrice = variants[idx].numericPrice < lowVariantPrice ? variants[idx].numericPrice : lowVariantPrice; highVariantDisplay = variants[idx].numericPrice > highVariantPrice ? variants[idx].displayPrice : highVariantDisplay; highVariantPrice = variants[idx].numericPrice > highVariantPrice ? variants[idx].numericPrice : highVariantPrice; } if (lowGroupPrice != highGroupPrice) { // Primary list should display a range if (pvds.isPrimary) if (lowVariantPrice != highVariantPrice) opt.text = opt.text + " " + lowVariantDisplay + " - " + highVariantDisplay; else opt.text = opt.text + " " + attribute.getVariant().displayPrice; else // Secondary lists should show exact price opt.text = opt.text + " " + attribute.getVariant().displayPrice; } return opt; } /* This function is called when a subject is changed so that actual subject text can be * stored in to a hidden subject field. Since value of the subject list is a keyword define * in the command configuration file to identify it's email address. */ function setSubject(thisRef) { var formRef = document.forms["contactUsForm"]; //set subject value formRef.elements["subject"].value = (thisRef.options[thisRef.selectedIndex]).text; } function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i elements with
"); $("#TB_overlay").click(tb_remove); } }else{//all others if(document.getElementById("TB_overlay") === null){ $("body").append("
"); $("#TB_overlay").click(tb_remove); } } if(caption===null){caption="";} $("body").append("
");//add loader to the page $('#TB_load').show();//show loader var baseURL; if(url.indexOf("?")!==-1){ //ff there is a query string involved baseURL = url.substr(0, url.indexOf("?")); }else{ baseURL = url; } var urlString = /\.jpg|\.jpeg|\.png|\.gif|\.bmp/g; var urlType = baseURL.toLowerCase().match(urlString); if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images TB_PrevCaption = ""; TB_PrevURL = ""; TB_PrevHTML = ""; TB_NextCaption = ""; TB_NextURL = ""; TB_NextHTML = ""; TB_imageCount = ""; TB_FoundURL = false; if(imageGroup){ TB_TempArray = $("a[rel="+imageGroup+"]").get(); for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) { var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString); if (!(TB_TempArray[TB_Counter].href == url)) { if (TB_FoundURL) { TB_NextCaption = TB_TempArray[TB_Counter].title; TB_NextURL = TB_TempArray[TB_Counter].href; TB_NextHTML = "  Next >"; } else { TB_PrevCaption = TB_TempArray[TB_Counter].title; TB_PrevURL = TB_TempArray[TB_Counter].href; TB_PrevHTML = "  < Prev"; } } else { TB_FoundURL = true; TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length); } } } imgPreloader = new Image(); imgPreloader.onload = function(){ imgPreloader.onload = null; // Resizing large images - orginal by Christian Montoya edited by me. var pagesize = tb_getPageSize(); var x = pagesize[0] - 150; var y = pagesize[1] - 150; var imageWidth = imgPreloader.width; var imageHeight = imgPreloader.height; if (imageWidth > x) { imageHeight = imageHeight * (x / imageWidth); imageWidth = x; if (imageHeight > y) { imageWidth = imageWidth * (y / imageHeight); imageHeight = y; } } else if (imageHeight > y) { imageWidth = imageWidth * (y / imageHeight); imageHeight = y; if (imageWidth > x) { imageHeight = imageHeight * (x / imageWidth); imageWidth = x; } } // End Resizing TB_WIDTH = imageWidth + 30; TB_HEIGHT = imageHeight + 60; if(params['modal'] != "true"){ $("#TB_window").append("
"+caption+"
"); } $("#TB_window").append(""); $("#TB_closeWindowButton").click(tb_remove); if (!(TB_PrevHTML === "")) { function goPrev(){ if($(document).off("click",goPrev)){$(document).off("click",goPrev);} $("#TB_window").remove(); $("body").append("
"); tb_show(TB_PrevCaption, TB_PrevURL, imageGroup); return false; } $("#TB_prev").click(goPrev); } if (!(TB_NextHTML === "")) { function goNext(){ $("#TB_window").remove(); $("body").append("
"); tb_show(TB_NextCaption, TB_NextURL, imageGroup); return false; } $("#TB_next").click(goNext); } document.onkeydown = function(e){ if (e == null) { // ie keycode = event.keyCode; } else { // mozilla keycode = e.which; } if(keycode == 27){ // close tb_remove(); } else if(keycode == 190){ // display previous image if(!(TB_NextHTML == "")){ document.onkeydown = ""; goNext(); } } else if(keycode == 188){ // display next image if(!(TB_PrevHTML == "")){ document.onkeydown = ""; goPrev(); } } }; tb_position(); $("#TB_load").remove(); $("#TB_ImageOff").click(tb_remove); $("#TB_window").css({display:"block"}); //for safari using css instead of show }; imgPreloader.src = url; }else{//code to show html pages var queryString = url.replace(/^[^\?]+\??/,''); var params = tb_parseQuery( queryString ); TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no paramaters were added to URL TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no paramaters were added to URL ajaxContentW = TB_WIDTH - 30; ajaxContentH = TB_HEIGHT - 45; if(url.indexOf('TB_iframe') != -1){ urlNoQuery = url.split('TB_'); $("#TB_window").append("
"+caption+"
"); }else{ if($("#TB_window").css("display") != "block"){ if(params['modal'] != "true"){ $("#TB_window").append("
"+caption+"
"); }else{ $("#TB_overlay").off(); $("#TB_window").append("
"); } }else{ $("#TB_ajaxContent")[0].style.width = ajaxContentW +"px"; $("#TB_ajaxContent")[0].style.height = ajaxContentH +"px"; $("#TB_ajaxContent")[0].scrollTop = 0; $("#TB_ajaxWindowTitle").html(caption); } } $("#TB_closeWindowButton").click(tb_remove); if(url.indexOf('TB_inline') != -1){ $("#TB_ajaxContent").html($('#' + params['inlineId']).html()); tb_position(); $("#TB_load").remove(); $("#TB_window").css({display:"block"}); }else if(url.indexOf('TB_iframe') != -1){ tb_position(); if(frames['TB_iframeContent'] === undefined){//be nice to safari $("#TB_load").remove(); $("#TB_window").css({display:"block"}); $(document).on('keyup', function(e){ var key = e.keyCode; if(key == 27){tb_remove();}}); } }else{ $("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()),function(){//to do a post change this load method tb_position(); $("#TB_load").remove(); tb_init("#TB_ajaxContent a.thickbox"); $("#TB_window").css({display:"block"}); }); } } if(!params['modal']){ document.onkeyup = function(e){ if (e == null) { // ie keycode = event.keyCode; } else { // mozilla keycode = e.which; } if(keycode == 27){ // close tb_remove(); } }; } } catch(e) { //nothing here } } //helper functions below function tb_showIframe(){ $("#TB_load").remove(); $("#TB_window").css({display:"block"}); } function tb_remove() { $("#TB_imageOff").off("click"); $("#TB_overlay").off("click"); $("#TB_closeWindowButton").off("click"); $("#TB_window").fadeOut("fast",function(){$('#TB_window,#TB_overlay,#TB_HideSelect').remove();}); $("#TB_load").remove(); if (typeof document.body.style.maxHeight == "undefined") {//if IE 6 $("body","html").css({height: "auto", width: "auto"}); $("html").css("overflow",""); } document.onkeydown = ""; return false; } function tb_position() { $("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'}); if ( !(jQuery.browser.msie && typeof XMLHttpRequest == 'function')) { // take away IE6 $("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'}); } } function tb_parseQuery ( query ) { var Params = {}; if ( ! query ) {return Params;}// return empty object var Pairs = query.split(/[;&]/); for ( var i = 0; i < Pairs.length; i++ ) { var KeyVal = Pairs[i].split('='); if ( ! KeyVal || KeyVal.length != 2 ) {continue;} var key = unescape( KeyVal[0] ); var val = unescape( KeyVal[1] ); val = val.replace(/\+/g, ' '); Params[key] = val; } return Params; } function tb_getPageSize(){ var de = document.documentElement; var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth; var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight; arrayPageSize = [w,h]; return arrayPageSize; } // Script for dropdown and fly menu for product category page (function($){ $.fn.superfish = function(o){ var defaults = { hoverClass : "sfHover", delay : 800, animation : {opacity:"show"}, speed : "normal" }, over = function(){ var $$ = $(this); clearTimeout(this.sfTimer); if (!$$.is("."+o.hoverClass)) { $$.addClass(o.hoverClass) .find("ul") .animate(o.animation,o.speed) .end() .siblings() .removeClass(o.hoverClass); } }, out = function(){ var $$ = $(this); this.sfTimer=setTimeout(function(){ $$.removeClass(o.hoverClass) .find("iframe", this) .remove(); },o.delay); }; o = $.extend(defaults, o || {}); var sfHovAr=$("li",this) .on("mouseenter",over).on("mouseleave",out) .find("a").each(function() { var $a = $(this), $li = $a.parents("li"); $a.on('focus',function(){ $li.each(over); }) .on('blur',function(){ $li.each(out); }); }).end(); $(window).on('unload',function() { sfHovAr.off("mouseover").off("mouseout"); }); return this; }; })(jQuery); // Script for product preview box on category page $(function(){ doc = function(){ if (self.innerHeight) { doc.pageYOffset = self.pageYOffset; doc.pageXOffset = self.pageXOffset; doc.innerHeight = self.innerHeight; doc.innerWidth = self.innerWidth; } else if (document.documentElement && document.documentElement.clientHeight) { doc.pageYOffset = document.documentElement.scrollTop; doc.pageXOffset = document.documentElement.scrollLeft; doc.innerHeight = document.documentElement.clientHeight; doc.innerWidth = document.documentElement.clientWidth; } else if (document.body) { doc.pageYOffset = document.body.scrollTop; doc.pageXOffset = document.body.scrollLeft; doc.innerHeight = document.body.clientHeight; doc.innerWidth = document.body.clientWidth; } return doc; } var docObj = new doc(); var scrollHeight = docObj.pageYOffset; var windowHeight = docObj.innerHeight; var startingPos = 0; var windowArea = scrollHeight + windowHeight; var prodTable = document.getElementById("prod_data"); var pixelHeight = $("#category_wrapper").height(); var pixelHeightHeader = $("#header-ta").height(); if ($(".toggle_container").css("display") == 'block') { var topPageContent = $("#top-page-content").height()- $(".toggle_container").height(); } else { var topPageContent = $("#top-page-content").height(); } if (topPageContent < 200) { var totalPixelsTopOfPage = topPageContent + pixelHeightHeader + 72; } else { var totalPixelsTopOfPage = topPageContent + pixelHeightHeader + 22; } if (pixelHeight > 650) { window.onscroll = moveMenuBar; document.onscroll = moveMenuBar; } function moveMenuBar() { var object=document.getElementById('product_preview'); if(object != null){ var newObj = new doc(); var y = newObj.pageYOffset; var endOfPage = pixelHeight - 550; var desiredOffset = y - totalPixelsTopOfPage; if ($(".toggle_container").css("display") != 'none') { desiredOffset=desiredOffset- $(".toggle_container").height(); if (y < (totalPixelsTopOfPage+$(".toggle_container").height())){ desiredOffset = 0; } else if (y > (endOfPage + totalPixelsTopOfPage+$(".toggle_container").height())) { desiredOffset = endOfPage; }} else { if (y < totalPixelsTopOfPage){ desiredOffset = 0; } else if (y > (endOfPage + totalPixelsTopOfPage)) { desiredOffset = endOfPage; } } object.style.display = 'none'; object.style.top = desiredOffset + 'px'; object.style.display = 'block'; } } }); /* Script for Pop up Windows for Category Page */ var cb_pathToImage = "/product_finder/loadingAnimation.gif"; //add catbox to href & area elements that have a class of .catbox function cb_init(domChunk){ $(domChunk).click(function(){ var t = this.title || this.name || null; var a = this.href || this.alt; var g = this.rel || false; cb_show(t,a,g); this.blur(); return false; }); } function cb_show(caption, url, imageGroup) {//function called when the user clicks on a catbox link try { if (typeof document.body.style.maxHeight === "undefined") {//if IE 6 $("body","html").css({height: "100%", width: "100%"}); $("html").css("overflow","hidden"); if (document.getElementById("CB_HideSelect") === null) {//iframe to hide select elements in ie6 $("body").append("
"); $("#CB_overlay").click(cb_remove); } }else{//all others if(document.getElementById("CB_overlay") === null){ $("body").append("
"); $("#CB_overlay").click(cb_remove); } } if(caption===null){caption="";} $("body").append("
");//add loader to the page $('#CB_load').show();//show loader var baseURL; if(url.indexOf("?")!==-1){ //ff there is a query string involved baseURL = url.substr(0, url.indexOf("?")); }else{ baseURL = url; } var urlString = /\.jpg|\.jpeg|\.png|\.gif|\.bmp/g; var urlType = baseURL.toLowerCase().match(urlString); if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images CB_PrevCaption = ""; CB_PrevURL = ""; CB_PrevHTML = ""; CB_NextCaption = ""; CB_NextURL = ""; CB_NextHTML = ""; CB_imageCount = ""; CB_FoundURL = false; if(imageGroup){ CB_TempArray = $("a[rel="+imageGroup+"]").get(); for (CB_Counter = 0; ((CB_Counter < CB_TempArray.length) && (CB_NextHTML === "")); CB_Counter++) { var urlTypeTemp = CB_TempArray[CB_Counter].href.toLowerCase().match(urlString); if (!(CB_TempArray[CB_Counter].href == url)) { if (CB_FoundURL) { CB_NextCaption = CB_TempArray[CB_Counter].title; CB_NextURL = CB_TempArray[CB_Counter].href; CB_NextHTML = "  Next >"; } else { CB_PrevCaption = CB_TempArray[CB_Counter].title; CB_PrevURL = CB_TempArray[CB_Counter].href; CB_PrevHTML = "  < Prev"; } } else { CB_FoundURL = true; CB_imageCount = "Image " + (CB_Counter + 1) +" of "+ (CB_TempArray.length); } } } imgPreloader = new Image(); imgPreloader.onload = function(){ imgPreloader.onload = null; // Resizing large images - orginal by Christian Montoya edited by me. var pagesize = cb_getPageSize(); var x = pagesize[0] - 150; var y = pagesize[1] - 150; var imageWidth = imgPreloader.width; var imageHeight = imgPreloader.height; if (imageWidth > x) { imageHeight = imageHeight * (x / imageWidth); imageWidth = x; if (imageHeight > y) { imageWidth = imageWidth * (y / imageHeight); imageHeight = y; } } else if (imageHeight > y) { imageWidth = imageWidth * (y / imageHeight); imageHeight = y; if (imageWidth > x) { imageHeight = imageHeight * (x / imageWidth); imageWidth = x; } } // End Resizing CB_WIDTH = imageWidth + 30; CB_HEIGHT = imageHeight + 60; $("#CB_window").append(""+caption+"" + "
"+caption+"
" + CB_imageCount + CB_PrevHTML + CB_NextHTML + "
"); $("#CB_closeWindowButton").click(cb_remove); if (!(CB_PrevHTML === "")) { function goPrev(){ if($(document).off("click",goPrev)){$(document).off("click",goPrev);} $("#CB_window").remove(); $("body").append("
"); cb_show(CB_PrevCaption, CB_PrevURL, imageGroup); return false; } $("#CB_prev").click(goPrev); } if (!(CB_NextHTML === "")) { function goNext(){ $("#CB_window").remove(); $("body").append("
"); cb_show(CB_NextCaption, CB_NextURL, imageGroup); return false; } $("#CB_next").click(goNext); } document.onkeydown = function(e){ if (e == null) { // ie keycode = event.keyCode; } else { // mozilla keycode = e.which; } if(keycode == 27){ // close cb_remove(); } else if(keycode == 190){ // display previous image if(!(CB_NextHTML == "")){ document.onkeydown = ""; goNext(); } } else if(keycode == 188){ // display next image if(!(CB_PrevHTML == "")){ document.onkeydown = ""; goPrev(); } } }; cb_position(); $("#CB_load").remove(); $("#CB_ImageOff").click(cb_remove); $("#CB_window").css({display:"block"}); //for safari using css instead of show }; imgPreloader.src = url; }else{//code to show html pages var queryString = url.replace(/^[^\?]+\??/,''); var params = cb_parseQuery( queryString ); CB_WIDTH = (params['width']*1) + 30 || 555; //defaults to 630 if no paramaters were added to URL CB_HEIGHT = (params['height']*1) + 40 || 595; //defaults to 440 if no paramaters were added to URL ajaxContentW = CB_WIDTH - 30; ajaxContentH = CB_HEIGHT - 45; if(url.indexOf('CB_iframe') != -1){ urlNoQuery = url.split('CB_'); $("#CB_window").append("
"+caption+"
"); }else{ if($("#CB_window").css("display") != "block"){ if(params['modal'] != "true"){ $("#CB_window").append("
"+caption+"
"); }else{ $("#CB_overlay").off(); $("#CB_window").append("
"); } }else{ $("#CB_ajaxContent")[0].style.width = ajaxContentW +"px"; $("#CB_ajaxContent")[0].style.height = ajaxContentH +"px"; $("#CB_ajaxContent")[0].scrollTop = 0; $("#CB_ajaxWindowTitle").html(caption); } } $("#CB_closeWindowButton").click(cb_remove); if(url.indexOf('CB_inline') != -1){ $("#CB_ajaxContent").html($('#' + params['inlineId']).html()); cb_position(); $("#CB_load").remove(); $("#CB_window").css({display:"block"}); }else if(url.indexOf('CB_iframe') != -1){ cb_position(); if(frames['CB_iframeContent'] === undefined){//be nice to safari $("#CB_load").remove(); $("#CB_window").css({display:"block"}); $(document).on('keyup', function(e){ var key = e.keyCode; if(key == 27){cb_remove();}}); } }else{ $("#CB_ajaxContent").load(url,function(){//to do a post change this load method cb_position(); $("#CB_load").remove(); cb_init("#CB_ajaxContent a.catbox"); $("#CB_window").css({display:"block"}); }); } } if(!params['modal']){ document.onkeyup = function(e){ if (e == null) { // ie keycode = event.keyCode; } else { // mozilla keycode = e.which; } if(keycode == 27){ // close cb_remove(); } }; } } catch(e) { //nothing here } } //helper functions below function cb_showIframe(){ $("#CB_load").remove(); $("#CB_window").css({display:"block"}); } function cb_remove() { $("#CB_imageOff").off("click"); $("#CB_overlay").off("click"); $("#CB_closeWindowButton").off("click"); $("#CB_window").fadeOut("fast",function(){$('#CB_window,#CB_overlay,#CB_HideSelect').remove();}); $("#CB_load").remove(); if (typeof document.body.style.maxHeight == "undefined") {//if IE 6 $("body","html").css({height: "auto", width: "auto"}); $("html").css("overflow",""); } document.onkeydown = ""; return false; } function cb_position() { $("#CB_window").css({marginLeft: '-' + parseInt((CB_WIDTH / 2),10) + 'px', width: CB_WIDTH + 'px'}); if ( !(jQuery.browser.msie && typeof XMLHttpRequest == 'function')) { // take away IE6 $("#CB_window").css({marginTop: '-' + parseInt((CB_HEIGHT / 2),10) + 'px'}); } } function cb_parseQuery ( query ) { var Params = {}; if ( ! query ) {return Params;}// return empty object var Pairs = query.split(/[;&]/); for ( var i = 0; i < Pairs.length; i++ ) { var KeyVal = Pairs[i].split('='); if ( ! KeyVal || KeyVal.length != 2 ) {continue;} var key = unescape( KeyVal[0] ); var val = unescape( KeyVal[1] ); val = val.replace(/\+/g, ' '); Params[key] = val; } return Params; } function cb_getPageSize(){ var de = document.documentElement; var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth; var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight; arrayPageSize = [w,h]; return arrayPageSize; } //TOG function addItemToSavedItems(formId){ $("#saving").show(); var path = "/user/add_item_to_saveditems_async.cmd"; $.get( path, $(formId).formSerialize(), function(data) { try{ var successMessage = $(".save_item_success",data); if (successMessage != null ) { $('#saveditem_message').css({ "display": "block" }); $('#itemnotsaved_link').css({ "display": "none" }); var origSaveItemsStr = $("#savedItemsNumber").html(); var origSaveItemsNum = parseInt(origSaveItemsStr); var saveItemNum = origSaveItemsNum +1; $("#savedItemsNumber").html(saveItemNum); } $("#saving").hide(); }catch(err){ $("#saving").hide(); } } ); } //TOG function addToSavedItems(pVarId, pId, pSubCatId, pCatId, pQty, source, pIncludedProductVariantId){ $("#saving").show(); var path = "/user/add_item_to_saveditems_async.cmd"; $.get( path, { productVariantId: pVarId, productId: pId, categoryId: pSubCatId, parentCategoryId: pCatId, quantity: pQty, includedProductVariantId: $.param(pIncludedProductVariantId), time: (new Date().getTime()) }, function(data) { try{ var successMessage = $(".save_item_success",data); if (successMessage != null ) { $('#saveditem_message').css({ "display": "block" }); $('#itemnotsaved_link').css({ "display": "none" }); var origSaveItemsStr = $("#savedItemsNumber").html(); var origSaveItemsNum = parseInt(origSaveItemsStr); var saveItemNum = origSaveItemsNum +1; $("#savedItemsNumber").html(saveItemNum); } $("#saving").hide(); }catch(err){ $("#saving").hide(); } } ); } //TOG function addToSavedItems(pVarId, pId, pSubCatId, pCatId, pQty, source, pIncludedProductVariantId){ $("#saving").show(); var path = "/user/add_item_to_saveditems_async.cmd"; $.get( path, { productVariantId: pVarId, productId: pId, categoryId: pSubCatId, parentCategoryId: pCatId, quantity: pQty, time: (new Date().getTime()) }, function(data) { try{ var successMessage = $(".save_item_success",data); if (successMessage != null ) { $('#saveditem_message').css({ "display": "block" }); $('#itemnotsaved_link').css({ "display": "none" }); var origSaveItemsStr = $("#savedItemsNumber").html(); var origSaveItemsNum = parseInt(origSaveItemsStr); var saveItemNum = origSaveItemsNum +1; $("#savedItemsNumber").html(saveItemNum); } $("#saving").hide(); }catch(err){ $("#saving").hide(); } } ); } function injectProcessing(el,cssDisplay,state,classIt) { if (state == true) { $(el).css("display","none"); $("Processing...").insertAfter($(el)); } else { $(el).next().remove(); $(el).css("display",cssDisplay); } } /** Frame source should be the location to load in the IFrame once it is made visible */ function zoomLinkClicked(frameSrc){ $("#zoomPopup_loading_preview").html('Loading') $("#zoomPopup_loading_preview").show(); // Force the IFRAME to reload itself. This is required to fix // a bug with how FireFox 1.5 and 2.0 handle page initialization // for a hidden IFRAME. var zoomFrame = top.document.getElementById("catZoomFrame"); if (zoomFrame.attachEvent){ zoomFrame.attachEvent("onload", function(){ $("#zoomPopup_loading_preview").hide(); $("#catZoomPopup").show(); }); } else { zoomFrame.onload = function(){ $("#zoomPopup_loading_preview").hide(); $("#catZoomPopup").show(); }; } zoomFrame.src = frameSrc; } function closeZoomWindow(){ $("#catZoomPopup").hide(); } /** */ var emailPopupLoaded = false; function emailLinkClicked(frameSrc){ if(emailPopupLoaded == false) $("#emailSignUpContent").load('email_signup_popup.jsp', function(data){$("#emailSignUpPopUp").show(); emailPopupLoaded = true;}) else $("#emailSignUpPopUp").show(); } function closeZoomWindow(){ $("#catZoomPopup").hide(); } // correctly handle PNG transparency in Win IE 5.5 & 6. function correctPNG() { var arVersion = navigator.appVersion.split("MSIE") var version = parseFloat(arVersion[1]) if ((version >= 5.5) && (version < 7) && (document.body.filters)) { for(var i=0; i" img.outerHTML = strNewHTML i = i-1 } } } }; $(correctPNG); /* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net) * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. * * $LastChangedDate: 2007-07-11 23:14:51 -0500 (Wed, 11 Jul 2007) $ * $Rev: 2323 $ * * Version 2.1 */ (function($){ /** * The bgiframe is chainable and applies the iframe hack to get * around zIndex issues in IE6. * @cat Plugins/bgiframe * @author Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net) */ $.fn.bgIframe = $.fn.bgiframe = function(s) { return this; }; })(jQuery); /* This function makes two elements the same height, whichever of the two is greater. */ /* it has two id's as parameters */ function setEqualHeight(firstElem, secondElem){ var firstHeight = $(firstElem).css('height'); var secondHeight = $(secondElem).css('height'); if (firstHeight < secondHeight){ $(firstElem).css('height', secondHeight) } else { $(secondElem).css('height', firstHeight); } } /* This function sets the left nav height in the */ function setLeftNavHeight(){ newHeight= $('.bottom-page').get(0).offsetTop - $('.left-nav-box').get(0).offsetTop; $('.left-nav-box').css('height',newHeight); } /* -- 2012/01/18, by xhji -- */ /* This function set the user-wrapper div's height in my account pages */ function setUserWrapDivHeight() { var userWrapperHeight = $('#user-wrapper').height(); var defaultUserWrapperHeight = 400; if (userWrapperHeight < defaultUserWrapperHeight) { $('#user-wrapper').css('height', defaultUserWrapperHeight); } } /* ----------------------------------------- */