SetupNamespaces("EZLF");EZLF.DocumentEmailing={Wizard:function(f,d,k,p,u){var g=this,s=new EZLF.Shared.ModalDialog(),t=d,y=k,a=p,m=u,c=null,l=null,i=new Image(),h=null,v=[],r=function(){s=new EZLF.Shared.ModalDialog(null,true);
var A=Elem("div");var z=Elem("h1");z.appendChild(Text("Email: "+m));A.appendChild(z);l=Elem("div");l.style.position="relative";A.appendChild(l);s.Display(A,550,550)},b=function(){s.CloseDialog()},e=function(A){ClearElem(l);
if(!A){A="Loading"}var z=Elem("div");z.style.position="absolute";z.style.zIndex=180;z.style.top="180px";z.style.left="185px";z.style.padding="0 0 0 40px";z.style.fontSize="18px";z.style.lineHeight="32px";
z.style.color="#171553";z.style.background="transparent url("+i.src+") no-repeat scroll center left";z.appendChild(Text(A+"&hellip;",true));l.appendChild(z)},n=function(){ClearElem(l);var z=Elem("div");
z.style.margin="180px auto 0 auto";z.style.fontSize="18px";z.style.lineHeight="32px";z.style.color="#B81818";z.style.textAlign="center";z.appendChild(Text("Error Contacting The Server"));var A=Elem("a");
A.style.display="block";A.style.margin="10px auto 0 auto";A.style.fontSize="12px";A.style.textAlign="center";A.href="#";A.onclick=function(){b();g.StartWizard();return false};A.appendChild(Text("Try Again"));
l.appendChild(z);l.appendChild(A)},w=function(){e();var z=new Pliner.Util.Ajax.Message("/wizards/ajax/loademailsettings.aspx",0);z.AddPostDataKey("leaseID",a);z.AddOnCompletedEvent(function(A){x(A.responseText)
});z.AddOnErrorEvent(function(A){n()});ajaxConnection.AddToQueue(z)},x=function(V){tenants=[];tenantsData=V.split("[break]");tenantsData.sort();for(var I=0;I<tenantsData.length;I++){var G=tenantsData[I].split("[split]");
if(G.length==3){var N=new Object();N.Name=G[0];N.Email=G[1];N.IsOnDocument=G[2].toLowerCase()=="true";tenants.push(N)}}ClearElem(l);var W=Elem("div");var S=Elem("h2");S.appendChild(Text("Add Recipients"));
l.appendChild(S);l.appendChild(Text("Select the recipients from your tenants with email addresses on file, or enter other email addresses."));var H=Elem("div");H.style.marginTop="10px";var U=Elem("div");
if(typeof(U.style.cssFloat)!="undefined"){U.style.cssFloat="left"}else{U.style.styleFloat="left"}U.style.paddingTop="2px";U.style.width="110px";U.appendChild(Text("Enter Email Address: "));var J=Elem("input");
J.type="text";J.maxlength=128;J.style.width="200px";var T=Elem("input");T.type="button";T.className="Button";T.value="Add Email";T.style.padding="3px";T.style.width="80px";T.style.marginLeft="5px";T.onclick=function(){if(J.value.length>0){if(Pliner.Util.Forms.ValidateEmail(J.value)){v.push(J.value);
J.value=""}else{alert("This email address does not appear to be formatted correctly. Please check for typos and try again.");J.focus()}}o(W);return false};H.appendChild(U);H.appendChild(J);H.appendChild(T);
l.appendChild(H);var F=Elem("div");F.style.padding="2px 0 2px 110px";F.style.fontStyle="italic";F.appendChild(Text("or"));l.appendChild(F);var K=Elem("div");var C=Elem("div");if(typeof(C.style.cssFloat)!="undefined"){C.style.cssFloat="left"
}else{C.style.styleFloat="left"}C.style.paddingTop="2px";C.style.width="110px";C.appendChild(Text("Select Saved Email: "));var B=Elem("select");B.style.width="206px";for(var I=0;I<tenants.length;I++){B.options[B.length]=new Option(tenants[I].Name+" ("+tenants[I].Email+")",tenants[I].Name+" <"+tenants[I].Email+">")
}B.selectedIndex=0;var R=Elem("input");R.type="button";R.className="Button";R.value="Add Email";R.style.padding="3px";R.style.width="80px";R.style.marginLeft="5px";R.onclick=function(){v.push(B.options[B.selectedIndex].value);
o(W);return false};K.appendChild(C);K.appendChild(B);K.appendChild(R);l.appendChild(K);var E=Elem("h2");E.appendChild(Text("Selected Recipients"));E.style.marginTop="10px";l.appendChild(E);l.appendChild(W);
for(var I=0;I<tenants.length;I++){if(tenants[I].IsOnDocument){v.push(tenants[I].Name+" <"+tenants[I].Email+">")}}o(W);var O=Elem("h2");O.style.marginTop="10px";O.appendChild(Text("Options"));l.appendChild(O);
var M=Elem("div");M.appendChild(Text("Include a Custom Message:"));var Q=Elem("textarea");Q.style.width="500px";Q.rows=3;Q.style.marginBottom="10px";Pliner.Util.Display.SetInputPlaceholder(Q,"Add an optional message to your document notification emails here.");
l.appendChild(M);l.appendChild(Q);var A=Elem("div");var P=Elem("input");P.id="InputReadReceipt";P.type="checkbox";var L=Elem("label");L.htmlFor="InputReadReceipt";L.appendChild(Text("Notify me by email when tenants read documents emailed to them."));
A.appendChild(P);A.appendChild(L);l.appendChild(A);var D=Elem("div");D.style.textAlign="center";D.style.bottom="10px";var z=Elem("input");z.type="button";z.className="Button";z.value="Send Emails";z.onclick=function(){if(v.length<=0){alert("You have not selected any recipients yet!  Please select recipients for the documents first.")
}else{j(Q.value,P.checked)}return false};D.appendChild(z);l.appendChild(D);setTimeout(function(){P.checked=true},1)},o=function(z){v.sort();for(var D=1;D<v.length;D++){if(v[D].toLowerCase()==v[D-1].toLowerCase()){v.splice(D,1);
D--}}ClearElem(z);for(var D=0;D<v.length;D++){var C=Elem("div");var A=Elem("a");var B=Elem("img");A.style.textDecoration="none";A.href="#";A.onclick=function(E){return function(){v.splice(E,1);o(z);return false
}}(D);B.src="/images/delete_icon.gif";B.width=16;B.height=16;B.alt="Remove this email from the list";B.style.verticalAlign="middle";B.style.marginRight="3px";A.appendChild(B);C.appendChild(A);C.appendChild(Text(v[D]));
z.appendChild(C)}if(v.length<=0){z.appendChild(Text("No recipients selected yet."))}z.style.height="115px";z.style.overflow="auto";z.style.border="1px solid #E5E5E5";z.style.padding="5px 8px"},j=function(z,C){e("Sending");
var B=new Pliner.Util.Ajax.Message("/wizards/ajax/senddocumentemails.aspx",0);B.AddPostDataKey("builtID",y);B.AddPostDataKey("documentID",t);B.AddPostDataKey("leaseID",a);B.AddPostDataKey("customMessage",z);
B.AddPostDataKey("haveReadReceipt",C);B.AddPostDataKey("emailsCount",v.length);for(var A=0;A<v.length;A++){B.AddPostDataKey("email"+A,v[A])}B.AddOnCompletedEvent(function(D){q(D.responseText)});B.AddOnErrorEvent(function(D){n()
});ajaxConnection.AddToQueue(B)},q=function(A){ClearElem(l);var z=Elem("h2");z.appendChild(Text(v.length+" Email"+(v.length!=1?"s":"")+" Sent"));l.appendChild(z);var B=Elem("a");B.href="/members/documents/";
B.appendChild(Text("Print"));l.appendChild(Text("Your document has been emailed to the selected recipients. "));l.appendChild(Text("You can check the status of each emailed copy by visiting the "));l.appendChild(B);
l.appendChild(Text(" page."));var D=Elem("div");D.style.marginTop="20px";var C=Elem("img");C.src="/images/info_icon.png";C.width=16;C.height=16;C.alt="Tip";C.align="absmiddle";var G=Elem("span");G.style.fontWeight="bold";
G.style.fontStyle="italic";G.style.color="#4464DC";G.appendChild(Text("Tip:"));D.appendChild(C);D.appendChild(G);D.appendChild(Text(" If your recipients don't receive an email from us, their spam filter might have blocked our message. We recommend that recipients add documents@ezlandlordforms.com to their email address book to prevent spam filters from blocking our emails."));
l.appendChild(D);var F=Elem("div");F.style.textAlign="center";F.style.marginTop="20px";var E=Elem("a");E.href="#";E.onclick=function(){b();return false};E.appendChild(Text("Close the Email Wizard"));F.appendChild(E);
l.appendChild(F)};g.StartWizard=function(){r();w()};g.TrialDialog=function(){s=new EZLF.Shared.ModalDialog(null,true);var C=Elem("div");C.style.height="180px";C.style.margin="10px";var z=Elem("img");z.src="/images/mail_icon.png";
z.width=136;z.height=84;z.style.marginRight="10px";typeof(z.style.cssFloat)!="undefined"?z.style.cssFloat="left":z.style.styleFloat="left";C.appendChild(z);var A=Elem("h1");A.appendChild(Text("Emailing Documents is a Premium Feature of ezLandlordForms"));
C.appendChild(A);var F=Elem("div");F.style.clear="both";C.appendChild(F);var D=Elem("a");D.href="https://"+window.location.host+"/join/?b=true";var B=Elem("img");B.src="/images/layout2009/home/premium_pricing.png";
B.width=170;B.height=27;B.alt="Upgrade to Premium...";B.onmouseover=function(){this.src="/images/layout2009/home/premium_pricing_roll.png"};B.onmouseout=function(){this.src="/images/layout2009/home/premium_pricing.png"
};D.appendChild(B);D.style.position="absolute";D.style.bottom="10px";C.appendChild(D);var E=Elem("a");E.href="#";E.onclick=function(){s.CloseDialog();return false};E.style.position="absolute";E.style.bottom="10px";
E.style.right="10px";E.appendChild(Text("Return To Website"));C.appendChild(E);s.Display(C,600,200)};g.TrialDownloadDialog=function(){s=new EZLF.Shared.ModalDialog(null,true);var C=Elem("div");C.style.height="180px";
C.style.margin="10px";var A=Elem("h1");A.appendChild(Text("Upgrade to Download"));C.appendChild(A);var z=Elem("h2");z.appendChild(Text("This electronic version of the Rental Application (which includes fillable fields and an e-signature) is only available to premium members."));
C.appendChild(z);var F=Elem("div");F.style.clear="both";C.appendChild(F);var D=Elem("a");D.href="https://"+window.location.host+"/join/?b=true";var B=Elem("img");B.src="/images/layout2009/home/premium_pricing.png";
B.width=170;B.height=27;B.alt="Upgrade to Premium...";B.onmouseover=function(){this.src="/images/layout2009/home/premium_pricing_roll.png"};B.onmouseout=function(){this.src="/images/layout2009/home/premium_pricing.png"
};D.appendChild(B);D.style.position="absolute";D.style.bottom="10px";C.appendChild(D);var E=Elem("a");E.href="#";E.onclick=function(){s.CloseDialog();return false};E.style.position="absolute";E.style.bottom="10px";
E.style.right="10px";E.appendChild(Text("Return To Website"));C.appendChild(E);s.Display(C,600,200)};i.src="/images/ajax-loader.gif"}};
