/* PDF Packet Builder Script ***********************************************************************************/ //page and control values. var linkPacketBuilderView = ".packetBuilderView"; var linkPacketBuilderQueuePage = ".packetBuilderQueuePage"; var linkPacketBuilderClearPacket = ".packetBuilderClearPacket"; var divOverlayScreen = "#overlayScreen"; var divOverlayPacketBuilder = "#overlayPacketBuilder"; var pagePacketView = "/FCWSite/Features/_PdfPacketBuilder/PacketViewF.aspx"; var pagePacketQueue = "/FCWSite/Features/_PdfPacketBuilder/PacketQueuePage.aspx"; var pagePacketDelete = "/FCWSite/Features/_PdfPacketBuilder/PacketDelete.aspx"; var pagePacketQuery = "/FCWSite/Features/_PdfPacketBuilder/PacketQuery.aspx"; var responseError = ""; var responseErrorLimit = ""; var messageOverItemLimit = "You are over the limit of items in your packet."; var messageSuccessfulQueueFeedback = "Remove PDF from Portfolio"; var messageGeneralError = "An error has occurred."; // Removed attaching events functionality. //refresh packet view. function refreshPacketView(closeCallBack) { $.ajax( { url: pagePacketView, cache: false, success: function(responseText) { if (responseText == responseError){ showGeneralError(); } else { $(divOverlayPacketBuilder).html(responseText).find(".packetBuilderClose").click(closeCallBack? closeCallBack : function(){}); } }, failure: function() { showGeneralError(); } } ); } //view packet builder. function viewPacketBuilder(closeCallBack) { var ie6OrBelow = ($.browser.msie && parseInt($.browser.version) < 7); if (!ie6OrBelow) { var overlayScreen = $(divOverlayScreen); overlayScreen.css("opacity", 0.6); overlayScreen.fadeIn("fast"); } var jWindow = $(window); var h = jWindow.height(); var w = jWindow.width(); var overlayPacketBuilder = $(divOverlayPacketBuilder); overlayPacketBuilder.css("top", (h / 2) - (overlayPacketBuilder.height() / 2)); overlayPacketBuilder.css("left", (w / 2) - (overlayPacketBuilder.width() / 2)); if (ie6OrBelow) overlayPacketBuilder.css("position", "absolute"); overlayPacketBuilder.show(); refreshPacketView(closeCallBack); } //queue page. function queuePage(action, url, title, target, queuedcallBack) { var actor = pagePacketQueue; if(action == "dequeue") actor = pagePacketDelete; $.ajax( { //fullURL comes from interior.master javascript url: actor, data: ({ page: escape((url)? url : fullURL), title: encodeURIComponent((title)? title : document.title) }), cache: false, type: "post", success: function(responseText) { if (responseText == responseErrorLimit) alert(messageOverItemLimit); else if (responseText == responseError) showGeneralError(); else if(target) { var link = $(target); if (link.length > 0 && messageSuccessfulQueueFeedback && messageSuccessfulQueueFeedback != '') link.html(messageSuccessfulQueueFeedback); else if(messageSuccessfulQueueFeedback && messageSuccessfulQueueFeedback != '') alert(messageSuccessfulQueueFeedback); if(queuedcallBack) queuedcallBack(); } else { var link = $(linkPacketBuilderQueuePage); if (link.length > 0 && messageSuccessfulQueueFeedback && messageSuccessfulQueueFeedback != '') link.html(messageSuccessfulQueueFeedback); else if(messageSuccessfulQueueFeedback && messageSuccessfulQueueFeedback != '') alert(messageSuccessfulQueueFeedback); if(queuedcallBack) queuedcallBack(); } }, failure: function() { showGeneralError(); } } ); } //query status function queryQueueStatus(url, callbackFunction) { $.ajax( { url: pagePacketQuery, data: ({ page: escape((url)? url : fullURL) }), cache: false, type: "post", success: function(responseText) { if (responseText == responseError){ showGeneralError(); } else { if (typeof(callbackFunction) == "function") { callbackFunction(responseText); } } }, failure: function() { showGeneralError(); } } ); } //show general error. function showGeneralError() { alert(messageGeneralError); } //for sitesearch binder //$(function(){ // $(".addtobinder").hover( // function(){$(this).find(".bindermenu").addClass("hovering");}, // function(){$(this).find(".bindermenu").removeClass("hovering");}); //});