﻿var isValid = true; var shareObject = new myShareObj(); var emailJobForm = '<div id="Email" class="email_form"><div class="heading"><div class="close"></div><p>Send this job to a friend</p></div><div id="forms"><div id="form"><div id="left_col" class="float_left"><p>Your first name</p><p>Your last name</p><p>Your email</p><p>To email</p><p class="one_row">Personal message</p><p class="one_row">(optional)</p></div><div id="right_col" class="float_left"><div class="one_row"><input id="fName" class="name fName"/><div class="errDiv"><label for="fName" class="error">*required</label></div></div><div class="one_row"><input id="lName" class="name lName"/><div class="errDiv"><label for="lName" class="error">*required</label></div></div><div class="one_row"><input id="fromEmail" class="email fromEmail"/><div class="errDiv"><label for="fromEmail" class="error">*must be a valid email</label></div></div><div class="one_row"><input id="toEmail" class="email"/><div class="errDiv"><label for="toEmail" class="error">*must be a valid email</label></div></div><div><textarea id="emailMessage" class="message" rows="4"></textarea><div class="errDiv"><label for="message" class="error">*must be less then 1000 characters</label></div></div></div><div class="clear">&nbsp;</div><div><input type="submit" class="submit" value="send" /></div></div><div id="result"><p>The job has been sent, <a href="/JS/General/Job.asp?a=save&id=##SourceInformationID##">send another</a>?</p></div></div></div>'; var saveJobForm = '<div id="Save" class="save_form"><div class="heading"><div class="close"></div><p>Job has been saved!</p></div></div>'; function toggleMe(a) { $(a).toggle() } function toggleChildren(a) { $(a).children().not(".close").toggle() } function disableLink(a) { $(a).attr("href", "") } function toggleChildrenIgnore(b, c) { $(b).children().not(c).hide(); var a = b + " > " + c; $(a).toggle() } function validateMaxLength(b, a) { return b.length <= a } function validateAlpha(b) { var a = /^[a-zA-Z]+$/; if (a.test(b)) { return true } else { return false } } function validateNoHTML(a) { var b = /<\/?[^>]*>/; if (b.test(a)) { return true } else { return false } } function validatePhoneNumeric(a) { var b = /^(\d{10})$/; if (b.test(a) | a.length == 0) { return true } else { return false } } function validate() { isValid = true; $("input").submit(); $("textarea").submit(); return (isValid) } function displayForm(c, g, e) { var d, b; var f = "#ajax_job_forms" + g; c = "#" + c; var a = "#ajax_job_forms" + g + " > " + c; if ($(a).html()) { $(f).children().not(c).hide(); $(f).find(c).toggle() } else { switch (c) { case "#Email": b = emailJobForm; break; case "#Save": b = saveJobForm; break; default: return true } $(f).children().not(c).hide(); $(f).append(b); $(f).find(".close").click(function () { toggleMe(a) }); $(f).find(".submit").click(function () { submitTellAFriend(a, f, "") }); $(f).find("#result a").click(function () { toggleChildren($(a).find("#forms")); return false }); $(f).append('<input type="hidden" id="linkHidden" value="' + e + '"/>'); setValidation(a); prepopulateTellAFriendFields() } } function setValidation(a) { $(a).find(".phone").submit(function () { if ($(this).parent().attr("style") != "display: none;" & $(this).parent().attr("style") != "DISPLAY: none") { if (validatePhoneNumeric($(this).val())) { $(this).css("background-color", "white"); $(this).parent().find(".errDiv").children().hide() } else { isValid = false; $(this).css("background-color", "#EFC0C0"); $(this).parent().find(".errDiv").children().show() } } }); $(a).find(".name, .email, .required").submit(function () { if ($(this).parent().attr("style") != "display: none;" & $(this).parent().attr("style") != "DISPLAY: none") { if ($(this).val().length > 0) { $(this).parent().find(".errDiv").children().hide(); $(this).css("background-color", "white") } else { isValid = false; $(this).css("background-color", "#EFC0C0"); $(this).parent().find(".errDiv").children().show() } } }); $(a).find(".email").submit(function () { if ($(this).parent().attr("style") != "display: none;" & $(this).parent().attr("style") != "DISPLAY: none") { if (validateEmailRegex($(this).val()) & validateEmailBlacklist($(this).val()) & validationEmailTypos($(this).val())) { $(this).css("background-color", "white"); $(this).parent().find(".errDiv").children().hide() } else { isValid = false; $(this).css("background-color", "#EFC0C0"); $(this).parent().find(".errDiv").children().show() } } }); $(a).find(".multiEmail").submit(function () { if ($(this).parent().attr("style") != "display: none;" & $(this).parent().attr("style") != "DISPLAY: none") { if (validateMultiEmail($(this).val())) { $(this).val($(this).val().replace(/[\s]|[ ]/g, "")); $(this).css("background-color", "white"); $(this).parent().find(".errDiv").children().hide() } else { $(this).val($(this).val().replace(/[\s]|[ ]/g, "")); isValid = false; $(this).css("background-color", "#EFC0C0"); $(this).parent().find(".errDiv").children().show() } } }); $(a).find("textarea").not(".email, .multiEmail").submit(function () { if ($(this).parent().attr("style") != "display: none;" & $(this).parent().attr("style") != "DISPLAY: none") { if (validateMaxLength($(this).val(), 1000)) { $(this).css("background-color", "white"); $(this).parent().find(".errDiv").children().hide() } else { isValid = false; $(this).css("background-color", "#EFC0C0"); $(this).parent().find(".errDiv").children().show() } } }); $(a).find(".alpha").submit(function () { if ($(this).parent().attr("style") != "display: none;" & $(this).parent().attr("style") != "DISPLAY: none") { if (validateAlpha($(this).val(), 1000)) { $(this).css("background-color", "white"); $(this).parent().find(".errDiv").children().hide() } else { isValid = false; $(this).css("background-color", "#EFC0C0"); $(this).parent().find(".errDiv").children().show() } } }); $(a).find(".noHTML").submit(function () { if ($(this).parent().attr("style") != "display: none;" & $(this).parent().attr("style") != "DISPLAY: none") { if (validateNoHTML($(this).val()) == false) { $(this).css("background-color", "white"); $(this).parent().find(".errDiv").children().hide() } else { isValid = false; $(this).css("background-color", "#EFC0C0"); $(this).parent().find(".errDiv").children().show() } } }) } function ajaxFinish(a) { } function ajaxError(a, c, b) { } function htmlDecode(e) { if (e != undefined) { var a = /(%20)|(\+)/g; var b = /(%40)/g; var c = /(%2E)/g; var d = /(%2D)/g; e = e.replace(a, " "); e = e.replace(b, "@"); e = e.replace(c, "."); e = e.replace(d, "-"); return e } else { return "" } } function alignBeyondBox(g) { var d = "#" + g; var c, f, a, b, e; c = $(window).width(); a = $(d).css("padding-left"); if (a) { a = parseInt(a.replace("px", "")); b = $(d).css("padding-right"); b = parseInt(b.replace("px", "")); f = $(d).css("width"); f = parseInt(f.replace("px", "")); f = f + a + b; e = (c / 2) - (f / 2); $(d).css("position", "absolute"); $(d).css("left", e); $(d).css("position", "absolute") } } function readCookie(h) { var l = h + "="; var e = document.cookie.split(";"); for (var g = 0; g < e.length; g++) { var k = e[g]; if (k.indexOf(l) > 0) { var d = k.split("&"); for (var f = 0; f < d.length; f++) { var a = d[f]; while (a.charAt(0) == " ") { a = a.substring(1, a.length) } if (a.indexOf(l) == 0) { return htmlDecode(a.substring(l.length, a.length)) } } } } return null } function CheckAction(a) { if (a.alert.checked && readCookie("CONTACTID") == undefined) { a.action = "/js/form/searchalertform.asp"; a.submit(); return false } return true } function clearDefaultText(a, c) { var b = $("input[name=" + c + "]").val(); if (b == a) { $("input[name=" + c + "]").val("") } $("input[name=" + c + "]").css("color", "black") } function myShareObj() { return { linkTemplate: '<a target="_blank" class="twitter ##CLASS##" rel="nofollow" onclick="_gaq.push([\'_trackEvent\', \'Click\', \'Share-Twitter\']);" href="http://twitter.com/share?url=##URL##&text=##SHORTTITLE##">Twitter</a><a target="_blank" rel="nofollow" onclick="_gaq.push([\'_trackEvent\', \'Click\', \'Share-Facebook\']);" class="facebook ##CLASS##" href="http://www.facebook.com/sharer.php?u=##URL##&t=##TITLE##">Facebook</a><a target="_blank" class="buzz ##CLASS##" rel="nofollow" onclick="_gaq.push([\'_trackEvent\', \'Click\', \'Share-GoogleBuzz\']);" href="http://www.google.com/buzz/post?message=##TITLE##&url=##URL##">Google Buzz</a><a target="_blank" class="yahoo ##CLASS##" rel="nofollow" onclick="_gaq.push([\'_trackEvent\', \'Click\', \'Share-Yahoo\']);" href="http://buzz.yahoo.com/buzz?targetUrl=##URL##">Yahoo</a><a target="_blank" class="messenger ##CLASS##" rel="nofollow" onclick="_gaq.push([\'_trackEvent\', \'Click\', \'Share-MSNMessenger\']);" href="http://profile.live.com/badge?url=##URL##">Messenger</a><a target="_blank" class="linkedin ##CLASS##" rel="nofollow" onclick="_gaq.push([\'_trackEvent\', \'Click\', \'Share-LinkedIn\']);" href="http://www.linkedin.com/shareArticle?mini=true&url=##URL##&title=##TITLE##&summary=##TITLESUMMARY##&source=##DOMAIN##">LinkedIn</a><a target="_blank" class="digg ##CLASS##" rel="nofollow" onclick="_gaq.push([\'_trackEvent\', \'Click\', \'Share-Digg\']);" href="http://digg.com/submit?url=##URL##">Digg</a><a target="_blank" class="stumble ##CLASS##" rel="nofollow" onclick="_gaq.push([\'_trackEvent\', \'Click\', \'Share-StumbleUpon\']);" href="http://www.stumbleupon.com/submit/?url=##URL##">Stumble</a><a target="_blank" class="delicious ##CLASS##" rel="nofollow" onclick="_gaq.push([\'_trackEvent\', \'Click\', \'Share-Delicious\']);" href="http://delicious.com/save?v=5&noui&jump=close&url=##URL##&title=##TITLE##">Delicious</a><a target="_blank" class="reddit ##CLASS##" rel="nofollow" onclick="_gaq.push([\'_trackEvent\', \'Click\', \'Share-Reddit\']);" href="http://reddit.com/submit?url=##URL##&title=##TITLE##">Reddit</a>', url: location.href, baseurl: location.host, title: document.title, titlesummary: document.title, domainname: location.hostname, anchorClass: "", twitterTag: "", twitterTitle: function () { var a = 90; if (this.title.length > a) { return this.twitterTag + " " + this.title.substring(0, a) } else { return this.twitterTag + " " + this.title.substring(0, this.title.length) } }, getLinks: function () { var a; this.displayHTML = this.linkTemplate; this.displayHTML = this.displayHTML.replace(/##URL##/g, encodeURIComponent(this.url)); this.displayHTML = this.displayHTML.replace(/##BASEURL##/g, encodeURIComponent(this.baseurl)); this.displayHTML = this.displayHTML.replace(/##TITLE##/g, encodeURIComponent(this.title)); this.displayHTML = this.displayHTML.replace(/##SHORTTITLE##/g, encodeURIComponent(this.twitterTitle())); this.displayHTML = this.displayHTML.replace(/##TITLESUMMARY##/g, encodeURIComponent(this.titlesummary)); this.displayHTML = this.displayHTML.replace(/##DOMAIN##/g, encodeURIComponent(this.domainname)); this.displayHTML = this.displayHTML.replace(/##CLASS##/g, this.anchorClass); return this.displayHTML } } } function ajaxPost(b, e, d, a, f) { var c; if (d == undefined || c == false) { c = false } else { c = true } if (e == null) { e = {} } if (a == "Y") { e.UM = "Y" } e.AJAXREQUEST = "Y"; $.ajax({ type: "Post", url: b, dataType: "html", data: e, async: c, processData: true, error: function (g, i, h) { ajaxError(g, i, h) }, success: function (h) { if (!f) { var g = h.toString(); if (g.toUpperCase().indexOf("AJAX_POST_SUCCESS") > -1) { curBox.success = true; return curBox.successActivity() } else { alert("request failed, please try again."); return curBox.failureMethod() } } else { return true } return false } }) } function internalTracking(a) { ajaxPost(a, {}, true, "", true) };
