﻿var ups=window.ups||{}; ups.modalEmploymentContact=function(){function v(){$(".contact-employment-trigger").click(function(b){$("#page-wrapper").before($("<div/>").addClass("overlay").height($("#page-wrapper").height()));if($.support.opacity)a.show(250,function(){e.focus()});else{a.show();e.focus()}$(document).bind("keydown",function(c){if(c.keyCode==27){f.click();c.preventDefault()}});b.preventDefault()});f.live("click",function(b){$.support.opacity?a.hide(250,function(){$(this).find("select").val("-1").removeClass("error");$(this).find(":input:text, textarea").val("").removeClass("error"); $(".overlay").remove()}):a.animate({height:"toggle",width:"toggle"},300,function(){$(this).find("select").val("-1").removeClass("error");$(this).find(":input:text, textarea").val("").removeClass("error");$(".overlay").remove()});$(document).unbind("keydown");b.preventDefault()});g.live("mouseenter",function(){$(this).addClass("submit-hover")}).live("mouseleave",function(){$(this).removeClass("submit-hover")}).live("click",w)}function w(b){if(!d){d=true;a.find(":input, button").attr("disabled","disabled"); $(".employment-validator").validator(function(c){if(c){empStatus.text("").html("Sending...&nbsp;&nbsp;<img src='/images/loading.gif' style='display: inline; vertical-align: middle;' alt='' />");c=JSON.stringify({name:e.val(),address:h.val(),cell:i.val(),city:j.val(),zip:k.val(),otherPhone:l.val(),email:m.val(),hs:n.val(),military:o.val(),secLicense:p.val(),ref1:q.val(),ref2:r.val(),ref3:s.val(),citizen:t.val(),crime:u.val()});ups.util.ajax("/WebServices/wsContact.asmx/sendEmploymentContactEmail", c,function(x){if(x)setTimeout(function(){$("#emp-contact-form").empty().append($("<p/>").text("Thank you for contacting United Protective Services. A representative will be in contact with you as soon as possible."))},1E3);else{empStatus.html("").text("An error has occured. Please try again or reload the page.").addClass("status-error");$("#emp-contact-form :input").removeAttr("disabled");d=false}},function(){empStatus.html("").text("An error has occured. Please try again or reload the page.").addClass("status-error"); $("#emp-contact-form :input, #emp-contact-form button").removeAttr("disabled");d=false})}else{a.find(":input").removeAttr("disabled").blur(function(){$(".employment-validator").validator(function(){})});a.find(".error:first").focus();d=false}})}b.preventDefault()}var a,f,e,h,i,j,k,l,m,n,o,p,q,r,s,t,u,g,d;return{init:function(){a=$("<div/>").attr("id","modal-employment").addClass("modal form").html($("#modal-employment-html").html()).appendTo("body").hide();var b=$("body").width()/2-a.width()/2;a.css({left:b, top:50});$("#modal-employment-html").remove();f=$("#modal-employment-close");e=$("#tbEmpName");h=$("#tbEmpAddress");i=$("#tbEmpCell");j=$("#ddlEmpCity");k=$("#tbZip");l=$("#tbEmpOtherPhone");m=$("#tbEmpEmail");n=$("#tbEmpHighSchool");o=$("#tbEmpMilitary");p=$("#tbEmpSecLicense");q=$("#tbEmpLastJob1");r=$("#tbEmpLastJob2");s=$("#tbEmpLastJob3");t=$("#tbEmpCitizen");u=$("#tbEmpCrime");g=$("#btnEmpSubmit");empStatus=$("#emp-status");d=false;v();(new Image).src="/images/global-buttons/submit-hover.png"}}}(); $(function(){ups.modalEmploymentContact.init()});
