var currPageNum = 0; $(document).ready( function() { $("#next_page_link").click( function() { return movePage(1); }); $("#bot_right").click( function() { return movePage(1); }); $("#bot_right_end").click( function() { loadPage(82); return movePage(180); }); $("#previous_page_link").click( function() { return movePage(-1); }); $("#bot_left").click( function() { return movePage(-1); }); $("#bot_left_end").click( function() { loadPage(-1); return movePage(-180); }); $("#spread_area").mousedown( function(event) { zoomButtonClicked(event.clientX, event.clientY); }); $("#bot_zoom").click(botZoomClicked); $("#bot_pdf").click(botPDFClicked); $("#bot_print").click(botPDFClicked); $("#bot_email").click(botEmailClicked); $("#bot_toc").click(boTocClicked); $('#bot_toc').tooltip({ track: true, delay: 0, showURL: false, showBody: " - ", extraClass: "bottom_bar_popup", fixPNG: true, opacity: 0.95, left: -120, bodyHandler: function() { return "Table of Contents"; } }); $('#bot_zoom').tooltip({ track: true, delay: 0, showURL: false, showBody: " - ", extraClass: "bottom_bar_popup", fixPNG: true, opacity: 0.95, left: -120, bodyHandler: function() { return "Zoom"; } }); $('#bot_left_end').tooltip({ track: true, delay: 0, showURL: false, showBody: " - ", extraClass: "bottom_bar_popup", fixPNG: true, opacity: 0.95, left: -120, bodyHandler: function() { return "Go to First Page"; } }); $('#bot_right_end').tooltip({ track: true, delay: 0, showURL: false, showBody: " - ", extraClass: "bottom_bar_popup", fixPNG: true, opacity: 0.95, left: -120, bodyHandler: function() { return "Go to Last Page"; } }); $('#bot_email').tooltip({ track: true, delay: 0, showURL: false, showBody: " - ", extraClass: "bottom_bar_popup", fixPNG: true, opacity: 0.95, left: -120, bodyHandler: function() { return "Email a Friend"; } }); $('#bot_pdf').tooltip({ track: true, delay: 0, showURL: false, showBody: " - ", extraClass: "bottom_bar_popup", fixPNG: true, opacity: 0.95, left: -120, bodyHandler: function() { return "Download PDF / Print"; } }); $("#page_area").mousedown( function(event) { dragStart(event); }); //Do the preloads for the first page, and slide to that page }); function botZoomClicked() { if($("#spread_area").css("z-index") != "9003") { $("#spread_area").css("display", "none"); $("#spread_area").css("z-index", "9003"); $("#zoom_area").css("z-index", "9002"); $("#spread_area").fadeIn("slow"); $("#bot_zoom").attr("class", "bot_zoom_plus"); } else zoomButtonClicked(0,0); } function zoomButtonClicked(moveX, moveY) { $("#bot_zoom").attr("class", "bot_zoom_minus"); $("#zoom_area").html(""); $("#zoom_area").css("width", "880px"); $("#zoom_area").css("height", "563px"); var img = new Image(); $(img) // once the image has loaded, execute this code .load(function () { $("#spread_area").css("z-index", "-9003"); $("#zoom_area").append(this); $("#page_area").css("left", "0px"); $("#page_area").css("top", "0px"); setTimeout("loadInnerPage(" + moveX + "," + moveY + ");", 100); //$("#page_area").fadeIn("fast", function() { //$("#page_area").animate({left: "-500px", top: "-125px"}, 3000 ); //}); }) .attr('src', getPageImage(currPageNum));; } function loadInnerPage(moveX, moveY) { $("#page_area").load((currPageNum * 2) + ".html", function() { $("#page_area").append(""); var CSS = $("#page_area").children(":last"); CSS.attr({ "rel": "stylesheet", "type": "text/css", "href": "./css/test.css" }); instantiateInnovations(); $(".link_a").click( function() { actualPageNum = $(this).html(); currPageNum = Math.floor((actualPageNum / 2.0)) $(this).attr("href", "catalogue.asp?init=" + currPageNum); }); if(moveX > 0 && moveY > 0) { //determine the percentage of the moveX = moveX - (document.body.clientWidth - 980) / 2 - 50; moveY = moveY - 86; moveX = moveX / 0.46 - (880 / 2); moveY = moveY / 0.46 - (563 / 2); moveX = moveX * -1; moveY = moveY * -1; if(moveX < -1 * (1900 - 880)) moveX = -1 * (1900 - 880); else if(moveX > 0) moveX = 0; if(moveY < -1 * (1215 - 563)) moveY = -1 * (1215 - 563); else if(moveY > 0) moveY = 0; newX = moveX; newY = moveY; $("#page_area").css("left", newX + "px"); $("#page_area").css("top", newY + "px"); } ignoreNext = false; $(".grey_span" ).each( function( intIndex ){ block = $(this).html(); if(!ignoreNext) { if(($(this).prev().attr("src") != null && $(this).prev().attr("tagName") == "IMG" && $(this).prev().attr("src").indexOf("spacer") > 0) ) { $(this).prev().before('
'); } else if(($(this).prev().attr("tagName") != "BR")) { //do nothing } else $(this).prepend('') } else ignoreNext = false; if(block.indexOf("Men's") == 0 || block.indexOf("Women's") == 0) { ignoreNext = true; } } ); $("#page_area").fadeIn("fast"); $("#zoom_area img").fadeOut("slow", function() { $("#zoom_area").css("z-index", "-9002"); }); }); } function zoomButtonClicked2(moveX, moveY) { $("#bot_zoom").attr("class", "bot_zoom_minus"); $("#zoom_area").html(""); $("#zoom_area").css("width", "880px"); $("#zoom_area").css("height", "563px"); var img = new Image(); $(img) // once the image has loaded, execute this code .load(function () { $("#spread_area").css("z-index", "-9003"); $("#zoom_area").append(this); $("#page_area").css("left", "0px"); $("#page_area").css("top", "0px"); $("#page_area").load((currPageNum * 2) + ".html", function() { instantiateInnovations(); $(".link_a").click( function() { actualPageNum = $(this).html(); currPageNum = Math.floor((actualPageNum / 2.0)) $(this).attr("href", "catalogue.asp?init=" + currPageNum); }); $("#page_area").fadeIn("fast"); $("#zoom_area img").animate({ width: "1900px", height: "1215px" }, 800 ).fadeOut("slow", function() { $("#zoom_area").css("z-index", "-9002"); if(moveX > 0 && moveY > 0) { //determine the percentage of the moveX = moveX - 199; moveY = moveY - 86; moveX = moveX / 0.46 - (880 / 2); moveY = moveY / 0.46 - (563 / 2); moveX = moveX * -1; moveY = moveY * -1; if(moveX < -1 * (1900 - 880)) moveX = -1 * (1900 - 880); else if(moveX > 0) moveX = 0; if(moveY < -1 * (1215 - 563)) moveY = -1 * (1215 - 563); else if(moveY > 0) moveY = 0; newX = moveX; newY = moveY; $("#page_area").animate({left: newX + "px", top: newY + "px"}, 800 ); } }); }); //$("#page_area").fadeIn("fast", function() { //$("#page_area").animate({left: "-500px", top: "-125px"}, 3000 ); //}); }) .attr('src', getPageImage(currPageNum));; } function movePage(num) { currPageNum+=num; showCurrPage(); return false; } function resetToSpread() { if($("#spread_area").css("z-index") != "9003") { $("#zoom_area").css("z-index", "9002"); $("#spread_area").css("z-index", "9003"); } } function showCurrPage() { resetToSpread(); if(currPageNum < -1) currPageNum = -1; if(currPageNum > 82) currPageNum = 82; slide(currPageNum); $("#bot_text_inner").empty(); if(currPageNum >= 0) $("#bot_text_inner").text((currPageNum * 2) + " of 164"); else $("#bot_text_inner").text("Cover"); //Now load the next and previous loadPage(currPageNum + 1); loadPage(currPageNum - 1); $("#bottom_h1_bar").load("catalogueKeywords.asp?init=" + currPageNum); }; function loadPage(pageNum) { imgTag = $("#spread_img_" + pageNum) if(imgTag != null && imgTag.attr("src") != null) if(imgTag.attr("src").indexOf("loading") >= 0) imgTag.attr("src", getPageImage(pageNum)); } function getPageImage(pageNum) { return "images/Spreads/NonZoomed/" + (pageNum * 2) + ".jpg"; } function slide(spreadNum) { var leftVal = 0; if (spreadNum >= 0 && spreadNum <= 164) leftVal = spreadNum * 880 + 880; else if (spreadNum == -1) { leftVal = 0; } $("#spread_area").animate({ left: "-" + leftVal + "px" }, 400); $("#curr_spread_num").val(spreadNum); } function searchSubmit() { if(($("#txt_catalogue_search").attr("value") ).length > 0) { $("#searchThickbox").attr("href", "searchAction.asp?query=" + $("#txt_catalogue_search").attr("value") + "&keepThis=true&TB_iframe=true&height=400&width=560"); $("#searchThickbox").click(); } else alert("Please enter search terms in the search box."); return false; } function botEmailClicked() { $("#emailFriendThickbox").attr("href", "emailFriend.asp?page=" +currPageNum + "&keepThis=true&TB_iframe=true&height=250&width=450"); $("#emailFriendThickbox").click(); } function showVideo(pageName, file) { $("#video").attr("href", "showVideo.asp?pageName=" + pageName + "&file=" + file + "&KeepThis=true&TB_iframe=true&height=520&width=600&modal=true"); $("#video").click(); } function boTocClicked() { $("#tocThickbox").click(); } function botPDFClicked() { //Open a pdf of the currPage //window.open("./pdfs/" + (currPageNum * 2) + ".pdf"); $("#downloadPDFTB").attr("href", "downloadPDF.asp?pageNum=" +currPageNum + "&keepThis=true&TB_iframe=true&height=240&width=400"); $("#downloadPDFTB").click(); } function stripPx(num) { return parseInt(num.substring(0, num.length - 2)); }