$.fn.extend({animateFix:function(){var b=[].slice.call(arguments,0),a=b.shift(),d,e,c,f,g=350,h=(void 0===this.attr("src")||null===this.attr("src"))&&0===this.find("img").length?!1:!0;switch(b.length){case 2:f=b[1];time=b[0];break;case 1:"function"==typeof b[0]?f=b[0]:g=b[0]}if(!h||!$.browser.msie||h&&$.browser.msie&&9<=$.browser.version)this.animate(a,g,f);else for(d in a)"opacity"==d?(c=c||{},c[d]=a[d]):(e=e||{},e[d]=a[d]),e&&this.animate(ieProps,g,f),!e&&f&&f(),c&&this.css(c)}});
function strtotime(b,a){var d,e,c;c=b.replace(/\s{2,}|^\s|\s$/g," ");c=c.replace(/[\t\r\n]/g,"");if("now"==c)return(new Date).getTime()/1E3;if(isNaN(e=Date.parse(c)))a=a?new Date(1E3*a):new Date;else return e/1E3;c=c.toLowerCase();var f={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6},g={jan:0,feb:1,mar:2,apr:3,may:4,jun:5,jul:6,aug:7,sep:8,oct:9,nov:10,dec:11};e=c.match(/^(\d{2,4}-\d{2}-\d{2})(?:\s(\d{1,2}:\d{2}(:\d{2})?)?(?:\.(\d+))?)?$/);if(null!=e){e[2]?e[3]||(e[2]+=":00"):e[2]="00:00:00";c=e[1].split(/-/g);
for(d in g)g[d]==c[1]-1&&(c[1]=d);c[0]=parseInt(c[0],10);c[0]=0<=c[0]&&69>=c[0]?"20"+(10>c[0]?"0"+c[0]:c[0]+""):70<=c[0]&&99>=c[0]?"19"+c[0]:c[0]+"";return parseInt(this.strtotime(c[2]+" "+c[1]+" "+c[0]+" "+e[2])+(e[4]?e[4]/1E3:""),10)}e=c.match(RegExp("([+-]?\\d+\\s(years?|months?|weeks?|days?|hours?|min|minutes?|sec|seconds?|sun\\.?|sunday|mon\\.?|monday|tue\\.?|tuesday|wed\\.?|wednesday|thu\\.?|thursday|fri\\.?|friday|sat\\.?|saturday)|(last|next)\\s(years?|months?|weeks?|days?|hours?|min|minutes?|sec|seconds?|sun\\.?|sunday|mon\\.?|monday|tue\\.?|tuesday|wed\\.?|wednesday|thu\\.?|thursday|fri\\.?|friday|sat\\.?|saturday))(\\sago)?",
"gi"));if(null==e)return!1;for(d=0;d<e.length;d++){a:{c=e[d].split(" ");var g=c[2]&&"ago"==c[2],h=(h="last"==c[0]?-1:1)*(g?-1:1);switch(c[0]){case "last":case "next":switch(c[1].substring(0,3)){case "yea":a.setFullYear(a.getFullYear()+h);break;case "mon":a.setMonth(a.getMonth()+h);break;case "wee":a.setDate(a.getDate()+7*h);break;case "day":a.setDate(a.getDate()+h);break;case "hou":a.setHours(a.getHours()+h);break;case "min":a.setMinutes(a.getMinutes()+h);break;case "sec":a.setSeconds(a.getSeconds()+
h);break;default:if("undefined"!=typeof(g=f[c[1].substring(0,3)]))g-=a.getDay(),0==g?g=7*h:0<g?"last"==c[0]&&(g-=7):"next"==c[0]&&(g+=7),a.setDate(a.getDate()+g)}break;default:if(/\d+/.test(c[0]))switch(h*=parseInt(c[0],10),c[1].substring(0,3)){case "yea":a.setFullYear(a.getFullYear()+h);break;case "mon":a.setMonth(a.getMonth()+h);break;case "wee":a.setDate(a.getDate()+7*h);break;case "day":a.setDate(a.getDate()+h);break;case "hou":a.setHours(a.getHours()+h);break;case "min":a.setMinutes(a.getMinutes()+
h);break;case "sec":a.setSeconds(a.getSeconds()+h)}else{c=!1;break a}}c=!0}if(!c)return!1}return a.getTime()/1E3}
BRI=function(){var b={},a={},d=0;return{register:function(a,c){b[a]={creator:c,instance:null}},start:function(a){if(b[a])b[a].instance=b[a].creator(new Sandbox),b[a].instance.init()},stop:function(a){a=b[a];if(a.instance)a.instance.destroy(),a.instance=null},startAll:function(){for(var a in b)b.hasOwnProperty(a)&&this.start(a)},stopAll:function(){for(var a in b)b.hasOwnProperty(a)&&this.stop(a)},addListener:function(b,c,f,d){for(var h=b.length,i=0;i<h;i++){var l=0,k=!1,j;a[b[i]]||(a[b[i]]=[]);for(j=
a[b[i]].length;l<j;l++)c==a[b[i]].handler&&f==a[b[i]].ctx&&!d&&(k=!0);k||a[b[i]].push({handler:c,ctx:f})}},dispatchEvent:function(b){var c=b.e,f=[],d=0,h,i;for(i in b.data)f.push(b.data[i]);for(h in a)if(h==c)for(b=a[h].length;d<b;d++)i=a[h][d],i.handler.apply(i.ctx,f)},removeListener:function(b,c,d){var g=0,h,i;if(a[b])for(h=a[b].length;g<h;g++)if(i=a[b][g],i.handler==c&&i.ctx==d){a[b].splice(g,1);break}},clearEventType:function(b){a[b]&&(a[b]=[])},log:function(a){var b;d++;a="err"+d+": "+a;b=$("#console");
if(0<b.length){var f=b.html();b.html(f+"\n"+a)}else if(!console)return a}}}();Sandbox=function(){return{listen:function(b,a,d,e){"string"==typeof b&&(b=[b]);BRI.addListener(b,a,d,e)},notify:function(b){BRI.dispatchEvent(b)},kill:function(b,a,d){BRI.removeListener(b,a,d)},killType:function(b){BRI.clearEventType(b)},refresh:function(){BRI.stopAll();BRI.startAll()}}};
BRI.register("adjust",function(b){return{init:function(){$(window).bind("resize",this.resize).trigger("resize")},resize:function(){var a=$(window).width(),d=$(window).height();b.notify({e:"adjust",data:{width:a,height:d}})},destroy:function(){$(window).unbind("resize",this.resize)}}});
BRI.register("home-carousel",function(){var b,a,d,e,c;return{init:function(){b=this;a=$("#home-carousel-nav").children("a").bind("click",b.changeCarousel);d=$(".home-carousel-item");c=d.length;e=setInterval(b.advance,6E3)},advance:function(){var f=d.filter(":visible").index(),f=f+1>=c?0:f+1;a.eq(f).addClass("active").siblings().removeClass("active");b.changeCarousel(void 0,d.eq(f))},changeCarousel:function(a,b){var c=void 0==b?$(this):b,i=c.index(),l=d.filter(":visible"),b=d.eq(i);if(l.index()==b.index())return!1;
c.addClass("active").siblings("a").removeClass("active");l.css("z-index",-1);b.css({position:"absolute",display:"block",opacity:0,top:0,left:0}).animateFix({opacity:1},function(){l.css({zIndex:0,display:"none",opacity:0}).removeClass("active");b.addClass("active").css({position:"relative"})});a&&(clearInterval(e),e=null,a.preventDefault())},destroy:function(){}}});
BRI.register("reservation-manager",function(b){var a,d,e,c=[],f,g=[],h,i,l="a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z".split(","),k,j;return{init:function(){a=this;if(0<$("body#thank_you").length)return!1;vehicles=$(".vehicle-selection fieldset");vehicles.bind("click",a.updateTravelers);j=$("#cheech");$("#res-comments");e=$(".select-field").detach();$("input,textarea,select").live({focus:a.focusField,blur:a.blurField});i=$(".reservation-field.destinations");h=$(".destination-item").clone();
h.find(".add-location").remove();$(".add-location").bind("click",a.addLocation);a.bindRemoves();k=$('input[type="radio"]').filter(".tab");d=$("#reservation-form, #quote-form");d.each(a.replaceRadios);d.each(a.replaceTravelers);a.replaceRadios();k.each(a.replaceTabs);d.each(a.getFormType);$("select").change(function(){if("how-did-you-hear-about-us"!=$(this).attr("id"))return!1;"other source"==$(this).val()?$("#other-source").show():$("#other-source").hide()});$("#reservation-form").find('input[type="submit"]').bind("click",
a.submitForm);$(".add-location").trigger("click");0===err.length&&$(".reservation-row-wrapper").hide();0===err.length&&$(".van-use").hide();0===err.length&&$('input[type="submit"]').hide();0<err.length&&a.highlightErrors(err);SWFAddress.addEventListener(SWFAddressEvent.CHANGE,a.routeChange)},updateTravelers:function(){var a=$(this).find(".form-label").text(),b=a.match(/(\d+)/m)[1],m=parseFloat(b,10)+1,a=$(".travelers-label"),c=a.eq(0),a=a.eq(1),d=$(".travelers"),f=d.eq(0),d=d.eq(1);c.html(c.html().replace(/^1\-(\d+)/,
"1-"+b));a.html(a.html().replace(/^(\d+)/,m));f.val(f.val().replace(/^1\-(\d+)/,"1-"+b));d.val(d.val().replace(/^(\d+)/,m))},highlightErrors:function(){var a=err.length,b;for(b=0;b<a;b++)$('select[name="'+err[b]+'"], input[name="'+err[b]+'"]').addClass("error")},focusField:function(){var a=$(this),b=a.parentsUntil(".reservation-field").eq(0).parent();b[0]||(b=a.parent());b.hasClass("destination-item")&&(b=b.parent());$(".reservation-field").removeClass("active");b.addClass("active")},blurField:function(){$(this).parentsUntil(".reservation-field").eq(0).parent().removeClass("active")},
routeChange:function(b){var c=b.pathNames[1],m={};$("html,body").animateFix({scrollTop:0});switch(c){case "reserve":a.tabClicked(!1,1);break;case "quote":a.tabClicked(!1,0)}if(b.pathNames[2])m.type="get",m.dataType="json",m.success=a.driverFound,m.error=a.unknownDriver,m.timeout=5E3,m.url=site_url+"_resources/ajax_interface/fetch/"+b.pathNames[2],$.ajax(m)},driverFound:function(a){$('textarea[name="additional-comments"]').val("I would like to travel with "+a.name+".\nI understand that chauffer requests may not be accommodated due to schedules or other conflicts.\n\n")},
unknownDriver:function(){},submitForm:function(a){var b=$("#reservation-form"),c=0,d,f,e,j,k,g,h,i,l,n,p;d=b.data("type");b.find(".reservation-field").each(function(){var a,b;a=!1;f=$(this);e=f.data("use").replace(/\s/gi,"").split(",");for(b in e)e[b]==d&&(a=!0);!1===a?f.detach():(j=f.find("input,select,radio"),j.each(function(a,b){var o=!1;k=$(b);"email*"==k[0].name&&(o=null==/[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}/i.exec(k[0].value)?!0:!1);if(k[0].name.match(/\*$/)&&(""==k[0].value||"--"==k[0].value||
!0==o))k.addClass("error"),c++}))});"other source"==document.getElementById("how-did-you-hear-about-us").value&&(b=document.getElementById("other-source"),""==b.value&&($(b).addClass("error"),c++,error=!0));b=$("#months");g=$("#days");h=$("#years");i=$("#res-time-hours");l=$("#res-time-minutes");n=b.val()+" "+g.val()+", "+h.val()+" "+i.val()+":"+l.val();n=strtotime(n);p=new Date;p=strtotime(p.toString());p>n&&(c++,b.addClass("error"),g.addClass("error"),h.addClass("error"),i.addClass("error"),l.addClass("error"));
0<c&&(a.preventDefault(),c=0)},dataReceived:function(b){var c=b.data,d=c.length,f;if("failed"==b.response)for(b=0;b<d;b++)f=c[b],f.replace(/\*$/,""),$('[name="'+f+'"]').addClass("error");else j.css({opacity:0,display:"block",cursor:"pointer"}).animateFix({opacity:0.9},function(){j.bind("click",a.killCheech)}),$("#thankyou-bubble,.thankyou-green-bubble").css({display:"block",opacity:0}).animateFix({opacity:1},function(){setTimeout(a.killCheech,2E3)})},killCheech:function(a){j.animateFix({opacity:0},
function(){j.remove()});$("#thankyou-bubble,.thankyou-green-bubble").animateFix({opacity:0},function(){$("#thankyou-bubble,.thankyou-green-bubble").css("display","none")});a.preventDefault()},dataError:function(){},replaceTabs:function(){var b=$(this).css({opacity:0,position:"absolute"}),c=document.createElement("a");c.className="tab";c.href="#";void 0!==b.attr("CHECKED")&&(c.className+=" active");c.innerHTML=b.attr("value");$(c).bind("click",a.tabClicked);b.after(c)},tabClicked:function(a,b){var c=
a?$(this):k.eq(b).next("a");"reservation"==c.prev('input[type="radio"]').val().toLowerCase().match(/\s(\w+)$/)[1]?$(".for-res-only").show():$(".for-res-only").hide();c.addClass("active").siblings().removeClass("active");k.removeAttr("checked");c.prev('input[type="radio"]').attr("CHECKED","");a&&a.preventDefault()},commentFocus:function(){var a=$(this),b=a.parent(),c=a.data("ph"),d=a.data("th");b.stop().animateFix({height:c+150});a.stop().animateFix({height:d+150})},commentBlur:function(){var a=$(this),
b=a.parent(),c=a.data("ph"),d=a.data("th");b.stop().animateFix({height:c});a.stop().animateFix({height:d})},bindRemoves:function(){$(".delete-location").unbind().bind("click",a.removeLocation)},addLocation:function(b){var c=h.clone(),d=$(this);c.find(".delete-location").show();c.find(".delete-location").css("display","block");d.detach().appendTo(c);g.push(c);a.sortDestinations();i.append(c);a.bindRemoves();b&&b.preventDefault()},sortDestinations:function(){var a,b=g.length,c,d,f,e;for(a=0;a<b;a++)c=
g[a],e=l[a+1],d=c.find(".destination-label"),d.text("Destination "+e.toUpperCase()),0==(a+1)%3&&c.css({marginLeft:0,borderLeft:"none"}),c.find(".delete-location").css("top",13),d=c.find("label"),f=c.find("select"),c=c.find("input"),d.each(function(){var a=$(this),b=a.attr("for").replace(/\-a/,"-"+e);a.attr("for",b)}),f.each(function(){var a=$(this),b=a.attr("id").replace(/\-a/,"-"+e),c=a.attr("name").replace(/\-a/,"-"+e);a.attr("id",b);a.attr("name",c)}),c.each(function(){var a=$(this),b=a.attr("id").replace(/\-a/,
"-"+e),c=a.attr("name").replace(/\-a/,"-"+e);a.attr("id",b);a.attr("name",c)})},removeLocation:function(b){var c=$(this).parent("div"),d=c.prev("div"),f=c.data("index");c.find(".add-location").detach().appendTo(d);g.splice(f,1);c.remove();a.sortDestinations();b.preventDefault()},replaceSelects:function(b,d){var m=void 0===b?$("select"):b,k=m.length,j,g,h,i,l,s,r,t;for(j=0;j<k;j++){g=m.eq(j);i=g.children("option");s=i.length;h=e.clone();h.attr("id",g.attr("id"));c.push(h);t=h.children(".select-field-list");
for(l=0;l<s;l++){r=i.eq(l);var n=document.createElement("li");$(n).data({value:r.val()});$(n).text(r.text());$(n).bind("click",a.optSelect);t.append(n);"how-did-you-hear-about-us"==g[0].id&&$(n).bind("click",a.howClicked)}"how-did-you-hear-about-us"==g.attr("id")?i=200:(i=void 0===d?parseInt(g.css("width"),10)-21:d,i=30>i?30:i);h.children(".select-field-input").css("width",i).addClass(g.attr("name").replace(/\*$/,"")).html(g.val());h.children(".select-field-list").css("width",i+19);h.css("width",
i+26);h.find(".select-field-input,.select-field-button").bind("click",a.toggleList);g.after(h).hide()}f=c.length},howClicked:function(){var a=$(this);a.parent("ul").parent("div").next("input")["other source"==a.data("value").toLowerCase()?"fadeIn":"fadeOut"]()},optSelect:function(a){var b=$(this),c=b.data("value"),d=b.parent("ul"),f=d.parent("div"),e=f.children(".select-field-input"),f=f.prev("select").children("option"),j=f.length,g,h;for(g=0;g<j;g++)h=f.eq(g),h.val()==c&&h.attr("SELECTED","selected").siblings("option").removeAttr("SELECTED");
e.html(b.text());d.hide();a.preventDefault()},closeSelects:function(b){$(this);b.preventDefault();b.stopPropagation();a.hideDropdowns(null)},hideDropdowns:function(a){var b,d,e;null!=a&&(container=a.parentsUntil(".reservation-field").parent(),container.addClass("active"));for(b=0;b<f;b++)if(d=c[b],e=d.find(".select-field-list"),!a||d.attr("id")!==a.attr("id"))e.hide(),null!=a&&(container=e.parentsUntil(".reservation-field").parent())},toggleList:function(a){var c=$(this),d=c.parent("div");c.siblings(".select-field-list").toggle();
b.notify({e:"dropdown",data:{source:d}});a.preventDefault()},getFormType:function(a,b){var c=$(b),d=c.find(".reservation-field"),f=d.length,e,g,h;c.attr("id");c.data("type");for(e=0;e<f;e++){var j,k,i;i=!1;g=d.eq(e);h=g.data("use").replace(/\s/g,"").split(",");k=h.length;for(j=0;j<k;j++)c.data("type")===h[j]&&(i=!0);g[!0===i?"show":"hide"]()[!0===i?"addClass":"removeClass"]("vis")}visible=$(".reservation-field:visible");g=visible.length;c.children("br").remove();for(e=0;e<g;e++)f=visible.eq(e),d=
f.find("h2"),h=d.text().replace(/^\d+/,e+3),d.text(h),c.data("type"),3==e?f.css("margin-left",0):0<e&&f.css("margin-left",3)},replaceRadios:function(){var b=$(this).find('input[type="radio"]').not(".tab,.travelers"),c=b.length,d,f,e;for(f=0;f<c;f++)d=b.eq(f),void 0!==d.data("image")?(e=new Image,e.src=d.data("image"),$(e).css("cursor","pointer").bind({click:a.toggleRadio}),d.css({position:"absolute",opacity:0}).after(e),$(e).parent("fieldset").bind({mouseenter:a.active,mouseleave:a.inactive}),$(e).next(".form-label").css("cursor",
"pointer").bind("click",a.vehicleClick)):(d.next(".form-label").css("cursor","pointer").bind("click",a.labelClick),d.hide())},replaceTravelers:function(){var b=$(this).find('input[type="radio"]').filter(".travelers"),c=b.length,d,f,e;for(f=0;f<c;f++)d=b.eq(f),e=document.createElement("div"),e.innerHTML=d.val(),$(e).bind("click",a.travelersClicked),e.className="travelers-label",d.after(e),d.is(":checked")&&$(e).addClass("active"),d.hide()},travelersClicked:function(){var a=$(this);a.prev('input[type="radio"]').trigger("click");
$(".travelers-label").removeClass("active");a.addClass("active")},vehicleClick:function(a){$(this).prev("img").trigger("click");a.preventDefualt()},active:function(a,b){var c=void 0===b?$(this).find("img"):b,d=c.prev('input[type="radio"]').data("image2");if(c.parent().hasClass("active")&&a)return!1;c[0].src=d},inactive:function(a,b){var c=void 0===b?$(this).find("img"):b,d=c.prev('input[type="radio"]').data("image");if(c.parent().hasClass("active"))return!1;c[0].src=d},labelClick:function(b){var c=
$(this),f=c.prev('input[type="radio"]'),c=c.parent("fieldset");$("form").data({type:f.val()});$(".reservation-row-wrapper").slideDown();$('input[type="submit"]').fadeIn();d.each(a.getFormType);f.trigger("click");c.addClass("active").siblings("fieldset").removeClass("active");b.preventDefault()},toggleRadio:function(b){var c=$(this),d=c.prev('input[type="radio"]'),f=c.parent("fieldset"),e=f.siblings("fieldset").children("img"),g;d.trigger("click");f.addClass("active").siblings("fieldset").removeClass("active");
$(".van-use").slideDown();a.active(null,c);e.each(function(){g=$(this);a.inactive(null,g)});b.preventDefault()},destroy:function(){return!1}}});
BRI.register("fleet",function(){var b,a,d,e=0,c=0,f=0,g,h,i,l;re=RegExp("^"+site_url+"(.+)$");re2=RegExp("^"+page_url+"(.+)$");aliasBase=page_url.match(re)[1];return{init:function(){b=this;$(".fleet-back").bind("click",b.listBack);$(".fleet-forward").bind("click",b.listForward);h=$(".fleet-play-pause").bind("click",b.listTogglePlay);$(".fleet-carousel-nav").children("a").unbind().bind("click",b.setCarouselItem);a=$(".fleet-section");l=$(".tab").bind("click",b.setTab);g=a.eq(0).find(".fleet-carousel-info").eq(0).children("ul").eq(0).children("li");
f=g.parent("ul").data("max");currentListPages=Math.ceil(g.length/f);c=g.length;b.setListTimer();SWFAddress.addEventListener(SWFAddressEvent.CHANGE,b.routeChange)},setListTimer:function(){h.removeClass("inactive");i=setInterval(b.advanceList,3E3)},routeChange:function(a){if(!a.pathNames[1])return!1;var c=aliasBase+a.path.replace(/^\/?!\//,""),c=site_url+"_resources/ajax_interface/alias_lookup/"+c,d={};if(0<a.pathNames[1]&&4>a.pathNames[1])return b.setItem(a.pathNames[1]),!1;d.url=c;d.dataType="json";
d.type="get";d.success=b.pageLoaded;d.timeout=5E3;d.error=b.pageError;$.ajax(d)},pageError:function(){},pageLoaded:function(a){var c={type:"get",dataType:"json"};c.url=site_url+"_resources/ajax_interface/fetch/"+a.parent;c.error=b.pageError;c.success=function(c){b.parentLoaded(a,c)};$.ajax(c)},parentLoaded:function(e,h){l.eq(h.order).addClass("active").siblings().removeClass("active");a.eq(h.order).show().siblings(".fleet-section").hide();d=a.eq(h.order).find(".fleet-carousel-item");a.find(".fleet-carousel-info").each(b.prepLists);
clearTimeout(i);i=setInterval(b.advanceList,3E3);d.eq(e.order).show().siblings(".fleet-carousel-item").hide();a.eq(h.order).find(".nav-item").eq(e.order).addClass("active").siblings().removeClass("active");g=d.eq(e.order).find(".fleet-carousel-info").children("ul").children("li");f=g.parent("ul").data("max")||9;c=g.length;currentListPages=Math.ceil(c/f);b.setCurrentListIndex(0);window.document.title=e.meta_title?e.meta_title:e.name+" | Brilliant Transportation"},setTab:function(a){var b="#!/"+$(this).attr("href").match(re2)[1];
window.location.hash=b;a.preventDefault()},setCarouselItem:function(a){var b="#!/"+$(this)[0].href.match(re2)[1];window.location.hash=b;a.preventDefault()},advanceList:function(){b.listForward()},listBack:function(a){b.setCurrentListIndex(e-1);a&&clearInterval(i);a.preventDefault()},listForward:function(a){b.setCurrentListIndex(e+1);a&&(a.preventDefault(),clearInterval(i))},listTogglePlay:function(a){null==i?b.setListTimer():(clearTimeout(i),i=null,$(this).addClass("inactive"));a.preventDefault()},
setCurrentListIndex:function(a){e=a;b.controlCurrentListIndex();b.updateListData()},controlCurrentListIndex:function(){e>=currentListPages?e=0:0>e&&(e=currentListPages-1)},updateListData:function(){var a=e*f,b=a+f,b=b>c?c:b;g.hide();g.slice(a,b).show()},prepLists:function(){var a=$(this).children("ul"),b=a.data("max"),a=a.children("li");a.slice(b,a.length).hide()},destroy:function(){SWFAddress.removeEventListener(SWFAddressEvent.CHANGE,b.routeChange)}}});
BRI.register("newsletter-module",function(){var b,a,d,e,c;return{init:function(){b=this;a=$(".newsletter-module,.register_form");e=$("#cheech");c=$("#thankyou-bubble,.thankyou-green-bubble").hide();d=a.find("form");a.find('input[type="text"]').val("Name").bind({focus:b.focusName,blur:b.blurName});a.find('input[type="email"]').val("Email*").bind({focus:b.focusEmail,blur:b.blurEmail});a.find('input[type="submit"]').bind("click",b.register)},register:function(a){var c=d.serialize(),e={};e.data=c;e.type=
"post";e.dataType="json";e.url=d.attr("action");e.success=b.registered;e.error=b.failed;e.timeout=5E3;$.ajax(e);a.preventDefault()},registered:function(a){a&&"success"==a.status&&(c.css({display:"inline-block",opacity:0,top:0,left:($(window).width()-c.innerWidth())/2}).animateFix({opacity:1}),e.css({display:"block",opacity:0,cursor:"pointer"}).animateFix({opacity:1},function(){e.bind("click",b.killCheech);setTimeout(b.killCheech,2E3)}))},killCheech:function(a){e.animateFix({opacity:0},function(){e.remove()});
c.fadeOut();a&&a.preventDefault()},failed:function(){},focusName:function(a){var b=$(this);"name"==b.val().toLowerCase()&&b.val("");a.preventDefault()},blurName:function(a){var b=$(this);""==b.val().toLowerCase()&&b.val("Name");a.preventDefault()},focusEmail:function(a){var b=$(this);"email*"==b.val().toLowerCase()&&b.val("");a.preventDefault()},blurEmail:function(a){var b=$(this);""==b.val().toLowerCase()&&b.val("Email*");a.preventDefault()},destroy:function(){}}});
BRI.register("about",function(){var b,a,d,e,c,f,g=RegExp("^"+page_url+"(.+)$"),h=page_url.match(RegExp("^"+site_url+"(.+)$"))[1],i,l,k;return{init:function(){b=this;k=f=!1;$(".section-header");$(".section-content");a=$(".tab").bind("click",b.setTab);b.bindBios();teamNext=$("#team-right").bind("click",b.teamBackward);teamPrev=$("#team-left").bind("click",b.teamForward);$("#quotes-left").bind("click",b.testimonialRight);$("#quotes-right").bind("click",b.testimonialLeft);i=$("#testimonial-carousel");
l=i.find(".quote");SWFAddress.addEventListener(SWFAddressEvent.CHANGE,b.routeChange)},testimonialLeft:function(a){var b=l.first(),c=b.clone(),d=b.innerWidth();if(k)return!1;k=!0;b.animateFix({marginLeft:-d},function(){c.appendTo(i);b.remove();l=i.find(".quote");k=!1});a.preventDefault()},testimonialRight:function(a){var b=l.last(),c=b.clone(),d=b.innerWidth();if(k)return!1;k=!0;c.css("margin-left",-d).prependTo(i).animateFix({marginLeft:0},function(){b.remove();l=i.find(".quote");k=!1});a.preventDefault()},
routeChange:function(a){a.path.replace(/^\/?!\//,"");var a=site_url+"_resources/ajax_interface/alias_lookup/"+h+a.path.replace(/\!\//,""),c={};c.url=a;c.type="get";c.dataType="json";c.success=b.dataReceived;c.timeout=5E3;c.error=b.dataError;$.ajax(c)},dataReceived:function(a){var b=$("#t"+a.id),c=$("#h"+a.id),d=$("#c"+a.id);window.document.title=a.meta_title?a.meta_title:a.name+" | Brilliant Transportation";b.addClass("active").siblings().removeClass("active");c.show().siblings(".section-header").hide();
d.show().siblings(".section-content").hide()},dataError:function(){},bindBios:function(){d=$(".team-image-item");e=$(".team-name-item");c=$(".team-bio-item")},teamForward:function(a){if(!0===f)return!1;f=!0;lastImage=d.last();lastName=e.last();lastBio=c.last();lastImage.detach().css({marginLeft:-326}).prependTo($("#team-image-carousel")).animateFix({marginLeft:0},function(){f=!1});lastName.detach().css({marginLeft:-326}).prependTo($("#team-name-carousel")).animateFix({marginLeft:0});lastBio.detach().css({marginLeft:-326}).prependTo($("#team-bio-carousel")).animateFix({marginLeft:0});
b.bindBios();a.preventDefault()},teamBackward:function(a){if(!0===f)return!1;f=!0;firstImage=d.first();firstName=e.first();firstBio=c.first();firstImage.animateFix({marginLeft:-326},function(){firstImage.detach().css("margin-left",0).appendTo($("#team-image-carousel"));b.bindBios();f=!1});firstName.animateFix({marginLeft:-326},function(){firstName.detach().css("margin-left",0).appendTo($("#team-name-carousel"));b.bindBios()});firstBio.animateFix({marginLeft:-326},function(){firstBio.detach().css("margin-left",
0).appendTo($("#team-bio-carousel"));b.bindBios()});a.preventDefault()},setTab:function(b,c){var d="#!/"+(b?$(this):a.eq(c)).attr("href").match(g)[1];window.location.hash=d;b&&b.preventDefault()},destroy:function(){SWFAddress.removeEventListener(SWFAddressEvent.CHANGE,b.routeChange)}}});
BRI.register("image-gallery",function(b){var a,d,e,c,f,g,h=RegExp("^"+page_url+"(.+)$"),i=page_url.match(RegExp("^"+site_url+"(.+)$"))[1],l,k,j,o,q,m;return{init:function(){a=this;f=0;g=!1;k=$("#cheech, #cheeched-carousel");q=$("#cheeched-carousel");m=q.outerHeight();o=$(".media-close");SWFAddress.addEventListener(SWFAddressEvent.CHANGE,a.checkHash);c=$("#media-carousel-text");d=$(".fleet-carousel-info-nav");d.children(".fleet-back").unbind().bind("click",a.previousItem);d.children(".fleet-play-pause").unbind().bind("click",
a.togglePlay);d.children(".fleet-forward").unbind().bind("click",a.nextItem);$(".media-link").unbind().bind("click",a.setHash);l=$("#carousel-media-container");$(window).bind("keydown",a.routeKeys);b.listen("adjust",a.adjust,a)},adjust:function(a,b){q.css({top:(b-m-c.height())/2})},routeKeys:function(b){if(k.is(":visible"))switch(b.keyCode){case 37:a.previousItem();break;case 39:a.nextItem();break;case 27:window.location.hash=""}},setHash:function(a){var b="#!/"+$(this).attr("href").match(h)[1];window.location.hash=
b;a.preventDefault()},checkHash:function(b){b.path.replace(/^\/?!\//,"");var c=site_url+"_resources/ajax_interface/alias_lookup/"+i+b.path.replace(/\!\//,"");if(2>b.pathNames.length)return a.conceal(),!1;$.ajax({url:c,type:"get",dataType:"json",success:a.fetchMedia,timeout:5E3,error:a.error})},expose:function(){k.css({display:"block",opacity:0}).animateFix({opacity:1},function(){k.not("#cheeched-carousel").css("cursor","pointer").bind("click",a.goBack);o.unbind().bind("click",a.goBack)});$(window).trigger("resize")},
conceal:function(){k.stop().animateFix({opacity:0},function(){k.css({display:"none"}).unbind("click",a.killCheech);$("iframe").remove()})},goBack:function(){window.location.hash=""},fetchMedia:function(b){var d;a.expose();c.html(b.text?b.text:"&nbsp");"media_gallery"==b.type?(d=site_url+"_resources/ajax_interface/children/"+b.id+"/media/",$.ajax({url:d,type:"get",dataType:"json",success:function(c){a.prepMedia(b,c)},timeout:5E3,error:a.error})):a.prepMedia(b)},prepMedia:function(b,c){var f=0,h,g;
clearInterval(j);l.children().remove();l.html("");if("media_gallery"==b.type){if(f=c?c.length:0,c){for(h=0;h<f;h++){g=new Image;g.src=public_dir+c[h].path;if(0==h)g.className="active";l.append(g)}e=l.children("img");len=e.length;1<len&&(d.show(),j=setInterval(a.nextItem,5E3))}}else if("media_video"==b.type)f=document.createElement("iframe"),f.className="youtube-player",f.type="text/html",f.src="http://www.youtube.com/embed/"+b.vimeo_id+"",f.width=702,f.height=392,$(f).attr("frameborder",0),l.append(f),
d.hide()},previousItem:function(b){a.setCurrentIndex(f-1);b.preventDefault()},togglePlay:function(b){null===j?j=setInterval(a.nextItem,5E3):(clearInterval(j),j=null);b.preventDefault()},nextItem:function(b){b&&(clearInterval(j),j=null);a.setCurrentIndex(f+1);b&&b.preventDefault()},setCurrentIndex:function(b){if(g)return!1;g=!0;f=b;a.controlCurrentIndex();a.updateData()},controlCurrentIndex:function(){f>=len?f=0:0>f&&(f=len-1)},updateData:function(){var a=e.filter(".active"),b=e.eq(f);d.css("z-index",
99999999);a.css({position:"absolute",top:0,left:0,zIndex:0});b.css({position:"absolute",top:0,left:0,zIndex:10,opacity:0,display:"block"}).stop().animateFix({opacity:1},750,function(){a.css({position:"relative",zIndex:0,display:"none"}).removeClass("active");b.css({position:"relative",zIndex:1}).addClass("active");g=!1})},error:function(){a.conceal()},destroy:function(){SWFAddress.removeEventListener(SWFAddressEvent.CHANGE,a.checkHash)}}});
BRI.register("uses",function(){var b,a="uses_book"!=parent_type?page_url:parent_url,d=RegExp("^"+a+"(.+)$"),e=a.match(RegExp("^"+site_url+"(.+)$"))[1],c,f,g,h,i=0,l=!1,k,j;return{init:function(){b=this;k=$("#uses-carousel-info");k.children("h2");c=$("#uses-carousel");f=$("#uses-carousel-nav");b.bindGallery();2>c.find("li").length&&f.hide();$(".fleet-back").bind("click",b.prevItem);$(".fleet-play-pause").bind("click",b.togglePlay);$(".fleet-forward").bind("click",b.nextItem);$(".detailed-thumb-item").children("a").bind("click",
b.hijack);SWFAddress.addEventListener(SWFAddressEvent.CHANGE,b.routePath)},bindGallery:function(){g=c.children("li");h=g.length;i=0;clearInterval(j);1<h&&(j=setInterval(b.nextItem,3E3))},prevItem:function(a){b.setCurrentIndex(i-1);a.preventDefault()},togglePlay:function(a){null==j?(j=setInterval(b.nextItem,3E3),$(this).removeClass("inactive")):(clearInterval(j),j=null,$(this).addClass("inactive"));a.preventDefault()},nextItem:function(a){a&&(clearInterval(j),j=null);b.setCurrentIndex(i+1);a&&a.preventDefault()},
setCurrentIndex:function(a){if(l)return!1;i=a;b.controlCurrentIndex();b.updateData()},controlCurrentIndex:function(){i>=h?i=0:0>i&&(i=h-1)},updateData:function(){var a=g.filter(".active"),b=g.eq(i);l=!0;a.css({position:"absolute",top:0,left:0});b.css({position:"absolute",left:0,top:0,zIndex:10,display:"block",opacity:0}).animateFix({opacity:1},function(){a.css({position:"relative",display:"none"}).removeClass("active");b.css({position:"relative",zIndex:1}).addClass("active");l=!1})},routePath:function(a){var c=
site_url+"_resources/ajax_interface/alias_lookup/"+e+a.path.replace(/\!\//,""),d={};if(1>a.pathNames.length)return!1;d.url=c;d.type="get";d.dataType="json";d.success=b.onDataReceived;d.error=b.onDataError;d.timeout=5E3;$.ajax(d)},onDataReceived:function(a){var c={},d='<h2 class="age">'+a.name+"</h2>",d=d+a.text;k[0].innerHTML=d;window.document.title=a.meta_title?a.meta_title:a.name+" | Brilliant Transportation";$("#u"+a.id).addClass("active").siblings().removeClass("active");c.url=site_url+"_resources/ajax_interface/children/"+
a.id+"/media/";c.dataType="json";c.type="get";c.success=b.imagesReady;c.error=b.imagesError;c.timeout=5E3;$.ajax(c)},imagesReady:function(a){var d=a.length,e,h,g;c.children().remove();for(e=0;e<d;e++){h=a[e];g=new Image;g.src=public_dir+h.path;h=document.createElement("li");h.appendChild(g);if(0==e)h.className="active";c.append(h)}b.bindGallery();l=!1;f[1<d?"fadeIn":"fadeOut"]()},imagesError:function(){},onDataError:function(){},hijack:function(a){var b=$(this);b.parent("li");b="#!/"+b.attr("href").match(d)[1];
window.location.hash=b;$("html,body").animateFix({scrollTop:0},850);a.preventDefault()},destroy:function(){}}});
BRI.register("mail",function(b){var a,d,e,c,f,g;return{init:function(){a=this;e=$("#mail-cheech").css("cursor","pointer").bind("click",a.hide);$(".mail-close").bind("click",a.hide);d=$("#mail-modal");c=$(".mail-share-form");d.find('input[type="submit"]').bind("click",a.submit);$(".error").live("focus",function(){$(this).removeClass("error")});d.data({w:parseInt(d.css("width"),10),h:parseInt(d.css("height"),10)});f=$("#thankyou-bubble,.thankyou-green-bubble").hide();$(".email").bind("click",a.launchModal);
b.listen("adjust",a.adjust,a)},submit:function(b){if(a.validate()){var d=c.serialize(),e={type:"post",dataType:"json"};e.url=c[0].action;e.success=a.mailSent;e.error=a.mailError;e.timeout=5E3;e.data=d;$.ajax(e)}b.preventDefault()},validate:function(){var a=c.find('input[type="email"]'),b=/[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}/i,d=!0;c.find('input[type="text"],textarea').each(function(){var a=$(this);""==a.val()&&(d=!1,a.addClass("error"))});a.each(function(){var a=$(this);b.exec(a.val())||(d=!1,a.addClass("error"))});
return d},mailSent:function(b){!0==b&&(c.find("textarea,input").not('input[type="submit"]').val(""),a.thanks())},thanks:function(){d.animateFix({opacity:0},function(){d.css("display","none")});$("#thankyou-bubble").css({marginTop:0});$(window).trigger("resize");f.css({opacity:0,display:"inline-block"}).animateFix({opacity:1},function(){setTimeout(a.hide,2E3)})},mailError:function(){},hide:function(){d.animateFix({opacity:0},function(){d.css("display","none")});f.fadeOut();e.animateFix({opacity:0},
function(){e.css("display","none")})},launchModal:function(a){g=$(this).data("msg");messageField=d.find("#message");messageField.val(g);e.css({opacity:0,display:"block"}).animateFix({opacity:1});d.css({opacity:0,display:"block"}).animateFix({opacity:1});a.preventDefault()},adjust:function(a,b){d.css({left:(a-d.data("w"))/2,top:(b-d.data("h"))/2});f.css({left:(a-f.width())/2,top:(b-f.height())/2-90,margin:0})},destroy:function(){}}});
BRI.register("ajax-analytics",function(){var b,a=/.+\/ajax\_interface\//,d=/.+\/ajax\_interface\/alias\_lookup\/(.+)$/;return{init:function(){b=this;$(document).bind("ajaxSend",b.googleLog)},googleLog:function(b,c,f){"undefined"!==typeof _gaq&&null!==_gaq&&(a.exec(f.url)?d.exec(f.url)&&(url=d.exec(f.url)[1],_gaq.push(["_trackPageview","/"+url])):_gaq.push(["_trackPageview",f.url]))},destroy:function(){$(document).unbind("ajaxSend",b.googleLog)}}});
BRI.register("social-tracking",function(){var b;return{init:function(){b=this;if($("#blog"))return!1;(void 0).events.bind("tweet",b.trackTweet);FB.Event.subscribe("edge.create",b.FBlike);FB.Event.subscribe("edge.remove",b.FBunlike);FB.Event.subscribe("message.send",b.FBsend)},trackTweet:function(a){a&&(a.target&&"IFRAME"==a.target.nodeName&&(targetUrl=b.extractParamFromUri(a.target.src,"url")),_gaq.push(["_trackSocial","twitter","tweet",targetUrl]))},FBlike:function(a){_gaq.push(["_trackSocial","facebook",
"like",a])},FBunlike:function(a){_gaq.push(["_trackSocial","facebook","unlike",a])},FBsend:function(a){_gaq.push(["_trackSocial","facebook","send",a])},extractParamFromUri:function(a,b){if(a){var a=a.split("#")[0],e=a.split("?");if(1!=e.length)for(var e=decodeURI(e[1]),b=b+"=",e=e.split("&"),c=0,f;f=e[c];++c)if(0===f.indexOf(b))return unescape(f.split("=")[1])}},destroy:function(){(void 0).events.unbind("tweet",b.trackTweet)}}});
BRI.register("blog-social",function(){var b,a,d,e;return{init:function(){b=this;a=$(".post-social");d=$(".post-body");e=a.offset().top-20;$(window).bind("scroll",b.onScroll)},onScroll:function(){var b=$(window).scrollTop();a[b>e?"addClass":"removeClass"]("social-fixed");d[b>e?"addClass":"removeClass"]("no-social")},destroy:function(){$(window).unbind("scroll",b.onScroll)}}});
BRI.register("number-replacement",function(){var b,a,d,e,c;return{init:function(){b=this;a=$("#contact-numbers,#contact-numbers-short,#contact-header");d=a.children("li");d.find("span,h2,h3").css("opacity",0);c=$("#contact-footer").find(".age");$("#number-replacement");$(window).load(b.numberReady)},numberReady:function(){var a=$("#tag").text().match(/\(\d{3}\)\s\d{3}-\d{4}/)[0];e=a;$("#tag").html('<span class="callout">Call us:<span> '+e);if("(800) 543-1001"==a)return d.find("span,h2,h3").css("opacity",
1),!1;d.eq(0).find("span,h3").html(e);d.eq(2).find("span,h3").html(e);d.eq(1).find("span,h3").html(e);c.html(e);d.find("span,h2,h3").css("opacity",1)},destroy:function(){}}});$(function(){var b=$("body").data("modules").toLowerCase().replace(/\s/g,"").split(","),a;for(a in b)BRI.start(b[a]);BRI.start("adjust");BRI.start("mail");BRI.start("number-replacement");BRI.start("ajax-analytics");BRI.start("social-tracking");$(window).trigger("resize")});
