﻿function DoSlider() {    var theInt = null;    var $crosslink, $navthumb;    var curclicked = 0;    theInterval = function (cur) {        clearInterval(theInt);        if (typeof cur != 'undefined')            curclicked = cur;        $crosslink.removeClass("active-thumb");        $navthumb.eq(curclicked).parent().addClass("active-thumb");        $(".stripNav ul li a").eq(curclicked).trigger('click');        theInt = setInterval(function () {            $crosslink.removeClass("active-thumb");            $navthumb.eq(curclicked).parent().addClass("active-thumb");            $(".stripNav ul li a").eq(curclicked).trigger('click');            curclicked++;            if (7 == curclicked)                curclicked = 0;        }, 5500);    };    $(function () {        $("#main-photo-slider").codaSlider();        $navthumb = $(".nav-thumb");        $crosslink = $(".cross-link");        $navthumb.click(function () {            var $this = $(this);            theInterval($this.parent().attr('href').slice(1) - 1);            return false;        });        theInterval();    });}function MM_swapImgRestore() { //v3.0    var i, x, a = document.MM_sr; for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;}function MM_preloadImages() { //v3.0    var d = document; if (d.images) {        if (!d.MM_p) d.MM_p = new Array();        var i, j = d.MM_p.length, a = MM_preloadImages.arguments; for (i = 0; i < a.length; i++)            if (a[i].indexOf("#") != 0) { d.MM_p[j] = new Image; d.MM_p[j++].src = a[i]; }    }}function MM_findObj(n, d) { //v4.01    var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) {        d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);    }    if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];    for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);    if (!x && d.getElementById) x = d.getElementById(n); return x;}function formValidator() {    // Make quick references to our fields    var firstname = document.getElementById('firstname');    var lastname = document.getElementById('lastname');    var email = document.getElementById('email');    var zip = document.getElementById('zip');    // Check each input in the order that it appears in the form!    if (isAlphabet(firstname, "Please enter only letters for your name.") &&isAlphabet(lastname, "Please enter only letters for last name.") &&emailValidator(email, "Please enter a valid email address.") &&isNumeric(zip, "Please enter a valid zip code.")) {        return true;    }    return false;}function notEmpty(elem, helperMsg) {    if (elem.value.length == 0) {        alert(helperMsg);        elem.focus(); // set the focus to this input        return false;    }    return true;}function isNumeric(elem, helperMsg) {    var numericExpression = /^[0-9]+$/;    if (elem.value.match(numericExpression)) {        return true;    } else {        alert(helperMsg);        elem.focus();        return false;    }}function emailValidator(elem, helperMsg) {    var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;    if (elem.value.match(emailExp)) {        return true;    } else {        alert(helperMsg);        elem.focus();        return false;    }}function isAlphabet(elem, helperMsg) {    var alphaExp = /^[a-zA-Z']+$/;    if (elem.value.match(alphaExp)) {        return true;    } else {        alert(helperMsg);        elem.focus();        return false;    }}function MM_swapImage() { //v3.0    var i, j = 0, x, a = MM_swapImage.arguments; document.MM_sr = new Array; for (i = 0; i < (a.length - 2); i += 3) {        if ((x = MM_findObj(a[i])) != null) { document.MM_sr[j++] = x; if (!x.oSrc) x.oSrc = x.src; x.src = a[i + 2]; }    }}function Tabs(obj) {    var select = function (link) {        var div = $(link).attr("href");        if (div) {            $(obj).find('div.tab').hide();            $(obj).find('ul.tabnav li a').removeClass("selected");            $(link).addClass("selected");            $(div).show();        }        return false;    }    var onclick = function () { return select(this); };    var links = $(obj).find('ul.tabnav li a');    links.each(function (index) { $(this).click(onclick); });    select(links[0]);}$(function () {    $(".tabs").each(function () {        Tabs(this)    });});$(function () {    $("#BradsSchedule").fancybox({        'width': 890,        'height': 600,        'autoScale': false,        'transitionIn': 'none',        'transitionOut': 'none',        'type': 'iframe',        'showCloseButton': false    });    $("#terms").fancybox({        'width': 690,        'height': 600,        'autoScale': false,        'transitionIn': 'none',        'transitionOut': 'none',        'type': 'iframe',        'showCloseButton': false    });    $("#privacy").fancybox({        'width': 690,        'height': 340,        'autoScale': false,        'transitionIn': 'none',        'transitionOut': 'none',        'type': 'iframe',        'showCloseButton': false    });    $("#quotes").fancybox({        'width': 915,        'height': 600,        'autoScale': false,        'transitionIn': 'none',        'transitionOut': 'none',        'type': 'iframe',        'showCloseButton': false    });    $("#BradsTracks").fancybox({        'width': 915,        'height': 600,        'autoScale': false,        'transitionIn': 'none',        'transitionOut': 'none',        'type': 'iframe',        'showCloseButton': false    });});$(function () {    var addScript = function (url) {        var script = document.createElement("script");        script.type = "text/javascript";        script.src = url;        $('body').append(script);    }    if (document.getElementById("twitter_update_list")) {        addScript("http://twitter.com/javascripts/blogger.js");        addScript("http://twitter.com/statuses/user_timeline/bradccoleman.json?callback=twitterCallback2&count=1");    }        //heat map script    addScript("http://counter.goingup.com/track/heatmap/clickheat.js?st=mpzcsjp");    var img = new Image();    img.src = "http://counter.goingup.com/default.php?st=mpzcsjp&amp;b=5";});
