/*Created By Darwin Ngo*/ function df() { //Do Nothing for now } $(document).ready(function () { //Global page javascripts $('#ErrorMessage').click(function () { $(this).fadeOut(); }); $(document).mousemove(function (e) { $('.loadingAjax').css({ 'left': e.pageX - 0, 'top': e.pageY - 0 }); }); /*auto scroll the image at the product page*/ if ($(".scroll")[0]) { $(function () { $(".scroll").jScroll({ speed: "slow" }); }); } /*show/hide. To use this function assign the class="ShowHide showAdvanceOption". The focus area must have cmd in front of the class for example cmdshowAdvanceOption. The id should be use for server side only.*/ $(document).on("click", ".CmdShowHide", function (e) { var _x = $(this).attr("class").split(" ")[1]; $(".cmd" + _x).slideToggle("slow"); }); if ($(".scroll")[0]) { $(function () { $(".scroll").jScroll({ speed: "slow" }); }); } //css navigator fixer for internet explorer browsers if (navigator.userAgent.match(/msie/i) != null) { $(".navmenu-h li, .navmenu-v li").hover(function () { $(this).addClass("iehover"); }, function () { $(this).removeClass("iehover"); }); } //Control SearchTxtBox $(document).on("focusin", ".SearchTxtBox", function (e) { if ($(this).val().toLowerCase() == "keyword search") { $(this).val("") } }); $(document).on("focusout", ".SearchTxtBox", function (e) { if ($(this).val() == "") { $(this).val("Keyword Search") } }); $(document).on("keydown", ".SearchTxtBox", function (e) { if ($(this).val() == "Keyword Search") { $(this).val("") } }); //Scroll back to top $(".footerBackToTop").click(function () { $('body,html').animate({ scrollTop: 0 }, 800); return false; }); $(document).on("focusin", ".HomePageProducts", function (e) { if ($(this).val().toLowerCase() == "keyword search") { $(this).val("") } }); //Limit the category results if ($(".HomePageProducts").hasClass("HomePageProducts")) { var limit = $(".HomePageProducts").attr("class").split(" "); if (limit.length > 1) { var _value = limit[1].replace("LimitTo", ""); $(".phold").each(function (index, element) { if (index > _value - 1) { $(element).hide(); } }); } $(".ViewAllCategories").show(); } //Show all categories $(document).on("click", ".ViewAllCategoriesLnk", function (e) { $(".phold").each(function (index, element) { $(element).fadeIn(); }) $('html,body').animate({ scrollTop: '+=170px' })//Scroll down 100px $(".ViewAllCategoriesLnk").hide(); }) //Product page click within the product area $(document).on("click", ".phr", function (e) { window.location = $(this).find('a').attr('href') }); //PMS -100 -Begin var _pmsClickedA = ""; //Click on the PMS color box $(document).on("click", ".showPMSBox", function (e) { var _x = parseInt(e.pageX)// (parseInt($(".pmswrap").css("width"))/2) var _y = parseInt(e.pageY) //- (parseInt($(".pmswrap").css("height"))/2) var _preH = parseInt($(document).height()); //Measure screen before new css $(".pmswrap").css({ "left": _x + "px", "top": _y + "px" }); $(".pmsbox").show(); $(".PMSCustom").hide(); $(".pmswrap").show(); $(".pmsMain").show() _pmsClickedA = $(this); //Scroll down whenever it doesn't have enough space if ($(document).height() > (_preH - parseInt($(".pmsbox").height()))) { $("html, body").animate({ scrollTop: $(document).height() - $(window).height() }); } //Improve the ie6 problem $(".pmsbox").css({ "width": $(document).width() + "px" }); $(".pmsbox").css({ "height": $(document).height() + "px" }); return false; }) //Click on the select PMS color box $(document).on("click", ".CaptPMS", function (e) { $(".pmsbox").hide(); $(".pmswrap").hide(); //Get Value for post back if (_pmsClickedA.attr("id").indexOf("ImprintImageColor") >= 0) {//Click on color image _pmsClickedA.attr("src", $(this).attr("src")) $("#" + _pmsClickedA.attr("id").replace("ImprintImageColor", "ImprintImageSrc")).val($(this).attr("src")); $("#" + _pmsClickedA.attr("id").replace("ImprintImageColor", "ImprintColor")).val($(this).attr("title")); $("#" + _pmsClickedA.attr("id").replace("ImprintImageColor", "ImprintColor")).hide(); } else {//Click on text box $("#" + _pmsClickedA.attr("id").replace("ImprintColor", "ImprintImageColor")).attr("src", $(this).attr("src")); //Save to text $("#" + _pmsClickedA.attr("id").replace("ImprintColor", "ImprintImageSrc")).val($(this).attr("src")); $("#" + _pmsClickedA.attr("id").replace("ImprintColor", "ImprintImageColor")).show(); $("#" + _pmsClickedA.attr("id")).val($(this).attr("title")); $("#" + _pmsClickedA.attr("id")).hide(); //hide text box } return false; }) //Close the screen $(document).on("click", ".closeit", function (e) { $(".pmsbox").hide(); $(".pmswrap").hide(); return false; }) //Click on the Custom PMS Box $(document).on("click", ".ClickCustomPMS", function (e) { $(".pmsMain").hide(); $(".PMSCustom").show(); $(".PMSCustomTB").val(""); //Reset to nothing $(".PMSCustomTB").focus(); return false; }) //Confirm PMS $(document).on("click", ".PMSConfirm", function (e) { if (_pmsClickedA.attr("id").indexOf("ImprintImageColor") >= 0) {//Click on color image $("#" + _pmsClickedA.attr("id").replace("ImprintImageColor", "ImprintColor")).val($(".PMSCustomTB").val()); $("#" + _pmsClickedA.attr("id").replace("ImprintImageColor", "ImprintImageSrc")).val(""); //Reset to nothing $("#" + _pmsClickedA.attr("id").replace("ImprintImageColor", "ImprintColor")).show(); //Show Text Box _pmsClickedA.hide(); } else { $("#" + _pmsClickedA.attr("id")).val($(".PMSCustomTB").val()); $("#" + _pmsClickedA.attr("id")).show(); $("#" + _pmsClickedA.attr("id").replace("ImprintColor", "ImprintImageColor")).hide(); $("#" + _pmsClickedA.attr("id").replace("ImprintColor", "ImprintImageSrc")).val(""); //Reset to nothing } $(".pmsbox").hide(); $(".pmswrap").hide(); return false; }); //PMS -100 -End ///Show and hide sizing chart $(".sizingChart").hide(); $(document).on("click", ".sizingOnOff", function (e) { $(".sizingChart").slideToggle("slow"); return false; }); //Show Hide usage pass class and ID to call function "ShowHide TargetID" $(document).on("click", ".ShowHide", function (e) { var _x = $(this).attr("class").split(" "); $("#" + _x[1]).slideToggle("slow"); return false; }); $(document).on("click", "#image1", function (e) { PopWindowZoom(); return false; }); }); function LiveChat(theurl) { NewWindow(theurl, 'livechat', '525', '525', 'no'); } function NewWindow(mypage, myname, w, h, scroll) { var winl = (screen.width - w) / 2; var wint = (screen.height - h) / 2; var winprops = 'height=' + h + ',width=' + w + ',top=' + wint + ',left=' + winl + ',scrollbars=' + scroll + ',resizable'; var win = window.open(mypage, myname, winprops); if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); } } /*Blink Error*/ var BlinkTimer; var IsClicked = ""; var LastKeyPressed = ""; //Detect click $(document).click(function (e) { IsClicked = "1"; }); //Detect keyboard $(document).keypress(function (e) { LastKeyPressed = e.which; }); function BlinkRequireForQ_E(blinkID) { if (IsClicked == "" && LastKeyPressed == "") { BlinkIt(blinkID); BlinkTimer = setTimeout("BlinkRequireForQ_E('" + blinkID + "')", 600); } else { if (blinkID != "") { var blinkIt = document.getElementById(blinkID) blinkIt.style.borderColor = '#FFFFFF'; blinkID = ""; } } } function BlinkIt(box) { var blinkIt = document.getElementById(box) var done; var myborder = '' + blinkIt.style.borderStyle + '' if (myborder.search('solid') == -1) { blinkIt.style.borderStyle = 'solid' blinkIt.style.borderColor = '#fa834e'; blinkIt.style.borderWidth = '2px'; done = "Y"; } if (myborder.search('solid') == 0 && done != 'Y') {/*make it invisible*/ blinkIt.style.borderStyle = 'dotted'; blinkIt.style.borderColor = '#FFFFFF'; } } /*zoom and popup zoomed image*/ function RunZoom() { $(document).ready(function () { var _wh= parseInt($(".rightcolumn").css("width")) - parseInt($(".pImages").css("width"))-4 $("#image1").elevateZoom({ gallery: 'gallery_01', scrollZoom: true, borderSize: 2, maxZoomLevel: false, zoomWindowWidth: _wh, zoomWindowHeight: _wh, cursor: 'pointer', galleryActiveClass: 'active', imageCrossfade: true, loadingIcon: '/fs/ajax-spinner.gif' }); return false; }); } //Additional codes written to add extra features by by Darwin Ngo //Open new window if click instead of mouseover function PopWindowZoom() { var ez = $('#image1').data('elevateZoom'); //alert("test yyr" + ez.zoomImage); //To view object infor use following .toSource()/ var _popUrl = new Image(); //Create element to get the origional image size instead of the zoomed size _popUrl.src = ez.zoomImage; NewWindow('/largeimage/?q=' + escape($("#image1").attr("src")).replace("/m/", "/l/"), 'largeIm', _popUrl.width + 20, _popUrl.height + 20, 'yes'); } /*JS Cookie - Begin This section is for helping browser to refocus the last click on the qty for jon ie browser */ function saveFocus(targetId) { createCookie("LastFocus", targetId.id, 20); } function ReFocus() { setTimeout("ffocus()", 200); } function ffocus() { if (navigator.userAgent.match(/msie/i) == null) { var lf = readCookie("LastFocus"); $('#' + lf).focus(); } } function createCookie(c_name, value, seconds) { var exdate = new Date(); exdate.setSeconds(exdate.getDate() + seconds); var c_value = escape(value) + ((seconds == null) ? "" : "; expires=" + exdate.toUTCString()); document.cookie = c_name + "=" + c_value; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') c = c.substring(1, c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); } return null; } function eraseCookie(name) { createCookie(name, "", -1); } //Popup new window function NewWindow(mypage, myname, w, h, scroll) { var winl = (screen.width - w) / 2; var wint = (screen.height - h) / 2; winprops = 'height=' + h + ',width=' + w + ',top=' + wint + ',left=' + winl + ',scrollbars=' + scroll + ',resizable' win = window.open(mypage, myname, winprops) if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); } } /*Show the progress Ajax spin icon for the form*/ $(".button").click(function () { $('#ctl00_ct_UpdateProgress1').show(); }); function SendingData() { $("#showLoading").show(); }