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(80); return movePage(180); }); $("#previous_page_link").click( function() { return movePage(-1); }); $("#bot_left").click( function() { return movePage(-1); }); $("#bot_left_end").click( function() { loadPage(0); 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 currPageNum = 0; showCurrPage(); }); function botZoomClicked() { if($("#spread_area").css("z-index") != "8250") { $("#spread_area").css("display", "none"); $("#spread_area").css("z-index", "8250"); $("#zoom_area").css("z-index", "8250"); $("#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", "550px"); $("#zoom_area").css("height", "493px"); var img = new Image(); $(img) // once the image has loaded, execute this code .load(function () { $("#spread_area").css("z-index", "-8250"); $("#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: "-493px", top: "-125px"}, 3000 ); //}); }) .attr('src', getPageImage(currPageNum));; } function loadInnerPage(moveX, moveY) { $("#page_area").load((currPageNum * 2) + ".html", function() { instantiateInnovations(); $(".link_a").click( function() { actualPageNum = $(this).html(); currPageNum = Math.floor((actualPageNum / 2.0)) $(this).attr("href", "corporate_profile.php?init=" + currPageNum); }); if(moveX > 0 && moveY > 0) { //determine the percentage of the moveX = moveX - (document.body.clientWidth - 550) / 2 - 50; moveY = moveY - 86; moveX = moveX / 0.46 - (550 / 2); moveY = moveY / 0.46 - (493 / 2); moveX = moveX * -1; moveY = moveY * -1; if(moveX < -1 * (2450 - 550)) moveX = -1 * (2450 - 550); else if(moveX > 0) moveX = 0; if(moveY < -1 * (1215 - 493)) moveY = -1 * (1215 - 493); else if(moveY > 0) moveY = 0; newX = moveX; newY = moveY; $("#page_area").css("left", newX + "px"); $("#page_area").css("top", newY + "px"); } $("#page_area").fadeIn("fast"); $("#zoom_area img").fadeOut("slow", function() { $("#zoom_area").css("z-index", "-8250"); }); }); } function zoomButtonClicked2(moveX, moveY) { $("#bot_zoom").attr("class", "bot_zoom_minus"); $("#zoom_area").html(""); $("#zoom_area").css("width", "550px"); $("#zoom_area").css("height", "493px"); var img = new Image(); $(img) // once the image has loaded, execute this code .load(function () { $("#spread_area").css("z-index", "-8250"); $("#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", "corporate_profile.php?init=" + currPageNum); }); $("#page_area").fadeIn("fast"); $("#zoom_area img").animate({ width: "2450px", height: "1215px" }, 550 ).fadeOut("slow", function() { $("#zoom_area").css("z-index", "-8250"); if(moveX > 0 && moveY > 0) { //determine the percentage of the moveX = moveX - 199; moveY = moveY - 86; moveX = moveX / 0.46 - (550 / 2); moveY = moveY / 0.46 - (516 / 2); moveX = moveX * -1; moveY = moveY * -1; if(moveX < -1 * (2450 - 550)) moveX = -1 * (2450 - 550); else if(moveX > 0) moveX = 0; if(moveY < -1 * (1215 - 516)) moveY = -1 * (1215 - 516); else if(moveY > 0) moveY = 0; newX = moveX; newY = moveY; $("#page_area").animate({left: newX + "px", top: newY + "px"}, 550 ); } }); }); //$("#page_area").fadeIn("fast", function() { //$("#page_area").animate({left: "-493px", top: "-125px"}, 3000 ); //}); }) .attr('src', getPageImage(currPageNum));; } function movePage(num) { currPageNum+=num; showCurrPage(); return false; } function resetToSpread() { if($("#spread_area").css("z-index") != "8250") { $("#zoom_area").css("z-index", "8250"); $("#spread_area").css("z-index", "8250"); } } function showCurrPage() { resetToSpread(); if(currPageNum < 0) currPageNum = 0; if(currPageNum > 15) currPageNum = 15; slide(currPageNum); $("#bot_text_inner").empty(); $("#bot_text_inner").text((currPageNum * 1) + " of 15"); //Now load the next and previous loadPage(currPageNum + 1); loadPage(currPageNum - 1); }; 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 <= 15) leftVal = spreadNum * 550; $("#spread_area").animate({ left: "-" + leftVal + "px" }, 400); $("#curr_spread_num").val(spreadNum); } function searchSubmit() { $("#searchThickbox").attr("href", "searchAction.asp?query=" + $("#search_box").attr("value") + "&keepThis=true&TB_iframe=true&height=400&width=560"); $("#searchThickbox").click(); 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)); }