﻿/*
Copyright 2007 - 2010 Red Software.
All Rights Reserved.

This file and its contents may only be used to the extent, in the manner and 
for the purposes permitted by PDFescape's terms of use. Without limiting the 
foregoing, this file and its contents may NOT be copied, modified, used to 
create a derivative work of, reverse engineered, reverse assembled or 
otherwise used in attempt to discover any source code, linked to or otherwise 
used outside of PDFescape, sold, assigned, sublicensed, or distributed without 
the prior written consent of Red Software.
*/

if(document.all){document.getElementById=document.all;}var o,q;var r,u,x,y,z,A,B,C,D,F,H,J,K,L,N,O,P,Q,R,S,T,U,V,W,X,Y;var Z=160;var ba=2;var bb=600;var bc=false;function ge(s){return document.getElementById(s);}function bo(a,v){a.style.visibility=(v?"visible":"hidden");}function bp(a,d){a.style.display=(d?"block":"none");}function bq(a,l,t,w,h){var s=a.style;s.position="absolute";s.left=l+"px";s.top=t+"px";s.width=w+"px";s.height=h+"px";}function br(a,w,h){bq(a,Math.floor((o-w)/2),Math.floor((q-h)/2),w,h);}function ce(n){return document.createElement(n);}function ac(p,n){p.appendChild(n);}function bs(t){return document.createTextNode(t);}function bt(p,t){ac(p,bs(t));}function pdfescapeOnLoad(){bu();}function pdfescapeHideOverlay(){bA();}function pdfescapeOpen(t){var bd;if(t==1){bd=ge(pdfescapeUrlFile);}else{bd=ge(pdfescapeUplFile);}if(bd.value.length==0){return false;}if(bc){return true;}bc=true;bC(0,0,0);setTimeout(function(){bw(pdfescapeOpenId);},200);return true;}function bu(){window.onresize=bv;r=ge("dHeader");u=ge("dHeaderUpl");x=ge("dHeaderUrl");y=ge("dHeaderHis");z=ge("dHeaderSub");Q=ge("dStart");R=ge("dStartUpl");S=ge("dStartUrl");T=ge("dStartHis");A=ge("dHeaderZoom");B=ge("dHeaderZoomFit");C=ge("dHeaderZoom50");D=ge("dHeaderZoom100");F=ge("dHeaderZoom200");H=ge("dHeaderSelect");J=ge("dHeaderInfo");K=ge("dHeaderSecu");L=ge("dHeaderAccount");N=ge("dHeaderReport");O=ge("dBody");P=ge("dRight");U=ge("dOverlay");V=ge("dOverlayDia");W=ge("dOverlayUpl");X=ge("dOverlayUrl");Y=ge("iFormTarget");u.onclick=function(){bB(function(){by();});return false;};x.onclick=function(){bB(function(){bz();});return false;};y.onclick=function(){bB(function(){window.location.href="/account/pdfs/";});return false;};z.onclick=function(){if(pdfescapeApi){if(pdfescapeApi.checkFormCompleted(true)){if(pdfescapeApi.save(false)){window.location.href="/open/submit/?"+pdfescapeDocOpen;}else{window.alert("Error saving.");}}}return false;};R.onclick=function(){by();return false;};S.onclick=function(){bz();return false;};T.onclick=function(){window.location.href="/account/pdfs/";return false;};B.onclick=function(){if(pdfescapeApi){pdfescapeApi.setZoom(-1);}return false;};C.onclick=function(){if(pdfescapeApi){pdfescapeApi.setZoom(50);}return false;};D.onclick=function(){if(pdfescapeApi){pdfescapeApi.setZoom(100);}return false;};F.onclick=function(){if(pdfescapeApi){pdfescapeApi.setZoom(200);}return false;};H.onclick=function(){if(pdfescapeApi){pdfescapeApi.setTool(-1);}return false;};J.onclick=function(){if(pdfescapeApi){pdfescapeApi.showInformation();}return false;};K.onclick=function(){if(pdfescapeApi){pdfescapeApi.showSecurity();}return false;};L.onclick=function(){bB(function(){window.location.href="/account/";});return false;};N.onclick=function(){bB(function(){window.location.href="/report/";});return false;};bv();var be=(pdfescapeDocOpen>0);bo(O,be);bo(Q,!be);bo(A,be);bo(B,be);bo(C,be);bo(D,be);bo(F,be);bo(H,be);bo(J,be);bo(K,be);bo(z,pdfescapeDocPub);if(pdfescapeDocUrl){try{ge(pdfescapeUrlFile).value=pdfescapeDocUrl;ge(pdfescapeUrlForm).submit();pdfescapeOpen(1);}catch(e){window.alert("Error opening from URL: "+e.description);}}}function bv(){try{if(window.innerWidth){o=window.innerWidth;q=window.innerHeight;}else if(document.documentElement.clientWidth){o=document.documentElement.clientWidth;q=document.documentElement.clientHeight;}else if(document.body.clientWidth){o=document.body.clientWidth;q=document.body.clientHeight;}else{o=0;q=0;}bo(r,1);bq(L,o-200,2,100,20);bq(N,o-100,2,100,20);bq(U,0,0,o,q);br(V,300,100);br(W,400,200);br(X,400,200);if(pdfescapeDocPub){bq(O,0,60,o,q-60);}else{bq(O,0,60,o-Z-2*ba,q-60);}bq(P,o-Z-ba,85,Z,q-60);bo(P,!pdfescapeDocPub);bp(P,!pdfescapeDocPub);bq(Q,Math.floor((o-bb-Z)/2),100,bb,300);if(pdfescapeApi){pdfescapeApi.refresh();}}catch(e){}}function bw(b){var bf=false;if(window.XMLHttpRequest){bf=new XMLHttpRequest();if(bf.overrideMimeType){bf.overrideMimeType("text/plain");}}else if(window.ActiveXObject){try{bf=new ActiveXObject("Msxml2.XMLHTTP");}catch(e1){try{bf=new ActiveXObject("Microsoft.XMLHTTP");}catch(e2){}}}bf.onreadystatechange=function(){if(bf.readyState==4){var bg=false;if(bf.status==200){try{var bh=bf.responseText;var bi=bh.split(";");if(bi.length==6){switch(bi[0]){case"2":bE();window.location.href="/open/?"+bi[1];break;case"9":bE();if(bi[5]){bD(bi[5]);}else{bD("Unknown error loading file.");}break;default:if(parseInt(bi[3],10)>pdfescapeDocMax){bD("File it too large to be loaded in PDFescape.");}else{bC(parseInt(bi[2],10),parseInt(bi[3],10),parseInt(bi[4],10));setTimeout(function(){bw(b);},500);}}}else{bE();bD("Invalid open status: "+bh);}}catch(err){bE();bD("Client-side error: "+err.message);}}else{bE();bD("There was a server error opening PDF, please try again later");}}};bf.open("GET","PdfescapeOpenStatus.axd?"+b,true);bf.send(null);}function bx(){bo(W,0);bo(X,0);bo(U,1);bo(V,1);}function by(){bo(V,0);bo(X,0);bo(U,1);bo(W,1);}function bz(){bo(V,0);bo(W,0);bo(U,1);bo(X,1);}function bA(){bo(V,0);bo(W,0);bo(X,0);bo(U,0);}function bB(c){if(pdfescapeDocOpen<=0){c();return;}V.innerHTML="";bt(V,"Would you like to save your work first?");ac(V,ce("br"));var bj=ce("span");bt(bj,"Yes");bq(bj,40,80,55,18);bj.onclick=function(){if(pdfescapeApi){if(pdfescapeApi.save(false)){c();}else{window.alert("Error saving.");}}};var bk=ce("span");bt(bk,"No");bq(bk,120,80,55,18);bk.onclick=function(){c();};var bl=ce("span");bt(bl,"Cancel");bq(bl,200,80,55,18);bl.onclick=bA;ac(V,bj);ac(V,bk);ac(V,bl);bx();}function bC(f,j,k){V.innerHTML="";if((f==0)||(j==0)||(k==0)){bt(V,"PDF file is being loaded.");}else if(f<j){bt(V,"Uploading...");ac(V,ce("br"));bt(V,"Approximately "+Math.floor((j*k/f)-k)+" seconds remaining");}else{bt(V,"PDF file is being processed.");}bx();}function bD(s){V.innerHTML="";var bm=ce("div");bt(bm,s);var bn=ce("span");bt(bn,"OK");bq(bn,120,80,55,18);bn.onclick=function(){window.location.href="/open/";};ac(V,bm);ac(V,bn);bx();}function bE(){try{Y.src="/blank/";}catch(e){}}
