﻿//sitewide jquerys
$(document).ready(function() { $("#tabs").tabs(); TabSelector(); IdPage(); $(".bannerPic").mouseenter(function() { $(this).fadeTo("normal", 0.2); $(".belowBanner").fadeIn() }); $("#tabs").mouseenter(function() { $(".belowBanner").fadeOut("slow"); $(".bannerPic").fadeTo("normal", 1) }); $(":radio[name$='rdoListSizeBT']").click(function() { RdoDisable(this.value) }); $(".clearer").click(function() { clearForm() }); $(".dialog").dialog({ autoOpen: false, width: 500, buttons: { close: function() { $(this).dialog("close") } } }); $("#dialog_link_1").click(function() { $("#dialog_1").dialog("open"); return false }); $("#dialog_link_2").click(function() { $("#dialog_2").dialog("open"); return false }); $("#dialog_link_3").click(function() { $("#dialog_3").dialog("open"); return false }); $("#dialog_link_4").click(function() { $("#dialog_4").dialog("open"); return false }); $(".What_CC").click(function() { $("#image_dialog_CC").dialog("open"); return false }); $(".What_FT").click(function() { $("#image_dialog_FT").dialog("open"); return false }); $(".What_MS").click(function() { $("#text_dialog_MS").dialog("open"); return false }); $("#dialog_link_bid").click(function() { $("#submit_bid").dialog("open"); return false }); $(".closeme, .dialog_link, ul#icons li").hover(function() { $(this).addClass("ui-state-hover") }, function() { $(this).removeClass("ui-state-hover") }); $(".waterz").focus(function() { $(".waterc").val("Enter a city name"); if ($(this).val() == "Enter zip code") { $(this).val("") } }); $(".waterz").blur(function() { if ($.trim($(this).val()) == "") { $(this).val("Enter zip code") } }); $(".waterc").focus(function() { $(".waterz").val("Enter zip code"); if ($(this).val() == "Enter a city name") { $(this).val("") } }); $(".waterc").blur(function() { if ($.trim($(this).val()) == "") { $(this).val("Enter a city name") } }); $("img.prev").hover(function() { $(this).attr("src", "images/bullet_org_lt.png") }, function() { $(this).attr("src", "images/bullet_lt.png") }); $("img.next").hover(function() { $(this).attr("src", "images/bullet_org_rt.png") }, function() { $(this).attr("src", "images/bullet_rt.png") }) }); function TabSelector() { var a = $.jqURL.get("eqtype"); switch (a) { case "truck": $("#tabs").tabs("select", 1); break; case "BEBP": $("#tabs").tabs("select", 2); break; case "AT": $("#tabs").tabs("select", 3); break; default: } } function IdPage() { if ($("#PageId").hasClass("defaultPage")) { CanadianPics(); Marquee(0, 0, 50, 3) } if ($("#PageId").hasClass("truckParts")) { $(".chatpnl").addClass("ninja") } if ($("#PageId").hasClass("ucarousel")) { $(".gets_faded").fadeTo("fast", 0.1, function() { $("#ucarousel_loading_gif").css("display", "block") }); setTimeout("doCarousel()", 3500) } if ($("#PageId").hasClass("galleryPage")) { Slideshow() } } function OgValidate() { var a = $(".txtOgz").val(), b = $(".txtOgc").val(), d = $(".ogState").val(), c = /^((\d{5}-\d{4})|(\d{5})|([A-Z]\d[A-Z]\d[A-Z]\d)|([A-Z]\d[A-Z]\s\d[A-Z]\d))$/i; if (c.test(a) === false && b === "Enter a city name") { $("#validate_dialog").dialog("open"); return false } else { if (a === "Enter zip code" && isNaN(b) === false) { $("#validate_dialog").dialog("open"); return false } else { a === "Enter zip code" ? DoLoading(b + ", " + d) : DoLoading(a) } } } function BtValidate() { var a = $(".txtBtz").val(), b = $(".txtBtc").val(), d = $(".btState").val(), c = /^((\d{5}-\d{4})|(\d{5})|([A-Z]\d[A-Z]\d[A-Z]\d)|([A-Z]\d[A-Z]\s\d[A-Z]\d))$/i; if (c.test(a) === false && b === "Enter a city name") { $("#validate_dialog").dialog("open"); return false } else { if (a === "Enter zip code" && isNaN(b) === false) { $("#validate_dialog").dialog("open"); return false } else { a === "Enter zip code" ? DoLoading(b + ", " + d) : DoLoading(a) } } } function BebpValidate() { var a = $(".txtBebpz").val(), b = $(".txtBebpc").val(), d = $(".beState").val(), c = /^((\d{5}-\d{4})|(\d{5})|([A-Z]\d[A-Z]\d[A-Z]\d)|([A-Z]\d[A-Z]\s\d[A-Z]\d))$/i; if (c.test(a) === false && b === "Enter a city name") { $("#validate_dialog").dialog("open"); return false } else { if (a === "Enter zip code" && isNaN(b) === false) { $("#validate_dialog").dialog("open"); return false } else { a === "Enter zip code" ? DoLoading(b + ", " + d) : DoLoading(a) } } } function AtValidate() { var b = $(".txtAtz").val(), c = $(".txtAtc").val(), d = $(".atState").val(), a = /^((\d{5}-\d{4})|(\d{5})|([A-Z]\d[A-Z]\d[A-Z]\d)|([A-Z]\d[A-Z]\s\d[A-Z]\d))$/i; if (a.test(b) === false && c === "Enter a city name") { $("#validate_dialog").dialog("open"); return false } else { if (b === "Enter zip code" && isNaN(c) === false) { $("#validate_dialog").dialog("open"); return false } else { b === "Enter zip code" ? DoLoading(c + ", " + d) : DoLoading(b) } } } function DoLoading(a) { BASE.modal(true, "Searching " + a) } function clearForm() { $(document).find(":radio, :checkbox").attr("checked", false).attr("disabled", false).end() } function RdoDisable(a) { switch (a) { case "JH": $(":radio[value='G']").attr("disabled", true); $(":radio[value='D']").attr("disabled", false); break; case "GH": case "TM": $(":radio[value='G']").attr("disabled", false); $(":radio[value='D']").attr("disabled", true); break; default: $(":radio[value='G']").attr("disabled", false); $(":radio[value='D']").attr("disabled", false) } } function doCarousel() { $(".ucarousel_h").ucarousel({ btnNext: ".next", btnPrev: ".prev", vertical: false, visible: 2, circular: false }); $("#ucarousel_loading_gif").css("display", "none"); $(".gets_faded").fadeTo("slow", 1); $(".ucarousel_h img").click(function() { $(".ucarousel_h_big_pic img").attr("src", $(this).attr("src").replace(/w=60&h=45/, "w=175&h=131")) }); $(".ucarousel_h_big_pic img").click(function() { window.open("large_carousel_image.aspx?" + $(this).attr("src").substring(23), "SuperSizeIt", "resizable=1, width=620, height=480") }) } function CanadianPics() { $(".truck_thumb:contains('cdn.')").addClass("truck_thumb_canada").removeClass("truck_thumb"); $(".truck_thumb:contains('cdn.')").addClass("truck_thumb_canada").removeClass("truck_thumb"); $(".truck_thumb:contains('14'')").addClass("truck_thumb_bestvalue").removeClass("truck_thumb") } function Slideshow() { var h = 140; var c = createControl("images/left.gif"), f = createControl("images/right.gif"), b = createControl("images/mag.gif"), g = $("<img/>").addClass("enlarged").hide().appendTo("body"), e = createControl("images/closeImage.gif").addClass("enlarged").appendTo("body"), a = $("<div/>").addClass("enlargedComments").css("opacity", 0.6).css("display", "none").appendTo("body"); $(".Slideshow").css({ width: h * 3, height: "108px", overflow: "hidden" }).find(".slides a").css({ "float": "none", position: "absolute", left: 1000 }); var d = function() { var i = $(".Slideshow .slides a"); i.unbind("click mouseenter mouseleave"); i.eq(0).css("left", 0).click(function(j) { i.eq(0).animate({ left: h }, "fast"); i.eq(1).animate({ left: h * 2 }, "fast"); i.eq(2).animate({ left: h * 3 }, "fast"); i.eq(i.length - 1).css("left", -h).animate({ left: 0 }, "fast", function() { $(this).prependTo(".Slideshow .slides"); d() }); j.preventDefault() }).hover(function() { c.appendTo(this).show() }, function() { c.hide() }); i.eq(2).css("left", h * 2).click(function(j) { i.eq(0).animate({ left: -h }, "fast", function() { $(this).appendTo(".Slideshow .slides"); d() }); i.eq(1).animate({ left: 0 }, "fast"); i.eq(2).animate({ left: h }, "fast"); i.eq(3).css("left", h * 3).animate({ left: h * 2 }, "fast"); j.preventDefault() }).hover(function() { f.appendTo(this).show() }, function() { f.hide() }); i.eq(1).css("left", h).click(function(j) { var k = $(this).find(".galleryComment").text(); a.css({ left: ($("body").width() - 500) / 2, top: 651 }).text(k).show(); e.css({ left: (($("body").width() - 500) / 2) + 463, top: 300, width: 37, height: 27 }).show().click(function() { g.click() }); g.attr("src", $(this).attr("href")).css({ left: ($("body").width() - 500) / 2, top: 300, width: 500, height: 375 }).show().one("click", function() { e.unbind("click").hide(); g.fadeOut(); a.hide() }); j.preventDefault() }).hover(function() { b.appendTo(this).show() }, function() { b.hide() }) }; d() } function createControl(a) { return $("<img/>").attr("src", a).addClass("control").css("opacity", 0.4).css("display", "none") } function Marquee(a, d, c, b) { a = (d + 1) % b; $(".overHidden .marqHeadline").eq(d).animate({ top: 12 }, 5000, function() { $(this).animate({ top: -c }, 5000, function() { $(this).css("top", c) }); d = a; Marquee(a, d, 50, 3) }) };
//uchat client
$(document).ready(function() { $("#dialog_link_chat_request").click(function() { $("#chat_request_dialog").dialog("open"); return false }); $("#user_textarea").keyup(function() { max_length(140, "#user_textarea") }); $("#user_textarea").keypress(function(a) { if ((a.which && a.which == 13) || (a.keyCode && a.keyCode == 13)) { $("#btn_send_user").click(); return true } }); chat_window_status() }); var users_name = "Chat-User"; var chat_session_started = "false"; var mod_name = "Moderator"; var t; var t1; var mtid = 1; var utid = 1; function form_ajax_request_init(a, b, c) { $.ajax({ type: "POST", url: a, data: b, contentType: "application/json; charset=utf-8", dataType: "json", success: function(d) { if (chat_session_started == "true") { clearTimeout(t); send_message(c, d.d); form_ajax_request_set_mod_name("uchat.asmx/get_mod_name_for_client", "{}") } else { if (d.d == "waiting..." || d.d == "Thanks for waiting.") { timer_1() } else { send_message(c, d.d); timer_1() } } } }) } function form_ajax_request_set_chat_status(a, b) { $.ajax({ type: "POST", url: a, data: b, contentType: "application/json; charset=utf-8", dataType: "json", success: function(c) { chat_session_started = c.d } }) } function form_ajax_request(a, b, c) { $.ajax({ type: "POST", url: a, data: b, contentType: "application/json; charset=utf-8", dataType: "json", success: function(d) { send_message(c, d.d) } }) } function form_ajax_request_set_mod_name(a, b) { $.ajax({ type: "POST", url: a, data: b, contentType: "application/json; charset=utf-8", dataType: "json", success: function(c) { mod_name = c.d; send_message(mod_name, "will be helping you today."); $("div.chat_box_send_button").show("slow", function() { text_area_reset() }) } }) } function form_ajax_request_set_mod_name_no_message(a, b) { $.ajax({ type: "POST", url: a, data: b, contentType: "application/json; charset=utf-8", dataType: "json", success: function(c) { mod_name = c.d } }) } function form_ajax_request_set_user_name_no_message(a, b) { $.ajax({ type: "POST", url: a, data: b, contentType: "application/json; charset=utf-8", dataType: "json", success: function(c) { users_name = c.d } }) } function form_ajax_request_get_chat_window_status(a, b) { $.ajax({ type: "POST", url: a, data: b, contentType: "application/json; charset=utf-8", dataType: "json", success: function(c) { if (c.d == "on") { chat_window_on_navigating() } else { } } }) } function form_ajax_request_no_message(a, b) { $.ajax({ type: "POST", url: a, data: b, contentType: "application/json; charset=utf-8", dataType: "json" }) } function init_chat_box() { users_name = $("#txt_user_name").val(); users_name = users_name.replace(/'/, "`"); $("#chat_request_dialog").dialog("close"); $(".chatpnl").hide("slow"); var a = "{'new_user':'" + users_name + "'}"; form_ajax_request("uchat.asmx/insert_user_into_q", a, "U-Chat Service"); $(".chat_box_content").html(" "); $("#chat_box_container").show("slow", function() { form_ajax_request_init("uchat.asmx/set_session_vars_per_user", "{}", "U-Chat Service") }) } function chat_window_status() { form_ajax_request_get_chat_window_status("uchat.asmx/get_chat_window_status", "{}") } function max_length(a, c) { var d = $(c).val(); var b = d.length; if (b > a) { $(".chat_box_title").html("Character limit reached!"); $(".chat_box_header").css("background-color", "#ff3000"); $(c).val(d.substr(0, a)); return false } else { $(".chat_box_title").html((a - b) + " characters remain"); $(".chat_box_header").css("background-color", "#334f99"); return true } } function chat_window_on_navigating() { form_ajax_request_set_mod_name_no_message("uchat.asmx/get_mod_name", "{}"); form_ajax_request_set_user_name_no_message("uchat.asmx/get_user_name", "{}"); $("#chat_box_container").addClass("samurai").removeClass("ninja"); $("div.chat_box_send_button").addClass("samurai").removeClass("ninja"); mod_check() } function send_message(e, d) { var a = get_current_time(); var b = '<div class="chat_box_message"><span class="chat_box_message_from">' + e + '&nbsp</span><span class="chat_box_message_content">' + d + "</span></div>"; $(".chat_box_content").append(b); var c = '<div class="chat_box_message"><span class="chat_box_message_info">' + a + "</span></div>"; $(".chat_box_content").append(c); $(".chat_box_content").scrollTop(100000) } function user_send_message() { var b = $(".chat_box_textarea").val(); b = b.replace(/'/g, "`"); var a = "{'text':'" + b + "'}"; form_ajax_request("uchat.asmx/insert_user_text", a, users_name); text_area_reset(); $(".chat_box_title").html("U-Chat"); clearTimeout(t); clearTimeout(t1); mod_check() } function search_for_new_mod_text() { $.ajax({ type: "POST", url: "uchat.asmx/fetch_new_moderator_text_id", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: function(a) { if (a.d > mtid) { $(".chat_box_title").html("U-Chat"); form_ajax_request("uchat.asmx/fetch_new_moderator_text", "{}", mod_name); mtid = parseInt(a.d) } else { $(".chat_box_title").html(mod_name + " is typing...") } } }) } function timer_1() { form_ajax_request_set_chat_status("uchat.asmx/get_chat_started_status", "{}"); t = setTimeout('form_ajax_request_init("uchat.asmx/set_session_vars_per_user", "{}", "U-Chat Service")', 5000) } function mod_check() { t = setTimeout("search_for_new_mod_text()", 3000); t1 = setTimeout("mod_check()", 4000) } function text_area_reset() { $("textarea").val("").focus(function() { $(this).val(""); return }) } function get_current_time() { var b = ""; var c = new Date(); var e = c.getHours(); if (e < 12) { b = "AM" } else { b = "PM" } if (e == 0) { e = 12 } if (e > 12) { e = e - 12 } var a = c.getMinutes(); a = a + ""; if (a.length == 1) { a = "0" + a } return e + ":" + a + " " + b } function reset_vars() { var b = "Chat-User"; var c = "false"; var e = "Moderator"; var a = 1; var d = 1 } function user_end_chat() { clearTimeout(t); clearTimeout(t1); reset_vars(); $("div.chat_box_send_button").hide("slow"); $("#chat_box_container").hide("slow", function() { var b = "has clicked the end chat button"; var a = "{'text':'" + b + "'}"; form_ajax_request("uchat.asmx/insert_user_text", a, users_name); form_ajax_request_no_message("uchat.asmx/set_chat_window_status", "{'status':'off'}"); form_ajax_request_no_message("uchat.asmx/end_this_session", "{}") }) };
//jqurl
jQuery.jqURL = { url: function(a) { a = jQuery.extend({ win: window }, a); return a.win.location.href }, loc: function(a, b) { b = jQuery.extend({ win: window, w: 500, h: 500, wintype: "_top" }, b); if (!b.t) { b.t = screen.height / 2 - b.h / 2 } if (!b.l) { b.l = screen.width / 2 - b.w / 2 } if (b.wintype == "_top") { b.win.location.href = a } else { open(a, b.wintype, "width=" + b.w + ",height=" + b.h + ",top=" + b.t + ",left=" + b.l + ",scrollbars,resizable") } return }, qs: function(b) { b = jQuery.extend({ ret: "string", win: window }, b); if (b.ret == "string") { return jQuery.jqURL.url({ win: b.win }).split("?")[1] } else { if (b.ret == "object") { var a = {}, e = jQuery.jqURL.url({ win: b.win }).split("?")[1]; if (e) { var c = e.split("&"); for (i = 0; i < c.length; i++) { var d = c[i].split("="); a[d[0]] = d[1] } } return a } } }, strip: function(e) { e = jQuery.extend({ keys: "", win: window }, e); if (jQuery.jqURL.url().indexOf("?") == -1) { return jQuery.jqURL.url({ win: e.win }) } else { if (!e.keys) { return jQuery.jqURL.url({ win: e.win }).split("?")[0] } else { var a = jQuery.jqURL.qs({ ret: "object", win: e.win }), b = 0, d = jQuery.jqURL.url({ win: e.win }).split("?")[0] + "?", c = ""; for (var f in a) { if (e.keys.indexOf(f) == -1) { c = (b) ? "&" : ""; d = d + c + f + "=" + a[f]; b++ } } return d } } }, get: function(b, a) { a = jQuery.extend({ win: window }, a); qsobj = jQuery.jqURL.qs({ ret: "object", win: a.win }); return qsobj[b] }, set: function(h, e) { e = jQuery.extend({ win: window }, e); var a = jQuery.jqURL.qs({ ret: "object", win: e.win }); for (var g in h) { a[g] = h[g] } var f = "", b = 0, d = ""; for (var c in a) { d = (b) ? "&" : ""; f = f + d + c + "=" + a[c]; b++ } return jQuery.jqURL.strip({ win: e.win }) + "?" + f } };
//ucarousel
(function($) { $.fn.ucarousel = function(o) { o = $.extend({ btnPrev: null, btnNext: null, btnGo: null, mouseWheel: false, auto: null, speed: 200, easing: null, vertical: false, circular: true, visible: 3, start: 0, scroll: 1, beforeStart: null, afterEnd: null }, o || {}); return this.each(function() { var running = false, animCss = o.vertical ? "top" : "left", sizeCss = o.vertical ? "height" : "width"; var div = $(this), ul = $("ul", div), tLi = $("li", ul), tl = tLi.size(), v = o.visible; if (o.circular) { ul.prepend(tLi.slice(tl - v - 1 + 1).clone()).append(tLi.slice(0, v).clone()); o.start += v } var li = $("li", ul), itemLength = li.size(), curr = o.start; div.css("visibility", "visible"); li.css({ overflow: "hidden", float: o.vertical ? "none" : "left" }); ul.css({ margin: "0", padding: "0", position: "relative", "list-style-type": "none", "z-index": "1" }); div.css({ overflow: "hidden", position: "relative", "z-index": "2", left: "0px" }); var liSize = o.vertical ? height(li) : width(li); var ulSize = liSize * itemLength; var divSize = liSize * v; li.css({ width: li.width(), height: li.height() }); ul.css(sizeCss, ulSize + "px").css(animCss, -(curr * liSize)); div.css(sizeCss, divSize + "px"); if (o.btnPrev) $(o.btnPrev).click(function() { return go(curr - o.scroll) }); if (o.btnNext) $(o.btnNext).click(function() { return go(curr + o.scroll) }); if (o.btnGo) $.each(o.btnGo, function(i, val) { $(val).click(function() { return go(o.circular ? o.visible + i : i) }) }); if (o.mouseWheel && div.mousewheel) div.mousewheel(function(e, d) { return d > 0 ? go(curr - o.scroll) : go(curr + o.scroll) }); if (o.auto) setInterval(function() { go(curr + o.scroll) }, o.auto + o.speed); function vis() { return li.slice(curr).slice(0, v) }; function go(to) { if (!running) { if (o.beforeStart) o.beforeStart.call(this, vis()); if (o.circular) { if (to <= o.start - v - 1) { ul.css(animCss, -((itemLength - (v * 2)) * liSize) + "px"); curr = to == o.start - v - 1 ? itemLength - (v * 2) - 1 : itemLength - (v * 2) - o.scroll } else if (to >= itemLength - v + 1) { ul.css(animCss, -((v) * liSize) + "px"); curr = to == itemLength - v + 1 ? v + 1 : v + o.scroll } else curr = to } else { if (to < 0 || to > itemLength - v) return; else curr = to } running = true; ul.animate(animCss == "left" ? { left: -(curr * liSize)} : { top: -(curr * liSize) }, o.speed, o.easing, function() { if (o.afterEnd) o.afterEnd.call(this, vis()); running = false }); if (!o.circular) { $(o.btnPrev + "," + o.btnNext).fadeIn("slow"); $((curr - o.scroll < 0 && o.btnPrev) || (curr + o.scroll > itemLength - v && o.btnNext) || []).fadeOut("slow") } } return false } }) }; function css(el, prop) { return parseInt($.css(el[0], prop)) || 0 }; function width(el) { return el[0].offsetWidth + css(el, 'marginLeft') + css(el, 'marginRight') }; function height(el) { return el[0].offsetHeight + css(el, 'marginTop') + css(el, 'marginBottom') } })(jQuery);
//update mytrucks widget
var UpdateMyTrucksWidget = { config: { hasNav: false }, init: function() { if (location.pathname === "/trucksales/compare.aspx") { return } updateRequest = new XHR("ulist.asmx/listCount"); updateRequest.callback = function(c, a) { var b = JSON.parse(c); UpdateMyTrucksWidget.changeCount(b.d) }; updateRequest.update("{}", "POST") }, doReminder: function(b) { var a = BASE.get("#my-trucks"); if (b === "0") { BASE.addClass(a, "ninja"); UpdateMyTrucksWidget.config.hasNav = false; UpdateMyTrucksWidget.removeNav() } else { BASE.removeClass(a, "ninja"); UpdateMyTrucksWidget.addNav() } }, changeCount: function(c) { var a = BASE.get("#my-trucks-count"), b = document.createTextNode(c); if (a._count) { a.removeChild(a._count); a.appendChild(b); a._count = b; UpdateMyTrucksWidget.doReminder(c) } else { a.appendChild(b); a._count = b; UpdateMyTrucksWidget.doReminder(c) } }, addNav: function() { if (UpdateMyTrucksWidget.config.hasNav === false) { var c = document.createElement("li"), d = document.createElement("a"), b = document.createTextNode("My Trucks"), e = BASE.get("#nav_ul"); d.setAttribute("href", "compare.aspx"); d.appendChild(b); c.appendChild(d); e.appendChild(c); UpdateMyTrucksWidget.config.hasNav = true } return }, removeNav: function() { if (UpdateMyTrucksWidget.config.hasNav === true) { var a = BASE.get("#nav_ul"); a.removeChild(a.childNodes[3]); UpdateMyTrucksWidget.config.hasNav = false } } }; BASE.start(UpdateMyTrucksWidget);
//open virtual tours
var OpenVirtualTour = { init: function() { var a = BASE.get(".virtual_tour_link"); for (var b = 0; b < a.length; b++) { BASE._click_(a[b], OpenVirtualTour.doClick) } }, doClick: function(b) { var a = window.open("", "virtual_tour", "resizable=1, width=560, height=710, scrollbars=1") } }; BASE.start(OpenVirtualTour);
//open terms
var OpenTermsHotline = { init: function() { var a = BASE.get(".terms_hotline_link"); for (var b = 0; b < a.length; b++) { BASE._click_(a[b], OpenTermsHotline.doClick) } }, doClick: function(b) { var a = window.open("", "terms_hotline", "resizable=1, width=600, height=400, scrollbars=1") } }; BASE.start(OpenTermsHotline);
//open sched appt
var OpenScheduleAppointment = { init: function() { var a = BASE.get(".schedule_appointment_link"); for (var b = 0; b < a.length; b++) { BASE._click_(a[b], OpenScheduleAppointment.doClick) } }, doClick: function(b) { var a = window.open("", "schedule_appointment", "resizable=1, width=600, height=400, scrollbars=1") } }; BASE.start(OpenScheduleAppointment);
//open make offer
var OpenMakeOffer = { init: function() { var a = BASE.get(".make_offer_link"); for (var b = 0; b < a.length; b++) { BASE._click_(a[b], OpenMakeOffer.doClick) } }, doClick: function(b) { var a = window.open("", "make_offer", "resizable=1, width=600, height=350, scrollbars=1") } }; BASE.start(OpenMakeOffer);
//open customer reviews
var OpenCustomerReviews = { init: function() { var a = BASE.get(".customer_reviews_link"); for (var b = 0; b < a.length; b++) { BASE._click_(a[b], OpenCustomerReviews.doClick) } }, doClick: function(b) { var a = window.open("", "customer_reviews", "resizable=1, width=575, height=675, scrollbars=1") } }; BASE.start(OpenCustomerReviews);
//close balloons
var CloseMe = { init: function() { var a = BASE.get(".closeme_button"); for (var b = 0; b < a.length; b++) { BASE._click_(a[b], CloseMe.doClick) } }, doClick: function(a) { BASE.addClass(this.parentNode.parentNode, "ninja") } }; BASE.start(CloseMe);
//some validation
var ValidateZip = { init: function() { var b = BASE.get(".btnGo"); for (var a = 0; a < b.length; a++) { BASE._click_(b[a], ValidateZip.submitListener) } }, rules: { is_valid: /^((\d{5}-\d{4})|(\d{5})|([A-Z]\d[A-Z]\d[A-Z]\d)|([A-Z]\d[A-Z]\s\d[A-Z]\d))$/i }, errors: { is_valid: "Enter a valid zip/postal code please" }, submitListener: function(b) { var a = this.previousSibling.previousSibling; if (!ValidateZip.rules.is_valid.test(a.value)) { a.focus(); alert(ValidateZip.errors.is_valid); BASE.preventDefault(b); return } BASE.modal(true, "One moment please.") } }; BASE.start(ValidateZip);